Bus distribution method, device and equipment for PCI-E card and storage medium

By enumerating PCI-E devices on the PCI-E card, changing the bus number multiple times, and restarting the server using the Option ROM signal, the problem of PCI-E card slot bus specification detection was solved, achieving bus specification adaptation without operating the host system and ensuring normal server startup.

CN115221092BActive Publication Date: 2026-01-16SHENZHEN XINGYUN ZHILIAN TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202210867023.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-07-22
Publication Date
2026-01-16
Estimated Expiration
2042-07-22

AI Technical Summary

Technical Problem

Existing technology cannot effectively detect the bus specification capability of a PCI-E card slot without operating the host system, leading to the problem of the BIOS failing to boot.

Method used

By starting the server on the PCI-E card, enumerating PCI-E devices, determining whether the enumeration is successful, changing the number of bus numbers multiple times until the enumeration fails, determining the number of allocable bus numbers, and restarting the server using the Option ROM signal or other methods, adaptive allocation of bus numbers is achieved.

Benefits of technology

Without operating the host system, accurately detect the bus specifications and capabilities of the PCI-E card slot to ensure the server starts up normally and facilitates adaptation according to actual conditions.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115221092B_ABST
    Figure CN115221092B_ABST
Patent Text Reader

Abstract

The application discloses a PCI-E card allocatable bus determination method and device, equipment and a storage medium, applied to a PCI-E card, and relates to the technical field of computers, and comprises the following steps: starting a server and determining the number of currently allocated bus numbers of a connected PCI-E device in a current topology state; performing enumeration on the PCI-E device through a basic input and output system, and then judging whether the enumeration of the PCI-E device is successful; if the enumeration of the PCI-E device is successful, allocating a new bus number to the PCI-E device, and jumping back to the step of starting the server and determining the number of currently allocated bus numbers of a connected PCI-E device in a current topology state until the enumeration of the PCI-E device fails, and determining the number of current bus numbers corresponding to the last successful enumeration of the PCI-E device as the number of allocatable bus numbers of the PCI-E card. Through the technical scheme, the PCI-E card can automatically detect the bus specification capability of a system, and further adaptation adjustment is facilitated.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of computer, in particular to a PCI-E card distributable bus determination method, device, equipment and storage medium. BACKGROUND

[0002] PCI Express, referred to as PCI-E, is an important branch of computer bus, and a large number of devices are accessed to the computer using PCI-E. After a single PCI-E card is accessed, it can be presented as a device, such as a single network card or a graphics card. With the development of technology, the functions on a single PCI-E physical card are gradually enriched. ASIC (Application Specific Integrated Circuit) / FPGA (Field-Programmable Gate Array) or software and hardware cooperation can be used to simulate multiple devices on the PCI-E card. The simulated devices also support on-demand addition and deletion during operation. The device type and the entire bus topology structure are relatively complex. Figure 1 As shown in the PCI-E topology architecture diagram, the architecture of the PCI-E bus can be visualized as a plurality of point-to-point interconnected components. There are roughly these components: Root Complex (RC), a plurality of Endpoint (PCI-E device), Switch (switch) and PCI-E to PCI / PCI-X Bridge, and the bus between each member is PCI Express. Figure 2 As shown in the PCI-E Switch internal structure diagram, the PCI-E devices of the entire computer are organized into a tree structure through switch expansion. As can be seen from the diagram, the switch expands the PCI-E port. Among them, the port close to the RC is called the upstream port (upstream port), and the other ports are called downstream ports (downstream port). A switch has only one upstream port and can expand several downstream ports; the downstream port can be directly connected to the Endpoint or connected to the switch to expand more PCI-E ports. That is, it is a physical network card on the surface. After being inserted into the server, the server will consider that multiple network cards are inserted into the PCI-E slot through certain configuration, just like inserting a switch into the slot, and the switch connects multiple devices or expands a level of switch. Each device has multiple functions.

[0003] After a PCI-E card simulates multiple levels of switches and complex endpoints, if the host (server) is restarted, the BIOS (Basic Input Output System) will enumerate all created endpoints and assign them buses during the restart process. Generally, an upstream switch requires one bus number, a downstream switch requires one bus number, and each downstream switch must reserve at least one bus number for the devices that will connect to it. That is, a switch with one downstream switch requires slots supporting three bus numbers, and a switch with 32 downstream switches requires slots supporting 34 bus numbers. However, for a specific server, due to hardware implementation limitations, the number of available bus numbers in a given slot is limited. When the number of bus numbers cannot meet the needs of the access cards, the BIOS may fail to boot. Therefore, to maximize the capabilities of a specific slot, it is necessary to be able to detect the range of bus numbers that the slot can support. Currently, possible solutions include determining the range by consulting the host's hardware design and software implementation, or inferring it by viewing topology information on the host system. However, there are problems such as difficulty in accessing information, the hardware design data not being readily available because the software BIOS is closed-source, and the need to operate the host system.

[0004] Therefore, how to detect the bus specification capability of the current slot from the device side without operating the host system, so as to facilitate adaptation according to the actual situation, is a problem that needs to be solved. Summary of the Invention

[0005] In view of this, the purpose of this invention is to provide a method, apparatus, device, and storage medium for determining the allocatable bus of a PCI-E card, which can detect the bus specification capability of the current slot from the device side without operating the host system, facilitating adaptation according to actual conditions. The specific solution is as follows:

[0006] In a first aspect, this application discloses a method for determining the allocatable bus of a PCI-E card, applicable to PCI-E cards, comprising:

[0007] Start the server and determine the number of currently assigned bus numbers for the PCI-E devices connected in the current topology.

[0008] The PCI-E devices are enumerated using the Basic Input / Output System (PIS), and then it is determined whether the PCI-E devices have been successfully enumerated.

[0009] If the enumeration of the PCI-E device succeeds, a new bus number is allocated to the PCI-E device, and the process of determining the number of currently allocated bus numbers of the connected PCI-E device in the current topology state is restarted until the enumeration of the PCI-E device fails, and the number of currently allocated bus numbers corresponding to the last successful enumeration of the PCI-E device is determined as the number of allocatable bus numbers of the PCI-E card.

[0010] Optionally, the determining whether the enumeration of the PCI-E device succeeds comprises:

[0011] If the current number of allocated bus numbers does not cause the server to be abnormal during the starting of the server, it is determined that the enumeration of the PCI-E device succeeds.

[0012] If the current number of allocated bus numbers causes the server to be abnormal during the starting of the server, it is determined that the enumeration of the PCI-E device fails.

[0013] Optionally, if the enumeration of the PCI-E device succeeds, the new bus number is allocated to the PCI-E device, comprising:

[0014] If the enumeration of the PCI-E device succeeds, a command for detecting the current number of allocated bus numbers in the Option ROM of the PCI-E card is executed to allocate a new bus number to the PCI-E device. Optionally, during the process of restarting the process of determining the current number of allocated bus numbers until the enumeration of the PCI-E device fails, further comprising:

[0015] The server is restarted by using the Option ROM, and the restarting of the server is completed after it is monitored that the server is started normally.

[0016] Optionally, if the enumeration of the PCI-E device succeeds, the new bus number is allocated to the PCI-E card, comprising:

[0017] If the enumeration of the PCI-E device succeeds, a signal that the enumeration of the PCI-E device succeeds is acquired from the Option ROM, and a new bus number is allocated to the PCI-E card.

[0018] Optionally, each of the PCI-E devices is allocated a bus number.

[0019] In a second aspect, the application discloses a device for determining the number of allocatable bus numbers of a PCI-E card, which is applied to the PCI-E card and comprises:

[0020] A current allocated bus number determination module is configured to start the server and determine the current allocated bus number of the connected PCI-E device in the current topology state;

[0021] A device enumeration module is configured to start the server and enumerate the connected PCI-E device in the current topology state through a basic input output system, and then determine whether the enumeration of the PCI-E device is successful;

[0022] An allocatable bus number determination module is configured to, if the enumeration of the PCI-E device is successful, allocate a new bus number for the PCI-E device, and jump back to the step of starting the server and determining the current allocated bus number of the connected PCI-E device in the current topology state until the enumeration of the PCI-E device fails, and determine the current allocated bus number corresponding to the last successful enumeration of the PCI-E device as the allocatable bus number of the PCI-E card.

[0023] Optionally, the allocatable bus number determination module is configured to, if the enumeration of the PCI-E device is successful, execute a command in the Option ROM of the PCI-E card for detecting the current allocated bus number, so as to allocate a new bus number for the PCI-E device.

[0024] In a third aspect, the present application discloses an electronic device, which comprises a processor and a memory; wherein the memory is configured to store a computer program, and the computer program is loaded and executed by the processor to implement the PCI-E card allocatable bus determination method as described above.

[0025] In a fourth aspect, the present application discloses a computer readable storage medium configured to store a computer program; wherein the computer program is executed by a processor to implement the PCI-E card allocatable bus determination method as described above.

[0026] In the application, the PCI-E card is applied to start a server and determine the current allocated bus number quantity of the connected PCI-E device in the current topology state; the basic input output system is used to enumerate the PCI-E device, and then it is judged whether the enumeration of the PCI-E device is successful; if the enumeration of the PCI-E device is successful, a new bus number is allocated to the PCI-E device, and the step of starting the server and determining the current bus number quantity of the connected PCI-E device in the current topology state is re-jumped until the enumeration of the PCI-E device fails, and the current bus number quantity corresponding to the last successful enumeration of the PCI-E device is determined as the allocatable bus number quantity of the PCI-E card. It can be seen that by changing the simulation state of the PCI-E card for many times, different quantities of bus numbers are allocated from the server, and whether the enumeration stage of the connected PCI-E device can be completed is used to identify whether the system can support the bus number specification, so that the bus number specification of the current slot can be detected from the PCI-E device side without operating the server system according to the application, and the actual situation can be adapted. On this basis, adaptive and other functions can be further developed. BRIEF DESCRIPTION OF DRAWINGS

[0027] In order to more clearly illustrate the technical solutions in the embodiments of the present application or the prior art, the drawings needed to be used in the embodiments or the prior art description will be briefly introduced. Obviously, the drawings in the following description are only embodiments of the present application, and other drawings can be obtained by those skilled in the art without creative labor on the basis of the provided drawings.

[0028] Figure 1 A PCI-E topology architecture diagram disclosed by the present application is shown in the figure;

[0029] Figure 2 A PCI-E Switch internal structure diagram disclosed by the present application is shown in the figure;

[0030] Figure 3 A bus allocation determination method flow chart of a PCI-E card disclosed by the present application is shown in the figure;

[0031] Figure 4 A specific bus allocation determination method flow chart of a PCI-E card disclosed by the present application is shown in the figure;

[0032] Figure 5 A bus allocation determination device structure diagram of a PCI-E card disclosed by the present application is shown in the figure;

[0033] Figure 6 An electronic equipment structure diagram disclosed by the present application is shown in the figure. DETAILED DESCRIPTION

[0034] The technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application. Obviously, the described embodiments are only a part of the embodiments of the present application, rather than all the embodiments of the present application. Based on the embodiments in the present application, all the other embodiments obtained by a person of ordinary skill in the art without creative work fall within the protection scope of the present application.

[0035] Currently, to exert the maximum capability of a specific slot, the bus number range that can be supported by the slot needs to be detected. Currently, the range can be obtained by referring to the hardware design and software scheme of a host, or the topology information of the host system is viewed to make an inference. However, there are problems such as that it is not easy to refer to, the hardware design data cannot be obtained because the software bios is closed source, and the host system needs to be operated.

[0036] Therefore, the present application provides a PCI-E card allocatable bus determination scheme, which can detect the bus specification capability of a current slot from a device side without operating a host system, and facilitate adaptation according to actual conditions.

[0037] The embodiment of the present application discloses a PCI-E card allocatable bus determination method, which is applied to a PCI-E card, and refers to Figure 3 The method comprises the following steps:

[0038] Step S11: starting a server and determining the number of currently allocated bus numbers of a connected PCI-E device in a current topology state.

[0039] In the embodiment of the present application, in order to detect the bus number capability that can be provided by a system, the simulation state of a PCI-E card is changed multiple times, that is, an initial bus number is first specified, and the bus number is taken as a current allocated bus number. The current allocated bus number corresponds to a simulated topology state, and the topology state indicates that a complete enumeration needs to obtain the current allocated bus number from a server.

[0040] Step S12: performing enumeration on the PCI-E device by a basic input output system, and then judging whether the enumeration of the PCI-E device is successful.

[0041] In the embodiment of the present application, the server is started, and after the basic input / output system enumeration stage, whether the system supports the bus number specification is identified according to whether the enumeration stage can be completed. It can be understood that for a specific server, due to hardware implementation limitations, the number of available bus numbers of a certain slot is limited, and when the number of bus numbers cannot meet the demand of the access card, it can cause the basic input / output system to fail to start. That is, when the number of bus numbers exceeds the system support range, it will be stuck or fall into a loop restart and other abnormalities. Therefore, the judgment of whether the PCI-E device is enumerated successfully includes: if the current number of allocated bus numbers does not cause the server to appear abnormal during the process of starting the server, it is determined that the PCI-E device is enumerated successfully; if the current number of allocated bus numbers causes the server to appear abnormal during the process of starting the server, it is determined that the PCI-E device is enumerated unsuccessfully.

[0042] It should be noted that in the embodiment of the present application, each of the PCI-E devices is allocated a bus number, so that when the PCI-E device is enumerated, only the last enumeration successful bus number read from the PCI-E card is the bus number specification capability of the system.

[0043] Step S13: If the PCI-E device is enumerated successfully, a new bus number is allocated to the PCI-E device, and the step of starting the server and determining the current number of bus numbers allocated to the connected PCI-E device in the current topology state is re-jumped until the PCI-E device is enumerated unsuccessfully, and the current number of bus numbers corresponding to the last enumeration success is determined as the allocatable bus number quantity of the PCI-E card.

[0044] In the embodiment of the present application, if the PCI-E device can be enumerated successfully under the current number of allocated bus numbers, it means that the current number of allocated bus numbers is effective under the current simulation state and does not exceed the bus number specification capability of the system. At this time, a new bus number is allocated to the PCI-E device, the number of bus numbers to be simulated next time is set, and then the server is restarted and enumeration is performed again until the PCI-E device is enumerated unsuccessfully. The current number of allocated bus numbers corresponding to the last enumeration success is the allocatable bus number quantity of the PCI-E card.

[0045] It can be understood that when a new bus number is allocated to the PCI-E device, the number of bus numbers can be changed by increasing or decreasing, for example, the number of bus numbers is increased from small to large. If the current number of allocated bus numbers is n, the number of bus numbers to be allocated next time can be simulated as n+1 when a new bus number is allocated. If the number of bus numbers is changed from large to small or other order, as long as it converges to a value, the purpose can also be achieved.

[0046] In the application, the PCI-E card is applied to start a server and determine the current allocated bus number quantity of the connected PCI-E device in the current topology state; the basic input and output system is used to enumerate the PCI-E device, and then it is judged whether the enumeration of the PCI-E device is successful; if the enumeration of the PCI-E device is successful, a new bus number is allocated to the PCI-E device, and the step of starting the server and determining the current bus number quantity of the connected PCI-E device in the current topology state is re-jumped until the enumeration of the PCI-E device fails, and the current bus number quantity corresponding to the last successful enumeration of the PCI-E device is determined as the allocatable bus number quantity of the PCI-E card. It can be seen that by changing the simulation state of the PCI-E card for multiple times, different quantities of bus numbers are allocated from the server, and whether the enumeration stage of the connected PCI-E device can be completed is used to identify whether the system can support the bus number specification, so that the bus number specification of the current slot can be detected from the PCI-E device side without operating the server system according to the application, and the actual situation is adapted. On this basis, adaptive and other functions can be further developed.

[0047] The embodiment of the application discloses a specific bus determination method of a PCI-E card, which is applied to a PCI-E card, as shown in the figure, Figure 4 The method comprises the following steps:

[0048] Step S21: starting a server and determining the current allocated bus number quantity of the connected PCI-E device in the current topology state.

[0049] Step S22: the basic input and output system is used to enumerate the PCI-E device, and then it is judged whether the enumeration of the PCI-E device is successful.

[0050] The more specific processing process of the above steps S21 and S22 can be referred to the corresponding content disclosed in the foregoing embodiment, and will not be repeated here.

[0051] Step S23: if the enumeration of the PCI-E device is successful, the command for detecting the current allocated bus number quantity in the Option ROM of the PCI-E card is executed, so as to allocate a new bus number to the PCI-E device, and the step of starting the server and determining the current bus number quantity of the connected PCI-E device in the current topology state is re-jumped until the enumeration of the PCI-E device fails, and the current bus number quantity corresponding to the last successful enumeration of the PCI-E device is determined as the allocatable bus number quantity of the PCI-E card.

[0052] In the embodiment of the present application, if the enumeration of the PCI-E device is successful, it indicates that the number of the currently allocated bus numbers is valid in the current simulation state, and then the command in the Option ROM of the PCI-E card for detecting the number of the currently allocated bus numbers is further executed. That is, the enumeration of the PCI-E card is successful as informed by the Option ROM, and thus the signal of the enumeration of the PCI-E device sent by the Option ROM is acquired. If the signal of the enumeration of the PCI-E device sent by the Option ROM is acquired, it indicates that the simulation topology state of the current device is normal, and the bus numbers consumed by the current simulation topology state are within the allowable range of the server slot, and then a new bus number is allocated for the PCI-E device.

[0053] In the embodiment of the present application, after the new bus number is allocated for the PCI-E device, the Option ROM informs the device to generate a new simulation topology state, and prepares to continue detecting the number of bus numbers in the next simulation topology state, and then the server is restarted by using the Option ROM, and the restart of the server is completed after the server is normally started. It can be understood that if the Option ROM is not used, the server can also be restarted by using other modes including manual control, and the restart is completed after the server is normally started.

[0054] In addition, in the embodiment of the present application, the enumeration of the PCI-E card is successful as informed by the Option ROM, and the range of the bus numbers is valid. If the PCI-E is not used, the enumeration can also be informed by other modes including manual command sending, and can also be automatically judged by the transmission of the PCI-E packet (such as a network card) detected by the enumeration of the PCI-E card. This is not specifically limited here.

[0055] In the application, the PCI-E card is applied, a server is started and a current allocated bus number quantity of a connected PCI-E device in a current topology state is determined; the PCI-E device is enumerated through a basic input output system, and then it is judged whether the enumeration of the PCI-E device is successful; if the enumeration of the PCI-E device is successful, a command for detecting the current allocated bus number quantity in the Option ROM of the PCI-E card is executed, so as to allocate a new bus number for the PCI-E device, and the step of starting the server and determining the current bus number quantity allocated by the connected PCI-E device in the current topology state is jumped to again until the enumeration of the PCI-E device fails, and the current bus number quantity corresponding to the last time when the enumeration of the PCI-E device is successful is determined as the allocatable bus number quantity of the PCI-E card. It can be seen that by changing the simulation state of the PCI-E card for many times, different quantities of bus numbers are allocated from the server, and whether the enumeration stage of the connected PCI-E device can be completed is used to identify whether the system can support the bus number specification, so that the bus number specification of the current slot can be detected from the PCI-E device side without operating the server system according to the application, and the actual situation is adapted. On this basis, adaptive and other functions can be further developed.

[0056] Correspondingly, the application further discloses a bus determination device for a PCI-E card, as shown in Figure 5 The device comprises:

[0057] A current allocated bus number quantity determination module 11 is configured to start a server and determine a current allocated bus number quantity of a connected PCI-E device in a current topology state.

[0058] A device enumeration module 12 is configured to enumerate the PCI-E device through a basic input output system, and then judge whether the enumeration of the PCI-E device is successful.

[0059] An allocatable bus number determination module 13 is configured to allocate a new bus number for the PCI-E device if the enumeration of the PCI-E device is successful, and jump to the step of starting the server and determining the current bus number quantity allocated by the connected PCI-E device in the current topology state again until the enumeration of the PCI-E device fails, and determine the current allocated bus number quantity corresponding to the last time when the enumeration of the PCI-E device is successful as the allocatable bus number quantity of the PCI-E card.

[0060] The working processes of the above modules are more specifically described in the foregoing embodiments, and will not be repeated here.

[0061] It can be seen that by the above scheme of the embodiment, the PCI-E card is applied, the server is started, and the current allocated bus number quantity of the connected PCI-E device in the current topology state is determined; the PCI-E device is enumerated by the basic input and output system, and then it is judged whether the enumeration of the PCI-E device is successful; if the enumeration of the PCI-E device is successful, a new bus number is allocated to the PCI-E device, and the step of starting the server and determining the current bus number quantity allocated to the connected PCI-E device in the current topology state is re-jumped until the enumeration of the PCI-E device fails, and the current bus number quantity corresponding to the last time when the enumeration of the PCI-E device is successful is determined as the allocatable bus number quantity of the PCI-E card. It can be seen that by changing the simulation state of the PCI-E card for multiple times, different quantities of bus numbers are allocated from the server, and whether the enumeration phase of the connected PCI-E device can be completed is used to identify whether the system can support the bus number specification, so that the bus number specification of the current slot is detected from the PCI-E device side without operating the server system, and the actual situation is adapted. On this basis, adaptive and other functions can be further developed.

[0062] In a specific embodiment, the device enumeration module 12 comprises:

[0063] The enumeration success determination module is used for determining that the enumeration of the PCI-E device is successful if the current allocated bus number quantity does not cause the server to be abnormal during the starting process of the server.

[0064] The enumeration failure determination module is used for determining that the enumeration of the PCI-E device fails if the current allocated bus number quantity causes the server to be abnormal during the starting process of the server.

[0065] In a specific embodiment, the allocatable bus number determination module 13 comprises:

[0066] The Option ROM command execution module is used for executing a command in the Option ROM of the PCI-E card for detecting the current allocated bus number quantity to allocate a new bus number to the PCI-E device if the enumeration of the PCI-E device is successful.

[0067] In a specific embodiment, the allocatable bus number determination module 13 further comprises:

[0068] The server restart unit is used for restarting the server by using the Option ROM, and completing the restart of the server after it is monitored that the server is normally started.

[0069] In a specific embodiment, the assignable bus number determination module 13 comprises:

[0070] The assignable bus number determination unit is configured to, if the PCI-E device enumeration succeeds, acquire the signal of the PCI-E device enumeration success sent by the Option ROM, and assign a new bus number to the PCI-E card.

[0071] Further, the embodiment of the present application further discloses an electronic device, Figure 6 is an electronic device 20 structure diagram according to an exemplary embodiment, the contents in the figure cannot be considered as any limitation to the use range of the present application.

[0072] Figure 6 An electronic device 20 structure diagram is provided in the embodiment of the present application. The electronic device 20 specifically can comprise 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 is configured to store a computer program, the computer program is loaded and executed by the processor 21 to realize the related steps in the PCI-E card assignable bus determination method disclosed in any of the preceding embodiments. In addition, the electronic device 20 in the embodiment can be a computer.

[0073] In the embodiment, the power supply 23 is configured to provide working 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 the external device, and the communication protocol followed by the communication interface 24 can be any communication protocol applicable to the technical solution of the present application, which is not limited here; the input / output interface 25 is configured to acquire external input data or output data to the outside, and the specific interface type can be selected according to the specific application needs, which is not limited here.

[0074] In addition, the memory 22 as a resource storage carrier can be a read-only memory, a random access memory, a magnetic disk or an optical disk, etc., and the resources stored thereon can include an operating system 221, a computer program 222 and data 223, etc., and the data 223 can include various data. The storage mode can be temporary storage or permanent storage.

[0075] The operating system 221 is configured to manage and control each hardware device on the electronic device 20 and the computer program 222, and can be Windows Server, Netware, Unix, Linux, etc. In addition to the computer program capable of completing the PCI-E card assignable bus determination method executed by the electronic device 20 disclosed in any of the preceding embodiments, the computer program 222 can further include a computer program capable of completing other specific work.

[0076] Further, the embodiments of the present application also disclose a computer readable storage medium, which comprises a random access memory (RAM), a memory, a read-only memory (ROM), an electrically programmable ROM, an electrically erasable programmable ROM, a register, a hard disk, a magnetic or optical disk or any other form of storage medium known in the technical field. The computer program is executed by a processor to implement the method for determining the bus to which the PCI-E card can be allocated. The specific steps of the method can refer to the corresponding content disclosed in the foregoing embodiments, and will not be described here again.

[0077] The embodiments described in the specification are progressive, and each embodiment focuses on the difference from other embodiments. The same or similar parts between the embodiments can be referred to each other. For the device disclosed in the embodiments, the description is relatively simple because the device corresponds to the method disclosed in the embodiments. The relevant parts can refer to the description of the method.

[0078] The steps of the method for determining the bus to which the PCI-E card can be allocated or the algorithm described in combination with the embodiments disclosed in the specification can be implemented directly by hardware, a software module executed by a processor or a combination of the two. The software module can be placed in a random access memory (RAM), a memory, a read-only memory (ROM), an electrically programmable ROM, an electrically erasable programmable ROM, a register, a hard disk, a removable magnetic disk, a CD-ROM or any other form of storage medium known in the technical field.

[0079] Finally, it should be noted that, in the present text, the relationship terms such as first and second are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between the entities or operations. Moreover, the terms "include", "contain" or any other variant thereof are intended to cover non-exclusive inclusion, so that the process, method, article or device including a series of elements not only includes those elements, but also includes other elements not explicitly listed or inherent to such process, method, article or device. Without more limitations, the element defined by the statement "including a" does not exclude the presence of another identical element in the process, method, article or device including the element.

[0080] The above describes in detail the bus determination method, device, equipment and storage medium provided by the PCI-E card in the application, and the principle and implementation manner of the application are described by using specific examples. The above description of the embodiments is only used to help understand the method of the application and its core idea. Meanwhile, for those skilled in the art, according to the idea of the application, the specific implementation manner and application range can be changed, and the above description should not be understood as a limitation on the application.

Claims

1. A method for determining the bus to which a PCI-E card can be assigned, characterized in that, The application is applied to a PCI-E card, comprising: starting a server and determining a current allocated bus number of a connected PCI-E device in a current topology state; enumerating the PCI-E device through a basic input output system, and then judging whether the PCI-E device is enumerated successfully; wherein if the current allocated bus number does not cause the server to be abnormal in the process of starting the server, it is determined that the PCI-E device is enumerated successfully; if the current allocated bus number causes the server to be abnormal in the process of starting the server, it is determined that the PCI-E device is enumerated unsuccessfully; if the PCI-E device is enumerated successfully, a new bus number is allocated to the PCI-E device, and the step of starting the server and determining the current bus number of the connected PCI-E device in the current topology state is re-jumped until the PCI-E device is enumerated unsuccessfully, and the current bus number corresponding to the last time when the PCI-E device is enumerated successfully is determined as the allocatable bus number of the PCI-E card; wherein if the PCI-E device is enumerated successfully, a command for detecting the current allocated bus number in the Option ROM of the PCI-E card is executed to allocate a new bus number to the PCI-E device; in the process of re-jumping to the step of determining the current allocated bus number until the PCI-E device is enumerated unsuccessfully, further comprising: restarting the server by using the Option ROM, and completing the restart of the server after monitoring that the server is started normally.

2. The method of claim 1, wherein the number of the bus is determined by the following equation: bus = (PCIe card number) mod (bus number of the PCIe card) + 1. Each of the PCI-E devices is allocated a bus number.

3. The PCI-E card allocatable bus determination method of claim 1 or 2, wherein, if the PCI-E device is enumerated successfully, a new bus number is allocated to the PCI-E card by a preset allocation method; wherein the preset allocation method is to change the number of the bus number by increasing or decreasing. The application is applied to a PCI-E card, comprising:

4. A PCI-E card allocatable bus determination apparatus characterized by comprising: a current allocated bus number determining module, configured to start a server and determine a current allocated bus number of a connected PCI-E device in a current topology state; a device enumeration module, configured to enumerate the PCI-E device through a basic input output system, and then judge whether the PCI-E device is enumerated successfully; wherein if the current allocated bus number does not cause the server to be abnormal in the process of starting the server, it is determined that the PCI-E device is enumerated successfully; if the current allocated bus number causes the server to be abnormal in the process of starting the server, it is determined that the PCI-E device is enumerated unsuccessfully; ​ The assignable bus number determination module is configured to, if the enumeration of the PCI-E device is successful, assign a new bus number to the PCI-E device, and jump back to the step of determining the number of currently-assigned bus numbers of the connected PCI-E devices in the current topology state until the enumeration of the PCI-E device fails, and determine the number of currently-assigned bus numbers corresponding to the last successful enumeration of the PCI-E device as the number of assignable bus numbers of the PCI-E card. The assignable bus number determination module is configured to, if the enumeration of the PCI-E device is successful, execute a command in the Option ROM of the PCI-E card for detecting the number of currently-assigned bus numbers, so as to assign a new bus number to the PCI-E device. The method further comprises restarting the server by using the Option ROM, and completing the restarting of the server after monitoring that the server is normally started.

5. An electronic device, comprising: The electronic device comprises a processor and a memory; wherein the memory is configured to store a computer program, and the computer program is loaded and executed by the processor to implement the method for determining the assignable bus numbers of the PCI-E card according to any one of claims 1 to 3.

6. A computer-readable storage medium, characterized in that, The computer program is stored in the memory and is executed by the processor to implement the method for determining the assignable bus numbers of the PCI-E card according to any one of claims 1 to 3.

Citation Information

Patent Citations

  • Method for PCIE (Peripheral Component Interface Express) virtualized management

    CN103778018A

  • PCIE (peripheral component interface express) device dynamic scanning method supporting multi RC (remote control) in Linux system

    CN104820646A