]> git.proxmox.com Git - mirror_edk2.git/blob - IntelFrameworkModulePkg/Universal/Acpi/AcpiSupportDxe/AcpiSupport.h
IntelFrameworkModulePkg: Add AcpiSupportDxe driver
[mirror_edk2.git] / IntelFrameworkModulePkg / Universal / Acpi / AcpiSupportDxe / AcpiSupport.h
1 /** @file
2 This is an implementation of the ACPI Support protocol.
3 It is in compliance with the 0.9 definition of the protocol.
4
5 Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>
6
7 This program and the accompanying materials
8 are licensed and made available under the terms and conditions
9 of the BSD License which accompanies this distribution. The
10 full text of the license may be found at
11 http://opensource.org/licenses/bsd-license.php
12
13 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
14 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
15
16 **/
17
18 #ifndef _ACPI_SUPPORT_H_
19 #define _ACPI_SUPPORT_H_
20
21
22 #include <PiDxe.h>
23
24 #include <Protocol/AcpiTable.h>
25 #include <Guid/Acpi.h>
26 #include <Protocol/AcpiSupport.h>
27
28 #include <Library/BaseLib.h>
29 #include <Library/DebugLib.h>
30 #include <Library/UefiLib.h>
31 #include <Library/BaseMemoryLib.h>
32 #include <Library/UefiDriverEntryPoint.h>
33 #include <Library/MemoryAllocationLib.h>
34 #include <Library/UefiBootServicesTableLib.h>
35 #include <Library/PcdLib.h>
36
37 //
38 // Statements that include other files
39 //
40 #include <IndustryStandard/Acpi.h>
41
42
43 //
44 // Private Driver Data
45 //
46 //
47 // ACPI Table Linked List Signature.
48 //
49 #define EFI_ACPI_TABLE_LIST_SIGNATURE SIGNATURE_32 ('E', 'A', 'T', 'L')
50
51 //
52 // ACPI Table Linked List Entry definition.
53 //
54 // Signature must be set to EFI_ACPI_TABLE_LIST_SIGNATURE
55 // Link is the linked list data.
56 // Version is the versions of the ACPI tables that this table belongs in.
57 // Table is a pointer to the table.
58 // PageAddress is the address of the pages allocated for the table.
59 // NumberOfPages is the number of pages allocated at PageAddress.
60 // Handle is used to identify a particular table.
61 //
62 typedef struct {
63 UINT32 Signature;
64 LIST_ENTRY Link;
65 EFI_ACPI_TABLE_VERSION Version;
66 EFI_ACPI_COMMON_HEADER *Table;
67 EFI_PHYSICAL_ADDRESS PageAddress;
68 UINTN NumberOfPages;
69 UINTN Handle;
70 } EFI_ACPI_TABLE_LIST;
71
72 //
73 // Containment record for linked list.
74 //
75 #define EFI_ACPI_TABLE_LIST_FROM_LINK(_link) CR (_link, EFI_ACPI_TABLE_LIST, Link, EFI_ACPI_TABLE_LIST_SIGNATURE)
76
77 //
78 // The maximum number of tables this driver supports
79 //
80 #define EFI_ACPI_MAX_NUM_TABLES 20
81
82 //
83 // ACPI table information used to initialize tables.
84 //
85 #define EFI_ACPI_OEM_ID "INTEL "
86 #define EFI_ACPI_OEM_TABLE_ID 0x2020204F4E414954ULL // "TIANO "
87 #define EFI_ACPI_OEM_REVISION 0x00000002
88 #define EFI_ACPI_CREATOR_ID 0x20202020
89 #define EFI_ACPI_CREATOR_REVISION 0x01000013
90
91 //
92 // Protocol private structure definition
93 //
94 //
95 // ACPI support protocol instance signature definition.
96 //
97 #define EFI_ACPI_SUPPORT_SIGNATURE SIGNATURE_32 ('S', 'S', 'A', 'E')
98
99 //
100 // ACPI support protocol instance data structure
101 //
102 typedef struct {
103 UINTN Signature;
104 EFI_ACPI_1_0_ROOT_SYSTEM_DESCRIPTION_POINTER *Rsdp1; // Pointer to RSD_PTR structure
105 EFI_ACPI_3_0_ROOT_SYSTEM_DESCRIPTION_POINTER *Rsdp3; // Pointer to RSD_PTR structure
106 EFI_ACPI_DESCRIPTION_HEADER *Rsdt1; // Pointer to RSDT table header
107 EFI_ACPI_DESCRIPTION_HEADER *Rsdt3; // Pointer to RSDT table header
108 EFI_ACPI_DESCRIPTION_HEADER *Xsdt; // Pointer to XSDT table header
109 EFI_ACPI_1_0_FIXED_ACPI_DESCRIPTION_TABLE *Fadt1; // Pointer to FADT table header
110 EFI_ACPI_3_0_FIXED_ACPI_DESCRIPTION_TABLE *Fadt3; // Pointer to FADT table header
111 EFI_ACPI_1_0_FIRMWARE_ACPI_CONTROL_STRUCTURE *Facs1; // Pointer to FACS table header
112 EFI_ACPI_3_0_FIRMWARE_ACPI_CONTROL_STRUCTURE *Facs3; // Pointer to FACS table header
113 EFI_ACPI_DESCRIPTION_HEADER *Dsdt1; // Pointer to DSDT table header
114 EFI_ACPI_DESCRIPTION_HEADER *Dsdt3; // Pointer to DSDT table header
115 LIST_ENTRY TableList;
116 UINTN NumberOfTableEntries1; // Number of ACPI 1.0 tables
117 UINTN NumberOfTableEntries3; // Number of ACPI 3.0 tables
118 UINTN CurrentHandle;
119 BOOLEAN TablesInstalled1; // ACPI 1.0 tables published
120 BOOLEAN TablesInstalled3; // ACPI 3.0 tables published
121 EFI_ACPI_SUPPORT_PROTOCOL AcpiSupport;
122 EFI_ACPI_TABLE_PROTOCOL AcpiTableProtocol;
123 } EFI_ACPI_SUPPORT_INSTANCE;
124
125 //
126 // ACPI support protocol instance containing record macro
127 //
128 #define EFI_ACPI_SUPPORT_INSTANCE_FROM_ACPI_SUPPORT_THIS(a) \
129 CR (a, \
130 EFI_ACPI_SUPPORT_INSTANCE, \
131 AcpiSupport, \
132 EFI_ACPI_SUPPORT_SIGNATURE \
133 )
134 //
135 // ACPI table protocol instance containing record macro
136 //
137 #define EFI_ACPI_TABLE_INSTANCE_FROM_ACPI_SUPPORT_THIS(a) \
138 CR (a, \
139 EFI_ACPI_SUPPORT_INSTANCE, \
140 AcpiTableProtocol, \
141 EFI_ACPI_SUPPORT_SIGNATURE \
142 )
143
144 /**
145 Constructor for the ACPI support protocol.
146
147 Constructor for the ACPI support protocol to initializes instance data.
148
149 @param AcpiSupportInstance Instance to construct
150
151 @retval EFI_SUCCESS Instance initialized.
152 @retval EFI_OUT_OF_RESOURCES Unable to allocate required resources.
153 **/
154 EFI_STATUS
155 AcpiSupportAcpiSupportConstructor (
156 IN EFI_ACPI_SUPPORT_INSTANCE *AcpiSupportInstance
157 );
158 /**
159 Entry point of the ACPI support driver. This function creates and initializes an instance of the ACPI Support
160 Protocol and installs it on a new handle.
161
162 @param ImageHandle A handle for the image that is initializing this driver
163 @param SystemTable A pointer to the EFI system table
164
165 @retval EFI_SUCCESS Driver initialized successfully
166 @retval EFI_LOAD_ERROR Failed to Initialize or has been loaded
167 @retval EFI_OUT_OF_RESOURCES Could not allocate needed resources
168 **/
169 EFI_STATUS
170 EFIAPI
171 InstallAcpiSupport (
172 IN EFI_HANDLE ImageHandle,
173 IN EFI_SYSTEM_TABLE *SystemTable
174 );
175 #endif