Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

195 lines
4.2 KiB

  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. /*
  82. * Memory
  83. */
  84. typedef UINT64 EFI_PHYSICAL_ADDRESS;
  85. typedef UINT64 EFI_VIRTUAL_ADDRESS;
  86. typedef enum {
  87. AllocateAnyPages,
  88. AllocateMaxAddress,
  89. AllocateAddress,
  90. MaxAllocateType
  91. } EFI_ALLOCATE_TYPE;
  92. /* Preseve the attr on any range supplied.
  93. * ConventialMemory must have WB,SR,SW when supplied.
  94. * When allocating from ConventialMemory always make it WB,SR,SW
  95. * When returning to ConventialMemory always make it WB,SR,SW
  96. * When getting the memory map, or on RT for runtime types */
  97. typedef enum {
  98. EfiReservedMemoryType,
  99. EfiLoaderCode,
  100. EfiLoaderData,
  101. EfiBootServicesCode,
  102. EfiBootServicesData,
  103. EfiRuntimeServicesCode,
  104. EfiRuntimeServicesData,
  105. EfiConventionalMemory,
  106. EfiUnusableMemory,
  107. EfiACPIReclaimMemory,
  108. EfiACPIMemoryNVS,
  109. EfiMemoryMappedIO,
  110. EfiMemoryMappedIOPortSpace,
  111. EfiPalCode,
  112. EfiMaxMemoryType
  113. } EFI_MEMORY_TYPE;
  114. /* possible caching types for the memory range */
  115. #define EFI_MEMORY_UC 0x0000000000000001
  116. #define EFI_MEMORY_WC 0x0000000000000002
  117. #define EFI_MEMORY_WT 0x0000000000000004
  118. #define EFI_MEMORY_WB 0x0000000000000008
  119. #define EFI_MEMORY_UCE 0x0000000000000010
  120. /* physical memory protection on range */
  121. #define EFI_MEMORY_WP 0x0000000000001000
  122. #define EFI_MEMORY_RP 0x0000000000002000
  123. #define EFI_MEMORY_XP 0x0000000000004000
  124. /* range requires a runtime mapping */
  125. #define EFI_MEMORY_RUNTIME 0x8000000000000000
  126. #define EFI_MEMORY_DESCRIPTOR_VERSION 1
  127. typedef struct {
  128. UINT32 Type; /* Field size is 32 bits followed by 32 bit pad */
  129. EFI_PHYSICAL_ADDRESS PhysicalStart; /* Field size is 64 bits */
  130. EFI_VIRTUAL_ADDRESS VirtualStart; /* Field size is 64 bits */
  131. UINT64 NumberOfPages; /* Field size is 64 bits */
  132. UINT64 Attribute; /* Field size is 64 bits */
  133. } EFI_MEMORY_DESCRIPTOR;
  134. /*
  135. * International Language
  136. */
  137. typedef UINT8 ISO_639_2;
  138. #define ISO_639_2_ENTRY_SIZE 3
  139. /*
  140. *
  141. */
  142. #define PAGE_SIZE 4096
  143. #define PAGE_MASK 0xFFF
  144. #define PAGE_SHIFT 12
  145. #define SIZE_TO_PAGES(a) \
  146. ( ((a) >> PAGE_SHIFT) + ((a) & PAGE_MASK ? 1 : 0) )
  147. #endif