xref: /freebsd/stand/efi/include/efiapi.h (revision b00ab754)
1 /* $FreeBSD$ */
2 #ifndef _EFI_API_H
3 #define _EFI_API_H
4 
5 /*++
6 
7 Copyright (c)  1999 - 2002 Intel Corporation. All rights reserved
8 This software and associated documentation (if any) is furnished
9 under a license and may only be used or copied in accordance
10 with the terms of the license. Except as permitted by such
11 license, no part of this software or documentation may be
12 reproduced, stored in a retrieval system, or transmitted in any
13 form or by any means without the express written consent of
14 Intel Corporation.
15 
16 Module Name:
17 
18     efiapi.h
19 
20 Abstract:
21 
22     Global EFI runtime & boot service interfaces
23 
24 
25 
26 
27 Revision 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 
42 INTERFACE_DECL(_EFI_SYSTEM_TABLE);
43 
44 //
45 // EFI Memory
46 //
47 
48 typedef
49 EFI_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 
57 typedef
58 EFI_STATUS
59 (EFIAPI *EFI_FREE_PAGES) (
60     IN EFI_PHYSICAL_ADDRESS         Memory,
61     IN UINTN                        NoPages
62     );
63 
64 typedef
65 EFI_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 
77 typedef
78 EFI_STATUS
79 (EFIAPI *EFI_ALLOCATE_POOL) (
80     IN EFI_MEMORY_TYPE              PoolType,
81     IN UINTN                        Size,
82     OUT VOID                        **Buffer
83     );
84 
85 typedef
86 EFI_STATUS
87 (EFIAPI *EFI_FREE_POOL) (
88     IN VOID                         *Buffer
89     );
90 
91 typedef
92 EFI_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 
106 typedef
107 EFI_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 
133 typedef
134 VOID
135 (EFIAPI *EFI_EVENT_NOTIFY) (
136     IN EFI_EVENT                Event,
137     IN VOID                     *Context
138     );
139 
140 typedef
141 EFI_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 
150 typedef enum {
151     TimerCancel,
152     TimerPeriodic,
153     TimerRelative,
154     TimerTypeMax
155 } EFI_TIMER_DELAY;
156 
157 typedef
158 EFI_STATUS
159 (EFIAPI *EFI_SET_TIMER) (
160     IN EFI_EVENT                Event,
161     IN EFI_TIMER_DELAY          Type,
162     IN UINT64                   TriggerTime
163     );
164 
165 typedef
166 EFI_STATUS
167 (EFIAPI *EFI_SIGNAL_EVENT) (
168     IN EFI_EVENT                Event
169     );
170 
171 typedef
172 EFI_STATUS
173 (EFIAPI *EFI_WAIT_FOR_EVENT) (
174     IN UINTN                    NumberOfEvents,
175     IN EFI_EVENT                *Event,
176     OUT UINTN                   *Index
177     );
178 
179 typedef
180 EFI_STATUS
181 (EFIAPI *EFI_CLOSE_EVENT) (
182     IN EFI_EVENT                Event
183     );
184 
185 typedef
186 EFI_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 
200 typedef
201 EFI_TPL
202 (EFIAPI *EFI_RAISE_TPL) (
203     IN EFI_TPL      NewTpl
204     );
205 
206 typedef
207 VOID
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 
228 typedef
229 EFI_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 
238 typedef
239 EFI_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 
247 typedef
248 EFI_STATUS
249 (EFIAPI *EFI_SET_VARIABLE) (
250     IN const 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 
262 typedef 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 
269 typedef
270 EFI_STATUS
271 (EFIAPI *EFI_GET_TIME) (
272     OUT EFI_TIME                    *Time,
273     OUT EFI_TIME_CAPABILITIES       *Capabilities OPTIONAL
274     );
275 
276 typedef
277 EFI_STATUS
278 (EFIAPI *EFI_SET_TIME) (
279     IN EFI_TIME                     *Time
280     );
281 
282 typedef
283 EFI_STATUS
284 (EFIAPI *EFI_GET_WAKEUP_TIME) (
285     OUT BOOLEAN                     *Enabled,
286     OUT BOOLEAN                     *Pending,
287     OUT EFI_TIME                    *Time
288     );
289 
290 typedef
291 EFI_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_EBC)
318 #define EFI_IMAGE_MACHINE_EBC       0x0EBC
319 #endif
320 
321 // Image Entry prototype
322 
323 typedef
324 EFI_STATUS
325 (EFIAPI *EFI_IMAGE_ENTRY_POINT) (
326     IN EFI_HANDLE                   ImageHandle,
327     IN struct _EFI_SYSTEM_TABLE     *SystemTable
328     );
329 
330 typedef
331 EFI_STATUS
332 (EFIAPI *EFI_IMAGE_LOAD) (
333     IN BOOLEAN                      BootPolicy,
334     IN EFI_HANDLE                   ParentImageHandle,
335     IN EFI_DEVICE_PATH              *FilePath,
336     IN VOID                         *SourceBuffer   OPTIONAL,
337     IN UINTN                        SourceSize,
338     OUT EFI_HANDLE                  *ImageHandle
339     );
340 
341 typedef
342 EFI_STATUS
343 (EFIAPI *EFI_IMAGE_START) (
344     IN EFI_HANDLE                   ImageHandle,
345     OUT UINTN                       *ExitDataSize,
346     OUT CHAR16                      **ExitData  OPTIONAL
347     );
348 
349 typedef
350 EFI_STATUS
351 (EFIAPI *EFI_EXIT) (
352     IN EFI_HANDLE                   ImageHandle,
353     IN EFI_STATUS                   ExitStatus,
354     IN UINTN                        ExitDataSize,
355     IN CHAR16                       *ExitData OPTIONAL
356     ) __dead2;
357 
358 typedef
359 EFI_STATUS
360 (EFIAPI *EFI_IMAGE_UNLOAD) (
361     IN EFI_HANDLE                   ImageHandle
362     );
363 
364 
365 // Image handle
366 #define LOADED_IMAGE_PROTOCOL \
367     { 0x5B1B31A1, 0x9562, 0x11d2, {0x8E, 0x3F, 0x00, 0xA0, 0xC9, 0x69, 0x72, 0x3B} }
368 
369 #define EFI_LOADED_IMAGE_INFORMATION_REVISION      0x1000
370 typedef struct {
371     UINT32                          Revision;
372     EFI_HANDLE                      ParentHandle;
373     struct _EFI_SYSTEM_TABLE        *SystemTable;
374 
375     // Source location of image
376     EFI_HANDLE                      DeviceHandle;
377     EFI_DEVICE_PATH                 *FilePath;
378     VOID                            *Reserved;
379 
380     // Images load options
381     UINT32                          LoadOptionsSize;
382     VOID                            *LoadOptions;
383 
384     // Location of where image was loaded
385     VOID                            *ImageBase;
386     UINT64                          ImageSize;
387     EFI_MEMORY_TYPE                 ImageCodeType;
388     EFI_MEMORY_TYPE                 ImageDataType;
389 
390     // If the driver image supports a dynamic unload request
391     EFI_IMAGE_UNLOAD                Unload;
392 
393 } EFI_LOADED_IMAGE;
394 
395 
396 typedef
397 EFI_STATUS
398 (EFIAPI *EFI_EXIT_BOOT_SERVICES) (
399     IN EFI_HANDLE                   ImageHandle,
400     IN UINTN                        MapKey
401     );
402 
403 //
404 // Misc
405 //
406 
407 
408 typedef
409 EFI_STATUS
410 (EFIAPI *EFI_STALL) (
411     IN UINTN                    Microseconds
412     );
413 
414 typedef
415 EFI_STATUS
416 (EFIAPI *EFI_SET_WATCHDOG_TIMER) (
417     IN UINTN                    Timeout,
418     IN UINT64                   WatchdogCode,
419     IN UINTN                    DataSize,
420     IN CHAR16                   *WatchdogData OPTIONAL
421     );
422 
423 
424 typedef enum {
425     EfiResetCold,
426     EfiResetWarm,
427     EfiResetShutdown
428 } EFI_RESET_TYPE;
429 
430 typedef
431 VOID
432 (EFIAPI *EFI_RESET_SYSTEM) (
433     IN EFI_RESET_TYPE           ResetType,
434     IN EFI_STATUS               ResetStatus,
435     IN UINTN                    DataSize,
436     IN CHAR16                   *ResetData OPTIONAL
437     );
438 
439 typedef
440 EFI_STATUS
441 (EFIAPI *EFI_GET_NEXT_MONOTONIC_COUNT) (
442     OUT UINT64                  *Count
443     );
444 
445 typedef
446 EFI_STATUS
447 (EFIAPI *EFI_GET_NEXT_HIGH_MONO_COUNT) (
448     OUT UINT32                  *HighCount
449     );
450 
451 //
452 // Protocol handler functions
453 //
454 
455 typedef enum {
456     EFI_NATIVE_INTERFACE
457 } EFI_INTERFACE_TYPE;
458 
459 typedef
460 EFI_STATUS
461 (EFIAPI *EFI_INSTALL_PROTOCOL_INTERFACE) (
462     IN OUT EFI_HANDLE           *Handle,
463     IN EFI_GUID                 *Protocol,
464     IN EFI_INTERFACE_TYPE       InterfaceType,
465     IN VOID                     *Interface
466     );
467 
468 typedef
469 EFI_STATUS
470 (EFIAPI *EFI_REINSTALL_PROTOCOL_INTERFACE) (
471     IN EFI_HANDLE               Handle,
472     IN EFI_GUID                 *Protocol,
473     IN VOID                     *OldInterface,
474     IN VOID                     *NewInterface
475     );
476 
477 typedef
478 EFI_STATUS
479 (EFIAPI *EFI_UNINSTALL_PROTOCOL_INTERFACE) (
480     IN EFI_HANDLE               Handle,
481     IN EFI_GUID                 *Protocol,
482     IN VOID                     *Interface
483     );
484 
485 typedef
486 EFI_STATUS
487 (EFIAPI *EFI_HANDLE_PROTOCOL) (
488     IN EFI_HANDLE               Handle,
489     IN EFI_GUID                 *Protocol,
490     OUT VOID                    **Interface
491     );
492 
493 typedef
494 EFI_STATUS
495 (EFIAPI *EFI_REGISTER_PROTOCOL_NOTIFY) (
496     IN EFI_GUID                 *Protocol,
497     IN EFI_EVENT                Event,
498     OUT VOID                    **Registration
499     );
500 
501 typedef enum {
502     AllHandles,
503     ByRegisterNotify,
504     ByProtocol
505 } EFI_LOCATE_SEARCH_TYPE;
506 
507 typedef
508 EFI_STATUS
509 (EFIAPI *EFI_LOCATE_HANDLE) (
510     IN EFI_LOCATE_SEARCH_TYPE   SearchType,
511     IN EFI_GUID                 *Protocol OPTIONAL,
512     IN VOID                     *SearchKey OPTIONAL,
513     IN OUT UINTN                *BufferSize,
514     OUT EFI_HANDLE              *Buffer
515     );
516 
517 typedef
518 EFI_STATUS
519 (EFIAPI *EFI_LOCATE_DEVICE_PATH) (
520     IN EFI_GUID                 *Protocol,
521     IN OUT EFI_DEVICE_PATH      **DevicePath,
522     OUT EFI_HANDLE              *Device
523     );
524 
525 typedef
526 EFI_STATUS
527 (EFIAPI *EFI_INSTALL_CONFIGURATION_TABLE) (
528     IN EFI_GUID                 *Guid,
529     IN VOID                     *Table
530     );
531 
532 typedef
533 EFI_STATUS
534 (EFIAPI *EFI_RESERVED_SERVICE) (
535     VOID
536     );
537 
538 typedef
539 EFI_STATUS
540 (EFIAPI *EFI_CONNECT_CONTROLLER) (
541   IN  EFI_HANDLE                    ControllerHandle,
542   IN  EFI_HANDLE                    *DriverImageHandle    OPTIONAL,
543   IN  EFI_DEVICE_PATH               *RemainingDevicePath  OPTIONAL,
544   IN  BOOLEAN                       Recursive
545   );
546 
547 typedef
548 EFI_STATUS
549 (EFIAPI *EFI_DISCONNECT_CONTROLLER)(
550   IN EFI_HANDLE           ControllerHandle,
551   IN EFI_HANDLE           DriverImageHandle, OPTIONAL
552   IN EFI_HANDLE           ChildHandle        OPTIONAL
553   );
554 
555 #define EFI_OPEN_PROTOCOL_BY_HANDLE_PROTOCOL	 0x00000001
556 #define EFI_OPEN_PROTOCOL_GET_PROTOCOL	       0x00000002
557 #define EFI_OPEN_PROTOCOL_TEST_PROTOCOL        0x00000004
558 #define EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER  0x00000008
559 #define EFI_OPEN_PROTOCOL_BY_DRIVER            0x00000010
560 #define EFI_OPEN_PROTOCOL_EXCLUSIVE            0x00000020
561 
562 typedef
563 EFI_STATUS
564 (EFIAPI *EFI_OPEN_PROTOCOL) (
565   IN EFI_HANDLE                 Handle,
566   IN EFI_GUID                   *Protocol,
567   OUT VOID                      **Interface,
568   IN  EFI_HANDLE                ImageHandle,
569   IN  EFI_HANDLE                ControllerHandle, OPTIONAL
570   IN  UINT32                    Attributes
571   );
572 
573 typedef
574 EFI_STATUS
575 (EFIAPI *EFI_CLOSE_PROTOCOL) (
576   IN EFI_HANDLE               Handle,
577   IN EFI_GUID                 *Protocol,
578   IN EFI_HANDLE               ImageHandle,
579   IN EFI_HANDLE               DeviceHandle
580   );
581 
582 typedef struct {
583   EFI_HANDLE                  AgentHandle;
584   EFI_HANDLE                  ControllerHandle;
585   UINT32                      Attributes;
586   UINT32                      OpenCount;
587 } EFI_OPEN_PROTOCOL_INFORMATION_ENTRY;
588 
589 typedef
590 EFI_STATUS
591 (EFIAPI *EFI_OPEN_PROTOCOL_INFORMATION) (
592   IN  EFI_HANDLE                          UserHandle,
593   IN  EFI_GUID                            *Protocol,
594   IN  EFI_OPEN_PROTOCOL_INFORMATION_ENTRY **EntryBuffer,
595   OUT UINTN                               *EntryCount
596   );
597 
598 typedef
599 EFI_STATUS
600 (EFIAPI *EFI_PROTOCOLS_PER_HANDLE) (
601   IN EFI_HANDLE       UserHandle,
602   OUT EFI_GUID        ***ProtocolBuffer,
603   OUT UINTN           *ProtocolBufferCount
604   );
605 
606 typedef
607 EFI_STATUS
608 (EFIAPI *EFI_LOCATE_HANDLE_BUFFER) (
609   IN EFI_LOCATE_SEARCH_TYPE       SearchType,
610   IN EFI_GUID                     *Protocol OPTIONAL,
611   IN VOID                         *SearchKey OPTIONAL,
612   IN OUT UINTN                    *NumberHandles,
613   OUT EFI_HANDLE                  **Buffer
614   );
615 
616 typedef
617 EFI_STATUS
618 (EFIAPI *EFI_LOCATE_PROTOCOL) (
619   EFI_GUID  *Protocol,
620   VOID      *Registration, OPTIONAL
621   VOID      **Interface
622   );
623 
624 typedef
625 EFI_STATUS
626 (EFIAPI *EFI_INSTALL_MULTIPLE_PROTOCOL_INTERFACES) (
627   IN OUT EFI_HANDLE           *Handle,
628   ...
629   );
630 
631 typedef
632 EFI_STATUS
633 (EFIAPI *EFI_UNINSTALL_MULTIPLE_PROTOCOL_INTERFACES) (
634   IN EFI_HANDLE           Handle,
635   ...
636   );
637 
638 typedef
639 EFI_STATUS
640 (EFIAPI *EFI_CALCULATE_CRC32) (
641   IN  VOID                              *Data,
642   IN  UINTN                             DataSize,
643   OUT UINT32                            *Crc32
644   );
645 
646 typedef
647 VOID
648 (EFIAPI *EFI_COPY_MEM) (
649   IN VOID     *Destination,
650   IN VOID     *Source,
651   IN UINTN    Length
652   );
653 
654 typedef
655 VOID
656 (EFIAPI *EFI_SET_MEM) (
657   IN VOID     *Buffer,
658   IN UINTN    Size,
659   IN UINT8    Value
660   );
661 
662 //
663 // Standard EFI table header
664 //
665 
666 typedef struct _EFI_TABLE_HEARDER {
667   UINT64                      Signature;
668   UINT32                      Revision;
669   UINT32                      HeaderSize;
670   UINT32                      CRC32;
671   UINT32                      Reserved;
672 } EFI_TABLE_HEADER;
673 
674 
675 //
676 // EFI Runtime Serivces Table
677 //
678 
679 #define EFI_RUNTIME_SERVICES_SIGNATURE  0x56524553544e5552
680 #define EFI_RUNTIME_SERVICES_REVISION   ((EFI_SPECIFICATION_MAJOR_REVISION<<16) | (EFI_SPECIFICATION_MINOR_REVISION))
681 
682 typedef struct  {
683   EFI_TABLE_HEADER                Hdr;
684 
685   //
686   // Time services
687   //
688 
689   EFI_GET_TIME                    GetTime;
690   EFI_SET_TIME                    SetTime;
691   EFI_GET_WAKEUP_TIME             GetWakeupTime;
692   EFI_SET_WAKEUP_TIME             SetWakeupTime;
693 
694   //
695   // Virtual memory services
696   //
697 
698   EFI_SET_VIRTUAL_ADDRESS_MAP     SetVirtualAddressMap;
699   EFI_CONVERT_POINTER             ConvertPointer;
700 
701   //
702   // Variable serviers
703   //
704 
705   EFI_GET_VARIABLE                GetVariable;
706   EFI_GET_NEXT_VARIABLE_NAME      GetNextVariableName;
707   EFI_SET_VARIABLE                SetVariable;
708 
709   //
710   // Misc
711   //
712 
713   EFI_GET_NEXT_HIGH_MONO_COUNT    GetNextHighMonotonicCount;
714   EFI_RESET_SYSTEM                ResetSystem;
715 
716 } EFI_RUNTIME_SERVICES;
717 
718 
719 //
720 // EFI Boot Services Table
721 //
722 
723 #define EFI_BOOT_SERVICES_SIGNATURE     0x56524553544f4f42
724 #define EFI_BOOT_SERVICES_REVISION      ((EFI_SPECIFICATION_MAJOR_REVISION<<16) | (EFI_SPECIFICATION_MINOR_REVISION))
725 
726 typedef struct {
727 
728   EFI_TABLE_HEADER                Hdr;
729 
730   //
731   // Task priority functions
732   //
733 
734   EFI_RAISE_TPL                   RaiseTPL;
735   EFI_RESTORE_TPL                 RestoreTPL;
736 
737   //
738   // Memory functions
739   //
740 
741   EFI_ALLOCATE_PAGES              AllocatePages;
742   EFI_FREE_PAGES                  FreePages;
743   EFI_GET_MEMORY_MAP              GetMemoryMap;
744   EFI_ALLOCATE_POOL               AllocatePool;
745   EFI_FREE_POOL                   FreePool;
746 
747   //
748   // Event & timer functions
749   //
750 
751   EFI_CREATE_EVENT                CreateEvent;
752   EFI_SET_TIMER                   SetTimer;
753   EFI_WAIT_FOR_EVENT              WaitForEvent;
754   EFI_SIGNAL_EVENT                SignalEvent;
755   EFI_CLOSE_EVENT                 CloseEvent;
756   EFI_CHECK_EVENT                 CheckEvent;
757 
758   //
759   // Protocol handler functions
760   //
761 
762   EFI_INSTALL_PROTOCOL_INTERFACE  InstallProtocolInterface;
763   EFI_REINSTALL_PROTOCOL_INTERFACE ReinstallProtocolInterface;
764   EFI_UNINSTALL_PROTOCOL_INTERFACE UninstallProtocolInterface;
765   EFI_HANDLE_PROTOCOL             HandleProtocol;
766   VOID                            *Reserved;
767   EFI_REGISTER_PROTOCOL_NOTIFY    RegisterProtocolNotify;
768   EFI_LOCATE_HANDLE               LocateHandle;
769   EFI_LOCATE_DEVICE_PATH          LocateDevicePath;
770   EFI_INSTALL_CONFIGURATION_TABLE InstallConfigurationTable;
771 
772   //
773   // Image functions
774   //
775 
776   EFI_IMAGE_LOAD                  LoadImage;
777   EFI_IMAGE_START                 StartImage;
778   EFI_EXIT                        Exit;
779   EFI_IMAGE_UNLOAD                UnloadImage;
780   EFI_EXIT_BOOT_SERVICES          ExitBootServices;
781 
782   //
783   // Misc functions
784   //
785 
786   EFI_GET_NEXT_MONOTONIC_COUNT    GetNextMonotonicCount;
787   EFI_STALL                       Stall;
788   EFI_SET_WATCHDOG_TIMER          SetWatchdogTimer;
789 
790   //
791   // DriverSupport Services
792   //
793   EFI_CONNECT_CONTROLLER	        ConnectController;
794   EFI_DISCONNECT_CONTROLLER       DisconnectController;
795 
796   //
797   // Open and Close Protocol Services
798   //
799   EFI_OPEN_PROTOCOL               OpenProtocol;
800   EFI_CLOSE_PROTOCOL              CloseProtocol;
801   EFI_OPEN_PROTOCOL_INFORMATION   OpenProtocolInformation;
802 
803   //
804   // Library Services to reduce size of drivers
805   //
806   EFI_PROTOCOLS_PER_HANDLE        ProtocolsPerHandle;
807   EFI_LOCATE_HANDLE_BUFFER        LocateHandleBuffer;
808   EFI_LOCATE_PROTOCOL             LocateProtocol;
809 
810   EFI_INSTALL_MULTIPLE_PROTOCOL_INTERFACES    InstallMultipleProtocolInterfaces;
811   EFI_UNINSTALL_MULTIPLE_PROTOCOL_INTERFACES  UninstallMultipleProtocolInterfaces;
812 
813   //
814   // CRC32 services
815   //
816   EFI_CALCULATE_CRC32             CalculateCrc32;
817 
818   //
819   // Memory Utility Services
820   //
821   EFI_COPY_MEM                    CopyMem;
822   EFI_SET_MEM                     SetMem;
823 
824 } EFI_BOOT_SERVICES;
825 
826 
827 //
828 // EFI Configuration Table and GUID definitions
829 //
830 
831 #define MPS_TABLE_GUID \
832     { 0xeb9d2d2f, 0x2d88, 0x11d3, {0x9a, 0x16, 0x0, 0x90, 0x27, 0x3f, 0xc1, 0x4d} }
833 
834 #define ACPI_TABLE_GUID \
835     { 0xeb9d2d30, 0x2d88, 0x11d3, {0x9a, 0x16, 0x0, 0x90, 0x27, 0x3f, 0xc1, 0x4d} }
836 
837 #define ACPI_20_TABLE_GUID \
838     { 0x8868e871, 0xe4f1, 0x11d3, {0xbc, 0x22, 0x0, 0x80, 0xc7, 0x3c, 0x88, 0x81} }
839 
840 #define SMBIOS_TABLE_GUID \
841     { 0xeb9d2d31, 0x2d88, 0x11d3, {0x9a, 0x16, 0x0, 0x90, 0x27, 0x3f, 0xc1, 0x4d} }
842 
843 #define SMBIOS3_TABLE_GUID \
844 	{ 0xf2fd1544, 0x9794, 0x4a2c, {0x99, 0x2e, 0xe5, 0xbb, 0xcf, 0x20, 0xe3, 0x94} }
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 LZMA_DECOMPRESSION_GUID \
859 	{ 0xee4e5898, 0x3914, 0x4259, {0x9d, 0x6e, 0xdc, 0x7b, 0xd7, 0x94, 0x3, 0xcf} }
860 
861 #define ARM_MP_CORE_INFO_TABLE_GUID \
862 	{ 0xa4ee0728, 0xe5d7, 0x4ac5, {0xb2, 0x1e, 0x65, 0x8e, 0xd8, 0x57, 0xe8, 0x34} }
863 
864 #define ESRT_TABLE_GUID \
865 	{ 0xb122a263, 0x3661, 0x4f68, {0x99, 0x29, 0x78, 0xf8, 0xb0, 0xd6, 0x21, 0x80} }
866 
867 #define MEMORY_TYPE_INFORMATION_TABLE_GUID \
868     { 0x4c19049f, 0x4137, 0x4dd3, {0x9c, 0x10, 0x8b, 0x97, 0xa8, 0x3f, 0xfd, 0xfa} }
869 
870 #define DEBUG_IMAGE_INFO_TABLE_GUID \
871     { 0x49152e77, 0x1ada, 0x4764, {0xb7, 0xa2, 0x7a, 0xfe, 0xfe, 0xd9, 0x5e, 0x8b} }
872 
873 typedef struct _EFI_CONFIGURATION_TABLE {
874   EFI_GUID                VendorGuid;
875   VOID                    *VendorTable;
876 } EFI_CONFIGURATION_TABLE;
877 
878 
879 //
880 // EFI System Table
881 //
882 
883 
884 
885 
886 #define EFI_SYSTEM_TABLE_SIGNATURE      0x5453595320494249
887 #define EFI_SYSTEM_TABLE_REVISION      ((EFI_SPECIFICATION_MAJOR_REVISION<<16) | (EFI_SPECIFICATION_MINOR_REVISION))
888 #define EFI_1_10_SYSTEM_TABLE_REVISION ((1<<16) | 10)
889 #define EFI_1_02_SYSTEM_TABLE_REVISION ((1<<16) | 02)
890 
891 typedef struct _EFI_SYSTEM_TABLE {
892   EFI_TABLE_HEADER                Hdr;
893 
894   CHAR16                          *FirmwareVendor;
895   UINT32                          FirmwareRevision;
896 
897   EFI_HANDLE                      ConsoleInHandle;
898   SIMPLE_INPUT_INTERFACE          *ConIn;
899 
900   EFI_HANDLE                      ConsoleOutHandle;
901   SIMPLE_TEXT_OUTPUT_INTERFACE    *ConOut;
902 
903   EFI_HANDLE                      StandardErrorHandle;
904   SIMPLE_TEXT_OUTPUT_INTERFACE    *StdErr;
905 
906   EFI_RUNTIME_SERVICES            *RuntimeServices;
907   EFI_BOOT_SERVICES               *BootServices;
908 
909   UINTN                           NumberOfTableEntries;
910   EFI_CONFIGURATION_TABLE         *ConfigurationTable;
911 
912 } EFI_SYSTEM_TABLE;
913 
914 #endif
915