efidef.h 5.0 KB

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