efidef.h 4.6 KB

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