Data interaction method, device and equipment and readable storage medium
By building target variables in the storage area of BMC, the KCS register function is simulated to implement, and the problem that BMCs that do not support KCS hardware do not have KCS communication capabilities is solved, and the data interaction of the KCS protocol is realized, reducing the design difficulty and improving simplicity.
Patent Information
- Application Number
- CN202411997363.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-31
- Publication Date
- 2025-05-23
AI Technical Summary
The substrate management controller (BMC) that does not support KCS hardware does not have KCS communication capabilities and cannot interact with data based on the KCS protocol.
By building target variables in the storage area of BMC, including state variables, command variables and data variables, the KCS register function is simulated and the KCS protocol data interaction between the host and BMC is realized.
It provides KCS communication capabilities for BMCs that do not support KCS hardware, reducing the difficulty of BMC chip design and improving the simplicity of design.
Smart Images

Figure CN120029716A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of computer technology, and in particular to a data interaction method, device, electronic device, and readable storage medium. Background Art
[0002] The baseboard management controller (BMC) is a control module widely used on servers to remotely monitor the server, i.e. the host. The BMC and the server can exchange data through the hardware protocol KCS (Keyboard Controller Style).
[0003] Currently, the BMC includes registers (KCS registers) for implementing the KCS protocol. By reading and writing these registers, data can be exchanged between the server and the baseboard management controller.
[0004] However, in the current solution, if data is to be exchanged based on the KCS protocol, the BMC needs to have KCS registers. Without KCS registers, data exchange based on the KCS protocol cannot be performed. Therefore, a BMC that does not support KCS hardware does not have KCS communication capabilities. Summary of the invention
[0005] The embodiments of the present invention provide a data interaction method, device and electronic device, which can solve the problem that a BMC that does not support KCS hardware has no KCS communication capability, provide KCS communication capability for a BMC that does not support KCS hardware, and implement the KCS register function and corresponding read and write access of the BMC through software simulation that complies with the KCS protocol.
[0006] In order to solve the above problem, an embodiment of the present invention proposes a data interaction method, which is applied to a baseboard management controller, wherein the baseboard management controller is communicatively connected with a host, and the method includes:
[0007] Constructing target variables in a storage area of the baseboard management controller; the target variables include state variables, command variables and data variables;
[0008] In the case where the host writes a command to the command variable or writes data to the data variable, a preset value in the state variable is read; the preset value is used to indicate that it is written by the host and the write type is a command or data;
[0009] According to the preset value, the command variable or the data variable is read, and a corresponding data operation is performed.
[0010] Optionally, the target variable includes a first buffer variable, a second buffer variable, a third buffer variable and a fourth buffer variable; the storage area includes an output buffer and an input buffer, the first buffer variable and the second buffer variable are used to set a first bit of a simulation state register, and the third buffer variable and the fourth buffer variable are used to set a second bit of the simulation state register;
[0011] When the values of the first buffer variable and the second buffer variable are different, it indicates that the first bit is set and the output buffer is full; the first buffer variable and the second buffer variable are used to represent the head and tail of the output buffer respectively; the output buffer is full indicating that the baseboard management controller has written data for the host to read;
[0012] When the values of the third buffer variable and the fourth buffer variable are different, it indicates that the second bit is a set value and the input buffer is full; the third buffer variable and the fourth buffer variable are used to represent the head and tail of the input buffer respectively; the input buffer is full indicating that the host has written a command or data for the baseboard management controller to read;
[0013] The values of the first buffer variable and the fourth buffer variable are set by the baseboard management controller.
[0014] Optionally, the data variable includes a first data variable, and the first data variable is used to store target data obtained by executing the command;
[0015] The step of reading the command variable or the data variable according to the preset value and performing a corresponding data operation includes:
[0016] The preset value includes a first preset value, the first preset value indicating that the host has written a command in the command variable; when the first preset value is read, the second bit is a set value;
[0017] Reading the command variable to obtain the command, setting the second bit to a clear value by setting the value of the fourth buffer variable to the same value as the value of the third buffer variable, wherein the clear value is used to indicate that the input buffer is empty, and the input buffer being empty indicates that the baseboard management controller has obtained the command;
[0018] Execute the command to obtain the target data indicated by the command in the storage area, and write the target data into the first data variable; the first data variable is used to store the target data for the host to read;
[0019] The first bit is set to a set value by setting the value of the first buffer variable to a value different from the value of the second buffer variable.
[0020] Optionally, the data variable includes a second data variable, and the second data variable is used to store data written by the host;
[0021] The step of reading the command variable or the data variable according to the preset value and performing a corresponding data operation includes:
[0022] The preset value includes a second preset value, the second preset value indicates that the host has written data in the second data variable; when the second preset value is read, the second bit is a set value;
[0023] Reading the second data variable to obtain the data;
[0024] The second bit is set to a clear value by setting the value of the fourth buffer variable to the same value as the value of the third buffer variable; the clear value is used to indicate that the input buffer is empty, and the input buffer being empty means that the baseboard management controller has acquired the data.
[0025] In a second aspect, an embodiment of the present invention further provides a data interaction method, which is applied to a host, wherein the host is communicatively connected to a baseboard management controller, and the method includes:
[0026] Writing a command to a command variable of the baseboard management controller, or writing data to a data variable of the baseboard management controller; a target variable is constructed in a storage area of the baseboard management controller; the target variable includes a state variable, the command variable and the data variable;
[0027] When a command is written to the command variable or data is written to the data variable, the state variable is set to a different preset value; the preset value is used to indicate that it is written by the host and the write type is a command or data; so that the baseboard management controller reads the preset value in the state variable, and according to the preset value, reads the command variable or the data variable and performs corresponding data operations.
[0028] Optionally, the target variable includes a first buffer variable, a second buffer variable, a third buffer variable and a fourth buffer variable; the storage area includes an output buffer and an input buffer, the first buffer variable and the second buffer variable are used to set a first bit of a simulation state register, and the third buffer variable and the fourth buffer variable are used to set a second bit of the simulation state register;
[0029] When the values of the first buffer variable and the second buffer variable are different, it indicates that the first bit is set and the output buffer is full; the first buffer variable and the second buffer variable are used to represent the head and tail of the output buffer respectively; the output buffer is full indicating that the baseboard management controller has written data for the host to read;
[0030] When the values of the third buffer variable and the fourth buffer variable are different, it indicates that the second bit is a set value and the input buffer is full; the third buffer variable and the fourth buffer variable are used to represent the head and tail of the input buffer respectively; the input buffer is full indicating that the host has written a command or data for the baseboard management controller to read;
[0031] The values of the second buffer variable and the third buffer variable are set by the host.
[0032] Optionally, the step of setting the state variable to a different preset value when writing a command to the command variable or writing data to the data variable comprises:
[0033] In case of writing a command to the command variable, setting a first preset value in the state variable;
[0034] In case of writing data to the data variable, setting a second preset value in the state variable;
[0035] The second bit is set to a set value by setting the value of the third buffer variable to a value different from the value of the fourth buffer variable.
[0036] Optionally, the data variable includes a first data variable and a second data variable; the first data variable is used to store data written by the baseboard management controller for reading by the host; the second data variable is used to save data written by the host to the baseboard management controller;
[0037] The method further comprises:
[0038] When the first bit is a set value, reading data in the first data variable; wherein the first bit is set to a set value by the baseboard management controller when the first data variable is written;
[0039] The first bit is set to a clear value by setting the value of the second buffer variable to the same value as the value of the first buffer variable.
[0040] In a third aspect, an embodiment of the present invention provides a data interaction device, which is applied to a baseboard management controller, wherein the baseboard management controller is communicatively connected to a host, and the device includes:
[0041] A variable construction module, used to construct target variables in the storage area of the baseboard management controller; the target variables include state variables, command variables and data variables;
[0042] A state identification module, used for reading a preset value in the state variable when the host writes a command to the command variable or writes data to the data variable; the preset value is used to indicate that it is written by the host and the write type is a command or data;
[0043] The reading module is used to read the command variable or the data variable according to the preset value and perform corresponding data operations.
[0044] In a fourth aspect, an embodiment of the present invention provides a data interaction device, which is applied to a host, wherein the host is communicatively connected to a baseboard management controller, and the device includes:
[0045] A writing module, used to write commands to the command variables of the baseboard management controller, or write data to the data variables of the baseboard management controller; target variables are constructed in the storage area of the baseboard management controller; the target variables include state variables, the command variables and the data variables;
[0046] A state setting module is used to set the state variable to different preset values when a command is written to the command variable or data is written to the data variable; the preset value is used to indicate that it is written by the host and the write type is command or data; so that the baseboard management controller reads the preset value in the state variable, reads the command variable or the data variable according to the preset value, and performs corresponding data operations.
[0047] In a fifth aspect, an embodiment of the present invention further proposes an electronic device, comprising a memory and one or more programs, wherein the one or more programs are stored in the memory and are configured to be executed by one or more processors to perform the aforementioned data interaction method.
[0048] An embodiment of the present invention further provides a readable storage medium. When instructions in the storage medium are executed by a processor of an electronic device, the electronic device can execute the aforementioned data interaction method.
[0049] The embodiments of the present invention include the following advantages:
[0050] The data interaction method provided by the embodiment of the present invention constructs a target variable in the storage area of a baseboard management controller; the target variable includes a state variable, a command variable and a data variable; when a host writes a command to the command variable or writes data to the data variable, reads a preset value in the state variable, reads the command variable or the data variable according to the preset value, and performs a corresponding data operation. This method can effectively avoid the situation that data interaction based on the KCS protocol can only be realized when there is a KCS register in the baseboard management controller, provides KCS communication capability for a BMC that does not support KCS hardware, simulates and realizes the KCS register function and corresponding read and write access of the BMC, reduces the design difficulty of the BMC chip on the basis of realizing the KCS function, and improves the design simplicity of the BMC chip because KCS communication can be realized without the KCS register. BRIEF DESCRIPTION OF THE DRAWINGS
[0051] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings required for describing the embodiments of the present invention are briefly introduced below.
[0052] Figure 1 is a flow chart of steps of an embodiment of a data interaction method of the present invention;
[0053] Figure 2 It is a structural schematic diagram of a host and a baseboard management controller of the present invention;
[0054] Figure 3 is a flowchart of another data interaction method embodiment of the present invention;
[0055] Figure 4 is a structural block diagram of an embodiment of a data interaction device of the present invention;
[0056] Figure 5 is a structural block diagram of another data interaction device embodiment of the present invention;
[0057] Figure 6 It is a structural block diagram of an electronic device for data interaction provided by an example of the present invention. DETAILED DESCRIPTION
[0058] The technical solutions in the embodiments of the present invention will be described clearly and completely below in conjunction with the accompanying drawings in the embodiments of the present invention.
[0059] Method Embodiment
[0060] Reference Figure 1 , shows a flow chart of steps of a data interaction method embodiment of the present invention, which is applied to a baseboard management controller, the baseboard management controller is in communication connection with a host, and the method comprises:
[0061] Step 101, constructing target variables in the storage area of the baseboard management controller; the target variables include state variables, command variables and data variables;
[0062] Step 102, when the host writes a command to the command variable or writes data to the data variable, read a preset value in the state variable; the preset value is used to indicate that it is written by the host and the write type is command or data;
[0063] Step 103, reading the command variable or the data variable according to the preset value, and performing corresponding data operations.
[0064] It should be noted that, currently, in order for the BMC to exchange data with the host through the KCS protocol, it is necessary to design multiple registers in the BMC chip for implementing the KCS protocol, and the host and BMC read and write these registers to implement data interaction based on the KCS protocol. Among them, the KCS registers may include a status register (status), a command register (command), a first data register (data_in), and a second data register (data_out), as shown in Table 1 below:
[0065] Table 1
[0066]
[0067] The status register includes 8 bits, and the bits of the status register can be used to represent multiple data interaction states, as shown in Table 2 below:
[0068] Table 2
[0069]
[0070] The bit of the input buffer full (IBF) is 1, indicating that the host has written the command register or the first data register; the bit of the output buffer full (OBF) is 1, indicating that the BMC has written the second data register. The data written to the first data register can be finally stored in the input buffer, and the data written to the second data register can be finally stored in the output buffer.
[0071] In addition, the KCS protocol stipulates that the command register and the first data register are written by the host and read by the BMC, and the second data register is written by the BMC and read by the host.
[0072] In an embodiment of the present invention, the BMC can be connected to the host based on a high-speed serial computer expansion bus standard interface (PCIE, Peripheral Component Interconnect Express), and the BMC can be connected to the PCIE bus based on an endpoint (EP, Endpoint) mode, and can receive requests from a root endpoint or other devices and perform data transmission.
[0073] In a storage area of the BMC, such as a PCIE memory, multiple target variables may be constructed based on multiple memory addresses. The multiple target variables may include a state variable, a command variable, and a data variable, which are respectively used to implement at least part of the functions of the state register, the command register, the first data register, and the second data register.
[0074] Figure 2 is a schematic diagram of the structure of a host and a baseboard management controller provided by an embodiment of the present invention; Figure 2 The system includes a host 21, a baseboard management controller 22 connected to the host 21, and a memory 221 in the baseboard management controller 22. State variables 2211, command variables 2212, and data variables 2213 are constructed in the memory 221.
[0075] The host can write commands to the command variables of the BMC, or write data to the data variables of the BMC. The host can also set the value written in the state variable according to the specific writing situation, such as writing commands or writing data. The written value can be set to the preset value 1, indicating that the host has written a command, and the written value can be set to the preset value 0, indicating that the host has written data.
[0076] For the command variable (used to implement the command register), the logic of Table 3 may be as follows:
[0077] Table 3
[0078] Code Name Description 60h GET_STATUS / ABORT Request interface status, stop current operation 61h WRITE_START Write start 62h WRITE_END Write end 63h - 67h Reserved 68h READ Request next data 69h - 6fh Reserved
[0079] Writing 60h to the command variable indicates checking the KCS status, such as the idle state (IDLE_STATE) or abandoning the operation; writing 61h (WRITE_START) indicates starting to write, and writing 62h (WRITE_END) to the command variable indicates that the writing has been completed. Writing 68h (READ) to the command variable indicates requesting the next data, i.e. reading data from the device.
[0080] BMC can choose to read command variables or data variables according to preset values. BMC can read command variables to obtain commands and perform data operations indicated by the commands. For example, the command can be a data acquisition command, indicating that the host needs to obtain data from the BMC, then the BMC can perform a data acquisition operation according to the command to obtain the corresponding data and provide it to the host. The host can send data to the BMC, and the BMC can obtain the corresponding data. Then, after writing the data to the data variable, the BMC can perform a data read operation to read the data in the data variable.
[0081] Optionally, the target variable includes a first buffer variable, a second buffer variable, a third buffer variable and a fourth buffer variable; the storage area includes an output buffer and an input buffer, the first buffer variable and the second buffer variable are used to set a first bit of a simulation state register, and the third buffer variable and the fourth buffer variable are used to set a second bit of the simulation state register;
[0082] When the values of the first buffer variable and the second buffer variable are different, it indicates that the first bit is set and the output buffer is full; the first buffer variable and the second buffer variable are used to represent the head and tail of the output buffer respectively; the output buffer is full indicating that the baseboard management controller has written data for the host to read;
[0083] When the values of the third buffer variable and the fourth buffer variable are different, it indicates that the second bit is a set value and the input buffer is full; the third buffer variable and the fourth buffer variable are used to represent the head and tail of the input buffer respectively; the input buffer is full indicating that the host has written a command or data for the baseboard management controller to read;
[0084] The values of the first buffer variable and the fourth buffer variable are set by the baseboard management controller.
[0085] In an embodiment of the present invention, the target variable in the storage area may also include a first buffer variable, a second buffer variable, a third buffer variable and a fourth buffer variable, the first buffer variable and the second buffer variable are used to set the first bit of the simulation status register, and the third buffer variable and the fourth buffer variable are used to set the second bit of the simulation status register.
[0086] Among them, the status register is a register required in kcs communication, and the first bit and the second bit of the status register can be the bits corresponding to OBF and IBF.
[0087] The value of the first bit can be determined according to the first buffer variable and the second buffer variable, and the first buffer variable and the second buffer variable are used to represent the head and tail of the output buffer, respectively. The state of the buffer can be used to control the data transmission process, and the state of the buffer can be determined by the head and tail of the buffer.
[0088] When the values of the first buffer variable and the second buffer variable are different, it can indicate that the output buffer is full, and the corresponding first bit value is a set value, such as 1; when the values of the first buffer variable and the second buffer variable are the same, it indicates that the output buffer is empty, and the corresponding first bit value is a clear value, such as 0.
[0089] The value of the second bit can also be determined based on the third buffer variable and the fourth buffer variable. The third buffer variable and the fourth buffer variable can also be used to indicate the head and tail of the input buffer. When the values of the third buffer variable and the fourth buffer variable are different, it indicates that the value of the second bit is a set value, i.e., 1, which can also indicate that the input buffer is full. The rest will not be elaborated.
[0090] It should be noted that the first buffer variable and the second buffer variable are used to represent the head and tail of the output buffer; the third buffer variable and the fourth buffer variable are used to represent the head and tail of the input buffer. However, the first buffer variable and the fourth buffer variable can be set by the BMC, and the second buffer variable and the third buffer variable can be set by the host. That is, the BMC and the host set different buffer variables respectively, and the BMC and the host can read the values of the variables set by the other party, that is, the host and the BMC have unidirectional access to each variable (read or write), so that the BMC and the host can set the status of the first buffer area and the second buffer area at the same time.
[0091] When the values of the first buffer variable and the fourth buffer variable are set by the baseboard management controller, the first buffer variable is an output buffer head and the fourth buffer variable is an input buffer tail.
[0092] For example, the first buffer variable can be represented as obfh, the second buffer variable can be represented as obft, the third buffer variable can be represented as ibfh, and the fourth buffer variable can be represented as ibft. Then the read and write logic is: ibfh: host write, BMC read; ibft: host read, BMC write; obfh: host read, BMC write; obft: host write, BMC read.
[0093] The first bit and the second bit set by the above buffer variable may not be bits of a real state register, but are used to simulate the first bit and the second bit of the real state register, namely OBF and IBF, so as to construct a simulated state register. The simulated state register may also include other simulated bits, such as the bits corresponding to "C / D" in the real state register, "C" represents command, and "D" represents data. When the value of bit 3 in the simulated state register is 1, the corresponding "C / D" of the real state register is 1, indicating that a command is written; when the value of bit 3 in the simulated state register is 0, the corresponding "C / D" of the real state register is 0, indicating that data is written.
[0094] By implementing the embodiments of the present invention, the bits of the simulated status register can be set by constructing multiple buffer variables, and the bits in the simulated status register are set by the buffer variables, so that the bits in the simulated status register can have the same function as the bits in the real status register, indicating the buffer status. The other bits in the simulated status register are also similar, and then when communicating based on the KCS protocol, the status register function and corresponding read and write access of the BMC are simulated, and the real status register is no longer needed, which improves the convenience of data interaction based on the KCS protocol, reduces the design difficulty of the BMC chip on the basis of realizing the status register function, and improves the design simplicity of the BMC chip.
[0095] Optionally, the data variable includes a first data variable, and the first data variable is used to store target data obtained by executing the command;
[0096] The step 103, reading the command variable or the data variable according to the preset value and performing corresponding data operations, includes:
[0097] The preset value includes a first preset value, the first preset value indicating that the host has written a command in the command variable; when the first preset value is read, the second bit is a set value;
[0098] Reading the command variable to obtain the command, setting the second bit to a clear value by setting the value of the fourth buffer variable to the same value as the value of the third buffer variable, wherein the clear value is used to indicate that the input buffer is empty, and the input buffer being empty indicates that the baseboard management controller has obtained the command;
[0099] Execute the command to obtain the target data indicated by the command in the storage area, and write the target data into the first data variable; the first data variable is used to store the target data for the host to read;
[0100] The first bit is set to a set value by setting the value of the first buffer variable to a value different from the value of the second buffer variable.
[0101] In the embodiment of the present invention, the first preset value may include the value of the second bit and the value of the bit C / D.
[0102] The data variable may include a first data variable, and the first data variable is used to store target data obtained after executing a host write command.
[0103] In an embodiment of the present invention, when the second bit, i.e., the simulated IBF bit, is set to a value such as 1, it indicates that the host has written to a command register or a data register, and an interrupt is triggered at this time. The host can send an interrupt signal, and when the BMC obtains the interrupt signal through the PCIE interface, it triggers the preset value of the read state variable. After receiving the interrupt signal, the BMC can call the registered kcs_bmc_handle_event function of the linux kernel (an open source kernel with a modular structure) through the driver, and read and write various variables through the kcs_bmc_handle_event function. The code that implements the communication logic between the BMC and the host is in the kcs_bmc_handle_event function.
[0104] The second bit is a set value, and after the interrupt is triggered, the BMC can start reading the command variable or the data variable. After the BMC reads, the second bit can be cleared, and the second bit can be set to a clear value such as 0 by setting the value of the fourth buffer variable to be the same as the value of the third buffer variable, so that when the host writes the command variable or the data variable again, the second bit can be set to the set value to trigger the interrupt.
[0105] The BMC reads the command in the command variable. By setting the value of the fourth buffer variable to the same value as the value of the third buffer variable, the second bit is set to a clear value, wherein the clear value is used to indicate that the input buffer is empty, and the input buffer is empty indicating that the baseboard management controller (BMC) has obtained the command. Execute the command, the command may be a data acquisition command, the data acquisition command may carry information such as a data name and a data address, and the BMC may obtain the target data indicated by the command through this information, and write the target data into the first data variable. The first data variable may be used to simulate the second data register (data_out), the first data variable is written by the BMC and read by the host, so that the host reads the data of the BMC.
[0106] When the command execution is completed and the target data is written into the first data variable, the BMC can notify the host to read the data. The BMC can set the value of the first buffer variable to a value different from the value of the second buffer variable, thereby setting the first bit to a set value. When the target data is written into the first data variable, that is, the output buffer is full, the BMC can read the value of the second buffer variable, set the value of the first buffer variable to a value different from the value of the second buffer variable, thereby making the head and tail of the output buffer different, thereby setting the value of the first bit to a set value, indicating that the output buffer is full, and notifying the host to read the data.
[0107] Optionally, the data variable includes a second data variable, and the second data variable is used to store data written by the host;
[0108] The step 103, reading the command variable or the data variable according to the preset value and performing the corresponding data operation, includes:
[0109] The preset value includes a second preset value indicating that the write type is data, and the second preset value indicates that the host has written data into the second data variable; when the second preset value is read, the second bit is a set value;
[0110] Reading the second data variable to obtain the data;
[0111] The second bit is set to a clear value by setting the value of the fourth buffer variable to the same value as the value of the third buffer variable; the clear value is used to indicate that the input buffer is empty, and the input buffer being empty means that the baseboard management controller has acquired the data.
[0112] In the embodiment of the present invention, the second preset value may include the value of the second bit and the value of the bit C / D.
[0113] Similarly, when the second bit is set, an interrupt is triggered, and the BMC performs a data read operation to read the data written by the host stored in the second data variable. Then, the value of the fourth buffer variable is set to the same value as the value of the third buffer variable, so that the second bit is set to a clear value to indicate that the input buffer is empty, and the input buffer is empty, which means that the baseboard management controller has obtained the data written by the host into the second data variable.
[0114] In summary, the KCS register structure implemented in memory can be as follows:
[0115] typedef struct kcs_reg{
[0116] uint8 command_reg; / *host write, bmc read* / command variable
[0117] uint8 status_reg; / *host read, bmc write* / analog status register;
[0118] uint8 data_in_reg; / *host write, bmc read* / first data variable;
[0119] uint8 data_out_reg; / *host read, bmc write* / second data variable;
[0120] uint8 ibfh; / *host write, bmc read* / the third buffer variable;
[0121] uint8 ibft; / *host read, bmc write* / the fourth buffer variable;
[0122] uint8 obfh; / *host read, bmc write* / first buffer variable;
[0123] uint8 obft; / *host write, bmc read* / second buffer variable;
[0124] uint8 cmd_data; / *host write, bmc read* / status variable;
[0125] }IPMIKCS.
[0126] As an embodiment, a structure can be constructed in the PCIE shared memory, the structure including target variables, the target variables including status variables, command variables and data variables, which are used to simulate a status register (status), a command register (command), a first data register (data_in) and a second data register (data_out).
[0127] In addition, two data state variables may be included to simulate bit 6 and bit 7 in the status register, namely S0 and S1. Based on the data state variables, it may be further determined whether the BMC is in an idle state, a data sending state, or a data receiving state.
[0128] The BMC can set the values of the first buffer variable and the fourth buffer variable. If the output buffer is full, the BMC can read the value of the second buffer variable and set the value of the first buffer variable to a value different from the value of the second buffer variable, thereby making the head and tail of the output buffer different, indicating that the value of the first bit is a set value, indicating that the output buffer is full.
[0129] It is understandable that the second buffer variable can be set by the host, so the host can also set the second buffer variable accordingly by reading the value of the first buffer variable, so that the value of the second buffer variable is different from that of the first buffer variable (indicating that the output buffer is full) or the same as that of the first buffer variable (indicating that the output buffer is empty), thereby changing the first bit. The state control of the input buffer is similar and will not be repeated.
[0130] It can be understood that the first bit is the OBF bit, which indicates that the BMC has written data in the second data register. Therefore, after the data is written, the BMC sets the value of the first buffer variable to a value different from the value of the second buffer variable, thereby making the first bit 1, indicating that the BMC has finished writing the data. The host can read the value of the first bit. When the first bit is 1, it can be known that the BMC has finished writing the data, and the host starts to obtain the data.
[0131] The second bit corresponds to the IBF bit, which is used to indicate whether the host has written the command register or the data register. The host can set the second bit to 1, indicating that the input buffer is full and the host has written the command register or the data register, and the BMC can read the command register or the data register. After the BMC obtains the data of the command register or the data register, it can similarly read the value of the third buffer variable and then set the value of the fourth buffer variable to set the second bit to 0, indicating that the data has been obtained. When the host reads that the second bit is 0, it can be known that the input buffer is empty and can continue to write the command register or the data register.
[0132] For example, when the four buffer variables are obfh, obft, ibfh, and ibft, the bit setting logic of the analog status register is:
[0133] The host sets ibf to 1 as ibfh=!ibft, which means that the host sets ibfh to the opposite value of ibft, so that ibfh is not equal to ibft, so that the second bit IBF is 1;
[0134] The BMC sets ibf to 0 to achieve ibft=ibfh; this means that the BMC sets ibft to the value of ibfh, thereby making ibft equal to ibfh, so that the second bit IBF is 0;
[0135] The BMC sets obf to 1 to achieve obfh =! obft; which means that the BMC sets obfh to the opposite value of obft, thereby making obfh not equal to obft, so that the first bit of obf is 1;
[0136] The host sets obf to 0 to implement obft=obfh; it means that the host sets obft to the value of obfh, thereby making obft equal to obfh, so that the first bit of obf is 0.
[0137] The above logic can be expressed as:
[0138] obf = obfh! = obft;
[0139] ibf = ibfh! = ibft;
[0140] status_reg_logic=(status_reg&~0xb)|obf|(ibf<<1)|(cmd_data<<3);
[0141] In the above code, the first line compares obfh and obft for inequality (logical comparison), and assigns the result (Boolean value, true or false, 1 for true and 0 for false) to the obf variable; the second line compares ibfh and ibft for inequality, and then assigns the result to the ibf variable; the third line, (status_reg&~0xb), performs a bitwise AND operation on the status_reg variable and the bitwise inverted value of 0xb, and then uses a bitwise OR operation to combine the value of obf, the result of ibf shifted left by one bit, and the result of cmd_data (C / D) shifted left by three bits, in turn, and finally assigns this combined value to the status_reg_logic variable, which is used to update or construct the logic value of the status register.
[0142] By implementing the embodiments of the present invention, the state representation function of the OBF and IBF bits of the status register can be realized based on the buffer variables constructed in the memory. Through the simulated OBF and IBF bits, data interaction can be performed in an orderly manner even without a real status register.
[0143] Figure 3 1 is a flowchart of another data interaction method embodiment of the present invention; the data interaction method is applied to a host, the host and the baseboard management controller are in communication connection, and the method includes:
[0144] Step 301, writing a command to a command variable of the baseboard management controller, or writing data to a data variable of the baseboard management controller; a target variable is constructed in a storage area of the baseboard management controller; the target variable includes a state variable, the command variable and the data variable;
[0145] Step 302, when writing a command to the command variable or writing data to the data variable, setting the state variable to a different preset value; the preset value is used to indicate that it is written by the host and the write type is a command or data; the baseboard management controller is used to read the preset value in the state variable, read the command variable or the data variable according to the preset value, and perform corresponding data operations.
[0146] In an embodiment of the present invention, target variables have been constructed in the storage area of the baseboard management controller; the target variables include state variables, command variables and data variables, the host can write commands to the command variables, or write data to the data variables, and set the state variables to different preset values according to whether the commands or data are written, and the preset values are used to indicate that the host has written a command or written data.
[0147] The baseboard management controller can read the preset value in the state variable, read the command variable or the data variable according to the preset value, and perform the corresponding data operation.
[0148] The host is, for example, a server, and the server can also read and write variables in various memories to communicate with the BMC. For example, the server can call the registered ipmi_kcs_sm function through the driver to implement the communication logic between the host and the BMC. In the ipmi_kcs_sm function, the ipmi_kcs_sm function is executed to execute the actions that the host needs to perform, including the writing of commands or data, the setting of preset values of state variables, and / or the setting of buffer variables, etc., so as to communicate with the BMC through KCS.
[0149] For details of steps 301 to 302, please refer to Figures 1 - 2 The embodiments of the present invention will not be described in detail.
[0150] Optionally, the target variable includes a first buffer variable, a second buffer variable, a third buffer variable and a fourth buffer variable; the storage area includes an output buffer and an input buffer, the first buffer variable and the second buffer variable are used to set a first bit of a simulation state register, and the third buffer variable and the fourth buffer variable are used to set a second bit of the simulation state register;
[0151] When the values of the first buffer variable and the second buffer variable are different, it indicates that the first bit is set and the output buffer is full; the first buffer variable and the second buffer variable are used to represent the head and tail of the output buffer respectively; the output buffer is full indicating that the baseboard management controller has written data for the host to read;
[0152] When the values of the third buffer variable and the fourth buffer variable are different, it indicates that the second bit is a set value and the input buffer is full; the third buffer variable and the fourth buffer variable are used to represent the head and tail of the input buffer respectively; the input buffer is full indicating that the host has written a command or data for the baseboard management controller to read;
[0153] The second buffer variable and the third buffer variable are set by the host.
[0154] In the embodiment of the present disclosure, among the first buffer variable, the second buffer variable, the third buffer variable and the fourth buffer variable, the values of the second buffer variable and the third buffer variable are set by the host, and the values of the first buffer variable and the fourth buffer variable are set by the BMC. The host and the BMC set the first bit and the second bit based on the buffer variables that can be set by each. For other contents, please refer to the above. Figures 1 - 2 The embodiments of the present invention will not be described in detail.
[0155] Optionally, the step of setting the state variable to a different preset value when writing a command to the command variable or writing data to the data variable includes:
[0156] In case of writing a command to the command variable, setting a first preset value in the state variable;
[0157] In case of writing data to the data variable, setting a second preset value in the state variable;
[0158] The second bit is set to a set value by setting the value of the third buffer variable to a value different from the value of the fourth buffer variable.
[0159] In the disclosed embodiment, the host can write a command to a command variable and set a first preset value in a state variable to inform the BMC that the command variable needs to be read. The host can write data to a data variable and set a second preset value in the state variable to inform the BMC that the data variable needs to be read.
[0160] The value of the third buffer variable is set to a value different from the value of the fourth buffer variable, so as to set the second bit to a set value, thereby triggering an interrupt. For other contents, please refer to the above. Figures 1 - 2The embodiments of the present invention will not be described in detail.
[0161] Optionally, the data variable includes a first data variable and a second data variable; the first data variable is used to store data written by the baseboard management controller for reading by the host; the second data variable is used to save data written by the host to the baseboard management controller;
[0162] The method further comprises:
[0163] When the first bit is a set value, reading data in the first data variable; wherein the first bit is set to a set value by the baseboard management controller when the first data variable is written;
[0164] The first bit is set to a clear value by setting the value of the second buffer variable to the same value as the value of the first buffer variable.
[0165] The first bit indicates the state of the output buffer. If the BMC writes data to the first data variable, the BMC can set the first bit to a set value. When the first bit is a set value, it means that the output buffer is full, that is, the BMC has written data, and the host can read the data in the first data variable. For other content, please refer to the above. Figures 1 - 2 The embodiments of the present invention will not be described in detail.
[0166] In summary, the data interaction method provided by the embodiment of the present invention constructs a target variable in the storage area of the baseboard management controller; the target variable includes a state variable, a command variable and a data variable; when the host writes a command to the command variable or writes data to the data variable, reads the preset value in the state variable, reads the command variable or the data variable according to the preset value, and performs the corresponding data operation. This can effectively avoid the situation that data interaction based on the KCS protocol can only be realized when there is a KCS register in the baseboard management controller, provides KCS communication capability for BMC that does not support KCS hardware, simulates and realizes the KCS register function and corresponding read and write access of the BMC, reduces the design difficulty of the BMC chip on the basis of realizing the KCS function, and improves the design simplicity of the BMC chip because KCS communication can be realized without the KCS register.
[0167] It should be noted that, for the sake of simplicity, the method embodiments are described as a series of action combinations, but those skilled in the art should be aware that the embodiments of the present invention are not limited by the order of the actions described, because according to the embodiments of the present invention, certain steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should also be aware that the embodiments described in the specification are all preferred embodiments, and the actions involved are not necessarily required by the embodiments of the present invention.
[0168] Device Embodiment
[0169] Reference Figure 4 , shows a structural block diagram of an embodiment of a data interaction device of the present invention, which is applied to a baseboard management controller, the baseboard management controller is communicatively connected with a host, and the device comprises:
[0170] A variable construction module 401 is used to construct target variables in the storage area of the baseboard management controller; the target variables include state variables, command variables and data variables;
[0171] A state identification module 402 is used to read a preset value in the state variable when the host writes a command to the command variable or writes data to the data variable; the preset value is used to indicate that it is written by the host and the write type is command or data;
[0172] The reading module 403 is used to read the command variable or the data variable according to the preset value and perform corresponding data operations.
[0173] Optionally, the target variable includes a first buffer variable, a second buffer variable, a third buffer variable and a fourth buffer variable; the storage area includes an output buffer and an input buffer, the first buffer variable and the second buffer variable are used to set a first bit of a simulation state register, and the third buffer variable and the fourth buffer variable are used to set a second bit of the simulation state register;
[0174] When the values of the first buffer variable and the second buffer variable are different, it indicates that the first bit is set and the output buffer is full; the first buffer variable and the second buffer variable are used to represent the head and tail of the output buffer respectively; the output buffer is full indicating that the baseboard management controller has written data for the host to read;
[0175] When the values of the third buffer variable and the fourth buffer variable are different, it indicates that the second bit is a set value and the input buffer is full; the third buffer variable and the fourth buffer variable are used to represent the head and tail of the input buffer respectively; the input buffer is full indicating that the host has written a command or data for the baseboard management controller to read;
[0176] The values of the first buffer variable and the fourth buffer variable are set by the baseboard management controller.
[0177] Optionally, the data variable includes a first data variable, and the first data variable is used to store target data obtained by executing the command;
[0178] The reading module comprises:
[0179] A state identification submodule, configured to include a first preset value in the preset value, wherein the first preset value indicates that the host has written a command in the command variable; when the first preset value is read, the second bit is a set value;
[0180] A reading submodule, used for reading the command variable to obtain the command;
[0181] a clearing submodule, configured to set the second bit to a clear value by setting the value of the fourth buffer variable to the same value as the value of the third buffer variable, wherein the clear value is used to indicate that the input buffer is empty, and the input buffer being empty indicates that the baseboard management controller has obtained the command;
[0182] an execution submodule, configured to execute the command to obtain target data indicated by the command in the storage area, and write the target data into the first data variable; the first data variable is used to store the target data for the host to read;
[0183] The setting submodule is configured to set the first bit to a set value by setting the value of the first buffer variable to a value different from the value of the second buffer variable.
[0184] Optionally, the data variable includes a second data variable, and the second data variable is used to store data written by the host;
[0185] The reading module comprises:
[0186] A state identification submodule, configured to include a second preset value in the preset value, wherein the second preset value indicates that the host has written data in the second data variable; when the second preset value is read, the second bit is a set value;
[0187] A reading submodule, used for reading the second data variable to obtain the data;
[0188] A clearing submodule is used to set the second bit to a clear value by setting the value of the fourth buffer variable to the same value as the value of the third buffer variable; the clear value is used to indicate that the input buffer is empty, and the input buffer being empty indicates that the baseboard management controller has acquired the data.
[0189] Reference Figure 5 , shows a structural block diagram of another data interaction device embodiment of the present invention; applied to a host, the host and the baseboard management controller are in communication connection, and the device includes:
[0190] A writing module 501 is used to write a command to a command variable of the baseboard management controller, or to write data to a data variable of the baseboard management controller; a target variable is constructed in a storage area of the baseboard management controller; the target variable includes a state variable, the command variable and the data variable;
[0191] The status setting module 502 is used to set the status variable to a different preset value when a command is written to the command variable or data is written to the data variable; the preset value is used to indicate that it is written by the host and the write type is a command or data; so that the baseboard management controller reads the preset value in the status variable, reads the command variable or the data variable according to the preset value, and performs corresponding data operations.
[0192] Optionally, the target variable includes a first buffer variable, a second buffer variable, a third buffer variable and a fourth buffer variable; the storage area includes an output buffer and an input buffer, the first buffer variable and the second buffer variable are used to set a first bit of a simulation state register, and the third buffer variable and the fourth buffer variable are used to set a second bit of the simulation state register;
[0193] When the values of the first buffer variable and the second buffer variable are different, it indicates that the first bit is set and the output buffer is full; the first buffer variable and the second buffer variable are used to represent the head and tail of the output buffer respectively; the output buffer is full indicating that the baseboard management controller has written data for the host to read;
[0194] When the values of the third buffer variable and the fourth buffer variable are different, it indicates that the second bit is a set value and the input buffer is full; the third buffer variable and the fourth buffer variable are used to represent the head and tail of the input buffer respectively; the input buffer is full indicating that the host has written a command or data for the baseboard management controller to read;
[0195] The values of the second buffer variable and the third buffer variable are set by the host.
[0196] Optional, state setting module, including:
[0197] A first state setting submodule, configured to set a first preset value in the state variable when a command is written to the command variable;
[0198] A second state setting submodule, configured to set a second preset value in the state variable when writing data to the data variable;
[0199] A setting submodule is configured to set the second bit to a set value by setting the value of the third buffer variable to a value different from the value of the fourth buffer variable.
[0200] Optionally, the data variable includes a first data variable and a second data variable; the first data variable is used to store data written by the baseboard management controller for reading by the host; the second data variable is used to save data written by the host to the baseboard management controller; the device also includes:
[0201] a reading module, configured to read data in the first data variable when the first bit is a set value; wherein the first bit is set to a set value by the baseboard management controller when the first data variable is written;
[0202] The clearing module is used to set the first bit to a clear value by setting the value of the second buffer variable to the same value as the value of the first buffer variable.
[0203] As for the device embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can refer to the corresponding description of the method embodiment.
[0204] The various embodiments in this specification are described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the various embodiments can be referenced to each other.
[0205] Regarding the device in the above embodiment, the specific manner in which each module performs operations has been described in detail in the embodiment of the method, and will not be elaborated here.
[0206] An embodiment of the present invention provides an electronic device for data interaction, the electronic device is applied to a graphics processor, the electronic device includes a memory, and one or more programs, wherein the one or more programs are stored in the memory, and are configured to be executed by one or more processors. The one or more programs include the steps of implementing the above method embodiment:
[0207] Figure 6 1 is a block diagram of an electronic device 600 for data interaction according to an exemplary embodiment. For example, the electronic device 600 may be a mobile phone, a computer, a digital broadcast terminal, a messaging device, a game console, a tablet device, a medical device, a fitness device, a personal digital assistant, etc.
[0208] Reference Figure 6, the electronic device 600 may include one or more of the following components: a processing component 602 , a memory 604 , a power component 606 , a multimedia component 608 , an audio component 610 , an input / output (I / O) interface 612 , a sensor component 614 , and a communication component 616 .
[0209] The processing component 602 generally controls the overall operation of the electronic device 600, such as operations associated with display, phone calls, data data interaction, camera operation, and recording operation. The processing component 602 may include one or more processors 620 to execute instructions to complete all or part of the steps of the above method. In addition, the processing component 602 may include one or more modules to facilitate the interaction between the processing component 602 and other components. For example, the processing component 602 may include a multimedia module to facilitate the interaction between the multimedia component 608 and the processing component 602.
[0210] The memory 604 is configured to store various types of data to support operations on the electronic device 600. Examples of such data include instructions for any application or method operating on the electronic device 600, contact data, phone book data, messages, pictures, videos, etc. The memory 604 can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic memory, flash memory, magnetic disk or optical disk.
[0211] The power supply component 606 provides power to the various components of the electronic device 600. The power supply component 606 may include a power management system, one or more power supplies, and other components associated with generating, managing, and distributing power to the electronic device 600.
[0212] The multimedia component 608 includes a screen that provides an output interface between the electronic device 600 and the user. In some embodiments, the screen may include a liquid crystal display (LCD) and a touch panel (TP). If the screen includes a touch panel, the screen may be implemented as a touch screen to receive input signals from the user. The touch panel includes one or more touch sensors to sense touch, slide, and gestures on the touch panel. The touch sensor may not only sense the boundaries of the touch or slide action, but also detect the duration and pressure associated with the touch or slide operation. In some embodiments, the multimedia component 608 includes a front camera and / or a rear camera. When the electronic device 600 is in an operating mode, such as a shooting mode or a video mode, the front camera and / or the rear camera may receive external multimedia data. Each front camera and the rear camera may be a fixed optical lens system or have a focal length and optical zoom capability.
[0213] The audio component 610 is configured to output and / or input audio signals. For example, the audio component 610 includes a microphone (MIC), and when the electronic device 600 is in an operating mode, such as a call mode, a recording mode, and a voice information processing mode, the microphone is configured to receive an external audio signal. The received audio signal can be further stored in the memory 604 or sent via the communication component 616. In some embodiments, the audio component 610 also includes a speaker for outputting audio signals.
[0214] I / O interface 612 provides an interface between processing component 602 and peripheral interface modules, such as keyboards, click wheels, buttons, etc. These buttons may include but are not limited to: a home button, a volume button, a start button, and a lock button.
[0215] The sensor assembly 614 includes one or more sensors for providing various aspects of status assessment for the electronic device 600. The sensor assembly 614 can also detect changes in the position of the electronic device 600 or a component of the electronic device 600, the presence or absence of contact between the user and the electronic device 600, the orientation or acceleration / deceleration of the electronic device 600, and the temperature change of the electronic device 600. The sensor assembly 614 may include a proximity sensor configured to detect the presence of a nearby object without any physical contact. The sensor assembly 614 may also include a light sensor, such as a CMOS or CCD image sensor, for use in imaging applications. In some embodiments, the sensor assembly 614 may also include an acceleration sensor, a gyroscope sensor, a magnetic sensor, a pressure sensor, or a temperature sensor.
[0216] The communication component 616 is configured to facilitate data interaction between the electronic device 600 and other devices in a wired or wireless manner. The electronic device 600 can access a wireless network based on a data interaction standard, such as WiFi, 2G or 3G, or a combination thereof. In an exemplary embodiment, the communication component 616 also includes a near field data interaction (NFC) module to facilitate short-range data interaction. For example, the NFC module can be implemented based on radio frequency information processing (RFID) technology, infrared data association (IrDA) technology, ultra-wideband (UWB) technology, Bluetooth (BT) technology and other technologies.
[0217] In an exemplary embodiment, the electronic device 600 may be implemented by one or more application-specific integrated circuits (ASICs), digital signal processors (DSPs), digital signal processing devices (DSPDs), programmable logic devices (PLDs), field programmable gate arrays (FPGAs), controllers, microcontrollers, microprocessors, or other electronic components to perform the above methods.
[0218] In an exemplary embodiment, a non-transitory computer-readable storage medium including instructions is also provided, such as a memory 604 including instructions, and the instructions can be executed by the processor 620 of the electronic device 600 to perform the above method.
[0219] A non-transitory computer-readable storage medium, when the instructions in the storage medium are executed by a processor of an electronic device (server or terminal), enables the processor to execute Figure 1 The data interaction method shown.
[0220] The data interaction method, device and electronic device provided by the present invention are introduced in detail above. Specific examples are used in this article to illustrate the principles and implementation methods of the present invention. The description of the above embodiments is only used to help understand the method of the present invention and its core idea. At the same time, for those skilled in the art, according to the idea of the present invention, there will be changes in the specific implementation method and application scope. In summary, the content of this specification should not be understood as a limitation on the present invention.
Claims
1. A data interaction method, characterized in that: Applied to a baseboard management controller, the baseboard management controller is communicatively connected with a host, and the method comprises: Constructing target variables in a storage area of the baseboard management controller; the target variables include state variables, command variables and data variables; In the case where the host writes a command to the command variable or writes data to the data variable, a preset value in the state variable is read; the preset value is used to indicate that it is written by the host and the write type is a command or data; According to the preset value, the command variable or the data variable is read, and a corresponding data operation is performed.
2. The method according to claim 1, characterized in that The target variable includes a first buffer variable, a second buffer variable, a third buffer variable and a fourth buffer variable; the storage area includes an output buffer and an input buffer, the first buffer variable and the second buffer variable are used to set a first bit of a simulation state register, and the third buffer variable and the fourth buffer variable are used to set a second bit of the simulation state register; When the values of the first buffer variable and the second buffer variable are different, it indicates that the first bit is set and the output buffer is full; the first buffer variable and the second buffer variable are used to represent the head and tail of the output buffer respectively; the output buffer is full indicating that the baseboard management controller has written data for the host to read; When the values of the third buffer variable and the fourth buffer variable are different, it indicates that the second bit is a set value and the input buffer is full; the third buffer variable and the fourth buffer variable are used to represent the head and tail of the input buffer respectively; the input buffer is full indicating that the host has written a command or data for the baseboard management controller to read; The values of the first buffer variable and the fourth buffer variable are set by the baseboard management controller.
3. The method according to claim 2, characterized in that The data variables include a first data variable, and the first data variable is used to store target data obtained by executing the command; The step of reading the command variable or the data variable according to the preset value and performing a corresponding data operation includes: The preset value includes a first preset value, the first preset value indicating that the host has written a command in the command variable; when the first preset value is read, the second bit is a set value; Reading the command variable to obtain the command, setting the second bit to a clear value by setting the value of the fourth buffer variable to the same value as the value of the third buffer variable, wherein the clear value is used to indicate that the input buffer is empty, and the input buffer being empty indicates that the baseboard management controller has obtained the command; Execute the command to obtain the target data indicated by the command in the storage area, and write the target data into the first data variable; the first data variable is used to store the target data for the host to read; The first bit is set to a set value by setting the value of the first buffer variable to a value different from the value of the second buffer variable.
4. The method according to claim 2, characterized in that: The data variable includes a second data variable, and the second data variable is used to store the data written by the host; The step of reading the command variable or the data variable according to the preset value and performing a corresponding data operation includes: The preset value includes a second preset value, and the second preset value indicates that the host has written data into the second data variable; When the second preset value is read, the second bit is a set value; Reading the second data variable to obtain the data; The second bit is set to a clear value by setting the value of the fourth buffer variable to the same value as the value of the third buffer variable; the clear value is used to indicate that the input buffer is empty, and the input buffer being empty means that the baseboard management controller has acquired the data.
5. A data interaction method, characterized in that: Applied to a host, the host is communicatively connected with a baseboard management controller, and the method includes: Writing a command to a command variable of the baseboard management controller, or writing data to a data variable of the baseboard management controller; a target variable is constructed in a storage area of the baseboard management controller; the target variable includes a state variable, the command variable and the data variable; When a command is written to the command variable or data is written to the data variable, the state variable is set to a different preset value; the preset value is used to indicate that it is written by the host and the write type is a command or data; so that the baseboard management controller reads the preset value in the state variable, and according to the preset value, reads the command variable or the data variable and performs corresponding data operations.
6. The method according to claim 5, characterized in that The target variable includes a first buffer variable, a second buffer variable, a third buffer variable and a fourth buffer variable; the storage area includes an output buffer and an input buffer, the first buffer variable and the second buffer variable are used to set a first bit of a simulation state register, and the third buffer variable and the fourth buffer variable are used to set a second bit of the simulation state register; When the values of the first buffer variable and the second buffer variable are different, it indicates that the first bit is set and the output buffer is full; the first buffer variable and the second buffer variable are used to represent the head and tail of the output buffer respectively; the output buffer is full indicating that the baseboard management controller has written data for the host to read; When the values of the third buffer variable and the fourth buffer variable are different, it indicates that the second bit is a set value and the input buffer is full; the third buffer variable and the fourth buffer variable are used to represent the head and tail of the input buffer respectively; the input buffer is full indicating that the host has written a command or data for the baseboard management controller to read; The values of the second buffer variable and the third buffer variable are set by the host.
7. The method according to claim 6, characterized in that The step of setting the state variable to a different preset value when writing a command to the command variable or writing data to the data variable comprises: In case of writing a command to the command variable, setting a first preset value in the state variable; In case of writing data to the data variable, setting a second preset value in the state variable; The second bit is set to a set value by setting the value of the third buffer variable to a value different from the value of the fourth buffer variable.
8. The method according to claim 6, characterized in that The data variable includes a first data variable and a second data variable; the first data variable is used to store data written by the baseboard management controller for reading by the host; The second data variable is used to store data written by the host to the baseboard management controller; The method further comprises: When the first bit is a set value, reading data in the first data variable; wherein the first bit is set to a set value by the baseboard management controller when the first data variable is written; The first bit is set to a clear value by setting the value of the second buffer variable to the same value as the value of the first buffer variable.
9. A data interaction device, characterized in that: Applied to a baseboard management controller, the baseboard management controller is communicatively connected with a host, and the device comprises: A variable construction module, used to construct target variables in the storage area of the baseboard management controller; the target variables include state variables, command variables and data variables; A state identification module, used for reading a preset value in the state variable when the host writes a command to the command variable or writes data to the data variable; the preset value is used to indicate that it is written by the host and the write type is a command or data; The reading module is used to read the command variable or the data variable according to the preset value and perform corresponding data operations.
10. A data interaction device, characterized in that: Applied to a host, the host is communicatively connected with a baseboard management controller, and the device comprises: A writing module, used to write commands to the command variables of the baseboard management controller, or write data to the data variables of the baseboard management controller; target variables are constructed in the storage area of the baseboard management controller; the target variables include state variables, the command variables and the data variables; A state setting module is used to set the state variable to different preset values when a command is written to the command variable or data is written to the data variable; the preset value is used to indicate that it is written by the host and the write type is command or data; so that the baseboard management controller reads the preset value in the state variable, reads the command variable or the data variable according to the preset value, and performs corresponding data operations.
11. An electronic device, characterized in that: The electronic device comprises a memory and one or more programs, wherein the one or more programs are stored in the memory and are configured to execute the data interaction method according to any one of claims 1 to 8 by one or more processors.
12. A readable storage medium, characterized in that: When the instructions in the storage medium are executed by a processor of an electronic device, the processor is enabled to execute the data interaction method as described in any one of claims 1 to 8.