]> git.proxmox.com Git - mirror_edk2.git/blobdiff - IntelFrameworkModulePkg/Universal/Acpi/AcpiSupportDxe/AcpiSupport.h
IntelFrameworkModulePkg: Add AcpiSupportDxe driver
[mirror_edk2.git] / IntelFrameworkModulePkg / Universal / Acpi / AcpiSupportDxe / AcpiSupport.h
diff --git a/IntelFrameworkModulePkg/Universal/Acpi/AcpiSupportDxe/AcpiSupport.h b/IntelFrameworkModulePkg/Universal/Acpi/AcpiSupportDxe/AcpiSupport.h
new file mode 100644 (file)
index 0000000..b28f1cd
--- /dev/null
@@ -0,0 +1,175 @@
+/** @file\r
+  This is an implementation of the ACPI Support protocol.\r
+  It is in compliance with the 0.9 definition of the protocol.\r
+\r
+Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>\r
+\r
+This program and the accompanying materials\r
+are licensed and made available under the terms and conditions\r
+of the BSD License which accompanies this distribution.  The\r
+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
+\r
+**/\r
+\r
+#ifndef _ACPI_SUPPORT_H_\r
+#define _ACPI_SUPPORT_H_\r
+\r
+\r
+#include <PiDxe.h>\r
+\r
+#include <Protocol/AcpiTable.h>\r
+#include <Guid/Acpi.h>\r
+#include <Protocol/AcpiSupport.h>\r
+\r
+#include <Library/BaseLib.h>\r
+#include <Library/DebugLib.h>\r
+#include <Library/UefiLib.h>\r
+#include <Library/BaseMemoryLib.h>\r
+#include <Library/UefiDriverEntryPoint.h>\r
+#include <Library/MemoryAllocationLib.h>\r
+#include <Library/UefiBootServicesTableLib.h>\r
+#include <Library/PcdLib.h>\r
+\r
+//\r
+// Statements that include other files\r
+//\r
+#include <IndustryStandard/Acpi.h>\r
+\r
+\r
+//\r
+// Private Driver Data\r
+//\r
+//\r
+// ACPI Table Linked List Signature.\r
+//\r
+#define EFI_ACPI_TABLE_LIST_SIGNATURE SIGNATURE_32 ('E', 'A', 'T', 'L')\r
+\r
+//\r
+// ACPI Table Linked List Entry definition.\r
+//\r
+//  Signature must be set to EFI_ACPI_TABLE_LIST_SIGNATURE\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
+//  Handle is used to identify a particular table.\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
+} EFI_ACPI_TABLE_LIST;\r
+\r
+//\r
+// Containment record for linked list.\r
+//\r
+#define EFI_ACPI_TABLE_LIST_FROM_LINK(_link)  CR (_link, EFI_ACPI_TABLE_LIST, Link, EFI_ACPI_TABLE_LIST_SIGNATURE)\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     0x2020204F4E414954ULL  // "TIANO   "\r
+#define EFI_ACPI_OEM_REVISION     0x00000002\r
+#define EFI_ACPI_CREATOR_ID       0x20202020\r
+#define EFI_ACPI_CREATOR_REVISION 0x01000013\r
+\r
+//\r
+// Protocol private structure definition\r
+//\r
+//\r
+// ACPI support protocol instance signature definition.\r
+//\r
+#define EFI_ACPI_SUPPORT_SIGNATURE  SIGNATURE_32 ('S', 'S', 'A', 'E')\r
+\r
+//\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_SUPPORT_PROTOCOL                     AcpiSupport;\r
+  EFI_ACPI_TABLE_PROTOCOL                       AcpiTableProtocol;\r
+} EFI_ACPI_SUPPORT_INSTANCE;\r
+\r
+//\r
+// ACPI support protocol instance containing record macro\r
+//\r
+#define EFI_ACPI_SUPPORT_INSTANCE_FROM_ACPI_SUPPORT_THIS(a) \\r
+  CR (a, \\r
+      EFI_ACPI_SUPPORT_INSTANCE, \\r
+      AcpiSupport, \\r
+      EFI_ACPI_SUPPORT_SIGNATURE \\r
+      )\r
+//\r
+// ACPI table protocol instance containing record macro\r
+//\r
+#define EFI_ACPI_TABLE_INSTANCE_FROM_ACPI_SUPPORT_THIS(a) \\r
+  CR (a, \\r
+      EFI_ACPI_SUPPORT_INSTANCE, \\r
+      AcpiTableProtocol, \\r
+      EFI_ACPI_SUPPORT_SIGNATURE \\r
+      )\r
+      \r
+/**\r
+  Constructor for the ACPI support protocol.  \r
+  \r
+  Constructor for the ACPI support protocol to initializes instance data.\r
+  \r
+  @param AcpiSupportInstance   Instance to construct\r
+\r
+  @retval EFI_SUCCESS           Instance initialized.\r
+  @retval EFI_OUT_OF_RESOURCES  Unable to allocate required resources.\r
+**/\r
+EFI_STATUS\r
+AcpiSupportAcpiSupportConstructor (\r
+  IN EFI_ACPI_SUPPORT_INSTANCE                 *AcpiSupportInstance\r
+  );\r
+/**\r
+  Entry point of the ACPI support driver. This function creates and initializes an instance of the ACPI Support \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
+  @retval EFI_SUCCESS              Driver initialized successfully\r
+  @retval EFI_LOAD_ERROR           Failed to Initialize or has been loaded \r
+  @retval EFI_OUT_OF_RESOURCES     Could not allocate needed resources\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+InstallAcpiSupport (\r
+  IN EFI_HANDLE           ImageHandle,\r
+  IN EFI_SYSTEM_TABLE     *SystemTable\r
+  );\r
+#endif\r