/** @file\r
ACPI Table Protocol Driver\r
\r
- Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>\r
- This program and the accompanying materials\r
- are licensed and made available under the terms and conditions of the BSD License\r
- which accompanies this distribution. The full text of the license may be found at\r
- http://opensource.org/licenses/bsd-license.php\r
-\r
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+ Copyright (c) 2006 - 2021, Intel Corporation. All rights reserved.<BR>\r
+ SPDX-License-Identifier: BSD-2-Clause-Patent\r
\r
**/\r
\r
#ifndef _ACPI_TABLE_H_\r
#define _ACPI_TABLE_H_\r
\r
-\r
#include <PiDxe.h>\r
\r
#include <Protocol/AcpiTable.h>\r
#include <Guid/Acpi.h>\r
#include <Protocol/AcpiSystemDescriptionTable.h>\r
-#include <Protocol/DxeSmmReadyToLock.h>\r
\r
#include <Library/BaseLib.h>\r
#include <Library/DebugLib.h>\r
#include <Library/MemoryAllocationLib.h>\r
#include <Library/UefiBootServicesTableLib.h>\r
#include <Library/PcdLib.h>\r
+#include <Library/HobLib.h>\r
+#include <UniversalPayload/AcpiTable.h>\r
\r
//\r
// Statements that include other files\r
#include "AcpiSdt.h"\r
\r
//\r
-// From Protocol/AcpiSupport.h\r
+// Great than or equal to 2.0.\r
//\r
-\r
-//\r
-// ACPI Version bitmap definition:\r
-//\r
-// EFI_ACPI_TABLE_VERSION_1_0B - ACPI Version 1.0b\r
-// EFI_ACPI_TABLE_VERSION_2_0 - ACPI Version 2.0\r
-// EFI_ACPI_TABLE_VERSION_3_0 - ACPI Version 3.0\r
-// EFI_ACPI_TABLE_VERSION_NONE - No ACPI Versions. This might be used\r
-// to create memory-based operation regions or other information\r
-// that is not part of the ACPI "tree" but must still be found\r
-// in ACPI memory space and/or managed by the core ACPI driver.\r
-//\r
-// Note that EFI provides discrete GUIDs for each version of ACPI\r
-// that is supported. It is expected that each EFI GUIDed\r
-// version of ACPI will also have a corresponding bitmap\r
-// definition. This allows maintenance of separate ACPI trees\r
-// for each distinctly different version of ACPI.\r
-//\r
-#define EFI_ACPI_TABLE_VERSION UINT32\r
-\r
-#define EFI_ACPI_TABLE_VERSION_NONE (1 << 0)\r
-#define EFI_ACPI_TABLE_VERSION_1_0B (1 << 1)\r
-#define EFI_ACPI_TABLE_VERSION_2_0 (1 << 2)\r
-#define EFI_ACPI_TABLE_VERSION_3_0 (1 << 3)\r
+#define ACPI_TABLE_VERSION_GTE_2_0 (EFI_ACPI_TABLE_VERSION_2_0 |\\r
+ EFI_ACPI_TABLE_VERSION_3_0 | \\r
+ EFI_ACPI_TABLE_VERSION_4_0 | \\r
+ EFI_ACPI_TABLE_VERSION_5_0)\r
\r
//\r
// Private Driver Data\r
//\r
// ACPI Table Linked List Signature.\r
//\r
-#define EFI_ACPI_TABLE_LIST_SIGNATURE SIGNATURE_32 ('E', 'A', 'T', 'L')\r
+#define EFI_ACPI_TABLE_LIST_SIGNATURE SIGNATURE_32 ('E', 'A', 'T', 'L')\r
\r
//\r
// ACPI Table Linked List Entry definition.\r
// Link is the linked list data.\r
// Version is the versions of the ACPI tables that this table belongs in.\r
// Table is a pointer to the table.\r
-// PageAddress is the address of the pages allocated for the table.\r
-// NumberOfPages is the number of pages allocated at PageAddress.\r
+// TableSize is the size of the table\r
// Handle is used to identify a particular table.\r
+// PoolAllocation carries the allocation type:\r
+// FALSE: Table points to EFI_SIZE_TO_PAGES(TableSize) pages allocated using\r
+// gBS->AllocatePages ()\r
+// TRUE: Table points to TableSize bytes allocated using gBS->AllocatePool ()\r
//\r
typedef struct {\r
- UINT32 Signature;\r
- LIST_ENTRY Link;\r
- EFI_ACPI_TABLE_VERSION Version;\r
- EFI_ACPI_COMMON_HEADER *Table;\r
- EFI_PHYSICAL_ADDRESS PageAddress;\r
- UINTN NumberOfPages;\r
- UINTN Handle;\r
+ UINT32 Signature;\r
+ LIST_ENTRY Link;\r
+ EFI_ACPI_TABLE_VERSION Version;\r
+ EFI_ACPI_COMMON_HEADER *Table;\r
+ UINTN TableSize;\r
+ UINTN Handle;\r
+ BOOLEAN PoolAllocation;\r
} EFI_ACPI_TABLE_LIST;\r
\r
//\r
//\r
// The maximum number of tables this driver supports\r
//\r
-#define EFI_ACPI_MAX_NUM_TABLES 20\r
-\r
-//\r
-// ACPI table information used to initialize tables.\r
-//\r
-#define EFI_ACPI_OEM_ID "INTEL "\r
-#define EFI_ACPI_OEM_TABLE_ID SIGNATURE_64('E', 'D', 'K', '2', ' ', ' ', ' ', ' ')\r
-#define EFI_ACPI_OEM_REVISION 0x00000002\r
-#define EFI_ACPI_CREATOR_ID 0x20202020\r
-#define EFI_ACPI_CREATOR_REVISION 0x01000013\r
+#define EFI_ACPI_MAX_NUM_TABLES 20\r
\r
//\r
// Protocol private structure definition\r
// ACPI support protocol instance data structure\r
//\r
typedef struct {\r
- UINTN Signature;\r
- EFI_ACPI_1_0_ROOT_SYSTEM_DESCRIPTION_POINTER *Rsdp1; // Pointer to RSD_PTR structure\r
- EFI_ACPI_3_0_ROOT_SYSTEM_DESCRIPTION_POINTER *Rsdp3; // Pointer to RSD_PTR structure\r
- EFI_ACPI_DESCRIPTION_HEADER *Rsdt1; // Pointer to RSDT table header\r
- EFI_ACPI_DESCRIPTION_HEADER *Rsdt3; // Pointer to RSDT table header\r
- EFI_ACPI_DESCRIPTION_HEADER *Xsdt; // Pointer to XSDT table header\r
- EFI_ACPI_1_0_FIXED_ACPI_DESCRIPTION_TABLE *Fadt1; // Pointer to FADT table header\r
- EFI_ACPI_3_0_FIXED_ACPI_DESCRIPTION_TABLE *Fadt3; // Pointer to FADT table header\r
- EFI_ACPI_1_0_FIRMWARE_ACPI_CONTROL_STRUCTURE *Facs1; // Pointer to FACS table header\r
- EFI_ACPI_3_0_FIRMWARE_ACPI_CONTROL_STRUCTURE *Facs3; // Pointer to FACS table header\r
- EFI_ACPI_DESCRIPTION_HEADER *Dsdt1; // Pointer to DSDT table header\r
- EFI_ACPI_DESCRIPTION_HEADER *Dsdt3; // Pointer to DSDT table header\r
- LIST_ENTRY TableList;\r
- UINTN NumberOfTableEntries1; // Number of ACPI 1.0 tables\r
- UINTN NumberOfTableEntries3; // Number of ACPI 3.0 tables\r
- UINTN CurrentHandle;\r
- BOOLEAN TablesInstalled1; // ACPI 1.0 tables published\r
- BOOLEAN TablesInstalled3; // ACPI 3.0 tables published\r
- EFI_ACPI_TABLE_PROTOCOL AcpiTableProtocol;\r
- EFI_ACPI_SDT_PROTOCOL AcpiSdtProtocol;\r
- LIST_ENTRY NotifyList;\r
+ UINTN Signature;\r
+ EFI_ACPI_1_0_ROOT_SYSTEM_DESCRIPTION_POINTER *Rsdp1; // Pointer to RSD_PTR structure\r
+ EFI_ACPI_3_0_ROOT_SYSTEM_DESCRIPTION_POINTER *Rsdp3; // Pointer to RSD_PTR structure\r
+ EFI_ACPI_DESCRIPTION_HEADER *Rsdt1; // Pointer to RSDT table header\r
+ EFI_ACPI_DESCRIPTION_HEADER *Rsdt3; // Pointer to RSDT table header\r
+ EFI_ACPI_DESCRIPTION_HEADER *Xsdt; // Pointer to XSDT table header\r
+ EFI_ACPI_1_0_FIXED_ACPI_DESCRIPTION_TABLE *Fadt1; // Pointer to FADT table header\r
+ EFI_ACPI_3_0_FIXED_ACPI_DESCRIPTION_TABLE *Fadt3; // Pointer to FADT table header\r
+ EFI_ACPI_1_0_FIRMWARE_ACPI_CONTROL_STRUCTURE *Facs1; // Pointer to FACS table header\r
+ EFI_ACPI_3_0_FIRMWARE_ACPI_CONTROL_STRUCTURE *Facs3; // Pointer to FACS table header\r
+ EFI_ACPI_DESCRIPTION_HEADER *Dsdt1; // Pointer to DSDT table header\r
+ EFI_ACPI_DESCRIPTION_HEADER *Dsdt3; // Pointer to DSDT table header\r
+ LIST_ENTRY TableList;\r
+ UINTN NumberOfTableEntries1; // Number of ACPI 1.0 tables\r
+ UINTN NumberOfTableEntries3; // Number of ACPI 3.0 tables\r
+ UINTN CurrentHandle;\r
+ EFI_ACPI_TABLE_PROTOCOL AcpiTableProtocol;\r
+ EFI_ACPI_SDT_PROTOCOL AcpiSdtProtocol;\r
+ LIST_ENTRY NotifyList;\r
} EFI_ACPI_TABLE_INSTANCE;\r
\r
//\r
**/\r
EFI_STATUS\r
AcpiTableAcpiTableConstructor (\r
- EFI_ACPI_TABLE_INSTANCE *AcpiTableInstance\r
+ EFI_ACPI_TABLE_INSTANCE *AcpiTableInstance\r
);\r
\r
-\r
/**\r
Entry point of the ACPI table driver.\r
- Creates and initializes an instance of the ACPI Table \r
+ Creates and initializes an instance of the ACPI Table\r
Protocol and installs it on a new handle.\r
\r
@param ImageHandle A handle for the image that is initializing this driver\r
@param SystemTable A pointer to the EFI system table\r
\r
@return EFI_SUCCESS Driver initialized successfully\r
- @return EFI_LOAD_ERROR Failed to Initialize or has been loaded \r
+ @return EFI_LOAD_ERROR Failed to Initialize or has been loaded\r
@return EFI_OUT_OF_RESOURCES Could not allocate needed resources\r
\r
**/\r
EFI_STATUS\r
EFIAPI\r
InitializeAcpiTableDxe (\r
- IN EFI_HANDLE ImageHandle,\r
- IN EFI_SYSTEM_TABLE *SystemTable\r
+ IN EFI_HANDLE ImageHandle,\r
+ IN EFI_SYSTEM_TABLE *SystemTable\r
);\r
\r
/**\r
\r
@param[in] Handle Table to find.\r
@param[in] TableList Table list to search\r
- @param[out] Table Pointer to table found. \r
+ @param[out] Table Pointer to table found.\r
\r
@retval EFI_SUCCESS The function completed successfully.\r
@retval EFI_NOT_FOUND No table found matching the handle specified.\r
**/\r
EFI_STATUS\r
FindTableByHandle (\r
- IN UINTN Handle,\r
- IN LIST_ENTRY *TableList,\r
- OUT EFI_ACPI_TABLE_LIST **Table\r
+ IN UINTN Handle,\r
+ IN LIST_ENTRY *TableList,\r
+ OUT EFI_ACPI_TABLE_LIST **Table\r
);\r
\r
/**\r
**/\r
EFI_STATUS\r
AcpiPlatformChecksum (\r
- IN VOID *Buffer,\r
- IN UINTN Size,\r
- IN UINTN ChecksumOffset\r
+ IN VOID *Buffer,\r
+ IN UINTN Size,\r
+ IN UINTN ChecksumOffset\r
);\r
\r
/**\r
**/\r
VOID\r
SdtNotifyAcpiList (\r
- IN EFI_ACPI_TABLE_INSTANCE *AcpiTableInstance,\r
- IN EFI_ACPI_TABLE_VERSION Version,\r
- IN UINTN Handle\r
+ IN EFI_ACPI_TABLE_INSTANCE *AcpiTableInstance,\r
+ IN EFI_ACPI_TABLE_VERSION Version,\r
+ IN UINTN Handle\r
);\r
\r
/**\r
**/\r
VOID\r
SdtAcpiTableAcpiSdtConstructor (\r
- IN EFI_ACPI_TABLE_INSTANCE *AcpiTableInstance\r
+ IN EFI_ACPI_TABLE_INSTANCE *AcpiTableInstance\r
+ );\r
+\r
+/**\r
+ Returns a requested ACPI table.\r
+\r
+ The following structures are not considered elements in the list of\r
+ ACPI tables:\r
+ - Root System Description Pointer (RSD_PTR)\r
+ - Root System Description Table (RSDT)\r
+ - Extended System Description Table (XSDT)\r
+ Version is updated with a bit map containing all the versions of ACPI of which the table is a\r
+ member. For tables installed via the EFI_ACPI_TABLE_PROTOCOL.InstallAcpiTable() interface,\r
+ the function returns the value of EFI_ACPI_STD_PROTOCOL.AcpiVersion.\r
+\r
+ @param[in] AcpiTableInstance ACPI table Instance.\r
+ @param[in] Index The zero-based index of the table to retrieve.\r
+ @param[out] Table Pointer for returning the table buffer.\r
+ @param[out] Version On return, updated with the ACPI versions to which this table belongs. Type\r
+ EFI_ACPI_TABLE_VERSION is defined in "Related Definitions" in the\r
+ EFI_ACPI_SDT_PROTOCOL.\r
+ @param[out] TableKey On return, points to the table key for the specified ACPI system definition table.\r
+ This is identical to the table key used in the EFI_ACPI_TABLE_PROTOCOL.\r
+ The TableKey can be passed to EFI_ACPI_TABLE_PROTOCOL.UninstallAcpiTable()\r
+ to uninstall the table.\r
+ @retval EFI_SUCCESS The function completed successfully.\r
+ @retval EFI_NOT_FOUND The requested index is too large and a table was not found.\r
+**/\r
+EFI_STATUS\r
+SdtGetAcpiTable (\r
+ IN EFI_ACPI_TABLE_INSTANCE *AcpiTableInstance,\r
+ IN UINTN Index,\r
+ OUT EFI_ACPI_SDT_HEADER **Table,\r
+ OUT EFI_ACPI_TABLE_VERSION *Version,\r
+ OUT UINTN *TableKey\r
);\r
\r
//\r
// export PrivateData symbol, because we need that in AcpiSdtProtol implementation\r
//\r
-extern EFI_HANDLE mHandle;\r
-extern EFI_ACPI_TABLE_INSTANCE *mPrivateData;\r
+extern EFI_HANDLE mHandle;\r
+extern EFI_ACPI_TABLE_INSTANCE *mPrivateData;\r
\r
#endif\r