efidef.h 5.1 KB

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