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