efidef.h 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227
  1. #ifndef _EFI_DEF_H
  2. #define _EFI_DEF_H
  3. /*++
  4. Copyright (c) 1998 Intel Corporation
  5. Module Name:
  6. efidef.h
  7. Abstract:
  8. EFI definitions
  9. Revision History
  10. --*/
  11. #if !defined(__cplusplus)
  12. #if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
  13. typedef _Bool BOOLEAN;
  14. #else
  15. typedef unsigned char BOOLEAN;
  16. #endif
  17. #else
  18. typedef bool BOOLEAN;
  19. #endif
  20. #ifndef CONST
  21. #define CONST const
  22. #endif
  23. #ifndef TRUE
  24. #define TRUE ((BOOLEAN) 1)
  25. #define FALSE ((BOOLEAN) 0)
  26. #endif
  27. #ifndef NULL
  28. #define NULL ((VOID *) 0)
  29. #endif
  30. typedef UINTN EFI_STATUS;
  31. typedef UINT64 EFI_LBA;
  32. typedef UINTN EFI_TPL;
  33. typedef VOID *EFI_HANDLE;
  34. typedef VOID *EFI_EVENT;
  35. //
  36. // Prototype argument decoration for EFI parameters to indicate
  37. // their direction
  38. //
  39. // IN - argument is passed into the function
  40. // OUT - argument (pointer) is returned from the function
  41. // OPTIONAL - argument is optional
  42. //
  43. #ifndef IN
  44. #define IN
  45. #define OUT
  46. #define OPTIONAL
  47. #endif
  48. //
  49. // A GUID
  50. //
  51. typedef struct {
  52. UINT32 Data1;
  53. UINT16 Data2;
  54. UINT16 Data3;
  55. UINT8 Data4[8];
  56. } EFI_GUID;
  57. //
  58. // Time
  59. //
  60. typedef struct {
  61. UINT16 Year; // 1998 - 20XX
  62. UINT8 Month; // 1 - 12
  63. UINT8 Day; // 1 - 31
  64. UINT8 Hour; // 0 - 23
  65. UINT8 Minute; // 0 - 59
  66. UINT8 Second; // 0 - 59
  67. UINT8 Pad1;
  68. UINT32 Nanosecond; // 0 - 999,999,999
  69. INT16 TimeZone; // -1440 to 1440 or 2047
  70. UINT8 Daylight;
  71. UINT8 Pad2;
  72. } EFI_TIME;
  73. // Bit definitions for EFI_TIME.Daylight
  74. #define EFI_TIME_ADJUST_DAYLIGHT 0x01
  75. #define EFI_TIME_IN_DAYLIGHT 0x02
  76. // Value definition for EFI_TIME.TimeZone
  77. #define EFI_UNSPECIFIED_TIMEZONE 0x07FF
  78. //
  79. // Networking
  80. //
  81. typedef struct {
  82. UINT8 Addr[4];
  83. } EFI_IPv4_ADDRESS;
  84. typedef struct {
  85. UINT8 Addr[16];
  86. } EFI_IPv6_ADDRESS;
  87. typedef struct {
  88. UINT8 Addr[32];
  89. } EFI_MAC_ADDRESS;
  90. typedef struct {
  91. UINT32 ReceivedQueueTimeoutValue;
  92. UINT32 TransmitQueueTimeoutValue;
  93. UINT16 ProtocolTypeFilter;
  94. BOOLEAN EnableUnicastReceive;
  95. BOOLEAN EnableMulticastReceive;
  96. BOOLEAN EnableBroadcastReceive;
  97. BOOLEAN EnablePromiscuousReceive;
  98. BOOLEAN FlushQueuesOnReset;
  99. BOOLEAN EnableReceiveTimestamps;
  100. BOOLEAN DisableBackgroundPolling;
  101. } EFI_MANAGED_NETWORK_CONFIG_DATA;
  102. //
  103. // Memory
  104. //
  105. typedef UINT64 EFI_PHYSICAL_ADDRESS;
  106. typedef UINT64 EFI_VIRTUAL_ADDRESS;
  107. typedef enum {
  108. AllocateAnyPages,
  109. AllocateMaxAddress,
  110. AllocateAddress,
  111. MaxAllocateType
  112. } EFI_ALLOCATE_TYPE;
  113. //Preseve the attr on any range supplied.
  114. //ConventialMemory must have WB,SR,SW when supplied.
  115. //When allocating from ConventialMemory always make it WB,SR,SW
  116. //When returning to ConventialMemory always make it WB,SR,SW
  117. //When getting the memory map, or on RT for runtime types
  118. typedef enum {
  119. EfiReservedMemoryType,
  120. EfiLoaderCode,
  121. EfiLoaderData,
  122. EfiBootServicesCode,
  123. EfiBootServicesData,
  124. EfiRuntimeServicesCode,
  125. EfiRuntimeServicesData,
  126. EfiConventionalMemory,
  127. EfiUnusableMemory,
  128. EfiACPIReclaimMemory,
  129. EfiACPIMemoryNVS,
  130. EfiMemoryMappedIO,
  131. EfiMemoryMappedIOPortSpace,
  132. EfiPalCode,
  133. EfiMaxMemoryType
  134. } EFI_MEMORY_TYPE;
  135. // possible caching types for the memory range
  136. #define EFI_MEMORY_UC 0x0000000000000001
  137. #define EFI_MEMORY_WC 0x0000000000000002
  138. #define EFI_MEMORY_WT 0x0000000000000004
  139. #define EFI_MEMORY_WB 0x0000000000000008
  140. #define EFI_MEMORY_UCE 0x0000000000000010
  141. // physical memory protection on range
  142. #define EFI_MEMORY_WP 0x0000000000001000
  143. #define EFI_MEMORY_RP 0x0000000000002000
  144. #define EFI_MEMORY_XP 0x0000000000004000
  145. // range requires a runtime mapping
  146. #define EFI_MEMORY_RUNTIME 0x8000000000000000
  147. #define EFI_MEMORY_DESCRIPTOR_VERSION 1
  148. typedef struct {
  149. UINT32 Type; // Field size is 32 bits followed by 32 bit pad
  150. UINT32 Pad;
  151. EFI_PHYSICAL_ADDRESS PhysicalStart; // Field size is 64 bits
  152. EFI_VIRTUAL_ADDRESS VirtualStart; // Field size is 64 bits
  153. UINT64 NumberOfPages; // Field size is 64 bits
  154. UINT64 Attribute; // Field size is 64 bits
  155. } EFI_MEMORY_DESCRIPTOR;
  156. //
  157. // International Language
  158. //
  159. typedef CHAR8 ISO_639_2;
  160. #define ISO_639_2_ENTRY_SIZE 3
  161. //
  162. //
  163. //
  164. #define EFI_PAGE_SIZE 4096
  165. #define EFI_PAGE_MASK 0xFFF
  166. #define EFI_PAGE_SHIFT 12
  167. #define EFI_SIZE_TO_PAGES(a) \
  168. ( ((a) >> EFI_PAGE_SHIFT) + ((a) & EFI_PAGE_MASK ? 1 : 0) )
  169. #define EFI_OS_INDICATIONS_BOOT_TO_FW_UI 0x0000000000000001
  170. #define EFI_OS_INDICATIONS_TIMESTAMP_REVOCATION 0x0000000000000002
  171. #define EFI_OS_INDICATIONS_FILE_CAPSULE_DELIVERY_SUPPORTED \
  172. 0x0000000000000004
  173. #define EFI_OS_INDICATIONS_FMP_CAPSULE_SUPPORTED \
  174. 0x0000000000000008
  175. #define EFI_OS_INDICATIONS_CAPSULE_RESULT_VAR_SUPPORTED \
  176. 0x0000000000000010
  177. #endif