Device starting method and apparatus, and device, storage medium and computer program product
By obtaining the startup status of the hardware device, especially the state of the self-start device, in the BIOS stage, the problem of increasing startup time caused by the connection of multiple hardware devices of computer devices is solved, and faster operating system startup is achieved.
Patent Information
- Application Number
- PCT/CN2024/121670
- Authority / Receiving Office
- WO · WO
- Patent Type
- Applications
- Current Assignee / Owner
- Priority Date
- 2024-02-22
- Filing Date
- 2024-09-27
- Publication Date
- 2025-08-28
AI Technical Summary
When computer equipment is connected to multiple hardware devices, the operating system startup time increases linearly, seriously affecting the system startup performance.
In the BIOS stage, the startup status of the hardware device is obtained through device enumeration, and the state is obtained only for the self-start device without storing and running the device driver. The non-self-start device is still initialized in the traditional way.
It reduces the device initialization time in the BIOS stage, shortens the operating system startup time, and improves the system startup performance.
Smart Images

Figure CN2024121670_28082025_PF_FP_ABST
Abstract
Description
Device startup method, apparatus, device, storage medium, and computer program product
[0001] This application claims priority to Chinese patent application number 202410201478.4, filed on February 22, 2024, entitled “Device startup method, apparatus, device, storage medium and computer program product”, the entire contents of which are incorporated by reference into this application. Technical Field
[0002] The present application relates to the field of computer technology, and in particular to a device startup method, apparatus, device, storage medium, and computer program product. Background Art
[0003] Computer devices typically require a variety of capabilities, such as storage, communication, and display capabilities. These capabilities are often provided by hardware devices connected to the computer device, such as storage devices, network devices, and display devices. As operating systems become more complex, the types of hardware devices connected to computer devices are also increasing, and the number of hardware devices connected to operating systems is also increasing. For hardware devices, they must be connected to the operating system and complete functional initialization before they can display their corresponding functions.
[0004] In the related art, computer devices usually use a hardware device and device driver model to serially start multiple hardware devices. The device drivers of these multiple hardware devices are stored in the local firmware of the computer device, that is, the basic input and output system (BIOS). Specifically, after the computer device is powered on, the processor first runs the BIOS, and the BIOS scans the bus to enumerate and discover the multiple hardware devices connected to the computer device. During the above device enumeration process, each time the BIOS enumerates and discovers a hardware device, it runs the device driver of the hardware device to initialize the hardware device and allocates corresponding system resources to the hardware device in the computer device to ensure that the hardware device can operate normally. Similarly, after the BIOS serially loads and runs the device drivers of all hardware devices, the BIOS loads the boot loader of the operating system to start the operating system.
[0005] However, in the above device startup mode, as the number of hardware devices connected to the computer device increases, the operating system startup time will also increase linearly, seriously affecting the system startup performance of the computer device.
[0006] Summary of the Invention
[0007] The present application provides a device startup method, apparatus, device, storage medium, and computer program product, which can reduce the startup time of the operating system of a computer device. The technical solution is as follows.
[0008] In a first aspect, a device startup method is provided, the method comprising:
[0009] After the computer device is powered on, the basic input and output system BIOS is run; device enumeration is performed through the BIOS to determine the hardware devices connected to the computer device, and the hardware devices include devices that can run device drivers to achieve self-starting; each time a hardware device is enumerated, the startup status of the hardware device is obtained; when the startup status of all hardware devices connected to the computer device is obtained and at least one hardware device among all the hardware devices is in normal operating state, the operating system of the computer device is run.
[0010] As can be seen from this, after a computer device is powered on, it runs the BIOS and uses the BIOS to perform device enumeration to determine the hardware devices connected to the computer device. If the hardware device is capable of self-booting, the computer device can directly obtain the hardware device's boot status without having to store and run the device driver for the hardware device. This reduces the time it takes for the BIOS to boot the operating system, as long as at least one of the hardware devices connected to the computer device is capable of self-booting.
[0011] In one possible implementation, obtaining the startup status of the hardware device includes: if the hardware device is a device that can run a device driver to achieve self-startup, calling the status query interface of the hardware device; sending a query request to the hardware device through the status query interface, the query request is used to query the startup status of the hardware device; receiving a query response sent by the hardware device, the query response carrying the startup status of the hardware device.
[0012] In other words, the hardware devices connected to a computer may include devices that can run device drivers to enable self-start, as well as non-self-starting devices. For non-self-starting hardware devices, the BIOS continues to initialize them by serially running the corresponding device drivers after enumerating them. For self-starting hardware devices, the BIOS does not need to store and run the corresponding device drivers; it only needs to communicate with the hardware device to obtain its startup status, thus reducing the time spent on hardware device initialization during the BIOS phase.
[0013] In one possible implementation, the startup state of the hardware device includes any one of a first state, a second state, a third state, and a fourth state; the first state indicates that the BIOS can discover the hardware device through device enumeration; the second state indicates that the computer device is supported to configure the hardware device based on the first state; the third state indicates that the hardware device is in a normal operating state based on the second state; and the fourth state indicates that there is an abnormality in the hardware device based on the first state.
[0014] That is, when the startup state of the hardware device is the first state, the BIOS can discover the hardware device through device enumeration and send a status query request to it; when the startup state of the hardware device is the second state, the BIOS can obtain the resource requirements of the hardware device and allocate corresponding resources to it based on the resource requirements; when the startup state of the hardware device is the third state, the BIOS does not need to process the hardware device, and after starting the operating system, it can transfer the relevant information and control rights of the hardware device to the operating system; when the startup state of the hardware device is the fourth state, the hardware device can communicate with the computer device, but the functions of the hardware device cannot be used normally.
[0015] In a possible implementation, after obtaining the startup status of the hardware device, the method further includes: performing device initialization processing on the hardware device based on the startup status of the hardware device.
[0016] That is, in the BIOS stage, for a hardware device discovered through enumeration, if the hardware device is a self-starting device, the computer device can call the status query interface of the hardware device to obtain the startup status of the hardware device, and perform differentiated management of the hardware device based on the startup status of the hardware device.
[0017] In a possible implementation, the method further includes: acquiring a startup status of the hardware device every other cycle; and performing device initialization processing on the hardware device based on the startup status of the hardware device.
[0018] In a possible implementation, the performing device initialization processing on the hardware device based on the startup state of the hardware device includes: if the startup state of the hardware device is the second state, allocating resources to the hardware device according to the device resource requirements of the hardware device.
[0019] In one possible implementation, the method further includes: storing the startup status of the hardware device; before obtaining the startup status of the hardware device every other cycle, the method further includes: if the currently stored startup status of the hardware device is not the third state, executing the step of obtaining the startup status of the hardware device every other cycle.
[0020] In a possible implementation, after obtaining the startup status of the hardware device every other period, the method further includes: updating the currently stored startup status of the hardware device.
[0021] Thus, after the computer device is powered on and started, for the hardware devices discovered by device enumeration, the present application can periodically obtain the startup status of each hardware device after obtaining the startup status of each hardware device, and store and update the startup status of the hardware device. In this way, during the operation of the operating system, based on the stored startup status of the hardware devices, the hardware devices that can be normally used on the computer device can be determined, and the functional interfaces of the normally used hardware devices can be called to perform related operations.
[0022] In a second aspect, a device startup apparatus is provided, which has the function of implementing the device startup method described in the first aspect. The device startup apparatus includes at least one module, which is used to implement the device startup method described in the first aspect.
[0023] In a third aspect, a computer device is provided, comprising a processor and a memory, wherein the memory is configured to store a computer program for executing the device startup method provided in the first aspect. The processor is configured to execute the computer program stored in the memory to implement the steps of the device startup method described in the first aspect.
[0024] In a possible implementation, the computer device may further include a communication bus, which is used to establish a connection between the processor and the memory.
[0025] In a fourth aspect, a computer-readable storage medium is provided, wherein the storage medium stores instructions. When the instructions are executed on a computer device, the computer device executes the steps of the device startup method described in the first aspect.
[0026] In a fifth aspect, a computer program product comprising instructions is provided. When the instructions are executed on a computer device, the computer device executes the steps of the device startup method described in the first aspect. Alternatively, a computer program is provided. When the computer program is executed on a computer device, the computer device executes the steps of the device startup method described in the first aspect.
[0027] The technical effects obtained in the above-mentioned second, third, fourth and fifth aspects are similar to those obtained by the corresponding technical means in the first aspect, and will not be repeated here. BRIEF DESCRIPTION OF THE DRAWINGS
[0028] FIG1 is a schematic diagram of a computer device serial boot hardware device provided in an embodiment of the present application;
[0029] FIG2 is a schematic diagram of the structure of a computer device provided in an embodiment of the present application;
[0030] FIG3 is a flow chart of a device startup method provided in an embodiment of the present application;
[0031] FIG4 is a schematic diagram of a device startup state provided in an embodiment of the present application;
[0032] FIG5 is a logical diagram of a computer device starting multiple hardware devices provided by an embodiment of the present application;
[0033] FIG6 is a schematic diagram of a process of starting multiple hardware devices by a computer device according to an embodiment of the present application;
[0034] FIG7 is a schematic structural diagram of a device starting apparatus provided in an embodiment of the present application. DETAILED DESCRIPTION
[0035] In order to make the objectives, technical solutions and advantages of the embodiments of the present application clearer, the implementation methods of the present application will be further described in detail below with reference to the accompanying drawings.
[0036] For ease of understanding, before explaining in detail the device startup method provided in the embodiment of the present application, the application scenarios and implementation environment involved in the embodiment of the present application are first introduced.
[0037] First, the application scenarios of the embodiments of the present application are introduced.
[0038] Computer devices typically require a variety of capabilities, such as storage, communication, and display capabilities. These capabilities are often provided by hardware devices connected to the computer device, such as storage devices, network devices, and display devices. As operating systems become more complex, the types of hardware devices connected to computer devices are also increasing, and the number of hardware devices connected to operating systems is also increasing. For hardware devices, they must be connected to the operating system and complete functional initialization before they can display their corresponding functions.
[0039] In practical applications, hardware devices are usually connected to computer devices through hardware integration, high-speed peripheral component interconnect express (PCIe), universal serial bus (USB), etc. However, no matter which method is used to connect to the computer device, the computer device usually uses the hardware device and device driver mode to serially start multiple hardware devices.
[0040] Referring to Figure 1, for multiple hardware devices connected to a computer device, such as hardware device A, hardware device B, hardware device C, and hardware device D, the computer device will store the device drivers corresponding to the multiple hardware devices, namely, device driver A, device driver B, device driver C, and device driver D. After the computer device is powered on, the processor first runs the basic input and output system (BIOS), and scans the bus through the BIOS to enumerate and discover the multiple hardware devices connected to the computer device. During the above device enumeration process, each time the BIOS enumerates and discovers a hardware device, it runs the device driver of the hardware device to initialize the hardware device and allocates corresponding system resources to the hardware device in the computer device to ensure that the hardware device can work normally. Similarly, when the BIOS serially loads and runs the device drivers of all hardware devices, and at least one of the hardware devices discovered by the device enumeration can be started normally, the BIOS loads the boot loader of the operating system to start the operating system (OS).
[0041] Among them, the above-mentioned hardware devices include but are not limited to graphics cards, network cards, solid-state drives, etc., and the embodiments of this application do not impose any restrictions on this.
[0042] In the above device startup mode, as the number of hardware devices connected to the computer device increases, the operating system startup time will also increase linearly, seriously affecting the system startup performance of the computer device.
[0043] Hardware devices that use the PCIe bus to connect to computer devices are also referred to as PCIe devices. Some PCIe devices support optional read-only memory (option ROM), meaning that the local ROM space of the PCIe device can store the device driver that runs the PCIe device during the BIOS phase. When the PCIe device is connected to a computer device, and the computer device's processor runs the BIOS enumeration to discover the PCIe device, the BIOS can read and run the device driver from the local ROM space of the PCIe device.
[0044] That is, because the BIOS and operating system have different control and management requirements for hardware devices, PCIe devices usually run different device drivers in the BIOS stage and the OS stage respectively. By loading a simplified firmware driver in the BIOS stage, the BIOS performs basic initialization work on the PCIe device; and by loading a more complete device driver in the OS stage, the operating system can fully control and manage the hardware devices and provide richer functions and services.
[0045] Among them, in the BIOS stage, the computer device needs to initialize the hardware device and allocate the necessary resources to it to ensure the normal operation of the hardware device. At this stage, the BIOS will load and run a simplified device driver, also known as the BIOS device driver or firmware device driver. This device driver is mainly used to initialize the device and provide basic functions, such as starting, stopping, reading and writing bytes, etc. By running this device driver, the BIOS can perform basic configuration and control of the hardware device to ensure that the operating system of the computer device can start and run normally. In the OS stage, the computer device needs to more comprehensively control and manage the hardware device and provide richer and more complex functions. Therefore, the operating system of the computer device needs to load a more complete device driver, also known as the OS device driver. The OS device driver provides a higher level of interaction and control capabilities with the hardware device, such as device read and write operations, interrupt processing, task scheduling, etc. By running this OS device driver, the operating system can fully utilize the performance and functions of the hardware device and provide better application interfaces and services.
[0046] It can be seen from this that although PCIe devices can locally store BIOS device drivers, reducing the number of device drivers stored in computer devices, for each PCIe device, during the entire computer device's operating system startup process, different device drivers need to be run separately in the BIOS stage and the OS stage to use the device functions of the PCIe device normally, which is inefficient.
[0047] Furthermore, because different architectures and central processing units (CPUs) have different instruction sets, architectural features, and performance characteristics, these differences can lead to differences in device driver implementation. To ensure that PCIe devices function properly across a variety of architectures and CPUs, device manufacturers typically develop customized device drivers for different target platforms. These drivers are optimized and tuned based on the characteristics and requirements of the target platforms to achieve optimal performance and compatibility. This means that a single PCIe device may require the development of multiple sets of device drivers to meet the needs of different scenarios, placing high demands on device development.
[0048] In addition, since computer devices use a serial boot method and run the device drivers corresponding to the hardware devices discovered by enumeration in sequence, for computer devices, it is necessary to require each hardware device to be ready within the moving time so that the BIOS can promptly discover the hardware device when scanning the bus. That is, the hardware device is required to be ready before the BIOS performs device enumeration, otherwise the enumeration window will be missed, resulting in device loss.
[0049] For PCIe devices, the PCIe protocol defines the startup timing requirements for PCIe devices, which require that PCIe devices can be discovered 20ms after PERST (a reset signal, usually indicating that the device is being reset or awakened) is pulled high, and can complete link establishment within 100ms, that is, establish a normal communication connection with the computer device.
[0050] It can be seen that since computer devices use a serial startup method to run the device drivers corresponding to the enumerated hardware devices in sequence, there are certain requirements for the startup time of each hardware device, which limits the implementation of the hardware devices and increases the difficulty of implementing the hardware devices.
[0051] Based on this, an embodiment of the present application provides a device startup method. When a self-starting hardware device is connected to a computer device, the computer device does not need to store and run the device driver for the hardware device. Instead, it only needs to obtain the startup status of the hardware device during the BIOS phase. In other words, since the BIOS does not need to store and run the device driver for the self-starting hardware device connected to the computer device, the number of device drivers and the time consumed by the BIOS to run are reduced, significantly shortening the startup time of the computer device's operating system, thereby improving the startup performance of the operating system.
[0052] Next, the implementation environment of the embodiments of the present application is introduced.
[0053] Please refer to Figure 2, which is a schematic diagram of the structure of a computer device according to an embodiment of the present application. The computer device may be the computer device shown in Figure 1. The computer device includes at least one processor 201, a communication bus 202, a memory 203, and at least one communication interface 204.
[0054] The processor 201 may be a general-purpose central processing unit (CPU), a network processor (NP), a microprocessor, or one or more integrated circuits for implementing the solution of the present application, such as an application-specific integrated circuit (ASIC), a programmable logic device (PLD), or a combination thereof. The PLD may be a complex programmable logic device (CPLD), a field-programmable gate array (FPGA), a generic array logic (GAL), or any combination thereof.
[0055] Communication bus 202 is used to transmit information between the above components. Communication bus 202 can be divided into address bus, data bus, control bus, etc. For ease of illustration, only one thick line is used in Figure 2, but this does not mean that there is only one bus or one type of bus.
[0056] The memory 203 may be a read-only memory (ROM), a random access memory (RAM), an electrically erasable programmable read-only memory (EEPROM), an optical disc (including a compact disc read-only memory (CD-ROM), a compact disc, a laser disc, a digital versatile disc, a Blu-ray disc, etc.), a magnetic disk storage medium or other magnetic storage device, or any other medium that can be used to carry or store desired program code in the form of instructions or data structures and can be accessed by a computer, but is not limited thereto. The memory 203 may exist independently and be connected to the processor 201 via the communication bus 202. The memory 203 may also be integrated with the processor 201.
[0057] The communication interface 204 uses any device, such as a transceiver, for communicating with other devices or communication networks. The communication interface 204 includes a wired communication interface and may also include a wireless communication interface. For example, the wired communication interface may be an Ethernet interface. The Ethernet interface may be an optical interface, an electrical interface, or a combination thereof. The wireless communication interface may be a wireless local area network (WLAN) interface, a cellular network communication interface, or a combination thereof.
[0058] As an example, the processor 201 may include one or more CPUs, such as CPU0 and CPU1 shown in FIG. 2 .
[0059] As an example, a computer device may include multiple processors, such as processor 201 and processor 205 shown in FIG2 . Each of these processors may be a single-core processor or a multi-core processor. A processor herein may refer to one or more devices, circuits, and / or processing cores for processing data (e.g., computer program instructions).
[0060] In some embodiments, the computer device may further include an output device 206 and an input device 207. The output device 206 communicates with the processor 201 and can display information in a variety of ways. For example, the output device 206 can be a liquid crystal display (LCD), a light emitting diode (LED) display device, a cathode ray tube (CRT) display device, or a projector. The input device 207 communicates with the processor 201 and can receive user input in a variety of ways. For example, the input device 207 can be a mouse, a keyboard, a touch screen device, or a sensor device.
[0061] In some embodiments, the memory 203 is used to store program code 210 for executing the solution of the present application, and the processor 201 can execute the program code 210 stored in the memory 203. The program code 210 may include one or more software modules, and the computer device can implement the device startup method provided in the embodiment of Figure 3 below through the processor 201 and the program code 210 in the memory 203.
[0062] FIG3 is a flow chart of a device startup method provided in an embodiment of the present application, which is applied to the above-mentioned computer device. Referring to FIG3 , the method includes the following steps.
[0063] Step 301: After the computer device is powered on, the basic input and output system BIOS is run.
[0064] The BIOS is the first firmware program that runs after a computer is powered on. It is responsible for initializing hardware devices and loading the operating system. When the BIOS runs, it enumerates the hardware devices connected to the computer, identifying and listing the various hardware devices (or components) in the computer, such as memory, hard drives, graphics cards, network cards, and sound cards.
[0065] Step 302: Perform device enumeration through BIOS to determine hardware devices connected to the computer device, where the hardware devices include devices capable of running device drivers to achieve self-start.
[0066] During device enumeration, the BIOS may find devices missing. This means that if the BIOS fails to find one or more hardware devices connected to the computer device while scanning the bus, the hardware device is considered lost during the device enumeration process. Therefore, the hardware devices connected to the computer device that the BIOS discovers through enumeration in step 302 may be all or part of the hardware devices actually connected to the computer device. This embodiment of the present application does not limit the number of hardware devices discovered through enumeration.
[0067] Device enumeration is an important process in computer systems. It involves reading various descriptor information from hardware devices connected to the computer device so that the computer device can identify, manage, and communicate with the hardware devices. This process usually occurs during the computer device startup phase, with the BIOS performing device enumeration to identify and manage hardware devices and pass relevant information about the hardware devices to the operating system; or, after the hardware devices are connected to the operating system, the operating system performs device enumeration and runs the complete device driver of the hardware devices to comprehensively and effectively manage the hardware devices.
[0068] In some embodiments, the process of device enumeration by BIOS may include the following steps (1)-(5).
[0069] (1) Detection and identification
[0070] The BIOS scans the bus to detect all hardware devices connected to the computer device bus and identifies the types and characteristics of these hardware devices. For example, the types and characteristics of the hardware devices are usually identified by reading the hardware addresses, configuration information and other identifiers of the hardware devices.
[0071] (2) Read descriptor
[0072] The BIOS reads a data structure called a "descriptor" from the discovered hardware device. The descriptor contains important information about the hardware device, such as the name, function, resource requirements, etc.
[0073] (3) Allocate resources
[0074] After reading the descriptor, BISO can allocate necessary resources, such as memory, input / output (I / O) ports, etc., to the discovered hardware device, that is, allocate resources necessary for the normal operation of the hardware device.
[0075] (4) Loading the driver
[0076] Based on the read descriptor information, the BIOS can determine which device drivers need to be loaded to communicate with the discovered hardware devices. Among them, the hardware driver is the software that allows the computer device to interact with the hardware device.
[0077] (5) Initialize the device
[0078] Once the driver is loaded, the computer device can initialize the hardware device through the BIOS, so that the hardware device can perform data transmission or other operations with the computer device.
[0079] It should be noted that after the BIOS executes the above step (1) to enumerate and discover a hardware device, it executes the subsequent steps (2)-(5) for the hardware device. In other words, for the enumerated devices, the BIOS performs subsequent processing on the enumerated hardware devices in the order in which the hardware devices are discovered.
[0080] Thus, in the embodiments of the present application, the hardware device can support local booting and provide an external status query interface to implement the solutions of the embodiments of the present application. This can reduce the repeated development and execution of the device driver for the hardware device, thereby improving the startup efficiency of the hardware device. Moreover, since the hardware device provides an external status query interface, the computer device's operating system startup no longer restricts the hardware device's startup time, simplifying the hardware device's implementation.
[0081] Step 303: For each hardware device enumerated, obtain the startup status of the hardware device.
[0082] As previously explained, hardware devices connected to a computer may include devices capable of running device drivers to enable self-startup, as well as non-self-startup devices. For non-self-startup hardware devices, the BIOS continues to initialize them by serially running the corresponding device drivers after enumerating them. For self-startup hardware devices, the BIOS does not need to store and run the corresponding device drivers; it simply communicates with the hardware device to obtain its startup status, thus reducing the time spent on hardware initialization during the BIOS phase.
[0083] Therefore, in one possible implementation, the implementation process of step 303 can be: if the hardware device is a device that can run a device driver to achieve self-startup, then call the status query interface of the hardware device; send a query request to the hardware device through the status query interface, and the query request is used to query the startup status of the hardware device; receive the query response sent by the hardware device, and the query response carries the startup status of the hardware device.
[0084] In some embodiments, the startup state of the hardware device includes any one of a first state, a second state, a third state and a fourth state; wherein, the first state indicates that the BIOS can discover the hardware device through device enumeration; the second state indicates that the computer device is supported to configure the hardware device based on the first state; the third state indicates that the hardware device is in a normal operating state based on the second state; and the fourth state indicates that there is an abnormality in the hardware device based on the first state.
[0085] In other words, when the startup state of the hardware device is the first state, the BIOS can discover the hardware device through device enumeration and send a status query request to it; when the startup state of the hardware device is the second state, the BIOS can obtain the resource requirements of the hardware device and allocate corresponding resources to it based on the resource requirements; when the startup state of the hardware device is the third state, the BIOS does not need to process the hardware device, and after starting the operating system, it can transfer the relevant information and control of the hardware device to the operating system; when the startup state of the hardware device is the fourth state, the hardware device can communicate with the computer device, but the functions of the hardware device cannot be used normally.
[0086] It can be seen that for self-starting hardware devices, the embodiment of the present application provides a hardware device status query interface and several startup states of the hardware device, so that the self-starting hardware device and the computer device can communicate simply through the status query interface, so that the BIOS running in the computer device can obtain the current startup state of the self-starting hardware device by calling the status query interface.
[0087] Next, the status query interface and the startup status of the hardware device defined in the embodiment of the present application are explained in detail.
[0088] In some embodiments, the status query interface can be implemented in the format of a Call ID, where a Call ID is a unique string typically used to identify and associate a specific request or transaction. By adding the Call ID to an application programming interface (API) or service interface, each request transmitted through the interface can be tracked and managed.
[0089] As an example, the status query interface may be represented by a 32-bit hexadecimal number. For example, the Call ID of the status query interface may be 0xC00B2B02. Table 1 below shows the values corresponding to the various function character bits in the Call ID.
[0090] Table 1
[0091] Among them, the function description of the status query interface is to obtain the current startup status of the hardware device; the type of the status query interface is a synchronous function, that is, the query request issued needs to wait for the corresponding query response; the read and write properties of the status query interface are read-only, that is, it can only be used to query the startup status of the hardware device and cannot be modified.
[0092] For the status query interface, the format and definition of its input content are shown in Table 2 below, the format and definition of its output content are shown in Table 3 below, and the format and definition of the return value of calling the status query interface are shown in Table 4 below.
[0093] Table 2
[0094] Among them, the device address can be the bus device function (BDF) address of the PCIe device or the channel number in the universal bus, which can be determined according to the device type of the hardware device. The embodiment of the present application does not impose any restrictions on this.
[0095] Table 3
[0096] It should be understood that, in actual applications, other identifiers may also be used to distinguish and represent the four startup states of the hardware device, and the embodiments of the present application do not impose any restrictions on this.
[0097] Table 4
[0098] That is, after the BIOS calls the status query interface to send a query request to the hardware device, if a corresponding query response is received from the status query interface, it means that the status query is successful, and the return value of calling the status query interface is 0; if no corresponding query response is received from the status query interface after sending the query request, it means that the status query fails, and the return value of calling the status query interface is -1.
[0099] It should be understood that when the return value of the BIOS call status query interface is -1, the reason may be that the request timed out, the hardware device failed to establish a link successfully, the hardware device does not support self-start, the message is incorrect, etc. The embodiment of this application does not limit this.
[0100] When the return value is -1, the BIOS can continue to query the current startup status of other hardware devices; it can also continue to try to obtain the startup status of the hardware device. The number of attempts can be a preset number, such as 1, 2, 3, etc., which can be flexibly set according to actual needs. The embodiment of this application does not limit this.
[0101] Next, with reference to FIG4 , the four startup states of the self-starting hardware device during the self-starting process after powering on will be explained.
[0102] In some embodiments, referring to FIG4 , after the hardware device capable of self-starting is powered on, its startup process can be divided into a device link initialization phase and a device function initialization phase. In the device link initialization phase, the hardware device establishes a communication link with the computer device through negotiation. After completing the link building, the hardware device can communicate with the computer device and can receive a status query request sent by the computer device side. That is, the startup state of the hardware device that has completed the link building is the first state (identified by P0 in FIG4 ). In the device function initialization phase, the hardware device first completes function initialization and completes its own resource collection to determine its own resource requirements and waits for the computer device to allocate resources for it. At this time, the startup state of the hardware device is the second state (identified by P1 in FIG4 ). Further, after the computer device allocates resources for the hardware device based on its resource requirements, all functions of the hardware device can be used normally, and the hardware device can work normally. At this time, the startup state of the hardware device is the third state (identified by P2 in FIG4 ). In addition, if the hardware device fails to allocate resources normally, or the function initialization fails, the startup state of the hardware device is the fourth state (identified by P3 in FIG4 ).
[0103] It should be noted that Figure 4 is only an example. In actual applications, other methods can also be used to define the state of the hardware device during the self-startup process. It is not limited to the division method shown in Figure 4 above, nor is it limited to the above four startup states. It can include more or fewer startup states, and the embodiments of this application do not limit this.
[0104] After the startup status of the hardware device is acquired, device initialization processing may be performed on the hardware device based on the startup status of the hardware device.
[0105] In a possible implementation, the process of performing device initialization processing on the hardware device based on the startup state of the hardware device may be: if the startup state of the hardware device is the second state, allocating resources to the hardware device according to the device resource requirements of the hardware device.
[0106] That is, based on the startup status of the hardware device, when the startup status of the hardware device is the second status, the computer device can allocate resources to the hardware device in a timely manner in the BIOS stage to ensure that the hardware device can be in a normal operating state, so that the computer device can normally use the relevant functions of the hardware device.
[0107] It should be noted that allocating resources to hardware devices may include memory resource allocation, I / O resource allocation, and other resource allocation. If the hardware device is a network device, allocating resources to the hardware device also includes one or more of Internet Protocol (IP) address configuration, subnet mask configuration, default gateway and Domain Name System (DNS) server configuration, etc. The embodiments of the present application do not limit this.
[0108] Memory resource allocation refers to allocating the necessary memory space to hardware devices for data storage or task execution. I / O resource allocation involves assigning necessary input / output ports and interrupt numbers to hardware devices. Other resource allocation includes clock and power resources to ensure proper hardware operation. IP address configuration assigns a unique IP address to a hardware device to uniquely identify it on the network. Subnet mask configuration determines the network segment on which the hardware device resides. Default gateway and DNS server configuration involves configuring the appropriate gateway and DNS server for the hardware device based on the network environment.
[0109] The embodiments of the present application only explain the device initialization process when the hardware device's startup state is the second state. When the hardware device's current startup state is the first or third state, there is no need to process the hardware device, and only the startup state of the hardware device is recorded. When the hardware device's current startup state is the fourth state, the hardware device can be restarted to attempt to repair it; or the hardware device can be retained, but during the operation of the computer device, it is only used as a data / information forwarding device, and other functional interfaces of the hardware device are not called.
[0110] As an example, Table 5 below shows the correspondence between the startup status of a hardware device and the device initialization processing mode.
[0111] Table 5
[0112] It can be seen that in the embodiment of the present application, in the BIOS stage, for a hardware device discovered through enumeration, if the hardware device is a self-starting device, the computer device can call the status query interface of the hardware device to obtain the startup status of the hardware device, and perform differentiated management of the hardware device based on the startup status of the hardware device.
[0113] It should be noted that after obtaining the startup status of the hardware device, the following step 304 can be executed, or the hardware device can be initialized based on the startup status of the hardware device first, or both can be performed in parallel. The embodiment of the present application does not limit the execution sequence.
[0114] In some embodiments, for all hardware devices discovered through enumeration, for those hardware devices that can self-start, after the computer device obtains the startup status of each hardware device, it considers that some hardware devices may not be in the third state currently, but may enter the third state later. Therefore, the startup status of the hardware devices discovered through enumeration can be periodically obtained and initialized.
[0115] That is, the device startup method provided in the embodiment of the present application further includes: obtaining the startup status of the hardware device every other cycle; and performing device initialization processing on the hardware device based on the startup status of the hardware device.
[0116] Among them, the period value can be any pre-set value, such as 100ms, 10s, etc., and the embodiment of the present application does not limit this.
[0117] After obtaining the startup status of the hardware device, the computer device may store the startup status of the hardware device. In this case, before obtaining the startup status of the hardware device every other period, the computer device may first determine whether the currently stored startup status of the hardware device is the third state based on the stored startup status of the hardware device. If the currently stored startup status of the hardware device is not the third state, the step of obtaining the startup status of the hardware device every other period is performed.
[0118] Of course, when periodically obtaining the startup status of hardware devices, the startup status of all hardware devices may also be obtained, not just the hardware devices that are not in the third state. This embodiment of the present application does not impose any restrictions on this.
[0119] In a possible implementation, after obtaining the startup status of the hardware device every period, the device startup method provided in the embodiment of the present application further includes: updating the startup status of the currently stored hardware device.
[0120] Thus, in the embodiment of the present application, after the computer device is powered on and started, for the hardware devices discovered through device enumeration, after obtaining the startup status of each hardware device, the startup status of each hardware device can be periodically obtained, and the startup status of the hardware device can be stored and updated. In this way, during the operation of the operating system, based on the stored startup status of the hardware devices, the computer device can determine the hardware devices that can be normally used, and call the functional interfaces of the normally used hardware devices to perform related operations.
[0121] Step 304: When the startup status of all hardware devices connected to the computer device is obtained and at least one hardware device among all the hardware devices is in a normal operating state, the operating system of the computer device is run.
[0122] It should be noted that the "all hardware devices connected to the computer device" here does not mean all the hardware devices physically connected to the computer device, but refers to the hardware devices enumerated and discovered through the above steps 302-303, which may be all the hardware devices physically connected to the computer device, or may be only some of the hardware devices physically connected.
[0123] Since there are self-starting devices among the hardware devices discovered through enumeration, these self-starting hardware devices are started independently, so the startup of the operating system no longer depends on the completion of the startup of all hardware devices. As long as there is a hardware device among the hardware devices discovered through enumeration that can operate normally, that is, the hardware device can be used as a startup device, the operating system of the computer device can be loaded and run.
[0124] In summary, in the embodiments of the present application, after powering on a computer device, the BIOS runs and performs device enumeration through the BIOS to determine the hardware devices connected to the computer device. If the hardware device is capable of self-booting, the computer device does not need to store and run the device driver for the hardware device and can directly obtain the startup status of the hardware device. In this way, as long as at least one hardware device connected to the computer device is capable of self-booting, the time it takes for the BIOS to boot the operating system can be reduced.
[0125] Based on the device startup method shown in the above embodiment, in actual applications, a device that can be started normally can be selected from the hardware devices connected to the computer device as an administrator device. The administrator device executes the above steps 301-304 to obtain the startup status of the self-starting hardware device, and performs different management according to the startup status of the hardware device, so that the startup of the operating system no longer depends on all hardware devices being ready. It only needs to complete the startup of the dependent hardware device (i.e., the startup device) before the operating system can be loaded and started.
[0126] The administrator device is a processor in a computer device by default, but may also be other hardware devices in the computer device, and this embodiment of the application does not limit this. In addition, for a data center, the administrator device can be a processor in any host, or a master device that manages multiple distributed hardware devices / computer nodes.
[0127] To facilitate understanding, the following uses the administrator device as an example to illustrate the specific implementation process of the device startup method provided in the embodiment of the present application.
[0128] Referring to Figure 5, for hardware devices A, B, C, and D that can self-start, since they can store and run hardware device drivers and complete device initialization to achieve self-start, the hardware devices can provide a status query interface to the outside world so as to respond to query requests sent by the computer device and promptly feedback their current startup status. For the computer device, after powering on and completing device initialization, the administrator device can, for the hardware devices discovered through enumeration, call the corresponding status query interface to send a query request to the hardware device if the hardware device is a self-starting device to obtain the startup status of the hardware device. If there is a hardware device connected to the computer device that is in normal operation, the operating system of the computer device can be loaded and run.
[0129] In a possible implementation, a query request may be directly sent to a hardware device discovered through enumeration. If the hardware device can return its own startup status in response to the query request, the hardware device is a device capable of self-starting.
[0130] Referring to Figure 6, in the device startup process provided in the embodiment of the present application, if the hardware devices A, B, C, and D connected to the computer device are all capable of self-starting, then after the computer device is powered on, all the hardware devices connected to the computer device can be powered on at the same time and perform the local startup process synchronously. Among them, the local startup process of the hardware device is: the hardware device runs the local firmware stored in itself to complete the link initialization through the local firmware of the device. After the communication link is established, the startup state of the hardware device is the first state. At this time, the hardware device can respond to the management command of the administrator device when performing device enumeration. Then, the hardware device continues to perform local initialization, such as initializing the memory and other hardware modules. At this time, the startup state of the hardware device is the second state. After determining its own resource requirements, it waits for the computer device to perform resource configuration. Furthermore, after the computer device allocates resources to the hardware device based on its resource requirements, the startup state of the hardware device is the third state, and the hardware device can operate and be used normally.
[0131] For computer devices, during device enumeration at the BIOS stage, the administrator device is used as the enumeration starting point. After discovering a hardware device during enumeration, the administrator device adds the hardware device to the device list and queries the current startup status of the hardware device. It then performs different processing based on the different startup statuses, including the following situations:
[0132] In the first case, the hardware device has only established a communication link and can be enumerated and discovered, but has not completed local initialization, that is, the hardware device is in the first state, such as the hardware device B shown in Figure 6. At this time, the administrator device does not need to allocate resources for the hardware device B, but only records that the hardware device B can be identified and discovered, and its startup state is the first state.
[0133] After the device enumeration is completed, the startup state of the hardware device B may be periodically queried. When the startup state of the hardware device B is the second startup state, resources are allocated to the hardware device B based on its resource requirements.
[0134] In the second case, the hardware device has completed local initialization to clarify its own resource requirements and supports configuration of the computer device, that is, the hardware device is in the second state, such as the hardware device C shown in Figure 6. At this time, after the administrator device enumerates and discovers the hardware device C, it allocates resources to it according to the resource requirements of the hardware device C, so that the hardware device C can enter the third state and operate normally, and its functions can be used normally.
[0135] In the third case, the hardware device fails to initialize, that is, the hardware device is in the fourth state, such as the hardware device D shown in FIG6 . At this time, the administrator device does not need to allocate resources for the hardware device D, but can choose to restart the hardware device D as needed.
[0136] It should be noted that, for the above-mentioned relevant implementation details and corresponding beneficial effects, please refer to the method embodiment shown in Figure 3, which will not be repeated here.
[0137] FIG7 is a schematic diagram of the structure of a device startup apparatus provided in an embodiment of the present application. The device startup apparatus can be implemented as part or all of a computer device by software, hardware, or a combination of both. The computer device can be the device shown in FIG2 . Referring to FIG7 , the device startup apparatus 700 includes a power-on module 701, a device identification module 702, a status query module 703, and a system startup module 704.
[0138] The power-on module 701 is used to run the basic input and output system BIOS after the computer device is powered on. For detailed implementation process, please refer to the relevant content in the above step 301 and will not be repeated here.
[0139] The device identification module 702 is used to perform device enumeration through BIOS to determine the hardware devices connected to the computer device, including devices that can run device drivers to achieve self-starting; for detailed implementation process, please refer to the relevant content in the above step 302, which will not be repeated here.
[0140] The status query module 703 is used to obtain the startup status of each hardware device enumerated. For the detailed implementation process, please refer to the relevant content in the above step 303 and will not be repeated here.
[0141] The system startup module 704 is used to run the operating system of the computer device when the startup status of all hardware devices connected to the computer device is obtained and at least one hardware device among all the hardware devices is in normal operating state; for the detailed implementation process, please refer to the relevant content in the above step 304, which will not be repeated here.
[0142] In a possible implementation, the status query module 703 includes:
[0143] An interface calling unit, configured to call a status query interface of the hardware device if the hardware device is a device capable of running a device driver to achieve self-start;
[0144] A sending unit, configured to send a query request to the hardware device through a status query interface, wherein the query request is used to query the startup status of the hardware device;
[0145] The receiving unit is used to receive a query response sent by the hardware device, where the query response carries the startup status of the hardware device.
[0146] In a possible implementation, the startup state of the hardware device includes any one of a first state, a second state, a third state, and a fourth state;
[0147] The first state indicates that the BIOS can discover the hardware device through device enumeration;
[0148] The second state indicates that the computer device is supported to configure the hardware device based on the first state;
[0149] The third state indicates that the hardware device is in a normal operating state based on the second state;
[0150] The fourth state indicates that an abnormality exists in the hardware device based on the first state.
[0151] In a possible implementation, after obtaining the startup status of the hardware device, the status query module 703 is further configured to:
[0152] Perform device initialization processing on the hardware device based on the startup status of the hardware device.
[0153] In a possible implementation, the status query module 703 is further configured to:
[0154] Used to obtain the startup status of the hardware device every other cycle;
[0155] Perform device initialization processing on the hardware device based on the startup status of the hardware device.
[0156] In a possible implementation, the status query module 703 is further configured to:
[0157] If the startup state of the hardware device is the second state, resources are allocated to the hardware device according to the device resource requirements of the hardware device.
[0158] In a possible implementation, the status query module 703 is further configured to:
[0159] Storage hardware device startup status;
[0160] Every other cycle, before obtaining the startup status of the hardware device, the status query module 703 is further used to:
[0161] If the currently stored startup state of the hardware device is not the third state, the step of obtaining the startup state of the hardware device is performed every other cycle.
[0162] In a possible implementation, after obtaining the startup status of the hardware device every period, the status query module 703 is further configured to:
[0163] Update the startup status of the currently stored hardware device.
[0164] In an embodiment of the present application, after powering on a computer device, the BIOS runs and performs device enumeration through the BIOS to determine the hardware devices connected to the computer device. If the hardware device is capable of self-booting, the computer device can directly obtain the boot status of the hardware device without having to store and run the device driver for the hardware device. In this way, as long as at least one of the hardware devices connected to the computer device is capable of self-booting, the time it takes for the BIOS to boot the operating system can be reduced.
[0165] It should be noted that the device startup apparatus provided in the above embodiment, when starting the operating system of a computing device, is merely illustrated by the division of the aforementioned functional modules. In actual applications, the aforementioned functions can be assigned to different functional modules as needed, that is, the internal structure of the device can be divided into different functional modules to complete all or part of the functions described above. Furthermore, the device startup apparatus provided in the above embodiment and the device startup method embodiment are based on the same concept. The specific implementation process is detailed in the method embodiment and will not be repeated here.
[0166] The present application also provides a computer-readable storage medium. The computer-readable storage medium can be any available medium that can be stored by a computer device or a data storage device such as a data center that contains one or more available media. The available medium can be a magnetic medium (e.g., a floppy disk, a hard disk, a magnetic tape), an optical medium (e.g., a DVD), or a semiconductor medium (e.g., a solid-state drive). The computer-readable storage medium includes instructions that instruct the computer device to execute the steps of the device startup method shown in the above embodiment.
[0167] The present application also provides a computer program product including instructions. This computer program product may be software or a program product including instructions that can be run on a computer device or stored in any available medium. When the computer program product is run on at least one computer device, the at least one computer device executes the steps of the device startup method described in the above embodiment.
[0168] In the above embodiments, all or part of the embodiments can be implemented by software, hardware, firmware, or any combination thereof. When implemented using software, all or part of the embodiments can be implemented in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer instructions are loaded and executed on a computer, all or part of the processes or functions described in the embodiments of the present application are generated. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions can be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium. For example, the computer instructions can be transmitted from one website, computer, server, or data center to another website, computer, server, or data center via a wired (e.g., coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) method. The computer-readable storage medium can be any available medium that can be accessed by a computer, or a data storage device such as a server or data center that includes one or more available media integrated therein. The available medium may be a magnetic medium (e.g., a floppy disk, a hard disk, or a magnetic tape), an optical medium (e.g., a digital versatile disc (DVD)), or a semiconductor medium (e.g., a solid state disk (SSD)). It is worth noting that the computer-readable storage medium mentioned in the embodiments of the present application may be a non-volatile storage medium, in other words, a non-transient storage medium.
[0169] It should be understood that the "plurality" mentioned herein refers to two or more. In the description of the embodiments of the present application, unless otherwise specified, " / " means or, for example, A / B can mean A or B; "and / or" in this article is merely a description of the association relationship of associated objects, indicating that there can be three relationships, for example, A and / or B can mean: A exists alone, A and B exist at the same time, and B exists alone. In addition, in order to facilitate a clear description of the technical solutions of the embodiments of the present application, in the embodiments of the present application, words such as "first" and "second" are used to distinguish between identical or similar items with substantially the same functions and effects. Those skilled in the art will understand that words such as "first" and "second" do not limit the quantity and execution order, and words such as "first" and "second" do not necessarily limit them to be different.
[0170] It should be noted that the information (including but not limited to user device information, user personal information, etc.), data (including but not limited to data used for analysis, stored data, displayed data, etc.) and signals involved in the embodiments of this application are all authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data need to comply with the relevant laws, regulations and standards of relevant countries and regions.
[0171] The above description is an embodiment provided for this application and is not intended to limit this application. Any modifications, equivalent replacements, improvements, etc. made within the spirit and principles of this application should be included in the scope of protection of this application.
Claims
1. A device startup method, characterized in that: The method comprises: After powering on the computer, run the basic input and output system (BIOS); Performing device enumeration through the BIOS to determine hardware devices connected to the computer device, wherein the hardware devices include devices capable of running device drivers to achieve self-starting; Each time a hardware device is enumerated, the startup status of the hardware device is obtained; When the startup status of all hardware devices connected to the computer device is acquired and at least one hardware device among all the hardware devices is in a normal operating state, the operating system of the computer device is run.
2. The method according to claim 1, wherein The obtaining of the startup status of the hardware device includes: If the hardware device is a device capable of running a device driver to achieve self-start, calling a status query interface of the hardware device; Sending a query request to the hardware device through the status query interface, wherein the query request is used to query the startup status of the hardware device; A query response sent by the hardware device is received, where the query response carries the startup status of the hardware device.
3. The method according to claim 1 or 2, wherein: The startup state of the hardware device includes any one of a first state, a second state, a third state and a fourth state; The first state indicates that the BIOS is able to discover the hardware device through device enumeration; The second state indicates that the computer device is supported to configure the hardware device based on the first state; The third state indicates that the hardware device is in a normal operating state based on the second state; The fourth state indicates that an abnormality exists in the hardware device based on the first state.
4. The method according to claim 3, wherein After obtaining the startup status of the hardware device, the method further includes: Perform device initialization processing on the hardware device based on the startup state of the hardware device.
5. The method according to claim 3 or 4, wherein: The method further comprises: Obtaining the startup status of the hardware device every other cycle; Perform device initialization processing on the hardware device based on the startup state of the hardware device.
6. The method according to claim 4 or 5, characterized in that The performing device initialization processing on the hardware device based on the startup state of the hardware device includes: If the startup state of the hardware device is the second state, resources are allocated to the hardware device according to the device resource requirements of the hardware device.
7. The method according to claim 5, wherein The method further comprises: Storing the startup status of the hardware device; Before obtaining the startup status of the hardware device every other cycle, the method further includes: If the currently stored startup state of the hardware device is not the third state, the step of obtaining the startup state of the hardware device is performed every other cycle.
8. The method according to claim 7, wherein After obtaining the startup status of the hardware device every other cycle, the method further includes: The currently stored startup status of the hardware device is updated.
9. A device starting device, characterized in that: The device comprises: A power-on module, used to run the basic input and output system BIOS after the computer device is powered on; a device identification module, configured to perform device enumeration through the BIOS to determine hardware devices connected to the computer device, wherein the hardware devices include devices capable of running device drivers to achieve self-start; A status query module is used to obtain the startup status of each hardware device after enumerating the hardware device; The system startup module is used to run the operating system of the computer device when the startup status of all hardware devices connected to the computer device is acquired and at least one hardware device among all the hardware devices is in a normal operating state.
10. The device according to claim 9, wherein The status query module includes: an interface calling unit, configured to call a status query interface of the hardware device if the hardware device is a device capable of running a device driver to achieve self-start; a sending unit, configured to send a query request to the hardware device through the status query interface, wherein the query request is used to query the startup status of the hardware device; A receiving unit is configured to receive a query response sent by the hardware device, where the query response carries the startup status of the hardware device.
11. The device according to claim 9 or 10, characterized in that The startup state of the hardware device includes any one of a first state, a second state, a third state and a fourth state; The first state indicates that the BIOS is able to discover the hardware device through device enumeration; The second state indicates that the computer device is supported to configure the hardware device based on the first state; The third state indicates that the hardware device is in a normal operating state based on the second state; The fourth state indicates that an abnormality exists in the hardware device based on the first state.
12. The device according to claim 11, wherein After obtaining the startup status of the hardware device, the status query module is further used to: Perform device initialization processing on the hardware device based on the startup state of the hardware device.
13. The device according to claim 11 or 12, characterized in that The status query module is also used for: Used to obtain the startup status of the hardware device every other cycle; Perform device initialization processing on the hardware device based on the startup state of the hardware device.
14. The device according to claim 12 or 13, characterized in that The status query module is also used for: If the startup state of the hardware device is the second state, resources are allocated to the hardware device according to the device resource requirements of the hardware device.
15. The device according to claim 14, wherein The status query module is also used for: Storing the startup status of the hardware device; Before obtaining the startup status of the hardware device every other cycle, the status query module is further configured to: If the currently stored startup state of the hardware device is not the third state, the step of obtaining the startup state of the hardware device is performed every other cycle.
16. The device according to claim 15, characterized in that After obtaining the startup status of the hardware device every other cycle, the status query module is further configured to: The currently stored startup status of the hardware device is updated.
17. A computer device, characterized in that: The computer device includes a memory and a processor; The memory is used to store computer programs; The processor is configured to execute the computer program to implement the steps of the device startup method according to any one of claims 1 to 8.
18. A computer-readable storage medium, characterized in that The method comprises computer program instructions, which, when executed by a computer device, enable the computer device to perform the steps of the device startup method according to any one of claims 1 to 8.
19. A computer program product comprising instructions, characterized in that When the instruction is executed by a computer device, the computer device is caused to perform the steps of the device startup method according to any one of claims 1 to 8.
Citation Information
Patent Citations
Equipment starting method and device, equipment, storage medium and computer program product
CN120523517A
Rapid peripheral component interconnection equipment starting method and device, and storage medium
CN114077738A
Rapid peripheral component interconnection equipment starting method and device, and storage medium
CN114077739A
Equipment enumeration method and device, computer equipment and storage medium
CN114817105A
USB interface mobile storage
CN1549094A