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