Bus circuit, bus control method and device for dual-master equipment
By designing the dual master device bus circuit and control method, and using the input and output expander and watchdog timer, the handshake and control rights reservation between BIOS and BMC are realized, and the problem of dual master devices competing for SMBUS bus control rights is solved. Improved system stability.
Patent Information
- Application Number
- CN202410696816.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-05-31
- Publication Date
- 2024-08-27
- Estimated Expiration
- 2044-05-31
AI Technical Summary
In server systems, when dual master devices such as BIOS and BMC compete for control of the SMBUS bus, conflicts occur, which existing technologies cannot effectively resolve, affecting system stability.
A bus circuit with dual master devices is designed, including a first master device, a second master device, a bus buffer, an input and output expander, a watchdog and a NOT gate, which are connected through an integrated circuit bus and implemented using the input and output expander. Handshake, reserve control of the bus control chip, and monitor and manage bus usage through a watchdog timer to ensure that only one master device occupies control at any time.
It effectively solves the conflict between dual master devices competing for bus control rights, reduces conflicts between master devices, and improves system stability.
Smart Images

Figure CN118260223B
Abstract
Description
Technical Field
[0001] The embodiments of the present application relate to the computer field, and in particular, to a bus circuit, a bus control method and a bus control device of a dual-master device. Background Art
[0002] SMBUS (System Management Bus) is a low-speed serial bus developed based on the I2C bus. It is mainly used to connect various devices and sensors inside the computer to monitor and manage the status and performance of these devices.
[0003] In the server system, the Baseboard Management Controller (BMC) manages a complex SMBUS topology network. After the server is powered on, the BMC can monitor the system's temperature, voltage, fan, power supply, etc. through the SMBUS and make corresponding adjustments. However, for management purposes, the BIOS will sometimes access some devices on the bus through the SMBUS, so that the SMBUS bus will have two master devices competing for the control of the SMBUS bus.
[0004] There is currently no effective solution to the above problems. Summary of the invention
[0005] The embodiments of the present application provide a bus circuit, a bus control method and an apparatus for a dual-master device, so as to at least solve the conflict problem of dual-master devices competing for bus control rights in the related art.
[0006] According to one embodiment of the present application, a bus circuit of a dual master device is provided, comprising: a first master device, a first bus buffer, a second master device, a second bus buffer, an input-output expander, a watchdog, a NOT gate, and a bus control chip; the first master device is connected to the first bus buffer via an integrated circuit bus, and the first bus buffer is connected to the bus control chip via an integrated circuit bus; the second master device is connected to the second bus buffer via an integrated circuit bus, and the second master device is also connected to the input-output expander via an integrated circuit bus; the input-output expander is also connected to the first master device, and the input-output expander is also connected to the watchdog; the watchdog is also connected to the NOT gate, and the NOT gate is also connected to the first bus buffer, and the watchdog is also connected to the second bus buffer.
[0007] In an exemplary embodiment, the bus circuit further includes: a slave device; the slave device is connected to the bus control chip via an integrated circuit bus.
[0008] In an exemplary embodiment, the first master device is connected to the first bus buffer via an integrated circuit bus, including: the first master device is connected to the first bus buffer via a first data line and a first clock line.
[0009] In an exemplary embodiment, the second master device is connected to a second bus buffer via an integrated circuit bus, and the second master device is also connected to an input-output expander via an integrated circuit bus, including: the second master device is connected to the second bus buffer and the input-output expander via a second data line; the second master device is connected to the second bus buffer and the input-output expander via a second clock line.
[0010] In an exemplary embodiment, the input / output expander is also connected to the first master device, including: the general input / output port of the first master device is connected to the first port of the first master device; the input / output expander is also connected to the watchdog, including: the second port of the input / output expander is connected to the watchdog.
[0011] In an exemplary embodiment, the first host device is a platform control unit, and the second host device is a baseboard management controller.
[0012] According to another embodiment of the present application, a bus control method for a dual-master device is provided, which is applied to the bus circuit of the above-mentioned dual-master device, including: before a first master device applies for control of the bus control chip, the first master device sets a first signal output by a universal input / output port to low to reserve the control right with the bus control chip; before a second master device polls and controls a slave device, the second master device reads the first signal of the first port as low, determines that the first master device has reserved the control right with the bus control chip, and the second master device gives up polling and controlling the slave device, wherein the first master device sends the first signal to the first port of an input / output expander through the universal input / output port.
[0013] In an exemplary embodiment, when the first signal read is low, the method further includes: the second master device stops sending the second signal to the watchdog to control the watchdog's timer to stop counting, and when the duration of the watchdog's timer stopping counting exceeds a preset time threshold, the watchdog outputs a third signal to control the first bus buffer to be turned on and the second bus buffer to be turned off.
[0014] In an exemplary embodiment, the method further includes: when a preset waiting time of the first master device is reached, the first master device applies to the bus control chip for the control right, wherein the preset waiting time is greater than the time for the second master device to poll and control the slave device.
[0015] In an exemplary embodiment, after the first master device applies for the control right from the bus control chip, the method further includes: the first master device reads target information from the slave device; after the first master device completes reading the target information from the slave device, the first master device sets the first signal output by the general input / output port to high.
[0016] In an exemplary embodiment, after the first master device sets the first signal output by the general input / output port high, the method further includes: before the second master device polls and controls the slave device, the second master device reads the first signal of the first port as high, the second master device sends the second signal to the watchdog to control the watchdog's timer to perform a counting operation, and the watchdog outputs a fourth signal to control the first bus buffer to be disconnected and the second bus buffer to be turned on.
[0017] In an exemplary embodiment, the method also includes: when the second master device is in a hung state or the second master device is in a dead loop state, the watchdog timer stops counting; when the duration of the watchdog timer stopping counting exceeds a preset time threshold, the watchdog outputs a third signal to control the first bus buffer to be turned on and the second bus buffer to be turned off.
[0018] In an exemplary embodiment, after the first master device applies for the control right from the bus control chip, the method further includes: when the first master device occupies the control right, the second master device monitors the length of time the first master device occupies the control right; when the length of time the first master device occupies the control right exceeds a preset length threshold, the second master device sends the second signal to the watchdog to control the watchdog timer to perform a counting operation, and the watchdog outputs a fourth signal to control the first bus buffer to disconnect and the second bus buffer to turn on.
[0019] According to another embodiment of the present application, a bus control device for dual master devices is provided, including: a reservation module, used for, before a first master device applies for control of the bus control chip, the first master device sets the first signal output by a universal input / output port to low, so as to reserve the control right with the bus control chip; a determination module, used for, before a second master device polls and controls a slave device, the second master device reads the first signal of the first port as low, determines that the first master device has reserved the control right with the bus control chip, and the second master device gives up polling and controlling the slave device, wherein the first master device sends the first signal to the first port of an input / output expander through the universal input / output port.
[0020] According to another embodiment of the present application, a computer-readable storage medium is provided, in which a computer program is stored, wherein the computer program is configured to execute the steps of any of the above method embodiments when run.
[0021] According to another embodiment of the present application, an electronic device is provided, including a memory and a processor, wherein the memory stores a computer program, and the processor is configured to run the computer program to execute the steps in any one of the above method embodiments.
[0022] According to another embodiment of the present application, a computer program product is provided, including a computer program, and when the computer program is executed by a processor, the steps in any of the above method embodiments are implemented.
[0023] Through the present application, the first master device is connected to the first bus buffer through the integrated circuit bus, and the first bus buffer is connected to the bus control chip through the integrated circuit bus; the second master device is connected to the second bus buffer through the integrated circuit bus, and the second master device is also connected to the input-output expander through the integrated circuit bus; the input-output expander is also connected to the first master device, and the input-output expander is also connected to the watchdog; the watchdog is also connected to the NOT gate, the NOT gate is also connected to the first bus buffer, and the watchdog is also connected to the second bus buffer.
[0024] Since the first master device and the second master device can shake hands through the input and output expander, the first master device can reserve the control right of the bus control chip. Therefore, the conflict problem of the related art of dual master devices competing for the bus control right can be solved, the conflict between the master devices can be reduced, and the effect of improving the stability of the system can be achieved. BRIEF DESCRIPTION OF THE DRAWINGS
[0025] Figure 1 It is a schematic diagram of the structure of a dual-master device direct-connect bus;
[0026] Figure 2It is a schematic diagram of the structure of a dual master device isolation connection bus;
[0027] Figure 3 is a schematic diagram of the structure of a bus circuit of a dual-master device according to an embodiment of the present application;
[0028] Figure 4 is a schematic diagram of the structure of a dual-master device control bus according to an embodiment of the present application;
[0029] Figure 5 It is a hardware structure block diagram of a computing device of a bus control method for a dual-master device according to an embodiment of the present application;
[0030] Figure 6 is a flow chart of a bus control method for a dual-master device according to an embodiment of the present application;
[0031] Figure 7 is a flow chart of a BIOS application for control rights according to an embodiment of the present application;
[0032] Figure 8 is a flow chart of a BMC in a hung state according to an embodiment of the present application;
[0033] Fig. 9 is a flow chart of a BIOS occupation control right timeout according to an embodiment of the present application;
[0034] Fig.10 It is a structural block diagram of a bus control device for a dual-master device according to an embodiment of the present application. DETAILED DESCRIPTION
[0035] The following is an explanation of some of the English in this application:
[0036] I2C: Inter-Integrated Circuit, integrated circuit bus, a two-wire serial communication bus.
[0037] BMC: Baseboard Management Controller, baseboard management controller, an independent system on a chip on the server motherboard.
[0038] BIOS: Basic Input Output System, basic input output system, in this application refers to BIOS firmware.
[0039] PCH: Platform Controller Hub, platform control unit, Intel's integrated south bridge, Intel's controller that separates some functions from the CPU. In this article, the BIOS firmware process is executed by PCH.
[0040] SMBUS (System Management Bus) is a low-speed serial bus that originated from Intel. It is an I2C-based protocol that provides a standardized way for hardware components such as motherboards, sensors, and power management chips to communicate with each other, aiming to simplify system management tasks.
[0041] The I2C bus is an integrated circuit bus. The hardware requires at least one data line (SDA) and one clock line (SCL). Multiple devices can be connected to the bus, which are mainly divided into master devices (Master) and slave devices (Slave). Each device has a unique address. An I2C bus allows multiple master devices to exist. When two or more master devices are ready to transmit data at the same time, the bus provides a conflict detection and arbitration mechanism to ensure that only one master device communicates at the same time.
[0042] In the server system, BMC manages a complex SMBUS topology network. After the server is powered on, BMC monitors the system's temperature, voltage, fan, power supply, etc. through SMBUS and makes corresponding adjustments. However, for management needs, BIOS sometimes accesses some devices on the bus through SMBUS, which will cause the SMBUS bus to have dual master devices (also called dual masters, i.e. BIOS and BMC) competing for control of the SMBUS bus.
[0043] At present, there are two main circuit connection methods for dual-master device control:
[0044] Figure 1 This is a schematic diagram of the structure of a dual-master direct-connect bus. Figure 1 As shown in the figure, the SDA / SCL pins of the PCH and the SDA / SCL pins of the BMC are connected in parallel to the SMBUS bus of the motherboard, and the signal waveforms sent and received by the BMC on the bus can be transmitted to the pins of the PCH. However, the two master devices of this connection method are directly connected to the SMBUS in parallel without any isolation, which can easily cause the abnormal fluctuation of the pin of one of the master devices to be transmitted to the entire SMBUS, thereby interfering with the normal communication of the other master device.
[0045] Figure 2 This is a schematic diagram of the structure of a dual-master device isolated connection bus, such as Figure 2As shown in the figure, the PCA9641 chip (2 I2master channels, 1 I2C slave channel) is used to isolate the two master devices, so that the two master devices (BMC and PCH) compete for the control of PCA9641, and only one master device can be connected to the slave channel at any time. In this connection mode, although the BIOS code only applies for the SMBUS bus control at a specific time node in the Power-On Self-Test (POST) process, the time is random for the BMC, and the BIOS application requirement will appear at any time in the POST stage. When the BIOS applies for the SMBUS control, if the BMC has already occupied the SMBUS, the BMC communication will not be interrupted, and the BIOS will not be able to obtain the current SMBUS control. As a result, the BIOS cannot obtain the slave device (slave) information at the specified time, resulting in resource allocation errors or display abnormalities under the BIOS.
[0046] Alternatively, in the POST stage, the BIOS request has a high priority. To avoid the situation where the BIOS cannot obtain the SMBUS control right, the BMC chooses to give up polling monitoring during the POST process and release the SMBUS bus. Then, during the entire POST process, the BIOS can apply for the control right of PCA9641 at any time and then access the slave device. However, the problem that follows is that the BMC loses the real-time monitoring and regulation of the slave device during the POST process.
[0047] In addition, the PCA9641 chip itself also has the function of automatic disconnection when timeout and automatic disconnection when the bus is hung, but the judgment of hanging is based on the timeout of the bus idle state. The bus idle state timeout refers to the long period of no data transmission or communication activity on the bus, which exceeds the preset time limit. This situation may indicate a fault or communication failure between the communication devices, which requires troubleshooting and repair. In actual applications, when the BMC I2C process is abnormal or the slave device is hung, the SCL / SDA signal is in a normal high (same as idle) state or a normal low state. PCA9641 can judge the timeout and automatically disconnect the master device from the slave; but when the slave device is abnormal, SCL or SDA is in an oscillating state. At this time, PCA9641 will not be able to judge the timeout and will not automatically disconnect the master and slave.
[0048] In summary, the present application proposes a bus circuit for dual-master devices, which uses a PCA9555 expander and a PCA9617 bus buffer, a watchdog timer (WDT), and a logic NOT gate circuit, etc., in conjunction with code modification of the BMC / BIOS, to achieve BIOS reservation of PCA9641 control rights, BMC actively giving up PCA9641 control rights, and forcing the BMC or BIOS to lose PCA9641 control rights, thereby solving the conflict problem of dual-master devices competing for SMBUS bus control rights in the related technology.
[0049] It should be noted that this application only uses the PCA9641 chip and the SMBUS bus as specific embodiments for detailed description. In practical applications, it is not limited to the PCA9641 chip and the SMBUS bus, but is also applicable to other bus contention conflicts of dual-master devices.
[0050] The embodiments of the present application will be described in detail below with reference to the accompanying drawings and in combination with the embodiments.
[0051] It should be noted that the terms "first", "second", etc. in the specification and claims of this application and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence.
[0052] In this embodiment, a bus circuit of a dual-master device is provided. Figure 3 is a schematic diagram of the structure of a bus circuit of a dual-master device according to an embodiment of the present application, such as Figure 3 As shown, the circuit includes: a first master device, a first bus buffer, a second master device, a second bus buffer, an input / output expander, a watchdog, a NOT gate, and a bus control chip; the first master device is connected to the first bus buffer through an integrated circuit bus, and the first bus buffer is connected to the bus control chip through an integrated circuit bus; the second master device is connected to the second bus buffer through an integrated circuit bus, and the second master device is also connected to the input / output expander through an integrated circuit bus; the input / output expander is also connected to the first master device, and the input / output expander is also connected to the watchdog; the watchdog is also connected to the NOT gate, and the NOT gate is also connected to the first bus buffer, and the watchdog is also connected to the second bus buffer.
[0053] The first host device and the second host device may be any two host devices, such as BMC, BIOS (PCH) and the like.
[0054] As an optional implementation manner, the first main device is a platform control unit, and the second main device is a baseboard management controller.
[0055] The first buffer and the second buffer mentioned above can be PCA9617 bus buffers. PCA9617 bus buffers are an I2C bus buffer that can expand the number of nodes on the I2C bus. It allows users to connect multiple slave devices on the I,2C bus while maintaining the performance and stability of the bus. PCA9617 also provides a voltage level shifting function that allows communication between different voltage levels. This makes it very suitable for use in applications that require long-distance transmission or communication between different voltage systems.
[0056] The bus control chip can be a PCA9641 chip, which is an I2C bus level converter and voltage level shifter for communicating between different levels and voltages. In this embodiment, PCA9641 is an SMBus bus controller chip, which can be used to control and manage devices and communications on the SMBus bus. In short, PCA9641 is part of the SMBus bus and is used to manage and control communications and devices on the SMBus bus.
[0057] The above-mentioned input and output expander can be a PCA9555 bus IO expander. The PCA9555 bus IO expander is a 16-bit I2C bus I / O expander that can provide 16 GPIO ports and support cascade connection. It can communicate with a microprocessor or other peripheral devices through the I2C bus. It can be used to control and monitor various external devices, such as LED lights, buttons, sensors, etc. This chip can be widely used in industrial control, automation systems, instrumentation, communication equipment and other fields.
[0058] The above-mentioned watchdog can be a watchdog timer. The working principle of the electronic device watchdog is based on the combination of a timer and a reset circuit. When the electronic device is working normally, the watchdog timer will periodically receive signals from the electronic device to keep the timer counting. If the electronic device stops working due to a malfunction or other reasons, the timer will no longer receive signals and the counting will stop. Once the timer count stops exceeding a preset time threshold, the reset circuit will automatically trigger and restart the electronic device, thereby preventing the system from being in an unresponsive state for a long time. In general, the working principle of the electronic device watchdog is to monitor the normal operating status of the system through a timer, and when the system fails, the reset circuit is automatically triggered to restart the system, thereby ensuring the stability and reliability of the system.
[0059] An I2C channel switch PCA9617 bus buffer is added to the connection channel between the PCA9641 chip and the two master devices, so that the two master devices are connected to the bus through a buffer respectively. At the same time, a watchdog timer and a NOT gate logic circuit are set to control the on and off of the two PCA9617 bus buffers, so that at any time, only one PCA9617 bus buffer is in the on state, that is, at any time, only one master device can establish a connection with the PCA9641 chip, and the watchdog timer can monitor the duration of BMC polling control, avoiding the problem that PCA9641 cannot judge the timeout and will not automatically disconnect the connection between the master device and the slave device.
[0060] At the same time, an input / output expander is set up to connect two master devices and a watchdog timer. Through the bus IO expander, a handshake signal is added between the two master devices, so that handshake communication between the two master devices can be realized, and a reservation channel is provided for the master device BIOS, so that the BIOS can reserve the control of the bus from the BMC.
[0061] As an optional implementation, the bus circuit further includes: a slave device; the slave device is connected to the bus control chip via an integrated circuit bus.
[0062] As an optional implementation, the first master device is connected to the first bus buffer via an integrated circuit bus, including: the first master device is connected to the first bus buffer via a first data line and a first clock line.
[0063] As an optional implementation, the second master device is connected to the second bus buffer via an integrated circuit bus, and the second master device is also connected to the input-output expander via the integrated circuit bus, including: the second master device is connected to the second bus buffer and the input-output expander via a second data line; the second master device is connected to the second bus buffer and the input-output expander via a second clock line.
[0064] As an optional implementation, the input / output expander is also connected to the first master device, including: the general input / output port of the first master device is connected to the first port of the first master device; the input / output expander is also connected to the watchdog, including: the second port of the input / output expander is connected to the watchdog.
[0065] Through the above circuit, the conflict problem between BMC and BIOS for the control of PCA9641 can be effectively solved, thereby reducing the conflict between devices and improving the stability of the system.
[0066] As an optional implementation, Figure 4 is a schematic diagram of the structure of a dual master device control bus according to an embodiment of the present application, such as Figure 4 As shown, BMC uses the pins of PCA9555 to complete handshake and watchdog feeding. At the same time, it uses the SMBUS polling process to read and write PCA9555. Among them, it can be recorded that the cycle of BMC completing normal polling is T0, the overflow duration of the watchdog is T1, the time taken for BIOS to normally complete a round of I2C reading is T2, the cycle of PCA9641 idle automatic disconnection is T3=100ms, the time interval from BIOS reservation to applying for PCA9641 control right t0>T0, BMC's dog feeding cycle t1=T0<(T1 / 2), and it is set that if the BIOS occupies the bus for a duration of t2>t0+T2, it is determined that the BIOS occupies the bus for a timeout. The specific polling scheme is as follows:
[0067] BMC maintains the connection with PCA9641 by feeding the dog. If the feeding stops, the connection between BMC and PCA9641 is disconnected, and the connection between PCH and PCA9641 is established. Before BIOS needs to apply for control of PCA9641, it notifies BMC through the GPIO signal status to make an appointment. At the same time, the normal polling of BMC will not be interrupted. Before the next polling starts, BMC reads the status of IO_0 of PCA9555 to determine whether BIOS has reserved control. In addition, if BIOS occupies PCA9641 for a timeout, that is, the length of time BIOS occupies the bus t2>t0+T2, BMC can disconnect PCH and PCA9641 by feeding the dog again.
[0068] It should be noted that in BMC, feeding the dog usually refers to regularly sending specific instructions or signals to the monitor or device in the system to ensure the normal operation of the system. This process is similar to the concept of feeding a pet, that is, regularly providing necessary food or resources to keep the pet healthy and energetic. In BMC, the process of feeding the dog can help monitor the operating status of the system and take necessary measures to recover or restart the system when problems or crashes occur.
[0069] The overflow duration of the watchdog refers to the time interval of the overflow of the watchdog timer. The watchdog timer is a hardware device used to monitor the operating status of the system. When the system fails or stops responding, the watchdog timer will trigger the restart of the system if it does not receive a response from the system within the preset time interval. The overflow duration of the watchdog is usually determined by the system designer based on the stability and response requirements of the system, generally between a few seconds and a few minutes. A shorter overflow duration can detect system failures more quickly and trigger a restart, but may increase the number of system restarts; while a longer overflow duration can reduce the number of system restarts, but may cause the system to respond untimely when a failure occurs. In general, the overflow duration of the watchdog needs to be reasonably set and adjusted according to the specific system requirements and stability.
[0070] The first master device and the second master device in the method embodiment provided in the embodiment of the present application can be Figure 5 The illustrated method may be executed in a server device or a similar computing device, and the computing device may be a station control unit or a baseboard management controller.
[0071] Figure 5 1 is a hardware structure block diagram of a computing device of a bus control method for a dual-master device according to an embodiment of the present application. Figure 5 As shown, the computing device may include one or more ( Figure 5 Only one is shown in the figure) a processor 502 (the processor 502 may include but is not limited to a processing device such as a microprocessor MCU or a programmable logic device FPGA) and a memory 504 for storing data, wherein the above-mentioned computing device may also include a transmission device 506 and an input / output device 508 for communication functions. It can be understood by those skilled in the art that Figure 5 The structure shown is only for illustration and does not limit the structure of the above server device. Figure 5 More or fewer components as shown, or with Figure 5 Different configurations are shown.
[0072] The memory 504 can be used to store computer programs, for example, software programs and modules of application software, such as the computer program corresponding to the bus control method of the dual master device in the embodiment of the present application. The processor 502 executes various functional applications and data processing by running the computer program stored in the memory 504, that is, to implement the above method. The memory 504 may include a high-speed random access memory, and may also include a non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some examples, the memory 504 may further include a memory remotely arranged relative to the processor 502, and these remote memories may be connected to the computing device via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.
[0073] The transmission device 506 is used to receive or send data via a network. The specific example of the above network may include a wireless network provided by a communication provider of the server device. In one example, the transmission device 506 includes a network adapter (Network Interface Controller, referred to as NIC), which can be connected to other network devices through a base station so as to communicate with the Internet. In one example, the transmission device 506 can be a radio frequency (RF) module, which is used to communicate with the Internet wirelessly.
[0074] In this embodiment, a bus control method for a dual-master device is provided, which is applied to the bus circuit of the dual-master device. Figure 6 is a flow chart of a bus control method for a dual-master device according to an embodiment of the present application. Figure 6 As shown, the process includes the following steps:
[0075] Step S602, before the first master device applies for the control right of the bus control chip, the first master device sets the first signal output by the general input / output port to low, so as to reserve the control right with the bus control chip;
[0076] The first master device may be a BIOS (PCH), the bus control chip may be a PCA9641 chip, the general input and output port may be a GPIO port of the BIOS, and the first signal may be a level signal; before the BIOS applies for control of the PCA9641 chip, the BIOS reserves control of the PCA9641 chip by setting the GPIO port to a low level.
[0077] Step S604: before the second master device polls and controls the slave device, the second master device reads the first signal of the first port as low, determines that the first master device has reserved the control right with the bus control chip, and the second master device gives up polling and controlling the slave device, wherein the first master device sends the first signal to the first port of the input / output expander through the general input / output port.
[0078] The second master device may be a BMC, and the first port may be the IO_0 port of a PCA9555 bus IO expander. Before the BMC polls and controls the slave device, it is necessary to first read the level signal of the IO_0 port of the bus IO expander. If the level signal of the IO_0 port is low, it indicates that the BIOS has reserved the control right of the PCA9641 chip. At this time, the BMC abandons the polling control of the slave device, wherein the level signal of the IO_0 port is the level signal sent by the first device through the GPIO port.
[0079] Through the above steps, handshake communication between BIOS and BMC is realized, so that BIOS can obtain control of the bus control chip through reservation, solve the conflict problem of dual master devices competing for bus control in related technologies, and improve system stability.
[0080] The execution subject of the above steps may be a server, a terminal, etc., but is not limited thereto.
[0081] As an optional embodiment, when the first signal read is low, the method also includes: the second master device stops sending the second signal to the watchdog to control the watchdog's timer to stop counting, and when the duration of the watchdog's timer stopping counting exceeds a preset time threshold, the watchdog outputs a third signal to control the first bus buffer to be turned on and the second bus buffer to be disconnected.
[0082] The second signal can be a trigger signal, and the third signal can be a logic value, such as 0 or 1. The watchdog timer can receive the trigger signal sent by the BMC through the IO_1 port of the PCA9555 bus IO expander, thereby establishing a connection between the BMC and the bus control chip, and realizing the polling control of the slave device by the BMC; when the BMC stops sending a trigger signal to the watchdog timer, the watchdog timer stops the technology, disconnects the connection between the BMC and the bus control chip, and when the watchdog timer stops counting for a period of time exceeding a preset time threshold, the watchdog timer outputs a corresponding logic value, controls the first bus buffer to be turned on, and the second bus buffer to be turned off through a NOT gate logic circuit. By adding a watchdog timer, the polling control of the bus control chip by dual master devices is realized, so that only one master device can control the bus control chip at any time.
[0083] As an optional implementation, the method further includes: when a preset waiting time is reached, the first master device applies to the bus control chip for the control right, wherein the preset waiting time is greater than the time for the second master device to poll and control the slave device.
[0084] The above-mentioned preset waiting time can be the time interval t0 from the BIOS making an appointment to applying for the control right of the bus control chip, and the time length of the above-mentioned second master device polling and controlling the slave device can be the cycle T0 of the BMC completing normal polling. When the preset waiting time t0 is greater than the cycle T0 of the BMC completing normal polling, the BIOS applies to the bus control chip for the control right of the bus control chip.
[0085] As an optional implementation, after the first master device applies for the control right from the bus control chip, the method further includes: the first master device reads target information from the slave device; after the first master device completes reading the target information from the slave device, the first master device sets the first signal output by the general input / output port to high.
[0086] As an optional implementation, after the first master device sets the first signal output by the general input / output port high, the method further includes: before the second master device polls and controls the slave device, the second master device reads the first signal of the first port as high, the second master device sends the second signal to the watchdog to control the watchdog timer to perform a counting operation, and the watchdog outputs a fourth signal to control the first bus buffer to be disconnected and the second bus buffer to be turned on.
[0087] After the BIOS completes reading the slave device information, it releases the control of the bus control chip and sets the GPIO port to a high level. Before the BMC polls the control again, the reading value of the IO_0 port is a high level. At this time, a trigger signal is sent to the watchdog timer to reset the timer, and the second bus buffer is turned on and the first bus buffer is disconnected through the NOT gate logic circuit. The BMC obtains the control of the bus control chip and executes this polling.
[0088] As an optional implementation, the method also includes: when the second master device is in a hung state or the second master device is in a dead loop state, the watchdog timer stops counting; when the duration of the watchdog timer stopping counting exceeds a preset time threshold, the watchdog outputs a third signal to control the first bus buffer to be turned on and the second bus buffer to be disconnected.
[0089] When the BMC is in a hung state or a dead loop state, the BMC cannot send a trigger signal to the watchdog timer. At this time, the watchdog timer controls the first bus buffer to be turned on and the second bus buffer to be turned off by outputting a third signal, thereby solving the problem that the BIOS cannot obtain the bus after the BMC hangs the bus.
[0090] As an optional implementation, after the first master device applies for the control right from the bus control chip, the method further includes: when the first master device occupies the control right, the second master device monitors the length of time the first master device occupies the control right; when the length of time the first master device occupies the control right exceeds a preset length threshold, the second master device sends the second signal to the watchdog to control the watchdog timer to perform a counting operation, and the watchdog outputs a fourth signal to control the first bus buffer to disconnect and the second bus buffer to turn on.
[0091] The time T2 for the first master device (BIOS) to control the bus control chip is limited. When the BIOS occupies the control right of the bus control device, the BMC will monitor the time for which the BIOS occupies the control right. If the time for which the BIOS occupies the control right exceeds the preset time threshold, it is determined that the BIOS occupies the control right for a timeout, or that the BIOS is abnormal (in a hung state). At this time, the BMC can directly send a trigger signal to the watchdog timer, thereby turning off the first bus buffer, turning on the second bus buffer, and regaining the control right of the bus control chip. This can solve the problem that the BMC cannot obtain the bus after the BIOS occupies the bus for a timeout.
[0092] As an optional implementation, Figure 7 : is a flow chart of the BIOS applying for control rights according to an embodiment of the present application, such as Figure 7 As shown, the specific process is as follows:
[0093] Before applying for PCA9641 control, BIOS sets GPIO to low to reserve with BMC.
[0094] Before each polling, BMC reads the value of IO_0 to determine whether BIOS has been reserved. If the value of IO_0 is 0, it means that BIOS has been reserved. Then BMC abandons this polling and feeding the dog. At this time, U8 is disconnected and U7 is turned on.
[0095] After waiting for t0 time, BIOS applies for the control of PCA9641. The waiting time t0 is greater than the normal polling cycle of BMC.
[0096] BIOS obtains the control right of PCA9641, and after completing the information reading, releases the control right of PCA9617 and sets GPIO high at the same time;
[0097] Before BMC polls again, if the reading value of IO_0 is 1, the dog is fed. At this time, U8 is turned on and U7 is turned off. BMC applies for control of PCA9641 and executes this polling.
[0098] As an optional implementation, Figure 8 is a flow chart of a BMC in a hung state according to an embodiment of the present application, such as Figure 8 As shown, the specific process is as follows:
[0099] When BIOS applies for control, if BMC is in a hung state, BMC cannot feed the watchdog. At this time, the watchdog circuit disconnects U8 and turns on U7. PCA9641 will automatically disconnect the master device from the slave device and remain idle after the SDA / SCL waveform remains unchanged for 100ms. After that, BIOS can apply for PCA9641 control normally.
[0100] Or, when BIOS applies for control, if BMC cannot exit a certain polling in an infinite loop, BMC cannot feed the watchdog. At this time, the watchdog circuit disconnects U8 and turns on U7. PCA9641 will automatically disconnect the master device and the slave device and remain idle after the SDA / SCL waveform remains unchanged for 100ms. After that, BIOS can apply for PCA9641 control normally.
[0101] As an optional implementation, Fig. 9 is a flowchart of the BIOS occupation control right timeout according to an embodiment of the present application, such as Fig. 9 As shown, the specific process is as follows:
[0102] After the BIOS applies for control, the BMC can monitor and determine whether the current BIOS has timed out from occupying the control of PCA9641. Since the normal duration of the BIOS occupying the control of PCA9641 is limited, if the BMC determines that the BIOS has timed out from occupying the control, it can be considered that the BIOS is abnormal or in a hung state, and the BIOS cannot actively release the control of PCA9641. At this time, the BMC can disconnect U7 and turn on U8 by resuming the dog feeding, and reapply for the control of PCA9641.
[0103] Through the description of the above implementation methods, those skilled in the art can clearly understand that the method according to the above embodiment can be implemented by means of software plus a necessary general hardware platform, and of course by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of the present application, or the part that contributes to the prior art, can be embodied in the form of a software product, which is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk), and includes a number of instructions for a terminal device (which can be a mobile phone, computer, server, or network device, etc.) to execute the methods described in each embodiment of the present application.
[0104] In the present embodiment, a bus control device for a dual-master device is also provided, which is used to implement the above-mentioned embodiments and preferred implementation modes, and the descriptions that have been made will not be repeated. As used below, the term "module" can implement a combination of software and / or hardware of a predetermined function. Although the devices described in the following embodiments are preferably implemented in software, the implementation of hardware, or a combination of software and hardware, is also possible and conceived.
[0105] Fig.10 is a structural block diagram of a bus control device for a dual-master device according to an embodiment of the present application, such as Fig.10 As shown, the device includes: a setting module 1002, which is set in the first master device, and is used to set the first signal output by the universal input and output port to low before the first master device applies for the control right of the bus control chip, so as to reserve the control right with the bus control chip; a reading module determination module 1004, which is set in the second master device, and is used to read the first signal of the first port as low before the second master device polls and controls the slave device, and determine that the first master device has reserved the control right with the bus control chip, and give up polling and controlling the slave device, wherein the first master device sends the first signal to the first port of the input and output expander through the universal input and output port for before the second master device polls and controls the slave device, the second master device reads the first signal of the first port as low, determines that the first master device has reserved the control right with the bus control chip, and the second master device gives up polling and controlling the slave device, wherein the first master device sends the first signal to the first port of the input and output expander through the universal input and output port.
[0106] In an exemplary embodiment, the second master device is also used to stop sending a second signal to the watchdog when the first signal read by the second master device is low, so as to control the watchdog timer to stop counting. When the duration of the watchdog timer stopping counting exceeds a preset time threshold, the watchdog outputs a third signal to control the first bus buffer to be turned on and the second bus buffer to be turned off.
[0107] In an exemplary embodiment, the first master device is also used to apply for the control right from the bus control chip when a preset waiting time is reached, wherein the preset waiting time is greater than the time for the second master device to poll and control the slave device.
[0108] In an exemplary embodiment, the first master device is further configured to read target information from the slave device;
[0109] After the first master device completes reading the target information from the slave device, the first master device is further configured to set the first signal output by the general input / output port to high.
[0110] In an exemplary embodiment, the second master device is also used to read the first signal of the first port as high before the second master device polls the control slave device, and the second master device sends the second signal to the watchdog to control the watchdog timer to perform a counting operation, and the watchdog outputs a fourth signal to control the first bus buffer to be disconnected and the second bus buffer to be turned on.
[0111] In an exemplary embodiment, the watchdog is also used to control the timer to stop counting when the second master device is in a hung state or the second master device is in a dead loop state, and to output a third signal to control the first bus buffer to be turned on and the second bus buffer to be disconnected when the duration of the timer stopping counting exceeds a preset time threshold.
[0112] In an exemplary embodiment, the second master device is also used to monitor the length of time the first master device occupies the control right when the first master device occupies the control right; when the length of time the first master device occupies the control right exceeds a preset length threshold, the second master device is also used to send the second signal to the watchdog to control the watchdog timer to perform a counting operation, and the watchdog is also used to output a fourth signal to control the first bus buffer to be disconnected and the second bus buffer to be turned on.
[0113] It should be noted that the above modules can be implemented by software or hardware. For the latter, it can be implemented in the following ways, but not limited to: the above modules are all located in the same processor; or the above modules are located in different processors in any combination.
[0114] An embodiment of the present application further provides a computer-readable storage medium, in which a computer program is stored, wherein the computer program is configured to execute the steps of any of the above method embodiments when running.
[0115] In an exemplary embodiment, the computer-readable storage medium may include, but is not limited to, various media that can store computer programs, such as a USB flash drive, a read-only memory (ROM), a random access memory (RAM), a mobile hard disk, a magnetic disk or an optical disk.
[0116] An embodiment of the present application further provides an electronic device, including a memory and a processor, wherein a computer program is stored in the memory, and the processor is configured to run the computer program to execute the steps in any one of the above method embodiments.
[0117] In an exemplary embodiment, the electronic device may further include a transmission device and an input / output device, wherein the transmission device is connected to the processor, and the input / output device is connected to the processor.
[0118] An embodiment of the present application further provides a computer program product, which includes a computer program. When the computer program is executed by a processor, the steps in any one of the above method embodiments are implemented.
[0119] For specific examples in this embodiment, reference may be made to the examples described in the above embodiments and exemplary implementation modes, and this embodiment will not be described in detail herein.
[0120] Obviously, those skilled in the art should understand that the above modules or steps of the present application can be implemented by a general computing device, they can be concentrated on a single computing device, or distributed on a network composed of multiple computing devices, they can be implemented by a program code executable by a computing device, so that they can be stored in a storage device and executed by the computing device, and in some cases, the steps shown or described can be executed in a different order from that herein, or they can be made into individual integrated circuit modules, or multiple modules or steps therein can be made into a single integrated circuit module for implementation. Thus, the present application is not limited to any specific combination of hardware and software.
[0121] The above description is only the preferred embodiment of the present application and is not intended to limit the present application. For those skilled in the art, the present application may have various modifications and variations. Any modification, equivalent replacement, improvement, etc. made within the principles of the present application shall be included in the protection scope of the present application.
Claims
1. A bus circuit for dual master devices, It is characterized in that It includes: a first master device, a first bus buffer, a second master device, a second bus buffer, an input / output expander, a watchdog, a NOT gate, and a bus control chip; The first master device is connected to the first bus buffer via an integrated circuit bus, and the first bus buffer is connected to the bus control chip via an integrated circuit bus; The second master device is connected to the second bus buffer via the integrated circuit bus, and the second master device is also connected to the input-output expander via the integrated circuit bus; The input-output expander is also connected to the first master device, and the input-output expander is also connected to the watchdog; The watchdog is also connected to the NOT gate, the NOT gate is also connected to the first bus buffer, and the watchdog is also connected to the second bus buffer.
2. The bus circuit of the dual-master device according to claim 1, characterized in that: The bus circuit further includes: a slave device; The slave device is connected to the bus control chip via an integrated circuit bus.
3. The bus circuit of the dual-master device according to claim 1, characterized in that: The first master device is connected to the first bus buffer via an integrated circuit bus, including: the first master device is connected to the first bus buffer via a first data line and a first clock line.
4. The bus circuit of the dual-master device according to claim 1, characterized in that: The second master device is connected to the second bus buffer through an integrated circuit bus, and the second master device is also connected to the input-output expander through the integrated circuit bus, including: the second master device is connected to the second bus buffer and the input-output expander through a second data line; the second master device is connected to the second bus buffer and the input-output expander through a second clock line.
5. The bus circuit of the dual-master device according to claim 1, characterized in that: The input / output expander is also connected to the first host device, including: a universal input / output port of the first host device is connected to a first port of the first host device; The input-output expander is also connected to the watchdog, including: the second port of the input-output expander is connected to the watchdog.
6. The circuit according to any one of claims 1 to 5, characterized in that The first host device is a platform control unit, and the second host device is a baseboard management controller.
7. A bus control method for a dual-master device, characterized in that: A bus circuit applied to a dual-master device according to any one of claims 1 to 6, comprising: Before the first master device applies for the control right of the bus control chip, the first master device sets the first signal output by the general input / output port to low, so as to reserve the control right with the bus control chip; Before the second master device polls and controls the slave device, the second master device reads the first signal of the first port as low, determines that the first master device has reserved the control right with the bus control chip, and the second master device gives up polling and controlling the slave device, wherein the first master device sends the first signal to the first port of the input / output expander through the general input / output port.
8. The method according to claim 7, characterized in that In the case where the first signal read is low, the method further includes: The second master device stops sending the second signal to the watchdog to control the watchdog's timer to stop counting. When the duration of the watchdog's timer stopping counting exceeds a preset time threshold, the watchdog outputs a third signal to control the first bus buffer to be turned on and the second bus buffer to be turned off.
9. The method according to claim 7, characterized in that: The method further comprises: When a preset waiting time is reached, the first master device applies to the bus control chip for the control right, wherein the preset waiting time is greater than the time for the second master device to poll and control the slave device.
10. The method according to claim 8, characterized in that After the first master device applies for the control right from the bus control chip, the method further includes: The first master device reads target information from the slave device; After the first master device completes reading the target information from the slave device, the first master device sets the first signal output by the general input / output port to high.
11. The method according to claim 8, characterized in that After the first master device sets the first signal output by the general input / output port to high, the method further includes: Before the second master device polls and controls the slave device, the second master device reads the first signal of the first port as high, and the second master device sends the second signal to the watchdog to control the watchdog's timer to perform a counting operation, and the watchdog outputs a fourth signal to control the first bus buffer to be disconnected and the second bus buffer to be turned on.
12. The method according to claim 7, characterized in that The method further comprises: When the second master device is in a hung state or the second master device is in an infinite loop, the watchdog timer stops counting. When the duration of the watchdog timer stopping counting exceeds a preset time threshold, the watchdog outputs a third signal to control the first bus buffer to be turned on and the second bus buffer to be turned off.
13. The method according to claim 8, characterized in that After the first master device applies for the control right from the bus control chip, the method further includes: When the first master device occupies the control right, the second master device monitors the length of time the first master device occupies the control right; When the length of time that the first master device occupies the control right exceeds a preset length threshold, the second master device sends the second signal to the watchdog to control the watchdog's timer to perform a counting operation, and the watchdog outputs a fourth signal to control the first bus buffer to be disconnected and the second bus buffer to be turned on.
14. A bus control device for dual-master equipment, characterized in that: A bus control method for a dual-master device according to any one of claims 7 to 13, comprising: A setting module, provided in the first master device, for setting a first signal output by a universal input / output port to low before the first master device applies for the control right of the bus control chip, so as to reserve the control right with the bus control chip; A reading module is provided in the second master device, and is used for reading the first signal of the first port as low before the second master device polls and controls the slave device, and determining that the first master device has reserved the control right with the bus control chip, and giving up polling and controlling the slave device, wherein the first master device sends the first signal to the first port of the input / output expander through the general input / output port.
15. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, wherein the computer program implements the steps of the method described in any one of claims 7 to 13 when executed by a processor.
16. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the computer program, the steps of the method described in any one of claims 7 to 13 are implemented.
17. A computer program product comprising a computer program, characterized in that When the computer program is executed by a processor, the steps of the method described in any one of claims 7 to 13 are implemented.
