Resource allocation and positioning method, electronic device, storage medium and product
By obtaining and comparing the resource allocation text files of BIOS and OS, the problem of incorrect resource allocation of PCIe equipment in product research and development is solved, and the effect of rapid positioning and reducing R&D costs is achieved.
Patent Information
- Application Number
- CN202411488099.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-23
- Publication Date
- 2025-02-25
- Estimated Expiration
- 2044-10-23
AI Technical Summary
During the product development process, the problem of incorrect allocation of PCIe equipment resources by BIOS and OS is difficult to quickly define, resulting in high communication costs and long analysis time.
By obtaining text files when resource allocation is allocated by the basic input and output system (BIOS) and operating system (OS), and comparing the resource allocation information and configuration space information in the two, we can locate the area of the problem of incorrect resource allocation.
This method can quickly locate the areas of resource allocation problems, reduce communication costs and analysis time, and improve the analysis rate during R&D.
Smart Images

Figure CN119003190B_ABST
Abstract
Description
Technical Field
[0001] Embodiments of the present invention relate to the field of computer technology, and in particular, to a resource allocation and positioning method, an electronic device, a computer-readable storage medium, and a computer program product. Background Art
[0002] In the process of product development, some problems of incorrect resource allocation of PCIe (Peripheral Component Interconnect Express, a high-speed serial computer expansion bus standard) devices are often tested. However, resource allocation involves the initialization and resource allocation of PCIe devices by BIOS (Basic Input Output System), as well as the redistribution of PCIe devices by OS (Operating System) after entering OS (Operating System), so it is often difficult to quickly identify whether these incorrect resource allocations are BIOS allocation problems or OS allocation problems. In related technologies, BIOS engineers are usually asked to first determine whether BIOS resource allocation is incorrect based on the serial port log of the code for the initialization and resource reservation of PCIe devices printed by the BIOS serial port, and the resource allocation information under the BIOS Shell, and then give it to OS engineers to analyze the PCIe device resource allocation information under the OS.
[0003] Therefore, this kind of problem analysis involving different fields in the product development process often requires a lot of time on communication, and may lead to unnecessary analysis due to uncertainty about the specific areas of the problem, thereby increasing the time cost of R&D. Summary of the invention
[0004] The embodiments of the present invention provide a resource allocation and positioning method, an electronic device, a computer-readable storage medium, and a computer program product to solve the problem of high communication costs and long analysis time during product development, due to the difficulty in quickly defining the incorrect allocation of PCIe device resources by BIOS and OS.
[0005] The embodiment of the present invention discloses a resource allocation and positioning method, wherein the resource allocation involves a basic input and output system and an operating system, and the resources obtained by the basic input and output system after performing initial resource allocation are sent to the operating system for secondary resource allocation, and the method includes:
[0006] Acquire a first text file corresponding to the basic input and output system when performing the initial resource allocation, and a second text file corresponding to the operating system when performing the secondary resource allocation;
[0007] Comparing the first text file with the second text file to obtain a comparison result;
[0008] The target system is located according to the comparison result; the target system is the basic input and output system or the operating system.
[0009] Optionally, the obtaining of a first text file corresponding to the basic input / output system when performing the initial resource allocation and a second text file corresponding to the operating system when performing the secondary resource allocation includes:
[0010] Obtain first resource allocation information in the first text file and second resource allocation information in the second text file; the first resource allocation information is the resource allocation information of the basic input / output system when performing the initial resource allocation, and the second resource allocation information is the resource allocation information of the operating system when performing the secondary resource allocation.
[0011] Optionally, after acquiring the first resource allocation information in the first text file and the second resource allocation information in the second text file, the method further includes:
[0012] Obtain configuration space information corresponding to the first resource allocation information in the first text file, and configuration space information corresponding to the second resource allocation information in the second text file; the basic input and output system performs initial resource allocation based on the configuration space information corresponding to the first resource allocation information, and the operating system performs secondary resource allocation based on the configuration space information corresponding to the first resource allocation information.
[0013] Optionally, before obtaining the first text file corresponding to the basic input and output system when performing the initial resource allocation and the second text file corresponding to the operating system when performing the secondary resource allocation, the method further includes:
[0014] Constructing a first interrupt interface and a first program under the basic input and output system, and constructing a second interrupt interface and a second program under the operating system;
[0015] Linking the first interrupt interface with the first program, and linking the second interrupt interface with the second program;
[0016] Acquiring the first resource allocation information through the first interrupt interface, and acquiring the second resource allocation information through the second interrupt interface;
[0017] The first resource allocation information is stored in the first text file through the first program, and the second resource allocation information is stored in the second text file through the second program.
[0018] Optionally, after storing the first resource allocation information in the first text file by the first program, and storing the second resource allocation information in the second text file by the second program, the method further includes:
[0019] Adding configuration space commands in the first program and the second program respectively;
[0020] obtaining configuration space information corresponding to the first resource allocation information through a configuration space command in the first program, and storing the configuration space information corresponding to the first resource allocation information in the first text file; and obtaining configuration space information corresponding to the second resource allocation information through a configuration space command in the second program, and storing the configuration space information corresponding to the second resource allocation information in the second text file.
[0021] Optionally, comparing the first text file and the second text file to obtain a comparison result includes:
[0022] Comparing the first resource allocation information with the second resource allocation information to obtain a first comparison result;
[0023] Comparing the configuration space information corresponding to the first resource allocation information with the configuration space information corresponding to the second resource allocation information to obtain a second comparison result;
[0024] The first comparison result and the second comparison result are used as the comparison result.
[0025] Optionally, locating the target system according to the comparison result includes:
[0026] When both the first comparison result and the second comparison result are the first preset result, or when the first comparison result is the second preset result and the second comparison result is the first preset result, the target system is located as the basic input and output system; the first preset result is used to indicate data consistency, and the second preset result is used to indicate data inconsistency;
[0027] When the first comparison result is the first preset result and the second comparison result is the second preset result, the target system is located as the operating system;
[0028] When both the first comparison result and the second comparison result indicate that the data are inconsistent, the target system is located according to the first comparison result and the second comparison result.
[0029] Optionally, locating the target system according to the first comparison result and the second comparison result includes:
[0030] determining inconsistent data between the first resource allocation information and the second resource allocation information as first data;
[0031] determining inconsistent data in the configuration space information corresponding to the first resource allocation information and the configuration space information corresponding to the second resource allocation information as second data;
[0032] The target system is located according to the first data and the second data.
[0033] Optionally, locating the target system according to the first data and the second data includes:
[0034] When the first data and the second data are caused by the basic input and output system, locating the target system as the basic input and output system;
[0035] When the first data and the second data are caused by the operating system, the target system is located as the operating system.
[0036] Optionally, when the first program is executed, the first program calls the first interrupt interface to store the first resource allocation information in the first text file; when the second program is executed, the second program calls the second interrupt interface to store the second resource allocation information in the second text file.
[0037] Optionally, the first resource allocation information and the second resource allocation information respectively include: a resource base address, an input and output resource size, resource mapping information, a resource enumeration part, and a resource allocation part.
[0038] Optionally, the first text file is saved in the same path as the first program, and the second text file is saved in the same path as the second program.
[0039] The embodiment of the present invention further discloses an electronic device, comprising a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory communicate with each other via the communication bus;
[0040] The memory is used to store computer programs;
[0041] The processor is used to implement the method described in the embodiment of the present invention when executing the program stored in the memory.
[0042] The embodiment of the present invention further discloses a computer-readable storage medium having instructions stored thereon, which, when executed by one or more processors, enables the processors to execute the method described in the embodiment of the present invention.
[0043] The embodiment of the present invention further discloses a computer program product, which is stored in a storage medium and is executed by at least one processor to implement the method described in the embodiment of the present invention.
[0044] The embodiments of the present invention include the following advantages:
[0045] In an embodiment of the present invention, a first text file corresponding to the basic input / output system when performing the initial resource allocation and a second text file corresponding to the operating system when performing the secondary resource allocation are obtained; the first text file and the second text file are compared to obtain a comparison result; and a target system is located according to the comparison result; the target system is the basic input / output system or the operating system.
[0046] The embodiment of the present invention can avoid the risk that BIOS engineers and OS engineers need to add or open serial port printing information and re-flash the version after encountering the problem of incorrect resource allocation by directly obtaining the text files corresponding to the PCIe device resource allocation under the basic input and output system and the operating system, thereby shortening the problem analysis time, simplifying the problem analysis process, and avoiding the information communication time and information deviation problems between different fields, reducing the communication cost, and thus improving the problem analysis rate in the research and development process. In addition, by comparing the text files corresponding to the resource allocation under the basic input and output system and the operating system, the field to which the problem of incorrect resource allocation belongs can be quickly located, avoiding waste of resources and time, and further improving the problem analysis rate in the research and development process. BRIEF DESCRIPTION OF THE DRAWINGS
[0047] Figure 1 It is a hardware architecture diagram applied to a resource allocation and positioning method provided in an embodiment of the present invention;
[0048] Figure 2 It is a schematic diagram of a basic input / output system and an operating system performing resource allocation provided in an embodiment of the present invention;
[0049] Figure 3 is a schematic diagram of an application environment provided in an embodiment of the present invention;
[0050] Figure 4 is a flowchart of a method for allocating and locating resources provided in an embodiment of the present invention;
[0051] Figure 5is a schematic diagram of a process of obtaining a first text file in a basic input and output system provided in an embodiment of the present invention;
[0052] Figure 6 is a schematic diagram of a process of obtaining a second text file in an operating system provided in an embodiment of the present invention;
[0053] Figure 7 is a schematic diagram of the hardware structure of an electronic device for implementing various embodiments of the present invention;
[0054] Figure 8 is a schematic diagram of a computer-readable medium provided in an embodiment of the present invention. DETAILED DESCRIPTION
[0055] In order to make the above-mentioned objects, features and advantages of the present invention more obvious and easy to understand, the present invention is further described in detail below with reference to the accompanying drawings and specific embodiments.
[0056] As the most basic and direct hardware setting and control manager of the server motherboard, BIOS can provide more simple and easy-to-use functions for the server. BIOS is a bridge connecting hardware devices and software programs. During the boot process, BIOS first performs self-test initialization on the hardware devices. The self-test process includes self-testing the CPU, memory, motherboard, serial and parallel ports, and hard disk devices, and loading drivers such as PCIe devices and I / O devices. PCIe is a local bus of the processor system. Its main purpose is to connect external devices in the processor system. The PCIe link uses an end-to-end data transmission method. In a PCIe link, the two ports are completely equivalent, connecting the sending and receiving devices respectively, and a section of a PCIe link can only connect one sending device or one receiving device. The PCIe links that can be expanded by different processors vary depending on the processor design and support capabilities. Different server manufacturers use the expanded PCIe links of the processor differently. According to the hardware design of different hardware, the design and use of the processor PCIe link are also inconsistent. Different external devices are connected using PCIe links for different hardware designs, and different hardware PCIe devices have different support for PCIe link capabilities based on their own designs.
[0057] Reference Figure 1, showing a hardware architecture diagram applied to a resource allocation and positioning method provided in an embodiment of the present invention, a central processing unit (CPU) is connected to a basic input and output system (BIOS) through a serial peripheral interface (SPI), and is responsible for the main computing tasks, and the central processing unit is also connected to a baseboard management controller (BMC) and a complex programmable logic device (CPLD) through an enhanced serial peripheral interface (eSPI), and the baseboard management controller communicates with the complex programmable logic device through a serial bus (I2C), and the first selection signal and the second selection signal are used to represent the selection signal between the baseboard management controller and the complex programmable logic device.
[0058] Specifically, in resource allocation, BMC and CPLD are responsible for monitoring various status information of the system, such as load, temperature, power consumption, etc. This information is transmitted to the CPU through the I2C bus. After receiving this status information, the CPU sends this information to the BIOS through the SPI interface so that the BIOS can decide how to allocate resources based on the received status information.
[0059] Reference Figure 2 , shows a schematic diagram of a basic input / output system and an operating system performing resource allocation provided in an embodiment of the present invention. The basic input / output system is responsible for initializing the device and loading the startup items. After completing the hardware initialization, the control is handed over to the operating system. The operating system is responsible for managing computer resources (resource management) and task scheduling (process management) to ensure the normal operation of the system.
[0060] Specifically, during the server startup process, BIOS is responsible for allocating system resources, including allocating resources for PCIe devices. During the startup process, BIOS will scan all PCIe bridges and devices according to the PCIe topology and perform Bus / IO / Mmio (Memory-Mapped I / O) resource allocation to ensure the normal operation of the system. During the startup process, after BIOS loads and completes the initialization of each device in the system, BIOS will load BootLoader from the hard disk. After BIOS puts BootLoader from the hard disk into the memory, the controller of CPU (Central Processing Unit) is also transferred to BootLoader, and then BootLoader loads functions, and then OS will take over the control of CPU. After OS takes over the control of CPU, it will reallocate resources to the devices initialized by BIOS to ensure that each device can work normally under OS. That is, the resources obtained by the basic input / output system after the initial resource allocation are sent to the operating system for secondary resource allocation. Therefore, the problem of incorrect PCIe device resource allocation mentioned in the embodiment of the present invention may exist in the basic input / output system or the operating system.
[0061] Reference Figure 3 , showing a schematic diagram of an application environment provided in an embodiment of the present invention, a first interrupt interface (SMI interface) and a first program are created in a basic input / output system (BIOS), and a second interrupt interface (SMI interface) and a second program are created in an operating system (OS). Therefore, if the problem of incorrect PCIe device resource allocation occurs during product development, the embodiment of the present invention can directly obtain text files corresponding to PCIe device resource allocation under the basic input / output system and the operating system through the first program and the second program. By comparing the text files corresponding to resource allocation under the basic input / output system and the operating system, the field to which the resource allocation problem belongs can be quickly located, thereby avoiding waste of resources and time, and further improving the problem analysis rate during the development process.
[0062] Reference Figure 4 , shows a flow chart of the steps of a resource allocation and positioning method provided in an embodiment of the present invention, which may specifically include the following steps:
[0063] Step 401: Obtain a first text file corresponding to the basic input and output system when performing the initial resource allocation, and a second text file corresponding to the operating system when performing the secondary resource allocation;
[0064] In one embodiment of the present invention, the system resource allocation information is continuously monitored by a monitoring tool. When resource conflicts or unallocated resources are automatically detected, it can be considered that there is a problem of incorrect resource allocation. Then, when the problem of incorrect resource allocation is found, the first program and the second program are automatically executed to obtain text files of the initial and secondary resource allocations. This can not only reduce the time and complexity of manual operations and avoid human errors, but also quickly respond to resource allocation problems, immediately obtain the required text files, shorten the time for problem locating, and further improve the problem analysis rate during the research and development process.
[0065] In one embodiment of the present invention, the problem of incorrect resource allocation can also be discovered by manually observing the system behavior. Specifically, the system can be manually observed to see if there are abnormal behaviors, such as system crashes, unrecognized devices, performance degradation, etc.; or the system logs (such as operating system logs, device manager logs) can be checked to find error messages or warnings related to resource allocation; each hardware device can also be manually tested to ensure that each hardware device can work properly. If some devices cannot work properly, there may be a problem of incorrect resource allocation; system tools (such as lspci, lsusb, dmidecode, etc.) can also be used to view system resource allocation information and manually check whether there are resource conflicts or unallocated resources.
[0066] like Figure 3 As shown, the first program runs in the BIOS (Basic Input Output System) environment and is responsible for obtaining detailed information about the initial resource allocation by the BIOS to generate a detailed text file (the first text file) that records all details of the initial resource allocation. The second program runs in the OS (Operating System) environment and is responsible for obtaining detailed information about the secondary resource allocation by the OS to generate another detailed text file (the second text file) that records all details of the secondary resource allocation. The initial resource allocation usually occurs when the computer starts, including the allocation of memory addresses, interrupt requests (IRQs), direct memory access (DMA) channels, etc. to various hardware devices. The secondary resource allocation occurs after the OS starts, and the OS will further allocate and manage resources based on the resources allocated by the BIOS.
[0067] The embodiment of the present invention directly obtains the text files corresponding to the PCIe device resource allocation under the basic input and output system and the operating system, thereby avoiding the risk that BIOS engineers and OS engineers need to add or open serial port printing information and re-flash the version after encountering the problem of incorrect resource allocation, shortening the problem analysis time, simplifying the problem analysis process, and avoiding the information communication time and information deviation problems between different fields, reducing communication costs, and thereby improving the problem analysis rate in the research and development process.
[0068] Step 402: Compare the first text file and the second text file to obtain a comparison result;
[0069] In an embodiment of the present invention, by comparing the contents of two text files, the differences between the two, that is, the comparison results, can be found, including differences in resource allocation, differences in configuration parameters, differences in device status, etc., and these differences help to identify the root cause of the problem of incorrect resource allocation.
[0070] Step 403: locate the target system according to the comparison result; the target system is the basic input and output system or the operating system.
[0071] In the embodiment of the present invention, according to the difference reflected in the comparison result, it can be determined whether the problem of incorrect resource allocation is caused by the primary resource allocation of the BIOS or the secondary resource allocation of the operating system.
[0072] If the comparison result shows that there is a problem with the initial resource allocation (the first text file), such as resource conflict, incorrect allocation, etc., the problem may occur in the basic input and output system, and the target system is the basic input and output system at this time; if the comparison result shows that there is a problem with the secondary resource allocation (the second text file), such as repeated resource allocation, configuration error, etc., the problem may occur in the operating system, and the target system is the operating system at this time.
[0073] Of course, if the comparison result does not reflect the difference between the two text files, and there is an incorrect resource allocation problem, it means that the operating system did not modify or adjust the initial resource allocation during the secondary resource allocation. Since the secondary resource allocation depends on the result of the primary resource allocation, if there is a problem with the primary resource allocation, the operating system will also encounter resource conflicts, unallocated resources and other problems during the secondary allocation. At this time, it can be directly determined that there is a problem with the primary resource allocation, that is, the problem occurs in the basic input and output system, and the target system at this time is the basic input and output system.
[0074] The embodiment of the present invention can quickly locate the field to which the problem of incorrect resource allocation belongs by comparing the text files corresponding to the resource allocation under the basic input and output system and the operating system, thereby avoiding waste of resources and time and further improving the problem analysis rate in the research and development process.
[0075] In an embodiment of the present invention, the step of obtaining a first text file corresponding to the basic input / output system when performing the initial resource allocation and a second text file corresponding to the operating system when performing the secondary resource allocation includes:
[0076] Obtain first resource allocation information in the first text file and second resource allocation information in the second text file; the first resource allocation information is the resource allocation information of the basic input / output system when performing the initial resource allocation, and the second resource allocation information is the resource allocation information of the operating system when performing the secondary resource allocation.
[0077] In an embodiment of the present invention, the first program will generate a detailed text file (first text file) during execution, and the first text file will include all details of the initial resource allocation, that is, the first resource allocation information; the second program will generate another detailed text file (second text file) during execution, and the second text file will include all details of the secondary resource allocation, that is, the second resource allocation information.
[0078] The embodiment of the present invention obtains detailed information of primary and secondary resource allocation (first resource allocation information, second resource allocation information) to provide basic data for subsequent comparison and problem location, which can effectively reduce communication costs, improve the efficiency of problem location, and thus accelerate the process of product development.
[0079] In an embodiment of the present invention, the first resource allocation information and the second resource allocation information respectively include: a resource base address, an input and output resource size, resource mapping information, a resource enumeration part, and a resource allocation part.
[0080] In the embodiment of the present invention, the first resource allocation information and the second resource allocation information respectively include the following contents:
[0081] Resource Base Address: The starting address of resource allocation. In the primary resource allocation (BIOS) and secondary resource allocation (OS), each resource (such as memory address, input / output address, etc.) has a base address. The base address is used to determine the location of the resource in the system and is the basis for resource allocation. For example, the memory base address of a PCIe device is 0x80000000, which means that the memory resources of the device are allocated starting from address 0x80000000.
[0082] Required IO resource size (input and output resource size): the capacity or range of resource allocation. In the primary resource allocation (BIOS) and secondary resource allocation (OS), each resource (such as memory, input and output ports, etc.) has a size. The resource size is used to determine the scope of resource use and is an important parameter for resource allocation. For example, the input and output resource size of a PCIe device is 0x1000, which means that the input and output resources of the device occupy 0x1000 address space.
[0083] The situation where the resources of the PCIe device fall into the CPU resource range (resource mapping information): The mapping situation of the resources of the PCIe device (such as memory, input and output ports, etc.) in the system, especially whether these resources fall into the resource range of the CPU (such as memory address space, input and output address space, etc.). This mapping situation is used to determine the specific location and usage of the resources of the PCIe device in the system to ensure that the CPU can correctly access these resources. For example, the memory resources of a PCIe device are mapped to the memory address space of the CPU from 0x80000000 to 0x80001000, indicating that the memory resources of the device can be accessed by the CPU.
[0084] PCIe resource enumeration section (resource enumeration section): The process of enumerating and identifying all PCIe resources in the system. In the primary resource allocation (BIOS) and secondary resource allocation (OS), the system needs to enumerate all available PCIe resources and identify each resource. The resource enumeration section is used to determine all available PCIe resources in the system and is a prerequisite for resource allocation. For example, the system enumerates all PCIe devices and identifies the resource type and quantity of each device.
[0085] PCIe resource allocation part (resource allocation part): The specific allocation process of PCIe resources. In the primary resource allocation (BIOS) and secondary resource allocation (OS), the system needs to make specific resource allocations based on the resource requirements and available resources of the PCIe device. The resource allocation part is used to determine the allocation result of each PCIe resource and is the core of resource allocation. For example, the system allocates corresponding memory addresses, input and output addresses, and interrupt requests based on the resource requirements of the PCIe device.
[0086] In an embodiment of the present invention, the first text file is saved in the same path as the first program, and the second text file is saved in the same path as the second program.
[0087] In the embodiment of the present invention, in order to simplify path management, the text file and the program are placed in the same directory to achieve the same storage path. Therefore, when the program reads or writes the text file, it can directly use the relative path without specifying the absolute path. In addition, placing the text file and the program in the same directory can quickly locate and access related files in the same path when the program is executed, reducing the time for searching files, thereby improving the problem analysis rate during the research and development process.
[0088] In an embodiment of the present invention, after acquiring the first resource allocation information in the first text file and the second resource allocation information in the second text file, the method further includes:
[0089] Obtain configuration space information corresponding to the first resource allocation information in the first text file, and configuration space information corresponding to the second resource allocation information in the second text file; the basic input and output system performs initial resource allocation based on the configuration space information corresponding to the first resource allocation information, and the operating system performs secondary resource allocation based on the configuration space information corresponding to the first resource allocation information.
[0090] In the process of resource allocation and positioning, it is very important to obtain configuration space information. Therefore, in an embodiment of the present invention, when the first program and the second program are executed, in addition to obtaining the first resource allocation information and the second resource allocation information, it is also necessary to obtain the configuration space information corresponding to the first resource allocation information and the configuration space information corresponding to the second resource allocation information.
[0091] Configuration space information refers to the hardware configuration space information related to resource allocation, which usually includes the device's configuration registers, status registers, control registers, etc. This information is used to describe the configuration and status of the hardware device and reflects the actual execution of resource allocation.
[0092] Configuration space information provides detailed configuration and status of hardware devices, which can fully understand the actual implementation of resource allocation. If only resource allocation information is obtained, it may not fully reflect the configuration and status of hardware devices, and thus resource allocation positioning cannot be correctly performed.
[0093] By acquiring configuration space information, the embodiments of the present invention can fully understand the actual execution of resource allocation, locate hardware configuration problems, and verify the correctness of resource allocation. It can effectively reduce communication costs, improve the efficiency of problem location, and thus accelerate the process of product development.
[0094] In an embodiment of the present invention, before obtaining the first text file corresponding to the basic input and output system when performing the initial resource allocation and the second text file corresponding to the operating system when performing the secondary resource allocation, the method further includes:
[0095] Constructing a first interrupt interface and a first program under the basic input and output system, and constructing a second interrupt interface and a second program under the operating system;
[0096] Linking the first interrupt interface with the first program, and linking the second interrupt interface with the second program;
[0097] Acquiring the first resource allocation information through the first interrupt interface, and acquiring the second resource allocation information through the second interrupt interface;
[0098] The first resource allocation information is stored in the first text file through the first program, and the second resource allocation information is stored in the second text file through the second program.
[0099] In the embodiment of the present invention, firstly, a new SMI (System Management Interrupt) interface (first interrupt interface and second interrupt interface) needs to be created on the BIOS side and the OS side respectively, and the resource allocation information of the PCIe device is collected through the SMI interface, including the resource Base address, the required IO resource size, the situation where the resources of the PCIe device fall into the CPU resource interval, etc. It is also necessary to create a new executable program (first program and second program) on the BIOS side and the OS side respectively. After the executable program is executed, it will be linked to the aforementioned newly created SMI interface, collect and output the resource allocation information, allocation process and allocation result of the PCIe device through the SMI interface, and store the information obtained in the SMI interface into a text file (first text file and second text file) through the executable program.
[0100] In another embodiment of the present invention, the user may manually execute the executable program to obtain resource allocation information of the PCIe device.
[0101] In the embodiment of the present invention, the first interrupt interface and the second interrupt interface are activated only when an executable program is executed under BIOS or OS, and will not affect the normal startup and shutdown of the server in daily use.
[0102] The embodiment of the present invention establishes an SMI interface and an executable program under BIOS and OS respectively, which can not only automatically collect resource allocation information, allocation process and allocation results of PCIe devices, reduce the time and complexity of manual operations, but also reduce the communication cost between different departments (such as BIOS engineers and OS engineers), avoid deviations in information transmission, centrally manage problem location and solution processes, reduce communication and coordination time, improve problem location efficiency, and thus accelerate the process of product development.
[0103] In one embodiment of the present invention, when the first program is executed, the first program calls the first interrupt interface to store the first resource allocation information in the first text file; when the second program is executed, the second program calls the second interrupt interface to store the second resource allocation information in the second text file.
[0104] In an embodiment of the present invention, when the first program and the second program are executed, it is proved that the first resource allocation information and the second resource allocation information need to be obtained at this time. Therefore, the first program needs to call the first interrupt interface and the second program needs to call the second interrupt interface to output the resource allocation information obtained by the interrupt interface and print it into a text file, so that the text file can be directly obtained for resource allocation positioning later.
[0105] In an embodiment of the present invention, after storing the first resource allocation information in the first text file by the first program, and storing the second resource allocation information in the second text file by the second program, the method further includes:
[0106] Adding configuration space commands in the first program and the second program respectively;
[0107] obtaining configuration space information corresponding to the first resource allocation information through a configuration space command in the first program, and storing the configuration space information corresponding to the first resource allocation information in the first text file; and obtaining configuration space information corresponding to the second resource allocation information through a configuration space command in the second program, and storing the configuration space information corresponding to the second resource allocation information in the second text file.
[0108] Since the operating system usually performs permission control on hardware access, ordinary applications cannot directly access the hardware configuration space. Therefore, in the embodiment of the present invention, by adding a configuration space command in the executable program, it can be ensured that the program has sufficient permissions to access the hardware configuration space.
[0109] Specifically, configuration space commands are added to the first program and the second program respectively, and configuration space information corresponding to the first resource allocation information and configuration space information corresponding to the second resource allocation information are obtained through the configuration space commands and then stored in the first text file and the second text file respectively.
[0110] The embodiment of the present invention can comprehensively record the detailed process and results of resource allocation by storing the configuration space information and resource allocation information in the same text file, so that all relevant information can be obtained at one time in the future, avoiding omissions caused by scattered information. It can also simplify the analysis process. When performing file comparison in the future, only the difference between the first text file and the second text file can be analyzed without processing multiple files at the same time. In addition, one system corresponds to one text file, which can reduce the complexity of file management and avoid file loss or confusion.
[0111] In an embodiment of the present invention, comparing the first text file and the second text file to obtain a comparison result includes:
[0112] Comparing the first resource allocation information with the second resource allocation information to obtain a first comparison result;
[0113] Comparing the configuration space information corresponding to the first resource allocation information with the configuration space information corresponding to the second resource allocation information to obtain a second comparison result;
[0114] The first comparison result and the second comparison result are used as the comparison result.
[0115] In the embodiment of the present invention, it is necessary to compare the resource allocation information and the configuration space information in the two text files respectively.
[0116] Specifically, by comparing the first resource allocation information and the second resource allocation information, the difference between the two can be found, and a first comparison result can be obtained. The first comparison result may include changes in the resource base address, changes in the input and output resource size, changes in resource mapping information, etc. The first comparison result is used to characterize whether the first resource allocation information and the second resource allocation information are consistent; by comparing the configuration space information corresponding to the first resource allocation information and the configuration space information corresponding to the second resource allocation information, the difference between the two can be found, and a second comparison result can be obtained. The second comparison result may include changes in configuration registers, changes in status registers, changes in control registers, etc. The second comparison result is used to characterize whether the first configuration space information and the second configuration space information are consistent. Through the comparison results, it can be determined whether the data is consistent, so as to make further judgments, and then locate the field to which the problem of incorrect resource allocation belongs.
[0117] The embodiment of the present invention generates a comparison result by quickly comparing two text files, thereby simplifying the problem location process, and by comparing resource allocation information and configuration space information respectively, it is possible to comprehensively analyze the differences in resource allocation and hardware configuration, thereby improving the accuracy of problem location.
[0118] In an embodiment of the present invention, locating the target system according to the comparison result includes:
[0119] When both the first comparison result and the second comparison result are the first preset result, or when the first comparison result is the second preset result and the second comparison result is the first preset result, the target system is located as the basic input and output system; the first preset result is used to indicate data consistency, and the second preset result is used to indicate data inconsistency;
[0120] When the first comparison result is the first preset result and the second comparison result is the second preset result, the target system is located as the operating system;
[0121] When both the first comparison result and the second comparison result indicate that the data are inconsistent, the target system is located according to the first comparison result and the second comparison result.
[0122] In the embodiment of the present invention, the first preset result is used to characterize data consistency, and the second preset result is used to characterize data inconsistency. Therefore, the comparison result has various situations, as shown below:
[0123] 1) The first comparison result and the second comparison result are both the first preset results
[0124] In this case, if there is a problem of incorrect resource allocation, since BIOS is the initial stage of resource allocation, OS relies on the resource information allocated by BIOS. If the resource information allocated by BIOS is wrong, OS will also get wrong information when reading the configuration space. Therefore, the field of incorrect resource allocation at this time is the basic input and output system (BIOS), that is, the target system is the basic input and output system (BIOS).
[0125] For example, suppose the resource base address of a PCIe device is incorrectly assigned to 0x1000 in the BIOS stage and is also incorrectly adjusted to 0x1000 in the OS stage. At this point, although the resource base addresses in the two text files are consistent, there are obvious errors.
[0126] In this case, consistent resource allocation information and configuration space information can quickly locate the root cause of the BIOS as the incorrect resource allocation problem, reduce misjudgment, and avoid misjudgment of OS problems due to incorrect OS configuration space information.
[0127] 2) The first comparison result is the second preset result, and the second comparison result is the first preset result
[0128] Since the resource allocation information is inconsistent, but the configuration space information is consistent, it means that the problem lies in the resource allocation. The basic input and output system (BIOS) is responsible for initializing resource allocation, so the BIOS can be directly located as the system with incorrect resource allocation problems, that is, the target system is the basic input and output system (BIOS).
[0129] In this case, the inconsistency of resource allocation information can directly locate the BIOS as the root cause of the incorrect resource allocation problem, which simplifies the problem location process and avoids further analysis of configuration space information.
[0130] 3) The first comparison result is the first preset result, and the second comparison result is the second preset result
[0131] Since the resource allocation information is consistent but the configuration space information is inconsistent, it means that the problem lies in the processing of the configuration space. The operating system (OS) is responsible for processing the configuration space information, so the OS can be directly located as the system with incorrect resource allocation problems, that is, the target system is the operating system (OS).
[0132] In this case, the inconsistency of the configuration space information can directly locate the root cause of the incorrect resource allocation problem as the OS, which simplifies the problem location process and avoids further analysis of the resource allocation information.
[0133] 4) The first comparison result and the second comparison result are both the second preset results
[0134] In this case, further analysis of the specific inconsistency is required to determine whether the BIOS or OS has incorrect resource allocation issues. This can accurately locate the system with incorrect resource allocation issues, avoid misjudgment, and simplify the problem location process.
[0135] In an embodiment of the present invention, locating the target system according to the first comparison result and the second comparison result includes:
[0136] determining inconsistent data between the first resource allocation information and the second resource allocation information as first data;
[0137] determining inconsistent data in the configuration space information corresponding to the first resource allocation information and the configuration space information corresponding to the second resource allocation information as second data;
[0138] The target system is located according to the first data and the second data.
[0139] In the embodiment of the present invention, inconsistent data in the first resource allocation information and the second resource allocation information are determined as first data, which reflect the inconsistency of the resource allocation information. Inconsistent data in the configuration space information corresponding to the first resource allocation information and the configuration space information corresponding to the second resource allocation information are determined as second data, which reflect the inconsistency of the configuration space information.
[0140] The target system can be further determined by analyzing the data sources, change trends, and correlations of the first data and the second data. For example, if the changes in the first data and the second data are mainly caused by the BIOS, it can be determined that the BIOS has an incorrect resource allocation problem; if the changes in the first data and the second data are mainly caused by the OS, it can be determined that the OS has an incorrect resource allocation problem.
[0141] The embodiment of the present invention can quickly and accurately locate the target system by analyzing inconsistent data (first data and second data) in the first comparison result and the second comparison result, thereby improving the efficiency and accuracy of problem troubleshooting and enhancing the stability and reliability of the system.
[0142] In an embodiment of the present invention, locating the target system according to the first data and the second data includes:
[0143] When the first data and the second data are caused by the basic input and output system, locating the target system as the basic input and output system;
[0144] When the first data and the second data are caused by the operating system, the target system is located as the operating system.
[0145] In the embodiment of the present invention, the first data and the second data may be analyzed from aspects such as data source, change trend, and correlation to obtain an analysis result, which is used to characterize which system (BIOS or OS) causes the first data and the second data, as described in detail as follows:
[0146] Data source analysis: Analyze the sources of the first data and the second data to determine whether the data are generated by the BIOS or the OS.
[0147] Data change trend analysis: analyzing the change trends of the first data and the second data to determine whether the changes of these data are caused by the BIOS or the OS.
[0148] Data correlation analysis: Analyze the correlation between the first data and the second data to determine whether there is a causal relationship between the changes in these data.
[0149] The embodiment of the present invention can quickly locate the target system by analyzing the first data and the second data, thereby reducing the troubleshooting time; and, through clear analysis steps, it simplifies the problem locating process, making the problem troubleshooting more intuitive and systematic.
[0150] The embodiment of the present invention provides a method for automatically comparing resource allocation under BIOS and OS and realizing rapid problem location. Through an interrupt interface and an executable program, after a PCIe resource allocation failure occurs, BIOS engineers and OS engineers do not need to add or open serial port printing information and re-flash the version, thus saving time for direct communication between different fields and the problem of information deviation between different fields. The field to which the problem belongs can be quickly located, thus avoiding waste of resources and time. After being given the correct field, location analysis can be quickly performed, and solutions can be given, thus reducing problems in the research and development process and improving research and development efficiency.
[0151] Reference Figure 5 , shows a schematic diagram of a process for obtaining a first text file in a basic input and output system provided in an embodiment of the present invention.
[0152] Step 501, creating a first interrupt interface and a first program;
[0153] Step 502: when the first program is executed, first resource allocation information and configuration space information corresponding to the first resource allocation information are obtained and stored in a first text file;
[0154] Step 503: Output the first text file.
[0155] Reference Figure 6 , shows a schematic diagram of a process for obtaining a second text file in an operating system provided in an embodiment of the present invention.
[0156] Step 601, creating a second interrupt interface and a second program;
[0157] Step 602: when the second program is executed, obtain second resource allocation information and configuration space information corresponding to the second resource allocation information, and store them in a second text file;
[0158] Step 603: Output the second text file.
[0159] It should be noted that, for the sake of simplicity, the method embodiments are described as a series of action combinations, but those skilled in the art should be aware that the embodiments of the present invention are not limited by the order of the actions described, because according to the embodiments of the present invention, certain steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should also be aware that the embodiments described in the specification are all preferred embodiments, and the actions involved are not necessarily required by the embodiments of the present invention.
[0160] In addition, an embodiment of the present invention further provides an electronic device, including a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory communicate with each other through the communication bus; the memory is used to store computer programs; the processor is used to implement the various processes of the above-mentioned resource allocation and positioning method embodiment when executing the program stored in the memory, and can achieve the same technical effect. To avoid repetition, it will not be repeated here.
[0161] The embodiment of the present invention further provides a computer-readable storage medium on which instructions are stored, and when executed by one or more processors, the processors execute the various processes of the above-mentioned resource allocation and positioning method embodiment, and can achieve the same technical effect, which will not be described here to avoid repetition. The computer-readable storage medium is, for example, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk, etc.
[0162] An embodiment of the present invention also provides a computer program product, which is stored in a storage medium and is executed by at least one processor to implement the various processes of the above-mentioned resource allocation and positioning method embodiment, and can achieve the same technical effect. To avoid repetition, it will not be repeated here.
[0163] Figure 7 A schematic diagram of the hardware structure of an electronic device for implementing various embodiments of the present invention.
[0164] The electronic device 700 includes but is not limited to: a radio frequency unit 701, a network module 702, an audio output unit 703, an input unit 704, a sensor 705, a display unit 706, a user input unit 707, an interface unit 708, a memory 709, a processor 710, and a power supply 711. Those skilled in the art will appreciate that Figure 7 The electronic device structure shown in the figure does not constitute a limitation on the electronic device, and the electronic device may include more or fewer components than shown in the figure, or combine certain components, or arrange the components differently. In the embodiments of the present invention, the electronic device includes but is not limited to a mobile phone, a tablet computer, a laptop computer, a PDA, a vehicle-mounted terminal, a wearable device, and a pedometer.
[0165] It should be understood that in the embodiment of the present invention, the radio frequency unit 701 can be used for receiving and sending signals during information transmission or communication. Specifically, after receiving downlink data from the base station, it is sent to the processor 710 for processing; in addition, uplink data is sent to the base station. Generally, the radio frequency unit 701 includes but is not limited to an antenna, at least one amplifier, a transceiver, a coupler, a low noise amplifier, a duplexer, etc. In addition, the radio frequency unit 701 can also communicate with the network and other devices through a wireless communication system.
[0166] The electronic device provides users with wireless broadband Internet access through the network module 702, such as helping users to send and receive emails, browse web pages, and access streaming media.
[0167] The audio output unit 703 can convert the audio data received by the RF unit 701 or the network module 702 or stored in the memory 709 into an audio signal and output it as sound. Moreover, the audio output unit 703 can also provide audio output related to a specific function performed by the electronic device 700 (for example, a call signal reception sound, a message reception sound, etc.). The audio output unit 703 includes a speaker, a buzzer, a receiver, etc.
[0168] The input unit 704 is used to receive audio or video signals. The input unit 704 may include a graphics processor (GPU) 7041 and a microphone 7042. The graphics processor 7041 processes the image data of a static picture or video obtained by an image capture device (such as a camera) in a video capture mode or an image capture mode. The processed image frame can be displayed on the display unit 706. The image frame processed by the graphics processor 7041 can be stored in the memory 709 (or other storage medium) or sent via the radio frequency unit 701 or the network module 702. The microphone 7042 can receive sound and can process such sound into audio data. The processed audio data can be converted into a format output that can be sent to a mobile communication base station via the radio frequency unit 701 in the case of a telephone call mode.
[0169] The electronic device 700 also includes at least one sensor 705, such as a light sensor, a motion sensor, and other sensors. Specifically, the light sensor includes an ambient light sensor and a proximity sensor, wherein the ambient light sensor can adjust the brightness of the display panel 7061 according to the brightness of the ambient light, and the proximity sensor can turn off the display panel 7061 and / or the backlight when the electronic device 700 is moved to the ear. As a type of motion sensor, the accelerometer sensor can detect the magnitude of acceleration in each direction (generally three axes), and can detect the magnitude and direction of gravity when stationary, which can be used to identify the posture of the electronic device (such as horizontal and vertical screen switching, related games, magnetometer posture calibration), vibration recognition related functions (such as pedometer, tapping), etc.; the sensor 705 can also include a fingerprint sensor, a pressure sensor, an iris sensor, a molecular sensor, a gyroscope, a barometer, a hygrometer, a thermometer, an infrared sensor, etc., which will not be repeated here.
[0170] The display unit 706 is used to display information input by the user or information provided to the user. The display unit 706 may include a display panel 7061, which may be configured in the form of a liquid crystal display (LCD), an organic light-emitting diode (OLED), or the like.
[0171] The user input unit 707 can be used to receive input digital or character information, and generate key signal input related to user settings and function control of the electronic device. Specifically, the user input unit 707 includes a touch panel 7071 and other input devices 7072. The touch panel 7071, also known as a touch screen, can collect user touch operations on or near it (such as operations performed by users using fingers, styluses, or any other suitable objects or accessories on or near the touch panel 7071). The touch panel 7071 may include two parts: a touch detection device and a touch controller. Among them, the touch detection device detects the user's touch orientation, detects the signal brought by the touch operation, and transmits the signal to the touch controller; the touch controller receives the touch information from the touch detection device, converts it into contact point coordinates, and then sends it to the processor 710, receives the command sent by the processor 710 and executes it. In addition, the touch panel 7071 can be implemented in various types such as resistive, capacitive, infrared, and surface acoustic waves. In addition to the touch panel 7071, the user input unit 707 may also include other input devices 7072. Specifically, other input devices 7072 may include but are not limited to a physical keyboard, function keys (such as volume control keys, switch keys, etc.), a trackball, a mouse, and a joystick, which are not described in detail here.
[0172] Furthermore, the touch panel 7071 may be overlaid on the display panel 7061. When the touch panel 7071 detects a touch operation on or near it, it transmits the information to the processor 710 to determine the type of the touch event. Then, the processor 710 provides a corresponding visual output on the display panel 7061 according to the type of the touch event. Figure 7 In the figure, the touch panel 7071 and the display panel 7061 are used as two independent components to realize the input and output functions of the electronic device. However, in some embodiments, the touch panel 7071 and the display panel 7061 can be integrated to realize the input and output functions of the electronic device, which is not limited here.
[0173] The interface unit 708 is an interface for connecting an external device to the electronic device 700. For example, the external device may include a wired or wireless headset port, an external power supply (or battery charger) port, a wired or wireless data port, a memory card port, a port for connecting a device with an identification module, an audio input / output (I / O) port, a video I / O port, a headphone port, etc. The interface unit 708 may be used to receive input (e.g., data information, power, etc.) from an external device and transmit the received input to one or more elements within the electronic device 700 or may be used to transmit data between the electronic device 700 and an external device.
[0174] The memory 709 can be used to store software programs and various data. The memory 709 can mainly include a program storage area and a data storage area, wherein the program storage area can store an operating system, an application required for at least one function (such as a sound playback function, an image playback function, etc.), etc.; the data storage area can store data created according to the use of the mobile phone (such as audio data, a phone book, etc.), etc. In addition, the memory 709 can include a high-speed random access memory, and can also include a non-volatile memory, such as at least one disk storage device, a flash memory device, or other volatile solid-state storage devices.
[0175] The processor 710 is the control center of the electronic device. It uses various interfaces and lines to connect various parts of the entire electronic device. It executes various functions of the electronic device and processes data by running or executing software programs and / or modules stored in the memory 709, and calling data stored in the memory 709, so as to monitor the electronic device as a whole. The processor 710 may include one or more processing units; preferably, the processor 710 may integrate an application processor and a modem processor, wherein the application processor mainly processes the operating system, user interface, and application programs, and the modem processor mainly processes wireless communications. It is understandable that the above-mentioned modem processor may not be integrated into the processor 710.
[0176] The electronic device 700 may also include a power supply 711 (such as a battery) for supplying power to various components. Preferably, the power supply 711 may be logically connected to the processor 710 via a power management system, thereby implementing functions such as charging, discharging, and power consumption management through the power management system.
[0177] In addition, the electronic device 700 includes some functional modules not shown, which will not be described in detail here.
[0178] like Figure 8 As shown, in another embodiment provided by the present invention, a computer-readable storage medium 801 is further provided, in which instructions are stored. When the computer-readable storage medium is run on a computer, the computer executes the resource allocation and positioning method described in the above embodiment.
[0179] It should be noted that, in this article, the terms "include", "comprises" or any other variations 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, an element defined by the sentence "comprises a ..." does not exclude the existence of other identical elements in the process, method, article or device including the element.
[0180] Through the description of the above implementation methods, those skilled in the art can clearly understand that the above-mentioned embodiment methods can be implemented by means of software plus a necessary general hardware platform, and of course by hardware, but in many cases the former is a better implementation method. Based on such an understanding, the technical solution of the present invention, or the part that contributes to the relevant technology, can be embodied in the form of a software product, which is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk), and includes a number of instructions for a terminal (which can be a mobile phone, computer, server, air conditioner, or network equipment, etc.) to execute the methods described in each embodiment of the present invention.
[0181] The embodiments of the present invention are described above in conjunction with the accompanying drawings, but the present invention is not limited to the above-mentioned specific implementation modes, which are merely illustrative rather than restrictive. Under the guidance of the present invention, ordinary technicians in this field can also make many forms without departing from the scope of protection of the present invention and the claims, all of which are within the protection of the present invention.
[0182] Those of ordinary skill in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed in the embodiments of the present invention can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can 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 the present invention.
[0183] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working processes of the systems, devices and units described above can refer to the corresponding processes in the aforementioned method embodiments and will not be repeated here.
[0184] In the embodiments provided in the present application, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.
[0185] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0186] In addition, each functional unit in each embodiment of the present invention may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit.
[0187] If the functions are implemented in the form of software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, or the part that contributes to the relevant technology or the part of the technical solution, can be embodied in the form of a software product. The computer software product is stored in a storage medium, including several instructions for a computer device (which can be a personal computer, server, or network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes: various media that can store program codes, such as USB flash drives, mobile hard disks, ROM, RAM, magnetic disks or optical disks.
[0188] The above is only a specific embodiment of the present invention, but the protection scope of the present invention is not limited thereto. Any person skilled in the art can easily think of changes or substitutions within the technical scope disclosed by the present invention, which should be included in the protection scope of the present invention. Therefore, the protection scope of the present invention should be based on the protection scope of the claims.
Claims
1. A resource allocation and positioning method, characterized in that: The resource allocation includes allocating resources to the PCIe device, the resource allocation involves a basic input / output system and an operating system, the resources obtained by the basic input / output system after performing the initial resource allocation are sent to the operating system for secondary resource allocation, and the method includes: Acquire a first text file corresponding to the basic input and output system when performing the initial resource allocation for the PCIe device, and a second text file corresponding to the operating system when performing the secondary resource allocation for the PCIe device; Comparing the first text file with the second text file to obtain a comparison result; The target system is located according to the comparison result; the target system is the basic input output system or the operating system; wherein, if the comparison result shows that there are differences between the first text file and the second text file, the target system is determined according to the differences, and if the comparison result shows that there are no differences between the first text file and the second text file, the target system is determined to be the basic input output system.
2. The method according to claim 1, characterized in that The obtaining of a first text file corresponding to when the basic input / output system performs the initial resource allocation for the PCIe device, and a second text file corresponding to when the operating system performs the secondary resource allocation for the PCIe device, includes: Obtain first resource allocation information in the first text file and second resource allocation information in the second text file; the first resource allocation information is the resource allocation information of the basic input / output system when performing the initial resource allocation, and the second resource allocation information is the resource allocation information of the operating system when performing the secondary resource allocation.
3. The method according to claim 2, characterized in that After acquiring the first resource allocation information in the first text file and the second resource allocation information in the second text file, the method further includes: Obtain configuration space information corresponding to the first resource allocation information in the first text file, and configuration space information corresponding to the second resource allocation information in the second text file; the basic input and output system performs initial resource allocation based on the configuration space information corresponding to the first resource allocation information, and the operating system performs secondary resource allocation based on the configuration space information corresponding to the first resource allocation information.
4. The method according to claim 2, characterized in that: Before obtaining the first text file corresponding to the basic input and output system when performing the initial resource allocation for the PCIe device and the second text file corresponding to the operating system when performing the secondary resource allocation for the PCIe device, the method further includes: Constructing a first interrupt interface and a first program under the basic input and output system, and constructing a second interrupt interface and a second program under the operating system; Linking the first interrupt interface with the first program, and linking the second interrupt interface with the second program; Acquiring the first resource allocation information through the first interrupt interface, and acquiring the second resource allocation information through the second interrupt interface; The first resource allocation information is stored in the first text file through the first program, and the second resource allocation information is stored in the second text file through the second program.
5. The method according to claim 4, characterized in that After storing the first resource allocation information in the first text file by the first program, and storing the second resource allocation information in the second text file by the second program, the method further includes: Adding configuration space commands in the first program and the second program respectively; obtaining configuration space information corresponding to the first resource allocation information through a configuration space command in the first program, and storing the configuration space information corresponding to the first resource allocation information in the first text file; and obtaining configuration space information corresponding to the second resource allocation information through a configuration space command in the second program, and storing the configuration space information corresponding to the second resource allocation information in the second text file.
6. The method according to claim 3, characterized in that The comparing the first text file and the second text file to obtain a comparison result includes: Comparing the first resource allocation information with the second resource allocation information to obtain a first comparison result; Comparing the configuration space information corresponding to the first resource allocation information with the configuration space information corresponding to the second resource allocation information to obtain a second comparison result; The first comparison result and the second comparison result are used as the comparison result.
7. The method according to claim 6, characterized in that The locating the target system according to the comparison result includes: When both the first comparison result and the second comparison result are the first preset result, or when the first comparison result is the second preset result and the second comparison result is the first preset result, the target system is located as the basic input and output system; the first preset result is used to indicate data consistency, and the second preset result is used to indicate data inconsistency; When the first comparison result is the first preset result and the second comparison result is the second preset result, the target system is located as the operating system; When both the first comparison result and the second comparison result indicate that the data are inconsistent, the target system is located according to the first comparison result and the second comparison result.
8. The method according to claim 7, characterized in that The locating the target system according to the first comparison result and the second comparison result includes: determining inconsistent data between the first resource allocation information and the second resource allocation information as first data; determining inconsistent data in the configuration space information corresponding to the first resource allocation information and the configuration space information corresponding to the second resource allocation information as second data; The target system is located according to the first data and the second data.
9. The method according to claim 8, characterized in that The locating the target system according to the first data and the second data includes: When the first data and the second data are caused by the basic input and output system, locating the target system as the basic input and output system; When the first data and the second data are caused by the operating system, the target system is located as the operating system.
10. The method according to claim 4, characterized in that When the first program is executed, the first program calls the first interrupt interface to store the first resource allocation information in the first text file; when the second program is executed, the second program calls the second interrupt interface to store the second resource allocation information in the second text file.
11. The method according to claim 2, characterized in that The first resource allocation information and the second resource allocation information respectively include: a resource base address, an input and output resource size, resource mapping information, a resource enumeration part and a resource allocation part.
12. The method according to claim 4, characterized in that The first text file is saved in the same path as the first program, and the second text file is saved in the same path as the second program.
13. An electronic device, characterized in that: It includes a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory communicate with each other through the communication bus; The memory is used to store computer programs; The processor is used to implement the method according to any one of claims 1 to 12 when executing the program stored in the memory.
14. A computer-readable storage medium having instructions stored thereon, which, when executed by one or more processors, cause the processors to perform the method according to any one of claims 1 to 12.
15. A computer program product comprising a computer program / instructions, characterized in that When the computer program / instructions are executed by a processor, the method according to any one of claims 1 to 12 is implemented.
Citation Information
Patent Citations
Information processing method and device, electronic equipment and storage medium
CN117687695A
PCIe resource allocation method and device, electronic equipment and storage medium
CN118034917A