Imported Upstream version 3.0
[platform/upstream/gnu-efi.git] / inc / efiapi.h
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
217 // Variable size limitation
218 #define EFI_MAXIMUM_VARIABLE_SIZE           1024
219
220 typedef
221 EFI_STATUS
222 (EFIAPI *EFI_GET_VARIABLE) (
223     IN CHAR16                       *VariableName,
224     IN EFI_GUID                     *VendorGuid,
225     OUT UINT32                      *Attributes OPTIONAL,
226     IN OUT UINTN                    *DataSize,
227     OUT VOID                        *Data
228     );
229
230 typedef
231 EFI_STATUS
232 (EFIAPI *EFI_GET_NEXT_VARIABLE_NAME) (
233     IN OUT UINTN                    *VariableNameSize,
234     IN OUT CHAR16                   *VariableName,
235     IN OUT EFI_GUID                 *VendorGuid
236     );
237
238
239 typedef
240 EFI_STATUS
241 (EFIAPI *EFI_SET_VARIABLE) (
242     IN CHAR16                       *VariableName,
243     IN EFI_GUID                     *VendorGuid,
244     IN UINT32                       Attributes,
245     IN UINTN                        DataSize,
246     IN VOID                         *Data
247     );
248
249
250 //
251 // EFI Time
252 //
253
254 typedef struct {
255         UINT32                      Resolution;     // 1e-6 parts per million
256         UINT32                      Accuracy;       // hertz
257         BOOLEAN                     SetsToZero;     // Set clears sub-second time
258 } EFI_TIME_CAPABILITIES;
259
260
261 typedef
262 EFI_STATUS
263 (EFIAPI *EFI_GET_TIME) (
264     OUT EFI_TIME                    *Time,
265     OUT EFI_TIME_CAPABILITIES       *Capabilities OPTIONAL
266     );
267
268 typedef
269 EFI_STATUS
270 (EFIAPI *EFI_SET_TIME) (
271     IN EFI_TIME                     *Time
272     );
273
274 typedef
275 EFI_STATUS
276 (EFIAPI *EFI_GET_WAKEUP_TIME) (
277     OUT BOOLEAN                     *Enabled,
278     OUT BOOLEAN                     *Pending,
279     OUT EFI_TIME                    *Time
280     );
281
282 typedef
283 EFI_STATUS
284 (EFIAPI *EFI_SET_WAKEUP_TIME) (
285     IN BOOLEAN                      Enable,
286     IN EFI_TIME                     *Time OPTIONAL
287     );
288
289
290 //
291 // Image functions
292 //
293
294
295 // PE32+ Subsystem type for EFI images
296
297 #if !defined(IMAGE_SUBSYSTEM_EFI_APPLICATION)
298 #define IMAGE_SUBSYSTEM_EFI_APPLICATION             10
299 #define IMAGE_SUBSYSTEM_EFI_BOOT_SERVICE_DRIVER     11
300 #define IMAGE_SUBSYSTEM_EFI_RUNTIME_DRIVER          12
301 #endif
302
303 // PE32+ Machine type for EFI images
304
305 #if !defined(EFI_IMAGE_MACHINE_IA32)
306 #define EFI_IMAGE_MACHINE_IA32      0x014c
307 #endif
308
309 #if !defined(EFI_IMAGE_MACHINE_IA64)
310 #define EFI_IMAGE_MACHINE_IA64      0x0200
311 #endif
312
313 // Image Entry prototype
314
315 typedef 
316 EFI_STATUS
317 (EFIAPI *EFI_IMAGE_ENTRY_POINT) (
318     IN EFI_HANDLE                   ImageHandle,
319     IN struct _EFI_SYSTEM_TABLE     *SystemTable
320     );
321
322 typedef 
323 EFI_STATUS
324 (EFIAPI *EFI_IMAGE_LOAD) (
325     IN BOOLEAN                      BootPolicy,
326     IN EFI_HANDLE                   ParentImageHandle,
327     IN EFI_DEVICE_PATH              *FilePath,
328     IN VOID                         *SourceBuffer   OPTIONAL,
329     IN UINTN                        SourceSize,
330     OUT EFI_HANDLE                  *ImageHandle
331     );
332
333 typedef 
334 EFI_STATUS
335 (EFIAPI *EFI_IMAGE_START) (
336     IN EFI_HANDLE                   ImageHandle,
337     OUT UINTN                       *ExitDataSize,
338     OUT CHAR16                      **ExitData  OPTIONAL
339     );
340
341 typedef
342 EFI_STATUS
343 (EFIAPI *EFI_EXIT) (
344     IN EFI_HANDLE                   ImageHandle,
345     IN EFI_STATUS                   ExitStatus,
346     IN UINTN                        ExitDataSize,
347     IN CHAR16                       *ExitData OPTIONAL
348     );
349
350 typedef 
351 EFI_STATUS
352 (EFIAPI *EFI_IMAGE_UNLOAD) (
353     IN EFI_HANDLE                   ImageHandle
354     );
355
356
357 // Image handle
358 #define LOADED_IMAGE_PROTOCOL      \
359     { 0x5B1B31A1, 0x9562, 0x11d2, {0x8E, 0x3F, 0x00, 0xA0, 0xC9, 0x69, 0x72, 0x3B} }
360
361 #define EFI_IMAGE_INFORMATION_REVISION      0x1000
362 typedef struct {
363     UINT32                          Revision;
364     EFI_HANDLE                      ParentHandle;
365     struct _EFI_SYSTEM_TABLE        *SystemTable;
366
367     // Source location of image
368     EFI_HANDLE                      DeviceHandle;
369     EFI_DEVICE_PATH                 *FilePath;
370     VOID                            *Reserved;
371
372     // Images load options
373     UINT32                          LoadOptionsSize;
374     VOID                            *LoadOptions;
375
376     // Location of where image was loaded
377     VOID                            *ImageBase;
378     UINT64                          ImageSize;
379     EFI_MEMORY_TYPE                 ImageCodeType;
380     EFI_MEMORY_TYPE                 ImageDataType;
381
382     // If the driver image supports a dynamic unload request
383     EFI_IMAGE_UNLOAD                Unload;
384
385 } EFI_LOADED_IMAGE;
386
387
388 typedef
389 EFI_STATUS
390 (EFIAPI *EFI_EXIT_BOOT_SERVICES) (
391     IN EFI_HANDLE                   ImageHandle,
392     IN UINTN                        MapKey
393     );
394
395 //
396 // Misc
397 //
398
399
400 typedef
401 EFI_STATUS
402 (EFIAPI *EFI_STALL) (
403     IN UINTN                    Microseconds
404     );
405
406 typedef
407 EFI_STATUS
408 (EFIAPI *EFI_SET_WATCHDOG_TIMER) (
409     IN UINTN                    Timeout,
410     IN UINT64                   WatchdogCode,
411     IN UINTN                    DataSize,
412     IN CHAR16                   *WatchdogData OPTIONAL
413     );
414
415 typedef
416 EFI_STATUS
417 (EFIAPI *EFI_CONNECT_CONTROLLER) (
418     IN EFI_HANDLE               ControllerHandle,
419     IN EFI_HANDLE               *DriverImageHandle OPTIONAL,
420     IN EFI_DEVICE_PATH          *RemainingDevicePath OPTIONAL,
421     IN BOOLEAN                  Recursive
422     );
423
424 typedef
425 EFI_STATUS
426 (EFIAPI *EFI_DISCONNECT_CONTROLLER) (
427     IN EFI_HANDLE               ControllerHandle,
428     IN EFI_HANDLE               DriverImageHandle OPTIONAL,
429     IN EFI_HANDLE               ChildHandle OPTIONAL
430     );
431
432 #define EFI_OPEN_PROTOCOL_BY_HANDLE_PROTOCOL  0x00000001
433 #define EFI_OPEN_PROTOCOL_GET_PROTOCOL        0x00000002
434 #define EFI_OPEN_PROTOCOL_TEST_PROTOCOL       0x00000004
435 #define EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER 0x00000008
436 #define EFI_OPEN_PROTOCOL_BY_DRIVER           0x00000010
437 #define EFI_OPEN_PROTOCOL_EXCLUSIVE           0x00000020
438
439 typedef
440 EFI_STATUS
441 (EFIAPI *EFI_OPEN_PROTOCOL) (
442     IN EFI_HANDLE               Handle,
443     IN EFI_GUID                 *Protocol,
444     OUT VOID                    **Interface OPTIONAL,
445     IN EFI_HANDLE               AgentHandle,
446     IN EFI_HANDLE               ControllerHandle,
447     IN UINT32                   Attributes
448     );
449
450 typedef
451 EFI_STATUS
452 (EFIAPI *EFI_CLOSE_PROTOCOL) (
453     IN EFI_HANDLE               Handle,
454     IN EFI_GUID                 *Protocol,
455     IN EFI_HANDLE               AgentHandle,
456     IN EFI_HANDLE               ControllerHandle
457     );
458
459 typedef struct {
460     EFI_HANDLE                  AgentHandle;
461     EFI_HANDLE                  ControllerHandle;
462     UINT32                      Attributes;
463     UINT32                      OpenCount;
464 } EFI_OPEN_PROTOCOL_INFORMATION_ENTRY;
465
466 typedef
467 EFI_STATUS
468 (EFIAPI *EFI_OPEN_PROTOCOL_INFORMATION) (
469     IN EFI_HANDLE               Handle,
470     IN EFI_GUID                 *Protocol,
471     OUT EFI_OPEN_PROTOCOL_INFORMATION_ENTRY **EntryBuffer,
472     OUT UINTN                   *EntryCount
473     );
474
475 typedef
476 EFI_STATUS
477 (EFIAPI *EFI_PROTOCOLS_PER_HANDLE) (
478     IN EFI_HANDLE               Handle,
479     OUT EFI_GUID                ***ProtocolBuffer,
480     OUT UINTN                   *ProtocolBufferCount
481     );
482
483 typedef enum {
484     AllHandles,
485     ByRegisterNotify,
486     ByProtocol
487 } EFI_LOCATE_SEARCH_TYPE;
488
489 typedef
490 EFI_STATUS
491 (EFIAPI *EFI_LOCATE_HANDLE_BUFFER) (
492     IN EFI_LOCATE_SEARCH_TYPE   SearchType,
493     IN EFI_GUID                 *Protocol OPTIONAL,
494     IN VOID                     *SearchKey OPTIONAL,
495     IN OUT UINTN                *NoHandles,
496     OUT EFI_HANDLE              **Buffer
497     );
498
499 typedef
500 EFI_STATUS
501 (EFIAPI *EFI_LOCATE_PROTOCOL) (
502     IN EFI_GUID                 *Protocol,
503     IN VOID                     *Registration OPTIONAL,
504     OUT VOID                    **Interface
505     );
506
507 typedef
508 EFI_STATUS
509 (EFIAPI *EFI_INSTALL_MULTIPLE_PROTOCOL_INTERFACES) (
510     IN OUT EFI_HANDLE           *Handle,
511     ...
512     );
513
514 typedef
515 EFI_STATUS
516 (EFIAPI *EFI_UNINSTALL_MULTIPLE_PROTOCOL_INTERFACES) (
517     IN OUT EFI_HANDLE           Handle,
518     ...
519     );
520
521 typedef
522 EFI_STATUS
523 (EFIAPI *EFI_CALCULATE_CRC32) (
524     IN VOID                     *Data,
525     IN UINTN                    DataSize,
526     OUT UINT32                  *Crc32
527     );
528
529 typedef
530 VOID
531 (EFIAPI *EFI_COPY_MEM) (
532     IN VOID                     *Destination,
533     IN VOID                     *Source,
534     IN UINTN                    Length
535     );
536
537 typedef
538 VOID
539 (EFIAPI *EFI_SET_MEM) (
540     IN VOID                     *Buffer,
541     IN UINTN                    Size,
542     IN UINT8                    Value
543     );
544
545
546 typedef
547 EFI_STATUS
548 (EFIAPI *EFI_CREATE_EVENT_EX) (
549     IN UINT32                   Type,
550     IN EFI_TPL                  NotifyTpl,
551     IN EFI_EVENT_NOTIFY         NotifyFunction OPTIONAL,
552     IN const VOID               *NotifyContext OPTIONAL,
553     IN const EFI_GUID           EventGroup OPTIONAL,
554     OUT EFI_EVENT               *Event
555     );
556
557 typedef enum {
558     EfiResetCold,
559     EfiResetWarm,
560     EfiResetShutdown
561 } EFI_RESET_TYPE;
562
563 typedef
564 EFI_STATUS
565 (EFIAPI *EFI_RESET_SYSTEM) (
566     IN EFI_RESET_TYPE           ResetType,
567     IN EFI_STATUS               ResetStatus,
568     IN UINTN                    DataSize,
569     IN CHAR16                   *ResetData OPTIONAL
570     );
571
572 typedef
573 EFI_STATUS
574 (EFIAPI *EFI_GET_NEXT_MONOTONIC_COUNT) (
575     OUT UINT64                  *Count
576     );
577
578 typedef
579 EFI_STATUS
580 (EFIAPI *EFI_GET_NEXT_HIGH_MONO_COUNT) (
581     OUT UINT32                  *HighCount
582     );
583
584 //
585 // Protocol handler functions
586 //
587
588 typedef enum {
589     EFI_NATIVE_INTERFACE,
590     EFI_PCODE_INTERFACE
591 } EFI_INTERFACE_TYPE;
592
593 typedef
594 EFI_STATUS
595 (EFIAPI *EFI_INSTALL_PROTOCOL_INTERFACE) (
596     IN OUT EFI_HANDLE           *Handle,
597     IN EFI_GUID                 *Protocol,
598     IN EFI_INTERFACE_TYPE       InterfaceType,
599     IN VOID                     *Interface
600     );
601
602 typedef
603 EFI_STATUS
604 (EFIAPI *EFI_REINSTALL_PROTOCOL_INTERFACE) (
605     IN EFI_HANDLE               Handle,
606     IN EFI_GUID                 *Protocol,
607     IN VOID                     *OldInterface,
608     IN VOID                     *NewInterface
609     );
610
611 typedef
612 EFI_STATUS
613 (EFIAPI *EFI_UNINSTALL_PROTOCOL_INTERFACE) (
614     IN EFI_HANDLE               Handle,
615     IN EFI_GUID                 *Protocol,
616     IN VOID                     *Interface
617     );
618
619 typedef
620 EFI_STATUS
621 (EFIAPI *EFI_HANDLE_PROTOCOL) (
622     IN EFI_HANDLE               Handle,
623     IN EFI_GUID                 *Protocol,
624     OUT VOID                    **Interface
625     );
626
627 typedef
628 EFI_STATUS 
629 (EFIAPI *EFI_REGISTER_PROTOCOL_NOTIFY) (
630     IN EFI_GUID                 *Protocol,
631     IN EFI_EVENT                Event,
632     OUT VOID                    **Registration
633     );
634
635 typedef
636 EFI_STATUS
637 (EFIAPI *EFI_LOCATE_HANDLE) (
638     IN EFI_LOCATE_SEARCH_TYPE   SearchType,
639     IN EFI_GUID                 *Protocol OPTIONAL,
640     IN VOID                     *SearchKey OPTIONAL,
641     IN OUT UINTN                *BufferSize,
642     OUT EFI_HANDLE              *Buffer
643     );
644
645 typedef
646 EFI_STATUS
647 (EFIAPI *EFI_LOCATE_DEVICE_PATH) (
648     IN EFI_GUID                 *Protocol,
649     IN OUT EFI_DEVICE_PATH      **DevicePath,
650     OUT EFI_HANDLE              *Device
651     );
652
653 typedef
654 EFI_STATUS
655 (EFIAPI *EFI_INSTALL_CONFIGURATION_TABLE) (
656     IN EFI_GUID                 *Guid,
657     IN VOID                     *Table
658     );
659
660 typedef
661 EFI_STATUS
662 (EFIAPI *EFI_RESERVED_SERVICE) (
663     );
664
665 //
666 // Standard EFI table header
667 //
668
669 typedef struct _EFI_TABLE_HEARDER {
670     UINT64                      Signature;
671     UINT32                      Revision;
672     UINT32                      HeaderSize;
673     UINT32                      CRC32;
674     UINT32                      Reserved;
675 } EFI_TABLE_HEADER;
676
677
678 //
679 // EFI Runtime Serivces Table
680 //
681
682 #define EFI_RUNTIME_SERVICES_SIGNATURE  0x56524553544e5552
683 #define EFI_RUNTIME_SERVICES_REVISION   (EFI_SPECIFICATION_MAJOR_REVISION<<16) | (EFI_SPECIFICATION_MINOR_REVISION)
684
685 typedef struct  {
686     EFI_TABLE_HEADER                Hdr;
687
688     //
689     // Time services
690     //
691
692     EFI_GET_TIME                    GetTime;
693     EFI_SET_TIME                    SetTime;
694     EFI_GET_WAKEUP_TIME             GetWakeupTime;
695     EFI_SET_WAKEUP_TIME             SetWakeupTime;
696
697     //
698     // Virtual memory services
699     //
700
701     EFI_SET_VIRTUAL_ADDRESS_MAP     SetVirtualAddressMap;
702     EFI_CONVERT_POINTER             ConvertPointer;
703
704     //
705     // Variable serviers
706     //
707
708     EFI_GET_VARIABLE                GetVariable;
709     EFI_GET_NEXT_VARIABLE_NAME      GetNextVariableName;
710     EFI_SET_VARIABLE                SetVariable;
711
712     //
713     // Misc
714     //
715
716     EFI_GET_NEXT_HIGH_MONO_COUNT    GetNextHighMonotonicCount;
717     EFI_RESET_SYSTEM                ResetSystem;
718
719 } EFI_RUNTIME_SERVICES;
720
721
722 //
723 // EFI Boot Services Table
724 //
725
726 #define EFI_BOOT_SERVICES_SIGNATURE     0x56524553544f4f42
727 #define EFI_BOOT_SERVICES_REVISION      (EFI_SPECIFICATION_MAJOR_REVISION<<16) | (EFI_SPECIFICATION_MINOR_REVISION)
728
729 typedef struct _EFI_BOOT_SERVICES {
730
731     EFI_TABLE_HEADER                Hdr;
732
733     //
734     // Task priority functions
735     //
736
737     EFI_RAISE_TPL                   RaiseTPL;
738     EFI_RESTORE_TPL                 RestoreTPL;
739
740     //
741     // Memory functions
742     //
743
744     EFI_ALLOCATE_PAGES              AllocatePages;
745     EFI_FREE_PAGES                  FreePages;
746     EFI_GET_MEMORY_MAP              GetMemoryMap;
747     EFI_ALLOCATE_POOL               AllocatePool;
748     EFI_FREE_POOL                   FreePool;
749
750     //
751     // Event & timer functions
752     //
753
754     EFI_CREATE_EVENT                CreateEvent;
755     EFI_SET_TIMER                   SetTimer;
756     EFI_WAIT_FOR_EVENT              WaitForEvent;
757     EFI_SIGNAL_EVENT                SignalEvent;
758     EFI_CLOSE_EVENT                 CloseEvent;
759     EFI_CHECK_EVENT                 CheckEvent;
760
761     //
762     // Protocol handler functions
763     //
764
765     EFI_INSTALL_PROTOCOL_INTERFACE  InstallProtocolInterface;
766     EFI_REINSTALL_PROTOCOL_INTERFACE ReinstallProtocolInterface;
767     EFI_UNINSTALL_PROTOCOL_INTERFACE UninstallProtocolInterface;
768     EFI_HANDLE_PROTOCOL             HandleProtocol;
769     EFI_HANDLE_PROTOCOL             PCHandleProtocol;
770     EFI_REGISTER_PROTOCOL_NOTIFY    RegisterProtocolNotify;
771     EFI_LOCATE_HANDLE               LocateHandle;
772     EFI_LOCATE_DEVICE_PATH          LocateDevicePath;
773     EFI_INSTALL_CONFIGURATION_TABLE InstallConfigurationTable;
774
775     //
776     // Image functions
777     //
778
779     EFI_IMAGE_LOAD                  LoadImage;
780     EFI_IMAGE_START                 StartImage;
781     EFI_EXIT                        Exit;
782     EFI_IMAGE_UNLOAD                UnloadImage;
783     EFI_EXIT_BOOT_SERVICES          ExitBootServices;
784
785     //
786     // Misc functions
787     //
788
789     EFI_GET_NEXT_MONOTONIC_COUNT    GetNextMonotonicCount;
790     EFI_STALL                       Stall;
791     EFI_SET_WATCHDOG_TIMER          SetWatchdogTimer;
792
793     //
794     // DriverSupport Services
795     //
796
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
809     //
810     EFI_PROTOCOLS_PER_HANDLE        ProtocolsPerHandle;
811     EFI_LOCATE_HANDLE_BUFFER        LocateHandleBuffer;
812     EFI_LOCATE_PROTOCOL             LocateProtocol;
813     EFI_INSTALL_MULTIPLE_PROTOCOL_INTERFACES InstallMultipleProtocolInterfaces;
814     EFI_UNINSTALL_MULTIPLE_PROTOCOL_INTERFACES UninstallMultipleProtocolInterfaces;
815
816     //
817     // 32-bit CRC Services
818     //
819     EFI_CALCULATE_CRC32             CalculateCrc32;
820
821     //
822     // Misc Services
823     //
824     EFI_COPY_MEM                    CopyMem;
825     EFI_SET_MEM                     SetMem;
826     EFI_CREATE_EVENT_EX             CreateEventEx;
827 } EFI_BOOT_SERVICES;
828
829
830 //
831 // EFI Configuration Table and GUID definitions
832 //
833
834 #define MPS_TABLE_GUID    \
835     { 0xeb9d2d2f, 0x2d88, 0x11d3, {0x9a, 0x16, 0x0, 0x90, 0x27, 0x3f, 0xc1, 0x4d} }
836
837 #define ACPI_TABLE_GUID    \
838     { 0xeb9d2d30, 0x2d88, 0x11d3, {0x9a, 0x16, 0x0, 0x90, 0x27, 0x3f, 0xc1, 0x4d} }
839
840 #define ACPI_20_TABLE_GUID  \
841     { 0x8868e871, 0xe4f1, 0x11d3, {0xbc, 0x22, 0x0, 0x80, 0xc7, 0x3c, 0x88, 0x81} }
842
843 #define SMBIOS_TABLE_GUID    \
844     { 0xeb9d2d31, 0x2d88, 0x11d3, {0x9a, 0x16, 0x0, 0x90, 0x27, 0x3f, 0xc1, 0x4d} }
845
846 #define SAL_SYSTEM_TABLE_GUID    \
847     { 0xeb9d2d32, 0x2d88, 0x11d3, {0x9a, 0x16, 0x0, 0x90, 0x27, 0x3f, 0xc1, 0x4d} }
848
849
850 typedef struct _EFI_CONFIGURATION_TABLE {
851     EFI_GUID                VendorGuid;
852     VOID                    *VendorTable;
853 } EFI_CONFIGURATION_TABLE;
854
855
856 //
857 // EFI System Table
858 //
859
860
861
862
863 #define EFI_SYSTEM_TABLE_SIGNATURE      0x5453595320494249
864 #define EFI_SYSTEM_TABLE_REVISION      (EFI_SPECIFICATION_MAJOR_REVISION<<16) | (EFI_SPECIFICATION_MINOR_REVISION)
865
866 typedef struct _EFI_SYSTEM_TABLE {
867     EFI_TABLE_HEADER                Hdr;
868
869     CHAR16                          *FirmwareVendor;
870     UINT32                          FirmwareRevision;
871
872     EFI_HANDLE                      ConsoleInHandle;
873     SIMPLE_INPUT_INTERFACE          *ConIn;
874
875     EFI_HANDLE                      ConsoleOutHandle;
876     SIMPLE_TEXT_OUTPUT_INTERFACE    *ConOut;
877
878     EFI_HANDLE                      StandardErrorHandle;
879     SIMPLE_TEXT_OUTPUT_INTERFACE    *StdErr;
880
881     EFI_RUNTIME_SERVICES            *RuntimeServices;
882     EFI_BOOT_SERVICES               *BootServices;
883
884     UINTN                           NumberOfTableEntries;
885     EFI_CONFIGURATION_TABLE         *ConfigurationTable;
886
887 } EFI_SYSTEM_TABLE;
888
889 #endif
890