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