OpenCore  1.0.4
OpenCore Bootloader
Loading...
Searching...
No Matches
OcAcpiLib.h
Go to the documentation of this file.
1
15#ifndef OC_ACPI_LIB_H
16#define OC_ACPI_LIB_H
17
18#include <IndustryStandard/Acpi62.h>
19#include <Protocol/SimpleFileSystem.h>
20
21#define OC_ACPI_NAME_SIZE 4
22
23//
24// RSDP and XSDT table definitions not provided by EDK2 due to no
25// flexible array support.
26//
27
28#pragma pack(push, 1)
29
30typedef struct {
31 EFI_ACPI_DESCRIPTION_HEADER Header;
32 UINT32 Tables[];
34
35typedef struct {
36 EFI_ACPI_DESCRIPTION_HEADER Header;
37 UINT64 Tables[];
39
40#pragma pack(pop)
41
42//
43// Operation region structure.
44//
45typedef struct {
46 //
47 // Region address.
48 //
49 UINT32 Address;
50 //
51 // Region name, not guaranteed to be null-terminated.
52 //
53 CHAR8 Name[OC_ACPI_NAME_SIZE+1];
55
56//
57// Main ACPI context describing current tableset worked on.
58//
59typedef struct {
60 //
61 // Pointer to original RSDP table.
62 //
63 EFI_ACPI_6_2_ROOT_SYSTEM_DESCRIPTION_POINTER *Rsdp;
64 //
65 // Pointer to active RSDT table.
66 //
68 //
69 // Pointer to active XSDT table.
70 //
72 //
73 // Pointer to active FADT table.
74 //
75 EFI_ACPI_6_2_FIXED_ACPI_DESCRIPTION_TABLE *Fadt;
76 //
77 // Pointer to active DSDT table.
78 //
79 EFI_ACPI_DESCRIPTION_HEADER *Dsdt;
80 //
81 // Current list of tables allocated from heap.
82 //
83 EFI_ACPI_COMMON_HEADER **Tables;
84 //
85 // Number of tables.
86 //
88 //
89 // Number of allocated table slots.
90 //
92 //
93 // Detected operation regions if any.
94 //
96 //
97 // Number of regions.
98 //
100 //
101 // Number of allocated region slots.
102 //
105
106//
107// ACPI patch structure.
108//
109typedef struct {
110 //
111 // Find bytes.
112 //
113 CONST UINT8 *Find;
114 //
115 // Replace bytes.
116 //
117 CONST UINT8 *Replace;
118 //
119 // Find mask or NULL.
120 //
121 CONST UINT8 *Mask;
122 //
123 // Replace mask or NULL.
124 //
125 CONST UINT8 *ReplaceMask;
126 //
127 // Fully qualified name with ACPI path (e.g. \_SB_.PCI0.GFX0).
128 //
129 CONST CHAR8 *Base;
130 //
131 // Number of Base entries to skip before using.
132 //
133 UINT32 BaseSkip;
134 //
135 // Patch size.
136 //
137 UINT32 Size;
138 //
139 // Replace count or 0 for all.
140 //
141 UINT32 Count;
142 //
143 // Skip count or 0 to start from 1 match.
144 //
145 UINT32 Skip;
146 //
147 // Limit replacement size to this value or 0, which assumes table size.
148 //
149 UINT32 Limit;
150 //
151 // ACPI Table signature or 0.
152 //
154 //
155 // ACPI Table length or 0.
156 //
158 //
159 // ACPI Table Id or 0.
160 //
163
171EFI_STATUS
173 IN OUT OC_ACPI_CONTEXT *Context
174 );
175
181VOID
183 IN OUT OC_ACPI_CONTEXT *Context
184 );
185
191EFI_STATUS
193 IN OUT OC_ACPI_CONTEXT *Context
194 );
195
205EFI_STATUS
207 IN OUT OC_ACPI_CONTEXT *Context,
208 IN UINT32 Signature,
209 IN UINT32 Length,
210 IN UINT64 OemTableId,
211 IN BOOLEAN All
212 );
213
221EFI_STATUS
223 IN OUT OC_ACPI_CONTEXT *Context,
224 IN CONST UINT8 *Data,
225 IN UINT32 Length
226 );
227
233VOID
235 IN OUT OC_ACPI_CONTEXT *Context
236 );
237
244EFI_STATUS
246 IN OUT OC_ACPI_CONTEXT *Context,
247 IN OC_ACPI_PATCH *Patch
248 );
249
255EFI_STATUS
257 IN OUT OC_ACPI_CONTEXT *Context
258 );
259
265VOID
267 IN OUT OC_ACPI_CONTEXT *Context
268 );
269
278EFI_STATUS
280 IN OUT OC_ACPI_CONTEXT *Context
281 );
282
288VOID
290 IN OUT OC_ACPI_CONTEXT *Context
291 );
292
298VOID
300 IN OUT OC_ACPI_CONTEXT *Context
301 );
302
309VOID
311 IN OUT OC_ACPI_CONTEXT *Context,
312 IN BOOLEAN Reset
313 );
314
320EFI_STATUS
322 IN EFI_FILE_PROTOCOL *Root
323 );
324
340EFI_STATUS
342 IN UINT8 *Table,
343 IN CONST CHAR8 *PathString,
344 IN UINT8 Entry,
345 OUT UINT32 *Offset,
346 IN UINT32 TableLength OPTIONAL
347 );
348
349#endif // OC_ACPI_LIB_H
UINT64 Length
UINT8 Signature[8]
Definition BiosId.h:67
VOID AcpiNormalizeHeaders(IN OUT OC_ACPI_CONTEXT *Context)
Definition OcAcpiLib.c:1164
EFI_STATUS AcpiApplyContext(IN OUT OC_ACPI_CONTEXT *Context)
Definition OcAcpiLib.c:900
EFI_STATUS AcpiFadtEnableReset(IN OUT OC_ACPI_CONTEXT *Context)
Definition OcAcpiLib.c:1510
EFI_STATUS AcpiDeleteTable(IN OUT OC_ACPI_CONTEXT *Context, IN UINT32 Signature, IN UINT32 Length, IN UINT64 OemTableId, IN BOOLEAN All)
Definition OcAcpiLib.c:1015
EFI_STATUS AcpiApplyPatch(IN OUT OC_ACPI_CONTEXT *Context, IN OC_ACPI_PATCH *Patch)
Definition OcAcpiLib.c:1247
VOID AcpiSyncTableIds(IN OUT OC_ACPI_CONTEXT *Context)
Definition OcAcpiLib.c:1640
VOID AcpiFreeContext(IN OUT OC_ACPI_CONTEXT *Context)
Definition OcAcpiLib.c:884
VOID AcpiRelocateRegions(IN OUT OC_ACPI_CONTEXT *Context)
Definition OcAcpiLib.c:1465
EFI_STATUS AcpiDumpTables(IN EFI_FILE_PROTOCOL *Root)
Definition AcpiDump.c:102
VOID AcpiHandleHardwareSignature(IN OUT OC_ACPI_CONTEXT *Context, IN BOOLEAN Reset)
Definition OcAcpiLib.c:1700
EFI_STATUS AcpiFindEntryInMemory(IN UINT8 *Table, IN CONST CHAR8 *PathString, IN UINT8 Entry, OUT UINT32 *Offset, IN UINT32 TableLength OPTIONAL)
VOID AcpiResetLogoStatus(IN OUT OC_ACPI_CONTEXT *Context)
Definition OcAcpiLib.c:1596
#define OC_ACPI_NAME_SIZE
Definition OcAcpiLib.h:21
EFI_STATUS AcpiInitContext(IN OUT OC_ACPI_CONTEXT *Context)
Definition OcAcpiLib.c:738
EFI_STATUS AcpiLoadRegions(IN OUT OC_ACPI_CONTEXT *Context)
Definition OcAcpiLib.c:1421
EFI_STATUS AcpiInsertTable(IN OUT OC_ACPI_CONTEXT *Context, IN CONST UINT8 *Data, IN UINT32 Length)
Definition OcAcpiLib.c:1082
EFI_ACPI_DESCRIPTION_HEADER Header
Definition OcAcpiLib.h:36
EFI_ACPI_DESCRIPTION_HEADER Header
Definition OcAcpiLib.h:31
UINT32 NumberOfRegions
Definition OcAcpiLib.h:99
EFI_ACPI_6_2_ROOT_SYSTEM_DESCRIPTION_POINTER * Rsdp
Definition OcAcpiLib.h:63
EFI_ACPI_COMMON_HEADER ** Tables
Definition OcAcpiLib.h:83
UINT32 AllocatedTables
Definition OcAcpiLib.h:91
EFI_ACPI_DESCRIPTION_HEADER * Dsdt
Definition OcAcpiLib.h:79
UINT32 AllocatedRegions
Definition OcAcpiLib.h:103
OC_ACPI_REGION * Regions
Definition OcAcpiLib.h:95
EFI_ACPI_6_2_FIXED_ACPI_DESCRIPTION_TABLE * Fadt
Definition OcAcpiLib.h:75
OC_ACPI_6_2_EXTENDED_SYSTEM_DESCRIPTION_TABLE * Xsdt
Definition OcAcpiLib.h:71
OC_ACPI_6_2_ROOT_SYSTEM_DESCRIPTION_TABLE * Rsdt
Definition OcAcpiLib.h:67
UINT32 NumberOfTables
Definition OcAcpiLib.h:87
CONST UINT8 * Find
Definition OcAcpiLib.h:113
CONST UINT8 * Replace
Definition OcAcpiLib.h:117
UINT32 TableLength
Definition OcAcpiLib.h:157
UINT32 BaseSkip
Definition OcAcpiLib.h:133
CONST UINT8 * Mask
Definition OcAcpiLib.h:121
UINT32 TableSignature
Definition OcAcpiLib.h:153
CONST UINT8 * ReplaceMask
Definition OcAcpiLib.h:125
CONST CHAR8 * Base
Definition OcAcpiLib.h:129
UINT64 OemTableId
Definition OcAcpiLib.h:161
UINT32 Address
Definition OcAcpiLib.h:49