EDK2 doxygen online documents - Firmware Encoding Index 1
EDK2 doxygen online documents - Firmware Encoding Index

MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiSdt.h

Go to the documentation of this file.
00001 
00015 #ifndef _ACPI_SDT_H_
00016 #define _ACPI_SDT_H_
00017 
00018 //
00019 // ACPI AML definition
00020 //
00021 
00022 //
00023 // Primary OpCode
00024 //
00025 #define AML_ZERO_OP                  0x00
00026 #define AML_ONE_OP                   0x01
00027 #define AML_ALIAS_OP                 0x06
00028 #define AML_NAME_OP                  0x08
00029 #define AML_BYTE_PREFIX              0x0a
00030 #define AML_WORD_PREFIX              0x0b
00031 #define AML_DWORD_PREFIX             0x0c
00032 #define AML_STRING_PREFIX            0x0d
00033 #define AML_QWORD_PREFIX             0x0e
00034 #define AML_SCOPE_OP                 0x10
00035 #define AML_BUFFER_OP                0x11
00036 #define AML_PACKAGE_OP               0x12
00037 #define AML_VAR_PACKAGE_OP           0x13
00038 #define AML_METHOD_OP                0x14
00039 #define AML_DUAL_NAME_PREFIX         0x2e
00040 #define AML_MULTI_NAME_PREFIX        0x2f
00041 #define AML_NAME_CHAR_A              0x41
00042 #define AML_NAME_CHAR_B              0x42
00043 #define AML_NAME_CHAR_C              0x43
00044 #define AML_NAME_CHAR_D              0x44
00045 #define AML_NAME_CHAR_E              0x45
00046 #define AML_NAME_CHAR_F              0x46
00047 #define AML_NAME_CHAR_G              0x47
00048 #define AML_NAME_CHAR_H              0x48
00049 #define AML_NAME_CHAR_I              0x49
00050 #define AML_NAME_CHAR_J              0x4a
00051 #define AML_NAME_CHAR_K              0x4b
00052 #define AML_NAME_CHAR_L              0x4c
00053 #define AML_NAME_CHAR_M              0x4d
00054 #define AML_NAME_CHAR_N              0x4e
00055 #define AML_NAME_CHAR_O              0x4f
00056 #define AML_NAME_CHAR_P              0x50
00057 #define AML_NAME_CHAR_Q              0x51
00058 #define AML_NAME_CHAR_R              0x52
00059 #define AML_NAME_CHAR_S              0x53
00060 #define AML_NAME_CHAR_T              0x54
00061 #define AML_NAME_CHAR_U              0x55
00062 #define AML_NAME_CHAR_V              0x56
00063 #define AML_NAME_CHAR_W              0x57
00064 #define AML_NAME_CHAR_X              0x58
00065 #define AML_NAME_CHAR_Y              0x59
00066 #define AML_NAME_CHAR_Z              0x5a
00067 #define AML_ROOT_CHAR                0x5c
00068 #define AML_PARENT_PREFIX_CHAR       0x5e
00069 #define AML_NAME_CHAR__              0x5f
00070 #define AML_LOCAL0                   0x60
00071 #define AML_LOCAL1                   0x61
00072 #define AML_LOCAL2                   0x62
00073 #define AML_LOCAL3                   0x63
00074 #define AML_LOCAL4                   0x64
00075 #define AML_LOCAL5                   0x65
00076 #define AML_LOCAL6                   0x66
00077 #define AML_LOCAL7                   0x67
00078 #define AML_ARG0                     0x68
00079 #define AML_ARG1                     0x69
00080 #define AML_ARG2                     0x6a
00081 #define AML_ARG3                     0x6b
00082 #define AML_ARG4                     0x6c
00083 #define AML_ARG5                     0x6d
00084 #define AML_ARG6                     0x6e
00085 #define AML_STORE_OP                 0x70
00086 #define AML_REF_OF_OP                0x71
00087 #define AML_ADD_OP                   0x72
00088 #define AML_CONCAT_OP                0x73
00089 #define AML_SUBTRACT_OP              0x74
00090 #define AML_INCREMENT_OP             0x75
00091 #define AML_DECREMENT_OP             0x76
00092 #define AML_MULTIPLY_OP              0x77
00093 #define AML_DIVIDE_OP                0x78
00094 #define AML_SHIFT_LEFT_OP            0x79
00095 #define AML_SHIFT_RIGHT_OP           0x7a
00096 #define AML_AND_OP                   0x7b
00097 #define AML_NAND_OP                  0x7c
00098 #define AML_OR_OP                    0x7d
00099 #define AML_NOR_OP                   0x7e
00100 #define AML_XOR_OP                   0x7f
00101 #define AML_NOT_OP                   0x80
00102 #define AML_FIND_SET_LEFT_BIT_OP     0x81
00103 #define AML_FIND_SET_RIGHT_BIT_OP    0x82
00104 #define AML_DEREF_OF_OP              0x83
00105 #define AML_CONCAT_RES_OP            0x84
00106 #define AML_MOD_OP                   0x85
00107 #define AML_NOTIFY_OP                0x86
00108 #define AML_SIZE_OF_OP               0x87
00109 #define AML_INDEX_OP                 0x88
00110 #define AML_MATCH_OP                 0x89
00111 #define AML_CREATE_DWORD_FIELD_OP    0x8a
00112 #define AML_CREATE_WORD_FIELD_OP     0x8b
00113 #define AML_CREATE_BYTE_FIELD_OP     0x8c
00114 #define AML_CREATE_BIT_FIELD_OP      0x8d
00115 #define AML_OBJECT_TYPE_OP           0x8e
00116 #define AML_CREATE_QWORD_FIELD_OP    0x8f
00117 #define AML_LAND_OP                  0x90
00118 #define AML_LOR_OP                   0x91
00119 #define AML_LNOT_OP                  0x92
00120 #define AML_LEQUAL_OP                0x93
00121 #define AML_LGREATER_OP              0x94
00122 #define AML_LLESS_OP                 0x95
00123 #define AML_TO_BUFFER_OP             0x96
00124 #define AML_TO_DEC_STRING_OP         0x97
00125 #define AML_TO_HEX_STRING_OP         0x98
00126 #define AML_TO_INTEGER_OP            0x99
00127 #define AML_TO_STRING_OP             0x9c
00128 #define AML_COPY_OBJECT_OP           0x9d
00129 #define AML_MID_OP                   0x9e
00130 #define AML_CONTINUE_OP              0x9f
00131 #define AML_IF_OP                    0xa0
00132 #define AML_ELSE_OP                  0xa1
00133 #define AML_WHILE_OP                 0xa2
00134 #define AML_NOOP_OP                  0xa3
00135 #define AML_RETURN_OP                0xa4
00136 #define AML_BREAK_OP                 0xa5
00137 #define AML_BREAK_POINT_OP           0xcc
00138 #define AML_ONES_OP                  0xff
00139 
00140 //
00141 // Extended OpCode
00142 //
00143 #define AML_EXT_OP                   0x5b
00144 
00145 #define AML_EXT_MUTEX_OP             0x01
00146 #define AML_EXT_EVENT_OP             0x02
00147 #define AML_EXT_COND_REF_OF_OP       0x12
00148 #define AML_EXT_CREATE_FIELD_OP      0x13
00149 #define AML_EXT_LOAD_TABLE_OP        0x1f
00150 #define AML_EXT_LOAD_OP              0x20
00151 #define AML_EXT_STALL_OP             0x21
00152 #define AML_EXT_SLEEP_OP             0x22
00153 #define AML_EXT_ACQUIRE_OP           0x23
00154 #define AML_EXT_SIGNAL_OP            0x24
00155 #define AML_EXT_WAIT_OP              0x25
00156 #define AML_EXT_RESET_OP             0x26
00157 #define AML_EXT_RELEASE_OP           0x27
00158 #define AML_EXT_FROM_BCD_OP          0x28
00159 #define AML_EXT_TO_BCD_OP            0x29
00160 #define AML_EXT_UNLOAD_OP            0x2a
00161 #define AML_EXT_REVISION_OP          0x30
00162 #define AML_EXT_DEBUG_OP             0x31
00163 #define AML_EXT_FATAL_OP             0x32
00164 #define AML_EXT_TIMER_OP             0x33
00165 #define AML_EXT_REGION_OP            0x80
00166 #define AML_EXT_FIELD_OP             0x81
00167 #define AML_EXT_DEVICE_OP            0x82
00168 #define AML_EXT_PROCESSOR_OP         0x83
00169 #define AML_EXT_POWER_RES_OP         0x84
00170 #define AML_EXT_THERMAL_ZONE_OP      0x85
00171 #define AML_EXT_INDEX_FIELD_OP       0x86
00172 #define AML_EXT_BANK_FIELD_OP        0x87
00173 #define AML_EXT_DATA_REGION_OP       0x88
00174 
00175 //
00176 // Privacy data structure
00177 //
00178 
00179 //
00180 // ACPI Notify Linked List Signature.
00181 //
00182 #define EFI_ACPI_NOTIFY_LIST_SIGNATURE SIGNATURE_32 ('E', 'A', 'N', 'L')
00183 
00184 //
00185 // ACPI Notify List Entry definition.
00186 //
00187 //  Signature must be set to EFI_ACPI_NOTIFY_LIST_SIGNATURE
00188 //  Link is the linked list data.
00189 //  Notification is the callback function.
00190 //
00191 typedef struct {
00192   UINT32                   Signature;
00193   LIST_ENTRY               Link;
00194   EFI_ACPI_NOTIFICATION_FN Notification;
00195 } EFI_ACPI_NOTIFY_LIST;
00196 
00197 //
00198 // Containment record for ACPI Notify linked list.
00199 //
00200 #define EFI_ACPI_NOTIFY_LIST_FROM_LINK(_link)  CR (_link, EFI_ACPI_NOTIFY_LIST, Link, EFI_ACPI_NOTIFY_LIST_SIGNATURE)
00201 
00202 typedef struct _AML_BYTE_ENCODING AML_BYTE_ENCODING;
00203 typedef struct _EFI_AML_NODE_LIST EFI_AML_NODE_LIST;
00204 
00205 //
00206 // AML Node Linked List Signature.
00207 //
00208 #define EFI_AML_NODE_LIST_SIGNATURE SIGNATURE_32 ('E', 'A', 'M', 'L')
00209 
00210 //
00211 // AML Node Linked List Entry definition.
00212 //
00213 //  Signature must be set to EFI_AML_NODE_LIST_SIGNATURE
00214 //  Link is the linked list data.
00215 //  Name is the ACPI node name.
00216 //         This is listed for PATH finding.
00217 //  Buffer is the ACPI node buffer pointer, the first/second bytes are opcode.
00218 //         This buffer should not be freed.
00219 //  Size is the total size of this ACPI node buffer.
00220 //  Children is the children linked list of this node.
00221 //
00222 #define AML_NAME_SEG_SIZE  4
00223 
00224 struct _EFI_AML_NODE_LIST {
00225   UINT32                  Signature;
00226   UINT8                   Name[AML_NAME_SEG_SIZE];
00227   UINT8                   *Buffer;
00228   UINTN                   Size;
00229   LIST_ENTRY              Link;
00230   LIST_ENTRY              Children;
00231   EFI_AML_NODE_LIST       *Parent;
00232   AML_BYTE_ENCODING       *AmlByteEncoding;
00233 };
00234 
00235 //
00236 // Containment record for AML Node linked list.
00237 //
00238 #define EFI_AML_NODE_LIST_FROM_LINK(_link)  CR (_link, EFI_AML_NODE_LIST, Link, EFI_AML_NODE_LIST_SIGNATURE)
00239 
00240 //
00241 // AML Handle Signature.
00242 //
00243 #define EFI_AML_HANDLE_SIGNATURE SIGNATURE_32 ('E', 'A', 'H', 'S')
00244 #define EFI_AML_ROOT_HANDLE_SIGNATURE SIGNATURE_32 ('E', 'A', 'R', 'H')
00245 
00246 //
00247 // AML Handle Entry definition.
00248 //
00249 //  Signature must be set to EFI_AML_HANDLE_SIGNATURE or EFI_AML_ROOT_HANDLE_SIGNATURE
00250 //  Buffer is the ACPI node buffer pointer, the first/second bytes are opcode.
00251 //         This buffer should not be freed.
00252 //  Size is the total size of this ACPI node buffer.
00253 //
00254 typedef struct {
00255   UINT32                  Signature;
00256   UINT8                   *Buffer;
00257   UINTN                   Size;
00258   AML_BYTE_ENCODING       *AmlByteEncoding;
00259   BOOLEAN                 Modified;
00260 } EFI_AML_HANDLE;
00261 
00262 typedef UINT32 AML_OP_PARSE_INDEX;
00263 
00264 #define AML_OP_PARSE_INDEX_GET_OPCODE     0
00265 #define AML_OP_PARSE_INDEX_GET_TERM1      1
00266 #define AML_OP_PARSE_INDEX_GET_TERM2      2
00267 #define AML_OP_PARSE_INDEX_GET_TERM3      3
00268 #define AML_OP_PARSE_INDEX_GET_TERM4      4
00269 #define AML_OP_PARSE_INDEX_GET_TERM5      5
00270 #define AML_OP_PARSE_INDEX_GET_TERM6      6
00271 #define AML_OP_PARSE_INDEX_GET_SIZE       (AML_OP_PARSE_INDEX)-1
00272 
00273 typedef UINT32 AML_OP_PARSE_FORMAT;
00274 #define AML_NONE         0
00275 #define AML_OPCODE       1
00276 #define AML_UINT8        2
00277 #define AML_UINT16       3
00278 #define AML_UINT32       4
00279 #define AML_UINT64       5
00280 #define AML_NAME         6
00281 #define AML_STRING       7
00282 #define AML_OBJECT       8
00283 
00284 typedef UINT32 AML_OP_ATTRIBUTE;
00285 #define AML_HAS_PKG_LENGTH       0x1     // It is ACPI attribute - if OpCode has PkgLength
00286 #define AML_IS_NAME_CHAR         0x2     // It is ACPI attribute - if this is NameChar
00287 #define AML_HAS_CHILD_OBJ        0x4     // it is ACPI attribute - if OpCode has Child Object.
00288 #define AML_IN_NAMESPACE         0x10000 // It is UEFI SDT attribute - if OpCode will be in NameSpace
00289                                          // NOTE; Not all OBJECT will be in NameSpace
00290                                          // For example, BankField | CreateBitField | CreateByteField | CreateDWordField | 
00291                                          //   CreateField | CreateQWordField | CreateWordField | Field | IndexField.
00292 
00293 struct _AML_BYTE_ENCODING {
00294   UINT8                      OpCode;
00295   UINT8                      SubOpCode;
00296   AML_OP_PARSE_INDEX         MaxIndex;
00297   AML_OP_PARSE_FORMAT        Format[6];
00298   AML_OP_ATTRIBUTE           Attribute;
00299 };
00300 
00301 //
00302 // AcpiSdt protocol declaration
00303 //
00304 
00328 EFI_STATUS
00329 EFIAPI
00330 GetAcpiTable2 (
00331   IN  UINTN                               Index,
00332   OUT EFI_ACPI_SDT_HEADER                 **Table,
00333   OUT EFI_ACPI_TABLE_VERSION              *Version,
00334   OUT UINTN                               *TableKey
00335   );
00336 
00351 EFI_STATUS
00352 EFIAPI
00353 RegisterNotify (
00354   IN BOOLEAN                    Register,
00355   IN EFI_ACPI_NOTIFICATION_FN   Notification
00356   );
00357 
00367 EFI_STATUS
00368 EFIAPI
00369 OpenSdt (
00370   IN    UINTN           TableKey,
00371   OUT   EFI_ACPI_HANDLE *Handle
00372   );
00373 
00385 EFI_STATUS
00386 EFIAPI
00387 Open (
00388   IN    VOID            *Buffer,
00389   OUT   EFI_ACPI_HANDLE *Handle 
00390   );
00391 
00400 EFI_STATUS
00401 EFIAPI
00402 Close (
00403   IN EFI_ACPI_HANDLE Handle
00404   );
00405 
00420 EFI_STATUS
00421 EFIAPI
00422 GetOption (
00423   IN        EFI_ACPI_HANDLE     Handle,
00424   IN        UINTN               Index,
00425   OUT       EFI_ACPI_DATA_TYPE  *DataType,
00426   OUT CONST VOID                **Data,
00427   OUT       UINTN               *DataSize
00428   );
00429 
00445 EFI_STATUS
00446 EFIAPI
00447 SetOption (
00448   IN        EFI_ACPI_HANDLE Handle,
00449   IN        UINTN           Index,
00450   IN CONST  VOID            *Data,
00451   IN        UINTN           DataSize
00452   );
00453 
00465 EFI_STATUS
00466 EFIAPI
00467 GetChild (
00468   IN EFI_ACPI_HANDLE        ParentHandle,
00469   IN OUT EFI_ACPI_HANDLE    *Handle
00470   );
00471 
00483 EFI_STATUS
00484 EFIAPI
00485 FindPath (
00486   IN    EFI_ACPI_HANDLE HandleIn,
00487   IN    VOID            *AcpiPath,
00488   OUT   EFI_ACPI_HANDLE *HandleOut
00489   );
00490 
00491 //
00492 // ACPI SDT function
00493 //
00494 
00507 EFI_STATUS
00508 SdtOpenEx (
00509   IN    VOID            *Buffer,
00510   IN    UINTN           BufferSize,
00511   OUT   EFI_ACPI_HANDLE *Handle 
00512   );
00513 
00514 //
00515 // AML support function
00516 //
00517 
00527 EFI_STATUS
00528 AmlGetNameStringSize (
00529   IN  UINT8              *Buffer,
00530   OUT UINTN              *BufferSize
00531   );
00532 
00541 UINTN
00542 AmlGetPkgLength (
00543   IN UINT8              *Buffer,
00544   OUT UINTN             *PkgLength
00545   );
00546 
00554 EFI_ACPI_DATA_TYPE
00555 AmlTypeToAcpiType (
00556   IN AML_OP_PARSE_FORMAT  AmlType
00557   );
00558 
00566 AML_BYTE_ENCODING *
00567 AmlSearchByOpByte (
00568   IN UINT8                *OpByteBuffer
00569   );
00570 
00580 UINTN
00581 AmlGetObjectSize (
00582   IN AML_BYTE_ENCODING   *AmlByteEncoding,
00583   IN UINT8               *Buffer,
00584   IN UINTN               MaxBufferSize
00585   );
00586 
00594 CHAR8 *
00595 AmlGetObjectName (
00596   IN EFI_AML_HANDLE      *AmlHandle
00597   );
00598 
00613 EFI_STATUS
00614 AmlParseOptionHandleCommon (
00615   IN EFI_AML_HANDLE      *AmlHandle,
00616   IN AML_OP_PARSE_INDEX  Index,
00617   OUT EFI_ACPI_DATA_TYPE *DataType,
00618   OUT VOID               **Data,
00619   OUT UINTN              *DataSize
00620   );
00621 
00631 EFI_STATUS
00632 AmlGetOffsetAfterLastOption (
00633   IN EFI_AML_HANDLE         *AmlHandle,
00634   OUT UINT8                 **Buffer
00635   );
00636 
00648 EFI_STATUS
00649 AmlGetChildFromRoot (
00650   IN EFI_AML_HANDLE         *AmlParentHandle,
00651   IN EFI_AML_HANDLE         *AmlHandle,
00652   OUT VOID                  **Buffer
00653   );
00654 
00666 EFI_STATUS
00667 AmlGetChildFromNonRoot (
00668   IN EFI_AML_HANDLE         *AmlParentHandle,
00669   IN EFI_AML_HANDLE         *AmlHandle,
00670   OUT VOID                  **Buffer
00671   );
00672 
00681 UINT8 *
00682 AmlNameFromAslName (
00683   IN UINT8 *AslPath
00684   );
00685 
00699 EFI_STATUS
00700 AmlFindPath (
00701   IN    EFI_AML_HANDLE  *AmlHandle,
00702   IN    UINT8           *AmlPath,
00703   OUT   VOID            **Buffer,
00704   IN    BOOLEAN         FromRoot
00705   );
00706 
00712 VOID
00713 AmlPrintNameString (
00714   IN UINT8              *Buffer
00715   );
00716 
00722 VOID
00723 AmlPrintNameSeg (
00724   IN UINT8              *Buffer
00725   );
00726 
00735 BOOLEAN
00736 AmlIsRootPath (
00737   IN UINT8              *Buffer
00738   );
00739 
00740 #endif
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Defines