PXE starting method and device for unified extensible firmware interface, equipment and medium
By using driver compatibility components and register mapping mechanisms in the PXE boot process of UEFI, the problem of UEFI's adaptation to USB network cards and processor architecture compatibility limitations are solved, and the compatibility and system flexibility of multiple USB network cards are achieved. Maintenance costs are reduced.
Patent Information
- Application Number
- CN202411034672.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-30
- Publication Date
- 2024-10-22
AI Technical Summary
During the PXE boot process of UEFI, differences in the type and implementation of network cards cause UEFI to be unable to correctly support USB network cards, and existing drivers are not compatible with different types of processor architectures, which limits the flexibility and compatibility of the system and increases development time. and maintenance costs.
By loading pre-created driver compatible components, read the configuration register of the multi-core architecture processor to obtain the hardware architecture, create timer events and callback functions to scan the USB network card access, determine whether the network card interface type matches the hardware architecture, and use it if it does not match. The register mapping component maps the registers of the network card interface type to the registers of the hardware architecture to implement the initialization and data transmission of the USB network card.
It achieves compatibility with many different types of USB network cards, improves the support capabilities of different architecture systems for USB network cards, enhances the flexibility and compatibility of the system, and reduces development and maintenance costs.
Smart Images

Figure CN118819652A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer technology, and in particular to a PXE boot method, device, equipment and medium of a unified extensible firmware interface. Background Art
[0002] Currently, UEFI (Unified Extensible Firmware Interface) is the boot firmware of modern computer systems, providing a wealth of boot and management functions. PXE (Preboot eXecution Environment) is a key function in UEFI that allows the system to boot the operating system or other firmware over the network. During the PXE boot process, the computer does not need a local storage device and loads the operating system image from a remote server over the network. This is a common boot method in data centers, embedded systems, and enterprise environments.
[0003] However, in the PXE boot process of UEFI, the type and implementation of the network card play a vital role in the success of the boot. For example, USB (Universal Serial Bus) network cards can be divided into those accessed through PCIe (Peripheral Component Interconnect Express, a high-speed serial computer expansion bus standard) bus or MMIO (Memory-mapped I / O) bus according to the implementation of their controllers. This implementation difference leads to some problems in UEFI's adaptation of USB network cards. For example, when the network card only provides drivers for the MMIO interface or PCIe interface, UEFI under a specific hardware architecture cannot correctly support these network cards. This is because the current UEFI firmware usually only provides corresponding drivers for specific hardware interfaces. For example, for USB controllers under the PCIe bus, UEFI provides corresponding PCIe drivers; and for USB controllers under the MMIO bus, UEFI provides MMIO drivers. These drivers implement the initialization and data transmission functions of the USB network card by accessing and operating the corresponding hardware registers.
[0004] In addition, current drivers are not compatible with different types of processor architectures, which limits the flexibility and compatibility of the system. In an environment where multiple processor architectures coexist (such as in a cloud server room), UEFI firmware needs to maintain different types of drivers separately, increasing development and maintenance costs.
[0005] In summary, how to correctly load and initialize the network card driver in an environment where multiple processor architectures coexist is a problem that needs to be further solved in this field. Summary of the invention
[0006] In view of this, the purpose of this application is to provide a PXE boot method, device, equipment and storage medium with a unified extensible firmware interface, which can achieve compatibility with multiple types of USB network cards, solve the problem of being unable to adapt different types of USB network cards, and improve the support capabilities of different architecture systems for various types of USB network cards, thereby enhancing the flexibility and compatibility of the system. The specific scheme is as follows:
[0007] In a first aspect, the present application discloses a PXE boot method of a unified extensible firmware interface, which is applied to a computer system based on a multi-core processor architecture, comprising:
[0008] When detecting that the Unified Extensible Firmware Interface firmware is booting, loading the pre-created driver compatibility component;
[0009] The configuration register of the multi-core architecture processor in the current system is read through the driver compatible component to obtain the hardware architecture of the current system, and a timer event and a corresponding callback function are created to scan whether a USB network card is connected through the timer event. If a USB network card is connected, the callback function is executed to obtain the network card interface type of the USB network card by reading the configuration register of the USB network card, and determine whether the network card interface type matches the hardware architecture. If the network card interface type does not match the hardware architecture, the interface matching flag is set to false;
[0010] Loading a register mapping component in the driver compatible component to obtain the interface matching identifier through the register mapping component, and when the interface matching identifier is false, mapping the configuration register corresponding to the network card interface type to the configuration register corresponding to the hardware architecture;
[0011] The USB network card is initialized based on the driver of the USB network card and the configuration register corresponding to the mapped hardware architecture, and the operating system is loaded through a boot loader to implement PXE boot of the unified extensible firmware interface firmware.
[0012] Optionally, when monitoring that the unified extensible firmware interface firmware is started, loading a pre-created driver compatible component includes:
[0013] When detecting that the unified extensible firmware interface firmware is started, initializing the hardware in the current system;
[0014] When it is detected that the hardware initialization operation is completed, a pre-created driver compatible component is loaded.
[0015] Optionally, the creating a timer event and a corresponding callback function to scan whether a USB network card is connected through the timer event includes:
[0016] A timer event and a corresponding callback function are created, and an event cycle of the timer event is set, so as to scan whether a USB network card is connected through the timer event and according to the event cycle.
[0017] Optionally, the multi-core architecture processor, the USB network card, and each of the configuration registers are located in the hardware layer, the driver of the USB network card is located in the network card driver layer, and the driver compatibility component is located between the hardware layer and the network card driver layer.
[0018] Optionally, obtaining the network card interface type of the USB network card by reading a configuration register of the USB network card includes:
[0019] The current connection status of the USB network card is obtained. If the connection status is in place, the configuration register of the USB network card is read to identify the network card interface type of the USB network card.
[0020] Optionally, the PXE boot method of the unified extensible firmware interface further includes:
[0021] If the network card interface type matches the hardware architecture, setting the interface matching flag to true;
[0022] Loading a register mapping component in the driver compatibility component to obtain the interface matching identifier through the register mapping component, and when the interface matching identifier is true, determining the configuration register corresponding to the hardware architecture, and initializing the USB network card based on the driver of the USB network card and the configuration register corresponding to the hardware architecture, and then loading the operating system through the boot loader to implement PXE booting of the unified extensible firmware interface firmware;
[0023] Correspondingly, the USB network card is initialized based on the driver of the USB network card and the configuration register corresponding to the hardware architecture, and then the operating system is loaded through the boot loader to implement the PXE boot of the unified extensible firmware interface firmware, including:
[0024] Loading the driver of the USB network card, and accessing the configuration register corresponding to the hardware architecture during the loading process to realize the initialization and data transmission functions of the USB network card; the initialization process of the USB network card includes the configuration of network card parameters, the setting of network parameters and the establishment of data channels;
[0025] When it is monitored that the USB network card is initialized, the operating system image of the current system is downloaded through the boot loader and the network, and the operating system image is started to achieve PXE startup of the unified extensible firmware interface firmware.
[0026] Optionally, when the interface matching flag is false, mapping the configuration register corresponding to the network card interface type to the configuration register corresponding to the hardware architecture includes:
[0027] When the interface matching flag is false, mapping the PCIe register corresponding to the network card interface type to the MMIO register corresponding to the hardware architecture;
[0028] Or, the MMIO register corresponding to the network card interface type is mapped to the PCIe register corresponding to the hardware architecture.
[0029] In a second aspect, the present application discloses a PXE boot device with a unified extensible firmware interface, which is applied to a computer system based on a multi-core processor architecture, including:
[0030] A loading module, used for loading a pre-created driver compatible component when detecting that the unified extensible firmware interface firmware is started;
[0031] A reading module, used for reading the configuration register of the multi-core architecture processor in the current system through the driver compatible component to obtain the hardware architecture of the current system, and creating a timer event and a corresponding callback function to scan whether a USB network card is connected through the timer event. If a USB network card is connected, the callback function is executed to obtain the network card interface type of the USB network card by reading the configuration register of the USB network card, and determine whether the network card interface type matches the hardware architecture. If the network card interface type does not match the hardware architecture, the interface matching flag is set to false;
[0032] A loading module, used for loading a register mapping component in the driver compatible component, so as to obtain the interface matching identifier through the register mapping component, and when the interface matching identifier is false, mapping the configuration register corresponding to the network card interface type to the configuration register corresponding to the hardware architecture;
[0033] The PXE boot module is used to initialize the USB network card based on the driver of the USB network card and the configuration register corresponding to the mapped hardware architecture, and load the operating system through the boot loader to realize the PXE boot of the unified extensible firmware interface firmware.
[0034] In a third aspect, the present application discloses an electronic device, comprising a processor and a memory; wherein the processor implements the aforementioned PXE boot method of the unified extensible firmware interface when executing a computer program stored in the memory.
[0035] In a fourth aspect, the present application discloses a computer-readable storage medium for storing a computer program; wherein, when the computer program is executed by a processor, the aforementioned PXE boot method of the unified extensible firmware interface is implemented.
[0036] It can be seen that the present application is applied to a computer system based on a multi-core processor architecture. When the unified extensible firmware interface firmware is detected to be started, a pre-created driver compatibility component is loaded, and the configuration register of the multi-core architecture processor in the current system is read through the driver compatibility component to obtain the hardware architecture of the current system, and a timer event and a corresponding callback function are created to scan whether a USB network card is connected through the timer event. If a USB network card is connected, the callback function is executed to obtain the network card interface type of the USB network card by reading the configuration register of the USB network card, and determine whether the network card interface type matches the hardware architecture. If the network card interface type does not match the hardware architecture, the interface matching flag is set to false, and then the register mapping component located in the driver compatibility component is loaded to obtain the interface matching flag through the register mapping component, and when the interface matching flag is false, the configuration register corresponding to the network card interface type is mapped to the configuration register corresponding to the hardware architecture. Finally, the USB network card is initialized based on the driver of the USB network card and the mapped configuration register corresponding to the hardware architecture, and the operating system is loaded through the boot loader to realize the PXE startup of the unified extensible firmware interface firmware. The present application is applied to a computer system based on a multi-core processor architecture. When the unified extensible firmware interface firmware is detected to be started, a pre-created driver compatibility component is first loaded, and the hardware architecture of the current system and the network card interface type of the scanned USB network card are respectively obtained through the component, and then it is determined whether the network card interface type matches the hardware architecture. If not, the configuration register corresponding to the network card interface type is mapped to the configuration register corresponding to the hardware architecture through the register mapping component in the driver compatibility component, and the USB network card is initialized based on the configuration register corresponding to the driver and the hardware architecture of the USB network card, thereby realizing PXE startup of the unified extensible firmware interface firmware. It can be seen that the present application can adapt to different types of USB network cards through the pre-created driver compatibility component, so it can be applied to an environment where multiple hardware architectures coexist, and realizes the compatibility of multiple different types of USB network cards, thereby solving the current problem of being unable to adapt different types of USB network cards. In addition, the register conversion mechanism can significantly improve the support capabilities of different architecture systems for various types of USB network cards, thereby enhancing the flexibility and compatibility of the system. BRIEF DESCRIPTION OF THE DRAWINGS
[0037] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on the provided drawings without paying any creative work.
[0038] Figure 1 A flow chart of a PXE boot method of a unified extensible firmware interface disclosed in this application;
[0039] Figure 2 A specific computer system architecture block diagram disclosed in this application;
[0040] Figure 3 A flowchart of a specific PXE boot method of a unified extensible firmware interface disclosed in this application;
[0041] Figure 4 A schematic diagram of the structure of a PXE boot device with a unified extensible firmware interface disclosed in this application;
[0042] Figure 5 This is a structural diagram of an electronic device disclosed in this application. DETAILED DESCRIPTION
[0043] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.
[0044] The present application embodiment discloses a PXE boot method of a unified extensible firmware interface, which is applied to a computer system based on a multi-core processor architecture, see Figure 1 As shown, the method includes:
[0045] Step S11: when it is detected that the UEFI firmware is started, a pre-created driver compatible component is loaded.
[0046] It should be pointed out that the PXE boot solution of the unified extensible firmware interface (UEFI) proposed in this application is applied to computer systems based on multi-core processor architecture, including but not limited to data center management systems, industrial control equipment, embedded systems in Internet of Things devices, and personal computer systems.
[0047] In addition, it should be noted that see Figure 2As shown, the present application pre-creates a driver compatibility component, which is located between the hardware layer and the network card driver layer, and is used to achieve adaptation of different types of USB network cards, wherein the hardware layer includes but is not limited to a multi-core architecture processor, a USB network card, different types of configuration registers, etc., and the network card driver layer includes a driver for the USB network card.
[0048] In this embodiment, when the computer system detects that the unified extensible firmware interface firmware (ie, UEFI firmware) is started, the pre-created driver compatible component is first loaded.
[0049] Specifically, when the unified extensible firmware interface firmware is detected to be started, the pre-created driver compatible component is loaded, which may include: when the unified extensible firmware interface firmware is detected to be started, the hardware in the current system is initialized; when the hardware initialization operation is detected to be completed, the pre-created driver compatible component is loaded. In this embodiment, when the UEFI firmware is detected to be started, the hardware in the current system is initialized, such as the processor (Central Processing Unit, CPU), memory and other hardware are initialized, and the peripherals are enumerated and resource allocated. Initialization operations such as, further, when the hardware initialization operation is detected to be completed, the pre-created driver compatible component is loaded into the memory through the UEFI firmware, and the driver compatible component is started. By performing the initialization operation on the hardware, it is possible to ensure that the basic hardware functions of the current computer system are normal, thereby providing an operating environment for the loading of the driver compatible component.
[0050] Step S12: reading the configuration register of the multi-core architecture processor in the current system through the driver compatibility component to obtain the hardware architecture of the current system, and creating a timer event and a corresponding callback function to scan whether a USB network card is connected through the timer event; if a USB network card is connected, executing the callback function to obtain the network card interface type of the USB network card by reading the configuration register of the USB network card, and judging whether the network card interface type matches the hardware architecture; if the network card interface type does not match the hardware architecture, setting the interface match flag to false.
[0051] In this embodiment, by loading the driver compatible component, the configuration register of the multi-core architecture processor (such as CPU) in the current system can be read, so as to determine the hardware architecture of the current system, such as ARM (Advanced RISC Machine) architecture, x86 architecture, etc., according to the type of the configuration register of the read multi-core architecture processor (such as PCIe interface type, MMIO interface type, etc.), and create a timer event (i.e., timer event) and a callback function corresponding to the timer event. Then, through the created timer event, scan whether there is a USB network card connected at present. If it is scanned that there is a USB network card connected, the corresponding callback function is executed, so as to determine the network card interface type (such as PCIe interface type, MMIO interface type, etc.) of the currently inserted USB network card by reading the configuration register of the USB network card, and then judge whether the above network card interface type matches the above hardware architecture. If the two do not match, it indicates that the USB network card at this time does not match the hardware architecture of the system and cannot be used directly. At this time, the pre-created interface matching flag can be set to false, such as setting the interface matching flag Pcd UsbPxeFlag=false, and then returning the value.
[0052] In this embodiment, the method of obtaining the network card interface type of the USB network card by reading the configuration register of the USB network card may specifically include: obtaining the connection status of the current USB network card, and if the connection status is in place, reading the configuration register of the USB network card to identify the network card interface type of the USB network card. That is, before reading the configuration register of the USB network card, first obtain the connection status of the currently inserted USB network card to perform an in-place detection on the USB network card, and if the connection status indicates that the USB network card is in place, read the configuration register of the USB network card to identify the network card interface type of the USB network card. In this embodiment, before reading the configuration register of the USB network card, first obtain the connection status of the USB network card, so that the connection status of the USB network card can be confirmed again, avoiding the failure of the PXE startup of the unified extensible firmware interface due to the abnormal connection status of the USB network card, and can directly return through the callback function after identifying the abnormality.
[0053] Specifically, the creation of a timer event and a corresponding callback function to scan whether a USB network card is connected through the timer event may include: creating a timer event and a corresponding callback function, and setting an event period of the timer event to scan whether a USB network card is connected through the timer event and according to the event period. That is, after creating the timer event and the corresponding callback function, set the event period of the timer event (such as 5ms), so that it is possible to continuously scan whether a USB network card is connected through the timer event and according to the set event period. This embodiment can monitor the access status of the USB network card by creating a timer event and a corresponding callback function, and can support hot plugging (hotplug) of the USB network card during the entire PXE boot process of the unified extensible firmware interface.
[0054] Step S13: Load the register mapping component in the driver compatible component to obtain the interface matching identifier through the register mapping component, and when the interface matching identifier is false, map the configuration register corresponding to the network card interface type to the configuration register corresponding to the hardware architecture.
[0055] In this embodiment, after setting the interface matching identifier, further, a register mapping component located in the above-mentioned driver compatible component is loaded so as to obtain the above-mentioned interface matching identifier through the mapping component, and then when the interface matching identifier is identified as false, the configuration register corresponding to the network card interface type (i.e., the configuration register corresponding to the USB network card) is mapped to the configuration register corresponding to the above-mentioned hardware architecture. The specific mapping method can be: mapping the control register inside the USB network card to the memory address space of the processor.
[0056] In a specific implementation, when the interface match flag is false, mapping the configuration register corresponding to the network card interface type to the configuration register corresponding to the hardware architecture may specifically include: when the interface match flag is false, mapping the PCIe register corresponding to the network card interface type to the MMIO register corresponding to the hardware architecture. For example, when the interface match flag Pcd UsbPxeFlag=false, mapping the PCIe register corresponding to the USB network card to the MMIO register corresponding to the hardware architecture in the memory address space of the processor.
[0057] In another specific implementation, when the interface matching flag is false, mapping the configuration register corresponding to the network card interface type to the configuration register corresponding to the hardware architecture may specifically include: mapping the MMIO register corresponding to the network card interface type to the PCIe register corresponding to the hardware architecture. For example, when the interface matching flag Pcd UsbPxeFlag=false, the MMIO register corresponding to the USB network card is mapped to the PCIe register corresponding to the hardware architecture and located in the memory address space of the processor.
[0058] Furthermore, after mapping the configuration register corresponding to the network card interface type to the configuration register corresponding to the hardware architecture, it can also include: providing a unified interface to the upper layer of the register mapping component (i.e., the network card driver layer) through the register mapping component. In this way, the register mapping component can be made transparent to the upper network card driver layer, so that the network card driver layer can know whether the register mapping component has completed the register mapping operation, so as to load the USB network card driver program.
[0059] Step S14: Initialize the USB network card based on the driver of the USB network card and the mapped configuration register corresponding to the hardware architecture, and load the operating system through a boot loader to implement PXE boot of the UEFI firmware.
[0060] In this embodiment, after mapping the configuration register corresponding to the network card interface type to the configuration register corresponding to the hardware architecture, the driver (Driver) of the above-mentioned USB network card is loaded, and the configuration register corresponding to the mapped hardware architecture is accessed during the loading process, thereby realizing the initialization and data transmission function of the USB network card; wherein, the initialization process of the USB network card specifically includes but is not limited to the configuration of network card parameters, the setting of network parameters and the establishment of data channels; when it is monitored that the initialization of the USB network card is completed, the operating system image of the current system can be downloaded through the boot loader and the network, and the operating system image can be started, thereby realizing the PXE boot of UEFI.
[0061] It can be seen that the embodiment of the present application is applied to a computer system based on a multi-core processor architecture. When the unified extensible firmware interface firmware is monitored to be started, a pre-created driver compatibility component is loaded, and the configuration register of the multi-core architecture processor in the current system is read through the driver compatibility component to obtain the hardware architecture of the current system, and a timer event and a corresponding callback function are created to scan whether a USB network card is connected through the timer event. If a USB network card is connected, the callback function is executed to obtain the network card interface type of the USB network card by reading the configuration register of the USB network card, and determine whether the network card interface type matches the hardware architecture. If the network card interface type does not match the hardware architecture, the interface matching flag is set to false, and then the register mapping component located in the driver compatibility component is loaded to obtain the interface matching flag through the register mapping component, and when the interface matching flag is false, the configuration register corresponding to the network card interface type is mapped to the configuration register corresponding to the hardware architecture. Finally, the USB network card is initialized based on the driver of the USB network card and the mapped configuration register corresponding to the hardware architecture, and the operating system is loaded through the boot loader to realize the PXE startup of the unified extensible firmware interface firmware. The embodiment of the present application is applied to a computer system based on a multi-core processor architecture. When the unified extensible firmware interface firmware is detected to be started, the pre-created driver compatibility component is first loaded, and the hardware architecture of the current system and the network card interface type of the scanned USB network card are respectively obtained through the component, and then the network card interface type and the hardware architecture are determined. If they do not match, the configuration register corresponding to the network card interface type is mapped to the configuration register corresponding to the hardware architecture through the register mapping component in the driver compatibility component, and the USB network card is initialized based on the configuration register corresponding to the driver and the hardware architecture of the USB network card, thereby realizing the PXE startup of the unified extensible firmware interface firmware. It can be seen that the embodiment of the present application can adapt different types of USB network cards through the pre-created driver compatibility component, so it can be applied to an environment where multiple hardware architectures coexist, and realizes the compatibility of multiple different types of USB network cards, thereby solving the current problem of being unable to adapt different types of USB network cards. In addition, the register conversion mechanism can significantly improve the support capabilities of different architecture systems for various types of USB network cards, thereby enhancing the flexibility and compatibility of the system. In addition, since the unified extensible firmware interface firmware does not need to maintain different types of drivers separately, the development and maintenance costs are reduced.
[0062] The present application embodiment discloses a specific PXE boot method of a unified extensible firmware interface, which is applied to a computer system based on a multi-core processor architecture, see Figure 2 As shown, the method includes:
[0063] Step S21: when it is detected that the UEFI firmware is started, a pre-created driver compatible component is loaded.
[0064] Step S22: reading the configuration register of the multi-core architecture processor in the current system through the driver compatibility component to obtain the hardware architecture of the current system, and creating a timer event and a corresponding callback function to scan whether a USB network card is connected through the timer event; if a USB network card is connected, executing the callback function to obtain the network card interface type of the USB network card by reading the configuration register of the USB network card, and judging whether the network card interface type matches the hardware architecture; if the network card interface type matches the hardware architecture, setting the interface match flag to true.
[0065] In this embodiment, the created callback function is used to determine whether the network card interface type matches the hardware architecture. If the two match, the interface matching flag is set to true, such as setting the interface matching flag Pcd UsbPxeFlag=false.
[0066] Step S23: Load the register mapping component located in the driver compatibility component to obtain the interface matching identifier through the register mapping component, and when the interface matching identifier is true, determine the configuration register corresponding to the hardware architecture, and initialize the USB network card based on the driver of the USB network card and the configuration register corresponding to the hardware architecture, and then load the operating system through the boot loader to achieve PXE boot of the unified extensible firmware interface firmware.
[0067] In this embodiment, after loading the register mapping component located in the above-mentioned driver compatible component, the above-mentioned interface matching identifier Pcd UsbPxeFlag can be obtained through the register mapping component, and when it is detected that the interface matching identifier Pcd UsbPxeFlag=false, the configuration register corresponding to the current hardware architecture is determined, and then the current USB network card is initialized based on the driver of the USB network card and the configuration register corresponding to the above-mentioned hardware architecture, and finally the operating system (Operating System, OS) is loaded through the boot loader, thereby realizing PXE boot of the unified extensible firmware interface firmware.
[0068] Specifically, the USB network card is initialized based on the driver program of the USB network card and the configuration register corresponding to the hardware architecture, and then the operating system is loaded through the boot loader to realize the PXE startup of the unified extensible firmware interface firmware, which may include: loading the driver program of the USB network card, and accessing the configuration register corresponding to the hardware architecture during the loading process to realize the initialization and data transmission functions of the USB network card; the initialization process of the USB network card includes the configuration of network card parameters, the setting of network parameters and the establishment of data channels; when it is monitored that the initialization of the USB network card is completed, the operating system image of the current system is downloaded through the boot loader and the network, and the operating system image is started to realize the PXE startup of the unified extensible firmware interface firmware. That is, first load the driver of the USB network card, and directly access the configuration register corresponding to the hardware architecture during the loading process, so as to realize the initialization and data transmission functions of the current USB network card; wherein, the initialization process of the USB network card includes the configuration of network card parameters, the setting of network parameters and the establishment of data channels; further, when it is monitored that the initialization of the USB network card is completed, the boot loader downloads the operating system image of the current system through the network, and starts the operating system image, so as to realize the PXE startup of the unified extensible firmware interface firmware.
[0069] For a more specific processing procedure of the above step S21, reference may be made to the corresponding contents disclosed in the above embodiments, which will not be described in detail here.
[0070] It can be seen that the embodiment of the present application reads the configuration register of the multi-core architecture processor in the current system through the driver compatibility component to obtain the hardware architecture of the current system, and creates a timer event and a corresponding callback function to scan whether a USB network card is connected through the timer event. If a USB network card is scanned to be connected, the callback function is executed to obtain the network card interface type of the USB network card by reading the configuration register of the USB network card, and determine whether the network card interface type matches the hardware architecture. If the network card interface type matches the hardware architecture, the interface matching flag is set to true, and the register mapping component located in the driver compatibility component is loaded to obtain the interface matching flag through the register mapping component, and when the interface matching flag is true, the configuration register corresponding to the hardware architecture is determined, and the USB network card is initialized based on the driver of the USB network card and the configuration register corresponding to the hardware architecture, and then the operating system is loaded through the boot loader to realize the PXE boot of the unified extensible firmware interface firmware. The embodiment of the present application can adapt to different types of USB network cards through a pre-created driver compatibility component, so it can be applied to an environment where multiple hardware architectures coexist, achieving compatibility of multiple different types of USB network cards, thereby solving the current problem of being unable to adapt to different types of USB network cards, and when the network card interface type of the USB network card matches the hardware architecture, the interface matching flag can be set to true, so that the system knows that the currently connected USB network card matches the hardware architecture of the system, and the register mapping component located in the driver compatibility component can be directly loaded, thereby achieving PXE fast startup of the unified extensible firmware interface firmware, that is, the present application can be used in the case where the USB network card matches the hardware architecture of the system through the driver compatibility component, and can also be used in the case where the USB network card does not match the hardware architecture of the system, thereby significantly improving the support capabilities of different architecture systems for various types of USB network cards, enhancing the flexibility and compatibility of the system, and solving the problem of different types of USB network cards that cannot be adapted in traditional technologies.
[0071] Correspondingly, the present application also discloses a PXE boot device with a unified extensible firmware interface, which is applied to a computer system based on a multi-core processor architecture, see Figure 4 As shown, the device comprises:
[0072] A loading module 11, used for loading a pre-created driver compatible component when detecting that the unified extensible firmware interface firmware is started;
[0073] A reading module 12 is used to read the configuration register of the multi-core architecture processor in the current system through the driver compatible component to obtain the hardware architecture of the current system, and create a timer event and a corresponding callback function to scan whether a USB network card is connected through the timer event. If a USB network card is connected, the callback function is executed to obtain the network card interface type of the USB network card by reading the configuration register of the USB network card, and determine whether the network card interface type matches the hardware architecture. If the network card interface type does not match the hardware architecture, the interface matching flag is set to false;
[0074] A loading module 13, used for loading a register mapping component in the driver compatible component, so as to obtain the interface matching identifier through the register mapping component, and when the interface matching identifier is false, mapping the configuration register corresponding to the network card interface type to the configuration register corresponding to the hardware architecture;
[0075] The PXE boot module 14 is used to initialize the USB network card based on the driver of the USB network card and the configuration register corresponding to the mapped hardware architecture, and load the operating system through the boot loader to achieve PXE boot of the unified extensible firmware interface firmware.
[0076] Among them, the specific working processes of the above-mentioned modules can refer to the corresponding contents disclosed in the aforementioned embodiments, which will not be repeated here.
[0077] It can be seen that the embodiment of the present application is applied to a computer system based on a multi-core processor architecture. When the unified extensible firmware interface firmware is monitored to be started, a pre-created driver compatibility component is loaded, and the configuration register of the multi-core architecture processor in the current system is read through the driver compatibility component to obtain the hardware architecture of the current system, and a timer event and a corresponding callback function are created to scan whether a USB network card is connected through the timer event. If a USB network card is connected, the callback function is executed to obtain the network card interface type of the USB network card by reading the configuration register of the USB network card, and determine whether the network card interface type matches the hardware architecture. If the network card interface type does not match the hardware architecture, the interface matching flag is set to false, and then the register mapping component located in the driver compatibility component is loaded to obtain the interface matching flag through the register mapping component, and when the interface matching flag is false, the configuration register corresponding to the network card interface type is mapped to the configuration register corresponding to the hardware architecture. Finally, the USB network card is initialized based on the driver of the USB network card and the mapped configuration register corresponding to the hardware architecture, and the operating system is loaded through the boot loader to realize the PXE startup of the unified extensible firmware interface firmware. The embodiment of the present application is applied to a computer system based on a multi-core processor architecture. When the unified extensible firmware interface firmware is detected to be started, a pre-created driver compatibility component is first loaded, and the hardware architecture of the current system and the network card interface type of the scanned USB network card are respectively obtained through the component, and then it is determined whether the network card interface type matches the hardware architecture. If not, the configuration register corresponding to the network card interface type is mapped to the configuration register corresponding to the hardware architecture through the register mapping component in the driver compatibility component, and the USB network card is initialized based on the configuration register corresponding to the driver and the hardware architecture of the USB network card, thereby realizing PXE startup of the unified extensible firmware interface firmware. It can be seen that the embodiment of the present application can adapt to different types of USB network cards through the pre-created driver compatibility component, so it can be applied to an environment where multiple hardware architectures coexist, and realizes compatibility of multiple different types of USB network cards, thereby solving the current problem of being unable to adapt different types of USB network cards. In addition, the register conversion mechanism can significantly improve the support capabilities of different architecture systems for various types of USB network cards, thereby enhancing the flexibility and compatibility of the system.
[0078] In some specific embodiments, the loading module 11 may specifically include:
[0079] An initialization unit, used to initialize the hardware in the current system when detecting that the unified extensible firmware interface firmware is started;
[0080] The first loading unit is used to load a pre-created driver compatible component when it is detected that the hardware initialization operation is completed.
[0081] In some specific embodiments, the reading module 12 may specifically include:
[0082] Create a unit to create timer events and corresponding callback functions;
[0083] The first setting unit is used to set the event period of the timer event, so as to scan whether a USB network card is connected through the timer event and according to the event period.
[0084] In some specific embodiments, the multi-core architecture processor, the USB network card, and each of the configuration registers are located in the hardware layer, the driver of the USB network card is located in the network card driver layer, and the driver compatibility component is located between the hardware layer and the network card driver layer.
[0085] In some specific embodiments, the reading module 12 may specifically include:
[0086] The reading unit is used to obtain the current connection status of the USB network card. If the connection status is in place, the configuration register of the USB network card is read to identify the network card interface type of the USB network card.
[0087] In some specific embodiments, the PXE boot device of the unified extensible firmware interface may further include:
[0088] A second setting unit, configured to set an interface matching flag to true if the network card interface type matches the hardware architecture;
[0089] A second loading unit is used to load a register mapping component located in the driver compatibility component, so as to obtain the interface matching identifier through the register mapping component, and when the interface matching identifier is true, determine the configuration register corresponding to the hardware architecture, and initialize the USB network card based on the driver of the USB network card and the configuration register corresponding to the hardware architecture, and then load the operating system through the boot loader to implement PXE boot of the unified extensible firmware interface firmware;
[0090] Accordingly, the second loading unit may specifically include:
[0091] A third loading unit is used to load the driver of the USB network card, and access the configuration register corresponding to the hardware architecture during the loading process to realize the initialization and data transmission functions of the USB network card; the initialization process of the USB network card includes the configuration of network card parameters, the setting of network parameters and the establishment of data channels;
[0092] A download unit, configured to download the operating system image of the current system through a boot loader and a network when monitoring that the USB network card has been initialized;
[0093] A boot unit is used to boot the operating system image to implement PXE boot of the unified extensible firmware interface firmware.
[0094] In some specific embodiments, the loading module 13 may specifically include:
[0095] A first mapping unit, configured to map a PCIe register corresponding to the network card interface type to an MMIO register corresponding to the hardware architecture when the interface matching flag is false;
[0096] Or, a second mapping unit is used to map the MMIO register corresponding to the network card interface type to a PCIe register corresponding to the hardware architecture.
[0097] Furthermore, the present application also discloses an electronic device. Figure 5 This is a structural diagram of an electronic device 20 according to an exemplary embodiment. The content in the diagram cannot be regarded as any limitation on the scope of use of the present application.
[0098] Figure 5 A schematic diagram of the structure of an electronic device 20 provided in an embodiment of the present application. The electronic device 20 may specifically include: at least one processor 21, at least one memory 22, a power supply 23, a communication interface 24, an input / output interface 25, and a communication bus 26. The memory 22 is used to store a computer program, which is loaded and executed by the processor 21 to implement the relevant steps in the PXE boot method of the unified extensible firmware interface disclosed in any of the aforementioned embodiments. In addition, the electronic device 20 in this embodiment may specifically be an electronic computer.
[0099] In this embodiment, the power supply 23 is used 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 it follows is any communication protocol that can be applied to the technical solution of the present application, and is not specifically limited here; the input and output interface 25 is used to obtain external input data or output data to the outside world, and its specific interface type can be selected according to specific application needs and is not specifically limited here.
[0100] In addition, the memory 22, as a carrier for storing resources, can be a read-only memory, a random access memory, a disk or an optical disk, etc. The resources stored thereon can include an operating system 221, a computer program 222, etc., and the storage method can be temporary storage or permanent storage.
[0101] The operating system 221 is used to manage and control the hardware devices on the electronic device 20 and the computer program 222, which can be Windows Server, Netware, Unix, Linux, etc. In addition to including a computer program that can be used to complete the PXE boot method of the unified extensible firmware interface executed by the electronic device 20 disclosed in any of the aforementioned embodiments, the computer program 222 can further include a computer program that can be used to complete other specific tasks.
[0102] Furthermore, the present application also discloses a computer-readable storage medium for storing a computer program; wherein, when the computer program is executed by a processor, the PXE boot method of the unified extensible firmware interface disclosed above is implemented. For the specific steps of the method, reference can be made to the corresponding contents disclosed in the above embodiments, and no further description will be given here.
[0103] Furthermore, an embodiment of the present application also discloses a computer program product, including a computer program / instruction, which, when executed by a processor, implements the steps of the PXE boot method of the unified extensible firmware interface as disclosed above.
[0104] In this specification, each embodiment is described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the embodiments can be referred to each other. For the device disclosed in the embodiment, since it corresponds to the method disclosed in the embodiment, the description is relatively simple, and the relevant parts can be referred to the method part.
[0105] Professionals may further appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of the two. In order to clearly illustrate the interchangeability of hardware and software, the composition and steps of each example have been generally described in the above description according to function. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professionals and technicians may use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this application.
[0106] The steps of the method or algorithm described in conjunction with the embodiments disclosed herein may be implemented directly using hardware, a software module executed by a processor, or a combination of the two. The software module may 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 disk, a CD-ROM, or any other form of storage medium known in the art.
[0107] Finally, it should be noted that, in this article, relational terms such as first and second, etc. 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 these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the presence of other identical elements in the process, method, article or device including the elements.
[0108] The PXE boot method, device, equipment and medium of the unified extensible firmware interface provided by the present application are introduced in detail above. Specific examples are used in this article to illustrate the principles and implementation methods of the present application. The description of the above embodiments is only used to help understand the method of the present application and its core idea. At the same time, for general technical personnel in this field, according to the idea of the present application, there will be changes in the specific implementation method and application scope. In summary, the content of this specification should not be understood as a limitation on the present application.
Claims
1. A PXE boot method of a unified extensible firmware interface, characterized in that: Applicable to computer systems based on multi-core processor architecture, including: When detecting that the Unified Extensible Firmware Interface firmware is booting, loading the pre-created driver compatibility component; The configuration register of the multi-core architecture processor in the current system is read through the driver compatible component to obtain the hardware architecture of the current system, and a timer event and a corresponding callback function are created to scan whether a USB network card is connected through the timer event. If a USB network card is connected, the callback function is executed to obtain the network card interface type of the USB network card by reading the configuration register of the USB network card, and determine whether the network card interface type matches the hardware architecture. If the network card interface type does not match the hardware architecture, the interface matching flag is set to false; Loading a register mapping component in the driver compatible component to obtain the interface matching identifier through the register mapping component, and when the interface matching identifier is false, mapping the configuration register corresponding to the network card interface type to the configuration register corresponding to the hardware architecture; The USB network card is initialized based on the driver of the USB network card and the configuration register corresponding to the mapped hardware architecture, and the operating system is loaded through a boot loader to implement PXE boot of the unified extensible firmware interface firmware.
2. The PXE boot method of the unified extensible firmware interface according to claim 1, characterized in that: When the unified extensible firmware interface firmware is detected to be started, the pre-created driver compatible component is loaded, including: When detecting that the unified extensible firmware interface firmware is started, initializing the hardware in the current system; When it is detected that the hardware initialization operation is completed, a pre-created driver compatible component is loaded.
3. The PXE boot method of the unified extensible firmware interface according to claim 1, characterized in that: The creating of a timer event and a corresponding callback function to scan whether a USB network card is connected through the timer event includes: A timer event and a corresponding callback function are created, and an event cycle of the timer event is set, so as to scan whether a USB network card is connected through the timer event and according to the event cycle.
4. The PXE boot method of the unified extensible firmware interface according to claim 1, characterized in that: The multi-core architecture processor, the USB network card, and each of the configuration registers are located in the hardware layer, the driver of the USB network card is located in the network card driver layer, and the driver compatibility component is located between the hardware layer and the network card driver layer.
5. The PXE boot method of the unified extensible firmware interface according to claim 1, characterized in that: The obtaining the network card interface type of the USB network card by reading the configuration register of the USB network card includes: The current connection status of the USB network card is obtained. If the connection status is in place, the configuration register of the USB network card is read to identify the network card interface type of the USB network card.
6. The PXE boot method of the unified extensible firmware interface according to claim 1, characterized in that: Also includes: If the network card interface type matches the hardware architecture, setting the interface matching flag to true; Loading a register mapping component in the driver compatibility component to obtain the interface matching identifier through the register mapping component, and when the interface matching identifier is true, determining the configuration register corresponding to the hardware architecture, and initializing the USB network card based on the driver of the USB network card and the configuration register corresponding to the hardware architecture, and then loading the operating system through the boot loader to implement PXE booting of the unified extensible firmware interface firmware; Correspondingly, the USB network card is initialized based on the driver of the USB network card and the configuration register corresponding to the hardware architecture, and then the operating system is loaded through the boot loader to implement the PXE boot of the unified extensible firmware interface firmware, including: Loading the driver of the USB network card, and accessing the configuration register corresponding to the hardware architecture during the loading process to realize the initialization and data transmission functions of the USB network card; the initialization process of the USB network card includes the configuration of network card parameters, the setting of network parameters and the establishment of data channels; When it is monitored that the USB network card is initialized, the operating system image of the current system is downloaded through the boot loader and the network, and the operating system image is started to achieve PXE startup of the unified extensible firmware interface firmware.
7. The PXE boot method of the unified extensible firmware interface according to any one of claims 1 to 6, characterized in that: When the interface matching flag is false, mapping the configuration register corresponding to the network card interface type to the configuration register corresponding to the hardware architecture includes: When the interface matching flag is false, mapping the PCIe register corresponding to the network card interface type to the MMIO register corresponding to the hardware architecture; Or, the MMIO register corresponding to the network card interface type is mapped to the PCIe register corresponding to the hardware architecture.
8. A PXE boot device with unified extensible firmware interface, characterized in that: Applicable to computer systems based on multi-core processor architecture, including: A loading module, used for loading a pre-created driver compatible component when detecting that the unified extensible firmware interface firmware is started; A reading module, used for reading the configuration register of the multi-core architecture processor in the current system through the driver compatible component to obtain the hardware architecture of the current system, and creating a timer event and a corresponding callback function to scan whether a USB network card is connected through the timer event. If a USB network card is connected, the callback function is executed to obtain the network card interface type of the USB network card by reading the configuration register of the USB network card, and determine whether the network card interface type matches the hardware architecture. If the network card interface type does not match the hardware architecture, the interface matching flag is set to false; A loading module, used for loading a register mapping component in the driver compatible component, so as to obtain the interface matching identifier through the register mapping component, and when the interface matching identifier is false, mapping the configuration register corresponding to the network card interface type to the configuration register corresponding to the hardware architecture; The PXE boot module is used to initialize the USB network card based on the driver of the USB network card and the configuration register corresponding to the mapped hardware architecture, and load the operating system through the boot loader to realize the PXE boot of the unified extensible firmware interface firmware.
9. An electronic device, characterized in that: It comprises a processor and a memory; wherein, when the processor executes the computer program stored in the memory, the PXE boot method of the unified extensible firmware interface as claimed in any one of claims 1 to 7 is implemented.
10. A computer-readable storage medium, characterized in that: Used to store computer programs; wherein, when the computer program is executed by a processor, the PXE boot method of the unified extensible firmware interface according to any one of claims 1 to 7 is implemented.
Citation Information
Cited By
External plug-in card control method and device, computer equipment and storage medium
CN119739652A
External card control method, device, computer equipment and storage medium
CN119739652B
