VirtualBox

source: vbox/trunk/src/VBox/Devices/EFI/FirmwareNew/DynamicTablesPkg/Readme.md@ 99404

Last change on this file since 99404 was 99404, checked in by vboxsync, 20 months ago

Devices/EFI/FirmwareNew: Update to edk2-stable202302 and make it build, bugref:4643

  • Property svn:eol-style set to native
File size: 11.5 KB
Line 
1# Dynamic Tables Framework
2
3Dynamic Tables Framework provides mechanisms to reduce the amount
4of effort required in porting firmware to new platforms. The aim is
5to provide an implementation capable of generating the firmware
6tables from an external source. This is potentially a management
7node, either local or remote, or, where suitable, a file that might
8be generated from the system construction. This initial release
9does not fully implement that - the configuration is held in local
10UEFI modules.
11
12# Feature Summary
13
14The dynamic tables framework is designed to generate standardised
15firmware tables that describe the hardware information at
16run-time. A goal of standardised firmware is to have a common
17firmware for a platform capable of booting both Windows and Linux
18operating systems.
19
20Traditionally the firmware tables are handcrafted using ACPI
21Source Language (ASL), Table Definition Language (TDL) and
22C-code. This approach can be error prone and involves time
23consuming debugging. In addition, it may be desirable to configure
24platform hardware at runtime such as: configuring the number of
25cores available for use by the OS, or turning SoC features ON or
26OFF.
27
28The dynamic tables framework simplifies this by providing a set
29of standard table generators, that are implemented as libraries.
30These generators query a platform specific component, the
31'Configuration Manager', to collate the information required
32for generating the tables at run-time.
33
34The framework also provides the ability to implement custom/OEM
35generators; thereby facilitating support for custom tables. The
36custom generators can also utilize the existing standard generators
37and override any functionality if needed.
38
39The framework currently implements a set of standard ACPI table
40generators for ARM architecture, that can generate Server Base Boot
41Requirement (SBBR) compliant tables. Although, the set of standard
42generators implement the functionality required for ARM architecture;
43the framework is extensible, and support for other architectures can
44be added easily.
45
46The framework currently supports the following table generators for ARM:
47* DBG2 - Debug Port Table 2
48* DSDT - Differentiated system description table. This is essentially
49 a RAW table generator.
50* FADT - Fixed ACPI Description Table
51* GTDT - Generic Timer Description Table
52* IORT - IO Remapping Table
53* MADT - Multiple APIC Description Table
54* MCFG - PCI Express memory mapped configuration space base address
55 Description Table
56* PCCT - Platform Communications Channel Table
57* PPTT - Processor Properties Topology Table
58* SPCR - Serial Port Console Redirection Table
59* SRAT - System Resource Affinity Table
60* SSDT - Secondary System Description Table. This is essentially
61 a RAW table generator.
62
63## Dynamic AML
64
65ACPI Definition block (e.g. DSDT or SSDT) tables are used to describe system
66devices along with other control and power management information. These tables
67are written using ACPI Source Language (ASL). The ASL code is compiled using an
68ASL compiler (e.g. Intel iASL compiler) to generate ACPI Machine Language (AML)
69bytecode.
70
71Since, definition blocks are represented using AML grammar, run-time generation
72of definition blocks is complex. Dynamic AML is a feature of Dynamic Tables
73framework that provides a solution for dynamic generation of ACPI Definition
74block tables.
75
76Dynamic AML introduces the following techniques:
77* AML Fixup
78* AML Codegen
79* AML Fixup + Codegen
80
81### AML Fixup
82AML fixup is a technique that involves compiling an ASL template file to
83generate AML bytecode. This template AML bytecode can be parsed at run-time
84and a fixup code can update the required fields in the AML template.
85
86To simplify AML Fixup, the Dynamic Tables Framework provides an *AmlLib*
87library with a rich set of APIs that can be used to fixup the AML code.
88
89### AML Codegen
90AML Codegen employs generating small segments of AML code. The *AmlLib*
91library provides AML Codegen APIs that generate the AML code segments.
92
93 Example: The following table depicts the AML Codegen APIs and the
94 corresponding ASL code that would be generated.
95
96 | AML Codegen API | ASL Code |
97 |--------------------------------|--------------------------------|
98 | AmlCodeGenDefinitionBlock ( | DefinitionBlock ( |
99 | .., | ... |
100 | &RootNode); | ) { |
101 | AmlCodeGenScope ( | Scope (_SB) { |
102 | "\_SB", | |
103 | RootNode, | |
104 | &ScopeNode); | |
105 | AmlCodeGenDevice ( | Device (CPU0) { |
106 | "CPU0", | |
107 | ScopeNode, | |
108 | &CpuNode); | |
109 | AmlCodeGenNameString ( | Name (_HID, "ACPI0007") |
110 | "_HID", | |
111 | "ACPI0007", | |
112 | CpuNode, | |
113 | &HidNode); | |
114 | AmlCodeGenNameInteger ( | Name (_UID, Zero) |
115 | "_UID", | |
116 | 0, | |
117 | CpuNode, | |
118 | &UidNode); | |
119 | | } // Device |
120 | | } // Scope |
121 | | } // DefinitionBlock |
122
123### AML Fixup + Codegen
124A combination of AML Fixup and AML Codegen could be used for generating
125Definition Blocks. For example the AML Fixup could be used to fixup certain
126parts of the AML template while the AML Codegen APIs could be used to inserted
127small fragments of AML code in the AML template.
128
129### AmlLib Library
130Since, AML bytecode represents complex AML grammar, an **AmlLib** library is
131introduced to assist parsing and traversing of the AML bytecode at run-time.
132
133The AmlLib library parses a definition block and represents it as an AML
134tree. This tree representation is based on the AML grammar defined by the
135ACPI 6.3 specification, section - 20 'ACPI Machine Language (AML)
136Specification'.
137
138AML objects, methods and data are represented as tree nodes. Since the AML
139data is represented as tree nodes, it is possible to traverse the tree, locate
140a node and modify the node data. The tree can then be serialized to a buffer
141(that represents the definition block). This definition block containing
142the fixed up AML code can then be installed as an ACPI table (DSDT/SSDT).
143
144AmlLib provides a rich API to operate on AML data. For example it provides
145APIs to update a device's name, the value of a "_UID" object, and the memory
146and interrupt number stored in a "_CRS" node.
147
148Although the AmlLib performs checks to a reasonable extent while modifying a
149definition block, these checks may not cover all aspects due to the complexity
150of the ASL/AML language. It is therefore recommended to review any operation
151performed, and validate the generated output.
152
153 Example: The serialized AML code could be validated by
154 - Saving the generated AML to a file and comparing with
155 a reference output.
156 or
157 - Disassemble the generated AML using the iASL compiler
158 and verifying the output.
159
160# Roadmap
161
162The current implementation of the Configuration Manager populates the
163platform information statically as a C structure. Further enhancements
164to introduce runtime loading of platform information from a platform
165information file is planned.
166
167Also support for generating SMBIOS tables is planned and will be added
168subsequently.
169
170# Supported Platforms
171
1721. Juno
1732. FVP Models
174
175# Build Instructions
176
1771. Set path for the iASL compiler with support for generating a C header
178 file as output.
179
1802. Set PACKAGES_PATH to point to the locations of the following repositories:
181
182Example:
183
184> set PACKAGES_PATH=%CD%\edk2;%CD%\edk2-platforms;
185
186 or
187
188> export PACKAGES_PATH=$PWD/edk2:$PWD/edk2-platforms
189
1903. To enable Dynamic tables framework the *'DYNAMIC_TABLES_FRAMEWORK'*
191option must be defined. This can be passed as a command line
192parameter to the edk2 build system.
193
194Example:
195
196>build -a AARCH64 -p Platform\ARM\JunoPkg\ArmJuno.dsc
197 -t GCC5 **-D DYNAMIC_TABLES_FRAMEWORK**
198
199or
200
201>build -a AARCH64 -p Platform\ARM\VExpressPkg\ArmVExpress-FVP-AArch64.dsc
202 -t GCC5 **-D DYNAMIC_TABLES_FRAMEWORK**
203
204# Prerequisites
205
206Ensure that the latest ACPICA iASL compiler is used for building *Dynamic Tables Framework*.
207*Dynamic Tables Framework* has been tested using the following iASL compiler version:
208[Version 20200717](https://www.acpica.org/node/183), dated 17 July, 2020.
209
210
211#Running CI builds locally
212
213The TianoCore EDKII project has introduced Core CI infrastructure using TianoCore EDKII Tools PIP modules:
214
215 - *[edk2-pytool-library](https://pypi.org/project/edk2-pytool-library)*
216
217 - *[edk2-pytool-extensions](https://pypi.org/project/edk2-pytool-extensions)*
218
219
220The instructions to setup the CI environment are in *'edk2\\.pytool\\Readme.md'*
221
222## Building DynamicTablesPkg with Pytools
223
2241. [Optional] Create a Python Virtual Environment - generally once per workspace
225
226 ```
227 python -m venv <name of virtual environment>
228
229 e.g. python -m venv edk2-ci
230 ```
231
2322. [Optional] Activate Virtual Environment - each time new shell/command window is opened
233
234 ```
235 <name of virtual environment>/Scripts/activate
236
237 e.g. On a windows host PC run:
238 edk2-ci\Scripts\activate.bat
239 ```
2403. Install Pytools - generally once per virtual env or whenever pip-requirements.txt changes
241
242 ```
243 pip install --upgrade -r pip-requirements.txt
244 ```
245
2464. Initialize & Update Submodules - only when submodules updated
247
248 ```
249 stuart_setup -c .pytool/CISettings.py TOOL_CHAIN_TAG=<TOOL_CHAIN_TAG> -a <TARGET_ARCH>
250
251 e.g. stuart_setup -c .pytool/CISettings.py TOOL_CHAIN_TAG=GCC5
252 ```
253
2545. Initialize & Update Dependencies - only as needed when ext_deps change
255
256 ```
257 stuart_update -c .pytool/CISettings.py TOOL_CHAIN_TAG=<TOOL_CHAIN_TAG> -a <TARGET_ARCH>
258
259 e.g. stuart_update -c .pytool/CISettings.py TOOL_CHAIN_TAG=GCC5
260 ```
261
2626. Compile the basetools if necessary - only when basetools C source files change
263
264 ```
265 python BaseTools/Edk2ToolsBuild.py -t <ToolChainTag>
266 ```
267
2687. Compile DynamicTablesPkg
269
270 ```
271 stuart_build-c .pytool/CISettings.py TOOL_CHAIN_TAG=<TOOL_CHAIN_TAG> -a <TARGET_ARCH>
272
273 e.g. stuart_ci_build -c .pytool/CISettings.py TOOL_CHAIN_TAG=GCC5 -p DynamicTablesPkg -a AARCH64 --verbose
274 ```
275
276 - use `stuart_build -c .pytool/CISettings.py -h` option to see help on additional options.
277
278
279# Documentation
280
281Refer to the following presentation from *UEFI Plugfest Seattle 2018*:
282
283[Dynamic Tables Framework: A Step Towards Automatic Generation of Advanced Configuration and Power Interface (ACPI) & System Management BIOS (SMBIOS) Tables](http://www.uefi.org/sites/default/files/resources/Arm_Dynamic%20Tables%20Framework%20A%20Step%20Towards%20Automatic%20Generation%20of%20Advanced%20Configuration%20and%20Power%20Interface%20%28ACPI%29%20%26%20System%20Management%20BIOS%20%28SMBIOS%29%20Tables%20_0.pdf)
284
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette