summaryrefslogtreecommitdiff
path: root/MdePkg/Include/Protocol/AcpiSystemDescriptionTable.h
blob: ab90b3499ab3875ce6114d99f9f0ddf4f8ad7607 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
/** @file
  This protocol provides services for creating ACPI system description tables.
  
  Copyright (c) 2006 - 2008, Intel Corporation
  All rights reserved. This program and the accompanying materials                          
  are licensed and made available under the terms and conditions of the BSD License         
  which accompanies this distribution.  The full text of the license may be found at        
  http://opensource.org/licenses/bsd-license.php                                            

  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,                     
  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.             

**/

#ifndef __ACPI_SYSTEM_DESCRIPTION_TABLE_H___
#define __ACPI_SYSTEM_DESCRIPTION_TABLE_H___

#define EFI_ACPI_SDT_PROTOCOL_GUID \
  { 0xeb97088e, 0xcfdf, 0x49c6, { 0xbe, 0x4b, 0xd9, 0x6, 0xa5, 0xb2, 0xe, 0x86 }}
  
typedef UINT32  EFI_ACPI_TABLE_VERSION;
typedef VOID    *EFI_ACPI_HANDLE;

#define EFI_ACPI_TABLE_VERSION_NONE (1 << 0)
#define EFI_ACPI_TABLE_VERSION_1_0B (1 << 1)
#define EFI_ACPI_TABLE_VERSION_2_0  (1 << 2)
#define EFI_ACPI_TABLE_VERSION_3_0  (1 << 3)
#define EFI_ACPI_TABLE_VERSION_4_0  (1 << 4)
  
typedef UINT32 EFI_ACPI_DATA_TYPE;
#define EFI_ACPI_DATA_TYPE_NONE         0
#define EFI_ACPI_DATA_TYPE_OPCODE       1
#define EFI_ACPI_DATA_TYPE_NAME_STRING  2
#define EFI_ACPI_DATA_TYPE_OP           3
#define EFI_ACPI_DATA_TYPE_UINT         4
#define EFI_ACPI_DATA_TYPE_STRING       5
#define EFI_ACPI_DATA_TYPE_CHILD        6
  
typedef struct {
  UINT32    Signature;
  UINT32    Length;
  UINT8     Revision;
  UINT8     Checksum;
  CHAR8     OemId[6];
  CHAR8     OemTableId[8];
  UINT32    OemRevision;
  UINT32    CreatorId;
  UINT32    CreatorRevision;
} EFI_ACPI_SDT_HEADER;
  
typedef
EFI_STATUS
(EFIAPI *EFI_ACPI_NOTIFICATION_FN)(
  IN EFI_ACPI_SDT_HEADER    *Table,     ///< A pointer to the ACPI table header.
  IN EFI_ACPI_TABLE_VERSION Version,    ///< The ACPI table's version.
  IN UINTN                  TableKey    ///< The table key for this ACPI table.
);
  
/**
  Returns a requested ACPI table.
  
  The GetAcpiTable() function returns a pointer to a buffer containing the ACPI table associated
  with the Index that was input. The following structures are not considered elements in the list of
  ACPI tables:
  - Root System Description Pointer (RSD_PTR)
  - Root System Description Table (RSDT)
  - Extended System Description Table (XSDT)
  Version is updated with a bit map containing all the versions of ACPI of which the table is a
  member.
  
  @param[in]    Index       The zero-based index of the table to retrieve.
  @param[out]   Table       Pointer for returning the table buffer.
  @param[out]   Version     On return, updated with the ACPI versions to which this table belongs. Type
                            EFI_ACPI_TABLE_VERSION is defined in "Related Definitions" in the
                            EFI_ACPI_SDT_PROTOCOL.    
  @param[out]   TableKey    On return, points to the table key for the specified ACPI system definition table. This
                            is identical to the table key used in the EFI_ACPI_TABLE_PROTOCOL.  
                            
  @retval EFI_SUCCESS       The function completed successfully.
  @retval EFI_NOT_FOUND     The requested index is too large and a table was not found.                                  
**/  
typedef
EFI_STATUS
(EFIAPI *EFI_ACPI_GET_ACPI_TABLE)(
  IN    UINTN                   Index,
  OUT   EFI_ACPI_SDT_HEADER     **Table,
  OUT   EFI_ACPI_TABLE_VERSION  *Version,
  OUT   UINTN                   *TableKey
);

/**
  Register or unregister a callback when an ACPI table is installed.
  
  This function registers or unregisters a function which will be called whenever a new ACPI table is
  installed.
  
  @param[in]    Register        If TRUE, then the specified function will be registered. If FALSE, then the specified
                                function will be unregistered.
  @param[in]    Notification    Points to the callback function to be registered or unregistered.
  
  @retval EFI_SUCCESS           Callback successfully registered or unregistered.
  @retval EFI_INVALID_PARAMETER Notification is NULL
  @retval EFI_INVALID_PARAMETER Register is FALSE and Notification does not match a known registration function.                        
**/
typedef
EFI_STATUS
(EFIAPI *EFI_ACPI_REGISTER_NOTIFY)(
  IN BOOLEAN                    Register,
  IN EFI_ACPI_NOTIFICATION_FN   Notification
);

/**
  Create a handle from an ACPI opcode
  
  @param[in]  Buffer                 Points to the ACPI opcode.
  @param[out] Handle                 Upon return, holds the handle.
  
  @retval   EFI_SUCCESS             Success
  @retval   EFI_INVALID_PARAMETER   Buffer is NULL or Handle is NULL or Buffer points to an
                                    invalid opcode.
  
**/
typedef
EFI_STATUS
(EFIAPI *EFI_ACPI_OPEN)(
  IN    VOID            *Buffer,
  OUT   EFI_ACPI_HANDLE *Handle 
);

/**
  Create a handle for the first ACPI opcode in an ACPI system description table.
  
  @param[in]    TableKey    The table key for the ACPI table, as returned by GetTable().
  @param[out]   Handle      On return, points to the newly created ACPI handle.

  @retval EFI_SUCCESS       Handle created successfully.
  @retval EFI_NOT_FOUND     TableKey does not refer to a valid ACPI table.  
**/
typedef
EFI_STATUS
(EFIAPI *EFI_ACPI_OPEN_SDT)(
  IN    UINTN           TableKey,
  OUT   EFI_ACPI_HANDLE *Handle
);

/**
  Close an ACPI handle.
  
  @param[in] Handle Returns the handle.
  
  @retval EFI_SUCCESS           Success
  @retval EFI_INVALID_PARAMETER Handle is NULL or does not refer to a valid ACPI object.  
**/
typedef
EFI_STATUS
(EFIAPI *EFI_ACPI_CLOSE)(
  IN EFI_ACPI_HANDLE Handle
);

/**
  Return the child ACPI objects.
  
  @param[in]        ParentHandle    Parent handle.
  @param[in, out]   Handle          On entry, points to the previously returned handle or NULL to start with the first
                                    handle. On return, points to the next returned ACPI handle or NULL if there are no
                                    child objects.

  @retval EFI_SUCCESS               Success
  @retval EFI_INVALID_PARAMETER     ParentHandle is NULL or does not refer to a valid ACPI object.                                
**/
typedef
EFI_STATUS
(EFIAPI *EFI_ACPI_GET_CHILD)(
  IN EFI_ACPI_HANDLE        ParentHandle,
  IN OUT EFI_ACPI_HANDLE    *Handle
);

/**
  Retrieve information about an ACPI object.
  
  @param[in]    Handle      ACPI object handle.
  @param[in]    Index       Index of the data to retrieve from the object. In general, indexes read from left-to-right
                            in the ACPI encoding, with index 0 always being the ACPI opcode.
  @param[out]   DataType    Points to the returned data type or EFI_ACPI_DATA_TYPE_NONE if no data exists
                            for the specified index.
  @param[out]   Data        Upon return, points to the pointer to the data.
  @param[out]   DataSize    Upon return, points to the size of Data.
  
  @retval              
**/
typedef
EFI_STATUS
(EFIAPI *EFI_ACPI_GET_OPTION)(
  IN        EFI_ACPI_HANDLE     Handle,
  IN        UINTN               Index,
  OUT       EFI_ACPI_DATA_TYPE  *DataType,
  OUT CONST VOID                **Data,
  OUT       UINTN               *DataSize
);

/**
  Change information about an ACPI object.
  
  @param[in]  Handle    ACPI object handle.
  @param[in]  Index     Index of the data to retrieve from the object. In general, indexes read from left-to-right
                        in the ACPI encoding, with index 0 always being the ACPI opcode.
  @param[in]  Data      Points to the data.
  @param[in]  DataSize  The size of the Data.

  @retval EFI_SUCCESS           Success
  @retval EFI_INVALID_PARAMETER Handle is NULL or does not refer to a valid ACPI object.
  @retval EFI_BAD_BUFFER_SIZE   Data cannot be accommodated in the space occupied by
                                the option.

**/
typedef
EFI_STATUS
(EFIAPI *EFI_ACPI_SET_OPTION)(
  IN        EFI_ACPI_HANDLE Handle,
  IN        UINTN           Index,
  IN CONST  VOID            *Data,
  IN        UINTN           DataSize
);

/**
  Returns the handle of the ACPI object representing the specified ACPI path
  
  @param[in]    HandleIn    Points to the handle of the object representing the starting point for the path search.
  @param[in]    AcpiPath    Points to the ACPI path, which conforms to the ACPI encoded path format.
  @param[out]   HandleOut   On return, points to the ACPI object which represents AcpiPath, relative to
                            HandleIn.
                            
  @retval EFI_SUCCESS           Success
  @retval EFI_INVALID_PARAMETER HandleIn is NULL or does not refer to a valid ACPI object.                            
**/
typedef
EFI_STATUS
(EFIAPI *EFI_ACPI_FIND_PATH)(
  IN    EFI_ACPI_HANDLE HandleIn,
  IN    VOID            *AcpiPath,
  OUT   EFI_ACPI_HANDLE HandleOut
);

typedef struct _EFI_ACPI_SDT_PROTOCOL {
  ///
  /// Specifies the ACPI version supported by this protocol.
  ///
  EFI_ACPI_TABLE_VERSION    AcpiVersion;
  EFI_ACPI_GET_ACPI_TABLE   GetAcpiTable;
  EFI_ACPI_REGISTER_NOTIFY  RegisterNotify;
  EFI_ACPI_OPEN             Open;
  EFI_ACPI_OPEN_SDT         OpenSdt;
  EFI_ACPI_CLOSE            Close;
  EFI_ACPI_GET_CHILD        GetChild;
  EFI_ACPI_GET_OPTION       GetOption;
  EFI_ACPI_SET_OPTION       SetOption;
  EFI_ACPI_FIND_PATH        FindPath;
} EFI_ACPI_SDT_PROTOCOL;

extern EFI_GUID gEfiAcpiSdtProtocolGuid;

#endif // __ACPI_SYSTEM_DESCRIPTION_TABLE_H___