Kcs data communication method, device and system
By introducing an LPC interface and a virtual KCS register on the EC chip, the problem that general-purpose SOCs cannot implement KCS communication is solved, and efficient cross-interface transmission of KCS data communication is achieved.
Patent Information
- Application Number
- CN202510073137.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-01-17
- Publication Date
- 2025-11-07
- Estimated Expiration
- 2045-01-17
AI Technical Summary
General-purpose SoCs lack native LPC interfaces and KCS registers, making it impossible to implement KCS communication and meet the management requirements of new hardware platforms.
By introducing an LPC interface on the EC chip and deploying a virtual KCS register and SPI data processing buffer, the KCS data communication is achieved by communicating with the SOC via the SPI bus and simulating the KCS coprocessor.
This enables BMC systems based on general-purpose SOCs to support the KCS protocol, complete the reception, parsing, and cross-interface data transmission of KCS commands, and improve data transmission efficiency and integrity.
Smart Images

Figure CN120104545B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the application field of BMC, and in particular to a KCS data communication method, device and system. BACKGROUND
[0002] With the rapid development of computer technology, server management and system monitoring are particularly important in modern data centers and enterprise environments. In order to realize remote management of computer systems, IPMI protocol, as an open standard, is widely used in the hardware management of servers.
[0003] In a typical IPMI implementation, the server communicates with the BMC through KCS, which is a protocol based on the LPC bus. The KCS interface is an important interface in the BMC system, used to transmit management commands and status information between the host processor CPU and the management controller. Therefore, KCS plays an important role in the communication between the BMC and the server. In the BMC processor, KCS communication usually relies on the LPC physical interface, KCS coprocessor and the supporting firmware to realize. Compared with the special BMC chip, the general SOC has strong computing performance and rich interface selection, and the optional models are widely used to build BMC systems.
[0004] However, compared with the special BMC chip, the general SOC lacks native LPC interface and KCS register support, and cannot provide KCS communication capabilities for BMC systems implemented based on the general SOC, and cannot meet the management needs of new hardware platforms. At present, there is no technical solution to solve the above technical problems, and there is no KCS data communication method, device and system. SUMMARY
[0005] The present application provides a KCS data communication method, device and system, which expands the KCS physical interface for the general SOC by using the EC chip with the LPC interface, and deploys a set of software on the EC to realize the virtual KCS interface coprocessor, providing KCS communication capabilities for the BMC system implemented based on the general SOC.
[0006] In a first aspect, the present application provides a KCS data communication method applied to an embedded controller EC, a baseboard management controller BMC and a server in communication connection, the BMC including a system on chip SOC and an embedded controller EC, the EC including an LPC bus first interface, a virtual KCS register and an SPI data processing buffer, comprising:
[0007] The first KCS data packet transmitted from the server is received by using the first LPC bus interface, the first KCS data packet is unpacked by using a virtual KCS register, and the unpacked data is obtained, and the first KCS data packet at least includes an encapsulated IPMI command;
[0008] The unpacked data is encapsulated as a first SPI data packet, and the first SPI data packet is sent to an SPI data processing buffer by using the virtual KCS register, the SPI data processing buffer includes a current buffer and a standby buffer, and the current buffer and the standby buffer are used to process data transmission and reception in a cyclic alternating manner;
[0009] In the case of obtaining a polling request from a system on chip (SOC), the first SPI data packet is sent to the system on chip (SOC) by using the SPI bus to indicate that the system on chip (SOC) unpacks the first SPI data packet to obtain an IPMI command, and IPMI response data is obtained according to the IPMI command, and the IPMI response data is encapsulated as a second SPI data packet and then sent;
[0010] The second SPI data packet from the system on chip (SOC) is received by using the SPI bus, the second SPI data packet is unpacked by using a virtual KCS register, and the IPMI response data is obtained, the IPMI response data is encapsulated as a second KCS data packet, and the second KCS data packet is sent to the server by using the first LPC bus interface to indicate that the server unpacks the second KCS data packet to obtain the IPMI response data, and a response operation is performed according to the IPMI response data.
[0011] According to the KCS data communication method provided by the application, before the first KCS data packet transmitted from the server is received by using the first LPC bus interface, the method further includes:
[0012] The KCS register in the server is initialized, the KCS register pointer is set, the configuration is set to an idle state, the message header is constructed according to the network function code, the command code and the command data, the checksum of the data packet is calculated according to the format of the IPMI protocol, and the IPMI command is constructed;
[0013] In the case of receiving a write command, the idle state is switched to a write data state, and each byte of the IPMI command is written into the KCS register in turn by using a double buffering mechanism and a batch data transmission technology, the double buffering mechanism is used to alternately process data by using two set buffers to realize data transmission and data switching, and the batch data transmission technology is used to transmit a plurality of data bytes or data blocks in one time by packaging the data into a preset unit;
[0014] After the IPMI command is written, the data encapsulation is ended by a write end command, and the KCS state is switched from the write data state to the write completion stage.
[0015] According to the KCS data communication method provided by the application, before the first KCS data packet is unpacked by the virtual KCS register, the method further comprises:
[0016] The virtual KCS register is initialized by a preset function Kcs_regs_init, the initial state of the virtual KCS register is set, the state flag is cleared, and the data input register and the data output register are reset to initial values;
[0017] The read and write operations of the virtual KCS register are simulated by preset functions Ls_kcs_inb and Ls_kcs_outb, the write operations of the data input register and the command register are simulated by preset functions Write_idr and Write_cmd, the state values of the virtual KCS register are updated according to a mask by a preset function Ls_kcs_updateb, in the write operation of the virtual KCS register, according to different interrupt types, the preset functions Lpc_send_edge_int_evt or Lpc_send_level_int_evt are called to simulate the interrupt events triggered when the state of the virtual KCS register changes, and the IO operation on the virtual KCS register is simulated by using preset functions Iord_short and Iowr_short.
[0018] According to the KCS data communication method provided by the application, the unpacked data is encapsulated as a first SPI data packet, and the virtual KCS register sends the first SPI data packet to an SPI data processing buffer, which comprises:
[0019] The first SPI data packet is generated according to the unpacked data, and a state machine Spi_phase is defined to manage different stages of the transmission of the first SPI data packet.
[0020] The first SPI data packet is sent to the SPI data processing buffer by using a double buffering mechanism, and SPI transmission parameters are set by using a preset variable Transfer_size.
[0021] According to the KCS data communication method provided by the application, the state machine Spi_phase is defined to manage different stages of the transmission of the first SPI data packet, which comprises:
[0022]
[0023] T = 1.switch W represents the time interval for state transitions. data The weight of the current data volume is P, the priority of the command (a larger value indicates a higher priority), and α is an adjustment factor used to balance the relationship between the current data volume and the priority.
[0024] According to the KCS data communication method provided by the present invention, before or after defining the state machine Spi_phase, the method further includes:
[0025] If the error frequency exceeds a preset threshold during data transmission, the number of retries is increased. The formula for calculating the number of retries is as follows:
[0026]
[0027] N retry E represents the number of retries. count E represents the number of errors detected over a past period of time. total γ represents the maximum number of errors allowed, with γ as the base number of retries.
[0028] According to the KCS data communication method provided by the present invention, the step of sending the first SPI data packet to the system-on-a-chip (SOC) using the SPI bus includes:
[0029] If data exists in the SPI data processing buffer, the system-on-chip (SoC) reads command data using the preset function Receive_ipmi_command according to the polling request of the SoC, and sends the first SPI data packet to the SoC via the SPI bus. The SoC receives data in batches in a loop. If the data is less than 32 bytes, it reads all the remaining data at once; otherwise, it obtains the data in blocks.
[0030] If there is no data in the SPI data processing buffer, a default value is returned to indicate that there is currently no available data.
[0031] According to the KCS data communication method provided by the present invention, after sending the first SPI data packet to the system-on-a-chip (SOC) via the SPI bus, the method further includes:
[0032] The system-on-chip (SOC) is instructed to decapsulate the first SPI data packet to obtain an IPMI command;
[0033] forwarding the IPMI command to a Dbus service, parsing a structure of the IPMI command through a preset function Handle_ipmi_command, calling an Execute method of a Xyz.openbmc_project.Ipmi.Server service through the Dbus, executing the IPMI command, and obtaining IPMI response data;
[0034] After the Dbus processing is completed, the IPMI response data is encapsulated into a second SPI data packet and then sent and returned to the EC.
[0035] In a second aspect, a KCS data communication device is provided, including:
[0036] a receiving unit configured to receive a first KCS data packet transmitted from a server through the LPC bus first interface, and to obtain unpacked data by unpacking the first KCS data packet through a virtual KCS register, the first KCS data packet including at least an encapsulated IPMI command;
[0037] an encapsulating unit configured to encapsulate the unpacked data into a first SPI data packet, and to send the first SPI data packet to an SPI data processing buffer through the virtual KCS register, the SPI data processing buffer including a current buffer and a standby buffer, and the current buffer and the standby buffer being configured to process data transmission and reception in a cyclic alternating manner;
[0038] a sending unit configured to, in a case where a polling request from a system on chip (SOC) is obtained, send the first SPI data packet to the SOC through an SPI bus to instruct the SOC to unpack the first SPI data packet to obtain an IPMI command, obtain IPMI response data according to the IPMI command, and send the IPMI response data after encapsulating the IPMI response data into a second SPI data packet;
[0039] an unpacking unit configured to receive a second SPI data packet from the SOC through the SPI bus, obtain the IPMI response data by unpacking the second SPI data packet through the virtual KCS register, encapsulate the IPMI response data into a second KCS data packet, and send the second KCS data packet to the server through the LPC bus first interface to instruct the server to unpack the second KCS data packet to obtain the IPMI response data and perform a response operation according to the IPMI response data.
[0040] In a third aspect, a KCS data communication system is provided, comprising a baseboard management controller (BMC) and a server, wherein the BMC is in communication connection with the server.
[0041] The BMC comprises a system on chip (SOC) and an EC, wherein the EC comprises an LPC bus first interface, a virtual KCS register and an SPI data processing buffer, and the EC is configured to perform the KCS data communication method according to any one of claims 1-8.
[0042] The SOC is connected with the SPI data processing buffer through an SPI bus, the SPI data processing buffer is connected with the virtual KCS register, and the virtual KCS register is connected with the LPC bus first interface.
[0043] The server comprises an LPC bus second interface and a KCS register, the LPC bus first interface is connected with the LPC bus second interface through an LPC bus, and the LPC bus second interface is connected with the KCS register.
[0044] The application introduces a bridging mechanism of SPI-LPC through the EC, the EC is connected with the general SOC as an SPI slave device, performs data transmission with the SOC through the SPI, and is connected with the server end through the LPC interface, so that the BMC system realized based on the general SOC can support the protocol communication based on the LPC; the software virtual KCS interface in the EC enables the EC to simulate the registers, state machines and command analysis of the KCS protocol, and act as a KCS coprocessor. This technology enables the BMC system realized based on the general SOC to support the KCS protocol, complete the receiving, analysis and cross-interface data transmission of the KCS command, the SOC can realize the active acquisition of the EC data by querying the buffer state of the EC in real time, the batch data processing and double buffering technology are adopted in the data encapsulation stage to realize the rapid preparation and switching of the data, the intelligent error detection and retransmission mechanism is proposed to ensure the integrity and efficiency of the data transmission. BRIEF DESCRIPTION OF DRAWINGS
[0045] In order to more clearly illustrate the technical solutions in the present application or prior art, the following will briefly introduce the drawings needed to be used in the embodiments or prior art description. Obviously, the drawings in the following description are some embodiments of the present application, and other drawings can also be obtained by those skilled in the art without creative labor.
[0046] Figure 1 is a flowchart of the KCS data communication method provided by the present application;
[0047] Figure 2It is a structural schematic view of the KCS data communication device provided by the application.
[0048] Figure 3 It is a structural schematic view of the KCS data communication system provided by the application.
[0049] Figure 4 It is a flow schematic view of the KCS data communication system provided by the application.
[0050] Figure 5 It is a structural schematic view of the electronic device provided by the application. DETAILED DESCRIPTION
[0051] In order to make the purpose, technical scheme and advantages of the application clearer, the technical scheme in the application will be described clearly and completely below in combination with the drawings in the application. Obviously, the described embodiments are part of the embodiments of the application, rather than all the embodiments. Based on the embodiments in the application, all other embodiments obtained by those skilled in the art without creative labor fall within the protection scope of the application.
[0052] Figure 1 It is a flow schematic view of the KCS data communication method provided by the application. The KCS data communication method is applied to an embedded controller EC, a backplane management controller BMC and a server in communication connection. The BMC includes a system on chip SOC and an embedded controller EC. The EC includes an LPC bus first interface, a virtual KCS register and an SPI data processing buffer. The backplane management controller BMC is a separate microcontroller in a server and a computer system, which is specially used for managing and monitoring hardware states. Its main responsibility is to monitor and control the key hardware (such as a processor, a memory, a hard disk, a fan, a power supply, etc.) of a system. The embedded controller EC is a kind of microcontroller, which is usually integrated on a computer mainboard, used for managing and controlling various low-speed hardware devices in a system. The EC is independent of a main processor and can execute some auxiliary functions, mainly used for power management, temperature control, keyboard scanning, fan speed regulation, etc. KCS is an interface standard for communication between a main processor (CPU) and a BMC in a computer system. KCS is one of several interfaces defined in the IPMI specification, used for realizing data transmission between a main processor and a BMC.
[0053] The KCS data communication method includes:
[0054] In step 101, the LPC bus first interface is used to receive a first KCS data packet transmitted from a server. The first KCS data packet is unpacked by using a virtual KCS register to obtain unpacked data. The first KCS data packet at least includes an encapsulated IPMI command.
[0055] Step 102, encapsulating the unsealed data as a first SPI data packet, the virtual KCS register sending the first SPI data packet to an SPI data processing buffer, the SPI data processing buffer including a current buffer and a standby buffer, the current buffer and the standby buffer being used to process data sending and receiving in a cyclically alternating processing mode;
[0056] Step 103, in the case of obtaining a polling request from a system on chip (SOC), sending the first SPI data packet to the system on chip (SOC) by using an SPI bus to instruct the system on chip (SOC) to unseal the first SPI data packet to obtain an IPMI command, obtaining IPMI response data according to the IPMI command, and sending the IPMI response data after encapsulating the IPMI response data as a second SPI data packet;
[0057] Step 104, receiving the second SPI data packet from the system on chip (SOC) by using the SPI bus, unsealing the second SPI data packet by using a virtual KCS register to obtain the IPMI response data, encapsulating the IPMI response data as a second KCS data packet, and sending the second KCS data packet to the server by using a first LPC bus interface to instruct the server to unseal the second KCS data packet to obtain the IPMI response data, and performing a response operation according to the IPMI response data.
[0058] In step 101, before receiving the first KCS data packet transmitted from the server by using the first LPC bus interface, the method further includes:
[0059] initializing a KCS register in the server, setting a KCS register pointer, configuring an idle state, constructing a message header according to a network function code, a command code, and command data, calculating a checksum of a data packet according to a format of an IPMI protocol, and building the IPMI command;
[0060] in the case of receiving a write command, switching the idle state to a write data state, sequentially writing each byte of the IPMI command to the KCS register by using a double buffering mechanism and a batch data transmission technology, the double buffering mechanism being used to alternately process data by using two set buffers to realize data transmission and data switching, and the batch data transmission technology being used to transmit a plurality of data bytes or data blocks in one time by packaging the plurality of data bytes or data blocks into a preset unit;
[0061] after the writing of the IPMI command is completed, marking the end of data encapsulation by using a write end command, and switching the KCS state from the write data state to a write completion phase.
[0062] Specifically, before encapsulating and transmitting KCS data, we first need to initialize the KCS protocol state machine: set the pointer of the register, and configure the KCS state machine to the idle state (KCS_PHASE_IDLE), configure the input and output data buffer, and ensure that the data pointer and error flag have been cleared, ready for subsequent data encapsulation and transmission; then build the IPMI data packet, which is a multi-step process. The completed IPMI data packet will be used as input data for KCS encapsulation. The specific steps include: constructing the message header (network function code and command code); according to the format of the IPMI protocol, calculating the checksum of the data packet to ensure data integrity; for important commands, use data priority management to prioritize high-priority data packets; after the complete IPMI data packet is ready, it will enter the encapsulation process.
[0063] Then, encapsulate the IPMI data into a KCS data packet, and write the constructed IPMI data byte by byte into the KCS register, thereby encapsulating it into a KCS data packet:
[0064] Write start phase: when the write start command is received, the KCS state switches from idle state to write data phase (KCS_PHASE_WRITE_DATA);
[0065] Data write phase: each byte of IPMI data is written into the KCS register in turn. Batch data transmission technology is used to reduce the waiting time of byte-by-byte writing and improve transmission efficiency. Batch data transmission technology is a method of transmitting multiple data bytes or data blocks in a single unit at a time during data transmission. In the implementation of the KCS interface, the traditional data transmission method is byte-by-byte writing and reading, and after each byte is transmitted, the register state needs to be updated before the next byte is transmitted. Batch transmission writes multiple bytes of data into the register or buffer at a time, reducing the number of state switches during data transmission. The advantage of this technology is that it can reduce the frequent state switching and waiting time during the byte-by-byte transmission of IPMI data when encapsulating KCS data, improving the efficiency of data transmission and the overall performance of the system.
[0066] In the data write phase, the present application uses a double buffering mechanism, i.e. during data transmission, a double buffer technology is used, one buffer is used for the current transmission, and the other buffer stores the data to be transmitted in advance to reduce the switching time. Double buffering mechanism is a technology used to improve data transmission efficiency, by setting two buffers (one for current data processing, the other for preparing the next batch of data), to realize continuous data transmission and seamless switching
[0067] The specific workflow of the double buffering mechanism is as follows:
[0068] Stage 1, data processing starts: one KCS buffer (current buffer) is being used by the system for encapsulation and transmission of current IPMI command data. At the same time, the standby buffer is idle for preparing the next batch of data;
[0069] Stage 2, switch buffers: when the data processing of the current buffer is completed, immediately switch the standby buffer to the current buffer to continue encapsulation and transmission of the current IPMI command data. The original current buffer becomes the standby buffer for preparing the next batch of data;
[0070] Stage 3, cycle alternation: the above process is cyclically alternated, and the two buffers constantly switch roles to realize continuous processing of IPMI data. This alternating method avoids pauses in data processing and realizes "seamless" data transmission.
[0071] Write end stage: after all data is written, the data encapsulation is marked as complete by a write end command, and the KCS state is switched to the write completion phase (KCS_PHASE_WRITE_DONE).
[0072] Optionally, before the first KCS data packet is unpacked using the virtual KCS register, the method further comprises:
[0073] Initializing the virtual KCS register using a preset function Kcs_regs_init to set the initial state of the virtual KCS register, clear the status flags, and reset the data input register and data output register to the initial values;
[0074] Using preset functions Ls_kcs_inb and Ls_kcs_outb to simulate the read and write operations of the virtual KCS register, using preset functions Write_idr and Write_cmd to simulate the write operations of the data input register and the command register respectively, using a preset function Ls_kcs_updateb to update the state values of the virtual KCS register according to the mask, in the write operation of the virtual KCS register, according to different interrupt types, calling preset functions Lpc_send_edge_int_evt or Lpc_send_level_int_evt to simulate the interrupt events triggered when the state of the virtual KCS register changes, using preset functions Iord_short and Iowr_short to simulate the IO operation on the virtual KCS register.
[0075] Optionally, the general SOC does not have a native LPC interface and KCS register, and needs to realize the KCS interface through an external LPC and KCS coprocessor, the KCS protocol is generally based on the LPC physical interface and the KCS coprocessor and the corresponding firmware, the KCS register is simulated on the EC as the KCS coprocessor, the KCS physical interface is extended for the general SOC by using the EC chip with the LPC interface, and a set of software is deployed on the EC to realize the virtual KCS interface coprocessor, the KCS communication capability is provided for the BMC system realized based on the general SOC, and high communication efficiency can be maintained, and the method is suitable for a wide range of application scenarios.
[0076] Firstly, the KCS register is initialized, the KCS register is initialized through the "kcs_regs_init" function, and the initial state of the register is set. The state flag is cleared, and the data input register and the data output register are reset to the initial value, so that the register starts from a known state.
[0077] Then, the read and write operations of the KCS register are simulated, and the "ls_kcs_inb" and "ls_kcs_outb" functions are used to simulate the read and write operations of the KCS register. The "ls_kcs_inb" function reads the value of the data input register (IDR) or the state register (OBF), simulates the read behavior of the KCS register. The "ls_kcs_outb" function writes data into the data output register (ODR) and sets the corresponding state flag, simulating the write operation.
[0078] Then, the processing of the command and data is simulated, and the "write_idr" and "write_cmd" functions are used to simulate the write operation of the data input register and the command register respectively. The "write_idr" processing writes data into the data input register and sets the IBF flag, indicating that the data is ready. The "write_cmd" processing writes the command into the command register and sets the IBF and CMD_DAT flags, indicating that the command is received.
[0079] Next, the management and update of the state register are simulated, and the "ls_kcs_updateb" function is used to update the state value of the register according to the mask, simulating the state change. The specific bits of the register are allowed to be set or cleared, reflecting the state change in the KCS protocol.
[0080] Then, the interrupt event is simulated, and according to different interrupt types, the "lpc_send_edge_int_evt" or "lpc_send_level_int_evt" function is called in the write operation of the register to simulate the interrupt event triggered when the KCS register state changes.
[0081] Finally, the IO operation is simulated using the "iord_short" and "iowr_short" functions to simulate the IO operation on the KCS register: the "iord_short" simulates the read operation to read the register value through the specified address; the "iowr_short" simulates the write operation to write data to the register through the specified address.
[0082] In step 101, the application receives a first KCS data packet transmitted from a server through the first LPC bus interface, and unpacks the first KCS data packet through a virtual KCS register to obtain unpacked data, wherein the first KCS data packet at least includes an encapsulated IPMI command. The LPC bus is a data transmission bus on a computer motherboard, which is used to replace the ISA bus. The main purpose of the LPC bus is to provide a low-pin-count communication method between a chipset and low-speed devices (such as BIOS, super I / O controller, embedded controller EC, etc.), while maintaining low cost and space occupation. The IPMI is an intelligent platform management interface, which can cross different operating systems, firmware and hardware platforms, intelligently monitor, control and automatically report the operation status of a large number of servers to reduce the cost of the server system.
[0083] Optionally, the first KCS data packet is transmitted to the EC through the LPC, and the EC unpacks it. The encapsulated first KCS data packet is transmitted to the EC through the LPC interface. At the EC end, the KCS register is implemented according to simulation, and can simulate the standard KCS protocol behavior. The specific process is as follows:
[0084] Initialization and configuration: in the whole system, first, the LPC and SPI interfaces are initialized and configured to support data transmission: the LPC interface is initialized to enable it to receive the first KCS data packet from the server, and the related interrupt mechanism is configured to ensure that the events in the transmission process can be handled. The SPI interface is initialized, including the configuration of the DMA controller, to improve the efficiency of data transmission. The SPI configuration parameters such as polarity, phase, data frame size, etc. ensure that the data can be correctly transmitted to the SOC through the SPI.
[0085] In the receiving and unpacking of the first KCS data packet, the first KCS data packet is received from the server through the LPC interface, and the EC receives the data byte by byte from the LPC register according to the steps of the KCS protocol and stores it in the local buffer. After receiving the first KCS data packet, the EC uses the KCS protocol state machine to parse it step by step. This process parses the data according to different stages of the state machine to ensure correct handling of the data:
[0086] The state of the virtual KCS register includes idle state (IDLE), write start (WRITE_START), write data (WRITE_DATA), write end (WRITE_END) and the like. When the EC receives a KCS command, it first enters the WRITE_START state, indicating the start of data writing. Then it enters the WRITE_DATA state, receives data byte by byte until it receives the write end command WRITE_END, indicating that data reception is complete. In the WRITE_DATA state, the EC reads each byte of data from the virtual KCS register, stores it in a local buffer, and performs data verification, such as checking whether the length of the data is correct and whether the checksum matches, and the like. In each stage of data reception, the flag bits (such as IBF and OBF flags) of the KCS status register are checked to ensure the validity of the data until a complete IPMI command transmission is completed.
[0087] In step 102, the encapsulated post-unmarshalling data is a first SPI data packet, and the virtual KCS register sends the first SPI data packet to an SPI data processing buffer, including:
[0088] According to the unmarshalled data, the first SPI data packet is generated, and a state machine Spi_phase is defined to manage different stages of transmission of the first SPI data packet.
[0089] The first SPI data packet is sent to the SPI data processing buffer using a double buffering mechanism, and SPI transmission parameters are set using a preset variable Transfer_size.
[0090] Optionally, the EC encapsulates the unmarshalled data into a first SPI data packet, and after the EC completes KCS data unmarshalling and obtains a complete IPMI command, the IPMI command is re-encapsulated into a first SPI data packet to be transmitted to the SOC through the SPI interface for further processing.
[0091] The specific process is as follows:
[0092] The first SPI data packet is generated according to the IPMI command content: the IPMI command usually contains command code, command parameters and data. To ensure that the SOC can correctly parse, the first SPI data packet needs to be encapsulated according to a specific format. The command identification (such as command code) and data length information need to be included in the data packet. Some command codes are defined, such as CMD_IPMI_SEND and CMD_IPMI_RESPONSE, to indicate the type of the data packet. When generating the data packet, these command codes are filled into the first byte position of the data packet, so that the SOC can identify the type of the data packet;
[0093] State machine for managing SPI transmission: a state machine "spi_phase" is defined to manage different phases of SPI transmission, such as SPI_IDLE, SPI_WAIT_POLL, SPI_WAIT_SEND_CMD, SPI_WAIT_RESPONSE_LEN, etc. According to the state of the state machine, the EC can decide the operation that should be performed at present.
[0094] Optionally, the application adopts a double buffering mechanism to improve data transmission efficiency and ensure seamless data switching. Two buffer areas, "TxBuffer" and "RxBuffer", are used to store transmitted and received data respectively. After transmission is completed, the buffer areas are switched through a callback function to prepare for the next round of transmission. The transmission size is dynamically adjusted according to the remaining size of the data packet.
[0095] Finally, set the SPI transmission parameters. After storing the packaged first SPI data packet into the SPI data processing buffer area, the SPI transmission parameters need to be set to ensure that the data can be correctly transmitted to the SOC. The application can set a "transfer_size" variable to specify the number of data bytes that need to be transmitted at present. According to different transmission phases, the value of "transfer_size" will dynamically change to adapt to the size of the data packet.
[0096] Optionally, the state machine Spi_phase is defined to manage different phases of transmission of the first SPI data packet, including:
[0097]
[0098] wherein T switch represents the time interval of state switching, W data is the weight of the current data amount, P is the priority of the command, the larger the value, the higher the priority, and a is the adjustment factor for balancing the relationship between the current data amount and the priority.
[0099] Optionally, a state machine mechanism (SPI_PHASE enumeration type) is used to manage each phase of SPI data transmission to ensure the order and integrity of data transmission. Different states (SPI_IDLE, SPI_WAIT_POLL, SPI_WAIT_SEND_CMD, etc.) are used to represent different phases of SPI transmission to control the advancement of the transmission process. The application introduces an adaptive state switching mechanism to dynamically adjust the state switching time according to the data amount and priority. The mechanism can increase the state residence time when the data amount is large, and reduce the residence time when the priority is high, thereby adaptively improving the response speed of the system.
[0100] Optionally, before or after defining the state machine Spi_phase, the method further comprises:
[0101] In the case that the error frequency exceeds a preset threshold in the data transmission process, the number of retries is increased, and the calculation formula of the number of retries is:
[0102]
[0103] N retry is the number of retries, E count represents the number of errors detected in the past period of time, E total is the maximum number of allowed errors, and γ is the basic number of retries.
[0104] Optionally, in the data transmission process, an error detection and adaptive retry mechanism is added, and the retry strategy is dynamically adjusted according to the type and frequency of errors. The application can increase the number of retries when the error frequency is high to ensure the success rate of data transmission, and reduce the retries when the errors are less to save time.
[0105] In step 103, the first SPI data packet is sent to the system on chip SOC using the SPI bus, including:
[0106] In the case that there is data in the SPI data processing buffer, according to the polling request of the system on chip SOC, the command data is read using a preset function Receive_ipmi_command, the first SPI data packet is sent to the system on chip SOC using the SPI bus, and the system on chip SOC receives data in batches in a loop. In the case that the data is less than 32 bytes, all the remaining data is read at one time; otherwise, the data is obtained in a block manner.
[0107] In the case that there is no data in the SPI data processing buffer, a default value is returned, which is used to represent that there is no available data at present.
[0108] Optionally, the serial peripheral interface SPI is a synchronous serial communication protocol widely used for high-speed data transmission between microcontrollers and peripheral devices (such as sensors, memories, displays, etc.), and the SOC constantly initiates a polling request to the EC through the SPI to obtain the IPMI command data of the EC. The SOC acts as the SPI master device and initiates the data transmission request actively, while the EC acts as the slave device and responds to the request. The SOC queries whether there is new IPMI data available in the EC by sending "CMD_IPMI_POLL", and performs an SPI transmission of an empty command to detect the data in the EC buffer. After polling, it is judged whether there is an IPMI command to be received according to the data returned by the EC. If the received command is "CMD_IPMI_SEND" and the data length is greater than 0, it indicates that there is a new IPMI command to be processed.
[0109] Optionally, if there is data available in the buffer, the EC will return the corresponding data according to the request of the SOC. The command data is read from the EC through the "receive_ipmi_command" function, and the data is received in batches through a loop. If the data is less than 32 bytes, the remaining data is read at one time; otherwise, the data is obtained in blocks. If there is no data (the EC buffer is empty), a default value is returned, indicating that there is no available data at present.
[0110] Optionally, after sending the first SPI data packet to the system on chip SOC using the SPI bus, the method further comprises:
[0111] indicating the system on chip SOC to unseal the first SPI data packet to obtain an IPMI command;
[0112] forwarding the IPMI command to a Dbus service, parsing the structure of the IPMI command through a preset function Handle_ipmi_command, calling the Execute method of the Xyz.openbmc_project.Ipmi.Server service through the Dbus, executing the IPMI command, and obtaining IPMI response data;
[0113] after the Dbus processing is completed, encapsulating the IPMI response data into a second SPI data packet and sending it back to the EC.
[0114] Optionally, the SOC unpacks the first SPI data packet, processes and obtains a response, and sends it back to the EC. After receiving the first SPI data packet, the SOC will unpack it until a complete IPMI command is obtained, and then forward the command to the Dbus service for further processing. The IPMI command structure is parsed through the "handle_ipmi_command" function, and the Execute method of the "xyz.openbmc_project.Ipmi.Server" service is called through the Dbus to execute the received IPMI command and obtain the response data. After the Dbus processing is completed, the second SPI data packet is encapsulated, and the IPMI response data corresponding to the second SPI data packet is sent back to the EC through the SPI. Through the "send_ipmi_response" function, the length of the response data (CMD_LENGTH) is first sent, and then the actual IPMI response data is transmitted in batches. If the response data is small, for example, less than or equal to 31 bytes, it is sent at one time; if it is large, it is transmitted in batches until it is sent completely.
[0115] In step 104, the EC receives the second SPI data packet from the SOC and unpacks it, and then encapsulates it as a second KCS data packet. After receiving the second SPI data packet, the EC stores it in the receiving buffer, unpacks it into the IPMI response data, and then writes it into the KCS register according to the specification to encapsulate it into a second KCS data packet. The same batch transmission technology and double buffering mechanism are used. The EC sends the second KCS data packet to the server through the LPC. After completing the encapsulation of the second KCS data packet, the EC stores it in the sending buffer of the LPC interface for transmission. According to the KCS protocol requirements, the data is written byte by byte into the output data register of the LPC, and the KCS interface on the server side reads these bytes and processes them.
[0116] Optionally, the server unpacks the second KCS data packet into IPMI response data, parses and executes the response. The server receives the encapsulated second KCS data packet from the EC through the LPC interface and stores it in the receiving buffer, and then unpacks it. According to the format of the data packet, the actual IPMI response data is unpacked from the second KCS data packet. Then, the server parses the IPMI response data and executes the corresponding operation to complete a complete KCS communication and realize a complete KCS to IPMI processing flow closed loop. The present application uses an EC chip with an LPC interface to expand the KCS physical interface for a general SOC, and deploys a set of software on the EC to realize a virtual KCS interface coprocessor, providing KCS communication capability for a BMC system implemented based on a general SOC.
[0117] The application introduces a bridging mechanism of SPI-LPC through EC, the EC is connected to a general SOC as an SPI slave device, data transmission is performed through SPI, and the EC end is connected to a server end through an LPC interface, so that the BMC system realized based on the general SOC can support protocol communication based on LPC; a software virtual KCS interface is arranged in the EC, so that the EC can simulate registers, a state machine and command analysis of the KCS protocol, and acts as a KCS coprocessor. This technology enables the BMC system realized based on the general SOC to support the KCS protocol, complete receiving, analysis and cross-interface data transmission of the KCS command, the SOC can query the buffer state of the EC in real time, active data acquisition of the SOC to the EC is realized, batch data processing and double buffering technology are adopted in the data encapsulation stage, fast preparation and switching of data are realized, an intelligent error detection and retransmission mechanism is proposed, and the integrity and efficiency of data transmission are ensured.
[0118] Figure 2 It is a structure schematic view of the KCS data communication device provided by the application, the KCS data communication device comprises a receiving unit 1, the receiving unit 1 is used for receiving a first KCS data packet transmitted from a server through the first LPC bus interface, and the first KCS data packet is unpacked by using a virtual KCS register to obtain unpacked data, the first KCS data packet at least comprises an encapsulated IPMI command, and the working principle of the receiving unit 1 can refer to the foregoing step 101, and details are not described herein.
[0119] The KCS data communication device further comprises an encapsulation unit 2, the encapsulation unit 2 is used for encapsulating the unpacked data into a first SPI data packet, and the first SPI data packet is sent to an SPI data processing buffer by the virtual KCS register, the SPI data processing buffer comprises a current buffer and a standby buffer, the current buffer and the standby buffer are used for processing data sending and receiving in a cyclic alternating manner, and the working principle of the encapsulation unit 2 can refer to the foregoing step 102, and details are not described herein.
[0120] The KCS data communication device further comprises a sending unit 3, the sending unit 3 is used for sending the first SPI data packet to a system on chip (SOC) by using an SPI bus in the case that a polling request from the SOC is acquired, so as to instruct the SOC to unpack the first SPI data packet to obtain an IPMI command, acquire IPMI response data according to the IPMI command, and send the IPMI response data after being encapsulated into a second SPI data packet, and the working principle of the sending unit 3 can refer to the foregoing step 103, and details are not described herein.
[0121] The KCS data communication device further comprises an unsealing unit 4, which is configured to receive a second SPI data packet from the system on chip (SOC) through the SPI bus, unseal the second SPI data packet through a virtual KCS register, obtain the IPMI response data, encapsulate the IPMI response data into a second KCS data packet, and send the second KCS data packet to the server through the first LPC bus interface, so as to instruct the server to unseal the second KCS data packet to obtain the IPMI response data and perform a response operation according to the IPMI response data. The working principle of the unsealing unit 4 can refer to the foregoing step 104, and details are not described herein again.
[0122] The application introduces a bridging mechanism of SPI-LPC through an EC, the EC is connected to a general SOC as an SPI slave device, data transmission is performed between the EC and the SOC through the SPI, and the EC end is connected to a server end through an LPC interface, so that a BMC system realized based on the general SOC can support protocol communication based on the LPC; a software virtual KCS interface is arranged in the EC, so that the EC can simulate registers, a state machine and command analysis of the KCS protocol, and acts as a KCS coprocessor. This technology enables the BMC system realized based on the general SOC to support the KCS protocol, and to complete receiving, analysis and cross-interface data transmission of the KCS command; the SOC can query the buffer state of the EC in real time, and actively acquire data of the EC; in the data encapsulation stage, batch data processing and double-buffering technology are adopted, so as to realize rapid preparation and switching of data; an intelligent error detection and retransmission mechanism is proposed, so as to ensure the integrity and efficiency of data transmission.
[0123] Figure 3 is a structural schematic diagram of a KCS data communication system provided by the application. The KCS data communication system comprises a baseboard management controller (BMC) and a server, the baseboard management controller (BMC) is in communication connection with the server;
[0124] The baseboard management controller (BMC) comprises a system on chip (SOC) and an EC, the EC comprises a first LPC bus interface, a virtual KCS register and an SPI data processing buffer, and the EC is configured to execute the KCS data communication method in any one of claims 1-8;
[0125] The system on chip (SOC) is connected to the SPI data processing buffer through an SPI bus, the SPI data processing buffer is connected to the virtual KCS register, and the virtual KCS register is connected to the first LPC bus interface;
[0126] The server comprises an LPC bus second interface and a KCS register, the LPC bus first interface connects the LPC bus second interface through an LPC bus, and the LPC bus second interface connects the KCS register.
[0127] Figure 4 The KCS data communication system provided by the application is shown in the flowchart, and specifically comprises: generating an IPMI command at a server end, encapsulating IPMI data into a KCS data packet at the server end, simulating a KCS register by software at an EC end, transmitting the KCS data packet to the EC through an LPC interface, unpacking the KCS data packet into IPMI data at the EC, encapsulating the IPMI data into an SPI data packet, continuously polling the EC by an SOC through an SPI, reading and unpacking the SPI data into an IPMI command, processing and obtaining an IPMI response, encapsulating the IPMI response into an SPI data packet and sending the SPI data packet back to the EC, unpacking the SPI data into IPMI data at the EC, encapsulating the IPMI data into a KCS data packet, transmitting the KCS data back to the server end through the LPC interface at the EC, unpacking the KCS data at the server end, and processing the response.
[0128] The application introduces a bridging mechanism of SPI-LPC through an EC, the EC is connected to a general SOC as an SPI slave device, data transmission is performed between the EC and the SOC through an SPI, and the EC end is connected to a server end through an LPC interface, so that a BMC system realized based on the general SOC can support protocol communication based on the LPC; a software virtual KCS interface is introduced in the EC, so that the EC can simulate a register, a state machine and command analysis of the KCS protocol and act as a KCS coprocessor. This technology enables the BMC system realized based on the general SOC to support the KCS protocol, complete receiving, analysis and cross-interface data transmission of the KCS command, the SOC actively acquires data of the EC by querying a buffer state of the EC in real time, batch data processing and double-buffering technology are adopted in the data encapsulation stage, so as to realize rapid preparation and switching of data, an intelligent error detection and retransmission mechanism is proposed, and the integrity and efficiency of data transmission are ensured.
[0129] Figure 5 The electronic device provided by the application is shown in the structural diagram. Figure 5As shown, the electronic device can include a processor 510, a communications interface 520, a memory 530, and a communications bus 540, wherein the processor 510, the communications interface 520, and the memory 530 complete mutual communication through the communications bus 540. The processor 510 can invoke a logical instruction in the memory 530 to execute a KCS data communication method, which includes receiving a first KCS data packet transmitted from a server through the LPC bus first interface, unpacking the first KCS data packet through a virtual KCS register to obtain unpacked data, wherein the first KCS data packet at least includes an encapsulated IPMI command; encapsulating the unpacked data into a first SPI data packet, and sending the first SPI data packet to an SPI data processing buffer by the virtual KCS register, wherein the SPI data processing buffer includes a current buffer and a standby buffer, and the current buffer and the standby buffer are used to process data transmission and reception in a cyclic alternating manner; in the case of obtaining a polling request from a system on chip (SOC), sending the first SPI data packet to the SOC through an SPI bus to instruct the SOC to unpack the first SPI data packet to obtain an IPMI command, obtain IPMI response data according to the IPMI command, and send the IPMI response data after encapsulating the IPMI response data into a second SPI data packet; receiving the second SPI data packet from the SOC through the SPI bus, unpacking the second SPI data packet through the virtual KCS register to obtain the IPMI response data, encapsulating the IPMI response data into a second KCS data packet, and sending the second KCS data packet to the server through the LPC bus first interface to instruct the server to unpack the second KCS data packet to obtain the IPMI response data, and execute a response operation according to the IPMI response data.
[0130] Further, the logic instructions in the memory 530 described above can be implemented in the form of software functional units and sold or used as independent products, and can be stored in a computer readable storage medium. Based on such understanding, the technical solutions of the present application essentially or the parts that contribute to the prior art or parts of the technical solutions can be embodied in the form of a software product. The computer software product is stored in a storage medium, and includes a number of instructions for causing a computer device (which can be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of the present application. The aforementioned storage medium includes: a U disk, a mobile hard disk, a read-only memory (ROM, Read-Only Memory), a random access memory (RAM, Random Access Memory), a magnetic disk or an optical disk, and various media that can store program codes.
[0131] In another aspect, the present application also provides a computer program product, which comprises a computer program, the computer program can be stored on a non-transitory computer readable storage medium, and the computer program can be executed by a processor to enable a computer to perform a KCS data communication method provided by the above-mentioned methods. The method comprises: receiving a first KCS data packet transmitted from a server by using a first LPC bus interface, and unpacking the first KCS data packet by using a virtual KCS register to obtain unpacked data, wherein the first KCS data packet at least comprises an encapsulated IPMI command; encapsulating the unpacked data into a first SPI data packet, and sending the first SPI data packet to an SPI data processing buffer by using the virtual KCS register, wherein the SPI data processing buffer comprises a current buffer and a standby buffer, and the current buffer and the standby buffer are used to process data transmission and reception in a cyclic alternating manner; in the case of obtaining a polling request from a system on chip (SOC), sending the first SPI data packet to the SOC by using an SPI bus to instruct the SOC to unpack the first SPI data packet to obtain an IPMI command, and obtaining IPMI response data according to the IPMI command and sending the IPMI response data after encapsulating the IPMI response data into a second SPI data packet; receiving the second SPI data packet from the SOC by using the SPI bus, unpacking the second SPI data packet by using the virtual KCS register to obtain the IPMI response data, encapsulating the IPMI response data into a second KCS data packet, and sending the second KCS data packet to the server by using the first LPC bus interface to instruct the server to unpack the second KCS data packet to obtain the IPMI response data and perform a response operation according to the IPMI response data.
[0132] In yet another aspect, the present application also provides a non-transitory computer readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the KCS data communication method provided by the above method, and the method comprises: receiving a first KCS data packet transmitted from a server by using the first LPC bus interface, and unpacking the first KCS data packet by using a virtual KCS register to obtain unpacked data, wherein the first KCS data packet at least comprises an encapsulated IPMI command; encapsulating the unpacked data into a first SPI data packet, and sending the first SPI data packet to an SPI data processing buffer by using the virtual KCS register, wherein the SPI data processing buffer comprises a current buffer and a standby buffer, and the current buffer and the standby buffer are used to process data transmission and reception in a cyclically alternating manner; in the case of obtaining a polling request from a system on chip (SOC), sending the first SPI data packet to the SOC by using an SPI bus to instruct the SOC to unpack the first SPI data packet to obtain an IPMI command, obtain IPMI response data according to the IPMI command, and send the IPMI response data after encapsulating the IPMI response data into a second SPI data packet; receiving the second SPI data packet from the SOC by using the SPI bus, unpacking the second SPI data packet by using a virtual KCS register to obtain the IPMI response data, encapsulating the IPMI response data into a second KCS data packet, and sending the second KCS data packet to the server by using the first LPC bus interface to instruct the server to unpack the second KCS data packet to obtain the IPMI response data, and perform a response operation according to the IPMI response data.
[0133] The device embodiments described above are only schematic, wherein the units illustrated as separate components can or can not be physically separate, and the components illustrated as units can or can not be physical units, i.e., can be located in one place or distributed on a plurality of network units. Some or all of the modules can be selected according to actual needs to achieve the purpose of the present embodiment scheme. Those skilled in the art can understand and implement without creative labor.
[0134] Those skilled in the art can clearly understand the technical solutions of the various embodiments from the above description of the embodiments, and the various embodiments can be implemented by means of software with the necessary general hardware platforms, and of course, can also be implemented by hardware. Based on such understanding, the above technical solutions, essentially or in other words, the part of the prior art that makes a contribution, can be embodied in the form of a software product, which can be stored in a computer readable storage medium, such as a ROM / RAM, a magnetic disk, an optical disk, and the like, and includes a number of instructions for causing a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in the various embodiments or some parts of the embodiments.
[0135] Finally, it should be noted that: the above embodiments are only used to illustrate the technical solutions of the present application, and not to limit them; although the present application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that: it can still modify the technical solutions recorded in the foregoing embodiments, or make equivalent replacement for some technical features therein; and these modifications or replacements do not make the essence of the corresponding technical solutions deviate from the spirit and scope of the technical solutions of the embodiments of the present application.
Claims
1. A KCS data communication method applied to an embedded controller (EC), characterized in that, A baseboard management controller (BMC) is in communication connection with a server, the BMC comprising a system on chip (SOC) and an embedded controller (EC), the EC comprising an LPC bus first interface, a virtual KCS register and an SPI data processing buffer, comprising: receiving a first KCS data packet transmitted from the server through the LPC bus first interface, and unpacking the first KCS data packet through the virtual KCS register to obtain unpacked data, the first KCS data packet comprising at least an encapsulated IPMI command; encapsulating the unpacked data into a first SPI data packet, and sending the first SPI data packet to the SPI data processing buffer through the virtual KCS register, the SPI data processing buffer comprising a current buffer and a standby buffer, and the current buffer and the standby buffer being used to process data transmission and reception in a cyclic alternating manner; in a case where a polling request from the SOC is obtained, sending the first SPI data packet to the SOC through an SPI bus to instruct the SOC to unpack the first SPI data packet to obtain an IPMI command, obtaining IPMI response data according to the IPMI command, and sending the IPMI response data after being encapsulated into a second SPI data packet; receiving the second SPI data packet from the SOC through the SPI bus, unpacking the second SPI data packet through the virtual KCS register to obtain the IPMI response data, encapsulating the IPMI response data into a second KCS data packet, and sending the second KCS data packet to the server through the LPC bus first interface to instruct the server to unpack the second KCS data packet to obtain the IPMI response data, and performing a response operation according to the IPMI response data.
2. The KCS data communication method of claim 1, wherein, Before receiving the first KCS data packet transmitted from the server through the LPC bus first interface, the method further comprises: initializing a KCS register in the server, setting a KCS register pointer, configuring an idle state, constructing a message header according to a network function code, a command code and command data, calculating a checksum of a data packet according to a format of an IPMI protocol, and building the IPMI command; in a case where a write command is received, switching the idle state to a write data state, and sequentially writing each byte of the IPMI command to the KCS register by using a double buffering mechanism and a batch data transmission technology, the double buffering mechanism being used to alternately process data through two set buffers to realize data transmission and data switching, and the batch data transmission technology being used to transmit a plurality of data bytes or data blocks in a preset unit at a time; after the writing of the IPMI command is completed, marking the end of data encapsulation by a write end command, and switching the KCS state from the write data state to a write completion stage.
3. The KCS data communication method of claim 1, wherein, Before unpacking the first KCS data packet through the virtual KCS register, the method further comprises: The virtual KCS register is initialized by using a preset function Kcs_regs_init, an initial state of the virtual KCS register is set, a state flag is cleared, and data input registers and data output registers are reset to initial values; The reading and writing operations of the virtual KCS register are simulated by using preset functions Ls_kcs_inb and Ls_kcs_outb, the writing operations of the data input registers and the command registers are simulated by using preset functions Write_idr and Write_cmd, the state values of the virtual KCS register are updated according to a mask by using a preset function Ls_kcs_updateb, in the writing operation of the virtual KCS register, according to different interrupt types, the preset functions Lpc_send_edge_int_evt or Lpc_send_level_int_evt are called to simulate interrupt events triggered when the state of the virtual KCS register changes, and IO operations on the virtual KCS register are simulated by using preset functions Iord_short and Iowr_short.
4. The KCS data communication method of claim 1, wherein, The encapsulated data after the unsealing is a first SPI data packet, and the virtual KCS register sends the first SPI data packet to an SPI data processing buffer, including: According to the unsealed data, the first SPI data packet is generated, and a state machine Spi_phase is defined to manage different phases of transmission of the first SPI data packet. The first SPI data packet is sent to the SPI data processing buffer by using a double buffering mechanism, and SPI transmission parameters are set by using a preset variable Transfer_size.
5. The KCS data communication method of claim 4, wherein, The state machine Spi_phase is defined to manage different phases of transmission of the first SPI data packet, including: wherein T switch represents the time interval of state switching, W data is the weight of the current data amount, P is the priority of the command, the larger the value, the higher the priority, and a is an adjustment factor for balancing the relationship between the current data amount and the priority.
6. The KCS data communication method of claim 4, wherein, Before or after the state machine Spi_phase is defined, the method further includes: In the data transmission process, if the error occurrence frequency exceeds a preset threshold, the retry number is increased, and the calculation formula of the retry number is: N retry is the number of retries, E count represents the number of errors detected in the past time, E total is the maximum number of errors allowed, and γ is the base number of retries.
7. The KCS data communication method of claim 1, wherein, The first SPI data packet is sent to the system on chip SOC by using the SPI bus, including: When there is data in the SPI data processing buffer, according to a polling request of the system on chip SOC, command data is read by using a preset function Receive_ipmi_command, the first SPI data packet is sent to the system on chip SOC by using the SPI bus, and the system on chip SOC cyclically receives data in batches, and when the data is less than 32 bytes, all the remaining data is read at one time; otherwise, the data is obtained in a block manner; When there is no data in the SPI data processing buffer, a default value is returned to represent that there is no available data at present.
8. The KCS data communication method of claim 1, wherein, After the first SPI data packet is sent to the system on chip SOC by using the SPI bus, the method further includes: The system on chip SOC is instructed to unseal the first SPI data packet to obtain an IPMI command. forwarding the IPMI command to a Dbus service, parsing a structure of the IPMI command by a preset function Handle_ipmi_command, calling an Execute method of a Xyz.openbmc_project.Ipmi.Server service by the Dbus, executing the IPMI command, and obtaining IPMI response data; after the Dbus processing is completed, encapsulating the IPMI response data into a second SPI data packet and sending and returning the second SPI data packet to the EC.
9. A KCS data communication device, characterized by The method comprises the following steps: a receiving unit is configured to receive a first KCS data packet transmitted from a server by using a first LPC bus interface, and to obtain unpacked data by unpacking the first KCS data packet by using a virtual KCS register, wherein the first KCS data packet at least comprises an encapsulated IPMI command; an encapsulating unit is configured to encapsulate the unpacked data into a first SPI data packet, and to send the first SPI data packet to an SPI data processing buffer by using the virtual KCS register, wherein the SPI data processing buffer comprises a current buffer and a standby buffer, and the current buffer and the standby buffer are configured to process data transmission and reception in a cyclic alternating manner; a sending unit is configured to send the first SPI data packet to a system on chip (SOC) by using an SPI bus to instruct the SOC to unpack the first SPI data packet to obtain an IPMI command, to obtain IPMI response data according to the IPMI command, and to send the IPMI response data after encapsulating the IPMI response data into a second SPI data packet; an unpacking unit is configured to receive the second SPI data packet from the SOC by using the SPI bus, to obtain the IPMI response data by unpacking the second SPI data packet by using the virtual KCS register, to encapsulate the IPMI response data into a second KCS data packet, and to send the second KCS data packet to the server by using the first LPC bus interface to instruct the server to unpack the second KCS data packet to obtain the IPMI response data and to perform a response operation according to the IPMI response data.
10. A KCS data communication system, characterized by The method comprises the following steps: a baseboard management controller (BMC) and a server are communicatively connected; the BMC comprises an SOC and an EC, the EC comprises a first LPC bus interface, a virtual KCS register, and an SPI data processing buffer, and the EC is configured to perform the KCS data communication method in any one of claims 1-8; the SOC is connected to the SPI data processing buffer by using an SPI bus, the SPI data processing buffer is connected to the virtual KCS register, and the virtual KCS register is connected to the first LPC bus interface. The server comprises an LPC bus second interface and a KCS register, the LPC bus first interface connects the LPC bus second interface through an LPC bus, and the LPC bus second interface connects the KCS register.
Citation Information
Patent Citations
Method for realizing KCS communication based on SPI bus
CN115221087A
Server operating system communication method and device
CN118467452A