]> git.proxmox.com Git - mirror_edk2.git/blame - EdkCompatibilityPkg/Foundation/Efi/Include/EfiApi.h
Update the copyright notice format
[mirror_edk2.git] / EdkCompatibilityPkg / Foundation / Efi / Include / EfiApi.h
CommitLineData
3eb9473e 1/*++\r
2\r
f57387d5
HT
3Copyright (c) 2004 - 2007, Intel Corporation. All rights reserved.<BR>\r
4This program and the accompanying materials \r
3eb9473e 5are licensed and made available under the terms and conditions of the BSD License \r
6which accompanies this distribution. The full text of the license may be found at \r
7http://opensource.org/licenses/bsd-license.php \r
8 \r
9THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, \r
10WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. \r
11\r
12Module Name:\r
13\r
14 EfiApi.h\r
15\r
16Abstract:\r
17\r
18 EFI intrinsic definitions. This includes all EFI 1.0 boot and runtime\r
19 services APIs.\r
20\r
21 Drivers and applications are passed in a pointer to the EFI system table.\r
22 The EFI system table contains pointers to the boot and runtime services\r
23 tables.\r
24\r
25--*/\r
26\r
27#ifndef _EFI_API_H_\r
28#define _EFI_API_H_\r
29\r
30#include EFI_PROTOCOL_DEFINITION (DevicePath)\r
31#include EFI_PROTOCOL_DEFINITION (SimpleTextIn)\r
32#include EFI_PROTOCOL_DEFINITION (SimpleTextOut)\r
33\r
34#if (EFI_SPECIFICATION_VERSION >= 0x00020000)\r
35#include "EfiCapsule.h"\r
36#else\r
37#include "EfiStatusCode.h"\r
38#endif\r
39\r
40//\r
41// Declare forward referenced data structures\r
42//\r
43EFI_FORWARD_DECLARATION (EFI_SYSTEM_TABLE);\r
44\r
45//\r
46// EFI Memory\r
47//\r
48typedef\r
49EFI_BOOTSERVICE\r
50EFI_STATUS\r
51(EFIAPI *EFI_ALLOCATE_PAGES) (\r
52 IN EFI_ALLOCATE_TYPE Type,\r
53 IN EFI_MEMORY_TYPE MemoryType,\r
54 IN UINTN NoPages,\r
55 OUT EFI_PHYSICAL_ADDRESS * Memory\r
56 );\r
57\r
58typedef\r
59EFI_BOOTSERVICE\r
60EFI_STATUS\r
61(EFIAPI *EFI_FREE_PAGES) (\r
62 IN EFI_PHYSICAL_ADDRESS Memory,\r
63 IN UINTN NoPages\r
64 );\r
65\r
66typedef\r
67EFI_BOOTSERVICE\r
68EFI_STATUS\r
69(EFIAPI *EFI_GET_MEMORY_MAP) (\r
70 IN OUT UINTN *MemoryMapSize,\r
71 IN OUT EFI_MEMORY_DESCRIPTOR * MemoryMap,\r
72 OUT UINTN *MapKey,\r
73 OUT UINTN *DescriptorSize,\r
74 OUT UINT32 *DescriptorVersion\r
75 );\r
76\r
77#define NextMemoryDescriptor(_Ptr, _Size) ((EFI_MEMORY_DESCRIPTOR *) (((UINT8 *) (_Ptr)) + (_Size)))\r
78#define NEXT_MEMORY_DESCRIPTOR(_Ptr, _Size) NextMemoryDescriptor (_Ptr, _Size)\r
79\r
80typedef\r
81EFI_BOOTSERVICE\r
82EFI_STATUS\r
83(EFIAPI *EFI_ALLOCATE_POOL) (\r
84 IN EFI_MEMORY_TYPE PoolType,\r
85 IN UINTN Size,\r
86 OUT VOID **Buffer\r
87 );\r
88\r
89typedef\r
90EFI_BOOTSERVICE\r
91EFI_STATUS\r
92(EFIAPI *EFI_FREE_POOL) (\r
93 IN VOID *Buffer\r
94 );\r
95\r
96typedef\r
97EFI_RUNTIMESERVICE\r
98EFI_STATUS\r
99(EFIAPI *EFI_SET_VIRTUAL_ADDRESS_MAP) (\r
100 IN UINTN MemoryMapSize,\r
101 IN UINTN DescriptorSize,\r
102 IN UINT32 DescriptorVersion,\r
103 IN EFI_MEMORY_DESCRIPTOR * VirtualMap\r
104 );\r
105\r
106typedef\r
107EFI_BOOTSERVICE11\r
108EFI_STATUS\r
109(EFIAPI *EFI_CONNECT_CONTROLLER) (\r
110 IN EFI_HANDLE ControllerHandle,\r
111 IN EFI_HANDLE * DriverImageHandle OPTIONAL,\r
112 IN EFI_DEVICE_PATH_PROTOCOL * RemainingDevicePath OPTIONAL,\r
113 IN BOOLEAN Recursive\r
114 );\r
115\r
116typedef\r
117EFI_BOOTSERVICE11\r
118EFI_STATUS\r
119(EFIAPI *EFI_DISCONNECT_CONTROLLER) (\r
120 IN EFI_HANDLE ControllerHandle,\r
121 IN EFI_HANDLE DriverImageHandle, OPTIONAL\r
122 IN EFI_HANDLE ChildHandle OPTIONAL\r
123 );\r
124\r
125//\r
126// ConvertPointer DebugDisposition type.\r
127//\r
128#define EFI_OPTIONAL_POINTER 0x00000001\r
129\r
130typedef\r
131EFI_RUNTIMESERVICE\r
132EFI_STATUS\r
133(EFIAPI *EFI_CONVERT_POINTER) (\r
134 IN UINTN DebugDisposition,\r
135 IN OUT VOID **Address\r
136 );\r
137\r
138//\r
139// EFI Event Types\r
140//\r
141#define EFI_EVENT_TIMER 0x80000000\r
142#define EFI_EVENT_RUNTIME 0x40000000\r
143#define EFI_EVENT_RUNTIME_CONTEXT 0x20000000\r
144\r
145#define EFI_EVENT_NOTIFY_WAIT 0x00000100\r
146#define EFI_EVENT_NOTIFY_SIGNAL 0x00000200\r
147\r
148#define EFI_EVENT_SIGNAL_EXIT_BOOT_SERVICES 0x00000201\r
149#define EFI_EVENT_SIGNAL_VIRTUAL_ADDRESS_CHANGE 0x60000202\r
150\r
151#define EFI_EVENT_EFI_SIGNAL_MASK 0x000000FF\r
152#define EFI_EVENT_EFI_SIGNAL_MAX 4\r
153\r
154typedef\r
155VOID\r
156(EFIAPI *EFI_EVENT_NOTIFY) (\r
157 IN EFI_EVENT Event,\r
158 IN VOID *Context\r
159 );\r
160\r
161typedef\r
162EFI_BOOTSERVICE\r
163EFI_STATUS\r
164(EFIAPI *EFI_CREATE_EVENT) (\r
165 IN UINT32 Type,\r
166 IN EFI_TPL NotifyTpl,\r
167 IN EFI_EVENT_NOTIFY NotifyFunction,\r
168 IN VOID *NotifyContext,\r
169 OUT EFI_EVENT * Event\r
170 );\r
171\r
172typedef\r
173EFI_BOOTSERVICE\r
174EFI_STATUS\r
175(EFIAPI *EFI_CREATE_EVENT_EX) (\r
176 IN UINT32 Type,\r
177 IN EFI_TPL NotifyTpl OPTIONAL,\r
178 IN EFI_EVENT_NOTIFY NotifyFunction OPTIONAL,\r
179 IN CONST VOID *NotifyContext OPTIONAL,\r
180 IN CONST EFI_GUID *EventGroup OPTIONAL,\r
181 OUT EFI_EVENT *Event\r
182 );\r
183\r
184typedef enum {\r
185 TimerCancel,\r
186 TimerPeriodic,\r
187 TimerRelative,\r
188 TimerTypeMax\r
189} EFI_TIMER_DELAY;\r
190\r
191typedef\r
192EFI_BOOTSERVICE\r
193EFI_STATUS\r
194(EFIAPI *EFI_SET_TIMER) (\r
195 IN EFI_EVENT Event,\r
196 IN EFI_TIMER_DELAY Type,\r
197 IN UINT64 TriggerTime\r
198 );\r
199\r
200typedef\r
201EFI_BOOTSERVICE\r
202EFI_STATUS\r
203(EFIAPI *EFI_SIGNAL_EVENT) (\r
204 IN EFI_EVENT Event\r
205 );\r
206\r
207typedef\r
208EFI_BOOTSERVICE\r
209EFI_STATUS\r
210(EFIAPI *EFI_WAIT_FOR_EVENT) (\r
211 IN UINTN NumberOfEvents,\r
212 IN EFI_EVENT * Event,\r
213 OUT UINTN *Index\r
214 );\r
215\r
216typedef\r
217EFI_BOOTSERVICE\r
218EFI_STATUS\r
219(EFIAPI *EFI_CLOSE_EVENT) (\r
220 IN EFI_EVENT Event\r
221 );\r
222\r
223typedef\r
224EFI_BOOTSERVICE\r
225EFI_STATUS\r
226(EFIAPI *EFI_CHECK_EVENT) (\r
227 IN EFI_EVENT Event\r
228 );\r
229\r
230//\r
231// Task priority level\r
232//\r
233#define EFI_TPL_APPLICATION 4\r
234#define EFI_TPL_CALLBACK 8\r
235#define EFI_TPL_NOTIFY 16\r
236#define EFI_TPL_HIGH_LEVEL 31\r
237\r
238typedef\r
239EFI_BOOTSERVICE\r
240EFI_TPL\r
241(EFIAPI *EFI_RAISE_TPL) (\r
242 IN EFI_TPL NewTpl\r
243 );\r
244\r
245typedef\r
246EFI_BOOTSERVICE\r
247VOID\r
248(EFIAPI *EFI_RESTORE_TPL) (\r
249 IN EFI_TPL OldTpl\r
250 );\r
251\r
252//\r
253// Variable attributes\r
254//\r
255#define EFI_VARIABLE_NON_VOLATILE 0x00000001\r
256#define EFI_VARIABLE_BOOTSERVICE_ACCESS 0x00000002\r
257#define EFI_VARIABLE_RUNTIME_ACCESS 0x00000004\r
258\r
259#if (EFI_SPECIFICATION_VERSION >= 0x0002000A)\r
260#define EFI_VARIABLE_HARDWARE_ERROR_RECORD 0x00000008\r
261#endif\r
262\r
263typedef\r
264EFI_RUNTIMESERVICE\r
265EFI_STATUS\r
266(EFIAPI *EFI_GET_VARIABLE) (\r
267 IN CHAR16 *VariableName,\r
268 IN EFI_GUID * VendorGuid,\r
269 OUT UINT32 *Attributes OPTIONAL,\r
270 IN OUT UINTN *DataSize,\r
271 OUT VOID *Data\r
272 );\r
273\r
274typedef\r
275EFI_RUNTIMESERVICE\r
276EFI_STATUS\r
277(EFIAPI *EFI_GET_NEXT_VARIABLE_NAME) (\r
278 IN OUT UINTN *VariableNameSize,\r
279 IN OUT CHAR16 *VariableName,\r
280 IN OUT EFI_GUID * VendorGuid\r
281 );\r
282\r
283typedef\r
284EFI_RUNTIMESERVICE\r
285EFI_STATUS\r
286(EFIAPI *EFI_SET_VARIABLE) (\r
287 IN CHAR16 *VariableName,\r
288 IN EFI_GUID * VendorGuid,\r
289 IN UINT32 Attributes,\r
290 IN UINTN DataSize,\r
291 IN VOID *Data\r
292 );\r
293\r
294//\r
295// EFI Time\r
296//\r
297typedef struct {\r
298 UINT32 Resolution;\r
299 UINT32 Accuracy;\r
300 BOOLEAN SetsToZero;\r
301} EFI_TIME_CAPABILITIES;\r
302\r
303typedef\r
304EFI_RUNTIMESERVICE\r
305EFI_STATUS\r
306(EFIAPI *EFI_GET_TIME) (\r
307 OUT EFI_TIME * Time,\r
308 OUT EFI_TIME_CAPABILITIES * Capabilities OPTIONAL\r
309 );\r
310\r
311typedef\r
312EFI_RUNTIMESERVICE\r
313EFI_STATUS\r
314(EFIAPI *EFI_SET_TIME) (\r
315 IN EFI_TIME * Time\r
316 );\r
317\r
318typedef\r
319EFI_RUNTIMESERVICE\r
320EFI_STATUS\r
321(EFIAPI *EFI_GET_WAKEUP_TIME) (\r
322 OUT BOOLEAN *Enabled,\r
323 OUT BOOLEAN *Pending,\r
324 OUT EFI_TIME * Time\r
325 );\r
326\r
327typedef\r
328EFI_RUNTIMESERVICE\r
329EFI_STATUS\r
330(EFIAPI *EFI_SET_WAKEUP_TIME) (\r
331 IN BOOLEAN Enable,\r
332 IN EFI_TIME * Time OPTIONAL\r
333 );\r
334\r
335//\r
336// Image Entry prototype\r
337//\r
338typedef\r
339EFI_STATUS\r
340(EFIAPI *EFI_IMAGE_ENTRY_POINT) (\r
341 IN EFI_HANDLE ImageHandle,\r
342 IN EFI_SYSTEM_TABLE * SystemTable\r
343 );\r
344\r
345//\r
346// Image functions\r
347//\r
348typedef\r
349EFI_BOOTSERVICE\r
350EFI_STATUS\r
351(EFIAPI *EFI_IMAGE_LOAD) (\r
352 IN BOOLEAN BootPolicy,\r
353 IN EFI_HANDLE ParentImageHandle,\r
354 IN EFI_DEVICE_PATH_PROTOCOL * FilePath,\r
355 IN VOID *SourceBuffer OPTIONAL,\r
356 IN UINTN SourceSize,\r
357 OUT EFI_HANDLE * ImageHandle\r
358 );\r
359\r
360typedef\r
361EFI_BOOTSERVICE\r
362EFI_STATUS\r
363(EFIAPI *EFI_IMAGE_START) (\r
364 IN EFI_HANDLE ImageHandle,\r
365 OUT UINTN *ExitDataSize,\r
366 OUT CHAR16 **ExitData OPTIONAL\r
367 );\r
368\r
369typedef\r
370EFI_BOOTSERVICE\r
371EFI_STATUS\r
372(EFIAPI *EFI_EXIT) (\r
373 IN EFI_HANDLE ImageHandle,\r
374 IN EFI_STATUS ExitStatus,\r
375 IN UINTN ExitDataSize,\r
376 IN CHAR16 *ExitData OPTIONAL\r
377 );\r
378\r
379typedef\r
380EFI_BOOTSERVICE\r
381EFI_STATUS\r
382(EFIAPI *EFI_IMAGE_UNLOAD) (\r
383 IN EFI_HANDLE ImageHandle\r
384 );\r
385\r
386typedef\r
387EFI_BOOTSERVICE\r
388EFI_STATUS\r
389(EFIAPI *EFI_EXIT_BOOT_SERVICES) (\r
390 IN EFI_HANDLE ImageHandle,\r
391 IN UINTN MapKey\r
392 );\r
393\r
394//\r
395// Misc\r
396//\r
397typedef\r
398EFI_BOOTSERVICE\r
399EFI_STATUS\r
400(EFIAPI *EFI_STALL) (\r
401 IN UINTN Microseconds\r
402 );\r
403\r
404typedef\r
405EFI_BOOTSERVICE\r
406EFI_STATUS\r
407(EFIAPI *EFI_SET_WATCHDOG_TIMER) (\r
408 IN UINTN Timeout,\r
409 IN UINT64 WatchdogCode,\r
410 IN UINTN DataSize,\r
411 IN CHAR16 *WatchdogData OPTIONAL\r
412 );\r
413\r
414typedef enum {\r
415 EfiResetCold,\r
416 EfiResetWarm,\r
4cb43192 417 EfiResetShutdown\r
3eb9473e 418\r
419#if ((TIANO_RELEASE_VERSION != 0) && (EFI_SPECIFICATION_VERSION < 0x00020000))\r
4cb43192 420 , EfiResetUpdate\r
3eb9473e 421#endif\r
422\r
423} EFI_RESET_TYPE;\r
424\r
425typedef\r
426EFI_RUNTIMESERVICE\r
427VOID\r
428(EFIAPI *EFI_RESET_SYSTEM) (\r
429 IN EFI_RESET_TYPE ResetType,\r
430 IN EFI_STATUS ResetStatus,\r
431 IN UINTN DataSize,\r
432 IN CHAR16 *ResetData OPTIONAL\r
433 );\r
434\r
435typedef\r
436EFI_BOOTSERVICE\r
437EFI_STATUS\r
438(EFIAPI *EFI_GET_NEXT_MONOTONIC_COUNT) (\r
439 OUT UINT64 *Count\r
440 );\r
441\r
442typedef\r
443EFI_RUNTIMESERVICE\r
444EFI_STATUS\r
445(EFIAPI *EFI_GET_NEXT_HIGH_MONO_COUNT) (\r
446 OUT UINT32 *HighCount\r
447 );\r
448\r
449typedef\r
450EFI_BOOTSERVICE\r
451EFI_STATUS\r
452(EFIAPI *EFI_CALCULATE_CRC32) (\r
453 IN VOID *Data,\r
454 IN UINTN DataSize,\r
455 OUT UINT32 *Crc32\r
456 );\r
457\r
458typedef\r
459EFI_BOOTSERVICE\r
460VOID\r
461(EFIAPI *EFI_COPY_MEM) (\r
462 IN VOID *Destination,\r
463 IN VOID *Source,\r
464 IN UINTN Length\r
465 );\r
466\r
467typedef\r
468EFI_BOOTSERVICE\r
469VOID\r
470(EFIAPI *EFI_SET_MEM) (\r
471 IN VOID *Buffer,\r
472 IN UINTN Size,\r
473 IN UINT8 Value\r
474 );\r
475\r
476//\r
477// Protocol handler functions\r
478//\r
479typedef enum {\r
480 EFI_NATIVE_INTERFACE\r
481} EFI_INTERFACE_TYPE;\r
482\r
483typedef\r
484EFI_BOOTSERVICE\r
485EFI_STATUS\r
486(EFIAPI *EFI_INSTALL_PROTOCOL_INTERFACE) (\r
487 IN OUT EFI_HANDLE * Handle,\r
488 IN EFI_GUID * Protocol,\r
489 IN EFI_INTERFACE_TYPE InterfaceType,\r
490 IN VOID *Interface\r
491 );\r
492\r
493typedef\r
494EFI_BOOTSERVICE11\r
495EFI_STATUS\r
496(EFIAPI *EFI_INSTALL_MULTIPLE_PROTOCOL_INTERFACES) (\r
497 IN OUT EFI_HANDLE * Handle,\r
498 ...\r
499 );\r
500\r
501typedef\r
502EFI_BOOTSERVICE\r
503EFI_STATUS\r
504(EFIAPI *EFI_REINSTALL_PROTOCOL_INTERFACE) (\r
505 IN EFI_HANDLE Handle,\r
506 IN EFI_GUID * Protocol,\r
507 IN VOID *OldInterface,\r
508 IN VOID *NewInterface\r
509 );\r
510\r
511typedef\r
512EFI_BOOTSERVICE\r
513EFI_STATUS\r
514(EFIAPI *EFI_UNINSTALL_PROTOCOL_INTERFACE) (\r
515 IN EFI_HANDLE Handle,\r
516 IN EFI_GUID * Protocol,\r
517 IN VOID *Interface\r
518 );\r
519\r
520typedef\r
521EFI_BOOTSERVICE11\r
522EFI_STATUS\r
523(EFIAPI *EFI_UNINSTALL_MULTIPLE_PROTOCOL_INTERFACES) (\r
524 IN EFI_HANDLE Handle,\r
525 ...\r
526 );\r
527\r
528typedef\r
529EFI_BOOTSERVICE\r
530EFI_STATUS\r
531(EFIAPI *EFI_HANDLE_PROTOCOL) (\r
532 IN EFI_HANDLE Handle,\r
533 IN EFI_GUID * Protocol,\r
534 OUT VOID **Interface\r
535 );\r
536\r
537#define EFI_OPEN_PROTOCOL_BY_HANDLE_PROTOCOL 0x00000001\r
538#define EFI_OPEN_PROTOCOL_GET_PROTOCOL 0x00000002\r
539#define EFI_OPEN_PROTOCOL_TEST_PROTOCOL 0x00000004\r
540#define EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER 0x00000008\r
541#define EFI_OPEN_PROTOCOL_BY_DRIVER 0x00000010\r
542#define EFI_OPEN_PROTOCOL_EXCLUSIVE 0x00000020\r
543\r
544//\r
545// ///////////////////////////////////////////////////////////////////////////////////////////////\r
546// OpenProtocol() Attribute Values\r
547/////////////////////////////////////////////////////////////////////////////////////////////////\r
548// BY_HANDLE_PROTOCOL - Used by EFI 1.0 Drivers and Applications\r
549// May not actually add an elemnt to the open list in a production build\r
550//\r
551// GET_PROTOCOL - Used by EFI 1.1 Drivers to get a protocol interface\r
552// May not actually add an elemnt to the open list in a production build\r
553//\r
554// TEST_PROTOCOL - Used by EFI 1.1 Drivers to test for the existence of a protocol interface\r
555// The interface is not returned, and it is an optional parameter tham may be NULL.\r
556// May not actually add an elemnt to the open list in a production build\r
557//\r
558// BY_DRIVER - Used by EFI 1.1 Drivers that are able to share a protocol with other\r
559// agents other than its children. A driver is always able to share\r
560// a protocol with its children, since the driver is in control of the\r
561// parent controller's and the child controller's use of the protocol.\r
562//\r
563// BY_DRIVER | EXCLUSIVE - Used by EFI 1.1 Drivers that will not share a protocol with any other\r
564// agents except its children. A driver is always able to share\r
565// a protocol with its children, since the driver is in control of the\r
566// parent controller's and the child controller's use of the protocol.\r
567// This attribute will force all other drivers to disconnect from the protocol\r
568// before this driver attaches. When this driver closes the handle, the other\r
569// drivers will reconnect to the protocol.\r
570//\r
571//\r
572// BY_CHILD_CONTROLLER - Used by EFI 1.1 Driver to show that a protocol is consumed by a child\r
573// of the driver. This is information used by DisconnectController() to\r
574// determine the list of children that a protocol has. It has\r
575// no affect on the OpenProtocol()/ClosePrototocol() behavior.\r
576//\r
577// EXCLUSIVE - Used by EFI 1.1 Applications to gain exclusive access to a protocol.\r
578// All drivers are disconnected from the handle while the application has\r
579// the handle open. These drivers are reconnected when the application\r
580// closes the handle.\r
581//\r
582/////////////////////////////////////////////////////////////////////////////////////////////////\r
583// OpenProtocol() behavior based on Attribute values\r
584/////////////////////////////////////////////////////////////////////////////////////////////////\r
585//\r
586// OpenProtocol (Handle, Protocol, Interface, ImageHandle, DeviceHandle, Attributes)\r
587// * EFI_UNSUPPORTED if Protocol does not exist on Handle\r
588// * EFI_INVALID_PARAMETER if Handle is not a valid handle.\r
589// * EFI_INVALID_PARAMETER if Protocol is NULL or not a valid GUID\r
590// * EFI_INVALID_PARAMETER if Interface is NULL\r
591// * EFI_INVALID_PARAMETER if Attributes is not one of the following values:\r
592// BY_HANDLE_PROTOCOL\r
593// GET_PROTOCOL\r
594// TEST_PROTOCOL\r
595// BY_CHILD_CONTROLLER\r
596// BY_DRIVER\r
597// BY_DRIVER | EXCLUSIVE\r
598// EXCLUSIVE\r
599// * EFI_INVALID_PARAMETER if Attributes BY_CHILD_CONTROLLER and ImageHandle is not a valid handle\r
600// * EFI_INVALID_PARAMETER if Attributes BY_CHILD_CONTROLLER and DeviceHandle is not a valid handle\r
601// * EFI_INVALID_PARAMETER if Attributes BY_CHILD_CONTROLLER and Handle == DeviceHandle\r
602// * EFI_INVALID_PARAMETER if Attributes BY_DRIVER and ImageHandle is not a valid handle\r
603// * EFI_INVALID_PARAMETER if Attributes BY_DRIVER and DeviceHandle is not a valid handle\r
604// * EFI_INVALID_PARAMETER if Attributes BY_DRIVER | EXCLUSIVE and ImageHandle is not a valid handle\r
605// * EFI_INVALID_PARAMETER if Attributes BY_DRIVER | EXCLUSIVE and DeviceHandle is not a valid handle\r
606// * EFI_INVALID_PARAMETER if Attributes EXCLUSIVE and ImageHandle is not a valid handle\r
607//\r
608// OpenProtocol() Attributes = BY_HANDLE_PROTOCOL, GET_PROTOCOL, TEST_PROTOCOL, BY_CHILD_CONTROLLER\r
609// * EFI_SUCCESS if Protocol exists on the Handle\r
610//\r
611// OpenProtocol() Attributes = BY_DRIVER\r
612// * EFI_SUCCESS if there are no items in the Open List for (Handle, Protocol)\r
613// * EFI_SUCCESS if there are only items in the Open List for (Handle, Protocol)\r
614// that have the one of the following Attributes\r
615// BY_HANDLE_PROTOCOL\r
616// GET_PROTOCOL\r
617// TEST_PROTOCOL\r
618// BY_CHILD_CONTROLLER\r
619// * EFI_ACCESS_DENIED if there are any items in the Open List for (Handle, Protocol)\r
620// that have the one of the following Attributes\r
621// BY_DRIVER\r
622// AND ImageHandle != OpenListItem.IH\r
623// * EFI_ALREADY_STARTED if there are any items in the Open List for (Handle, Protocol)\r
624// that have the one of the following Attributes\r
625// BY_DRIVER\r
626// AND ImageHandle == OpenListItem.IH\r
627// * EFI_ACCESS_DENIED if there are any items in the Open List for (Handle, Protocol)\r
628// that have the one of the following Attributes\r
629// BY_DRIVER | EXCLUSIVE\r
630// EXCLUSIVE\r
631//\r
632// OpenProtocol() Attributes = BY_DRIVER | EXCLUSIVE\r
633// * EFI_SUCCESS if there are no items in the Open List for (Handle, Protocol)\r
634// * EFI_SUCCESS if there are only items in the Open List for (Handle, Protocol)\r
635// that have the one of the following Attributes\r
636// BY_HANDLE_PROTOCOL\r
637// GET_PROTOCOL\r
638// TEST_PROTOCOL\r
639// BY_CHILD_CONTROLLER\r
640// * EFI_SUCCESS if there are any items in the Open List for (Handle, Protocol)\r
641// that have the one of the following Attributes\r
642// BY_DRIVER\r
643// AND the driver is removed by DisconnectController(IH,DH)\r
644// * EFI_ALREADY_STARTED if there are any items in the Open List for (Handle, Protocol)\r
645// that have the one of the following Attributes\r
646// BY_DRIVER | EXCLUSIVE\r
647// AND ImageHandle == OpenListItem.IH\r
648// * EFI_ACCESS_DENIED if there are any items in the Open List for (Handle, Protocol)\r
649// that have the one of the following Attributes\r
650// BY_DRIVER\r
651// AND the driver can not be removed by DisconnectController(IH,DH)\r
652// * EFI_ACCESS_DENIED if there are any items in the Open List for (Handle, Protocol)\r
653// that have the one of the following Attributes\r
654// BY_DRIVER | EXCLUSIVE\r
655// EXCLUSIVE\r
656//\r
657// OpenProtocol() Attributes = EXCLUSIVE\r
658// * EFI_SUCCESS if there are no items in the Open List for (Handle, Protocol)\r
659// * EFI_SUCCESS if there are only items in the Open List for (Handle, Protocol)\r
660// that have the one of the following Attributes\r
661// BY_HANDLE_PROTOCOL\r
662// GET_PROTOCOL\r
663// TEST_PROTOCOL\r
664// BY_CHILD_CONTROLLER\r
665// * EFI_SUCCESS if there are any items in the Open List for (Handle, Protocol)\r
666// that have the one of the following Attributes\r
667// BY_DRIVER\r
668// AND the driver is removed by DisconnectController(IH,DH)\r
669// * EFI_ACCESS_DENIED if there are any items in the Open List for (Handle, Protocol)\r
670// that have the one of the following Attributes\r
671// BY_DRIVER\r
672// AND the driver can not be removed by DisconnectController(IH,DH)\r
673// * EFI_ACCESS_DENIED if there are any items in the Open List for (Handle, Protocol)\r
674// that have the one of the following Attributes\r
675// BY_DRIVER | EXCLUSIVE\r
676// EXCLUSIVE\r
677//\r
678/////////////////////////////////////////////////////////////////////////////////////////////////\r
679// CloseProtocol() Behavior based on the Attributes of the item being closed and the items\r
680// remaining on the Open List\r
681/////////////////////////////////////////////////////////////////////////////////////////////////\r
682// CloseProtocol(Handle, Protocol, ImageHandle, DeviceHandle)\r
683// CloseProtocol() Attributes of item = BY_HANDLE_PROTOCOL,\r
684// GET_PROTOCOL\r
685// TEST_PROTOCOL\r
686// BY_CHILD_CONTROLLER,\r
687// BY_DRIVER\r
688// BY_DRIVER | EXCLUSIVE\r
689// EXCLUSIVE\r
690// EFI_NOT_FOUND if Protocol does not exist on Handle\r
691// EFI_INVALID_PARAMETER if Handle is not a valid handle.\r
692// EFI_INVALID_PARAMETER if Protocol is NULL or not a valid GUID\r
693// EFI_INVALID_PARAMETER if ImageHandle is not a valid handle\r
694// EFI_INVALID_PARAMETER if DeviceHandle is not a valid handle\r
695// EFI_NOT_FOUND if (ImageHandle, DeviceHandle) is not present in the Open List\r
696// for (Handle, Protocol)\r
697// EFI_ACCESS_DENIED if (ImageHandle, DeviceHandle) is present in the Open List\r
698// for (Handle, Protocol), but the item can not be removed.\r
699// EFI_SUCCESS if (ImageHandle, DeviceHandle) is present in the Open List\r
700// for (Handle, Protocol), and the item can be removed.\r
701//\r
702/////////////////////////////////////////////////////////////////////////////////////////////////\r
703// UninstallProtocolInterface() behavior\r
704/////////////////////////////////////////////////////////////////////////////////////////////////\r
705//\r
706// UninstallProtocolInterface (Handle, Protocol, Interface)\r
707//\r
708// EFI_INVALID_PARAMETER if Handle is not a valid handle.\r
709// EFI_INVALID_PARAMETER if Protocol is not a vlaid GUID\r
710// EFI_NOT_FOUND if Handle doe not support Protocol\r
711// EFI_NOT_FOUND if the interface for (Handle, Protocol) does not match Interface\r
712// EFI_ACCESS_DENIED if the list of Open Items for (Handle, Protocol) can not be removed\r
713// EFI_SUCCESS if the list of Open Items is empty, and Protocol is removed from Handle\r
714//\r
715// Algorithm to remove Open Item List:\r
716//\r
717// Loop through all Open Item List entries\r
718// if (OpenItem.Attributes & BY_DRIVER) then\r
719// DisconnectController (OpenItem.IH, OpenItem.DH)\r
720// end if\r
721// end loop\r
722// Loop through all Open Item List entries\r
723// if (OpenItem.Attributes & BY_HANDLE_PROTOCOL or GET_PROTOCOL or TEST_PROTOCOL) then\r
724// CloseProtocol (Handle, Protocol, OpenItem.IH, OpenItem.DH)\r
725// end if\r
726// end loop\r
727// if Open Item List is empty then remove Protocol from Handle and return EFI_SUCCESS\r
728// if Open Item List is not empty then return EFI_ACCESS_DENIED\r
729//\r
730/////////////////////////////////////////////////////////////////////////////////////////////////\r
731typedef\r
732EFI_BOOTSERVICE11\r
733EFI_STATUS\r
734(EFIAPI *EFI_OPEN_PROTOCOL) (\r
735 IN EFI_HANDLE Handle,\r
736 IN EFI_GUID * Protocol,\r
737 OUT VOID **Interface,\r
738 IN EFI_HANDLE ImageHandle,\r
739 IN EFI_HANDLE ControllerHandle, OPTIONAL\r
740 IN UINT32 Attributes\r
741 );\r
742\r
743typedef\r
744EFI_BOOTSERVICE11\r
745EFI_STATUS\r
746(EFIAPI *EFI_CLOSE_PROTOCOL) (\r
747 IN EFI_HANDLE Handle,\r
748 IN EFI_GUID * Protocol,\r
749 IN EFI_HANDLE ImageHandle,\r
750 IN EFI_HANDLE DeviceHandle\r
751 );\r
752\r
753typedef struct {\r
754 EFI_HANDLE AgentHandle;\r
755 EFI_HANDLE ControllerHandle;\r
756 UINT32 Attributes;\r
757 UINT32 OpenCount;\r
758} EFI_OPEN_PROTOCOL_INFORMATION_ENTRY;\r
759\r
760typedef\r
761EFI_BOOTSERVICE11\r
762EFI_STATUS\r
763(EFIAPI *EFI_OPEN_PROTOCOL_INFORMATION) (\r
764 IN EFI_HANDLE UserHandle,\r
765 IN EFI_GUID * Protocol,\r
766 IN EFI_OPEN_PROTOCOL_INFORMATION_ENTRY **EntryBuffer,\r
767 OUT UINTN *EntryCount\r
768 );\r
769\r
770typedef\r
771EFI_BOOTSERVICE11\r
772EFI_STATUS\r
773(EFIAPI *EFI_PROTOCOLS_PER_HANDLE) (\r
774 IN EFI_HANDLE UserHandle,\r
775 OUT EFI_GUID ***ProtocolBuffer,\r
776 OUT UINTN *ProtocolBufferCount\r
777 );\r
778\r
779typedef\r
780EFI_BOOTSERVICE\r
781EFI_STATUS\r
782(EFIAPI *EFI_REGISTER_PROTOCOL_NOTIFY) (\r
783 IN EFI_GUID * Protocol,\r
784 IN EFI_EVENT Event,\r
785 OUT VOID **Registration\r
786 );\r
787\r
788typedef enum {\r
789 AllHandles,\r
790 ByRegisterNotify,\r
791 ByProtocol\r
792} EFI_LOCATE_SEARCH_TYPE;\r
793\r
794typedef\r
795EFI_BOOTSERVICE\r
796EFI_STATUS\r
797(EFIAPI *EFI_LOCATE_HANDLE) (\r
798 IN EFI_LOCATE_SEARCH_TYPE SearchType,\r
799 IN EFI_GUID * Protocol OPTIONAL,\r
800 IN VOID *SearchKey OPTIONAL,\r
801 IN OUT UINTN *BufferSize,\r
802 OUT EFI_HANDLE * Buffer\r
803 );\r
804\r
805typedef\r
806EFI_BOOTSERVICE\r
807EFI_STATUS\r
808(EFIAPI *EFI_LOCATE_DEVICE_PATH) (\r
809 IN EFI_GUID * Protocol,\r
810 IN OUT EFI_DEVICE_PATH_PROTOCOL **DevicePath,\r
811 OUT EFI_HANDLE * Device\r
812 );\r
813\r
814typedef\r
815EFI_BOOTSERVICE\r
816EFI_STATUS\r
817(EFIAPI *EFI_INSTALL_CONFIGURATION_TABLE) (\r
818 IN EFI_GUID * Guid,\r
819 IN VOID *Table\r
820 );\r
821\r
822typedef\r
823EFI_BOOTSERVICE\r
824EFI_STATUS\r
825(EFIAPI *EFI_RESERVED_SERVICE) (\r
826 VOID\r
827 );\r
828\r
829typedef\r
830EFI_BOOTSERVICE11\r
831EFI_STATUS\r
832(EFIAPI *EFI_LOCATE_HANDLE_BUFFER) (\r
833 IN EFI_LOCATE_SEARCH_TYPE SearchType,\r
834 IN EFI_GUID * Protocol OPTIONAL,\r
835 IN VOID *SearchKey OPTIONAL,\r
836 IN OUT UINTN *NumberHandles,\r
837 OUT EFI_HANDLE **Buffer\r
838 );\r
839\r
840typedef\r
841EFI_BOOTSERVICE11\r
842EFI_STATUS\r
843(EFIAPI *EFI_LOCATE_PROTOCOL) (\r
844 EFI_GUID * Protocol,\r
845 VOID *Registration, OPTIONAL\r
846 VOID **Interface\r
847 );\r
848\r
849//\r
850// Definition of Status Code extended data header\r
851//\r
852// HeaderSize The size of the architecture. This is specified to enable\r
853// the future expansion\r
854//\r
855// Size The size of the data in bytes. This does not include the size\r
856// of the header structure.\r
857//\r
858// Type A GUID defining the type of the data\r
859//\r
860//\r
861#if ((TIANO_RELEASE_VERSION != 0) && (EFI_SPECIFICATION_VERSION < 0x00020000))\r
862\r
863typedef\r
864EFI_RUNTIMESERVICE\r
865EFI_STATUS\r
866(EFIAPI *EFI_REPORT_STATUS_CODE) (\r
867 IN EFI_STATUS_CODE_TYPE Type,\r
868 IN EFI_STATUS_CODE_VALUE Value,\r
869 IN UINT32 Instance,\r
870 IN EFI_GUID * CallerId OPTIONAL,\r
871 IN EFI_STATUS_CODE_DATA * Data OPTIONAL\r
872 );\r
873\r
874#endif\r
875\r
876#if (EFI_SPECIFICATION_VERSION >= 0x00020000)\r
877\r
878typedef\r
879EFI_RUNTIMESERVICE\r
880EFI_STATUS\r
881(EFIAPI *EFI_UPDATE_CAPSULE) (\r
882 IN EFI_CAPSULE_HEADER **CapsuleHeaderArray,\r
883 IN UINTN CapsuleCount,\r
884 IN EFI_PHYSICAL_ADDRESS ScatterGatherList OPTIONAL\r
885 );\r
886\r
887\r
888typedef\r
889EFI_RUNTIMESERVICE\r
890EFI_STATUS\r
891(EFIAPI *EFI_QUERY_CAPSULE_CAPABILITIES) (\r
892 IN EFI_CAPSULE_HEADER **CapsuleHeaderArray,\r
893 IN UINTN CapsuleCount,\r
894 OUT UINT64 *MaxiumCapsuleSize,\r
895 OUT EFI_RESET_TYPE *ResetType\r
896);\r
897\r
898typedef\r
899EFI_RUNTIMESERVICE\r
900EFI_STATUS\r
901(EFIAPI *EFI_QUERY_VARIABLE_INFO) (\r
902 IN UINT32 Attributes,\r
903 OUT UINT64 *MaximumVariableStorageSize,\r
904 OUT UINT64 *RemainingVariableStorageSize,\r
905 OUT UINT64 *MaximumVariableSize\r
906 );\r
907\r
908#endif\r
909\r
910//\r
911// EFI Runtime Services Table\r
912//\r
b6228a08 913#define EFI_RUNTIME_SERVICES_SIGNATURE 0x56524553544e5552ULL\r
3eb9473e 914#define EFI_RUNTIME_SERVICES_REVISION EFI_SPECIFICATION_VERSION\r
915\r
916typedef struct {\r
917 EFI_TABLE_HEADER Hdr;\r
918\r
919 //\r
920 // Time services\r
921 //\r
922 EFI_GET_TIME GetTime;\r
923 EFI_SET_TIME SetTime;\r
924 EFI_GET_WAKEUP_TIME GetWakeupTime;\r
925 EFI_SET_WAKEUP_TIME SetWakeupTime;\r
926\r
927 //\r
928 // Virtual memory services\r
929 //\r
930 EFI_SET_VIRTUAL_ADDRESS_MAP SetVirtualAddressMap;\r
931 EFI_CONVERT_POINTER ConvertPointer;\r
932\r
933 //\r
934 // Variable services\r
935 //\r
936 EFI_GET_VARIABLE GetVariable;\r
937 EFI_GET_NEXT_VARIABLE_NAME GetNextVariableName;\r
938 EFI_SET_VARIABLE SetVariable;\r
939\r
940 //\r
941 // Misc\r
942 //\r
943 EFI_GET_NEXT_HIGH_MONO_COUNT GetNextHighMonotonicCount;\r
944 EFI_RESET_SYSTEM ResetSystem;\r
945\r
946#if (EFI_SPECIFICATION_VERSION >= 0x00020000)\r
947 //\r
948 // New Boot Service added by UEFI 2.0\r
949 //\r
950 EFI_UPDATE_CAPSULE UpdateCapsule;\r
951 EFI_QUERY_CAPSULE_CAPABILITIES QueryCapsuleCapabilities;\r
952 EFI_QUERY_VARIABLE_INFO QueryVariableInfo;\r
953#elif (TIANO_RELEASE_VERSION != 0)\r
954 //\r
955 // Tiano extension to EFI 1.10 runtime table\r
956 // It was moved to a protocol to not conflict with UEFI 2.0\r
957 // If Tiano is disabled, this item is not enabled for EFI1.10\r
958 //\r
959 EFI_REPORT_STATUS_CODE ReportStatusCode;\r
960#endif\r
961\r
962} EFI_RUNTIME_SERVICES;\r
963\r
964//\r
965// EFI Boot Services Table\r
966//\r
b6228a08 967#define EFI_BOOT_SERVICES_SIGNATURE 0x56524553544f4f42ULL\r
3eb9473e 968#define EFI_BOOT_SERVICES_REVISION EFI_SPECIFICATION_VERSION\r
969\r
970typedef struct {\r
971 EFI_TABLE_HEADER Hdr;\r
972\r
973 //\r
974 // Task priority functions\r
975 //\r
976 EFI_RAISE_TPL RaiseTPL;\r
977 EFI_RESTORE_TPL RestoreTPL;\r
978\r
979 //\r
980 // Memory functions\r
981 //\r
982 EFI_ALLOCATE_PAGES AllocatePages;\r
983 EFI_FREE_PAGES FreePages;\r
984 EFI_GET_MEMORY_MAP GetMemoryMap;\r
985 EFI_ALLOCATE_POOL AllocatePool;\r
986 EFI_FREE_POOL FreePool;\r
987\r
988 //\r
989 // Event & timer functions\r
990 //\r
991 EFI_CREATE_EVENT CreateEvent;\r
992 EFI_SET_TIMER SetTimer;\r
993 EFI_WAIT_FOR_EVENT WaitForEvent;\r
994 EFI_SIGNAL_EVENT SignalEvent;\r
995 EFI_CLOSE_EVENT CloseEvent;\r
996 EFI_CHECK_EVENT CheckEvent;\r
997\r
998 //\r
999 // Protocol handler functions\r
1000 //\r
1001 EFI_INSTALL_PROTOCOL_INTERFACE InstallProtocolInterface;\r
1002 EFI_REINSTALL_PROTOCOL_INTERFACE ReinstallProtocolInterface;\r
1003 EFI_UNINSTALL_PROTOCOL_INTERFACE UninstallProtocolInterface;\r
1004 EFI_HANDLE_PROTOCOL HandleProtocol;\r
1005 VOID *Reserved;\r
1006 EFI_REGISTER_PROTOCOL_NOTIFY RegisterProtocolNotify;\r
1007 EFI_LOCATE_HANDLE LocateHandle;\r
1008 EFI_LOCATE_DEVICE_PATH LocateDevicePath;\r
1009 EFI_INSTALL_CONFIGURATION_TABLE InstallConfigurationTable;\r
1010\r
1011 //\r
1012 // Image functions\r
1013 //\r
1014 EFI_IMAGE_LOAD LoadImage;\r
1015 EFI_IMAGE_START StartImage;\r
1016 EFI_EXIT Exit;\r
1017 EFI_IMAGE_UNLOAD UnloadImage;\r
1018 EFI_EXIT_BOOT_SERVICES ExitBootServices;\r
1019\r
1020 //\r
1021 // Misc functions\r
1022 //\r
1023 EFI_GET_NEXT_MONOTONIC_COUNT GetNextMonotonicCount;\r
1024 EFI_STALL Stall;\r
1025 EFI_SET_WATCHDOG_TIMER SetWatchdogTimer;\r
1026\r
1027 //\r
1028 // ////////////////////////////////////////////////////\r
1029 // EFI 1.1 Services\r
1030 //////////////////////////////////////////////////////\r
1031 //\r
1032 // DriverSupport Services\r
1033 //\r
1034 EFI_CONNECT_CONTROLLER ConnectController;\r
1035 EFI_DISCONNECT_CONTROLLER DisconnectController;\r
1036\r
1037 //\r
1038 // Added Open and Close protocol for the new driver model\r
1039 //\r
1040 EFI_OPEN_PROTOCOL OpenProtocol;\r
1041 EFI_CLOSE_PROTOCOL CloseProtocol;\r
1042 EFI_OPEN_PROTOCOL_INFORMATION OpenProtocolInformation;\r
1043\r
1044 //\r
1045 // Added new services to EFI 1.1 as Lib to reduce code size.\r
1046 //\r
1047 EFI_PROTOCOLS_PER_HANDLE ProtocolsPerHandle;\r
1048 EFI_LOCATE_HANDLE_BUFFER LocateHandleBuffer;\r
1049 EFI_LOCATE_PROTOCOL LocateProtocol;\r
1050\r
1051 EFI_INSTALL_MULTIPLE_PROTOCOL_INTERFACES InstallMultipleProtocolInterfaces;\r
1052 EFI_UNINSTALL_MULTIPLE_PROTOCOL_INTERFACES UninstallMultipleProtocolInterfaces;\r
1053\r
1054 //\r
1055 // CRC32 services\r
1056 //\r
1057 EFI_CALCULATE_CRC32 CalculateCrc32;\r
1058\r
1059 //\r
1060 // Memory Utility Services\r
1061 //\r
1062 EFI_COPY_MEM CopyMem;\r
1063 EFI_SET_MEM SetMem;\r
1064#if (EFI_SPECIFICATION_VERSION >= 0x00020000)\r
1065 //\r
1066 // UEFI 2.0 Extension to the table\r
1067 //\r
1068 EFI_CREATE_EVENT_EX CreateEventEx;\r
1069#endif\r
1070\r
1071} EFI_BOOT_SERVICES;\r
1072\r
1073//\r
1074// EFI Configuration Table\r
1075//\r
1076typedef struct {\r
1077 EFI_GUID VendorGuid;\r
1078 VOID *VendorTable;\r
1079} EFI_CONFIGURATION_TABLE;\r
1080\r
1081//\r
1082// EFI System Table\r
1083//\r
b6228a08 1084#define EFI_SYSTEM_TABLE_SIGNATURE 0x5453595320494249ULL\r
3eb9473e 1085#define EFI_SYSTEM_TABLE_REVISION EFI_SPECIFICATION_VERSION\r
1086#define EFI_1_02_SYSTEM_TABLE_REVISION ((1 << 16) | 02)\r
1087#define EFI_1_10_SYSTEM_TABLE_REVISION ((1 << 16) | 10)\r
1088#define EFI_2_00_SYSTEM_TABLE_REVISION ((2 << 16) | 00)\r
1089#define EFI_2_10_SYSTEM_TABLE_REVISION ((2 << 16) | 10)\r
1090\r
5413b31d 1091struct _EFI_SYSTEM_TABLE {\r
3eb9473e 1092 EFI_TABLE_HEADER Hdr;\r
1093\r
1094 CHAR16 *FirmwareVendor;\r
1095 UINT32 FirmwareRevision;\r
1096\r
1097 EFI_HANDLE ConsoleInHandle;\r
1098 EFI_SIMPLE_TEXT_IN_PROTOCOL *ConIn;\r
1099\r
1100 EFI_HANDLE ConsoleOutHandle;\r
1101 EFI_SIMPLE_TEXT_OUT_PROTOCOL *ConOut;\r
1102\r
1103 EFI_HANDLE StandardErrorHandle;\r
1104 EFI_SIMPLE_TEXT_OUT_PROTOCOL *StdErr;\r
1105\r
1106 EFI_RUNTIME_SERVICES *RuntimeServices;\r
1107 EFI_BOOT_SERVICES *BootServices;\r
1108\r
1109 UINTN NumberOfTableEntries;\r
1110 EFI_CONFIGURATION_TABLE *ConfigurationTable;\r
1111\r
5413b31d 1112};\r
3eb9473e 1113\r
1114#endif\r