]> git.proxmox.com Git - mirror_edk2.git/blob - IntelFrameworkModulePkg/Universal/Acpi/AcpiSupportDxe/AcpiSupport.h
IntelFrameworkModulePkg: Replace BSD License with BSD+Patent License
[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 - 2018, Intel Corporation. All rights reserved.<BR>
6
7 SPDX-License-Identifier: BSD-2-Clause-Patent
8
9 **/
10
11 #ifndef _ACPI_SUPPORT_H_
12 #define _ACPI_SUPPORT_H_
13
14
15 #include <PiDxe.h>
16
17 #include <Protocol/AcpiTable.h>
18 #include <Guid/Acpi.h>
19 #include <Protocol/AcpiSupport.h>
20
21 #include <Library/BaseLib.h>
22 #include <Library/DebugLib.h>
23 #include <Library/UefiLib.h>
24 #include <Library/BaseMemoryLib.h>
25 #include <Library/UefiDriverEntryPoint.h>
26 #include <Library/MemoryAllocationLib.h>
27 #include <Library/UefiBootServicesTableLib.h>
28 #include <Library/PcdLib.h>
29
30 //
31 // Statements that include other files
32 //
33 #include <IndustryStandard/Acpi.h>
34
35
36 //
37 // Private Driver Data
38 //
39 //
40 // ACPI Table Linked List Signature.
41 //
42 #define EFI_ACPI_TABLE_LIST_SIGNATURE SIGNATURE_32 ('E', 'A', 'T', 'L')
43
44 //
45 // ACPI Table Linked List Entry definition.
46 //
47 // Signature must be set to EFI_ACPI_TABLE_LIST_SIGNATURE
48 // Link is the linked list data.
49 // Version is the versions of the ACPI tables that this table belongs in.
50 // Table is a pointer to the table.
51 // PageAddress is the address of the pages allocated for the table.
52 // NumberOfPages is the number of pages allocated at PageAddress.
53 // Handle is used to identify a particular table.
54 //
55 typedef struct {
56 UINT32 Signature;
57 LIST_ENTRY Link;
58 EFI_ACPI_TABLE_VERSION Version;
59 EFI_ACPI_COMMON_HEADER *Table;
60 EFI_PHYSICAL_ADDRESS PageAddress;
61 UINTN NumberOfPages;
62 UINTN Handle;
63 } EFI_ACPI_TABLE_LIST;
64
65 //
66 // Containment record for linked list.
67 //
68 #define EFI_ACPI_TABLE_LIST_FROM_LINK(_link) CR (_link, EFI_ACPI_TABLE_LIST, Link, EFI_ACPI_TABLE_LIST_SIGNATURE)
69
70 //
71 // The maximum number of tables this driver supports
72 //
73 #define EFI_ACPI_MAX_NUM_TABLES 20
74
75 //
76 // Protocol private structure definition
77 //
78 //
79 // ACPI support protocol instance signature definition.
80 //
81 #define EFI_ACPI_SUPPORT_SIGNATURE SIGNATURE_32 ('S', 'S', 'A', 'E')
82
83 //
84 // ACPI support protocol instance data structure
85 //
86 typedef struct {
87 UINTN Signature;
88 EFI_ACPI_1_0_ROOT_SYSTEM_DESCRIPTION_POINTER *Rsdp1; // Pointer to RSD_PTR structure
89 EFI_ACPI_3_0_ROOT_SYSTEM_DESCRIPTION_POINTER *Rsdp3; // Pointer to RSD_PTR structure
90 EFI_ACPI_DESCRIPTION_HEADER *Rsdt1; // Pointer to RSDT table header
91 EFI_ACPI_DESCRIPTION_HEADER *Rsdt3; // Pointer to RSDT table header
92 EFI_ACPI_DESCRIPTION_HEADER *Xsdt; // Pointer to XSDT table header
93 EFI_ACPI_1_0_FIXED_ACPI_DESCRIPTION_TABLE *Fadt1; // Pointer to FADT table header
94 EFI_ACPI_3_0_FIXED_ACPI_DESCRIPTION_TABLE *Fadt3; // Pointer to FADT table header
95 EFI_ACPI_1_0_FIRMWARE_ACPI_CONTROL_STRUCTURE *Facs1; // Pointer to FACS table header
96 EFI_ACPI_3_0_FIRMWARE_ACPI_CONTROL_STRUCTURE *Facs3; // Pointer to FACS table header
97 EFI_ACPI_DESCRIPTION_HEADER *Dsdt1; // Pointer to DSDT table header
98 EFI_ACPI_DESCRIPTION_HEADER *Dsdt3; // Pointer to DSDT table header
99 LIST_ENTRY TableList;
100 UINTN NumberOfTableEntries1; // Number of ACPI 1.0 tables
101 UINTN NumberOfTableEntries3; // Number of ACPI 3.0 tables
102 UINTN CurrentHandle;
103 BOOLEAN TablesInstalled1; // ACPI 1.0 tables published
104 BOOLEAN TablesInstalled3; // ACPI 3.0 tables published
105 EFI_ACPI_SUPPORT_PROTOCOL AcpiSupport;
106 EFI_ACPI_TABLE_PROTOCOL AcpiTableProtocol;
107 } EFI_ACPI_SUPPORT_INSTANCE;
108
109 //
110 // ACPI support protocol instance containing record macro
111 //
112 #define EFI_ACPI_SUPPORT_INSTANCE_FROM_ACPI_SUPPORT_THIS(a) \
113 CR (a, \
114 EFI_ACPI_SUPPORT_INSTANCE, \
115 AcpiSupport, \
116 EFI_ACPI_SUPPORT_SIGNATURE \
117 )
118 //
119 // ACPI table protocol instance containing record macro
120 //
121 #define EFI_ACPI_TABLE_INSTANCE_FROM_ACPI_SUPPORT_THIS(a) \
122 CR (a, \
123 EFI_ACPI_SUPPORT_INSTANCE, \
124 AcpiTableProtocol, \
125 EFI_ACPI_SUPPORT_SIGNATURE \
126 )
127
128 /**
129 Constructor for the ACPI support protocol.
130
131 Constructor for the ACPI support protocol to initializes instance data.
132
133 @param AcpiSupportInstance Instance to construct
134
135 @retval EFI_SUCCESS Instance initialized.
136 @retval EFI_OUT_OF_RESOURCES Unable to allocate required resources.
137 **/
138 EFI_STATUS
139 AcpiSupportAcpiSupportConstructor (
140 IN EFI_ACPI_SUPPORT_INSTANCE *AcpiSupportInstance
141 );
142 /**
143 Entry point of the ACPI support driver. This function creates and initializes an instance of the ACPI Support
144 Protocol and installs it on a new handle.
145
146 @param ImageHandle A handle for the image that is initializing this driver
147 @param SystemTable A pointer to the EFI system table
148
149 @retval EFI_SUCCESS Driver initialized successfully
150 @retval EFI_LOAD_ERROR Failed to Initialize or has been loaded
151 @retval EFI_OUT_OF_RESOURCES Could not allocate needed resources
152 **/
153 EFI_STATUS
154 EFIAPI
155 InstallAcpiSupport (
156 IN EFI_HANDLE ImageHandle,
157 IN EFI_SYSTEM_TABLE *SystemTable
158 );
159 #endif