efiapi.h 21 KB

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