KCS data communication method, device and system
By introducing a coprocessor with an EC chip with an LPC interface and a virtual KCS interface on a general SOC, the problem of the general SOC lacking LPC interface and KCS register support is solved, and the KCS communication capability and efficient data transmission of the BMC system are realized.
Patent Information
- Application Number
- CN202510073137.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-01-17
- Publication Date
- 2025-06-06
- Estimated Expiration
- 2045-01-17
Smart Images

Figure CN120104545A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of BMC applications, and in particular to a KCS data communication method, device and system. Background Art
[0002] With the rapid development of computer technology, server management and system monitoring are particularly important in modern data centers and enterprise environments. To achieve remote management of computer systems, the IPMI protocol, as an open standard, is widely used in server hardware management.
[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 main 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 supporting firmware. Compared with the dedicated BMC chip, the general-purpose SOC has powerful computing performance and rich interface selection, with a wide range of optional models, which can be used to build the BMC system.
[0004] However, compared with the dedicated BMC chip, the general SOC lacks native LPC interface and KCS register support, and the BMC system implemented based on the general SOC cannot provide KCS communication capabilities, and cannot meet the management requirements of the new hardware platform. At present, there is no technical solution that can solve the above technical problems, and there is no KCS data communication method, device and system. Summary of the invention
[0005] The present invention provides a KCS data communication method, device and system, which expands a KCS physical interface for a general SOC by using an EC chip with an LPC interface, and deploys a set of software on the EC to implement a coprocessor with a virtual KCS interface, thereby providing KCS communication capabilities for a BMC system implemented based on a general SOC.
[0006] In a first aspect, the present invention provides a KCS data communication method, which is applied to an embedded controller EC, a baseboard 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 a first LPC bus interface, a virtual KCS register and an SPI data processing buffer, including:
[0007] Using the first interface of the LPC bus to receive a first KCS data packet transmitted from the server, and using the virtual KCS register to unpack the first KCS data packet to obtain unpacked data, wherein the first KCS data packet at least includes the encapsulated IPMI command;
[0008] Encapsulating the unpacked data into 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 comprising a current buffer and a standby buffer, the current buffer and the standby buffer being used to process data sending and receiving in a cyclic alternating processing manner;
[0009] In the case of obtaining a polling request from the system on chip SOC, using the SPI bus to send the first SPI data packet to the system on chip SOC to instruct the system on chip SOC to decapsulate the first SPI data packet to obtain an IPMI command, obtain IPMI response data according to the IPMI command, and encapsulate the IPMI response data into a second SPI data packet before sending;
[0010] The SPI bus is used to receive a second SPI data packet from the system on chip SOC, the virtual KCS register is used to unpack the second SPI data packet to obtain the IPMI response data, the IPMI response data is encapsulated into a second KCS data packet, and the second KCS data packet is sent to the server using the first interface of the LPC bus to instruct the server to unpack 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 present invention, before using the first interface of the LPC bus to receive the first KCS data packet transmitted from the server, the method further includes:
[0012] Initialize the KCS register in the server, set the KCS register pointer, configure it to an idle state, construct a message header according to the network function code, command code and command data, calculate the checksum of the data packet according to the format of the IPMI protocol, and construct the IPMI command;
[0013] When a write command is received, the idle state is switched to a data write state, and each byte of the IPMI command is sequentially written to the KCS register using a double buffer mechanism and a batch data transmission technology, wherein the double buffer mechanism is used to process data alternately through two buffers to achieve data transmission and data switching, and the batch data transmission technology is used to transmit multiple data bytes or data blocks in one go by packaging them into a preset unit;
[0014] After the IPMI command is written, a write end command is used to mark the end of data encapsulation, 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 present invention, before unpacking the first KCS data packet using the virtual KCS register, the method further includes:
[0016] Use the preset function Kcs_regs_init to initialize the virtual KCS register, set the initial state of the virtual KCS register, clear the status flag, and reset the data input register and data output register to the initial value;
[0017] Use the preset functions Ls_kcs_inb and Ls_kcs_outb to simulate the read and write operations of the virtual KCS register. Use the preset functions Write_idr and Write_cmd to simulate the write operations of the data input register and the command register respectively. Use the preset function Ls_kcs_updateb to update the status value of the virtual KCS register according to the mask. In the write operation of the virtual KCS register, call the preset function Lpc_send_edge_int_evt or Lpc_send_level_int_evt according to different interrupt types to simulate the interrupt event triggered when the virtual KCS register status changes. Use the preset functions Iord_short and Iowr_short to simulate the IO operations on the virtual KCS register.
[0018] According to the KCS data communication method provided by the present invention, the encapsulation and the unpacking data are a first SPI data packet, and the virtual KCS register sends the first SPI data packet to the SPI data processing buffer, including:
[0019] Generate the first SPI data packet according to the decapsulated data, and define a state machine Spi_phase for managing different phases of transmission of the first SPI data packet;
[0020] The first SPI data packet is sent to the SPI data processing buffer using a double buffer mechanism, and the SPI transmission parameters are set using a preset variable Transfer_size.
[0021] According to the KCS data communication method provided by the present invention, the defined state machine Spi_phase is used to manage different phases of the first SPI data packet transmission, including:
[0022]
[0023] Among them, Tswitch Indicates the time interval of state switching, W data is the weight of the current data volume, P is the priority of the command, the larger the value is, the higher the priority is, and α is the adjustment factor, which is 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] During data transmission, if the error frequency exceeds a preset threshold, the number of retries is increased. The calculation formula for the number of retries is:
[0026]
[0027] N retry is the number of retries, E count Indicates the number of errors detected in the past period of time, E total is the maximum number of errors allowed, and γ is the basic number of retries.
[0028] According to the KCS data communication method provided by the present invention, the sending of the first SPI data packet to the system on chip SOC using the SPI bus includes:
[0029] When there is data in the SPI data processing buffer, according to the polling request of the system on chip SOC, the preset function Receive_ipmi_command is used to read the command data, and the first SPI data packet is sent to the system on chip SOC using the SPI bus. The system on chip SOC receives data in batches cyclically. When the data is less than 32 bytes, all the remaining data is read at one time; otherwise, the data is obtained in blocks;
[0030] When there is no data in the SPI data processing buffer, the default value is returned to indicate that there is 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 chip SOC using the SPI bus, the method further includes:
[0032] Instructing the system on chip SOC to decapsulate the first SPI data packet to obtain an IPMI command;
[0033] Forward the IPMI command to the Dbus service, parse the structure of the IPMI command through the preset function Handle_ipmi_command, call the Execute method of the Xyz.openbmc_project.Ipmi.Server service through DBus, execute the IPMI command, and obtain 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, comprising:
[0036] A receiving unit, the receiving unit is used to receive a first KCS data packet transmitted from a server by using the first interface of the LPC bus, and to decapsulate the first KCS data packet by using a virtual KCS register to obtain decapsulated data, wherein the first KCS data packet at least includes an encapsulated IPMI command;
[0037] An encapsulation unit, wherein the encapsulation unit is used to encapsulate the unpacked data into a first SPI data packet, wherein the virtual KCS register sends the first SPI data packet to an SPI data processing buffer, wherein the SPI data processing buffer includes a current buffer and a standby buffer, wherein the current buffer and the standby buffer are used to process data sending and receiving in a cyclic alternating processing manner;
[0038] A sending unit, wherein the sending unit is used to send the first SPI data packet to the system on chip SOC by using the SPI bus when a polling request from the system on chip SOC is obtained, so as to instruct the system on chip SOC to decapsulate the first SPI data packet to obtain an IPMI command, obtain IPMI response data according to the IPMI command, and encapsulate the IPMI response data into a second SPI data packet before sending;
[0039] The unpacking unit is used to receive a second SPI data packet from the system on chip SOC by using the SPI bus, unpack the second SPI data packet by using the virtual KCS register, obtain the IPMI response data, encapsulate the IPMI response data into a second KCS data packet, send the second KCS data packet to the server by using the first interface of the LPC bus to instruct the server to unpack the second KCS data packet, 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 baseboard management controller BMC is communicatively connected with the server;
[0041] The baseboard management controller BMC includes a system on chip SOC and an EC, the EC includes a first LPC bus interface, a virtual KCS register and an SPI data processing buffer, and the EC is used to execute the KCS data communication method according to any one of claims 1 to 8;
[0042] The system on chip SOC is connected to the SPI data processing buffer via the SPI bus, the SPI data processing buffer is connected to the virtual KCS register, and the virtual KCS register is connected to the first interface of the LPC bus;
[0043] The server comprises a second LPC bus interface and a KCS register, the first LPC bus interface is connected to the second LPC bus interface via the LPC bus, and the second LPC bus interface is connected to the KCS register.
[0044] The present invention introduces the SPI-LPC bridging mechanism through EC. EC is connected to the general SOC as an SPI slave device, and data is transmitted with SOC through SPI, while the EC end is connected to the server end through the LPC interface, so that the BMC system implemented based on the general SOC can support LPC-based protocol communication; through the software virtual KCS interface in EC, EC can simulate the register, state machine and command parsing of the KCS protocol and act as a KCS coprocessor. This technology enables the BMC system implemented based on the general SOC to support the KCS protocol, complete the reception, parsing and cross-interface data transmission of KCS commands; SOC queries the buffer status of EC in real time to realize the active acquisition of EC data by SOC; in the data encapsulation stage, batch data processing and double buffering technology are adopted to realize rapid preparation and switching of data; an intelligent error detection and retransmission mechanism is proposed to ensure the integrity and efficiency of data transmission. BRIEF DESCRIPTION OF THE DRAWINGS
[0045] In order to more clearly illustrate the technical solutions in the present invention or the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0046] Figure 1 It is a flow chart of the KCS data communication method provided by the present invention;
[0047] Figure 2It is a structural schematic diagram of the KCS data communication device provided by the present invention;
[0048] Figure 3 It is a structural schematic diagram of the KCS data communication system provided by the present invention;
[0049] Figure 4 It is a flow chart of the KCS data communication system provided by the present invention;
[0050] Figure 5 It is a structural schematic diagram of the electronic device provided by the present invention. DETAILED DESCRIPTION
[0051] In order to make the purpose, technical solution and advantages of the present invention clearer, the technical solution of the present invention will be clearly and completely described below in conjunction with the drawings of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0052] Figure 1 The present invention provides a flow chart of the KCS data communication method, which is applied to an embedded controller EC, a baseboard management controller BMC and a server communication connection, the BMC includes a system on chip SOC and an embedded controller EC, the EC includes a first LPC bus interface, a virtual KCS register and an SPI data processing buffer, and the baseboard management controller BMC is an independent microcontroller in the server and computer system, which is specifically used to manage and monitor the hardware status. Its main responsibility is to monitor and control the key hardware of the system (such as processor, memory, hard disk, fan, power supply, etc.). The embedded controller EC is a microcontroller, which is usually integrated on a computer motherboard and is used to manage and control various low-speed hardware devices in the system. EC runs independently of the main processor and can perform some auxiliary functions, mainly used for tasks such as power management, temperature control, keyboard scanning, and fan speed regulation. KCS is an interface standard for communication between the main processor (CPU) and BMC in a computer system. KCS is one of several interfaces defined in the IPMI specification, which is used to realize data transmission between the main processor and BMC.
[0053] The KCS data communication method comprises:
[0054] Step 101: using the first interface of the LPC bus to receive a first KCS data packet transmitted from a server, and using a virtual KCS register to decapsulate the first KCS data packet to obtain decapsulated data, wherein the first KCS data packet at least includes an encapsulated IPMI command;
[0055] Step 102: encapsulate the unpacked data into a first SPI data packet, and the virtual KCS register sends the first SPI data packet to an SPI data processing buffer, 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 sending and receiving in a cyclic alternating processing manner;
[0056] Step 103: when a polling request is obtained from the system on chip SOC, the first SPI data packet is sent to the system on chip SOC by using the SPI bus to instruct the system on chip SOC to decapsulate the first SPI data packet to obtain an IPMI command, obtain IPMI response data according to the IPMI command, encapsulate the IPMI response data into a second SPI data packet and then send it;
[0057] Step 104: Receive a second SPI data packet from the system on chip SOC using the SPI bus, decapsulate the second SPI data packet using the virtual KCS register to 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 using the first interface of the LPC bus to instruct the server to decapsulate the second KCS data packet to obtain the IPMI response data, and perform a response operation according to the IPMI response data.
[0058] In step 101, before using the first interface of the LPC bus to receive a first KCS data packet transmitted from a server, the method further includes:
[0059] Initialize the KCS register in the server, set the KCS register pointer, configure it to an idle state, construct a message header according to the network function code, command code and command data, calculate the checksum of the data packet according to the format of the IPMI protocol, and construct the IPMI command;
[0060] When a write command is received, the idle state is switched to a data write state, and each byte of the IPMI command is sequentially written to the KCS register using a double buffer mechanism and a batch data transmission technology, wherein the double buffer mechanism is used to process data alternately through two buffers to achieve data transmission and data switching, and the batch data transmission technology is used to transmit multiple data bytes or data blocks in one go by packaging them into a preset unit;
[0061] After the IPMI command is written, a write end command is used to mark the end of data encapsulation, and the KCS state is switched from the write data state to the write completion stage.
[0062] Specifically, before encapsulating and transmitting KCS data, we first need to initialize the state machine of the KCS protocol: 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 buffers, and ensure that the data pointer and error flag have been cleared to prepare for subsequent data encapsulation and transmission; then build the IPMI data packet. Building the IPMI data packet 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); calculating the checksum of the data packet according to the format of the IPMI protocol to ensure data integrity; for important commands, use data priority management to prioritize the construction and transmission of 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 to encapsulate it into a KCS data packet:
[0064] Write start phase: When a write start command is received, the KCS state switches from the idle state to the write data phase (KCS_PHASE_WRITE_DATA);
[0065] Data writing phase: Write each byte of IPMI data into the KCS register in turn. Use batch data transmission technology to reduce the waiting time for byte-by-byte writing and improve transmission efficiency. Batch data transmission technology is a method of transmitting multiple data bytes or data blocks in one unit during data transmission. In the implementation of the KCS interface, the traditional data transmission method is to write and read byte by byte. After each byte is transmitted, it is necessary to wait for the register status to be updated before the next byte is transmitted. Batch transmission reduces the number of state switching during data transmission by packaging multiple bytes of data and writing them into the register or buffer at one time. 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 it is encapsulated into KCS data, thereby improving the efficiency of data transmission and the overall performance of the system.
[0066] In the data writing stage, the present invention adopts a double buffer mechanism, that is, in the data transmission process, 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. The double buffer mechanism is a technology used to improve the efficiency of data transmission. By setting two buffers (one for processing the current data and the other for preparing the next batch of data), continuous data transmission and seamless switching are achieved.
[0067] The specific workflow of the double buffering mechanism is as follows:
[0068] Phase 1, data processing starts: a KCS buffer (current buffer) is being used by the system for encapsulation and transmission of the current IPMI command data. At the same time, the standby buffer is idle to prepare for the next batch of data;
[0069] Phase 2, switching buffers: When the data in the current buffer is processed, the standby buffer is immediately switched to the current buffer to continue encapsulating and transmitting the current IPMI command data. The original current buffer becomes the standby buffer to prepare for the next data batch;
[0070] Phase 3, cyclic alternation: The above process is cyclically alternating, and the two buffers continuously switch roles to achieve continuous processing of IPMI data. This alternating method avoids pauses in data processing and achieves "seamless" data transmission.
[0071] Write completion phase: After all data is written, the write completion command is used to mark the end of data encapsulation, and the KCS state is switched to the write completion phase (KCS_PHASE_WRITE_DONE).
[0072] Optionally, before unpacking the first KCS data packet using the virtual KCS register, the method further includes:
[0073] Use the preset function Kcs_regs_init to initialize the virtual KCS register, set the initial state of the virtual KCS register, clear the status flag, and reset the data input register and data output register to the initial value;
[0074] Use the preset functions Ls_kcs_inb and Ls_kcs_outb to simulate the read and write operations of the virtual KCS register. Use the preset functions Write_idr and Write_cmd to simulate the write operations of the data input register and the command register respectively. Use the preset function Ls_kcs_updateb to update the status value of the virtual KCS register according to the mask. In the write operation of the virtual KCS register, call the preset function Lpc_send_edge_int_evt or Lpc_send_level_int_evt according to different interrupt types to simulate the interrupt event triggered when the virtual KCS register status changes. Use the preset functions Iord_short and Iowr_short to simulate the IO operations on the virtual KCS register.
[0075] Optionally, a general-purpose SOC does not have a native LPC interface and a KCS register, and needs to implement the KCS interface through an external LPC and KCS coprocessor. The KCS protocol is generally implemented based on the LPC physical interface, the KCS coprocessor and the corresponding firmware. The present invention simulates the KCS register on the EC as a KCS coprocessor, and expands the KCS physical interface for the general-purpose SOC by using an EC chip with an LPC interface, and deploys a set of software on the EC to implement a coprocessor with a virtual KCS interface, thereby providing the BMC system implemented based on the general-purpose SOC with the KCS communication capability, while maintaining a high communication efficiency, and being suitable for a wide range of application scenarios.
[0076] First, initialize the KCS registers, initialize the KCS registers through the "kcs_regs_init" function, set the initial state of the registers, clear the status flags, reset the data input registers and data output registers to the initial values, and ensure that the registers start from a known state.
[0077] Then simulate the read and write operations of the KCS register through the "ls_kcs_inb" and "ls_kcs_outb" functions. The "ls_kcs_inb" function reads the value of the data input register (IDR) or the status register (OBF) to simulate the read behavior of the KCS register. The "ls_kcs_outb" function writes data to the data output register (ODR) and sets the corresponding status flags to simulate the write operation.
[0078] Then, simulate the processing of commands and data, and simulate the write operation of the data input register and the command register through the "write_idr" and "write_cmd" functions respectively. The "write_idr" process writes the data into the data input register and sets the IBF flag to indicate that the data is ready. The "write_cmd" process writes the command into the command register and sets the IBF and CMD_DAT flags to indicate that the command has been received.
[0079] Next, the management and update of the status register is simulated, and the status value of the register is updated according to the mask through the "ls_kcs_updateb" function to simulate the state change. It allows specific bits of the register to be set or cleared to reflect the state change in the KCS protocol.
[0080] Then, simulate the interrupt event. In the register write operation, call the "lpc_send_edge_int_evt" or "lpc_send_level_int_evt" function according to the different interrupt types to simulate the interrupt event triggered when the KCS register state changes.
[0081] Finally, simulate the IO operation and use the "iord_short" and "iowr_short" functions to simulate the IO operation on the KCS register: "iord_short" simulates the read operation and reads the register value through the specified address; "iowr_short" simulates the write operation and writes data to the register through the specified address.
[0082] In step 101, the present invention uses the first interface of the LPC bus to receive the first KCS data packet transmitted from the server, and uses the virtual KCS register to unpack the first KCS data packet to obtain unpacked data, wherein the first KCS data packet at least includes the 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 the chipset and low-speed devices (such as BIOS, super I / O controller, embedded controller EC, etc.), while maintaining low cost and space. IPMI is an intelligent platform management interface that can intelligently monitor, control and automatically report the operating status of a large number of servers across different operating systems, firmware and hardware platforms to reduce the cost of the server system.
[0083] Optionally, the first KCS data packet is transmitted to the EC via the LPC, and the EC decapsulates it. The encapsulated first KCS data packet is transmitted to the EC via the LPC interface. On the EC side, the KCS register is implemented based on simulation and can simulate the standard KCS protocol behavior. The specific process is as follows:
[0084] Initialization and configuration, in the whole system, first of all, the LPC and SPI interfaces must be initialized and configured to support data transmission: Initialize the LPC interface so that it can receive the first KCS data packet from the server, and configure the relevant interrupt mechanism to ensure that events during the transmission process can be handled. Initialize the SPI interface, including the configuration of the DMA controller, to improve the efficiency of data transmission. SPI configuration parameters such as polarity, phase, data frame size, etc., ensure that data can be correctly transmitted to the SOC through SPI.
[0085] In the reception and decapsulation of the first KCS data packet, the first KCS data packet from the server is received through the LPC interface. According to the steps of the KCS protocol, the EC receives data byte by byte from the LPC register and stores it in the local buffer. After receiving the first KCS data packet, the EC uses the state machine of the KCS protocol to parse it step by step. This process parses the data according to the different stages of the state machine to ensure the correct processing of the data:
[0086] The states of the virtual KCS register include the idle state (IDLE), write start (WRITE_START), write data (WRITE_DATA), and write end (WRITE_END). 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 and 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 the local buffer, and performs data verification, such as checking whether the length of the data is correct and whether the checksum matches. At each stage of data reception, the flag bits of the KCS status register (such as IBF and OBF flags) are checked to ensure the validity of the data until a complete IPMI command transmission is completed.
[0087] In step 102, the encapsulation of the decapsulated data is a first SPI data packet, and the virtual KCS register sends the first SPI data packet to the SPI data processing buffer, including:
[0088] Generate the first SPI data packet according to the decapsulated data, and define a state machine Spi_phase for managing different phases 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 buffer mechanism, and the SPI transmission parameters are set using a preset variable Transfer_size.
[0090] Optionally, the EC encapsulates the decapsulated data into a first SPI data packet, and after the EC completes the decapsulation of the KCS data and obtains the complete IPMI command, re-encapsulates the IPMI command into the first SPI data packet so as to be transmitted to the SOC through the SPI interface for further processing.
[0091] The specific process is as follows:
[0092] Generate the first SPI data packet according to the IPMI command content: IPMI commands usually contain command codes, command parameters and data. To ensure that the SOC can parse it correctly, the first SPI data packet needs to be encapsulated in a specific format. The data packet needs to contain command identifiers (such as command codes) and data length information. Some command codes, such as CMD_IPMI_SEND and CMD_IPMI_RESPONSE, are defined to indicate the type of data packet. When generating a data packet, fill these command codes 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, EC can decide the operation that should be performed currently.
[0094] Optionally, the present invention adopts a double buffer mechanism to improve data transmission efficiency and ensure seamless data switching, using two buffers "TxBuffer" and "RxBuffer" to store the sent and received data respectively. After the transmission is completed, the buffer is switched through the 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, the SPI transmission parameters are set. After the encapsulated first SPI data packet is stored in the SPI data processing buffer, the SPI transmission parameters need to be set to ensure that the data can be correctly transmitted to the SOC. The present invention can set a "transfer_size" variable to specify the number of data bytes currently required to be transmitted. According to different transmission stages, the value of "transfer_size" will change dynamically to adapt to the size of the data packet.
[0096] Optionally, the defined state machine Spi_phase is used to manage different phases of the first SPI data packet transmission, including:
[0097]
[0098] Among them, T switch Indicates the time interval of state switching, W data is the weight of the current data volume, P is the priority of the command, the larger the value is, the higher the priority is, and α is the adjustment factor, which is used to balance the relationship between the current data volume and the priority.
[0099] Optionally, a state machine mechanism (SPI_PHASE enumeration type) is used to manage the various stages 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 stages of SPI transmission to control the advancement of the transmission process. The present invention introduces an adaptive state switching mechanism, dynamically adjusts the state switching time according to the data volume and priority, and designs the state switching time. The mechanism can increase the state residence time when the data volume is large, and reduce the residence time for high-priority tasks, thereby adaptively improving the response speed of the system.
[0100] Optionally, before or after defining the state machine Spi_phase, the method further includes:
[0101] During data transmission, if the frequency of errors exceeds a preset threshold, the number of retries is increased. The calculation formula for the number of retries is:
[0102]
[0103] N retry is the number of retries, E count Indicates the number of errors detected in the past period of time, E total is the maximum number of errors allowed, and γ is the basic number of retries.
[0104] Optionally, during 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 the error. The present invention can increase the number of retries when the error frequency is high to ensure the success rate of data transmission, and reduce retries when the errors are less to save time.
[0105] In step 103, sending the first SPI data packet to the system on chip SOC by using the SPI bus includes:
[0106] When there is data in the SPI data processing buffer, according to the polling request of the system on chip SOC, the preset function Receive_ipmi_command is used to read the command data, and the first SPI data packet is sent to the system on chip SOC using the SPI bus. The system on chip SOC receives data in batches cyclically. When the data is less than 32 bytes, all the remaining data is read at one time; otherwise, the data is obtained in blocks;
[0107] When there is no data in the SPI data processing buffer, the default value is returned to indicate that there is no available data.
[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.). The SOC continuously initiates polling requests to the EC through the SPI to obtain the IPMI command data of the EC. As the SPI master device, the SOC actively initiates a data transmission request, and the EC responds to the request as a slave device. The SOC queries the EC whether there is new IPMI data available 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 determined whether there is an IPMI command to be received based on the data returned by the EC. If the received command is "CMD_IPMI_SEND" and the data length is greater than 0, it means that there is a new IPMI command to be processed.
[0109] Optionally, if there is data available in the buffer, EC will return the corresponding data according to the SOC's request. Read the command data from EC through the "receive_ipmi_command" function, and receive the data in batches using a loop. If the data is less than 32 bytes, read the remaining data at once; otherwise, get the data in blocks. If there is no data (EC buffer is empty), the default value will be returned, indicating that there is no data available at present.
[0110] Optionally, after sending the first SPI data packet to the system on chip SOC by using the SPI bus, the method further includes:
[0111] Instructing the system on chip SOC to decapsulate the first SPI data packet to obtain an IPMI command;
[0112] Forward the IPMI command to the Dbus service, parse the structure of the IPMI command through the preset function Handle_ipmi_command, call the Execute method of the Xyz.openbmc_project.Ipmi.Server service through DBus, execute the IPMI command, and obtain IPMI response data;
[0113] 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.
[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, parse the structure of the IPMI command through the "handle_ipmi_command" function, call the Execute method of the "xyz.openbmc_project.Ipmi.Server" service through DBus, execute the received IPMI command, and obtain the response data. After the DBus processing is completed, it is encapsulated into a second SPI data packet, and the IPMI response data corresponding to the second SPI data packet is sent back to the EC through 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. The block transmission method is adopted. If the amount of 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.
[0115] In step 104, the EC receives the second SPI data packet from the SOC and unpacks it, and then encapsulates it into 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, and encapsulates it into a second KCS data packet, which also uses batch transmission technology and double buffering mechanism. 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 the second KCS data packet in the sending buffer of the LPC interface for transmission. According to the KCS protocol requirements, the data is written byte by byte to 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 as IPMI response data, parses and executes the response. The server receives the encapsulated second KCS data packet from the EC through the LPC interface, stores it in the receiving buffer, and 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 performs corresponding operations to complete a complete KCS communication, realizing a complete closed loop of the KCS to IPMI processing flow. The present invention uses an EC chip with an LPC interface to expand a KCS physical interface for a general SOC, and deploys a set of software on the EC to implement a coprocessor of a virtual KCS interface, providing KCS communication capabilities for a BMC system based on a general SOC.
[0117] The present invention introduces the SPI-LPC bridging mechanism through EC. EC is connected to the general SOC as an SPI slave device, and data is transmitted with SOC through SPI, while the EC end is connected to the server end through the LPC interface, so that the BMC system implemented based on the general SOC can support LPC-based protocol communication; by software virtual KCS interface in EC, EC can simulate the register, state machine and command parsing of KCS protocol and act as KCS coprocessor. This technology enables the BMC system implemented based on general SOC to support KCS protocol, complete the reception, parsing and cross-interface data transmission of KCS commands; SOC queries the buffer status of EC in real time to realize the active acquisition of EC data by SOC; in the data encapsulation stage, batch data processing and double buffering technology are adopted to realize rapid preparation and switching of data; intelligent error detection and retransmission mechanism is proposed to ensure the integrity and efficiency of data transmission.
[0118] Figure 2 It is a structural schematic diagram of the KCS data communication device provided by the present invention, and the KCS data communication device includes: a receiving unit 1, and the receiving unit 1 is used to use the first interface of the LPC bus to receive a first KCS data packet transmitted from a server, and use a virtual KCS register to unpack the first KCS data packet to obtain unpacked data, wherein the first KCS data packet at least includes an encapsulated IPMI command. The working principle of the receiving unit 1 can refer to the aforementioned step 101 and will not be repeated here.
[0119] The KCS data communication device also includes an encapsulation unit 2, which is used to encapsulate the unpacked data into a first SPI data packet. The virtual KCS register sends the first SPI data packet to the SPI data processing buffer. The SPI data processing buffer includes a current buffer and a standby buffer. The current buffer and the standby buffer are used to process data sending and receiving in a cyclic alternating manner. The working principle of the encapsulation unit 2 can refer to the aforementioned step 102 and will not be repeated here.
[0120] The KCS data communication device also includes a sending unit 3, which is used to send the first SPI data packet to the system on chip SOC using the SPI bus when a polling request from the system on chip SOC is obtained, so as to instruct the system on chip SOC to unpack the first SPI data packet, obtain the IPMI command, obtain the IPMI response data according to the IPMI command, encapsulate the IPMI response data into a second SPI data packet and then send it. The working principle of the sending unit 3 can refer to the aforementioned step 103 and will not be repeated here.
[0121] The KCS data communication device also includes an unpacking unit 4, which is used to use the SPI bus to receive a second SPI data packet from the system on chip SOC, use a virtual KCS register to unpack the second SPI data packet, obtain the IPMI response data, encapsulate the IPMI response data into a second KCS data packet, and use the first interface of the LPC bus to send the second KCS data packet to the server 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. The working principle of the unpacking unit 4 can refer to the aforementioned step 104 and will not be repeated here.
[0122] The present invention introduces the SPI-LPC bridging mechanism through EC. EC is connected to the general SOC as an SPI slave device, and data is transmitted with SOC through SPI, while the EC end is connected to the server end through the LPC interface, so that the BMC system implemented based on the general SOC can support LPC-based protocol communication; by software virtual KCS interface in EC, EC can simulate the register, state machine and command parsing of KCS protocol and act as KCS coprocessor. This technology enables the BMC system implemented based on general SOC to support KCS protocol, complete the reception, parsing and cross-interface data transmission of KCS commands; SOC queries the buffer status of EC in real time to realize the active acquisition of EC data by SOC; in the data encapsulation stage, batch data processing and double buffering technology are adopted to realize rapid preparation and switching of data; intelligent error detection and retransmission mechanism is proposed to ensure the integrity and efficiency of data transmission.
[0123] Figure 3 1 is a schematic diagram of the structure of a KCS data communication system provided by the present invention, wherein the KCS data communication system comprises a baseboard management controller BMC and a server, wherein the baseboard management controller BMC is communicatively connected with the server;
[0124] The baseboard management controller BMC includes a system on chip SOC and an EC, the EC includes a first LPC bus interface, a virtual KCS register and an SPI data processing buffer, and the EC is used to execute the KCS data communication method according to any one of claims 1 to 8;
[0125] The system on chip SOC is connected to the SPI data processing buffer via the SPI bus, the SPI data processing buffer is connected to the virtual KCS register, and the virtual KCS register is connected to the first interface of the LPC bus;
[0126] The server comprises a second LPC bus interface and a KCS register, the first LPC bus interface is connected to the second LPC bus interface via the LPC bus, and the second LPC bus interface is connected to the KCS register.
[0127] Figure 4 The present invention is a flow chart of a KCS data communication system provided by the present invention, which specifically includes: a server generates an IPMI command, the server encapsulates IPMI data into a KCS data packet, at the EC end, software simulates a KCS register, the KCS data packet is transmitted to the EC through an LPC interface, the EC decapsulates the KCS data packet into IPMI data, and then encapsulates it into an SPI data packet, the SOC continuously polls the EC through the SPI, reads and decapsulates the SPI data into an IPMI command, the SOC processes and obtains an IPMI response, the SOC encapsulates the IPMI response into an SPI data packet and sends it back to the EC, the EC decapsulates the SPI data into IPMI data, and then encapsulates it into a KCS data packet, the EC transmits the KCS data back to the server through the LPC interface, and the server decapsulates the KCS data and processes the response.
[0128] The present invention introduces the SPI-LPC bridging mechanism through EC. EC is connected to the general SOC as an SPI slave device, and data is transmitted with SOC through SPI, while the EC end is connected to the server end through the LPC interface, so that the BMC system implemented based on the general SOC can support LPC-based protocol communication; by software virtual KCS interface in EC, EC can simulate the register, state machine and command parsing of KCS protocol and act as KCS coprocessor. This technology enables the BMC system implemented based on general SOC to support KCS protocol, complete the reception, parsing and cross-interface data transmission of KCS commands; SOC queries the buffer status of EC in real time to realize the active acquisition of EC data by SOC; in the data encapsulation stage, batch data processing and double buffering technology are adopted to realize rapid preparation and switching of data; intelligent error detection and retransmission mechanism is proposed to ensure the integrity and efficiency of data transmission.
[0129] Figure 5 Schematic diagram of the structure of the electronic device provided by the present invention. Figure 5As shown, the electronic device may include: a processor 510, a communication interface 520, a memory 530 and a communication bus 540, wherein the processor 510, the communication interface 520 and the memory 530 communicate with each other through the communication bus 540. The processor 510 may call the logic instructions in the memory 530 to execute the KCS data communication method, which includes: using the first interface of the LPC bus to receive a first KCS data packet transmitted from the server, using the virtual KCS register to unpack the first KCS data packet to obtain unpacked data, wherein the first KCS data packet at least includes the encapsulated IPMI command; encapsulating the unpacked data into a first SPI data packet, the virtual KCS register sends the first SPI data packet to the SPI data processing buffer, the SPI data processing buffer includes a current buffer and a standby buffer, the current buffer and the standby buffer are used to process data sending and receiving in a cyclic alternating manner; in the case of obtaining a polling request from the system on chip SOC, using the SPI bus The method comprises the steps of: sending the first SPI data packet to the system on chip SOC via the SPI bus to instruct the system on chip SOC to decapsulate the first SPI data packet to obtain an IPMI command, acquiring IPMI response data according to the IPMI command, encapsulating the IPMI response data into a second SPI data packet and then sending the second SPI data packet; receiving a second SPI data packet from the system on chip SOC by using the SPI bus, decapsulating 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, sending the second KCS data packet to the server by using the first interface of the LPC bus to instruct the server to decapsulate the second KCS data packet to obtain the IPMI response data, and performing a response operation according to the IPMI response data.
[0130] In addition, the logic instructions in the above-mentioned memory 530 can be implemented in the form of a software functional unit and can be stored in a computer-readable storage medium when it is sold or used as an independent product. Based on such an understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art or the part of the technical solution, can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk, etc. Various media that can store program codes.
[0131] On the other hand, the present invention also provides a computer program product, which includes a computer program. The computer program can be stored on a non-transitory computer-readable storage medium. When the computer program is executed by a processor, the computer can execute a KCS data communication method provided by the above methods, which includes: using the first interface of the LPC bus to receive a first KCS data packet transmitted from a server, using a virtual KCS register to unpack the first KCS data packet 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 the virtual KCS register sends the first SPI data packet to an SPI data processing buffer, 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 in a cyclic alternating processing manner. and receiving; in the case of obtaining a polling request from a system on chip SOC, using the SPI bus to send the first SPI data packet to the system on chip SOC to instruct the system on chip SOC to decapsulate the first SPI data packet to obtain an IPMI command, obtaining IPMI response data according to the IPMI command, and encapsulating the IPMI response data into a second SPI data packet and then sending it; using the SPI bus to receive a second SPI data packet from the system on chip SOC, using a virtual KCS register to decapsulate the second SPI data packet to obtain the IPMI response data, encapsulating the IPMI response data into a second KCS data packet, using the first interface of the LPC bus to send the second KCS data packet to the server to instruct the server to decapsulate the second KCS data packet to obtain the IPMI response data, and performing a response operation according to the IPMI response data.
[0132] On the other hand, the present invention also provides a non-transitory computer-readable storage medium having a computer program stored thereon, and when the computer program is executed by a processor, the KCS data communication method provided by the above methods is implemented, the method comprising: using the first interface of the LPC bus to receive a first KCS data packet transmitted from a server, using a virtual KCS register to unpack the first KCS data packet 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, the virtual KCS register sending the first SPI data packet to an SPI data processing buffer, the SPI data processing buffer comprising a current buffer and a standby buffer, the current buffer and the standby buffer being used to process data sending and receiving in a cyclic alternating manner; upon obtaining the data from the system on chip In the case of a polling request of SOC, the first SPI data packet is sent to the system on chip SOC by using the SPI bus to instruct the system on chip SOC to decapsulate the first SPI data packet to obtain an IPMI command, obtain IPMI response data according to the IPMI command, and encapsulate the IPMI response data into a second SPI data packet and then send it; the second SPI data packet from the system on chip SOC is received by using the SPI bus, the second SPI data packet is decapsulated by using a virtual KCS register to obtain the IPMI response data, the IPMI response data is encapsulated into a second KCS data packet, and the second KCS data packet is sent to the server by using the first interface of the LPC bus to instruct the server to decapsulate the second KCS data packet to obtain the IPMI response data, and a response operation is performed according to the IPMI response data.
[0133] The device embodiments described above are merely illustrative, wherein the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the scheme of this embodiment. Ordinary technicians in this field can understand and implement it without paying creative labor.
[0134] Through the description of the above implementation methods, those skilled in the art can clearly understand that each implementation method can be implemented by means of software plus a necessary general hardware platform, and of course, it can also be implemented by hardware. Based on this understanding, the above technical solution is essentially or the part that contributes to the prior art can be embodied in the form of a software product, and the computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, a disk, an optical disk, etc., including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in each embodiment 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 invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention.
Claims
1. A KCS data communication method, applied to an embedded controller EC, characterized in that: The baseboard management controller BMC is connected to the server in communication, and the BMC includes a system on chip SOC and an embedded controller EC, and the EC includes a first LPC bus interface, a virtual KCS register, and an SPI data processing buffer, including: Using the first interface of the LPC bus to receive a first KCS data packet transmitted from the server, and using the virtual KCS register to unpack the first KCS data packet to obtain unpacked data, wherein the first KCS data packet at least includes the encapsulated IPMI command; Encapsulating the unpacked data into 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 comprising a current buffer and a standby buffer, the current buffer and the standby buffer being used to process data sending and receiving in a cyclic alternating processing manner; In the case of obtaining a polling request from the system on chip SOC, using the SPI bus to send the first SPI data packet to the system on chip SOC to instruct the system on chip SOC to decapsulate the first SPI data packet to obtain an IPMI command, obtain IPMI response data according to the IPMI command, and encapsulate the IPMI response data into a second SPI data packet before sending; The SPI bus is used to receive a second SPI data packet from the system on chip SOC, the virtual KCS register is used to unpack the second SPI data packet to obtain the IPMI response data, the IPMI response data is encapsulated into a second KCS data packet, and the second KCS data packet is sent to the server using the first interface of the LPC bus to instruct the server to unpack the second KCS data packet to obtain the IPMI response data, and a response operation is performed according to the IPMI response data.
2. The KCS data communication method according to claim 1, characterized in that: Before using the first interface of the LPC bus to receive a first KCS data packet transmitted from a server, the method further includes: Initialize the KCS register in the server, set the KCS register pointer, configure it to an idle state, construct a message header according to the network function code, command code and command data, calculate the checksum of the data packet according to the format of the IPMI protocol, and construct the IPMI command; When a write command is received, the idle state is switched to a data write state, and each byte of the IPMI command is sequentially written to the KCS register using a double buffer mechanism and a batch data transmission technology, wherein the double buffer mechanism is used to process data alternately through two buffers to achieve data transmission and data switching, and the batch data transmission technology is used to transmit multiple data bytes or data blocks in one go by packaging them into a preset unit; After the IPMI command is written, a write end command is used to mark the end of data encapsulation, and the KCS state is switched from the write data state to the write completion stage.
3. The KCS data communication method according to claim 1, characterized in that: Before unpacking the first KCS data packet using the virtual KCS register, the method further includes: Use the preset function Kcs_regs_init to initialize the virtual KCS register, set the initial state of the virtual KCS register, clear the status flag, and reset the data input register and data output register to the initial value; Use the preset functions Ls_kcs_inb and Ls_kcs_outb to simulate the read and write operations of the virtual KCS register. Use the preset functions Write_idr and Write_cmd to simulate the write operations of the data input register and the command register respectively. Use the preset function Ls_kcs_updateb to update the status value of the virtual KCS register according to the mask. In the write operation of the virtual KCS register, call the preset function Lpc_send_edge_int_evt or Lpc_send_level_int_evt according to different interrupt types to simulate the interrupt event triggered when the virtual KCS register status changes. Use the preset functions Iord_short and Iowr_short to simulate the IO operations on the virtual KCS register.
4. The KCS data communication method according to claim 1, characterized in that: The encapsulating the decapsulated data into a first SPI data packet, and the virtual KCS register sending the first SPI data packet to the SPI data processing buffer, comprises: Generate the first SPI data packet according to the decapsulated data, and define a state machine Spi_phase for managing different phases of transmission of the first SPI data packet; The first SPI data packet is sent to the SPI data processing buffer using a double buffer mechanism, and the SPI transmission parameters are set using a preset variable Transfer_size.
5. The KCS data communication method according to claim 4, characterized in that: The defined state machine Spi_phase is used to manage different phases of the first SPI data packet transmission, including: Among them, T switch Indicates the time interval of state switching, W data is the weight of the current data volume, P is the priority of the command, the larger the value is, the higher the priority is, and α is the adjustment factor, which is used to balance the relationship between the current data volume and the priority.
6. The KCS data communication method according to claim 4, characterized in that: Before or after defining the state machine Spi_phase, the method further comprises: During data transmission, if the error frequency exceeds a preset threshold, the number of retries is increased. The calculation formula for the number of retries is: N retry is the number of retries, E count Indicates the number of errors detected in the past period of time, E total is the maximum number of errors allowed, and γ is the basic number of retries.
7. The KCS data communication method according to claim 1, characterized in that: The sending the first SPI data packet to the system on chip SOC by using the SPI bus includes: When there is data in the SPI data processing buffer, according to the polling request of the system on chip SOC, the preset function Receive_ipmi_command is used to read the command data, and the first SPI data packet is sent to the system on chip SOC using the SPI bus. The system on chip SOC receives data in batches cyclically. When the data is less than 32 bytes, all the remaining data is read at one time; otherwise, the data is obtained in blocks; When there is no data in the SPI data processing buffer, the default value is returned to indicate that there is no available data.
8. The KCS data communication method according to claim 1, characterized in that: After sending the first SPI data packet to the system on chip SOC using the SPI bus, the method further includes: Instructing the system on chip SOC to decapsulate the first SPI data packet to obtain an IPMI command; Forward the IPMI command to the Dbus service, parse the structure of the IPMI command through the preset function Handle_ipmi_command, call the Execute method of the Xyz.openbmc_project.Ipmi.Server service through DBus, execute the IPMI command, and obtain IPMI response data; 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.
9. A KCS data communication device, characterized in that: include: A receiving unit, the receiving unit is used to receive a first KCS data packet transmitted from a server by using a first interface of an LPC bus, and to decapsulate the first KCS data packet by using a virtual KCS register to obtain decapsulated data, wherein the first KCS data packet at least includes an encapsulated IPMI command; An encapsulation unit, wherein the encapsulation unit is used to encapsulate the unpacked data into a first SPI data packet, wherein the virtual KCS register sends the first SPI data packet to an SPI data processing buffer, wherein the SPI data processing buffer includes a current buffer and a standby buffer, wherein the current buffer and the standby buffer are used to process data sending and receiving in a cyclic alternating processing manner; A sending unit, wherein the sending unit is used to send the first SPI data packet to the system on chip SOC by using the SPI bus when a polling request from the system on chip SOC is obtained, so as to instruct the system on chip SOC to decapsulate the first SPI data packet to obtain an IPMI command, obtain IPMI response data according to the IPMI command, and encapsulate the IPMI response data into a second SPI data packet before sending; The unpacking unit is used to receive a second SPI data packet from the system on chip SOC by using the SPI bus, unpack the second SPI data packet by using the virtual KCS register, obtain the IPMI response data, encapsulate the IPMI response data into a second KCS data packet, send the second KCS data packet to the server by using the first interface of the LPC bus to instruct the server to unpack the second KCS data packet, obtain the IPMI response data, and perform a response operation according to the IPMI response data.
10. A KCS data communication system, characterized in that: It includes a baseboard management controller BMC and a server, wherein the baseboard management controller BMC is communicatively connected with the server; The baseboard management controller BMC includes a system on chip SOC and an EC, the EC includes a first LPC bus interface, a virtual KCS register and an SPI data processing buffer, and the EC is used to execute the KCS data communication method according to any one of claims 1 to 8; The system on chip SOC is connected to the SPI data processing buffer via the SPI bus, the SPI data processing buffer is connected to the virtual KCS register, and the virtual KCS register is connected to the first interface of the LPC bus; The server comprises a second LPC bus interface and a KCS register, the first LPC bus interface is connected to the second LPC bus interface via the LPC bus, and the second LPC bus interface is connected to 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
UBM implementation inside bmc
US20200065273A1
BMC based HROT implementation establishing chain of trust in a secured server system
US20240211602A1