1 /******************************************************************************
2  *
3  * Name: acefiex.h - Extra OS specific defines, etc. for EFI
4  *
5  *****************************************************************************/
6 
7 /******************************************************************************
8  *
9  * 1. Copyright Notice
10  *
11  * Some or all of this work - Copyright (c) 1999 - 2017, Intel Corp.
12  * All rights reserved.
13  *
14  * 2. License
15  *
16  * 2.1. This is your license from Intel Corp. under its intellectual property
17  * rights. You may have additional license terms from the party that provided
18  * you this software, covering your right to use that party's intellectual
19  * property rights.
20  *
21  * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
22  * copy of the source code appearing in this file ("Covered Code") an
23  * irrevocable, perpetual, worldwide license under Intel's copyrights in the
24  * base code distributed originally by Intel ("Original Intel Code") to copy,
25  * make derivatives, distribute, use and display any portion of the Covered
26  * Code in any form, with the right to sublicense such rights; and
27  *
28  * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
29  * license (with the right to sublicense), under only those claims of Intel
30  * patents that are infringed by the Original Intel Code, to make, use, sell,
31  * offer to sell, and import the Covered Code and derivative works thereof
32  * solely to the minimum extent necessary to exercise the above copyright
33  * license, and in no event shall the patent license extend to any additions
34  * to or modifications of the Original Intel Code. No other license or right
35  * is granted directly or by implication, estoppel or otherwise;
36  *
37  * The above copyright and patent license is granted only if the following
38  * conditions are met:
39  *
40  * 3. Conditions
41  *
42  * 3.1. Redistribution of Source with Rights to Further Distribute Source.
43  * Redistribution of source code of any substantial portion of the Covered
44  * Code or modification with rights to further distribute source must include
45  * the above Copyright Notice, the above License, this list of Conditions,
46  * and the following Disclaimer and Export Compliance provision. In addition,
47  * Licensee must cause all Covered Code to which Licensee contributes to
48  * contain a file documenting the changes Licensee made to create that Covered
49  * Code and the date of any change. Licensee must include in that file the
50  * documentation of any changes made by any predecessor Licensee. Licensee
51  * must include a prominent statement that the modification is derived,
52  * directly or indirectly, from Original Intel Code.
53  *
54  * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
55  * Redistribution of source code of any substantial portion of the Covered
56  * Code or modification without rights to further distribute source must
57  * include the following Disclaimer and Export Compliance provision in the
58  * documentation and/or other materials provided with distribution. In
59  * addition, Licensee may not authorize further sublicense of source of any
60  * portion of the Covered Code, and must include terms to the effect that the
61  * license from Licensee to its licensee is limited to the intellectual
62  * property embodied in the software Licensee provides to its licensee, and
63  * not to intellectual property embodied in modifications its licensee may
64  * make.
65  *
66  * 3.3. Redistribution of Executable. Redistribution in executable form of any
67  * substantial portion of the Covered Code or modification must reproduce the
68  * above Copyright Notice, and the following Disclaimer and Export Compliance
69  * provision in the documentation and/or other materials provided with the
70  * distribution.
71  *
72  * 3.4. Intel retains all right, title, and interest in and to the Original
73  * Intel Code.
74  *
75  * 3.5. Neither the name Intel nor any other trademark owned or controlled by
76  * Intel shall be used in advertising or otherwise to promote the sale, use or
77  * other dealings in products derived from or relating to the Covered Code
78  * without prior written authorization from Intel.
79  *
80  * 4. Disclaimer and Export Compliance
81  *
82  * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
83  * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
84  * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
85  * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
86  * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
87  * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
88  * PARTICULAR PURPOSE.
89  *
90  * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
91  * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
92  * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
93  * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
94  * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
95  * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
96  * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
97  * LIMITED REMEDY.
98  *
99  * 4.3. Licensee shall not export, either directly or indirectly, any of this
100  * software or system incorporating such software without first obtaining any
101  * required license or other approval from the U. S. Department of Commerce or
102  * any other agency or department of the United States Government. In the
103  * event Licensee exports any such software from the United States or
104  * re-exports any such software from a foreign destination, Licensee shall
105  * ensure that the distribution and export/re-export of the software is in
106  * compliance with all laws, regulations, orders, or other restrictions of the
107  * U.S. Export Administration Regulations. Licensee agrees that neither it nor
108  * any of its subsidiaries will export/re-export any technical data, process,
109  * software, or service, directly or indirectly, to any country for which the
110  * United States government or any agency thereof requires an export license,
111  * other governmental approval, or letter of assurance, without first obtaining
112  * such license, approval or letter.
113  *
114  *****************************************************************************
115  *
116  * Alternatively, you may choose to be licensed under the terms of the
117  * following license:
118  *
119  * Redistribution and use in source and binary forms, with or without
120  * modification, are permitted provided that the following conditions
121  * are met:
122  * 1. Redistributions of source code must retain the above copyright
123  *    notice, this list of conditions, and the following disclaimer,
124  *    without modification.
125  * 2. Redistributions in binary form must reproduce at minimum a disclaimer
126  *    substantially similar to the "NO WARRANTY" disclaimer below
127  *    ("Disclaimer") and any redistribution must be conditioned upon
128  *    including a substantially similar Disclaimer requirement for further
129  *    binary redistribution.
130  * 3. Neither the names of the above-listed copyright holders nor the names
131  *    of any contributors may be used to endorse or promote products derived
132  *    from this software without specific prior written permission.
133  *
134  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
135  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
136  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
137  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
138  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
139  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
140  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
141  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
142  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
143  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
144  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
145  *
146  * Alternatively, you may choose to be licensed under the terms of the
147  * GNU General Public License ("GPL") version 2 as published by the Free
148  * Software Foundation.
149  *
150  *****************************************************************************/
151 
152 #ifndef __ACEFIEX_H__
153 #define __ACEFIEX_H__
154 
155 
156 #ifndef ACPI_USE_SYSTEM_CLIBRARY
157 
158 typedef signed char                     int8_t;
159 typedef short int                       int16_t;
160 typedef int                             int32_t;
161 typedef unsigned char                   uint8_t;
162 typedef unsigned short int              uint16_t;
163 typedef unsigned int                    uint32_t;
164 typedef COMPILER_DEPENDENT_INT64        int64_t;
165 typedef COMPILER_DEPENDENT_UINT64       uint64_t;
166 
167 #endif /* ACPI_USE_SYSTEM_CLIBRARY */
168 
169 #define ACPI_EFI_ERROR(a)               (((INTN) a) < 0)
170 #define ACPI_EFI_SUCCESS                0
171 #define ACPI_EFI_LOAD_ERROR             ACPI_EFI_ERR(1)
172 #define ACPI_EFI_INVALID_PARAMETER      ACPI_EFI_ERR(2)
173 #define ACPI_EFI_UNSUPPORTED            ACPI_EFI_ERR(3)
174 #define ACPI_EFI_BAD_BUFFER_SIZE        ACPI_EFI_ERR(4)
175 #define ACPI_EFI_BUFFER_TOO_SMALL       ACPI_EFI_ERR(5)
176 #define ACPI_EFI_NOT_READY              ACPI_EFI_ERR(6)
177 #define ACPI_EFI_DEVICE_ERROR           ACPI_EFI_ERR(7)
178 #define ACPI_EFI_WRITE_PROTECTED        ACPI_EFI_ERR(8)
179 #define ACPI_EFI_OUT_OF_RESOURCES       ACPI_EFI_ERR(9)
180 #define ACPI_EFI_VOLUME_CORRUPTED       ACPI_EFI_ERR(10)
181 #define ACPI_EFI_VOLUME_FULL            ACPI_EFI_ERR(11)
182 #define ACPI_EFI_NO_MEDIA               ACPI_EFI_ERR(12)
183 #define ACPI_EFI_MEDIA_CHANGED          ACPI_EFI_ERR(13)
184 #define ACPI_EFI_NOT_FOUND              ACPI_EFI_ERR(14)
185 #define ACPI_EFI_ACCESS_DENIED          ACPI_EFI_ERR(15)
186 #define ACPI_EFI_NO_RESPONSE            ACPI_EFI_ERR(16)
187 #define ACPI_EFI_NO_MAPPING             ACPI_EFI_ERR(17)
188 #define ACPI_EFI_TIMEOUT                ACPI_EFI_ERR(18)
189 #define ACPI_EFI_NOT_STARTED            ACPI_EFI_ERR(19)
190 #define ACPI_EFI_ALREADY_STARTED        ACPI_EFI_ERR(20)
191 #define ACPI_EFI_ABORTED                ACPI_EFI_ERR(21)
192 #define ACPI_EFI_PROTOCOL_ERROR         ACPI_EFI_ERR(24)
193 
194 
195 typedef UINTN ACPI_EFI_STATUS;
196 typedef VOID *ACPI_EFI_HANDLE;
197 typedef VOID *ACPI_EFI_EVENT;
198 
199 typedef struct {
200     UINT32  Data1;
201     UINT16  Data2;
202     UINT16  Data3;
203     UINT8   Data4[8];
204 } ACPI_EFI_GUID;
205 
206 typedef struct {
207     UINT16 Year;       /* 1998 - 20XX */
208     UINT8  Month;      /* 1 - 12 */
209     UINT8  Day;        /* 1 - 31 */
210     UINT8  Hour;       /* 0 - 23 */
211     UINT8  Minute;     /* 0 - 59 */
212     UINT8  Second;     /* 0 - 59 */
213     UINT8  Pad1;
214     UINT32 Nanosecond; /* 0 - 999,999,999 */
215     INT16  TimeZone;   /* -1440 to 1440 or 2047 */
216     UINT8  Daylight;
217     UINT8  Pad2;
218 } ACPI_EFI_TIME;
219 
220 typedef struct _ACPI_EFI_DEVICE_PATH {
221         UINT8                           Type;
222         UINT8                           SubType;
223         UINT8                           Length[2];
224 } ACPI_EFI_DEVICE_PATH;
225 
226 typedef UINT64          ACPI_EFI_PHYSICAL_ADDRESS;
227 typedef UINT64          ACPI_EFI_VIRTUAL_ADDRESS;
228 
229 typedef enum {
230     AcpiEfiAllocateAnyPages,
231     AcpiEfiAllocateMaxAddress,
232     AcpiEfiAllocateAddress,
233     AcpiEfiMaxAllocateType
234 } ACPI_EFI_ALLOCATE_TYPE;
235 
236 typedef enum {
237     AcpiEfiReservedMemoryType,
238     AcpiEfiLoaderCode,
239     AcpiEfiLoaderData,
240     AcpiEfiBootServicesCode,
241     AcpiEfiBootServicesData,
242     AcpiEfiRuntimeServicesCode,
243     AcpiEfiRuntimeServicesData,
244     AcpiEfiConventionalMemory,
245     AcpiEfiUnusableMemory,
246     AcpiEfiACPIReclaimMemory,
247     AcpiEfiACPIMemoryNVS,
248     AcpiEfiMemoryMappedIO,
249     AcpiEfiMemoryMappedIOPortSpace,
250     AcpiEfiPalCode,
251     AcpiEfiMaxMemoryType
252 } ACPI_EFI_MEMORY_TYPE;
253 
254 /* possible caching types for the memory range */
255 #define ACPI_EFI_MEMORY_UC      0x0000000000000001
256 #define ACPI_EFI_MEMORY_WC      0x0000000000000002
257 #define ACPI_EFI_MEMORY_WT      0x0000000000000004
258 #define ACPI_EFI_MEMORY_WB      0x0000000000000008
259 #define ACPI_EFI_MEMORY_UCE     0x0000000000000010
260 
261 /* physical memory protection on range */
262 #define ACPI_EFI_MEMORY_WP      0x0000000000001000
263 #define ACPI_EFI_MEMORY_RP      0x0000000000002000
264 #define ACPI_EFI_MEMORY_XP      0x0000000000004000
265 
266 /* range requires a runtime mapping */
267 #define ACPI_EFI_MEMORY_RUNTIME 0x8000000000000000
268 
269 #define ACPI_EFI_MEMORY_DESCRIPTOR_VERSION  1
270 typedef struct {
271     UINT32                          Type;
272     UINT32                          Pad;
273     ACPI_EFI_PHYSICAL_ADDRESS       PhysicalStart;
274     ACPI_EFI_VIRTUAL_ADDRESS        VirtualStart;
275     UINT64                          NumberOfPages;
276     UINT64                          Attribute;
277 } ACPI_EFI_MEMORY_DESCRIPTOR;
278 
279 typedef struct _ACPI_EFI_TABLE_HEARDER {
280     UINT64                      Signature;
281     UINT32                      Revision;
282     UINT32                      HeaderSize;
283     UINT32                      CRC32;
284     UINT32                      Reserved;
285 } ACPI_EFI_TABLE_HEADER;
286 
287 typedef
288 ACPI_EFI_STATUS
289 (ACPI_EFI_API *ACPI_EFI_UNKNOWN_INTERFACE) (
290     void);
291 
292 
293 /*
294  * Text output protocol
295  */
296 #define ACPI_SIMPLE_TEXT_OUTPUT_PROTOCOL \
297     { 0x387477c2, 0x69c7, 0x11d2, {0x8e, 0x39, 0x0, 0xa0, 0xc9, 0x69, 0x72, 0x3b} }
298 
299 typedef
300 ACPI_EFI_STATUS
301 (ACPI_EFI_API *ACPI_EFI_TEXT_RESET) (
302     struct _ACPI_SIMPLE_TEXT_OUTPUT_INTERFACE   *This,
303     BOOLEAN                                     ExtendedVerification);
304 
305 typedef
306 ACPI_EFI_STATUS
307 (ACPI_EFI_API *ACPI_EFI_TEXT_OUTPUT_STRING) (
308     struct _ACPI_SIMPLE_TEXT_OUTPUT_INTERFACE   *This,
309     CHAR16                                      *String);
310 
311 typedef
312 ACPI_EFI_STATUS
313 (ACPI_EFI_API *ACPI_EFI_TEXT_TEST_STRING) (
314     struct _ACPI_SIMPLE_TEXT_OUTPUT_INTERFACE   *This,
315     CHAR16                                      *String);
316 
317 typedef
318 ACPI_EFI_STATUS
319 (ACPI_EFI_API *ACPI_EFI_TEXT_QUERY_MODE) (
320     struct _ACPI_SIMPLE_TEXT_OUTPUT_INTERFACE   *This,
321     UINTN                                       ModeNumber,
322     UINTN                                       *Columns,
323     UINTN                                       *Rows);
324 
325 typedef
326 ACPI_EFI_STATUS
327 (ACPI_EFI_API *ACPI_EFI_TEXT_SET_MODE) (
328     struct _ACPI_SIMPLE_TEXT_OUTPUT_INTERFACE   *This,
329     UINTN                                       ModeNumber);
330 
331 typedef
332 ACPI_EFI_STATUS
333 (ACPI_EFI_API *ACPI_EFI_TEXT_SET_ATTRIBUTE) (
334     struct _ACPI_SIMPLE_TEXT_OUTPUT_INTERFACE   *This,
335     UINTN                                       Attribute);
336 
337 typedef
338 ACPI_EFI_STATUS
339 (ACPI_EFI_API *ACPI_EFI_TEXT_CLEAR_SCREEN) (
340     struct _ACPI_SIMPLE_TEXT_OUTPUT_INTERFACE   *This);
341 
342 typedef
343 ACPI_EFI_STATUS
344 (ACPI_EFI_API *ACPI_EFI_TEXT_SET_CURSOR_POSITION) (
345     struct _ACPI_SIMPLE_TEXT_OUTPUT_INTERFACE   *This,
346     UINTN                                       Column,
347     UINTN                                       Row);
348 
349 typedef
350 ACPI_EFI_STATUS
351 (ACPI_EFI_API *ACPI_EFI_TEXT_ENABLE_CURSOR) (
352     struct _ACPI_SIMPLE_TEXT_OUTPUT_INTERFACE   *This,
353     BOOLEAN                                     Enable);
354 
355 typedef struct {
356     INT32                           MaxMode;
357     INT32                           Mode;
358     INT32                           Attribute;
359     INT32                           CursorColumn;
360     INT32                           CursorRow;
361     BOOLEAN                         CursorVisible;
362 } ACPI_SIMPLE_TEXT_OUTPUT_MODE;
363 
364 typedef struct _ACPI_SIMPLE_TEXT_OUTPUT_INTERFACE {
365     ACPI_EFI_TEXT_RESET                 Reset;
366 
367     ACPI_EFI_TEXT_OUTPUT_STRING         OutputString;
368     ACPI_EFI_TEXT_TEST_STRING           TestString;
369 
370     ACPI_EFI_TEXT_QUERY_MODE            QueryMode;
371     ACPI_EFI_TEXT_SET_MODE              SetMode;
372     ACPI_EFI_TEXT_SET_ATTRIBUTE         SetAttribute;
373 
374     ACPI_EFI_TEXT_CLEAR_SCREEN          ClearScreen;
375     ACPI_EFI_TEXT_SET_CURSOR_POSITION   SetCursorPosition;
376     ACPI_EFI_TEXT_ENABLE_CURSOR         EnableCursor;
377 
378     ACPI_SIMPLE_TEXT_OUTPUT_MODE        *Mode;
379 } ACPI_SIMPLE_TEXT_OUTPUT_INTERFACE;
380 
381 /*
382  * Text input protocol
383  */
384 #define ACPI_SIMPLE_TEXT_INPUT_PROTOCOL  \
385     { 0x387477c1, 0x69c7, 0x11d2, {0x8e, 0x39, 0x0, 0xa0, 0xc9, 0x69, 0x72, 0x3b} }
386 
387 typedef struct {
388     UINT16                              ScanCode;
389     CHAR16                              UnicodeChar;
390 } ACPI_EFI_INPUT_KEY;
391 
392 /*
393  * Baseline unicode control chars
394  */
395 #define CHAR_NULL                       0x0000
396 #define CHAR_BACKSPACE                  0x0008
397 #define CHAR_TAB                        0x0009
398 #define CHAR_LINEFEED                   0x000A
399 #define CHAR_CARRIAGE_RETURN            0x000D
400 
401 typedef
402 ACPI_EFI_STATUS
403 (ACPI_EFI_API *ACPI_EFI_INPUT_RESET) (
404     struct _ACPI_SIMPLE_INPUT_INTERFACE         *This,
405     BOOLEAN                                     ExtendedVerification);
406 
407 typedef
408 ACPI_EFI_STATUS
409 (ACPI_EFI_API *ACPI_EFI_INPUT_READ_KEY) (
410     struct _ACPI_SIMPLE_INPUT_INTERFACE         *This,
411     ACPI_EFI_INPUT_KEY                          *Key);
412 
413 typedef struct _ACPI_SIMPLE_INPUT_INTERFACE {
414     ACPI_EFI_INPUT_RESET                    Reset;
415     ACPI_EFI_INPUT_READ_KEY                 ReadKeyStroke;
416     ACPI_EFI_EVENT                          WaitForKey;
417 } ACPI_SIMPLE_INPUT_INTERFACE;
418 
419 
420 /*
421  * Simple file system protocol
422  */
423 #define ACPI_SIMPLE_FILE_SYSTEM_PROTOCOL \
424     { 0x964e5b22, 0x6459, 0x11d2, {0x8e, 0x39, 0x0, 0xa0, 0xc9, 0x69, 0x72, 0x3b} }
425 
426 typedef
427 ACPI_EFI_STATUS
428 (ACPI_EFI_API *ACPI_EFI_VOLUME_OPEN) (
429     struct _ACPI_EFI_FILE_IO_INTERFACE          *This,
430     struct _ACPI_EFI_FILE_HANDLE                **Root);
431 
432 #define ACPI_EFI_FILE_IO_INTERFACE_REVISION     0x00010000
433 
434 typedef struct _ACPI_EFI_FILE_IO_INTERFACE {
435     UINT64                  Revision;
436     ACPI_EFI_VOLUME_OPEN    OpenVolume;
437 } ACPI_EFI_FILE_IO_INTERFACE;
438 
439 typedef
440 ACPI_EFI_STATUS
441 (ACPI_EFI_API *ACPI_EFI_FILE_OPEN) (
442     struct _ACPI_EFI_FILE_HANDLE                *File,
443     struct _ACPI_EFI_FILE_HANDLE                **NewHandle,
444     CHAR16                                      *FileName,
445     UINT64                                      OpenMode,
446     UINT64                                      Attributes);
447 
448 /* Values for OpenMode used above */
449 
450 #define ACPI_EFI_FILE_MODE_READ     0x0000000000000001
451 #define ACPI_EFI_FILE_MODE_WRITE    0x0000000000000002
452 #define ACPI_EFI_FILE_MODE_CREATE   0x8000000000000000
453 
454 /* Values for Attribute used above */
455 
456 #define ACPI_EFI_FILE_READ_ONLY     0x0000000000000001
457 #define ACPI_EFI_FILE_HIDDEN        0x0000000000000002
458 #define ACPI_EFI_FILE_SYSTEM        0x0000000000000004
459 #define ACPI_EFI_FILE_RESERVIED     0x0000000000000008
460 #define ACPI_EFI_FILE_DIRECTORY     0x0000000000000010
461 #define ACPI_EFI_FILE_ARCHIVE       0x0000000000000020
462 #define ACPI_EFI_FILE_VALID_ATTR    0x0000000000000037
463 
464 typedef
465 ACPI_EFI_STATUS
466 (ACPI_EFI_API *ACPI_EFI_FILE_CLOSE) (
467     struct _ACPI_EFI_FILE_HANDLE                *File);
468 
469 typedef
470 ACPI_EFI_STATUS
471 (ACPI_EFI_API *ACPI_EFI_FILE_DELETE) (
472     struct _ACPI_EFI_FILE_HANDLE                *File);
473 
474 typedef
475 ACPI_EFI_STATUS
476 (ACPI_EFI_API *ACPI_EFI_FILE_READ) (
477     struct _ACPI_EFI_FILE_HANDLE                *File,
478     UINTN                                       *BufferSize,
479     VOID                                        *Buffer);
480 
481 typedef
482 ACPI_EFI_STATUS
483 (ACPI_EFI_API *ACPI_EFI_FILE_WRITE) (
484     struct _ACPI_EFI_FILE_HANDLE                *File,
485     UINTN                                       *BufferSize,
486     VOID                                        *Buffer);
487 
488 typedef
489 ACPI_EFI_STATUS
490 (ACPI_EFI_API *ACPI_EFI_FILE_SET_POSITION) (
491     struct _ACPI_EFI_FILE_HANDLE                *File,
492     UINT64                                      Position);
493 
494 typedef
495 ACPI_EFI_STATUS
496 (ACPI_EFI_API *ACPI_EFI_FILE_GET_POSITION) (
497     struct _ACPI_EFI_FILE_HANDLE                *File,
498     UINT64                                      *Position);
499 
500 #define ACPI_EFI_FILE_INFO_ID \
501     { 0x9576e92, 0x6d3f, 0x11d2, {0x8e, 0x39, 0x0, 0xa0, 0xc9, 0x69, 0x72, 0x3b} }
502 
503 typedef struct {
504     UINT64 Size;
505     UINT64 FileSize;
506     UINT64 PhysicalSize;
507     ACPI_EFI_TIME CreateTime;
508     ACPI_EFI_TIME LastAccessTime;
509     ACPI_EFI_TIME ModificationTime;
510     UINT64 Attribute;
511     CHAR16 FileName[1];
512 } ACPI_EFI_FILE_INFO;
513 
514 #define SIZE_OF_ACPI_EFI_FILE_INFO  ACPI_OFFSET(ACPI_EFI_FILE_INFO, FileName)
515 
516 typedef
517 ACPI_EFI_STATUS
518 (ACPI_EFI_API *ACPI_EFI_FILE_GET_INFO) (
519     struct _ACPI_EFI_FILE_HANDLE                *File,
520     ACPI_EFI_GUID                               *InformationType,
521     UINTN                                       *BufferSize,
522     VOID                                        *Buffer);
523 
524 typedef
525 ACPI_EFI_STATUS
526 (ACPI_EFI_API *ACPI_EFI_FILE_SET_INFO) (
527     struct _ACPI_EFI_FILE_HANDLE                *File,
528     ACPI_EFI_GUID                               *InformationType,
529     UINTN                                       BufferSize,
530     VOID                                        *Buffer);
531 
532 typedef
533 ACPI_EFI_STATUS
534 (ACPI_EFI_API *ACPI_EFI_FILE_FLUSH) (
535     struct _ACPI_EFI_FILE_HANDLE                *File);
536 
537 
538 #define ACPI_EFI_FILE_HANDLE_REVISION           0x00010000
539 
540 typedef struct _ACPI_EFI_FILE_HANDLE {
541     UINT64                      Revision;
542     ACPI_EFI_FILE_OPEN          Open;
543     ACPI_EFI_FILE_CLOSE         Close;
544     ACPI_EFI_FILE_DELETE        Delete;
545     ACPI_EFI_FILE_READ          Read;
546     ACPI_EFI_FILE_WRITE         Write;
547     ACPI_EFI_FILE_GET_POSITION  GetPosition;
548     ACPI_EFI_FILE_SET_POSITION  SetPosition;
549     ACPI_EFI_FILE_GET_INFO      GetInfo;
550     ACPI_EFI_FILE_SET_INFO      SetInfo;
551     ACPI_EFI_FILE_FLUSH         Flush;
552 } ACPI_EFI_FILE_STRUCT, *ACPI_EFI_FILE_HANDLE;
553 
554 
555 /*
556  * Loaded image protocol
557  */
558 #define ACPI_EFI_LOADED_IMAGE_PROTOCOL \
559     { 0x5B1B31A1, 0x9562, 0x11d2, {0x8E, 0x3F, 0x00, 0xA0, 0xC9, 0x69, 0x72, 0x3B} }
560 
561 typedef
562 ACPI_EFI_STATUS
563 (ACPI_EFI_API *ACPI_EFI_IMAGE_ENTRY_POINT) (
564     ACPI_EFI_HANDLE                         ImageHandle,
565     struct _ACPI_EFI_SYSTEM_TABLE           *SystemTable);
566 
567 typedef
568 ACPI_EFI_STATUS
569 (ACPI_EFI_API *ACPI_EFI_IMAGE_LOAD) (
570     BOOLEAN                         BootPolicy,
571     ACPI_EFI_HANDLE                 ParentImageHandle,
572     ACPI_EFI_DEVICE_PATH            *FilePath,
573     VOID                            *SourceBuffer,
574     UINTN                           SourceSize,
575     ACPI_EFI_HANDLE                 *ImageHandle);
576 
577 typedef
578 ACPI_EFI_STATUS
579 (ACPI_EFI_API *ACPI_EFI_IMAGE_START) (
580     ACPI_EFI_HANDLE                 ImageHandle,
581     UINTN                           *ExitDataSize,
582     CHAR16                          **ExitData);
583 
584 typedef
585 ACPI_EFI_STATUS
586 (ACPI_EFI_API *ACPI_EFI_EXIT) (
587     ACPI_EFI_HANDLE                 ImageHandle,
588     ACPI_EFI_STATUS                 ExitStatus,
589     UINTN                           ExitDataSize,
590     CHAR16                          *ExitData);
591 
592 typedef
593 ACPI_EFI_STATUS
594 (ACPI_EFI_API *ACPI_EFI_IMAGE_UNLOAD) (
595     ACPI_EFI_HANDLE                 ImageHandle);
596 
597 
598 typedef
599 ACPI_EFI_STATUS
600 (ACPI_EFI_API *ACPI_EFI_SET_WATCHDOG_TIMER) (
601     UINTN                           Timeout,
602     UINT64                          WatchdogCode,
603     UINTN                           DataSize,
604     CHAR16                          *WatchdogData);
605 
606 
607 #define EFI_IMAGE_INFORMATION_REVISION      0x1000
608 typedef struct {
609     UINT32                          Revision;
610     ACPI_EFI_HANDLE                 ParentHandle;
611     struct _ACPI_EFI_SYSTEM_TABLE   *SystemTable;
612     ACPI_EFI_HANDLE                 DeviceHandle;
613     ACPI_EFI_DEVICE_PATH            *FilePath;
614     VOID                            *Reserved;
615     UINT32                          LoadOptionsSize;
616     VOID                            *LoadOptions;
617     VOID                            *ImageBase;
618     UINT64                          ImageSize;
619     ACPI_EFI_MEMORY_TYPE            ImageCodeType;
620     ACPI_EFI_MEMORY_TYPE            ImageDataType;
621     ACPI_EFI_IMAGE_UNLOAD           Unload;
622 
623 } ACPI_EFI_LOADED_IMAGE;
624 
625 
626 /*
627  * EFI Memory
628  */
629 typedef
630 ACPI_EFI_STATUS
631 (ACPI_EFI_API *ACPI_EFI_ALLOCATE_PAGES) (
632     ACPI_EFI_ALLOCATE_TYPE          Type,
633     ACPI_EFI_MEMORY_TYPE            MemoryType,
634     UINTN                           NoPages,
635     ACPI_EFI_PHYSICAL_ADDRESS       *Memory);
636 
637 typedef
638 ACPI_EFI_STATUS
639 (ACPI_EFI_API *ACPI_EFI_FREE_PAGES) (
640     ACPI_EFI_PHYSICAL_ADDRESS       Memory,
641     UINTN                           NoPages);
642 
643 typedef
644 ACPI_EFI_STATUS
645 (ACPI_EFI_API *ACPI_EFI_GET_MEMORY_MAP) (
646     UINTN                           *MemoryMapSize,
647     ACPI_EFI_MEMORY_DESCRIPTOR      *MemoryMap,
648     UINTN                           *MapKey,
649     UINTN                           *DescriptorSize,
650     UINT32                          *DescriptorVersion);
651 
652 #define NextMemoryDescriptor(Ptr,Size)  ((ACPI_EFI_MEMORY_DESCRIPTOR *) (((UINT8 *) Ptr) + Size))
653 
654 typedef
655 ACPI_EFI_STATUS
656 (ACPI_EFI_API *ACPI_EFI_ALLOCATE_POOL) (
657     ACPI_EFI_MEMORY_TYPE            PoolType,
658     UINTN                           Size,
659     VOID                            **Buffer);
660 
661 typedef
662 ACPI_EFI_STATUS
663 (ACPI_EFI_API *ACPI_EFI_FREE_POOL) (
664     VOID                            *Buffer);
665 
666 
667 /*
668  * Protocol handler functions
669  */
670 typedef enum {
671     ACPI_EFI_NATIVE_INTERFACE,
672     ACPI_EFI_PCODE_INTERFACE
673 } ACPI_EFI_INTERFACE_TYPE;
674 
675 typedef enum {
676     AcpiEfiAllHandles,
677     AcpiEfiByRegisterNotify,
678     AcpiEfiByProtocol
679 } ACPI_EFI_LOCATE_SEARCH_TYPE;
680 
681 typedef
682 ACPI_EFI_STATUS
683 (ACPI_EFI_API *ACPI_EFI_INSTALL_PROTOCOL_INTERFACE) (
684     ACPI_EFI_HANDLE                 *Handle,
685     ACPI_EFI_GUID                   *Protocol,
686     ACPI_EFI_INTERFACE_TYPE         InterfaceType,
687     VOID                            *Interface);
688 
689 typedef
690 ACPI_EFI_STATUS
691 (ACPI_EFI_API *ACPI_EFI_REINSTALL_PROTOCOL_INTERFACE) (
692     ACPI_EFI_HANDLE                 Handle,
693     ACPI_EFI_GUID                   *Protocol,
694     VOID                            *OldInterface,
695     VOID                            *NewInterface);
696 
697 typedef
698 ACPI_EFI_STATUS
699 (ACPI_EFI_API *ACPI_EFI_UNINSTALL_PROTOCOL_INTERFACE) (
700     ACPI_EFI_HANDLE                 Handle,
701     ACPI_EFI_GUID                   *Protocol,
702     VOID                            *Interface);
703 
704 typedef
705 ACPI_EFI_STATUS
706 (ACPI_EFI_API *ACPI_EFI_HANDLE_PROTOCOL) (
707     ACPI_EFI_HANDLE                 Handle,
708     ACPI_EFI_GUID                   *Protocol,
709     VOID                            **Interface);
710 
711 typedef
712 ACPI_EFI_STATUS
713 (ACPI_EFI_API *ACPI_EFI_REGISTER_PROTOCOL_NOTIFY) (
714     ACPI_EFI_GUID                   *Protocol,
715     ACPI_EFI_EVENT                  Event,
716     VOID                            **Registration);
717 
718 typedef
719 ACPI_EFI_STATUS
720 (ACPI_EFI_API *ACPI_EFI_LOCATE_HANDLE) (
721     ACPI_EFI_LOCATE_SEARCH_TYPE     SearchType,
722     ACPI_EFI_GUID                   *Protocol,
723     VOID                            *SearchKey,
724     UINTN                           *BufferSize,
725     ACPI_EFI_HANDLE                 *Buffer);
726 
727 typedef
728 ACPI_EFI_STATUS
729 (ACPI_EFI_API *ACPI_EFI_LOCATE_DEVICE_PATH) (
730     ACPI_EFI_GUID                   *Protocol,
731     ACPI_EFI_DEVICE_PATH            **DevicePath,
732     ACPI_EFI_HANDLE                 *Device);
733 
734 typedef
735 ACPI_EFI_STATUS
736 (ACPI_EFI_API *ACPI_EFI_INSTALL_CONFIGURATION_TABLE) (
737     ACPI_EFI_GUID                   *Guid,
738     VOID                            *Table);
739 
740 #define ACPI_EFI_OPEN_PROTOCOL_BY_HANDLE_PROTOCOL  0x00000001
741 #define ACPI_EFI_OPEN_PROTOCOL_GET_PROTOCOL        0x00000002
742 #define ACPI_EFI_OPEN_PROTOCOL_TEST_PROTOCOL       0x00000004
743 #define ACPI_EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER 0x00000008
744 #define ACPI_EFI_OPEN_PROTOCOL_BY_DRIVER           0x00000010
745 #define ACPI_EFI_OPEN_PROTOCOL_EXCLUSIVE           0x00000020
746 
747 typedef
748 ACPI_EFI_STATUS
749 (ACPI_EFI_API *ACPI_EFI_OPEN_PROTOCOL) (
750     ACPI_EFI_HANDLE                 Handle,
751     ACPI_EFI_GUID                   *Protocol,
752     VOID                            **Interface,
753     ACPI_EFI_HANDLE                 AgentHandle,
754     ACPI_EFI_HANDLE                 ControllerHandle,
755     UINT32                          Attributes);
756 
757 typedef
758 ACPI_EFI_STATUS
759 (ACPI_EFI_API *ACPI_EFI_CLOSE_PROTOCOL) (
760     ACPI_EFI_HANDLE                 Handle,
761     ACPI_EFI_GUID                   *Protocol,
762     ACPI_EFI_HANDLE                 AgentHandle,
763     ACPI_EFI_HANDLE                 ControllerHandle);
764 
765 typedef struct {
766     ACPI_EFI_HANDLE                 AgentHandle;
767     ACPI_EFI_HANDLE                 ControllerHandle;
768     UINT32                          Attributes;
769     UINT32                          OpenCount;
770 } ACPI_EFI_OPEN_PROTOCOL_INFORMATION_ENTRY;
771 
772 typedef
773 ACPI_EFI_STATUS
774 (ACPI_EFI_API *ACPI_EFI_OPEN_PROTOCOL_INFORMATION) (
775     ACPI_EFI_HANDLE                 Handle,
776     ACPI_EFI_GUID                   *Protocol,
777     ACPI_EFI_OPEN_PROTOCOL_INFORMATION_ENTRY **EntryBuffer,
778     UINTN                           *EntryCount);
779 
780 typedef
781 ACPI_EFI_STATUS
782 (ACPI_EFI_API *ACPI_EFI_PROTOCOLS_PER_HANDLE) (
783     ACPI_EFI_HANDLE                 Handle,
784     ACPI_EFI_GUID                   ***ProtocolBuffer,
785     UINTN                           *ProtocolBufferCount);
786 
787 typedef
788 ACPI_EFI_STATUS
789 (ACPI_EFI_API *ACPI_EFI_LOCATE_HANDLE_BUFFER) (
790     ACPI_EFI_LOCATE_SEARCH_TYPE     SearchType,
791     ACPI_EFI_GUID                   *Protocol,
792     VOID                            *SearchKey,
793     UINTN                           *NoHandles,
794     ACPI_EFI_HANDLE                 **Buffer);
795 
796 typedef
797 ACPI_EFI_STATUS
798 (ACPI_EFI_API *ACPI_EFI_LOCATE_PROTOCOL) (
799     ACPI_EFI_GUID                   *Protocol,
800     VOID                            *Registration,
801     VOID                            **Interface);
802 
803 typedef
804 ACPI_EFI_STATUS
805 (ACPI_EFI_API *ACPI_EFI_INSTALL_MULTIPLE_PROTOCOL_INTERFACES) (
806     ACPI_EFI_HANDLE                 *Handle,
807     ...);
808 
809 typedef
810 ACPI_EFI_STATUS
811 (ACPI_EFI_API *ACPI_EFI_UNINSTALL_MULTIPLE_PROTOCOL_INTERFACES) (
812     ACPI_EFI_HANDLE                 Handle,
813     ...);
814 
815 typedef
816 ACPI_EFI_STATUS
817 (ACPI_EFI_API *ACPI_EFI_CALCULATE_CRC32) (
818     VOID                            *Data,
819     UINTN                           DataSize,
820     UINT32                          *Crc32);
821 
822 typedef
823 VOID
824 (ACPI_EFI_API *ACPI_EFI_COPY_MEM) (
825     VOID                            *Destination,
826     VOID                            *Source,
827     UINTN                           Length);
828 
829 typedef
830 VOID
831 (ACPI_EFI_API *ACPI_EFI_SET_MEM) (
832     VOID                            *Buffer,
833     UINTN                           Size,
834     UINT8                           Value);
835 
836 /*
837  * EFI Boot Services Table
838  */
839 #define ACPI_EFI_BOOT_SERVICES_SIGNATURE 0x56524553544f4f42
840 #define ACPI_EFI_BOOT_SERVICES_REVISION  (ACPI_EFI_SPECIFICATION_MAJOR_REVISION<<16) | (ACPI_EFI_SPECIFICATION_MINOR_REVISION)
841 
842 typedef struct _ACPI_EFI_BOOT_SERVICES {
843     ACPI_EFI_TABLE_HEADER               Hdr;
844 
845 #if 0
846     ACPI_EFI_RAISE_TPL                  RaiseTPL;
847     ACPI_EFI_RESTORE_TPL                RestoreTPL;
848 #else
849     ACPI_EFI_UNKNOWN_INTERFACE          RaiseTPL;
850     ACPI_EFI_UNKNOWN_INTERFACE          RestoreTPL;
851 #endif
852 
853     ACPI_EFI_ALLOCATE_PAGES             AllocatePages;
854     ACPI_EFI_FREE_PAGES                 FreePages;
855     ACPI_EFI_GET_MEMORY_MAP             GetMemoryMap;
856     ACPI_EFI_ALLOCATE_POOL              AllocatePool;
857     ACPI_EFI_FREE_POOL                  FreePool;
858 
859 #if 0
860     ACPI_EFI_CREATE_EVENT               CreateEvent;
861     ACPI_EFI_SET_TIMER                  SetTimer;
862     ACPI_EFI_WAIT_FOR_EVENT             WaitForEvent;
863     ACPI_EFI_SIGNAL_EVENT               SignalEvent;
864     ACPI_EFI_CLOSE_EVENT                CloseEvent;
865     ACPI_EFI_CHECK_EVENT                CheckEvent;
866 #else
867     ACPI_EFI_UNKNOWN_INTERFACE          CreateEvent;
868     ACPI_EFI_UNKNOWN_INTERFACE          SetTimer;
869     ACPI_EFI_UNKNOWN_INTERFACE          WaitForEvent;
870     ACPI_EFI_UNKNOWN_INTERFACE          SignalEvent;
871     ACPI_EFI_UNKNOWN_INTERFACE          CloseEvent;
872     ACPI_EFI_UNKNOWN_INTERFACE          CheckEvent;
873 #endif
874 
875     ACPI_EFI_INSTALL_PROTOCOL_INTERFACE InstallProtocolInterface;
876     ACPI_EFI_REINSTALL_PROTOCOL_INTERFACE ReinstallProtocolInterface;
877     ACPI_EFI_UNINSTALL_PROTOCOL_INTERFACE UninstallProtocolInterface;
878     ACPI_EFI_HANDLE_PROTOCOL            HandleProtocol;
879     ACPI_EFI_HANDLE_PROTOCOL            PCHandleProtocol;
880     ACPI_EFI_REGISTER_PROTOCOL_NOTIFY   RegisterProtocolNotify;
881     ACPI_EFI_LOCATE_HANDLE              LocateHandle;
882     ACPI_EFI_LOCATE_DEVICE_PATH         LocateDevicePath;
883     ACPI_EFI_INSTALL_CONFIGURATION_TABLE InstallConfigurationTable;
884 
885     ACPI_EFI_IMAGE_LOAD                 LoadImage;
886     ACPI_EFI_IMAGE_START                StartImage;
887     ACPI_EFI_EXIT                       Exit;
888     ACPI_EFI_IMAGE_UNLOAD               UnloadImage;
889 
890 #if 0
891     ACPI_EFI_EXIT_BOOT_SERVICES         ExitBootServices;
892     ACPI_EFI_GET_NEXT_MONOTONIC_COUNT   GetNextMonotonicCount;
893     ACPI_EFI_STALL                      Stall;
894 #else
895     ACPI_EFI_UNKNOWN_INTERFACE          ExitBootServices;
896     ACPI_EFI_UNKNOWN_INTERFACE          GetNextMonotonicCount;
897     ACPI_EFI_UNKNOWN_INTERFACE          Stall;
898 #endif
899     ACPI_EFI_SET_WATCHDOG_TIMER         SetWatchdogTimer;
900 
901 #if 0
902     ACPI_EFI_CONNECT_CONTROLLER         ConnectController;
903     ACPI_EFI_DISCONNECT_CONTROLLER      DisconnectController;
904 #else
905     ACPI_EFI_UNKNOWN_INTERFACE          ConnectController;
906     ACPI_EFI_UNKNOWN_INTERFACE          DisconnectController;
907 #endif
908 
909     ACPI_EFI_OPEN_PROTOCOL              OpenProtocol;
910     ACPI_EFI_CLOSE_PROTOCOL             CloseProtocol;
911     ACPI_EFI_OPEN_PROTOCOL_INFORMATION  OpenProtocolInformation;
912     ACPI_EFI_PROTOCOLS_PER_HANDLE       ProtocolsPerHandle;
913     ACPI_EFI_LOCATE_HANDLE_BUFFER       LocateHandleBuffer;
914     ACPI_EFI_LOCATE_PROTOCOL            LocateProtocol;
915     ACPI_EFI_INSTALL_MULTIPLE_PROTOCOL_INTERFACES InstallMultipleProtocolInterfaces;
916     ACPI_EFI_UNINSTALL_MULTIPLE_PROTOCOL_INTERFACES UninstallMultipleProtocolInterfaces;
917 
918     ACPI_EFI_CALCULATE_CRC32        CalculateCrc32;
919 
920     ACPI_EFI_COPY_MEM               CopyMem;
921     ACPI_EFI_SET_MEM                SetMem;
922 
923 #if 0
924     ACPI_EFI_CREATE_EVENT_EX        CreateEventEx;
925 #else
926     ACPI_EFI_UNKNOWN_INTERFACE      CreateEventEx;
927 #endif
928 } ACPI_EFI_BOOT_SERVICES;
929 
930 
931 /*
932  * EFI System Table
933  */
934 
935 /*
936  * EFI Configuration Table and GUID definitions
937  */
938 #define ACPI_TABLE_GUID \
939     { 0xeb9d2d30, 0x2d88, 0x11d3, {0x9a, 0x16, 0x0, 0x90, 0x27, 0x3f, 0xc1, 0x4d} }
940 #define ACPI_20_TABLE_GUID \
941     { 0x8868e871, 0xe4f1, 0x11d3, {0xbc, 0x22, 0x0, 0x80, 0xc7, 0x3c, 0x88, 0x81} }
942 
943 typedef struct _ACPI_EFI_CONFIGURATION_TABLE {
944     ACPI_EFI_GUID           VendorGuid;
945     VOID                    *VendorTable;
946 } ACPI_EFI_CONFIGURATION_TABLE;
947 
948 
949 #define ACPI_EFI_SYSTEM_TABLE_SIGNATURE 0x5453595320494249
950 #define ACPI_EFI_SYSTEM_TABLE_REVISION  (ACPI_EFI_SPECIFICATION_MAJOR_REVISION<<16) | (ACPI_EFI_SPECIFICATION_MINOR_REVISION)
951 
952 typedef struct _ACPI_EFI_SYSTEM_TABLE {
953     ACPI_EFI_TABLE_HEADER               Hdr;
954 
955     CHAR16                              *FirmwareVendor;
956     UINT32                              FirmwareRevision;
957 
958     ACPI_EFI_HANDLE                     ConsoleInHandle;
959     ACPI_SIMPLE_INPUT_INTERFACE         *ConIn;
960 
961     ACPI_EFI_HANDLE                     ConsoleOutHandle;
962     ACPI_SIMPLE_TEXT_OUTPUT_INTERFACE   *ConOut;
963 
964     ACPI_EFI_HANDLE                     StandardErrorHandle;
965     ACPI_SIMPLE_TEXT_OUTPUT_INTERFACE   *StdErr;
966 
967 #if 0
968     ACPI_EFI_RUNTIME_SERVICES           *RuntimeServices;
969 #else
970     ACPI_EFI_HANDLE                     *RuntimeServices;
971 #endif
972     ACPI_EFI_BOOT_SERVICES              *BootServices;
973 
974     UINTN                               NumberOfTableEntries;
975     ACPI_EFI_CONFIGURATION_TABLE        *ConfigurationTable;
976 
977 } ACPI_EFI_SYSTEM_TABLE;
978 
979 
980 /*
981  * EFI PCI I/O Protocol
982  */
983 #define ACPI_EFI_PCI_IO_PROTOCOL \
984     { 0x4cf5b200, 0x68b8, 0x4ca5, {0x9e, 0xec, 0xb2, 0x3e, 0x3f, 0x50, 0x2, 0x9a} }
985 
986 typedef enum {
987     AcpiEfiPciIoWidthUint8 = 0,
988     AcpiEfiPciIoWidthUint16,
989     AcpiEfiPciIoWidthUint32,
990     AcpiEfiPciIoWidthUint64,
991     AcpiEfiPciIoWidthFifoUint8,
992     AcpiEfiPciIoWidthFifoUint16,
993     AcpiEfiPciIoWidthFifoUint32,
994     AcpiEfiPciIoWidthFifoUint64,
995     AcpiEfiPciIoWidthFillUint8,
996     AcpiEfiPciIoWidthFillUint16,
997     AcpiEfiPciIoWidthFillUint32,
998     AcpiEfiPciIoWidthFillUint64,
999     AcpiEfiPciIoWidthMaximum
1000 } ACPI_EFI_PCI_IO_PROTOCOL_WIDTH;
1001 
1002 typedef
1003 ACPI_EFI_STATUS
1004 (ACPI_EFI_API *ACPI_EFI_PCI_IO_PROTOCOL_CONFIG)(
1005     struct _ACPI_EFI_PCI_IO             *This,
1006     ACPI_EFI_PCI_IO_PROTOCOL_WIDTH      Width,
1007     UINT32                              Offset,
1008     UINTN                               Count,
1009     VOID                                *Buffer);
1010 
1011 typedef struct {
1012     ACPI_EFI_PCI_IO_PROTOCOL_CONFIG     Read;
1013     ACPI_EFI_PCI_IO_PROTOCOL_CONFIG     Write;
1014 } ACPI_EFI_PCI_IO_PROTOCOL_CONFIG_ACCESS;
1015 
1016 typedef
1017 ACPI_EFI_STATUS
1018 (ACPI_EFI_API *ACPI_EFI_PCI_IO_PROTOCOL_GET_LOCATION)(
1019     struct _ACPI_EFI_PCI_IO             *This,
1020     UINTN                               *SegmentNumber,
1021     UINTN                               *BusNumber,
1022     UINTN                               *DeviceNumber,
1023     UINTN                               *FunctionNumber);
1024 
1025 typedef struct _ACPI_EFI_PCI_IO {
1026     ACPI_EFI_UNKNOWN_INTERFACE          PollMem;
1027     ACPI_EFI_UNKNOWN_INTERFACE          PollIo;
1028     ACPI_EFI_UNKNOWN_INTERFACE          Mem;
1029     ACPI_EFI_UNKNOWN_INTERFACE          Io;
1030     ACPI_EFI_PCI_IO_PROTOCOL_CONFIG_ACCESS Pci;
1031     ACPI_EFI_UNKNOWN_INTERFACE          CopyMem;
1032     ACPI_EFI_UNKNOWN_INTERFACE          Map;
1033     ACPI_EFI_UNKNOWN_INTERFACE          Unmap;
1034     ACPI_EFI_UNKNOWN_INTERFACE          AllocateBuffer;
1035     ACPI_EFI_UNKNOWN_INTERFACE          FreeBuffer;
1036     ACPI_EFI_UNKNOWN_INTERFACE          Flush;
1037     ACPI_EFI_PCI_IO_PROTOCOL_GET_LOCATION GetLocation;
1038     ACPI_EFI_UNKNOWN_INTERFACE          Attributes;
1039     ACPI_EFI_UNKNOWN_INTERFACE          GetBarAttributes;
1040     ACPI_EFI_UNKNOWN_INTERFACE          SetBarAttributes;
1041     UINT64                              RomSize;
1042     VOID                                *RomImage;
1043 } ACPI_EFI_PCI_IO;
1044 
1045 /* FILE abstraction */
1046 
1047 union acpi_efi_file {
1048     struct _ACPI_EFI_FILE_HANDLE File;
1049     struct _ACPI_SIMPLE_TEXT_OUTPUT_INTERFACE ConOut;
1050     struct _ACPI_SIMPLE_INPUT_INTERFACE ConIn;
1051 };
1052 
1053 
1054 /* GNU EFI definitions */
1055 
1056 #if defined(_GNU_EFI)
1057 
1058 /*
1059  * This is needed to hide platform specific code from ACPICA
1060  */
1061 UINT64
1062 DivU64x32 (
1063     UINT64                  Dividend,
1064     UINTN                   Divisor,
1065     UINTN                   *Remainder);
1066 
1067 /*
1068  * EFI specific prototypes
1069  */
1070 ACPI_EFI_STATUS
1071 efi_main (
1072     ACPI_EFI_HANDLE         Image,
1073     ACPI_EFI_SYSTEM_TABLE   *SystemTab);
1074 
1075 int
1076 acpi_main (
1077     int                     argc,
1078     char                    *argv[]);
1079 
1080 
1081 #endif
1082 
1083 extern ACPI_EFI_GUID AcpiGbl_LoadedImageProtocol;
1084 extern ACPI_EFI_GUID AcpiGbl_TextInProtocol;
1085 extern ACPI_EFI_GUID AcpiGbl_TextOutProtocol;
1086 extern ACPI_EFI_GUID AcpiGbl_FileSystemProtocol;
1087 extern ACPI_EFI_GUID AcpiGbl_GenericFileInfo;
1088 
1089 #endif /* __ACEFIEX_H__ */
1090