efiapi.h revision 292343
1/* $FreeBSD: stable/10/sys/boot/efi/include/efiapi.h 292343 2015-12-16 16:48:59Z emaste $ */
2#ifndef _EFI_API_H
3#define _EFI_API_H
4
5/*++
6
7Copyright (c)  1999 - 2002 Intel Corporation. All rights reserved
8This software and associated documentation (if any) is furnished
9under a license and may only be used or copied in accordance
10with the terms of the license. Except as permitted by such
11license, no part of this software or documentation may be
12reproduced, stored in a retrieval system, or transmitted in any
13form or by any means without the express written consent of
14Intel Corporation.
15
16Module Name:
17
18    efiapi.h
19
20Abstract:
21
22    Global EFI runtime & boot service interfaces
23
24
25
26
27Revision History
28
29--*/
30
31//
32// EFI Specification Revision
33//
34
35#define EFI_SPECIFICATION_MAJOR_REVISION 1
36#define EFI_SPECIFICATION_MINOR_REVISION 10
37
38//
39// Declare forward referenced data structures
40//
41
42INTERFACE_DECL(_EFI_SYSTEM_TABLE);
43
44//
45// EFI Memory
46//
47
48typedef
49EFI_STATUS
50(EFIAPI *EFI_ALLOCATE_PAGES) (
51    IN EFI_ALLOCATE_TYPE            Type,
52    IN EFI_MEMORY_TYPE              MemoryType,
53    IN UINTN                        NoPages,
54    OUT EFI_PHYSICAL_ADDRESS        *Memory
55    );
56
57typedef
58EFI_STATUS
59(EFIAPI *EFI_FREE_PAGES) (
60    IN EFI_PHYSICAL_ADDRESS         Memory,
61    IN UINTN                        NoPages
62    );
63
64typedef
65EFI_STATUS
66(EFIAPI *EFI_GET_MEMORY_MAP) (
67    IN OUT UINTN                    *MemoryMapSize,
68    IN OUT EFI_MEMORY_DESCRIPTOR    *MemoryMap,
69    OUT UINTN                       *MapKey,
70    OUT UINTN                       *DescriptorSize,
71    OUT UINT32                      *DescriptorVersion
72    );
73
74#define NextMemoryDescriptor(Ptr,Size)  ((EFI_MEMORY_DESCRIPTOR *) (((UINT8 *) Ptr) + Size))
75
76
77typedef
78EFI_STATUS
79(EFIAPI *EFI_ALLOCATE_POOL) (
80    IN EFI_MEMORY_TYPE              PoolType,
81    IN UINTN                        Size,
82    OUT VOID                        **Buffer
83    );
84
85typedef
86EFI_STATUS
87(EFIAPI *EFI_FREE_POOL) (
88    IN VOID                         *Buffer
89    );
90
91typedef
92EFI_STATUS
93(EFIAPI *EFI_SET_VIRTUAL_ADDRESS_MAP) (
94    IN UINTN                        MemoryMapSize,
95    IN UINTN                        DescriptorSize,
96    IN UINT32                       DescriptorVersion,
97    IN EFI_MEMORY_DESCRIPTOR        *VirtualMap
98    );
99
100
101#define EFI_OPTIONAL_PTR            0x00000001
102#define EFI_INTERNAL_FNC            0x00000002      // Pointer to internal runtime fnc
103#define EFI_INTERNAL_PTR            0x00000004      // Pointer to internal runtime data
104
105
106typedef
107EFI_STATUS
108(EFIAPI *EFI_CONVERT_POINTER) (
109    IN UINTN                        DebugDisposition,
110    IN OUT VOID                     **Address
111    );
112
113
114//
115// EFI Events
116//
117
118
119
120#define EVT_TIMER                           0x80000000
121#define EVT_RUNTIME                         0x40000000
122#define EVT_RUNTIME_CONTEXT                 0x20000000
123
124#define EVT_NOTIFY_WAIT                     0x00000100
125#define EVT_NOTIFY_SIGNAL                   0x00000200
126
127#define EVT_SIGNAL_EXIT_BOOT_SERVICES       0x00000201
128#define EVT_SIGNAL_VIRTUAL_ADDRESS_CHANGE   0x60000202
129
130#define EVT_EFI_SIGNAL_MASK                 0x000000FF
131#define EVT_EFI_SIGNAL_MAX                  2
132
133typedef
134VOID
135(EFIAPI *EFI_EVENT_NOTIFY) (
136    IN EFI_EVENT                Event,
137    IN VOID                     *Context
138    );
139
140typedef
141EFI_STATUS
142(EFIAPI *EFI_CREATE_EVENT) (
143    IN UINT32                       Type,
144    IN EFI_TPL                      NotifyTpl,
145    IN EFI_EVENT_NOTIFY             NotifyFunction,
146    IN VOID                         *NotifyContext,
147    OUT EFI_EVENT                   *Event
148    );
149
150typedef enum {
151    TimerCancel,
152    TimerPeriodic,
153    TimerRelative,
154    TimerTypeMax
155} EFI_TIMER_DELAY;
156
157typedef
158EFI_STATUS
159(EFIAPI *EFI_SET_TIMER) (
160    IN EFI_EVENT                Event,
161    IN EFI_TIMER_DELAY          Type,
162    IN UINT64                   TriggerTime
163    );
164
165typedef
166EFI_STATUS
167(EFIAPI *EFI_SIGNAL_EVENT) (
168    IN EFI_EVENT                Event
169    );
170
171typedef
172EFI_STATUS
173(EFIAPI *EFI_WAIT_FOR_EVENT) (
174    IN UINTN                    NumberOfEvents,
175    IN EFI_EVENT                *Event,
176    OUT UINTN                   *Index
177    );
178
179typedef
180EFI_STATUS
181(EFIAPI *EFI_CLOSE_EVENT) (
182    IN EFI_EVENT                Event
183    );
184
185typedef
186EFI_STATUS
187(EFIAPI *EFI_CHECK_EVENT) (
188    IN EFI_EVENT                Event
189    );
190
191//
192// Task priority level
193//
194
195#define TPL_APPLICATION    4
196#define TPL_CALLBACK       8
197#define TPL_NOTIFY        16
198#define TPL_HIGH_LEVEL    31
199
200typedef
201EFI_TPL
202(EFIAPI *EFI_RAISE_TPL) (
203    IN EFI_TPL      NewTpl
204    );
205
206typedef
207VOID
208(EFIAPI *EFI_RESTORE_TPL) (
209    IN EFI_TPL      OldTpl
210    );
211
212
213//
214// EFI platform varibles
215//
216
217#define EFI_GLOBAL_VARIABLE     \
218    { 0x8BE4DF61, 0x93CA, 0x11d2, 0xAA, 0x0D, 0x00, 0xE0, 0x98, 0x03, 0x2B, 0x8C }
219
220// Variable attributes
221#define EFI_VARIABLE_NON_VOLATILE           0x00000001
222#define EFI_VARIABLE_BOOTSERVICE_ACCESS     0x00000002
223#define EFI_VARIABLE_RUNTIME_ACCESS         0x00000004
224
225// Variable size limitation
226#define EFI_MAXIMUM_VARIABLE_SIZE           1024
227
228typedef
229EFI_STATUS
230(EFIAPI *EFI_GET_VARIABLE) (
231    IN CHAR16                       *VariableName,
232    IN EFI_GUID                     *VendorGuid,
233    OUT UINT32                      *Attributes OPTIONAL,
234    IN OUT UINTN                    *DataSize,
235    OUT VOID                        *Data
236    );
237
238typedef
239EFI_STATUS
240(EFIAPI *EFI_GET_NEXT_VARIABLE_NAME) (
241    IN OUT UINTN                    *VariableNameSize,
242    IN OUT CHAR16                   *VariableName,
243    IN OUT EFI_GUID                 *VendorGuid
244    );
245
246
247typedef
248EFI_STATUS
249(EFIAPI *EFI_SET_VARIABLE) (
250    IN CHAR16                       *VariableName,
251    IN EFI_GUID                     *VendorGuid,
252    IN UINT32                       Attributes,
253    IN UINTN                        DataSize,
254    IN VOID                         *Data
255    );
256
257
258//
259// EFI Time
260//
261
262typedef struct {
263        UINT32                      Resolution;     // 1e-6 parts per million
264        UINT32                      Accuracy;       // hertz
265        BOOLEAN                     SetsToZero;     // Set clears sub-second time
266} EFI_TIME_CAPABILITIES;
267
268
269typedef
270EFI_STATUS
271(EFIAPI *EFI_GET_TIME) (
272    OUT EFI_TIME                    *Time,
273    OUT EFI_TIME_CAPABILITIES       *Capabilities OPTIONAL
274    );
275
276typedef
277EFI_STATUS
278(EFIAPI *EFI_SET_TIME) (
279    IN EFI_TIME                     *Time
280    );
281
282typedef
283EFI_STATUS
284(EFIAPI *EFI_GET_WAKEUP_TIME) (
285    OUT BOOLEAN                     *Enabled,
286    OUT BOOLEAN                     *Pending,
287    OUT EFI_TIME                    *Time
288    );
289
290typedef
291EFI_STATUS
292(EFIAPI *EFI_SET_WAKEUP_TIME) (
293    IN BOOLEAN                      Enable,
294    IN EFI_TIME                     *Time OPTIONAL
295    );
296
297
298//
299// Image functions
300//
301
302
303// PE32+ Subsystem type for EFI images
304
305#if !defined(IMAGE_SUBSYSTEM_EFI_APPLICATION)
306#define IMAGE_SUBSYSTEM_EFI_APPLICATION             10
307#define IMAGE_SUBSYSTEM_EFI_BOOT_SERVICE_DRIVER     11
308#define IMAGE_SUBSYSTEM_EFI_RUNTIME_DRIVER          12
309#endif
310
311// PE32+ Machine type for EFI images
312
313#if !defined(EFI_IMAGE_MACHINE_IA32)
314#define EFI_IMAGE_MACHINE_IA32      0x014c
315#endif
316
317#if !defined(EFI_IMAGE_MACHINE_IA64)
318#define EFI_IMAGE_MACHINE_IA64      0x0200
319#endif
320
321#if !defined(EFI_IMAGE_MACHINE_EBC)
322#define EFI_IMAGE_MACHINE_EBC       0x0EBC
323#endif
324
325// Image Entry prototype
326
327typedef
328EFI_STATUS
329(EFIAPI *EFI_IMAGE_ENTRY_POINT) (
330    IN EFI_HANDLE                   ImageHandle,
331    IN struct _EFI_SYSTEM_TABLE     *SystemTable
332    );
333
334typedef
335EFI_STATUS
336(EFIAPI *EFI_IMAGE_LOAD) (
337    IN BOOLEAN                      BootPolicy,
338    IN EFI_HANDLE                   ParentImageHandle,
339    IN EFI_DEVICE_PATH              *FilePath,
340    IN VOID                         *SourceBuffer   OPTIONAL,
341    IN UINTN                        SourceSize,
342    OUT EFI_HANDLE                  *ImageHandle
343    );
344
345typedef
346EFI_STATUS
347(EFIAPI *EFI_IMAGE_START) (
348    IN EFI_HANDLE                   ImageHandle,
349    OUT UINTN                       *ExitDataSize,
350    OUT CHAR16                      **ExitData  OPTIONAL
351    );
352
353typedef
354EFI_STATUS
355(EFIAPI *EFI_EXIT) (
356    IN EFI_HANDLE                   ImageHandle,
357    IN EFI_STATUS                   ExitStatus,
358    IN UINTN                        ExitDataSize,
359    IN CHAR16                       *ExitData OPTIONAL
360    );
361
362typedef
363EFI_STATUS
364(EFIAPI *EFI_IMAGE_UNLOAD) (
365    IN EFI_HANDLE                   ImageHandle
366    );
367
368
369// Image handle
370#define LOADED_IMAGE_PROTOCOL      \
371    { 0x5B1B31A1, 0x9562, 0x11d2, 0x8E, 0x3F, 0x00, 0xA0, 0xC9, 0x69, 0x72, 0x3B }
372
373#define EFI_LOADED_IMAGE_INFORMATION_REVISION      0x1000
374typedef struct {
375    UINT32                          Revision;
376    EFI_HANDLE                      ParentHandle;
377    struct _EFI_SYSTEM_TABLE        *SystemTable;
378
379    // Source location of image
380    EFI_HANDLE                      DeviceHandle;
381    EFI_DEVICE_PATH                 *FilePath;
382    VOID                            *Reserved;
383
384    // Images load options
385    UINT32                          LoadOptionsSize;
386    VOID                            *LoadOptions;
387
388    // Location of where image was loaded
389    VOID                            *ImageBase;
390    UINT64                          ImageSize;
391    EFI_MEMORY_TYPE                 ImageCodeType;
392    EFI_MEMORY_TYPE                 ImageDataType;
393
394    // If the driver image supports a dynamic unload request
395    EFI_IMAGE_UNLOAD                Unload;
396
397} EFI_LOADED_IMAGE;
398
399
400typedef
401EFI_STATUS
402(EFIAPI *EFI_EXIT_BOOT_SERVICES) (
403    IN EFI_HANDLE                   ImageHandle,
404    IN UINTN                        MapKey
405    );
406
407//
408// Misc
409//
410
411
412typedef
413EFI_STATUS
414(EFIAPI *EFI_STALL) (
415    IN UINTN                    Microseconds
416    );
417
418typedef
419EFI_STATUS
420(EFIAPI *EFI_SET_WATCHDOG_TIMER) (
421    IN UINTN                    Timeout,
422    IN UINT64                   WatchdogCode,
423    IN UINTN                    DataSize,
424    IN CHAR16                   *WatchdogData OPTIONAL
425    );
426
427
428typedef enum {
429    EfiResetCold,
430    EfiResetWarm,
431    EfiResetShutdown
432} EFI_RESET_TYPE;
433
434typedef
435VOID
436(EFIAPI *EFI_RESET_SYSTEM) (
437    IN EFI_RESET_TYPE           ResetType,
438    IN EFI_STATUS               ResetStatus,
439    IN UINTN                    DataSize,
440    IN CHAR16                   *ResetData OPTIONAL
441    );
442
443typedef
444EFI_STATUS
445(EFIAPI *EFI_GET_NEXT_MONOTONIC_COUNT) (
446    OUT UINT64                  *Count
447    );
448
449typedef
450EFI_STATUS
451(EFIAPI *EFI_GET_NEXT_HIGH_MONO_COUNT) (
452    OUT UINT32                  *HighCount
453    );
454
455//
456// Protocol handler functions
457//
458
459typedef enum {
460    EFI_NATIVE_INTERFACE
461} EFI_INTERFACE_TYPE;
462
463typedef
464EFI_STATUS
465(EFIAPI *EFI_INSTALL_PROTOCOL_INTERFACE) (
466    IN OUT EFI_HANDLE           *Handle,
467    IN EFI_GUID                 *Protocol,
468    IN EFI_INTERFACE_TYPE       InterfaceType,
469    IN VOID                     *Interface
470    );
471
472typedef
473EFI_STATUS
474(EFIAPI *EFI_REINSTALL_PROTOCOL_INTERFACE) (
475    IN EFI_HANDLE               Handle,
476    IN EFI_GUID                 *Protocol,
477    IN VOID                     *OldInterface,
478    IN VOID                     *NewInterface
479    );
480
481typedef
482EFI_STATUS
483(EFIAPI *EFI_UNINSTALL_PROTOCOL_INTERFACE) (
484    IN EFI_HANDLE               Handle,
485    IN EFI_GUID                 *Protocol,
486    IN VOID                     *Interface
487    );
488
489typedef
490EFI_STATUS
491(EFIAPI *EFI_HANDLE_PROTOCOL) (
492    IN EFI_HANDLE               Handle,
493    IN EFI_GUID                 *Protocol,
494    OUT VOID                    **Interface
495    );
496
497typedef
498EFI_STATUS
499(EFIAPI *EFI_REGISTER_PROTOCOL_NOTIFY) (
500    IN EFI_GUID                 *Protocol,
501    IN EFI_EVENT                Event,
502    OUT VOID                    **Registration
503    );
504
505typedef enum {
506    AllHandles,
507    ByRegisterNotify,
508    ByProtocol
509} EFI_LOCATE_SEARCH_TYPE;
510
511typedef
512EFI_STATUS
513(EFIAPI *EFI_LOCATE_HANDLE) (
514    IN EFI_LOCATE_SEARCH_TYPE   SearchType,
515    IN EFI_GUID                 *Protocol OPTIONAL,
516    IN VOID                     *SearchKey OPTIONAL,
517    IN OUT UINTN                *BufferSize,
518    OUT EFI_HANDLE              *Buffer
519    );
520
521typedef
522EFI_STATUS
523(EFIAPI *EFI_LOCATE_DEVICE_PATH) (
524    IN EFI_GUID                 *Protocol,
525    IN OUT EFI_DEVICE_PATH      **DevicePath,
526    OUT EFI_HANDLE              *Device
527    );
528
529typedef
530EFI_STATUS
531(EFIAPI *EFI_INSTALL_CONFIGURATION_TABLE) (
532    IN EFI_GUID                 *Guid,
533    IN VOID                     *Table
534    );
535
536typedef
537EFI_STATUS
538(EFIAPI *EFI_RESERVED_SERVICE) (
539    );
540
541typedef
542EFI_STATUS
543(EFIAPI *EFI_CONNECT_CONTROLLER) (
544  IN  EFI_HANDLE                    ControllerHandle,
545  IN  EFI_HANDLE                    *DriverImageHandle    OPTIONAL,
546  IN  EFI_DEVICE_PATH               *RemainingDevicePath  OPTIONAL,
547  IN  BOOLEAN                       Recursive
548  );
549
550typedef
551EFI_STATUS
552(EFIAPI *EFI_DISCONNECT_CONTROLLER)(
553  IN EFI_HANDLE           ControllerHandle,
554  IN EFI_HANDLE           DriverImageHandle, OPTIONAL
555  IN EFI_HANDLE           ChildHandle        OPTIONAL
556  );
557
558#define EFI_OPEN_PROTOCOL_BY_HANDLE_PROTOCOL	 0x00000001
559#define EFI_OPEN_PROTOCOL_GET_PROTOCOL	       0x00000002
560#define EFI_OPEN_PROTOCOL_TEST_PROTOCOL        0x00000004
561#define EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER  0x00000008
562#define EFI_OPEN_PROTOCOL_BY_DRIVER            0x00000010
563#define EFI_OPEN_PROTOCOL_EXCLUSIVE            0x00000020
564
565typedef
566EFI_STATUS
567(EFIAPI *EFI_OPEN_PROTOCOL) (
568  IN EFI_HANDLE                 Handle,
569  IN EFI_GUID                   *Protocol,
570  OUT VOID                      **Interface,
571  IN  EFI_HANDLE                ImageHandle,
572  IN  EFI_HANDLE                ControllerHandle, OPTIONAL
573  IN  UINT32                    Attributes
574  );
575
576typedef
577EFI_STATUS
578(EFIAPI *EFI_CLOSE_PROTOCOL) (
579  IN EFI_HANDLE               Handle,
580  IN EFI_GUID                 *Protocol,
581  IN EFI_HANDLE               ImageHandle,
582  IN EFI_HANDLE               DeviceHandle
583  );
584
585typedef struct {
586  EFI_HANDLE                  AgentHandle;
587  EFI_HANDLE                  ControllerHandle;
588  UINT32                      Attributes;
589  UINT32                      OpenCount;
590} EFI_OPEN_PROTOCOL_INFORMATION_ENTRY;
591
592typedef
593EFI_STATUS
594(EFIAPI *EFI_OPEN_PROTOCOL_INFORMATION) (
595  IN  EFI_HANDLE                          UserHandle,
596  IN  EFI_GUID                            *Protocol,
597  IN  EFI_OPEN_PROTOCOL_INFORMATION_ENTRY **EntryBuffer,
598  OUT UINTN                               *EntryCount
599  );
600
601typedef
602EFI_STATUS
603(EFIAPI *EFI_PROTOCOLS_PER_HANDLE) (
604  IN EFI_HANDLE       UserHandle,
605  OUT EFI_GUID        ***ProtocolBuffer,
606  OUT UINTN           *ProtocolBufferCount
607  );
608
609typedef
610EFI_STATUS
611(EFIAPI *EFI_LOCATE_HANDLE_BUFFER) (
612  IN EFI_LOCATE_SEARCH_TYPE       SearchType,
613  IN EFI_GUID                     *Protocol OPTIONAL,
614  IN VOID                         *SearchKey OPTIONAL,
615  IN OUT UINTN                    *NumberHandles,
616  OUT EFI_HANDLE                  **Buffer
617  );
618
619typedef
620EFI_STATUS
621(EFIAPI *EFI_LOCATE_PROTOCOL) (
622  EFI_GUID  *Protocol,
623  VOID      *Registration, OPTIONAL
624  VOID      **Interface
625  );
626
627typedef
628EFI_STATUS
629(EFIAPI *EFI_INSTALL_MULTIPLE_PROTOCOL_INTERFACES) (
630  IN OUT EFI_HANDLE           *Handle,
631  ...
632  );
633
634typedef
635EFI_STATUS
636(EFIAPI *EFI_UNINSTALL_MULTIPLE_PROTOCOL_INTERFACES) (
637  IN EFI_HANDLE           Handle,
638  ...
639  );
640
641typedef
642EFI_STATUS
643(EFIAPI *EFI_CALCULATE_CRC32) (
644  IN  VOID                              *Data,
645  IN  UINTN                             DataSize,
646  OUT UINT32                            *Crc32
647  );
648
649typedef
650VOID
651(EFIAPI *EFI_COPY_MEM) (
652  IN VOID     *Destination,
653  IN VOID     *Source,
654  IN UINTN    Length
655  );
656
657typedef
658VOID
659(EFIAPI *EFI_SET_MEM) (
660  IN VOID     *Buffer,
661  IN UINTN    Size,
662  IN UINT8    Value
663  );
664
665//
666// Standard EFI table header
667//
668
669typedef struct _EFI_TABLE_HEARDER {
670  UINT64                      Signature;
671  UINT32                      Revision;
672  UINT32                      HeaderSize;
673  UINT32                      CRC32;
674  UINT32                      Reserved;
675} EFI_TABLE_HEADER;
676
677
678//
679// EFI Runtime Serivces Table
680//
681
682#define EFI_RUNTIME_SERVICES_SIGNATURE  0x56524553544e5552
683#define EFI_RUNTIME_SERVICES_REVISION   ((EFI_SPECIFICATION_MAJOR_REVISION<<16) | (EFI_SPECIFICATION_MINOR_REVISION))
684
685typedef struct  {
686  EFI_TABLE_HEADER                Hdr;
687
688  //
689  // Time services
690  //
691
692  EFI_GET_TIME                    GetTime;
693  EFI_SET_TIME                    SetTime;
694  EFI_GET_WAKEUP_TIME             GetWakeupTime;
695  EFI_SET_WAKEUP_TIME             SetWakeupTime;
696
697  //
698  // Virtual memory services
699  //
700
701  EFI_SET_VIRTUAL_ADDRESS_MAP     SetVirtualAddressMap;
702  EFI_CONVERT_POINTER             ConvertPointer;
703
704  //
705  // Variable serviers
706  //
707
708  EFI_GET_VARIABLE                GetVariable;
709  EFI_GET_NEXT_VARIABLE_NAME      GetNextVariableName;
710  EFI_SET_VARIABLE                SetVariable;
711
712  //
713  // Misc
714  //
715
716  EFI_GET_NEXT_HIGH_MONO_COUNT    GetNextHighMonotonicCount;
717  EFI_RESET_SYSTEM                ResetSystem;
718
719} EFI_RUNTIME_SERVICES;
720
721
722//
723// EFI Boot Services Table
724//
725
726#define EFI_BOOT_SERVICES_SIGNATURE     0x56524553544f4f42
727#define EFI_BOOT_SERVICES_REVISION      ((EFI_SPECIFICATION_MAJOR_REVISION<<16) | (EFI_SPECIFICATION_MINOR_REVISION))
728
729typedef struct {
730
731  EFI_TABLE_HEADER                Hdr;
732
733  //
734  // Task priority functions
735  //
736
737  EFI_RAISE_TPL                   RaiseTPL;
738  EFI_RESTORE_TPL                 RestoreTPL;
739
740  //
741  // Memory functions
742  //
743
744  EFI_ALLOCATE_PAGES              AllocatePages;
745  EFI_FREE_PAGES                  FreePages;
746  EFI_GET_MEMORY_MAP              GetMemoryMap;
747  EFI_ALLOCATE_POOL               AllocatePool;
748  EFI_FREE_POOL                   FreePool;
749
750  //
751  // Event & timer functions
752  //
753
754  EFI_CREATE_EVENT                CreateEvent;
755  EFI_SET_TIMER                   SetTimer;
756  EFI_WAIT_FOR_EVENT              WaitForEvent;
757  EFI_SIGNAL_EVENT                SignalEvent;
758  EFI_CLOSE_EVENT                 CloseEvent;
759  EFI_CHECK_EVENT                 CheckEvent;
760
761  //
762  // Protocol handler functions
763  //
764
765  EFI_INSTALL_PROTOCOL_INTERFACE  InstallProtocolInterface;
766  EFI_REINSTALL_PROTOCOL_INTERFACE ReinstallProtocolInterface;
767  EFI_UNINSTALL_PROTOCOL_INTERFACE UninstallProtocolInterface;
768  EFI_HANDLE_PROTOCOL             HandleProtocol;
769  VOID                            *Reserved;
770  EFI_REGISTER_PROTOCOL_NOTIFY    RegisterProtocolNotify;
771  EFI_LOCATE_HANDLE               LocateHandle;
772  EFI_LOCATE_DEVICE_PATH          LocateDevicePath;
773  EFI_INSTALL_CONFIGURATION_TABLE InstallConfigurationTable;
774
775  //
776  // Image functions
777  //
778
779  EFI_IMAGE_LOAD                  LoadImage;
780  EFI_IMAGE_START                 StartImage;
781  EFI_EXIT                        Exit;
782  EFI_IMAGE_UNLOAD                UnloadImage;
783  EFI_EXIT_BOOT_SERVICES          ExitBootServices;
784
785  //
786  // Misc functions
787  //
788
789  EFI_GET_NEXT_MONOTONIC_COUNT    GetNextMonotonicCount;
790  EFI_STALL                       Stall;
791  EFI_SET_WATCHDOG_TIMER          SetWatchdogTimer;
792
793  //
794  // DriverSupport Services
795  //
796  EFI_CONNECT_CONTROLLER	        ConnectController;
797  EFI_DISCONNECT_CONTROLLER       DisconnectController;
798
799  //
800  // Open and Close Protocol Services
801  //
802  EFI_OPEN_PROTOCOL               OpenProtocol;
803  EFI_CLOSE_PROTOCOL              CloseProtocol;
804  EFI_OPEN_PROTOCOL_INFORMATION   OpenProtocolInformation;
805
806  //
807  // Library Services to reduce size of drivers
808  //
809  EFI_PROTOCOLS_PER_HANDLE        ProtocolsPerHandle;
810  EFI_LOCATE_HANDLE_BUFFER        LocateHandleBuffer;
811  EFI_LOCATE_PROTOCOL             LocateProtocol;
812
813  EFI_INSTALL_MULTIPLE_PROTOCOL_INTERFACES    InstallMultipleProtocolInterfaces;
814  EFI_UNINSTALL_MULTIPLE_PROTOCOL_INTERFACES  UninstallMultipleProtocolInterfaces;
815
816  //
817  // CRC32 services
818  //
819  EFI_CALCULATE_CRC32             CalculateCrc32;
820
821  //
822  // Memory Utility Services
823  //
824  EFI_COPY_MEM                    CopyMem;
825  EFI_SET_MEM                     SetMem;
826
827} EFI_BOOT_SERVICES;
828
829
830//
831// EFI Configuration Table and GUID definitions
832//
833
834#define MPS_TABLE_GUID    \
835  { 0xeb9d2d2f, 0x2d88, 0x11d3, 0x9a, 0x16, 0x0, 0x90, 0x27, 0x3f, 0xc1, 0x4d }
836
837#define ACPI_TABLE_GUID    \
838  { 0xeb9d2d30, 0x2d88, 0x11d3, 0x9a, 0x16, 0x0, 0x90, 0x27, 0x3f, 0xc1, 0x4d }
839
840#define ACPI_20_TABLE_GUID  \
841  { 0x8868e871, 0xe4f1, 0x11d3, 0xbc, 0x22, 0x0, 0x80, 0xc7, 0x3c, 0x88, 0x81 }
842
843#define SMBIOS_TABLE_GUID    \
844  { 0xeb9d2d31, 0x2d88, 0x11d3, 0x9a, 0x16, 0x0, 0x90, 0x27, 0x3f, 0xc1, 0x4d }
845
846#define SAL_SYSTEM_TABLE_GUID    \
847  { 0xeb9d2d32, 0x2d88, 0x11d3, 0x9a, 0x16, 0x0, 0x90, 0x27, 0x3f, 0xc1, 0x4d }
848
849#define FDT_TABLE_GUID    \
850  { 0xb1b621d5, 0xf19c, 0x41a5, 0x83, 0x0b, 0xd9, 0x15, 0x2c, 0x69, 0xaa, 0xe0 }
851
852#define DXE_SERVICES_TABLE_GUID	\
853  { 0x5ad34ba, 0x6f02, 0x4214, 0x95, 0x2e, 0x4d, 0xa0, 0x39, 0x8e, 0x2b, 0xb9 }
854
855#define	HOB_LIST_TABLE_GUID	\
856  { 0x7739f24c, 0x93d7, 0x11d4, 0x9a, 0x3a, 0x0, 0x90, 0x27, 0x3f, 0xc1, 0x4d }
857
858#define MEMORY_TYPE_INFORMATION_TABLE_GUID \
859  { 0x4c19049f, 0x4137, 0x4dd3, 0x9c, 0x10, 0x8b, 0x97, 0xa8, 0x3f, 0xfd, 0xfa }
860
861#define DEBUG_IMAGE_INFO_TABLE_GUID \
862  { 0x49152e77, 0x1ada, 0x4764, 0xb7, 0xa2, 0x7a, 0xfe, 0xfe, 0xd9, 0x5e, 0x8b }
863
864typedef struct _EFI_CONFIGURATION_TABLE {
865  EFI_GUID                VendorGuid;
866  VOID                    *VendorTable;
867} EFI_CONFIGURATION_TABLE;
868
869
870//
871// EFI System Table
872//
873
874
875
876
877#define EFI_SYSTEM_TABLE_SIGNATURE      0x5453595320494249
878#define EFI_SYSTEM_TABLE_REVISION      ((EFI_SPECIFICATION_MAJOR_REVISION<<16) | (EFI_SPECIFICATION_MINOR_REVISION))
879#define EFI_1_10_SYSTEM_TABLE_REVISION ((1<<16) | 10)
880#define EFI_1_02_SYSTEM_TABLE_REVISION ((1<<16) | 02)
881
882typedef struct _EFI_SYSTEM_TABLE {
883  EFI_TABLE_HEADER                Hdr;
884
885  CHAR16                          *FirmwareVendor;
886  UINT32                          FirmwareRevision;
887
888  EFI_HANDLE                      ConsoleInHandle;
889  SIMPLE_INPUT_INTERFACE          *ConIn;
890
891  EFI_HANDLE                      ConsoleOutHandle;
892  SIMPLE_TEXT_OUTPUT_INTERFACE    *ConOut;
893
894  EFI_HANDLE                      StandardErrorHandle;
895  SIMPLE_TEXT_OUTPUT_INTERFACE    *StdErr;
896
897  EFI_RUNTIME_SERVICES            *RuntimeServices;
898  EFI_BOOT_SERVICES               *BootServices;
899
900  UINTN                           NumberOfTableEntries;
901  EFI_CONFIGURATION_TABLE         *ConfigurationTable;
902
903} EFI_SYSTEM_TABLE;
904
905#endif
906