TianoCore EDK2 master
Loading...
Searching...
No Matches
AcpiSdt.h
Go to the documentation of this file.
1
9#ifndef _ACPI_SDT_H_
10#define _ACPI_SDT_H_
11
12//
13// Privacy data structure
14//
15
16//
17// ACPI Notify Linked List Signature.
18//
19#define EFI_ACPI_NOTIFY_LIST_SIGNATURE SIGNATURE_32 ('E', 'A', 'N', 'L')
20
21//
22// ACPI Notify List Entry definition.
23//
24// Signature must be set to EFI_ACPI_NOTIFY_LIST_SIGNATURE
25// Link is the linked list data.
26// Notification is the callback function.
27//
28typedef struct {
29 UINT32 Signature;
30 LIST_ENTRY Link;
31 EFI_ACPI_NOTIFICATION_FN Notification;
33
34//
35// Containment record for ACPI Notify linked list.
36//
37#define EFI_ACPI_NOTIFY_LIST_FROM_LINK(_link) CR (_link, EFI_ACPI_NOTIFY_LIST, Link, EFI_ACPI_NOTIFY_LIST_SIGNATURE)
38
41
42//
43// AML Node Linked List Signature.
44//
45#define EFI_AML_NODE_LIST_SIGNATURE SIGNATURE_32 ('E', 'A', 'M', 'L')
46
47//
48// AML Node Linked List Entry definition.
49//
50// Signature must be set to EFI_AML_NODE_LIST_SIGNATURE
51// Link is the linked list data.
52// Name is the ACPI node name.
53// This is listed for PATH finding.
54// Buffer is the ACPI node buffer pointer, the first/second bytes are opcode.
55// This buffer should not be freed.
56// Size is the total size of this ACPI node buffer.
57// Children is the children linked list of this node.
58//
59
61 UINT32 Signature;
62 UINT8 Name[AML_NAME_SEG_SIZE];
63 UINT8 *Buffer;
64 UINTN Size;
65 LIST_ENTRY Link;
66 LIST_ENTRY Children;
67 EFI_AML_NODE_LIST *Parent;
68 AML_BYTE_ENCODING *AmlByteEncoding;
69};
70
71//
72// Containment record for AML Node linked list.
73//
74#define EFI_AML_NODE_LIST_FROM_LINK(_link) CR (_link, EFI_AML_NODE_LIST, Link, EFI_AML_NODE_LIST_SIGNATURE)
75
76//
77// AML Handle Signature.
78//
79#define EFI_AML_HANDLE_SIGNATURE SIGNATURE_32 ('E', 'A', 'H', 'S')
80#define EFI_AML_ROOT_HANDLE_SIGNATURE SIGNATURE_32 ('E', 'A', 'R', 'H')
81
82//
83// AML Handle Entry definition.
84//
85// Signature must be set to EFI_AML_HANDLE_SIGNATURE or EFI_AML_ROOT_HANDLE_SIGNATURE
86// Buffer is the ACPI node buffer pointer, the first/second bytes are opcode.
87// This buffer should not be freed.
88// Size is the total size of this ACPI node buffer.
89//
90typedef struct {
91 UINT32 Signature;
92 UINT8 *Buffer;
93 UINTN Size;
94 AML_BYTE_ENCODING *AmlByteEncoding;
95 BOOLEAN Modified;
97
98typedef UINT32 AML_OP_PARSE_INDEX;
99
100#define AML_OP_PARSE_INDEX_GET_OPCODE 0
101#define AML_OP_PARSE_INDEX_GET_TERM1 1
102#define AML_OP_PARSE_INDEX_GET_TERM2 2
103#define AML_OP_PARSE_INDEX_GET_TERM3 3
104#define AML_OP_PARSE_INDEX_GET_TERM4 4
105#define AML_OP_PARSE_INDEX_GET_TERM5 5
106#define AML_OP_PARSE_INDEX_GET_TERM6 6
107#define AML_OP_PARSE_INDEX_GET_SIZE (AML_OP_PARSE_INDEX)-1
108
109typedef UINT32 AML_OP_PARSE_FORMAT;
110#define AML_NONE 0
111#define AML_OPCODE 1
112#define AML_UINT8 2
113#define AML_UINT16 3
114#define AML_UINT32 4
115#define AML_UINT64 5
116#define AML_NAME 6
117#define AML_STRING 7
118#define AML_OBJECT 8
119
120typedef UINT32 AML_OP_ATTRIBUTE;
121#define AML_HAS_PKG_LENGTH 0x1 // It is ACPI attribute - if OpCode has PkgLength
122#define AML_IS_NAME_CHAR 0x2 // It is ACPI attribute - if this is NameChar
123#define AML_HAS_CHILD_OBJ 0x4 // it is ACPI attribute - if OpCode has Child Object.
124#define AML_IN_NAMESPACE 0x10000 // It is UEFI SDT attribute - if OpCode will be in NameSpace
125 // NOTE; Not all OBJECT will be in NameSpace
126 // For example, BankField | CreateBitField | CreateByteField | CreateDWordField |
127 // CreateField | CreateQWordField | CreateWordField | Field | IndexField.
128
129struct _AML_BYTE_ENCODING {
130 UINT8 OpCode;
131 UINT8 SubOpCode;
132 AML_OP_PARSE_INDEX MaxIndex;
133 AML_OP_PARSE_FORMAT Format[6];
135};
136
137//
138// AcpiSdt protocol declaration
139//
140
168EFIAPI
170 IN UINTN Index,
171 OUT EFI_ACPI_SDT_HEADER **Table,
172 OUT EFI_ACPI_TABLE_VERSION *Version,
173 OUT UINTN *TableKey
174 );
175
191EFIAPI
193 IN BOOLEAN Register,
194 IN EFI_ACPI_NOTIFICATION_FN Notification
195 );
196
207EFIAPI
208OpenSdt (
209 IN UINTN TableKey,
210 OUT EFI_ACPI_HANDLE *Handle
211 );
212
225EFIAPI
226Open (
227 IN VOID *Buffer,
228 OUT EFI_ACPI_HANDLE *Handle
229 );
230
240EFIAPI
241Close (
242 IN EFI_ACPI_HANDLE Handle
243 );
244
260EFIAPI
261GetOption (
262 IN EFI_ACPI_HANDLE Handle,
263 IN UINTN Index,
264 OUT EFI_ACPI_DATA_TYPE *DataType,
265 OUT CONST VOID **Data,
266 OUT UINTN *DataSize
267 );
268
285EFIAPI
286SetOption (
287 IN EFI_ACPI_HANDLE Handle,
288 IN UINTN Index,
289 IN CONST VOID *Data,
290 IN UINTN DataSize
291 );
292
305EFIAPI
306GetChild (
307 IN EFI_ACPI_HANDLE ParentHandle,
308 IN OUT EFI_ACPI_HANDLE *Handle
309 );
310
323EFIAPI
324FindPath (
325 IN EFI_ACPI_HANDLE HandleIn,
326 IN VOID *AcpiPath,
327 OUT EFI_ACPI_HANDLE *HandleOut
328 );
329
330//
331// ACPI SDT function
332//
333
347SdtOpenEx (
348 IN VOID *Buffer,
349 IN UINTN BufferSize,
350 OUT EFI_ACPI_HANDLE *Handle
351 );
352
353//
354// AML support function
355//
356
368 IN UINT8 *Buffer,
369 OUT UINTN *BufferSize
370 );
371
380UINTN
382 IN UINT8 *Buffer,
383 OUT UINTN *PkgLength
384 );
385
393EFI_ACPI_DATA_TYPE
395 IN AML_OP_PARSE_FORMAT AmlType
396 );
397
407 IN UINT8 *OpByteBuffer
408 );
409
419UINTN
421 IN AML_BYTE_ENCODING *AmlByteEncoding,
422 IN UINT8 *Buffer,
423 IN UINTN MaxBufferSize
424 );
425
433CHAR8 *
435 IN EFI_AML_HANDLE *AmlHandle
436 );
437
454 IN EFI_AML_HANDLE *AmlHandle,
455 IN AML_OP_PARSE_INDEX Index,
456 OUT EFI_ACPI_DATA_TYPE *DataType,
457 OUT VOID **Data,
458 OUT UINTN *DataSize
459 );
460
472 IN EFI_AML_HANDLE *AmlHandle,
473 OUT UINT8 **Buffer
474 );
475
489 IN EFI_AML_HANDLE *AmlParentHandle,
490 IN EFI_AML_HANDLE *AmlHandle,
491 OUT VOID **Buffer
492 );
493
507 IN EFI_AML_HANDLE *AmlParentHandle,
508 IN EFI_AML_HANDLE *AmlHandle,
509 OUT VOID **Buffer
510 );
511
520UINT8 *
522 IN UINT8 *AslPath
523 );
524
540 IN EFI_AML_HANDLE *AmlHandle,
541 IN UINT8 *AmlPath,
542 OUT VOID **Buffer,
543 IN BOOLEAN FromRoot
544 );
545
551VOID
553 IN UINT8 *Buffer
554 );
555
561VOID
563 IN UINT8 *Buffer
564 );
565
574BOOLEAN
576 IN UINT8 *Buffer
577 );
578
579#endif
UINT64 UINTN
CHAR8 * AmlGetObjectName(IN EFI_AML_HANDLE *AmlHandle)
Definition: AmlOption.c:341
EFI_STATUS AmlFindPath(IN EFI_AML_HANDLE *AmlHandle, IN UINT8 *AmlPath, OUT VOID **Buffer, IN BOOLEAN FromRoot)
Definition: AmlNamespace.c:517
UINTN AmlGetObjectSize(IN AML_BYTE_ENCODING *AmlByteEncoding, IN UINT8 *Buffer, IN UINTN MaxBufferSize)
Definition: AmlOption.c:308
VOID AmlPrintNameString(IN UINT8 *Buffer)
Definition: AmlString.c:495
BOOLEAN AmlIsRootPath(IN UINT8 *Buffer)
Definition: AmlString.c:20
EFI_STATUS AmlGetChildFromRoot(IN EFI_AML_HANDLE *AmlParentHandle, IN EFI_AML_HANDLE *AmlHandle, OUT VOID **Buffer)
Definition: AmlChild.c:81
EFI_STATUS EFIAPI OpenSdt(IN UINTN TableKey, OUT EFI_ACPI_HANDLE *Handle)
Definition: AcpiSdt.c:512
EFI_STATUS EFIAPI GetAcpiTable2(IN UINTN Index, OUT EFI_ACPI_SDT_HEADER **Table, OUT EFI_ACPI_TABLE_VERSION *Version, OUT UINTN *TableKey)
Definition: AcpiSdt.c:292
EFI_STATUS EFIAPI RegisterNotify(IN BOOLEAN Register, IN EFI_ACPI_NOTIFICATION_FN Notification)
Definition: AcpiSdt.c:422
UINTN AmlGetPkgLength(IN UINT8 *Buffer, OUT UINTN *PkgLength)
Definition: Aml.c:239
EFI_STATUS EFIAPI Open(IN VOID *Buffer, OUT EFI_ACPI_HANDLE *Handle)
Definition: AcpiSdt.c:593
EFI_STATUS EFIAPI FindPath(IN EFI_ACPI_HANDLE HandleIn, IN VOID *AcpiPath, OUT EFI_ACPI_HANDLE *HandleOut)
Definition: AcpiSdt.c:1033
EFI_STATUS AmlGetNameStringSize(IN UINT8 *Buffer, OUT UINTN *BufferSize)
Definition: AmlString.c:109
EFI_STATUS EFIAPI SetOption(IN EFI_ACPI_HANDLE Handle, IN UINTN Index, IN CONST VOID *Data, IN UINTN DataSize)
Definition: AcpiSdt.c:745
EFI_STATUS AmlParseOptionHandleCommon(IN EFI_AML_HANDLE *AmlHandle, IN AML_OP_PARSE_INDEX Index, OUT EFI_ACPI_DATA_TYPE *DataType, OUT VOID **Data, OUT UINTN *DataSize)
Definition: AmlOption.c:449
EFI_STATUS EFIAPI GetChild(IN EFI_ACPI_HANDLE ParentHandle, IN OUT EFI_ACPI_HANDLE *Handle)
Definition: AcpiSdt.c:820
UINT8 * AmlNameFromAslName(IN UINT8 *AslPath)
Definition: AmlString.c:385
VOID AmlPrintNameSeg(IN UINT8 *Buffer)
Definition: AmlString.c:466
EFI_STATUS EFIAPI GetOption(IN EFI_ACPI_HANDLE Handle, IN UINTN Index, OUT EFI_ACPI_DATA_TYPE *DataType, OUT CONST VOID **Data, OUT UINTN *DataSize)
Definition: AcpiSdt.c:680
AML_BYTE_ENCODING * AmlSearchByOpByte(IN UINT8 *OpByteBuffer)
Definition: Aml.c:180
EFI_STATUS AmlGetOffsetAfterLastOption(IN EFI_AML_HANDLE *AmlHandle, OUT UINT8 **Buffer)
Definition: AmlOption.c:398
EFI_STATUS SdtOpenEx(IN VOID *Buffer, IN UINTN BufferSize, OUT EFI_ACPI_HANDLE *Handle)
Definition: AcpiSdt.c:537
EFI_STATUS AmlGetChildFromNonRoot(IN EFI_AML_HANDLE *AmlParentHandle, IN EFI_AML_HANDLE *AmlHandle, OUT VOID **Buffer)
Definition: AmlChild.c:249
EFI_ACPI_DATA_TYPE AmlTypeToAcpiType(IN AML_OP_PARSE_FORMAT AmlType)
Definition: Aml.c:218
EFI_STATUS EFIAPI Close(IN EFI_ACPI_HANDLE Handle)
Definition: AcpiSdt.c:628
EFI_STATUS(EFIAPI * EFI_ACPI_NOTIFICATION_FN)(IN EFI_ACPI_SDT_HEADER *Table, IN EFI_ACPI_TABLE_VERSION Version, IN UINTN TableKey)
UINT32 AML_OP_ATTRIBUTE
Definition: Aml.h:59
#define CONST
Definition: Base.h:259
#define IN
Definition: Base.h:279
#define OUT
Definition: Base.h:284
EFI_STATUS EFIAPI Register(IN EFI_PEI_RSC_HANDLER_CALLBACK Callback)
RETURN_STATUS EFI_STATUS
Definition: UefiBaseType.h:29
UINT8 SubOpCode
Definition: Aml.h:128
UINT8 OpCode
OpCode of the AML object.
Definition: Aml.h:122
AML_OP_ATTRIBUTE Attribute
Additional information on the AML object.
Definition: Aml.h:145
AML_PARSE_FORMAT Format[EAmlParseIndexMax]
Type of each fixed argument.
Definition: Aml.h:142
EAML_PARSE_INDEX MaxIndex
Definition: Aml.h:134