1*e985c628SWarner Losh /** @file 2*e985c628SWarner Losh This protocol provides services for creating ACPI system description tables. 3*e985c628SWarner Losh 4*e985c628SWarner Losh Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR> 5*e985c628SWarner Losh SPDX-License-Identifier: BSD-2-Clause-Patent 6*e985c628SWarner Losh 7*e985c628SWarner Losh @par Revision Reference: 8*e985c628SWarner Losh This Protocol was introduced in PI Specification 1.2. 9*e985c628SWarner Losh 10*e985c628SWarner Losh **/ 11*e985c628SWarner Losh 12*e985c628SWarner Losh #ifndef __ACPI_SYSTEM_DESCRIPTION_TABLE_H___ 13*e985c628SWarner Losh #define __ACPI_SYSTEM_DESCRIPTION_TABLE_H___ 14*e985c628SWarner Losh 15*e985c628SWarner Losh #define EFI_ACPI_SDT_PROTOCOL_GUID \ 16*e985c628SWarner Losh { 0xeb97088e, 0xcfdf, 0x49c6, { 0xbe, 0x4b, 0xd9, 0x6, 0xa5, 0xb2, 0xe, 0x86 }} 17*e985c628SWarner Losh 18*e985c628SWarner Losh typedef UINT32 EFI_ACPI_TABLE_VERSION; 19*e985c628SWarner Losh typedef VOID *EFI_ACPI_HANDLE; 20*e985c628SWarner Losh 21*e985c628SWarner Losh #define EFI_ACPI_TABLE_VERSION_NONE (1 << 0) 22*e985c628SWarner Losh #define EFI_ACPI_TABLE_VERSION_1_0B (1 << 1) 23*e985c628SWarner Losh #define EFI_ACPI_TABLE_VERSION_2_0 (1 << 2) 24*e985c628SWarner Losh #define EFI_ACPI_TABLE_VERSION_3_0 (1 << 3) 25*e985c628SWarner Losh #define EFI_ACPI_TABLE_VERSION_4_0 (1 << 4) 26*e985c628SWarner Losh #define EFI_ACPI_TABLE_VERSION_5_0 (1 << 5) 27*e985c628SWarner Losh 28*e985c628SWarner Losh typedef UINT32 EFI_ACPI_DATA_TYPE; 29*e985c628SWarner Losh #define EFI_ACPI_DATA_TYPE_NONE 0 30*e985c628SWarner Losh #define EFI_ACPI_DATA_TYPE_OPCODE 1 31*e985c628SWarner Losh #define EFI_ACPI_DATA_TYPE_NAME_STRING 2 32*e985c628SWarner Losh #define EFI_ACPI_DATA_TYPE_OP 3 33*e985c628SWarner Losh #define EFI_ACPI_DATA_TYPE_UINT 4 34*e985c628SWarner Losh #define EFI_ACPI_DATA_TYPE_STRING 5 35*e985c628SWarner Losh #define EFI_ACPI_DATA_TYPE_CHILD 6 36*e985c628SWarner Losh 37*e985c628SWarner Losh typedef struct { 38*e985c628SWarner Losh UINT32 Signature; 39*e985c628SWarner Losh UINT32 Length; 40*e985c628SWarner Losh UINT8 Revision; 41*e985c628SWarner Losh UINT8 Checksum; 42*e985c628SWarner Losh CHAR8 OemId[6]; 43*e985c628SWarner Losh CHAR8 OemTableId[8]; 44*e985c628SWarner Losh UINT32 OemRevision; 45*e985c628SWarner Losh UINT32 CreatorId; 46*e985c628SWarner Losh UINT32 CreatorRevision; 47*e985c628SWarner Losh } EFI_ACPI_SDT_HEADER; 48*e985c628SWarner Losh 49*e985c628SWarner Losh typedef 50*e985c628SWarner Losh EFI_STATUS 51*e985c628SWarner Losh (EFIAPI *EFI_ACPI_NOTIFICATION_FN)( 52*e985c628SWarner Losh IN EFI_ACPI_SDT_HEADER *Table, ///< A pointer to the ACPI table header. 53*e985c628SWarner Losh IN EFI_ACPI_TABLE_VERSION Version, ///< The ACPI table's version. 54*e985c628SWarner Losh IN UINTN TableKey ///< The table key for this ACPI table. 55*e985c628SWarner Losh ); 56*e985c628SWarner Losh 57*e985c628SWarner Losh /** 58*e985c628SWarner Losh Returns a requested ACPI table. 59*e985c628SWarner Losh 60*e985c628SWarner Losh The GetAcpiTable() function returns a pointer to a buffer containing the ACPI table associated 61*e985c628SWarner Losh with the Index that was input. The following structures are not considered elements in the list of 62*e985c628SWarner Losh ACPI tables: 63*e985c628SWarner Losh - Root System Description Pointer (RSD_PTR) 64*e985c628SWarner Losh - Root System Description Table (RSDT) 65*e985c628SWarner Losh - Extended System Description Table (XSDT) 66*e985c628SWarner Losh Version is updated with a bit map containing all the versions of ACPI of which the table is a 67*e985c628SWarner Losh member. For tables installed via the EFI_ACPI_TABLE_PROTOCOL.InstallAcpiTable() interface, 68*e985c628SWarner Losh the function returns the value of EFI_ACPI_STD_PROTOCOL.AcpiVersion. 69*e985c628SWarner Losh 70*e985c628SWarner Losh @param[in] Index The zero-based index of the table to retrieve. 71*e985c628SWarner Losh @param[out] Table Pointer for returning the table buffer. 72*e985c628SWarner Losh @param[out] Version On return, updated with the ACPI versions to which this table belongs. Type 73*e985c628SWarner Losh EFI_ACPI_TABLE_VERSION is defined in "Related Definitions" in the 74*e985c628SWarner Losh EFI_ACPI_SDT_PROTOCOL. 75*e985c628SWarner Losh @param[out] TableKey On return, points to the table key for the specified ACPI system definition table. 76*e985c628SWarner Losh This is identical to the table key used in the EFI_ACPI_TABLE_PROTOCOL. 77*e985c628SWarner Losh The TableKey can be passed to EFI_ACPI_TABLE_PROTOCOL.UninstallAcpiTable() 78*e985c628SWarner Losh to uninstall the table. 79*e985c628SWarner Losh 80*e985c628SWarner Losh @retval EFI_SUCCESS The function completed successfully. 81*e985c628SWarner Losh @retval EFI_NOT_FOUND The requested index is too large and a table was not found. 82*e985c628SWarner Losh **/ 83*e985c628SWarner Losh typedef 84*e985c628SWarner Losh EFI_STATUS 85*e985c628SWarner Losh (EFIAPI *EFI_ACPI_GET_ACPI_TABLE2)( 86*e985c628SWarner Losh IN UINTN Index, 87*e985c628SWarner Losh OUT EFI_ACPI_SDT_HEADER **Table, 88*e985c628SWarner Losh OUT EFI_ACPI_TABLE_VERSION *Version, 89*e985c628SWarner Losh OUT UINTN *TableKey 90*e985c628SWarner Losh ); 91*e985c628SWarner Losh 92*e985c628SWarner Losh /** 93*e985c628SWarner Losh Register or unregister a callback when an ACPI table is installed. 94*e985c628SWarner Losh 95*e985c628SWarner Losh This function registers or unregisters a function which will be called whenever a new ACPI table is 96*e985c628SWarner Losh installed. 97*e985c628SWarner Losh 98*e985c628SWarner Losh @param[in] Register If TRUE, then the specified function will be registered. If FALSE, then the specified 99*e985c628SWarner Losh function will be unregistered. 100*e985c628SWarner Losh @param[in] Notification Points to the callback function to be registered or unregistered. 101*e985c628SWarner Losh 102*e985c628SWarner Losh @retval EFI_SUCCESS Callback successfully registered or unregistered. 103*e985c628SWarner Losh @retval EFI_INVALID_PARAMETER Notification is NULL 104*e985c628SWarner Losh @retval EFI_INVALID_PARAMETER Register is FALSE and Notification does not match a known registration function. 105*e985c628SWarner Losh **/ 106*e985c628SWarner Losh typedef 107*e985c628SWarner Losh EFI_STATUS 108*e985c628SWarner Losh (EFIAPI *EFI_ACPI_REGISTER_NOTIFY)( 109*e985c628SWarner Losh IN BOOLEAN Register, 110*e985c628SWarner Losh IN EFI_ACPI_NOTIFICATION_FN Notification 111*e985c628SWarner Losh ); 112*e985c628SWarner Losh 113*e985c628SWarner Losh /** 114*e985c628SWarner Losh Create a handle from an ACPI opcode 115*e985c628SWarner Losh 116*e985c628SWarner Losh @param[in] Buffer Points to the ACPI opcode. 117*e985c628SWarner Losh @param[out] Handle Upon return, holds the handle. 118*e985c628SWarner Losh 119*e985c628SWarner Losh @retval EFI_SUCCESS Success 120*e985c628SWarner Losh @retval EFI_INVALID_PARAMETER Buffer is NULL or Handle is NULL or Buffer points to an 121*e985c628SWarner Losh invalid opcode. 122*e985c628SWarner Losh 123*e985c628SWarner Losh **/ 124*e985c628SWarner Losh typedef 125*e985c628SWarner Losh EFI_STATUS 126*e985c628SWarner Losh (EFIAPI *EFI_ACPI_OPEN)( 127*e985c628SWarner Losh IN VOID *Buffer, 128*e985c628SWarner Losh OUT EFI_ACPI_HANDLE *Handle 129*e985c628SWarner Losh ); 130*e985c628SWarner Losh 131*e985c628SWarner Losh /** 132*e985c628SWarner Losh Create a handle for the first ACPI opcode in an ACPI system description table. 133*e985c628SWarner Losh 134*e985c628SWarner Losh @param[in] TableKey The table key for the ACPI table, as returned by GetTable(). 135*e985c628SWarner Losh @param[out] Handle On return, points to the newly created ACPI handle. 136*e985c628SWarner Losh 137*e985c628SWarner Losh @retval EFI_SUCCESS Handle created successfully. 138*e985c628SWarner Losh @retval EFI_NOT_FOUND TableKey does not refer to a valid ACPI table. 139*e985c628SWarner Losh **/ 140*e985c628SWarner Losh typedef 141*e985c628SWarner Losh EFI_STATUS 142*e985c628SWarner Losh (EFIAPI *EFI_ACPI_OPEN_SDT)( 143*e985c628SWarner Losh IN UINTN TableKey, 144*e985c628SWarner Losh OUT EFI_ACPI_HANDLE *Handle 145*e985c628SWarner Losh ); 146*e985c628SWarner Losh 147*e985c628SWarner Losh /** 148*e985c628SWarner Losh Close an ACPI handle. 149*e985c628SWarner Losh 150*e985c628SWarner Losh @param[in] Handle Returns the handle. 151*e985c628SWarner Losh 152*e985c628SWarner Losh @retval EFI_SUCCESS Success 153*e985c628SWarner Losh @retval EFI_INVALID_PARAMETER Handle is NULL or does not refer to a valid ACPI object. 154*e985c628SWarner Losh **/ 155*e985c628SWarner Losh typedef 156*e985c628SWarner Losh EFI_STATUS 157*e985c628SWarner Losh (EFIAPI *EFI_ACPI_CLOSE)( 158*e985c628SWarner Losh IN EFI_ACPI_HANDLE Handle 159*e985c628SWarner Losh ); 160*e985c628SWarner Losh 161*e985c628SWarner Losh /** 162*e985c628SWarner Losh Return the child ACPI objects. 163*e985c628SWarner Losh 164*e985c628SWarner Losh @param[in] ParentHandle Parent handle. 165*e985c628SWarner Losh @param[in, out] Handle On entry, points to the previously returned handle or NULL to start with the first 166*e985c628SWarner Losh handle. On return, points to the next returned ACPI handle or NULL if there are no 167*e985c628SWarner Losh child objects. 168*e985c628SWarner Losh 169*e985c628SWarner Losh @retval EFI_SUCCESS Success 170*e985c628SWarner Losh @retval EFI_INVALID_PARAMETER ParentHandle is NULL or does not refer to a valid ACPI object. 171*e985c628SWarner Losh **/ 172*e985c628SWarner Losh typedef 173*e985c628SWarner Losh EFI_STATUS 174*e985c628SWarner Losh (EFIAPI *EFI_ACPI_GET_CHILD)( 175*e985c628SWarner Losh IN EFI_ACPI_HANDLE ParentHandle, 176*e985c628SWarner Losh IN OUT EFI_ACPI_HANDLE *Handle 177*e985c628SWarner Losh ); 178*e985c628SWarner Losh 179*e985c628SWarner Losh /** 180*e985c628SWarner Losh Retrieve information about an ACPI object. 181*e985c628SWarner Losh 182*e985c628SWarner Losh @param[in] Handle ACPI object handle. 183*e985c628SWarner Losh @param[in] Index Index of the data to retrieve from the object. In general, indexes read from left-to-right 184*e985c628SWarner Losh in the ACPI encoding, with index 0 always being the ACPI opcode. 185*e985c628SWarner Losh @param[out] DataType Points to the returned data type or EFI_ACPI_DATA_TYPE_NONE if no data exists 186*e985c628SWarner Losh for the specified index. 187*e985c628SWarner Losh @param[out] Data Upon return, points to the pointer to the data. 188*e985c628SWarner Losh @param[out] DataSize Upon return, points to the size of Data. 189*e985c628SWarner Losh 190*e985c628SWarner Losh @retval 191*e985c628SWarner Losh **/ 192*e985c628SWarner Losh typedef 193*e985c628SWarner Losh EFI_STATUS 194*e985c628SWarner Losh (EFIAPI *EFI_ACPI_GET_OPTION)( 195*e985c628SWarner Losh IN EFI_ACPI_HANDLE Handle, 196*e985c628SWarner Losh IN UINTN Index, 197*e985c628SWarner Losh OUT EFI_ACPI_DATA_TYPE *DataType, 198*e985c628SWarner Losh OUT CONST VOID **Data, 199*e985c628SWarner Losh OUT UINTN *DataSize 200*e985c628SWarner Losh ); 201*e985c628SWarner Losh 202*e985c628SWarner Losh /** 203*e985c628SWarner Losh Change information about an ACPI object. 204*e985c628SWarner Losh 205*e985c628SWarner Losh @param[in] Handle ACPI object handle. 206*e985c628SWarner Losh @param[in] Index Index of the data to retrieve from the object. In general, indexes read from left-to-right 207*e985c628SWarner Losh in the ACPI encoding, with index 0 always being the ACPI opcode. 208*e985c628SWarner Losh @param[in] Data Points to the data. 209*e985c628SWarner Losh @param[in] DataSize The size of the Data. 210*e985c628SWarner Losh 211*e985c628SWarner Losh @retval EFI_SUCCESS Success 212*e985c628SWarner Losh @retval EFI_INVALID_PARAMETER Handle is NULL or does not refer to a valid ACPI object. 213*e985c628SWarner Losh @retval EFI_BAD_BUFFER_SIZE Data cannot be accommodated in the space occupied by 214*e985c628SWarner Losh the option. 215*e985c628SWarner Losh 216*e985c628SWarner Losh **/ 217*e985c628SWarner Losh typedef 218*e985c628SWarner Losh EFI_STATUS 219*e985c628SWarner Losh (EFIAPI *EFI_ACPI_SET_OPTION)( 220*e985c628SWarner Losh IN EFI_ACPI_HANDLE Handle, 221*e985c628SWarner Losh IN UINTN Index, 222*e985c628SWarner Losh IN CONST VOID *Data, 223*e985c628SWarner Losh IN UINTN DataSize 224*e985c628SWarner Losh ); 225*e985c628SWarner Losh 226*e985c628SWarner Losh /** 227*e985c628SWarner Losh Returns the handle of the ACPI object representing the specified ACPI path 228*e985c628SWarner Losh 229*e985c628SWarner Losh @param[in] HandleIn Points to the handle of the object representing the starting point for the path search. 230*e985c628SWarner Losh @param[in] AcpiPath Points to the ACPI path, which conforms to the ACPI encoded path format. 231*e985c628SWarner Losh @param[out] HandleOut On return, points to the ACPI object which represents AcpiPath, relative to 232*e985c628SWarner Losh HandleIn. 233*e985c628SWarner Losh 234*e985c628SWarner Losh @retval EFI_SUCCESS Success 235*e985c628SWarner Losh @retval EFI_INVALID_PARAMETER HandleIn is NULL or does not refer to a valid ACPI object. 236*e985c628SWarner Losh **/ 237*e985c628SWarner Losh typedef 238*e985c628SWarner Losh EFI_STATUS 239*e985c628SWarner Losh (EFIAPI *EFI_ACPI_FIND_PATH)( 240*e985c628SWarner Losh IN EFI_ACPI_HANDLE HandleIn, 241*e985c628SWarner Losh IN VOID *AcpiPath, 242*e985c628SWarner Losh OUT EFI_ACPI_HANDLE *HandleOut 243*e985c628SWarner Losh ); 244*e985c628SWarner Losh 245*e985c628SWarner Losh typedef struct _EFI_ACPI_SDT_PROTOCOL { 246*e985c628SWarner Losh /// 247*e985c628SWarner Losh /// A bit map containing all the ACPI versions supported by this protocol. 248*e985c628SWarner Losh /// 249*e985c628SWarner Losh EFI_ACPI_TABLE_VERSION AcpiVersion; 250*e985c628SWarner Losh EFI_ACPI_GET_ACPI_TABLE2 GetAcpiTable; 251*e985c628SWarner Losh EFI_ACPI_REGISTER_NOTIFY RegisterNotify; 252*e985c628SWarner Losh EFI_ACPI_OPEN Open; 253*e985c628SWarner Losh EFI_ACPI_OPEN_SDT OpenSdt; 254*e985c628SWarner Losh EFI_ACPI_CLOSE Close; 255*e985c628SWarner Losh EFI_ACPI_GET_CHILD GetChild; 256*e985c628SWarner Losh EFI_ACPI_GET_OPTION GetOption; 257*e985c628SWarner Losh EFI_ACPI_SET_OPTION SetOption; 258*e985c628SWarner Losh EFI_ACPI_FIND_PATH FindPath; 259*e985c628SWarner Losh } EFI_ACPI_SDT_PROTOCOL; 260*e985c628SWarner Losh 261*e985c628SWarner Losh extern EFI_GUID gEfiAcpiSdtProtocolGuid; 262*e985c628SWarner Losh 263*e985c628SWarner Losh #endif // __ACPI_SYSTEM_DESCRIPTION_TABLE_H___ 264