summaryrefslogtreecommitdiff
path: root/source/include/platform/acefiex.h
blob: e90b8971269542949875210fd9f1d0af27a4aa86 (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
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
/******************************************************************************
 *
 * Name: acefiex.h - Extra OS specific defines, etc. for EFI
 *
 *****************************************************************************/

/******************************************************************************
 *
 * 1. Copyright Notice
 *
 * Some or all of this work - Copyright (c) 1999 - 2016, Intel Corp.
 * All rights reserved.
 *
 * 2. License
 *
 * 2.1. This is your license from Intel Corp. under its intellectual property
 * rights. You may have additional license terms from the party that provided
 * you this software, covering your right to use that party's intellectual
 * property rights.
 *
 * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
 * copy of the source code appearing in this file ("Covered Code") an
 * irrevocable, perpetual, worldwide license under Intel's copyrights in the
 * base code distributed originally by Intel ("Original Intel Code") to copy,
 * make derivatives, distribute, use and display any portion of the Covered
 * Code in any form, with the right to sublicense such rights; and
 *
 * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
 * license (with the right to sublicense), under only those claims of Intel
 * patents that are infringed by the Original Intel Code, to make, use, sell,
 * offer to sell, and import the Covered Code and derivative works thereof
 * solely to the minimum extent necessary to exercise the above copyright
 * license, and in no event shall the patent license extend to any additions
 * to or modifications of the Original Intel Code. No other license or right
 * is granted directly or by implication, estoppel or otherwise;
 *
 * The above copyright and patent license is granted only if the following
 * conditions are met:
 *
 * 3. Conditions
 *
 * 3.1. Redistribution of Source with Rights to Further Distribute Source.
 * Redistribution of source code of any substantial portion of the Covered
 * Code or modification with rights to further distribute source must include
 * the above Copyright Notice, the above License, this list of Conditions,
 * and the following Disclaimer and Export Compliance provision. In addition,
 * Licensee must cause all Covered Code to which Licensee contributes to
 * contain a file documenting the changes Licensee made to create that Covered
 * Code and the date of any change. Licensee must include in that file the
 * documentation of any changes made by any predecessor Licensee. Licensee
 * must include a prominent statement that the modification is derived,
 * directly or indirectly, from Original Intel Code.
 *
 * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
 * Redistribution of source code of any substantial portion of the Covered
 * Code or modification without rights to further distribute source must
 * include the following Disclaimer and Export Compliance provision in the
 * documentation and/or other materials provided with distribution. In
 * addition, Licensee may not authorize further sublicense of source of any
 * portion of the Covered Code, and must include terms to the effect that the
 * license from Licensee to its licensee is limited to the intellectual
 * property embodied in the software Licensee provides to its licensee, and
 * not to intellectual property embodied in modifications its licensee may
 * make.
 *
 * 3.3. Redistribution of Executable. Redistribution in executable form of any
 * substantial portion of the Covered Code or modification must reproduce the
 * above Copyright Notice, and the following Disclaimer and Export Compliance
 * provision in the documentation and/or other materials provided with the
 * distribution.
 *
 * 3.4. Intel retains all right, title, and interest in and to the Original
 * Intel Code.
 *
 * 3.5. Neither the name Intel nor any other trademark owned or controlled by
 * Intel shall be used in advertising or otherwise to promote the sale, use or
 * other dealings in products derived from or relating to the Covered Code
 * without prior written authorization from Intel.
 *
 * 4. Disclaimer and Export Compliance
 *
 * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
 * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
 * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
 * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
 * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
 * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
 * PARTICULAR PURPOSE.
 *
 * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
 * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
 * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
 * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
 * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
 * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
 * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
 * LIMITED REMEDY.
 *
 * 4.3. Licensee shall not export, either directly or indirectly, any of this
 * software or system incorporating such software without first obtaining any
 * required license or other approval from the U. S. Department of Commerce or
 * any other agency or department of the United States Government. In the
 * event Licensee exports any such software from the United States or
 * re-exports any such software from a foreign destination, Licensee shall
 * ensure that the distribution and export/re-export of the software is in
 * compliance with all laws, regulations, orders, or other restrictions of the
 * U.S. Export Administration Regulations. Licensee agrees that neither it nor
 * any of its subsidiaries will export/re-export any technical data, process,
 * software, or service, directly or indirectly, to any country for which the
 * United States government or any agency thereof requires an export license,
 * other governmental approval, or letter of assurance, without first obtaining
 * such license, approval or letter.
 *
 *****************************************************************************/

#ifndef __ACEFIEX_H__
#define __ACEFIEX_H__


#ifndef ACPI_USE_SYSTEM_CLIBRARY

typedef signed char                     int8_t;
typedef short int                       int16_t;
typedef int                             int32_t;
typedef unsigned char                   uint8_t;
typedef unsigned short int              uint16_t;
typedef unsigned int                    uint32_t;
typedef COMPILER_DEPENDENT_INT64        int64_t;
typedef COMPILER_DEPENDENT_UINT64       uint64_t;

#endif /* ACPI_USE_SYSTEM_CLIBRARY */

#define ACPI_EFI_ERROR(a)               (((INTN) a) < 0)
#define ACPI_EFI_SUCCESS                0
#define ACPI_EFI_LOAD_ERROR             ACPI_EFI_ERR(1)
#define ACPI_EFI_INVALID_PARAMETER      ACPI_EFI_ERR(2)
#define ACPI_EFI_UNSUPPORTED            ACPI_EFI_ERR(3)
#define ACPI_EFI_BAD_BUFFER_SIZE        ACPI_EFI_ERR(4)
#define ACPI_EFI_BUFFER_TOO_SMALL       ACPI_EFI_ERR(5)
#define ACPI_EFI_NOT_READY              ACPI_EFI_ERR(6)
#define ACPI_EFI_DEVICE_ERROR           ACPI_EFI_ERR(7)
#define ACPI_EFI_WRITE_PROTECTED        ACPI_EFI_ERR(8)
#define ACPI_EFI_OUT_OF_RESOURCES       ACPI_EFI_ERR(9)
#define ACPI_EFI_VOLUME_CORRUPTED       ACPI_EFI_ERR(10)
#define ACPI_EFI_VOLUME_FULL            ACPI_EFI_ERR(11)
#define ACPI_EFI_NO_MEDIA               ACPI_EFI_ERR(12)
#define ACPI_EFI_MEDIA_CHANGED          ACPI_EFI_ERR(13)
#define ACPI_EFI_NOT_FOUND              ACPI_EFI_ERR(14)
#define ACPI_EFI_ACCESS_DENIED          ACPI_EFI_ERR(15)
#define ACPI_EFI_NO_RESPONSE            ACPI_EFI_ERR(16)
#define ACPI_EFI_NO_MAPPING             ACPI_EFI_ERR(17)
#define ACPI_EFI_TIMEOUT                ACPI_EFI_ERR(18)
#define ACPI_EFI_NOT_STARTED            ACPI_EFI_ERR(19)
#define ACPI_EFI_ALREADY_STARTED        ACPI_EFI_ERR(20)
#define ACPI_EFI_ABORTED                ACPI_EFI_ERR(21)
#define ACPI_EFI_PROTOCOL_ERROR         ACPI_EFI_ERR(24)


typedef UINTN ACPI_EFI_STATUS;
typedef VOID *ACPI_EFI_HANDLE;
typedef VOID *ACPI_EFI_EVENT;

typedef struct {
    UINT32  Data1;
    UINT16  Data2;
    UINT16  Data3;
    UINT8   Data4[8];
} ACPI_EFI_GUID;

typedef struct {
    UINT16 Year;       /* 1998 - 20XX */
    UINT8  Month;      /* 1 - 12 */
    UINT8  Day;        /* 1 - 31 */
    UINT8  Hour;       /* 0 - 23 */
    UINT8  Minute;     /* 0 - 59 */
    UINT8  Second;     /* 0 - 59 */
    UINT8  Pad1;
    UINT32 Nanosecond; /* 0 - 999,999,999 */
    INT16  TimeZone;   /* -1440 to 1440 or 2047 */
    UINT8  Daylight;
    UINT8  Pad2;
} ACPI_EFI_TIME;

typedef struct _ACPI_EFI_DEVICE_PATH {
        UINT8                           Type;
        UINT8                           SubType;
        UINT8                           Length[2];
} ACPI_EFI_DEVICE_PATH;

typedef UINT64          ACPI_EFI_PHYSICAL_ADDRESS;
typedef UINT64          ACPI_EFI_VIRTUAL_ADDRESS;

typedef enum {
    AcpiEfiAllocateAnyPages,
    AcpiEfiAllocateMaxAddress,
    AcpiEfiAllocateAddress,
    AcpiEfiMaxAllocateType
} ACPI_EFI_ALLOCATE_TYPE;

typedef enum {
    AcpiEfiReservedMemoryType,
    AcpiEfiLoaderCode,
    AcpiEfiLoaderData,
    AcpiEfiBootServicesCode,
    AcpiEfiBootServicesData,
    AcpiEfiRuntimeServicesCode,
    AcpiEfiRuntimeServicesData,
    AcpiEfiConventionalMemory,
    AcpiEfiUnusableMemory,
    AcpiEfiACPIReclaimMemory,
    AcpiEfiACPIMemoryNVS,
    AcpiEfiMemoryMappedIO,
    AcpiEfiMemoryMappedIOPortSpace,
    AcpiEfiPalCode,
    AcpiEfiMaxMemoryType
} ACPI_EFI_MEMORY_TYPE;

/* possible caching types for the memory range */
#define ACPI_EFI_MEMORY_UC      0x0000000000000001
#define ACPI_EFI_MEMORY_WC      0x0000000000000002
#define ACPI_EFI_MEMORY_WT      0x0000000000000004
#define ACPI_EFI_MEMORY_WB      0x0000000000000008
#define ACPI_EFI_MEMORY_UCE     0x0000000000000010

/* physical memory protection on range */
#define ACPI_EFI_MEMORY_WP      0x0000000000001000
#define ACPI_EFI_MEMORY_RP      0x0000000000002000
#define ACPI_EFI_MEMORY_XP      0x0000000000004000

/* range requires a runtime mapping */
#define ACPI_EFI_MEMORY_RUNTIME 0x8000000000000000

#define ACPI_EFI_MEMORY_DESCRIPTOR_VERSION  1
typedef struct {
    UINT32                          Type;
    UINT32                          Pad;
    ACPI_EFI_PHYSICAL_ADDRESS       PhysicalStart;
    ACPI_EFI_VIRTUAL_ADDRESS        VirtualStart;
    UINT64                          NumberOfPages;
    UINT64                          Attribute;
} ACPI_EFI_MEMORY_DESCRIPTOR;

typedef struct _ACPI_EFI_TABLE_HEARDER {
    UINT64                      Signature;
    UINT32                      Revision;
    UINT32                      HeaderSize;
    UINT32                      CRC32;
    UINT32                      Reserved;
} ACPI_EFI_TABLE_HEADER;

typedef
ACPI_EFI_STATUS
(ACPI_EFI_API *ACPI_EFI_UNKNOWN_INTERFACE) (
    void);


/*
 * Text output protocol
 */
#define ACPI_SIMPLE_TEXT_OUTPUT_PROTOCOL \
    { 0x387477c2, 0x69c7, 0x11d2, {0x8e, 0x39, 0x0, 0xa0, 0xc9, 0x69, 0x72, 0x3b} }

typedef
ACPI_EFI_STATUS
(ACPI_EFI_API *ACPI_EFI_TEXT_RESET) (
    struct _ACPI_SIMPLE_TEXT_OUTPUT_INTERFACE   *This,
    BOOLEAN                                     ExtendedVerification);

typedef
ACPI_EFI_STATUS
(ACPI_EFI_API *ACPI_EFI_TEXT_OUTPUT_STRING) (
    struct _ACPI_SIMPLE_TEXT_OUTPUT_INTERFACE   *This,
    CHAR16                                      *String);

typedef
ACPI_EFI_STATUS
(ACPI_EFI_API *ACPI_EFI_TEXT_TEST_STRING) (
    struct _ACPI_SIMPLE_TEXT_OUTPUT_INTERFACE   *This,
    CHAR16                                      *String);

typedef
ACPI_EFI_STATUS
(ACPI_EFI_API *ACPI_EFI_TEXT_QUERY_MODE) (
    struct _ACPI_SIMPLE_TEXT_OUTPUT_INTERFACE   *This,
    UINTN                                       ModeNumber,
    UINTN                                       *Columns,
    UINTN                                       *Rows);

typedef
ACPI_EFI_STATUS
(ACPI_EFI_API *ACPI_EFI_TEXT_SET_MODE) (
    struct _ACPI_SIMPLE_TEXT_OUTPUT_INTERFACE   *This,
    UINTN                                       ModeNumber);

typedef
ACPI_EFI_STATUS
(ACPI_EFI_API *ACPI_EFI_TEXT_SET_ATTRIBUTE) (
    struct _ACPI_SIMPLE_TEXT_OUTPUT_INTERFACE   *This,
    UINTN                                       Attribute);

typedef
ACPI_EFI_STATUS
(ACPI_EFI_API *ACPI_EFI_TEXT_CLEAR_SCREEN) (
    struct _ACPI_SIMPLE_TEXT_OUTPUT_INTERFACE   *This);

typedef
ACPI_EFI_STATUS
(ACPI_EFI_API *ACPI_EFI_TEXT_SET_CURSOR_POSITION) (
    struct _ACPI_SIMPLE_TEXT_OUTPUT_INTERFACE   *This,
    UINTN                                       Column,
    UINTN                                       Row);

typedef
ACPI_EFI_STATUS
(ACPI_EFI_API *ACPI_EFI_TEXT_ENABLE_CURSOR) (
    struct _ACPI_SIMPLE_TEXT_OUTPUT_INTERFACE   *This,
    BOOLEAN                                     Enable);

typedef struct {
    INT32                           MaxMode;
    INT32                           Mode;
    INT32                           Attribute;
    INT32                           CursorColumn;
    INT32                           CursorRow;
    BOOLEAN                         CursorVisible;
} ACPI_SIMPLE_TEXT_OUTPUT_MODE;

typedef struct _ACPI_SIMPLE_TEXT_OUTPUT_INTERFACE {
    ACPI_EFI_TEXT_RESET                 Reset;

    ACPI_EFI_TEXT_OUTPUT_STRING         OutputString;
    ACPI_EFI_TEXT_TEST_STRING           TestString;

    ACPI_EFI_TEXT_QUERY_MODE            QueryMode;
    ACPI_EFI_TEXT_SET_MODE              SetMode;
    ACPI_EFI_TEXT_SET_ATTRIBUTE         SetAttribute;

    ACPI_EFI_TEXT_CLEAR_SCREEN          ClearScreen;
    ACPI_EFI_TEXT_SET_CURSOR_POSITION   SetCursorPosition;
    ACPI_EFI_TEXT_ENABLE_CURSOR         EnableCursor;

    ACPI_SIMPLE_TEXT_OUTPUT_MODE        *Mode;
} ACPI_SIMPLE_TEXT_OUTPUT_INTERFACE;

/*
 * Text input protocol
 */
#define ACPI_SIMPLE_TEXT_INPUT_PROTOCOL  \
    { 0x387477c1, 0x69c7, 0x11d2, {0x8e, 0x39, 0x0, 0xa0, 0xc9, 0x69, 0x72, 0x3b} }

typedef struct {
    UINT16                              ScanCode;
    CHAR16                              UnicodeChar;
} ACPI_EFI_INPUT_KEY;

/*
 * Baseline unicode control chars
 */
#define CHAR_NULL                       0x0000
#define CHAR_BACKSPACE                  0x0008
#define CHAR_TAB                        0x0009
#define CHAR_LINEFEED                   0x000A
#define CHAR_CARRIAGE_RETURN            0x000D

typedef
ACPI_EFI_STATUS
(ACPI_EFI_API *ACPI_EFI_INPUT_RESET) (
    struct _ACPI_SIMPLE_INPUT_INTERFACE         *This,
    BOOLEAN                                     ExtendedVerification);

typedef
ACPI_EFI_STATUS
(ACPI_EFI_API *ACPI_EFI_INPUT_READ_KEY) (
    struct _ACPI_SIMPLE_INPUT_INTERFACE         *This,
    ACPI_EFI_INPUT_KEY                          *Key);

typedef struct _ACPI_SIMPLE_INPUT_INTERFACE {
    ACPI_EFI_INPUT_RESET                    Reset;
    ACPI_EFI_INPUT_READ_KEY                 ReadKeyStroke;
    ACPI_EFI_EVENT                          WaitForKey;
} ACPI_SIMPLE_INPUT_INTERFACE;


/*
 * Simple file system protocol
 */
#define ACPI_SIMPLE_FILE_SYSTEM_PROTOCOL \
    { 0x964e5b22, 0x6459, 0x11d2, {0x8e, 0x39, 0x0, 0xa0, 0xc9, 0x69, 0x72, 0x3b} }

typedef
ACPI_EFI_STATUS
(ACPI_EFI_API *ACPI_EFI_VOLUME_OPEN) (
    struct _ACPI_EFI_FILE_IO_INTERFACE          *This,
    struct _ACPI_EFI_FILE_HANDLE                **Root);

#define ACPI_EFI_FILE_IO_INTERFACE_REVISION     0x00010000

typedef struct _ACPI_EFI_FILE_IO_INTERFACE {
    UINT64                  Revision;
    ACPI_EFI_VOLUME_OPEN    OpenVolume;
} ACPI_EFI_FILE_IO_INTERFACE;

typedef
ACPI_EFI_STATUS
(ACPI_EFI_API *ACPI_EFI_FILE_OPEN) (
    struct _ACPI_EFI_FILE_HANDLE                *File,
    struct _ACPI_EFI_FILE_HANDLE                **NewHandle,
    CHAR16                                      *FileName,
    UINT64                                      OpenMode,
    UINT64                                      Attributes);

/* Values for OpenMode used above */

#define ACPI_EFI_FILE_MODE_READ     0x0000000000000001
#define ACPI_EFI_FILE_MODE_WRITE    0x0000000000000002
#define ACPI_EFI_FILE_MODE_CREATE   0x8000000000000000

/* Values for Attribute used above */

#define ACPI_EFI_FILE_READ_ONLY     0x0000000000000001
#define ACPI_EFI_FILE_HIDDEN        0x0000000000000002
#define ACPI_EFI_FILE_SYSTEM        0x0000000000000004
#define ACPI_EFI_FILE_RESERVIED     0x0000000000000008
#define ACPI_EFI_FILE_DIRECTORY     0x0000000000000010
#define ACPI_EFI_FILE_ARCHIVE       0x0000000000000020
#define ACPI_EFI_FILE_VALID_ATTR    0x0000000000000037

typedef
ACPI_EFI_STATUS
(ACPI_EFI_API *ACPI_EFI_FILE_CLOSE) (
    struct _ACPI_EFI_FILE_HANDLE                *File);

typedef
ACPI_EFI_STATUS
(ACPI_EFI_API *ACPI_EFI_FILE_DELETE) (
    struct _ACPI_EFI_FILE_HANDLE                *File);

typedef
ACPI_EFI_STATUS
(ACPI_EFI_API *ACPI_EFI_FILE_READ) (
    struct _ACPI_EFI_FILE_HANDLE                *File,
    UINTN                                       *BufferSize,
    VOID                                        *Buffer);

typedef
ACPI_EFI_STATUS
(ACPI_EFI_API *ACPI_EFI_FILE_WRITE) (
    struct _ACPI_EFI_FILE_HANDLE                *File,
    UINTN                                       *BufferSize,
    VOID                                        *Buffer);

typedef
ACPI_EFI_STATUS
(ACPI_EFI_API *ACPI_EFI_FILE_SET_POSITION) (
    struct _ACPI_EFI_FILE_HANDLE                *File,
    UINT64                                      Position);

typedef
ACPI_EFI_STATUS
(ACPI_EFI_API *ACPI_EFI_FILE_GET_POSITION) (
    struct _ACPI_EFI_FILE_HANDLE                *File,
    UINT64                                      *Position);

#define ACPI_EFI_FILE_INFO_ID \
    { 0x9576e92, 0x6d3f, 0x11d2, {0x8e, 0x39, 0x0, 0xa0, 0xc9, 0x69, 0x72, 0x3b} }

typedef struct {
    UINT64 Size;
    UINT64 FileSize;
    UINT64 PhysicalSize;
    ACPI_EFI_TIME CreateTime;
    ACPI_EFI_TIME LastAccessTime;
    ACPI_EFI_TIME ModificationTime;
    UINT64 Attribute;
    CHAR16 FileName[1];
} ACPI_EFI_FILE_INFO;

#define SIZE_OF_ACPI_EFI_FILE_INFO  ACPI_OFFSET(ACPI_EFI_FILE_INFO, FileName)

typedef
ACPI_EFI_STATUS
(ACPI_EFI_API *ACPI_EFI_FILE_GET_INFO) (
    struct _ACPI_EFI_FILE_HANDLE                *File,
    ACPI_EFI_GUID                               *InformationType,
    UINTN                                       *BufferSize,
    VOID                                        *Buffer);

typedef
ACPI_EFI_STATUS
(ACPI_EFI_API *ACPI_EFI_FILE_SET_INFO) (
    struct _ACPI_EFI_FILE_HANDLE                *File,
    ACPI_EFI_GUID                               *InformationType,
    UINTN                                       BufferSize,
    VOID                                        *Buffer);

typedef
ACPI_EFI_STATUS
(ACPI_EFI_API *ACPI_EFI_FILE_FLUSH) (
    struct _ACPI_EFI_FILE_HANDLE                *File);


#define ACPI_EFI_FILE_HANDLE_REVISION           0x00010000

typedef struct _ACPI_EFI_FILE_HANDLE {
    UINT64                      Revision;
    ACPI_EFI_FILE_OPEN          Open;
    ACPI_EFI_FILE_CLOSE         Close;
    ACPI_EFI_FILE_DELETE        Delete;
    ACPI_EFI_FILE_READ          Read;
    ACPI_EFI_FILE_WRITE         Write;
    ACPI_EFI_FILE_GET_POSITION  GetPosition;
    ACPI_EFI_FILE_SET_POSITION  SetPosition;
    ACPI_EFI_FILE_GET_INFO      GetInfo;
    ACPI_EFI_FILE_SET_INFO      SetInfo;
    ACPI_EFI_FILE_FLUSH         Flush;
} ACPI_EFI_FILE_STRUCT, *ACPI_EFI_FILE_HANDLE;


/*
 * Loaded image protocol
 */
#define ACPI_EFI_LOADED_IMAGE_PROTOCOL \
    { 0x5B1B31A1, 0x9562, 0x11d2, {0x8E, 0x3F, 0x00, 0xA0, 0xC9, 0x69, 0x72, 0x3B} }

typedef
ACPI_EFI_STATUS
(ACPI_EFI_API *ACPI_EFI_IMAGE_ENTRY_POINT) (
    ACPI_EFI_HANDLE                         ImageHandle,
    struct _ACPI_EFI_SYSTEM_TABLE           *SystemTable);

typedef
ACPI_EFI_STATUS
(ACPI_EFI_API *ACPI_EFI_IMAGE_LOAD) (
    BOOLEAN                         BootPolicy,
    ACPI_EFI_HANDLE                 ParentImageHandle,
    ACPI_EFI_DEVICE_PATH            *FilePath,
    VOID                            *SourceBuffer,
    UINTN                           SourceSize,
    ACPI_EFI_HANDLE                 *ImageHandle);

typedef
ACPI_EFI_STATUS
(ACPI_EFI_API *ACPI_EFI_IMAGE_START) (
    ACPI_EFI_HANDLE                 ImageHandle,
    UINTN                           *ExitDataSize,
    CHAR16                          **ExitData);

typedef
ACPI_EFI_STATUS
(ACPI_EFI_API *ACPI_EFI_EXIT) (
    ACPI_EFI_HANDLE                 ImageHandle,
    ACPI_EFI_STATUS                 ExitStatus,
    UINTN                           ExitDataSize,
    CHAR16                          *ExitData);

typedef
ACPI_EFI_STATUS
(ACPI_EFI_API *ACPI_EFI_IMAGE_UNLOAD) (
    ACPI_EFI_HANDLE                 ImageHandle);


typedef
ACPI_EFI_STATUS
(ACPI_EFI_API *ACPI_EFI_SET_WATCHDOG_TIMER) (
    UINTN                           Timeout,
    UINT64                          WatchdogCode,
    UINTN                           DataSize,
    CHAR16                          *WatchdogData);


#define EFI_IMAGE_INFORMATION_REVISION      0x1000
typedef struct {
    UINT32                          Revision;
    ACPI_EFI_HANDLE                 ParentHandle;
    struct _ACPI_EFI_SYSTEM_TABLE   *SystemTable;
    ACPI_EFI_HANDLE                 DeviceHandle;
    ACPI_EFI_DEVICE_PATH            *FilePath;
    VOID                            *Reserved;
    UINT32                          LoadOptionsSize;
    VOID                            *LoadOptions;
    VOID                            *ImageBase;
    UINT64                          ImageSize;
    ACPI_EFI_MEMORY_TYPE            ImageCodeType;
    ACPI_EFI_MEMORY_TYPE            ImageDataType;
    ACPI_EFI_IMAGE_UNLOAD           Unload;

} ACPI_EFI_LOADED_IMAGE;


/*
 * EFI Memory
 */
typedef
ACPI_EFI_STATUS
(ACPI_EFI_API *ACPI_EFI_ALLOCATE_PAGES) (
    ACPI_EFI_ALLOCATE_TYPE          Type,
    ACPI_EFI_MEMORY_TYPE            MemoryType,
    UINTN                           NoPages,
    ACPI_EFI_PHYSICAL_ADDRESS       *Memory);

typedef
ACPI_EFI_STATUS
(ACPI_EFI_API *ACPI_EFI_FREE_PAGES) (
    ACPI_EFI_PHYSICAL_ADDRESS       Memory,
    UINTN                           NoPages);

typedef
ACPI_EFI_STATUS
(ACPI_EFI_API *ACPI_EFI_GET_MEMORY_MAP) (
    UINTN                           *MemoryMapSize,
    ACPI_EFI_MEMORY_DESCRIPTOR      *MemoryMap,
    UINTN                           *MapKey,
    UINTN                           *DescriptorSize,
    UINT32                          *DescriptorVersion);

#define NextMemoryDescriptor(Ptr,Size)  ((ACPI_EFI_MEMORY_DESCRIPTOR *) (((UINT8 *) Ptr) + Size))

typedef
ACPI_EFI_STATUS
(ACPI_EFI_API *ACPI_EFI_ALLOCATE_POOL) (
    ACPI_EFI_MEMORY_TYPE            PoolType,
    UINTN                           Size,
    VOID                            **Buffer);

typedef
ACPI_EFI_STATUS
(ACPI_EFI_API *ACPI_EFI_FREE_POOL) (
    VOID                            *Buffer);


/*
 * Protocol handler functions
 */
typedef enum {
    ACPI_EFI_NATIVE_INTERFACE,
    ACPI_EFI_PCODE_INTERFACE
} ACPI_EFI_INTERFACE_TYPE;

typedef enum {
    AcpiEfiAllHandles,
    AcpiEfiByRegisterNotify,
    AcpiEfiByProtocol
} ACPI_EFI_LOCATE_SEARCH_TYPE;

typedef
ACPI_EFI_STATUS
(ACPI_EFI_API *ACPI_EFI_INSTALL_PROTOCOL_INTERFACE) (
    ACPI_EFI_HANDLE                 *Handle,
    ACPI_EFI_GUID                   *Protocol,
    ACPI_EFI_INTERFACE_TYPE         InterfaceType,
    VOID                            *Interface);

typedef
ACPI_EFI_STATUS
(ACPI_EFI_API *ACPI_EFI_REINSTALL_PROTOCOL_INTERFACE) (
    ACPI_EFI_HANDLE                 Handle,
    ACPI_EFI_GUID                   *Protocol,
    VOID                            *OldInterface,
    VOID                            *NewInterface);

typedef
ACPI_EFI_STATUS
(ACPI_EFI_API *ACPI_EFI_UNINSTALL_PROTOCOL_INTERFACE) (
    ACPI_EFI_HANDLE                 Handle,
    ACPI_EFI_GUID                   *Protocol,
    VOID                            *Interface);

typedef
ACPI_EFI_STATUS
(ACPI_EFI_API *ACPI_EFI_HANDLE_PROTOCOL) (
    ACPI_EFI_HANDLE                 Handle,
    ACPI_EFI_GUID                   *Protocol,
    VOID                            **Interface);

typedef
ACPI_EFI_STATUS
(ACPI_EFI_API *ACPI_EFI_REGISTER_PROTOCOL_NOTIFY) (
    ACPI_EFI_GUID                   *Protocol,
    ACPI_EFI_EVENT                  Event,
    VOID                            **Registration);

typedef
ACPI_EFI_STATUS
(ACPI_EFI_API *ACPI_EFI_LOCATE_HANDLE) (
    ACPI_EFI_LOCATE_SEARCH_TYPE     SearchType,
    ACPI_EFI_GUID                   *Protocol,
    VOID                            *SearchKey,
    UINTN                           *BufferSize,
    ACPI_EFI_HANDLE                 *Buffer);

typedef
ACPI_EFI_STATUS
(ACPI_EFI_API *ACPI_EFI_LOCATE_DEVICE_PATH) (
    ACPI_EFI_GUID                   *Protocol,
    ACPI_EFI_DEVICE_PATH            **DevicePath,
    ACPI_EFI_HANDLE                 *Device);

typedef
ACPI_EFI_STATUS
(ACPI_EFI_API *ACPI_EFI_INSTALL_CONFIGURATION_TABLE) (
    ACPI_EFI_GUID                   *Guid,
    VOID                            *Table);

#define ACPI_EFI_OPEN_PROTOCOL_BY_HANDLE_PROTOCOL  0x00000001
#define ACPI_EFI_OPEN_PROTOCOL_GET_PROTOCOL        0x00000002
#define ACPI_EFI_OPEN_PROTOCOL_TEST_PROTOCOL       0x00000004
#define ACPI_EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER 0x00000008
#define ACPI_EFI_OPEN_PROTOCOL_BY_DRIVER           0x00000010
#define ACPI_EFI_OPEN_PROTOCOL_EXCLUSIVE           0x00000020

typedef
ACPI_EFI_STATUS
(ACPI_EFI_API *ACPI_EFI_OPEN_PROTOCOL) (
    ACPI_EFI_HANDLE                 Handle,
    ACPI_EFI_GUID                   *Protocol,
    VOID                            **Interface,
    ACPI_EFI_HANDLE                 AgentHandle,
    ACPI_EFI_HANDLE                 ControllerHandle,
    UINT32                          Attributes);

typedef
ACPI_EFI_STATUS
(ACPI_EFI_API *ACPI_EFI_CLOSE_PROTOCOL) (
    ACPI_EFI_HANDLE                 Handle,
    ACPI_EFI_GUID                   *Protocol,
    ACPI_EFI_HANDLE                 AgentHandle,
    ACPI_EFI_HANDLE                 ControllerHandle);

typedef struct {
    ACPI_EFI_HANDLE                 AgentHandle;
    ACPI_EFI_HANDLE                 ControllerHandle;
    UINT32                          Attributes;
    UINT32                          OpenCount;
} ACPI_EFI_OPEN_PROTOCOL_INFORMATION_ENTRY;

typedef
ACPI_EFI_STATUS
(ACPI_EFI_API *ACPI_EFI_OPEN_PROTOCOL_INFORMATION) (
    ACPI_EFI_HANDLE                 Handle,
    ACPI_EFI_GUID                   *Protocol,
    ACPI_EFI_OPEN_PROTOCOL_INFORMATION_ENTRY **EntryBuffer,
    UINTN                           *EntryCount);

typedef
ACPI_EFI_STATUS
(ACPI_EFI_API *ACPI_EFI_PROTOCOLS_PER_HANDLE) (
    ACPI_EFI_HANDLE                 Handle,
    ACPI_EFI_GUID                   ***ProtocolBuffer,
    UINTN                           *ProtocolBufferCount);

typedef
ACPI_EFI_STATUS
(ACPI_EFI_API *ACPI_EFI_LOCATE_HANDLE_BUFFER) (
    ACPI_EFI_LOCATE_SEARCH_TYPE     SearchType,
    ACPI_EFI_GUID                   *Protocol,
    VOID                            *SearchKey,
    UINTN                           *NoHandles,
    ACPI_EFI_HANDLE                 **Buffer);

typedef
ACPI_EFI_STATUS
(ACPI_EFI_API *ACPI_EFI_LOCATE_PROTOCOL) (
    ACPI_EFI_GUID                   *Protocol,
    VOID                            *Registration,
    VOID                            **Interface);

typedef
ACPI_EFI_STATUS
(ACPI_EFI_API *ACPI_EFI_INSTALL_MULTIPLE_PROTOCOL_INTERFACES) (
    ACPI_EFI_HANDLE                 *Handle,
    ...);

typedef
ACPI_EFI_STATUS
(ACPI_EFI_API *ACPI_EFI_UNINSTALL_MULTIPLE_PROTOCOL_INTERFACES) (
    ACPI_EFI_HANDLE                 Handle,
    ...);

typedef
ACPI_EFI_STATUS
(ACPI_EFI_API *ACPI_EFI_CALCULATE_CRC32) (
    VOID                            *Data,
    UINTN                           DataSize,
    UINT32                          *Crc32);

typedef
VOID
(ACPI_EFI_API *ACPI_EFI_COPY_MEM) (
    VOID                            *Destination,
    VOID                            *Source,
    UINTN                           Length);

typedef
VOID
(ACPI_EFI_API *ACPI_EFI_SET_MEM) (
    VOID                            *Buffer,
    UINTN                           Size,
    UINT8                           Value);

/*
 * EFI Boot Services Table
 */
#define ACPI_EFI_BOOT_SERVICES_SIGNATURE 0x56524553544f4f42
#define ACPI_EFI_BOOT_SERVICES_REVISION  (ACPI_EFI_SPECIFICATION_MAJOR_REVISION<<16) | (ACPI_EFI_SPECIFICATION_MINOR_REVISION)

typedef struct _ACPI_EFI_BOOT_SERVICES {
    ACPI_EFI_TABLE_HEADER               Hdr;

#if 0
    ACPI_EFI_RAISE_TPL                  RaiseTPL;
    ACPI_EFI_RESTORE_TPL                RestoreTPL;
#else
    ACPI_EFI_UNKNOWN_INTERFACE          RaiseTPL;
    ACPI_EFI_UNKNOWN_INTERFACE          RestoreTPL;
#endif

    ACPI_EFI_ALLOCATE_PAGES             AllocatePages;
    ACPI_EFI_FREE_PAGES                 FreePages;
    ACPI_EFI_GET_MEMORY_MAP             GetMemoryMap;
    ACPI_EFI_ALLOCATE_POOL              AllocatePool;
    ACPI_EFI_FREE_POOL                  FreePool;

#if 0
    ACPI_EFI_CREATE_EVENT               CreateEvent;
    ACPI_EFI_SET_TIMER                  SetTimer;
    ACPI_EFI_WAIT_FOR_EVENT             WaitForEvent;
    ACPI_EFI_SIGNAL_EVENT               SignalEvent;
    ACPI_EFI_CLOSE_EVENT                CloseEvent;
    ACPI_EFI_CHECK_EVENT                CheckEvent;
#else
    ACPI_EFI_UNKNOWN_INTERFACE          CreateEvent;
    ACPI_EFI_UNKNOWN_INTERFACE          SetTimer;
    ACPI_EFI_UNKNOWN_INTERFACE          WaitForEvent;
    ACPI_EFI_UNKNOWN_INTERFACE          SignalEvent;
    ACPI_EFI_UNKNOWN_INTERFACE          CloseEvent;
    ACPI_EFI_UNKNOWN_INTERFACE          CheckEvent;
#endif

    ACPI_EFI_INSTALL_PROTOCOL_INTERFACE InstallProtocolInterface;
    ACPI_EFI_REINSTALL_PROTOCOL_INTERFACE ReinstallProtocolInterface;
    ACPI_EFI_UNINSTALL_PROTOCOL_INTERFACE UninstallProtocolInterface;
    ACPI_EFI_HANDLE_PROTOCOL            HandleProtocol;
    ACPI_EFI_HANDLE_PROTOCOL            PCHandleProtocol;
    ACPI_EFI_REGISTER_PROTOCOL_NOTIFY   RegisterProtocolNotify;
    ACPI_EFI_LOCATE_HANDLE              LocateHandle;
    ACPI_EFI_LOCATE_DEVICE_PATH         LocateDevicePath;
    ACPI_EFI_INSTALL_CONFIGURATION_TABLE InstallConfigurationTable;

    ACPI_EFI_IMAGE_LOAD                 LoadImage;
    ACPI_EFI_IMAGE_START                StartImage;
    ACPI_EFI_EXIT                       Exit;
    ACPI_EFI_IMAGE_UNLOAD               UnloadImage;

#if 0
    ACPI_EFI_EXIT_BOOT_SERVICES         ExitBootServices;
    ACPI_EFI_GET_NEXT_MONOTONIC_COUNT   GetNextMonotonicCount;
    ACPI_EFI_STALL                      Stall;
#else
    ACPI_EFI_UNKNOWN_INTERFACE          ExitBootServices;
    ACPI_EFI_UNKNOWN_INTERFACE          GetNextMonotonicCount;
    ACPI_EFI_UNKNOWN_INTERFACE          Stall;
#endif
    ACPI_EFI_SET_WATCHDOG_TIMER         SetWatchdogTimer;

#if 0
    ACPI_EFI_CONNECT_CONTROLLER         ConnectController;
    ACPI_EFI_DISCONNECT_CONTROLLER      DisconnectController;
#else
    ACPI_EFI_UNKNOWN_INTERFACE          ConnectController;
    ACPI_EFI_UNKNOWN_INTERFACE          DisconnectController;
#endif

    ACPI_EFI_OPEN_PROTOCOL              OpenProtocol;
    ACPI_EFI_CLOSE_PROTOCOL             CloseProtocol;
    ACPI_EFI_OPEN_PROTOCOL_INFORMATION  OpenProtocolInformation;
    ACPI_EFI_PROTOCOLS_PER_HANDLE       ProtocolsPerHandle;
    ACPI_EFI_LOCATE_HANDLE_BUFFER       LocateHandleBuffer;
    ACPI_EFI_LOCATE_PROTOCOL            LocateProtocol;
    ACPI_EFI_INSTALL_MULTIPLE_PROTOCOL_INTERFACES InstallMultipleProtocolInterfaces;
    ACPI_EFI_UNINSTALL_MULTIPLE_PROTOCOL_INTERFACES UninstallMultipleProtocolInterfaces;

    ACPI_EFI_CALCULATE_CRC32        CalculateCrc32;

    ACPI_EFI_COPY_MEM               CopyMem;
    ACPI_EFI_SET_MEM                SetMem;

#if 0
    ACPI_EFI_CREATE_EVENT_EX        CreateEventEx;
#else
    ACPI_EFI_UNKNOWN_INTERFACE      CreateEventEx;
#endif
} ACPI_EFI_BOOT_SERVICES;


/*
 * EFI System Table
 */

/*
 * EFI Configuration Table and GUID definitions
 */
#define ACPI_TABLE_GUID \
    { 0xeb9d2d30, 0x2d88, 0x11d3, {0x9a, 0x16, 0x0, 0x90, 0x27, 0x3f, 0xc1, 0x4d} }
#define ACPI_20_TABLE_GUID \
    { 0x8868e871, 0xe4f1, 0x11d3, {0xbc, 0x22, 0x0, 0x80, 0xc7, 0x3c, 0x88, 0x81} }

typedef struct _ACPI_EFI_CONFIGURATION_TABLE {
    ACPI_EFI_GUID           VendorGuid;
    VOID                    *VendorTable;
} ACPI_EFI_CONFIGURATION_TABLE;


#define ACPI_EFI_SYSTEM_TABLE_SIGNATURE 0x5453595320494249
#define ACPI_EFI_SYSTEM_TABLE_REVISION  (ACPI_EFI_SPECIFICATION_MAJOR_REVISION<<16) | (ACPI_EFI_SPECIFICATION_MINOR_REVISION)

typedef struct _ACPI_EFI_SYSTEM_TABLE {
    ACPI_EFI_TABLE_HEADER               Hdr;

    CHAR16                              *FirmwareVendor;
    UINT32                              FirmwareRevision;

    ACPI_EFI_HANDLE                     ConsoleInHandle;
    ACPI_SIMPLE_INPUT_INTERFACE         *ConIn;

    ACPI_EFI_HANDLE                     ConsoleOutHandle;
    ACPI_SIMPLE_TEXT_OUTPUT_INTERFACE   *ConOut;

    ACPI_EFI_HANDLE                     StandardErrorHandle;
    ACPI_SIMPLE_TEXT_OUTPUT_INTERFACE   *StdErr;

#if 0
    ACPI_EFI_RUNTIME_SERVICES           *RuntimeServices;
#else
    ACPI_EFI_HANDLE                     *RuntimeServices;
#endif
    ACPI_EFI_BOOT_SERVICES              *BootServices;

    UINTN                               NumberOfTableEntries;
    ACPI_EFI_CONFIGURATION_TABLE        *ConfigurationTable;

} ACPI_EFI_SYSTEM_TABLE;


/*
 * EFI PCI I/O Protocol
 */
#define ACPI_EFI_PCI_IO_PROTOCOL \
    { 0x4cf5b200, 0x68b8, 0x4ca5, {0x9e, 0xec, 0xb2, 0x3e, 0x3f, 0x50, 0x2, 0x9a} }

typedef enum {
    AcpiEfiPciIoWidthUint8 = 0,
    AcpiEfiPciIoWidthUint16,
    AcpiEfiPciIoWidthUint32,
    AcpiEfiPciIoWidthUint64,
    AcpiEfiPciIoWidthFifoUint8,
    AcpiEfiPciIoWidthFifoUint16,
    AcpiEfiPciIoWidthFifoUint32,
    AcpiEfiPciIoWidthFifoUint64,
    AcpiEfiPciIoWidthFillUint8,
    AcpiEfiPciIoWidthFillUint16,
    AcpiEfiPciIoWidthFillUint32,
    AcpiEfiPciIoWidthFillUint64,
    AcpiEfiPciIoWidthMaximum
} ACPI_EFI_PCI_IO_PROTOCOL_WIDTH;

typedef
ACPI_EFI_STATUS
(ACPI_EFI_API *ACPI_EFI_PCI_IO_PROTOCOL_CONFIG)(
    struct _ACPI_EFI_PCI_IO             *This,
    ACPI_EFI_PCI_IO_PROTOCOL_WIDTH      Width,
    UINT32                              Offset,
    UINTN                               Count,
    VOID                                *Buffer);

typedef struct {
    ACPI_EFI_PCI_IO_PROTOCOL_CONFIG     Read;
    ACPI_EFI_PCI_IO_PROTOCOL_CONFIG     Write;
} ACPI_EFI_PCI_IO_PROTOCOL_CONFIG_ACCESS;

typedef
ACPI_EFI_STATUS
(ACPI_EFI_API *ACPI_EFI_PCI_IO_PROTOCOL_GET_LOCATION)(
    struct _ACPI_EFI_PCI_IO             *This,
    UINTN                               *SegmentNumber,
    UINTN                               *BusNumber,
    UINTN                               *DeviceNumber,
    UINTN                               *FunctionNumber);

typedef struct _ACPI_EFI_PCI_IO {
    ACPI_EFI_UNKNOWN_INTERFACE          PollMem;
    ACPI_EFI_UNKNOWN_INTERFACE          PollIo;
    ACPI_EFI_UNKNOWN_INTERFACE          Mem;
    ACPI_EFI_UNKNOWN_INTERFACE          Io;
    ACPI_EFI_PCI_IO_PROTOCOL_CONFIG_ACCESS Pci;
    ACPI_EFI_UNKNOWN_INTERFACE          CopyMem;
    ACPI_EFI_UNKNOWN_INTERFACE          Map;
    ACPI_EFI_UNKNOWN_INTERFACE          Unmap;
    ACPI_EFI_UNKNOWN_INTERFACE          AllocateBuffer;
    ACPI_EFI_UNKNOWN_INTERFACE          FreeBuffer;
    ACPI_EFI_UNKNOWN_INTERFACE          Flush;
    ACPI_EFI_PCI_IO_PROTOCOL_GET_LOCATION GetLocation;
    ACPI_EFI_UNKNOWN_INTERFACE          Attributes;
    ACPI_EFI_UNKNOWN_INTERFACE          GetBarAttributes;
    ACPI_EFI_UNKNOWN_INTERFACE          SetBarAttributes;
    UINT64                              RomSize;
    VOID                                *RomImage;
} ACPI_EFI_PCI_IO;

/* FILE abstraction */

union acpi_efi_file {
    struct _ACPI_EFI_FILE_HANDLE File;
    struct _ACPI_SIMPLE_TEXT_OUTPUT_INTERFACE ConOut;
    struct _ACPI_SIMPLE_INPUT_INTERFACE ConIn;
};


/* GNU EFI definitions */

#if defined(_GNU_EFI)

/*
 * This is needed to hide platform specific code from ACPICA
 */
UINT64
DivU64x32 (
    UINT64                  Dividend,
    UINTN                   Divisor,
    UINTN                   *Remainder);

/*
 * EFI specific prototypes
 */
ACPI_EFI_STATUS
efi_main (
    ACPI_EFI_HANDLE         Image,
    ACPI_EFI_SYSTEM_TABLE   *SystemTab);

int
acpi_main (
    int                     argc,
    char                    *argv[]);


#endif

extern ACPI_EFI_GUID AcpiGbl_LoadedImageProtocol;
extern ACPI_EFI_GUID AcpiGbl_TextInProtocol;
extern ACPI_EFI_GUID AcpiGbl_TextOutProtocol;
extern ACPI_EFI_GUID AcpiGbl_FileSystemProtocol;
extern ACPI_EFI_GUID AcpiGbl_GenericFileInfo;

#endif /* __ACEFIEX_H__ */