efiapi.h revision 312772
1/* $FreeBSD: stable/10/sys/boot/efi/include/efiapi.h 312772 2017-01-25 19:55:35Z dim $ */
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    VOID
540    );
541
542typedef
543EFI_STATUS
544(EFIAPI *EFI_CONNECT_CONTROLLER) (
545  IN  EFI_HANDLE                    ControllerHandle,
546  IN  EFI_HANDLE                    *DriverImageHandle    OPTIONAL,
547  IN  EFI_DEVICE_PATH               *RemainingDevicePath  OPTIONAL,
548  IN  BOOLEAN                       Recursive
549  );
550
551typedef
552EFI_STATUS
553(EFIAPI *EFI_DISCONNECT_CONTROLLER)(
554  IN EFI_HANDLE           ControllerHandle,
555  IN EFI_HANDLE           DriverImageHandle, OPTIONAL
556  IN EFI_HANDLE           ChildHandle        OPTIONAL
557  );
558
559#define EFI_OPEN_PROTOCOL_BY_HANDLE_PROTOCOL	 0x00000001
560#define EFI_OPEN_PROTOCOL_GET_PROTOCOL	       0x00000002
561#define EFI_OPEN_PROTOCOL_TEST_PROTOCOL        0x00000004
562#define EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER  0x00000008
563#define EFI_OPEN_PROTOCOL_BY_DRIVER            0x00000010
564#define EFI_OPEN_PROTOCOL_EXCLUSIVE            0x00000020
565
566typedef
567EFI_STATUS
568(EFIAPI *EFI_OPEN_PROTOCOL) (
569  IN EFI_HANDLE                 Handle,
570  IN EFI_GUID                   *Protocol,
571  OUT VOID                      **Interface,
572  IN  EFI_HANDLE                ImageHandle,
573  IN  EFI_HANDLE                ControllerHandle, OPTIONAL
574  IN  UINT32                    Attributes
575  );
576
577typedef
578EFI_STATUS
579(EFIAPI *EFI_CLOSE_PROTOCOL) (
580  IN EFI_HANDLE               Handle,
581  IN EFI_GUID                 *Protocol,
582  IN EFI_HANDLE               ImageHandle,
583  IN EFI_HANDLE               DeviceHandle
584  );
585
586typedef struct {
587  EFI_HANDLE                  AgentHandle;
588  EFI_HANDLE                  ControllerHandle;
589  UINT32                      Attributes;
590  UINT32                      OpenCount;
591} EFI_OPEN_PROTOCOL_INFORMATION_ENTRY;
592
593typedef
594EFI_STATUS
595(EFIAPI *EFI_OPEN_PROTOCOL_INFORMATION) (
596  IN  EFI_HANDLE                          UserHandle,
597  IN  EFI_GUID                            *Protocol,
598  IN  EFI_OPEN_PROTOCOL_INFORMATION_ENTRY **EntryBuffer,
599  OUT UINTN                               *EntryCount
600  );
601
602typedef
603EFI_STATUS
604(EFIAPI *EFI_PROTOCOLS_PER_HANDLE) (
605  IN EFI_HANDLE       UserHandle,
606  OUT EFI_GUID        ***ProtocolBuffer,
607  OUT UINTN           *ProtocolBufferCount
608  );
609
610typedef
611EFI_STATUS
612(EFIAPI *EFI_LOCATE_HANDLE_BUFFER) (
613  IN EFI_LOCATE_SEARCH_TYPE       SearchType,
614  IN EFI_GUID                     *Protocol OPTIONAL,
615  IN VOID                         *SearchKey OPTIONAL,
616  IN OUT UINTN                    *NumberHandles,
617  OUT EFI_HANDLE                  **Buffer
618  );
619
620typedef
621EFI_STATUS
622(EFIAPI *EFI_LOCATE_PROTOCOL) (
623  EFI_GUID  *Protocol,
624  VOID      *Registration, OPTIONAL
625  VOID      **Interface
626  );
627
628typedef
629EFI_STATUS
630(EFIAPI *EFI_INSTALL_MULTIPLE_PROTOCOL_INTERFACES) (
631  IN OUT EFI_HANDLE           *Handle,
632  ...
633  );
634
635typedef
636EFI_STATUS
637(EFIAPI *EFI_UNINSTALL_MULTIPLE_PROTOCOL_INTERFACES) (
638  IN EFI_HANDLE           Handle,
639  ...
640  );
641
642typedef
643EFI_STATUS
644(EFIAPI *EFI_CALCULATE_CRC32) (
645  IN  VOID                              *Data,
646  IN  UINTN                             DataSize,
647  OUT UINT32                            *Crc32
648  );
649
650typedef
651VOID
652(EFIAPI *EFI_COPY_MEM) (
653  IN VOID     *Destination,
654  IN VOID     *Source,
655  IN UINTN    Length
656  );
657
658typedef
659VOID
660(EFIAPI *EFI_SET_MEM) (
661  IN VOID     *Buffer,
662  IN UINTN    Size,
663  IN UINT8    Value
664  );
665
666//
667// Standard EFI table header
668//
669
670typedef struct _EFI_TABLE_HEARDER {
671  UINT64                      Signature;
672  UINT32                      Revision;
673  UINT32                      HeaderSize;
674  UINT32                      CRC32;
675  UINT32                      Reserved;
676} EFI_TABLE_HEADER;
677
678
679//
680// EFI Runtime Serivces Table
681//
682
683#define EFI_RUNTIME_SERVICES_SIGNATURE  0x56524553544e5552
684#define EFI_RUNTIME_SERVICES_REVISION   ((EFI_SPECIFICATION_MAJOR_REVISION<<16) | (EFI_SPECIFICATION_MINOR_REVISION))
685
686typedef struct  {
687  EFI_TABLE_HEADER                Hdr;
688
689  //
690  // Time services
691  //
692
693  EFI_GET_TIME                    GetTime;
694  EFI_SET_TIME                    SetTime;
695  EFI_GET_WAKEUP_TIME             GetWakeupTime;
696  EFI_SET_WAKEUP_TIME             SetWakeupTime;
697
698  //
699  // Virtual memory services
700  //
701
702  EFI_SET_VIRTUAL_ADDRESS_MAP     SetVirtualAddressMap;
703  EFI_CONVERT_POINTER             ConvertPointer;
704
705  //
706  // Variable serviers
707  //
708
709  EFI_GET_VARIABLE                GetVariable;
710  EFI_GET_NEXT_VARIABLE_NAME      GetNextVariableName;
711  EFI_SET_VARIABLE                SetVariable;
712
713  //
714  // Misc
715  //
716
717  EFI_GET_NEXT_HIGH_MONO_COUNT    GetNextHighMonotonicCount;
718  EFI_RESET_SYSTEM                ResetSystem;
719
720} EFI_RUNTIME_SERVICES;
721
722
723//
724// EFI Boot Services Table
725//
726
727#define EFI_BOOT_SERVICES_SIGNATURE     0x56524553544f4f42
728#define EFI_BOOT_SERVICES_REVISION      ((EFI_SPECIFICATION_MAJOR_REVISION<<16) | (EFI_SPECIFICATION_MINOR_REVISION))
729
730typedef struct {
731
732  EFI_TABLE_HEADER                Hdr;
733
734  //
735  // Task priority functions
736  //
737
738  EFI_RAISE_TPL                   RaiseTPL;
739  EFI_RESTORE_TPL                 RestoreTPL;
740
741  //
742  // Memory functions
743  //
744
745  EFI_ALLOCATE_PAGES              AllocatePages;
746  EFI_FREE_PAGES                  FreePages;
747  EFI_GET_MEMORY_MAP              GetMemoryMap;
748  EFI_ALLOCATE_POOL               AllocatePool;
749  EFI_FREE_POOL                   FreePool;
750
751  //
752  // Event & timer functions
753  //
754
755  EFI_CREATE_EVENT                CreateEvent;
756  EFI_SET_TIMER                   SetTimer;
757  EFI_WAIT_FOR_EVENT              WaitForEvent;
758  EFI_SIGNAL_EVENT                SignalEvent;
759  EFI_CLOSE_EVENT                 CloseEvent;
760  EFI_CHECK_EVENT                 CheckEvent;
761
762  //
763  // Protocol handler functions
764  //
765
766  EFI_INSTALL_PROTOCOL_INTERFACE  InstallProtocolInterface;
767  EFI_REINSTALL_PROTOCOL_INTERFACE ReinstallProtocolInterface;
768  EFI_UNINSTALL_PROTOCOL_INTERFACE UninstallProtocolInterface;
769  EFI_HANDLE_PROTOCOL             HandleProtocol;
770  VOID                            *Reserved;
771  EFI_REGISTER_PROTOCOL_NOTIFY    RegisterProtocolNotify;
772  EFI_LOCATE_HANDLE               LocateHandle;
773  EFI_LOCATE_DEVICE_PATH          LocateDevicePath;
774  EFI_INSTALL_CONFIGURATION_TABLE InstallConfigurationTable;
775
776  //
777  // Image functions
778  //
779
780  EFI_IMAGE_LOAD                  LoadImage;
781  EFI_IMAGE_START                 StartImage;
782  EFI_EXIT                        Exit;
783  EFI_IMAGE_UNLOAD                UnloadImage;
784  EFI_EXIT_BOOT_SERVICES          ExitBootServices;
785
786  //
787  // Misc functions
788  //
789
790  EFI_GET_NEXT_MONOTONIC_COUNT    GetNextMonotonicCount;
791  EFI_STALL                       Stall;
792  EFI_SET_WATCHDOG_TIMER          SetWatchdogTimer;
793
794  //
795  // DriverSupport Services
796  //
797  EFI_CONNECT_CONTROLLER	        ConnectController;
798  EFI_DISCONNECT_CONTROLLER       DisconnectController;
799
800  //
801  // Open and Close Protocol Services
802  //
803  EFI_OPEN_PROTOCOL               OpenProtocol;
804  EFI_CLOSE_PROTOCOL              CloseProtocol;
805  EFI_OPEN_PROTOCOL_INFORMATION   OpenProtocolInformation;
806
807  //
808  // Library Services to reduce size of drivers
809  //
810  EFI_PROTOCOLS_PER_HANDLE        ProtocolsPerHandle;
811  EFI_LOCATE_HANDLE_BUFFER        LocateHandleBuffer;
812  EFI_LOCATE_PROTOCOL             LocateProtocol;
813
814  EFI_INSTALL_MULTIPLE_PROTOCOL_INTERFACES    InstallMultipleProtocolInterfaces;
815  EFI_UNINSTALL_MULTIPLE_PROTOCOL_INTERFACES  UninstallMultipleProtocolInterfaces;
816
817  //
818  // CRC32 services
819  //
820  EFI_CALCULATE_CRC32             CalculateCrc32;
821
822  //
823  // Memory Utility Services
824  //
825  EFI_COPY_MEM                    CopyMem;
826  EFI_SET_MEM                     SetMem;
827
828} EFI_BOOT_SERVICES;
829
830
831//
832// EFI Configuration Table and GUID definitions
833//
834
835#define MPS_TABLE_GUID \
836    { 0xeb9d2d2f, 0x2d88, 0x11d3, {0x9a, 0x16, 0x0, 0x90, 0x27, 0x3f, 0xc1, 0x4d} }
837
838#define ACPI_TABLE_GUID \
839    { 0xeb9d2d30, 0x2d88, 0x11d3, {0x9a, 0x16, 0x0, 0x90, 0x27, 0x3f, 0xc1, 0x4d} }
840
841#define ACPI_20_TABLE_GUID \
842    { 0x8868e871, 0xe4f1, 0x11d3, {0xbc, 0x22, 0x0, 0x80, 0xc7, 0x3c, 0x88, 0x81} }
843
844#define SMBIOS_TABLE_GUID \
845    { 0xeb9d2d31, 0x2d88, 0x11d3, {0x9a, 0x16, 0x0, 0x90, 0x27, 0x3f, 0xc1, 0x4d} }
846
847#define SAL_SYSTEM_TABLE_GUID  \
848    { 0xeb9d2d32, 0x2d88, 0x11d3, {0x9a, 0x16, 0x0, 0x90, 0x27, 0x3f, 0xc1, 0x4d} }
849
850#define FDT_TABLE_GUID \
851    { 0xb1b621d5, 0xf19c, 0x41a5, {0x83, 0x0b, 0xd9, 0x15, 0x2c, 0x69, 0xaa, 0xe0} }
852
853#define DXE_SERVICES_TABLE_GUID \
854    { 0x5ad34ba, 0x6f02, 0x4214, {0x95, 0x2e, 0x4d, 0xa0, 0x39, 0x8e, 0x2b, 0xb9} }
855
856#define HOB_LIST_TABLE_GUID \
857    { 0x7739f24c, 0x93d7, 0x11d4, {0x9a, 0x3a, 0x0, 0x90, 0x27, 0x3f, 0xc1, 0x4d} }
858
859#define MEMORY_TYPE_INFORMATION_TABLE_GUID \
860    { 0x4c19049f, 0x4137, 0x4dd3, {0x9c, 0x10, 0x8b, 0x97, 0xa8, 0x3f, 0xfd, 0xfa} }
861
862#define DEBUG_IMAGE_INFO_TABLE_GUID \
863    { 0x49152e77, 0x1ada, 0x4764, {0xb7, 0xa2, 0x7a, 0xfe, 0xfe, 0xd9, 0x5e, 0x8b} }
864
865typedef struct _EFI_CONFIGURATION_TABLE {
866  EFI_GUID                VendorGuid;
867  VOID                    *VendorTable;
868} EFI_CONFIGURATION_TABLE;
869
870
871//
872// EFI System Table
873//
874
875
876
877
878#define EFI_SYSTEM_TABLE_SIGNATURE      0x5453595320494249
879#define EFI_SYSTEM_TABLE_REVISION      ((EFI_SPECIFICATION_MAJOR_REVISION<<16) | (EFI_SPECIFICATION_MINOR_REVISION))
880#define EFI_1_10_SYSTEM_TABLE_REVISION ((1<<16) | 10)
881#define EFI_1_02_SYSTEM_TABLE_REVISION ((1<<16) | 02)
882
883typedef struct _EFI_SYSTEM_TABLE {
884  EFI_TABLE_HEADER                Hdr;
885
886  CHAR16                          *FirmwareVendor;
887  UINT32                          FirmwareRevision;
888
889  EFI_HANDLE                      ConsoleInHandle;
890  SIMPLE_INPUT_INTERFACE          *ConIn;
891
892  EFI_HANDLE                      ConsoleOutHandle;
893  SIMPLE_TEXT_OUTPUT_INTERFACE    *ConOut;
894
895  EFI_HANDLE                      StandardErrorHandle;
896  SIMPLE_TEXT_OUTPUT_INTERFACE    *StdErr;
897
898  EFI_RUNTIME_SERVICES            *RuntimeServices;
899  EFI_BOOT_SERVICES               *BootServices;
900
901  UINTN                           NumberOfTableEntries;
902  EFI_CONFIGURATION_TABLE         *ConfigurationTable;
903
904} EFI_SYSTEM_TABLE;
905
906#endif
907