A method, apparatus, device, and storage medium for determining the physical location of an external device.
By determining the location of external devices using bus signals and device addresses, the problem of inaccurate location determination of external devices in existing technologies is solved, enabling efficient device positioning and maintenance.
Patent Information
- Application Number
- CN202211191057.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-09-28
- Publication Date
- 2026-11-10
- Estimated Expiration
- 2042-09-28
AI Technical Summary
In existing technologies, BMC cannot effectively match the information of multiple external devices of the same type with their specific locations one by one, resulting in inaccurate location when devices malfunction, thus reducing the efficiency of location determination.
By using the presence signal of the bus and the bus device address of the external device, the target bus and motherboard slot where the expansion card connected to the external device is located are determined. Combined with the bus exchange channel and the expansion card slot, the physical location of the external device is determined.
It enables accurate positioning of external devices, improves the efficiency of parts replacement and maintenance when equipment fails, and can clearly distinguish the location of multiple devices of the same type.
Smart Images

Figure CN115509978B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of computer technology, and in particular to a method, apparatus, device, and storage medium for determining the physical location of an external device. Background Technology
[0002] The Baseboard Management Controller (BMC) acts as the "steward" of the entire server, monitoring the health status of all components, including temperature and voltage. It performs adjustments when any component malfunctions and promptly reports faults to the upper-level platform using industry-standard protocols such as SNMP (Simple Network Management Protocol), SMTP (Simple Mail Transfer Protocol), and Redfish. This allows maintenance personnel to address the issues promptly and ensure the server remains in good health. To facilitate targeted repairs or replacements, the BMC must not only accurately monitor the health of each component but also pinpoint the type and physical location of any malfunctioning component, especially for external devices like PCIe (PCI-Express) devices.
[0003] Currently, in mainstream servers, the monitoring of the location information of external devices such as PCIe devices is mostly implemented by the BIOS (Basic Input Output System), which sends all detected device location information to the BMC. Taking PCIe devices as an example, in addition to the information sent by the BIOS, the BMC also needs to monitor other information of the PCIe devices according to customer requirements, such as temperature, health status, serial number, firmware version, lifespan, and capacity. The BMC typically obtains PCIe device information based on the I2C protocol, by accessing the corresponding registers of the device's slave address. Although the BMC can obtain the location information of all devices through the BIOS and can also read the necessary information of PCIe devices via I2C, it cannot effectively map the read information to their specific locations when multiple identical PCIe devices are connected, such as RAID (Redundant Arrays of Independent Disks) cards and GPUs (graphics processing units). In this case, if one PCIe device malfunctions, it cannot accurately identify which of the multiple identical PCIe devices plugged into the expansion card (i.e., riser card) is correct. Verification can only be done by manually plugging and unplugging the PCIe devices using a process of elimination. This reduces the efficiency of determining the physical location of external devices. Summary of the Invention
[0004] In view of this, the purpose of this invention is to provide a method, apparatus, device, and medium for determining the physical location of an external insertion device, capable of accurately locating the specific position of the external insertion device. The specific solution is as follows:
[0005] In a first aspect, this application discloses a method for determining the physical location of an external device, applied to a baseboard management controller, comprising:
[0006] Based on the presence signal of the bus and the bus device address corresponding to the external device, determine the target bus where the expansion card connected to the external device is located from all buses, and determine the motherboard slot corresponding to the target bus;
[0007] Based on the bus device address, determine the target bus switching channel where the external device is located from all bus switching channels of the expansion card, and determine the expansion card slot corresponding to the target bus switching channel;
[0008] The physical chassis location of the external device is determined based on the motherboard slot and the expansion card slot.
[0009] Optionally, determining the target bus where the expansion card connected to the external device is located from all buses based on the bus presence signal and the bus device address corresponding to the external device includes:
[0010] The candidate bus with the expansion card is determined from all buses based on the bus's presence signal;
[0011] Based on the bus device address corresponding to the external device, poll the candidate buses to determine the target bus where the expansion card connected to the external device is located from all candidate buses.
[0012] Optionally, before determining the candidate bus with the expansion card inserted from all buses based on the bus's presence signal, the method further includes:
[0013] Create a monitoring thread for monitoring external devices;
[0014] If the monitoring thread detects an external device, it performs the operation of determining the candidate bus with the expansion card inserted from all buses based on the bus's presence signal.
[0015] Optionally, determining the motherboard slot corresponding to the target bus includes:
[0016] Based on the pre-created first mapping relationship between bus numbers and motherboard slots, the motherboard slot corresponding to the target bus is determined according to the bus number corresponding to the target bus;
[0017] The first mapping relationship is a mapping relationship created in advance based on the unique correspondence between different buses and different motherboard slots.
[0018] Optionally, determining the target bus switching channel where the external device is located from all bus switching channels of the expansion card includes:
[0019] Based on the bus device address, poll all bus switching channels of the expansion card to determine the target bus switching channel where the external device is located from all bus switching channels.
[0020] Optionally, determining the expansion card slot corresponding to the target bus switching channel includes:
[0021] Based on the pre-created second mapping relationship between channel number and expansion card slot, and the channel number corresponding to the target bus switching channel, the expansion card slot corresponding to the target bus switching channel is determined.
[0022] Optionally, before determining the expansion card slot corresponding to the target bus switching channel, the method further includes:
[0023] Obtain the card ID of the expansion card, and determine the card type corresponding to the expansion card based on the pre-created third mapping relationship between card ID and card type; the card type is determined by classifying the expansion card based on the number of bus switching channels and the number of expansion card slots.
[0024] The second mapping relationship corresponding to the expansion card is determined according to the card type; the second mapping relationship is a mapping relationship created in advance for the correspondence between the channel number and the expansion card slot in different types of expansion cards.
[0025] Secondly, this application discloses an external device physical location determination device, applied to a substrate management controller, comprising:
[0026] The motherboard slot determination module is used to determine the target bus where the expansion card connected to the external device is located from all buses based on the bus presence signal and the bus device address corresponding to the external device, and to determine the motherboard slot corresponding to the target bus.
[0027] An expansion card slot determination module is used to determine the target bus switching channel where the external device is located from all bus switching channels of the expansion card according to the bus device address, and to determine the expansion card slot corresponding to the target bus switching channel;
[0028] The location determination module is used to determine the physical chassis location of the external device based on the motherboard slot and the expansion card slot.
[0029] Thirdly, this application discloses an electronic device, comprising:
[0030] Memory, used to store computer programs;
[0031] A processor is used to execute the computer program to implement the aforementioned method for determining the physical location of the external device.
[0032] Fourthly, this application discloses a computer-readable storage medium for storing a computer program; wherein the computer program, when executed by a processor, implements the aforementioned method for determining the physical location of an external device.
[0033] In this application, based on the presence signal of the bus and the bus device address corresponding to the external device, the target bus where the expansion card connected to the external device is located is determined from all buses, and the motherboard slot corresponding to the target bus is determined; based on the bus device address, the target bus switching channel where the external device is located is determined from all bus switching channels of the expansion card, and the expansion card slot corresponding to the target bus switching channel is determined; based on the motherboard slot and the expansion card slot, the physical chassis location of the external device is determined. It can be seen that after obtaining the bus device address of the external device through the bus, the software layer information such as the target bus and target bus switching channel corresponding to the external device is determined, and then the software layer information is mapped one-to-one with the physical layer location information, thereby determining the unique physical location of the external device. When multiple external devices of the same type are connected, the information of each device can be clearly distinguished, and when an external device malfunctions, its specific location can be accurately located for targeted replacement or repair, enriching functionality while improving problem-solving efficiency. Attached Figure Description
[0034] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on the provided drawings without creative effort.
[0035] Figure 1 A flowchart of a method for determining the physical location of an external device provided in this application;
[0036] Figure 2 A diagram showing the positional relationship between external devices, expansion cards, and motherboard slots;
[0037] Figure 3 A schematic diagram illustrating a specific mapping relationship between bus numbers and motherboard slots provided in this application;
[0038] Figure 4 A schematic diagram illustrating a specific mapping relationship between channel numbers and expansion card slots provided for this application;
[0039] Figure 5 This application provides a specific diagram illustrating the mapping relationship between card ID and card type.
[0040] Figure 6 This application provides a specific logic diagram for determining the physical location of an external device;
[0041] Figure 7A flowchart illustrating a specific method for determining the physical location of an external device provided in this application;
[0042] Figure 8 A schematic diagram of a device for determining the physical location of an external insertion device is provided in this application;
[0043] Figure 9 This application provides a structural diagram of an electronic device. Detailed Implementation
[0044] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, the technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0045] In current technology, the monitoring of the location information of external devices such as PCIe devices in mainstream servers is mostly implemented by the BIOS, which sends the location information of all detected devices to the BMC. Taking PCIe devices as an example, in addition to the information sent by the BIOS, the BMC also needs to monitor other information of the PCIe devices according to customer requirements, such as temperature, health status, serial number, firmware version, lifespan, and capacity. The BMC usually obtains PCIe device information based on the I2C protocol, by accessing the corresponding register of the slave device address. Although the BMC can obtain the location information of all devices through the BIOS, and can also read the required information of PCIe devices itself through I2C, it cannot effectively match the read information with the specific location of multiple identical PCIe devices connected, such as RAID cards and GPUs. In this case, if one PCIe device malfunctions, it is impossible to accurately identify which of the multiple identical PCIe devices plugged into the expansion card, and verification can only be done by manually plugging and unplugging the PCIe devices by elimination. This reduces the efficiency of determining the physical location of external devices. To overcome the above-mentioned technical problems, this application proposes a method for determining the physical location of an external insertion device, which can accurately locate the specific location of the external insertion device.
[0046] This application discloses a method for determining the physical location of an external device, applied to a baseboard management controller. See also... Figure 1 As shown, the method may include the following steps:
[0047] Step S11: Based on the presence signal of the bus and the bus device address corresponding to the external device, determine the target bus where the expansion card connected to the external device is located from all buses, and determine the motherboard slot corresponding to the target bus.
[0048] In this embodiment, the baseboard management controller determines the target bus where the expansion card connected to the external device is located from all buses based on the presence signal of the server's internal bus and the bus device address corresponding to the external device. Then, it determines the motherboard slot corresponding to that target bus. In other words, the baseboard management controller obtains relevant information, including the bus device address, for the external device through the bus connecting it to the external device, and then determines the target bus based on that address. Because external devices are usually plugged into expansion card slots, it is necessary to first determine which target bus the expansion card containing the external device is located on.
[0049] In this embodiment, the external device can specifically be a PCIe device, the expansion card is a riser card, the bus device address is a slave address, and the bus is an I2C bus. Correspondingly, for example... Figure 2 As shown, a riser card has multiple riser card slots to accommodate PCIe devices, and the riser card is also inserted into a motherboard slot in the server. Furthermore, the location and number of slots vary depending on the type of riser card.
[0050] In this embodiment, determining the target bus where the expansion card connected to the external device is located from all buses based on the bus presence signal and the bus device address corresponding to the external device may include: determining candidate buses with inserted expansion cards from all buses based on the bus presence signal; polling the candidate buses based on the bus device address corresponding to the external device to determine the target bus where the expansion card connected to the external device is located from all candidate buses. That is, the presence signal of the bus can be used to query which buses have inserted expansion cards, and the target bus is one of these candidate buses with inserted expansion cards. After determining the candidate bus, the candidate buses to the left and right are polled based on the bus device address corresponding to the external device, checking in turn whether these buses have the bus device address corresponding to the external device; if so, the bus is taken as the target bus.
[0051] In this embodiment, before determining the candidate bus with the expansion card inserted from all buses based on the bus's presence signal, the process may further include: creating a monitoring thread for monitoring external devices; if the monitoring thread detects an external device, then performing the operation of determining the candidate bus with the expansion card inserted from all buses based on the bus's presence signal. That is, after the BMC's main process starts, it automatically creates an external device monitoring thread so that it can automatically perform a location positioning operation when an external device is detected.
[0052] In this embodiment, determining the motherboard slot corresponding to the target bus may include: determining the motherboard slot corresponding to the target bus based on the bus number corresponding to the target bus according to a pre-created first mapping relationship between bus numbers and motherboard slots; the first mapping relationship is a mapping relationship created in advance based on the unique correspondence between different buses and different motherboard slots. It can be understood that, due to the unique correspondence between different buses and different motherboard slots within the server, by pre-constructing the mapping relationship between bus numbers and motherboard slots, the location of the corresponding motherboard slot can be determined based on the obtained bus number. The aforementioned first mapping relationship can be as follows: Figure 3 As shown, each motherboard slot corresponds to a unique bus number (I2C BusNo). The bus number and presence signal determine whether an expansion card is inserted into the motherboard slot and its specific slot location.
[0053] Step S12: Based on the bus device address, determine the target bus switching channel where the external device is located from all bus switching channels of the expansion card, and determine the expansion card slot corresponding to the target bus switching channel.
[0054] In this embodiment, after determining the target bus, the external device is located in the target bus switching channel from all bus switching channels corresponding to the target bus based on the bus device address of the external device, and then the expansion card slot corresponding to the target bus switching channel is determined.
[0055] In this embodiment, determining the target bus switching channel where the external device is located from all bus switching channels of the expansion card may include: polling all bus switching channels of the expansion card according to the bus device address, and determining the target bus switching channel where the external device is located from all bus switching channels. In this embodiment, before polling all bus switching channels of the expansion card according to the bus device address, the method further includes: determining candidate channels with the expansion card inserted from all bus switching channels according to the bit signals of the bus switching channels; polling the candidate channels according to the bus device address, and determining the target bus switching channel where the external device is located from all candidate channels. That is, similar to the process of determining the target bus, polling all bus switching channels of the expansion card according to the bus device address of the external device, sequentially checking whether these bus switching channels have the bus device address corresponding to the current external device, and if so, using that bus switching channel as the target bus switching channel.
[0056] In this embodiment, determining the expansion card slot corresponding to the target bus switching channel may include: determining the expansion card slot corresponding to the target bus switching channel based on a pre-created second mapping relationship between channel numbers and expansion card slots, and the channel number corresponding to the target bus switching channel. The second mapping relationship is a mapping relationship created in advance based on the unique correspondence between different bus switching channels and different expansion card slots. It can be understood that there is a unique correspondence between different bus switching channels and different expansion card slots within a single expansion card; therefore, by pre-constructing the mapping relationship between bus switching channel numbers and expansion card slots, the location of the corresponding expansion card slot can be determined based on the obtained bus switching channel number. The aforementioned second mapping relationship can be as follows: Figure 4 As shown, taking the riser card as an example, each bus switching channel (I2C switch channel) corresponds to a unique riser slot.
[0057] In this embodiment, before determining the expansion card slot corresponding to the target bus switching channel, the method may further include: obtaining the card ID of the expansion card; determining the card type corresponding to the expansion card based on a pre-created third mapping relationship between the card ID and the card type; the card type is determined by classifying the expansion card based on the number of bus switching channels and the number of expansion card slots; determining the second mapping relationship corresponding to the expansion card based on the card type; the second mapping relationship is a mapping relationship pre-created for the correspondence between channel numbers and expansion card slots in different types of expansion cards.
[0058] Understandably, in existing technologies, to enable multiple devices to be connected to a single bus, the conventional approach is to utilize the PCA954X series I2C switch routing chip to expand a sufficient number of interfaces on limited I2C resources. For example, the 9546 can be expanded to 4 channels, and the 9548 to 8 channels. During I / O access, a write operation is only needed to address 0x00, which enables routing of the I2C bus of the device connected to the PCA954X and reading information about the device on the relevant channel. Given the diverse configurations of different customers, riser cards need to accommodate many scenarios, resulting in various riser types. Different types of riser cards may have different numbers of I2C channels or slots. To pinpoint the specific chassis location of the device inserted into the riser card, the aforementioned second mapping relationship needs to be determined. For example... Figure 5As shown, in this embodiment, a second mapping relationship is constructed for each type of expansion card. Before determining the expansion card slot position, the riser card type is first identified. The specific riser card type can be further distinguished by adding card ID (board ID) information. After determining the riser card type, the correspondence between the current riser card's channel number and the expansion card slot is confirmed.
[0059] Step S13: Determine the physical chassis location of the external device based on the motherboard slot and the expansion card slot.
[0060] In this embodiment, after determining the motherboard slot and expansion card slot corresponding to the external device, the expansion card slot on the motherboard slot determined on the server can be used as the physical location of the external device. Furthermore, this embodiment, besides being applied to the baseboard management controller, can also be applied to other devices to confirm the location of key components through I2C link information.
[0061] For example Figure 6 As shown, taking a PCIe device as an example, in this embodiment, combining the first mapping relationship with the I2C Bus No., a unique corresponding motherboard slot can be determined; combining the third mapping relationship with the card ID, a unique corresponding card type can be determined; after determining the second mapping relationship based on the card type, a unique corresponding riser slot can be determined based on the I2C switch channel. That is, after determining the I2C Bus No., card ID, and I2C switch channel—these soft-level information—then, according to the physical silkscreen correspondence table based on the motherboard slot location rules and riser card slot location configuration within the server, the soft-level information can be converted into physical-level information, thereby determining the physical location information of the external device. Taking a PCIe device as an example, as... Figure 7 As shown, the determination process is as follows:
[0062] S1: After the main process starts, BMC creates an external device monitoring thread (OdeviceMonitorTask);
[0063] S2: After the monitoring thread is started, it polls the I2C Bus No occupied by the external device. It determines whether a riser card is inserted on the Bus No by checking the position signal. If not, it skips to detect the next Bus No. If a riser card is inserted and the bus has the bus device address of a PCIe device, it saves the Bus No to the static variable GBusNo and proceeds to S3.
[0064] S3: Read the register corresponding to the riser card on the bus determined in S2, obtain the boardID of the riser card and record it in the static variable GBoardID. Next, index the mapping table between boardID and riser card type to obtain the correspondence between each riser card slot and I2C switch channel of the riser card, and then proceed to S4.
[0065] S4: Based on the number of riser switch channels obtained, poll and switch channels in turn. Determine whether there is a connected device on the channel by the presence signal of each channel. If not, skip to the next channel. If there is a device and the bus device address of a PCIe device exists on the channel, save the channel to the static variable GChannel and proceed to S5.
[0066] S5: By querying the physical silkscreen correspondence table under the given configuration using the recorded static variables GBusNo, GBoardID, and GChannel, the physical location information of the external device is determined.
[0067] Therefore, by mapping the I2C information obtained by the BMC to key physical location information, and by indexing the I2C Bus NO to the motherboard slot mapping table, riserboardID to the riser card type mapping table, and I2C switchchannel to the riser slot mapping table, the physical location of the external PCIe device can be uniquely identified.
[0068] As can be seen from the above, in this embodiment, based on the presence signal of the bus and the bus device address corresponding to the external device, the target bus where the expansion card connected to the external device is located is determined from all buses, and the motherboard slot corresponding to the target bus is determined; based on the bus device address, the target bus switching channel where the external device is located is determined from all bus switching channels of the expansion card, and the expansion card slot corresponding to the target bus switching channel is determined; based on the motherboard slot and the expansion card slot, the physical chassis location of the external device is determined. It is evident that after obtaining the bus device address of the external device through the bus, the software layer information such as the target bus and target bus switching channel corresponding to the external device is determined, and then the software layer information is mapped one-to-one with the physical layer location information, thereby determining the unique physical location of the external device. When multiple external devices of the same type are connected, the information of each device can be clearly distinguished, and when an external device malfunctions, its specific location can be accurately located for targeted replacement or repair, enriching functionality while improving problem-solving efficiency.
[0069] Accordingly, this application also discloses an external device physical location determination device, applied to a baseboard management controller, see [link to relevant documentation]. Figure 8 As shown, the device includes:
[0070] The motherboard slot determination module 11 is used to determine the target bus where the expansion card connected to the external device is located from all buses based on the bus presence signal and the bus device address corresponding to the external device, and to determine the motherboard slot corresponding to the target bus.
[0071] The expansion card slot determination module 12 is used to determine the target bus switching channel where the external device is located from all bus switching channels of the expansion card according to the bus device address, and to determine the expansion card slot corresponding to the target bus switching channel;
[0072] The location determination module 13 is used to determine the physical chassis location of the external device based on the motherboard slot and the expansion card slot.
[0073] As can be seen from the above, in this embodiment, based on the presence signal of the bus and the bus device address corresponding to the external device, the target bus where the expansion card connected to the external device is located is determined from all buses, and the motherboard slot corresponding to the target bus is determined; based on the bus device address, the target bus switching channel where the external device is located is determined from all bus switching channels of the expansion card, and the expansion card slot corresponding to the target bus switching channel is determined; based on the motherboard slot and the expansion card slot, the physical chassis location of the external device is determined. It is evident that after obtaining the bus device address of the external device through the bus, the software layer information such as the target bus and target bus switching channel corresponding to the external device is determined, and then the software layer information is mapped one-to-one with the physical layer location information, thereby determining the unique physical location of the external device. When multiple external devices of the same type are connected, the information of each device can be clearly distinguished, and when an external device malfunctions, its specific location can be accurately located for targeted replacement or repair, enriching functionality while improving problem-solving efficiency.
[0074] In some specific embodiments, the motherboard slot determination module 11 may specifically include:
[0075] The candidate bus determination unit is used to determine the candidate bus with the expansion card inserted from all buses based on the bus presence signal;
[0076] The target bus determination unit is used to poll the candidate buses according to the bus device address corresponding to the external device, and determine the target bus where the expansion card connected to the external device is located from all candidate buses.
[0077] In some specific embodiments, the device for determining the physical location of the external device may specifically include:
[0078] The monitoring thread creation unit is used to create monitoring threads for monitoring external devices.
[0079] The monitoring unit is configured to perform the operation of determining the candidate bus with the expansion card inserted from all buses based on the bus presence signal if the monitoring thread detects an external device.
[0080] In some specific embodiments, the motherboard slot determination module 11 may specifically include:
[0081] The motherboard slot determination unit is used to determine the motherboard slot corresponding to the target bus based on the bus number corresponding to the target bus according to the first mapping relationship between the bus number and the motherboard slot in a pre-created manner; the first mapping relationship is a mapping relationship created in advance based on the unique correspondence between different buses and different motherboard slots.
[0082] In some specific embodiments, the expansion card slot determination module 12 may specifically include:
[0083] The target bus switching channel determination unit is used to poll all bus switching channels of the expansion card according to the bus device address, and determine the target bus switching channel where the external device is located from all bus switching channels.
[0084] In some specific embodiments, the expansion card slot determination module 12 may specifically include:
[0085] An expansion card slot determination unit is used to determine the expansion card slot corresponding to the target bus switching channel based on a pre-created second mapping relationship between channel number and expansion card slot, and the channel number corresponding to the target bus switching channel.
[0086] In some specific embodiments, the device for determining the physical location of the external device may specifically include:
[0087] The card type determination unit is used to obtain the card ID of the expansion card and determine the card type corresponding to the expansion card according to the pre-created third mapping relationship between the card ID and the card type; the card type is determined by classifying the expansion card based on the number of bus switching channels and the number of expansion card slots.
[0088] The second mapping relationship determination unit is used to determine the second mapping relationship corresponding to the expansion card according to the card type; the second mapping relationship is a mapping relationship created in advance for the correspondence between the channel number and the expansion card slot in different types of expansion cards.
[0089] As can be seen from the above, in this embodiment, by combining the first mapping relationship with the bus number corresponding to the target bus, a unique corresponding motherboard slot can be determined. By combining the third mapping relationship with the card ID, a unique corresponding card type can be determined. After determining the second mapping relationship based on the card type, a unique corresponding expansion card slot can be determined by combining the second mapping relationship with the channel number corresponding to the target bus switching channel. That is, after determining the soft-level information such as the bus number, card ID, and channel number corresponding to the target bus switching channel, the soft-level information can be converted into physical-level information according to the physical silkscreen correspondence table based on the motherboard slot location rules and expansion card slot location configuration within the server, thereby determining the physical location information of the external device.
[0090] Furthermore, this application also discloses an electronic device, see [link to relevant documentation]. Figure 9 As shown, the content in the figure should not be considered as any limitation on the scope of use of this application.
[0091] Figure 9 This is a schematic diagram of the structure of an electronic device 20 provided in an embodiment of this application. The electronic device 20 may specifically include: at least one processor 21, at least one memory 22, a power supply 23, a communication interface 24, an input / output interface 25, and a communication bus 26. The memory 22 stores a computer program, which is loaded and executed by the processor 21 to implement the relevant steps in the external device physical location determination method disclosed in any of the foregoing embodiments.
[0092] In this embodiment, the power supply 23 is used to provide operating voltage for each hardware device on the electronic device 20; the communication interface 24 can create a data transmission channel between the electronic device 20 and external devices, and the communication protocol it follows can be any communication protocol applicable to the technical solution of this application, and is not specifically limited here; the input / output interface 25 is used to acquire external input data or output data to the outside world, and its specific interface type can be selected according to specific application needs, and is not specifically limited here.
[0093] In addition, the memory 22, as a carrier for resource storage, can be a read-only memory, random access memory, disk or optical disk, etc. The resources stored thereon include the operating system 221, computer programs 222 and data 223 including bus device addresses, etc. The storage method can be temporary storage or permanent storage.
[0094] The operating system 221 manages and controls the various hardware devices on the electronic device 20 and the computer program 222 to enable the processor 21 to perform calculations and processing on the massive data 223 in the memory 22. The operating system 221 can be Windows Server, Netware, Unix, Linux, etc. In addition to including a computer program capable of performing the external device physical location determination method executed by the electronic device 20 as disclosed in any of the foregoing embodiments, the computer program 222 may further include computer programs capable of performing other specific tasks.
[0095] Furthermore, this application also discloses a computer storage medium storing computer-executable instructions. When the computer-executable instructions are loaded and executed by a processor, they implement the steps of the external device physical location determination method disclosed in any of the foregoing embodiments.
[0096] The various embodiments in this specification are described in a progressive manner, with each embodiment focusing on its differences from other embodiments. Similar or identical parts between embodiments can be referred to interchangeably. For the apparatus disclosed in the embodiments, since it corresponds to the method disclosed in the embodiments, the description is relatively simple; relevant parts can be referred to in the method section.
[0097] The steps of the methods or algorithms described in conjunction with the embodiments disclosed herein can be implemented directly by hardware, a software module executed by a processor, or a combination of both. The software module can be located in random access memory (RAM), main memory, read-only memory (ROM), electrically programmable ROM, electrically erasable programmable ROM, registers, hard disk, removable disk, CD-ROM, or any other form of storage medium known in the art.
[0098] Finally, it should be noted that in this document, relational terms such as "first" and "second" are used only to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element.
[0099] The present invention provides a detailed description of a method, apparatus, device, and medium for determining the physical location of an external insertion device. Specific examples have been used to illustrate the principles and implementation methods of the present invention. The descriptions of the above embodiments are only for the purpose of helping to understand the method and core ideas of the present invention. At the same time, those skilled in the art will recognize that there will be changes in the specific implementation methods and application scope based on the ideas of the present invention. Therefore, the content of this specification should not be construed as a limitation of the present invention.
Claims
1. A method for determining the physical location of an external insertion device, characterized in that, Applications to baseboard management controllers include: Based on the presence signal of the bus and the bus device address corresponding to the external device, the target bus where the expansion card connected to the external device is located is determined from all buses, and the motherboard slot corresponding to the target bus is determined; the bus is an I2C bus, and the bus device address is the slave device address; Based on the bus device address, determine the target bus switching channel where the external device is located from all bus switching channels of the expansion card, and determine the expansion card slot corresponding to the target bus switching channel; The physical chassis location of the external device is determined based on the motherboard slot and the expansion card slot; The step of determining the target bus where the expansion card connected to the external device is located from all buses based on the bus presence signal and the bus device address corresponding to the external device includes: The candidate bus with the expansion card is determined from all buses based on the bus's presence signal; Based on the bus device address corresponding to the external device, poll the candidate buses to determine the target bus where the expansion card connected to the external device is located from all candidate buses; Before determining the candidate bus with the expansion card inserted from all buses based on the bus's presence signal, the method further includes: Create a monitoring thread for monitoring external devices; If the monitoring thread detects an external device, it performs the operation of determining the candidate bus with the expansion card inserted from all buses based on the bus presence signal; The step of determining the expansion card slot corresponding to the target bus switching channel includes: Based on the pre-created second mapping relationship between the channel number and the expansion card slot, and the channel number corresponding to the target bus switching channel, the expansion card slot corresponding to the target bus switching channel is determined; Prior to determining the expansion card slot corresponding to the target bus switching channel, the method further includes: Obtain the card ID of the expansion card, and determine the card type corresponding to the expansion card based on the pre-created third mapping relationship between card ID and card type; the card type is determined by classifying the expansion card based on the number of bus switching channels and the number of expansion card slots. The second mapping relationship corresponding to the expansion card is determined according to the card type; the second mapping relationship is a mapping relationship created in advance for the correspondence between the channel number and the expansion card slot in different types of expansion cards. The step of determining the target bus switching channel where the external device is located from all bus switching channels of the expansion card includes: Based on the bus device address, poll all bus switching channels of the expansion card to determine the target bus switching channel where the external device is located from all bus switching channels; Prior to polling all bus switching channels of the expansion card according to the bus device address, the method further includes: Candidate channels with expansion cards are determined from all bus switching channels based on the bit signals of the bus switching channels; the candidate channels are polled based on the bus device address to determine the target bus switching channel where the external device is located from all candidate channels.
2. The method for determining the physical location of an external insertion device according to claim 1, characterized in that, Determining the motherboard slot corresponding to the target bus includes: Based on the pre-created first mapping relationship between bus numbers and motherboard slots, the motherboard slot corresponding to the target bus is determined according to the bus number corresponding to the target bus; The first mapping relationship is a mapping relationship created in advance based on the unique correspondence between different buses and different motherboard slots.
3. A device for determining the physical location of an external device, applied to a baseboard management controller, characterized in that, include: The motherboard slot determination module is used to determine the target bus where the expansion card connected to the external device is located from all buses based on the bus presence signal and the bus device address corresponding to the external device, and to determine the motherboard slot corresponding to the target bus; the bus is an I2C bus, and the bus device address is a slave device address; An expansion card slot determination module is used to determine the target bus switching channel where the external device is located from all bus switching channels of the expansion card according to the bus device address, and to determine the expansion card slot corresponding to the target bus switching channel; The location determination module is used to determine the physical chassis location of the external device based on the motherboard slot and the expansion card slot; The motherboard slot determination module is used to determine the candidate bus with the expansion card inserted from all buses based on the bus presence signal; and to poll the candidate buses according to the bus device address corresponding to the external device, and determine the target bus where the expansion card connected to the external device is located from all candidate buses. The device is further configured to create a monitoring thread for monitoring external devices before determining a candidate bus with an expansion card inserted from all buses based on the presence signal of the bus; if the monitoring thread detects an external device, the operation of determining a candidate bus with an expansion card inserted from all buses based on the presence signal of the bus is performed. The expansion card slot determination module is used to determine the expansion card slot corresponding to the target bus switching channel based on the second mapping relationship between the pre-created channel number and the expansion card slot, and the channel number corresponding to the target bus switching channel. The device is further configured to, before determining the expansion card slot corresponding to the target bus switching channel, obtain the card ID of the expansion card, and determine the card type corresponding to the expansion card according to a pre-created third mapping relationship between the card ID and the card type; the card type is determined by classifying the expansion card based on the number of bus switching channels and the number of expansion card slots; and determine the second mapping relationship corresponding to the expansion card according to the card type; the second mapping relationship is a mapping relationship pre-created for the correspondence between channel numbers and expansion card slots in different types of expansion cards. The expansion card slot determination module is used to poll all bus switching channels of the expansion card according to the bus device address, and determine the target bus switching channel where the external device is located from all bus switching channels; The expansion card slot determination module is further configured to, before polling all bus switching channels of the expansion card according to the bus device address, determine the candidate channel in which the expansion card is inserted from all bus switching channels according to the bit signal of the bus switching channel; and poll the candidate channels according to the bus device address to determine the target bus switching channel in which the external device is located from all candidate channels.
4. An electronic device, characterized in that, include: Memory, used to store computer programs; A processor for executing the computer program to implement the method for determining the physical location of an external device as described in claim 1 or 2.
5. A computer-readable storage medium, characterized in that, Used to store computer programs; wherein the computer programs, when executed by a processor, implement the method for determining the physical location of an external device as described in claim 1 or 2.
Citation Information
Patent Citations
PCIE (Peripheral Component Interface Express) equipment positioning method and device and related equipment
CN114077452A
Method and system for providing hot plug of adapter cards in an expanded slot environment
US6338107B1
