Disclosure of Invention
Aiming at the requirements of the RISC-V platform for efficient energy management and hardware configuration, the invention provides a method, a system, equipment and a storage medium for realizing ACPI by the RISC-V platform so as to provide extensible, efficient and universal energy management and hardware configuration support.
Term interpretation:
1. RISC-V is an open-source instruction set architecture that uses reduced instruction sets, modular design and scalability concepts. This allows the RISC-V processor to be simple in design, low in cost, and flexible in extension as desired. This design flexibility makes RISC-V suitable for a variety of different application scenarios, including embedded systems, servers, high performance computing, and internet of things devices, among others.
2. UEFI (Unified Extensible FIRMWARE INTERFACE) UEFI is a firmware interface specification intended to replace the traditional BIOS (Basic Input/Output System). It provides a more flexible and standardized boot solution that can load operating systems and applications and provides more powerful hardware initialization and configuration functions.
3. UEFI/PI services UEFI and PI (Platform Initialization) services are key firmware architectures and functional sets in the startup and operation of modern computer systems. UEFI replaces the conventional BIOS, providing a more flexible, extensible boot environment and rich interface to support interaction between the operating system and firmware. The PI services define a modular framework for hardware initialization and system boot, including initialization of processors, chipsets and devices, ensuring specification and compatibility of the system boot process. The two together form the basic firmware framework of modern computing platforms, providing security boot, device driver management, and system configuration.
4. Firmware File System (FIRMWARE FILE SYSTEM, FFS) FFS is a special file system for embedded systems, typically stored in non-volatile memory (e.g., flash, EEPROM). It is mainly used to store firmware, configuration data and other static information of the device, and is intended to provide efficient reading and updating operations while protecting the data from power failures and other problems. FFS can implement reliable firmware upgrades, configuration management, and boot procedures, and are widely used in embedded devices (e.g., routers, smart appliances, ioT devices).
5. UEFI configuration table is a set of data structures created by firmware at system start-up that provide hardware information and platform configuration for the operating system and boot loader. The configuration table includes various types of information such as a system memory map, an ACPI table, an SMBIOS (SYSTEM MANAGEMENT BIOS) table, EFI system partition information, and the like. These tables are accessed through the EFI system Table (EFI SYSTEM Table) and are used to support booting of the operating system and hardware initialization.
6. Advanced configuration and Power interface (Advanced Configuration and Power Interface, ACPI) ACPI is a standard interface for implementing advanced configuration and power management, aimed at providing a unified interface between an operating system and computer hardware for energy management and hardware configuration.
7. OSPM (Open Source Power Management) OSPM is an open source energy management framework that aims to provide an efficient energy management and optimization solution for computer systems. OSPM is dedicated to developing portable, flexible and extensible software tools to support a variety of operating systems and hardware platforms.
8. Root system description pointer (Root System Description Pointer, RSDP) RSDP is a pointer used in computer systems to identify Advanced Configuration and Power Interface (ACPI) data structures. Typically, BIOS or UEFI firmware will specify an RSDP in the memory of the system that points to a data structure containing ACPI information.
9. The extended system description table (Extended System Description Table, XSDT) XSDT is a data table that is primarily used to provide a list of pointers to other ACPI data tables in the system for quick access to the location and contents of the other ACPI data tables.
10. Firmware ACPI description table (Fixed ACPIDescription Table, FADT) FADT is an important table in the ACPI specification for providing fixed information about a computer system, including parameters in terms of energy management and configuration of system hardware. FADT contain critical information such as the system clock, the location of the power button, the address of the interrupt controller, etc., so that the operating system can effectively manage and control the power state and hardware configuration of the system.
11. Differential system description tables (DIFFERENTIATED SYSTEM Description Table, DSDT) DSDT contains information related to the specific hardware of the system, providing key information for the operating system and firmware to dynamically configure the hardware and manage power at run-time by defining devices, resources, methods, events, etc. in the ACPI namespace.
12. Processor attribute topology table (Processor Properties Topology Table, PPTT) is commonly used to describe the topology of a processor, including the cache hierarchy of the processor, core attributes, and other information related to the processor topology.
13. Memory-mapped configuration space base address description table (Memory-Mapped Configuration Space Base Address Table, MCFG) provides the starting address and range of the PCIe configuration space, enabling the operating system to directly read and write the configuration registers of the PCIe device through the Memory mapping, simplifying the configuration and management process of the PCIe device.
14. Serial port terminal redirection table (Serial Port Console Redirection Table, SPCR) defines the way system firmware redirects the output of the system console to the serial port.
15. A system resource association table (System Resource Affinity Table, SRAT) for describing the topology of CPUs, memory and I/O devices in the system and their association with NUMA (Non-Uniform Memory Access) nodes.
16. A system location information table (System Locality Information Table, SLIT) defines relative access delays between different processors and memory nodes within the system. It provides a matrix table indicating the delay values between each pair of nodes.
17. Advanced programmable interrupt controller (Advanced Programmable Interrupt Controller, APIC) APIC is an advanced programmable interrupt controller for managing and distributing interrupts in a computer system. APIC allows multiple processors in the system to work in concert to efficiently process and respond to interrupt requests.
18. A composite APIC description table (Multiple APIC Description Table, MADT) describes configuration information of Local interrupt controllers (Local APICs) and I/O interrupt controllers (I/O APICs) in the system, as well as other interrupt-related hardware information.
19. RISC-V Hart function Table (RHCT), a new ACPI table, is used to communicate certain functions of RISC-V Hart to the operating system.
20. RINTC (RISC-V Hart Local Interrupt Controller) a simple RISC-V platform available in supervisor mode each Hart (hardware thread) interrupt controller.
21. PLIC (Platform Level Interrupt Controller) the PLIC is a platform-level interrupt controller in the RISC-V architecture, responsible for managing and distributing various interrupt signals to ensure efficient and reliable handling of interrupt events in the system.
22. AIA (Advanced Interrupt Architecture) AIA is an interrupt controller specification newly proposed by RISC-V communities to address the defects of PLICs. Two components, IMSIC (Incoming MSI Controller) and APLIC (Advanced platform level interrupt controller), are defined in AIA. IMSIC is to collect and process MSI interrupts. APLIC is to collect and process line interrupts and then pass these interrupts to Hart in a line connection or MSI fashion.
23. PCIe (Peripheral Component Interconnect Express) PCIe is a high-speed serial computer expansion bus standard used for connecting a computer motherboard with high-speed components such as a display card, a solid state disk and a network adapter. PCIe provides higher data transfer rates and better scalability than traditional parallel PCI, improving bandwidth and efficiency through the use of point-to-point serial connections and multiple data lanes (referred to as "lanes"). PCIe standards support hot-plug functionality and their versions are continually upgraded, providing progressively increasing bandwidth and performance improvements, and are widely used in modern computer and server systems.
The technical scheme adopted by the invention is as follows:
a method for realizing ACPI by RISC-V platform based on the starting mode of UEFI firmware comprises:
UEFI sets a root system description pointer in a memory address space of a computer system and points to an extended system description table;
According to the requirements of a RISC-V platform, writing a static ACPI table according to the ACPI specification, and storing the ACPI table in an independent firmware file form;
Reading the ACPI tables one by one through a firmware file system, and loading the ACPI tables into a memory to complete a static loading process;
after the static loading process is completed, dynamically modifying the ACPI table according to the difference of the hardware platform;
The ACPI table is added to the list of entries of the extended system description table and is installed into the UEFI configuration table.
According to the invention, the UEFI sets a root system description pointer in a system memory address space and points to an extended system description table, and specifically comprises:
The UEFI firmware creates a root system description pointer structure, and initializes the fields of the root system description pointer structure, including a signature, an OEM identifier, a version, a length and an extended system description table address;
Creating an extended system description table, initializing system description table header information of the extended system description table, and reserving a first table entry of the extended system description table for the firmware ACPI description table.
According to the invention, static ACPI tables are written according to the ACPI specification and stored in the form of independent firmware files according to the requirements of a RISC-V platform, and the method comprises the following steps:
The ACPI table comprises a root system description pointer, an extended system description table, a firmware ACPI description table, a differential system description table, a composite APIC description table, a processor attribute topology table, a RISC-V Hart function table, a memory mapping configuration space base address description table, a serial port terminal redirection table, a system resource association table and a system position information table.
According to the invention, the ACPI table is dynamically modified according to the difference of the hardware platforms, wherein the ACPI table comprises configuration information of a CPU, a memory and PCIE.
According to the present invention, the ACPI table is preferably added to the entry list of the extended system description table and is installed in the UEFI configuration table, and specifically includes:
According to the ACPI specification, the differentiated system description table is pointed by the firmware ACPI description table, other ACPI tables are pointed by the expansion system description table, and according to the hierarchical relationship among the ACPI tables, the ACPI tables are added into the table item list of the expansion system description table;
a pointer to the root system description pointer structure is installed into the UEFI configuration table, and the checksum of the ACPI table is calculated and updated.
Further preferably, according to the hierarchical relationship between the ACPI tables, the ACPI tables are added to the list of the table items of the extended system description table, and the method comprises the following steps:
The firmware loads a firmware ACPI description table, wherein the firmware ACPI description table comprises pointers pointing to a differentiated system description table, pointers of other ACPI tables are added to an item list of an extended system description table for other ACPI tables, the structure of the extended system description table comprises a fixed head and a variable-length item list, each item is a 64-bit address pointing to the other ACPI tables, and the system finds and loads the ACPI tables by analyzing the extended system description table when starting up, so that ACPI configuration and initialization of the system are completed.
An apparatus for implementing ACPI by a RISC-V platform, comprising a memory, a processor and a computer program stored in the memory and executable on the processor, wherein the processor implements the steps of the method for implementing ACPI by the RISC-V platform when executing the computer program.
A computer readable storage medium storing a computer program which, when executed by a processor, implements the steps of the method for implementing ACPI for a RISC-V platform as described above.
A system for implementing ACPI for a RISC-V platform based on UEFI firmware initiation, comprising:
A management module configured to create and initialize a root system description pointer and an extended system description table and generate UEFI/PI services to install, uninstall, or manage ACPI tables;
the writing module is configured to write a static ACPI table according to the ACPI specification according to the requirements of the RISC-V platform and store the ACPI table in an independent firmware file form;
the loading module is configured to read the ACPI tables one by one through the firmware file system, load the ACPI tables into the memory and complete the static loading process;
the dynamic modification module is configured to dynamically modify the ACPI table according to the difference of the hardware platform after the static loading process is completed;
and an installation module configured to add the ACPI table to an entry list of the extended system description table and install the ACPI table to the UEFI configuration table.
The invention has the beneficial effects that:
1. The invention fully considers the uniqueness of the RISC-V architecture, and optimizes the special requirements of RISC-V in the design and the realization of the ACPI, thereby improving the universality of the ACPI on a RISC-V platform.
2. The invention can provide high-efficiency energy management and improve the system performance. ACPI not only enables efficient power management, but also provides a detailed description of the hierarchy and capabilities of the system hardware, enabling the operating system to more precisely configure the hardware to optimize system performance.
3. The invention improves the expandability of hardware configuration. The hardware structure on the RISC-V platform can be described and managed more accurately by means of static loading and dynamic modification, so that the RISC-V platform has better expandability and adaptability.
4. The present invention, taking into account the particularities of the RISC-V platform, helps to improve compatibility with different operating systems by following specifications and standards in ACPI implementations.
Detailed Description
It should be understood that the specific embodiments described herein are for purposes of illustration only and are not intended to limit the scope of the invention.
Example 1
A method for realizing ACPI by RISC-V platform based on the starting mode of UEFI firmware is shown in figure 1, comprising the following steps:
UEFI sets a root system description pointer in a memory address space of a computer system and points to an extended system description table;
According to the requirements of a RISC-V platform, writing a static ACPI table according to the ACPI specification, and storing the ACPI table in an independent firmware file form;
Reading the ACPI tables one by one through a firmware file system, and loading the ACPI tables into a memory to complete a static loading process;
after the static loading process is completed, dynamically modifying the ACPI table according to the difference of the hardware platform;
The ACPI table is added to the list of entries of the extended system description table and is installed into the UEFI configuration table.
Example 2
A method for implementing ACPI by a RISC-V platform according to embodiment 1, wherein:
the UEFI sets a root system description pointer in a system memory address space and points to an extended system description table, and specifically comprises the following steps:
The UEFI firmware creates a root system description pointer structure, and initializes the fields of the root system description pointer structure, including a signature, an OEM identifier, a version, a length and an extended system description table address;
Creating an extended system description table, initializing system description table header information of the extended system description table, and reserving a first table entry of the extended system description table for the firmware ACPI description table.
In UEFI enabled systems, the use of EFI system tables extends through the entire development phase of UEFI applications and drivers. The pointer to the EFI configuration table is contained in the EFI system table and there is a pointer to the RSDP structure in the EFI configuration table. The operating system loader provides a pointer to the EFI configuration table when called. The operating system loader must retrieve the pointer to the RSDP structure from the EFI configuration table and pass the pointer to the OSPM using the data structure associated with the operating system as part of the operating system loader handing over control to the operating system. The EFI configuration table entry consists of GUID (global Unique Identifier)/table pointer pairs. EFI GUID pointing to ACPI 2.0 and RSDP architecture of the above specification is 8868e871-e4f1-11d3-bc22-0080c73c8881.
According to the requirements of RISC-V platform, writing static ACPI table according to ACPI specification and storing ACPI table in independent firmware file form, comprising:
The ACPI table comprises a root system description pointer, an extended system description table, a firmware ACPI description table, a differential system description table, a composite APIC description table, a processor attribute topology table, a RISC-V Hart function table, a memory mapping configuration space base address description table, a serial port terminal redirection table, a system resource association table and a system position information table. Among other things, considering the uniqueness of RISC-V platforms, including differences in hardware architecture, different requirements for memory management, and unique design of interrupt handling mechanisms, it is desirable to implement ACPI tables that conform to RISC-V architecture characteristics. The ACPI interrupt model is implemented with a unified interrupt model to describe all interrupts for the entire system. Composite APIC description table for RISC-V processor based systems, OSPM is provided with the information needed to operate on the system implementing the ritc, AIA and PLIC. Wherein each Hart in the system requires a RINTC record in the composite APIC description table and a processor device object in the differential system description table. Depending on the system implemented interrupt controller, the composite APIC description table will also contain PLIC or AIA structures. RISC-V Hart function tables are new tables created specifically for RISC-V, and are mainly used to describe certain characteristics of RISC-V processor (Harts), including ISA string information, cache management operation extension related information, memory management unit related information, harts information.
And positioning the firmware volume where the ACPI table is located, reading the ACPI table one by one through a firmware file system, loading the ACPI table into a memory, constructing the ACPI in the memory as shown in fig. 2, and then completing a static loading process. The in-memory architecture of the ACPI table includes a plurality of key components, and the ACPI table starts with a Root System Description Pointer (RSDP) and points to a Root System Description Table (RSDT) or an extended system description table (XSDT). These tables are further directed to various other description tables, including Firmware ACPI Description Table (FADT), differential System Description Table (DSDT), and Secondary System Description Table (SSDT). The processor attribute topology table (PPTT) describes the topology of the processor, the PCI Express memory mapped configuration space base address description table (MCFG) defines the configuration space of the PCIe device, the serial port terminal redirection table (SPCR) configures the serial port console, the System Resource Association Table (SRAT) describes NUMA node information, the System Location Information Table (SLIT) provides system locality information, the composite APIC description table (MADT) describes interrupt controllers in the system, and the RISC-VHart function table (RHCT) describes specific attributes of the RISC-V processor. Together, these tables provide the system with interfaces and configuration information between hardware and software.
And dynamically modifying the ACPI table according to the difference of the hardware platforms, wherein the ACPI table comprises configuration information of a CPU, a memory and PCIE.
The ACPI table is dynamically modified by detecting the specific configuration and characteristics of the hardware platform so as to adapt to different hardware environments. Different hardware platforms typically have different physical components and architectures of computer systems, including CPUs, memory, storage, I/O devices, network components, and their interconnection. In particular, such dynamic modifications include adjusting the core and thread information of the CPU, the distribution and size of memory, and the number and address mapping of PCIe devices. By reading the hardware configuration during the boot process and modifying the ACPI tables according to predefined policies and templates, it is ensured that the operating system can correctly identify and utilize hardware resources, thereby improving compatibility and performance of the system.
Adding the ACPI table to an entry list of an extended system description table and installing the ACPI table to a UEFI configuration table, wherein the ACPI table specifically comprises:
According to the ACPI specification, the differentiated system description table is pointed by the firmware ACPI description table, other ACPI tables are pointed by the expansion system description table, and according to the hierarchical relationship among the ACPI tables, the ACPI tables are added into the table item list of the expansion system description table;
A pointer to the root system description pointer structure is installed into the UEFI configuration table, and the checksum of the ACPI table is calculated and updated. A pointer to the root system description pointer structure is installed to the UEFI configuration table for provision to the operating system. In addition, when updating the ACPI tables, the checksum needs to be recalculated and updated to ensure the integrity and correctness of the data. The checksum is calculated by traversing each byte of the ACPI table and filling the checksum field with the negative modulus 256 of the result to ensure that the checksum of the entire table is zero.
According to the hierarchical relationship between ACPI tables, adding the ACPI tables into an item list of an extended system description table, wherein the method comprises the following steps:
The firmware loads a firmware ACPI description table, wherein the firmware ACPI description table comprises pointers pointing to a differentiated system description table, pointers of other ACPI tables are added to an item list of an extended system description table for other ACPI tables, the structure of the extended system description table comprises a fixed head and a variable-length item list, each item is a 64-bit address pointing to the other ACPI tables, and the system finds and loads the ACPI tables by analyzing the extended system description table when starting up, so that ACPI configuration and initialization of the system are completed.
Example 3
An apparatus for implementing ACPI by a RISC-V platform, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, the processor implementing the steps of the method for implementing ACPI by a RISC-V platform as described in embodiment 1 or 2 when the computer program is executed by the processor.
Example 4
A computer readable storage medium storing a computer program which when executed by a processor performs the steps of the RISC-V platform ACPI method of embodiments 1 or 2.
Example 5
A system for implementing ACPI for a RISC-V platform based on UEFI firmware initiation, comprising:
A management module configured to create and initialize a root system description pointer and an extended system description table and generate UEFI/PI services to install, uninstall, or manage ACPI tables;
the writing module is configured to write a static ACPI table according to the ACPI specification according to the requirements of the RISC-V platform and store the ACPI table in an independent firmware file form;
the loading module is configured to read the ACPI tables one by one through the firmware file system, load the ACPI tables into the memory and complete the static loading process;
the dynamic modification module is configured to dynamically modify the ACPI table according to the difference of the hardware platform after the static loading process is completed;
and an installation module configured to add the ACPI table to an entry list of the extended system description table and install the ACPI table to the UEFI configuration table.
The method, the device, the equipment and the storage medium for realizing the ACPI by the RISC-V platform adopt a static loading and dynamic modification mode, meet the requirements of ACPI standards, and transmit the ACPI table into a memory in the form of a section of memory data. The invention provides more efficient and flexible ACPI support for computing platforms of RISC-V architecture.
The foregoing embodiment numbers of the present invention are merely for the purpose of description, and do not represent the advantages or disadvantages of the embodiments.
From the above description of the embodiments, it will be clear to those skilled in the art that the above-described embodiment method may be implemented by means of software plus a necessary general hardware platform, but of course may also be implemented by means of hardware, but in many cases the former is a preferred embodiment. Based on such understanding, the technical solution of the present invention may be embodied essentially or in a part contributing to the prior art in the form of a software product, which is stored in a storage medium (such as ROM/RAM, magnetic disk, optical disk), and includes several instructions for causing a terminal (which may be a mobile phone, a computer, a server, an air conditioner, or a network device, etc.) to perform the methods of the embodiments of the present invention.
The embodiments of the present invention have been described above with reference to the accompanying drawings, but the present invention is not limited to the above-described embodiments, which are merely illustrative and not restrictive, and many forms may be made by those having ordinary skill in the art without departing from the spirit of the present invention and the scope of the claims, which are to be protected by the present invention.