Remove some unneeded definitions of NULL.
[dragonfly.git] / sys / boot / efi / include / efidef.h
blobf1f54bd16b0dff7d76b16ba4acd1afa1cd044511
1 /*
2 * $FreeBSD: src/sys/boot/efi/include/efidef.h,v 1.2 2002/05/19 03:17:20 marcel Exp $
3 * $DragonFly: src/sys/boot/efi/include/efidef.h,v 1.2 2008/06/05 18:01:49 swildner Exp $
4 */
5 #ifndef _EFI_DEF_H
6 #define _EFI_DEF_H
8 /*++
10 Copyright (c) 1998 Intel Corporation
12 Module Name:
14 efidef.h
16 Abstract:
18 EFI definitions
23 Revision History
25 --*/
27 typedef UINT16 CHAR16;
28 typedef UINT8 CHAR8;
29 typedef UINT8 BOOLEAN;
31 #ifndef TRUE
32 #define TRUE ((BOOLEAN) 1)
33 #define FALSE ((BOOLEAN) 0)
34 #endif
36 typedef UINTN EFI_STATUS;
37 typedef UINT64 EFI_LBA;
38 typedef UINTN EFI_TPL;
39 typedef VOID *EFI_HANDLE;
40 typedef VOID *EFI_EVENT;
44 * Prototype argument decoration for EFI parameters to indicate
45 * their direction
47 * IN - argument is passed into the function
48 * OUT - argument (pointer) is returned from the function
49 * OPTIONAL - argument is optional
52 #ifndef IN
53 #define IN
54 #define OUT
55 #define OPTIONAL
56 #endif
60 * A GUID
63 typedef struct {
64 UINT32 Data1;
65 UINT16 Data2;
66 UINT16 Data3;
67 UINT8 Data4[8];
68 } EFI_GUID;
72 * Time
75 typedef struct {
76 UINT16 Year; /* 1998 - 20XX */
77 UINT8 Month; /* 1 - 12 */
78 UINT8 Day; /* 1 - 31 */
79 UINT8 Hour; /* 0 - 23 */
80 UINT8 Minute; /* 0 - 59 */
81 UINT8 Second; /* 0 - 59 */
82 UINT8 Pad1;
83 UINT32 Nanosecond; /* 0 - 999,999,999 */
84 INT16 TimeZone; /* -1440 to 1440 or 2047 */
85 UINT8 Daylight;
86 UINT8 Pad2;
87 } EFI_TIME;
89 /* Bit definitions for EFI_TIME.Daylight */
90 #define EFI_TIME_ADJUST_DAYLIGHT 0x01
91 #define EFI_TIME_IN_DAYLIGHT 0x02
93 /* Value definition for EFI_TIME.TimeZone */
94 #define EFI_UNSPECIFIED_TIMEZONE 0x07FF
99 * Networking
102 typedef struct {
103 UINT8 Addr[4];
104 } EFI_IPv4_ADDRESS;
106 typedef struct {
107 UINT8 Addr[16];
108 } EFI_IPv6_ADDRESS;
110 typedef struct {
111 UINT8 Addr[32];
112 } EFI_MAC_ADDRESS;
115 * Memory
118 typedef UINT64 EFI_PHYSICAL_ADDRESS;
119 typedef UINT64 EFI_VIRTUAL_ADDRESS;
121 typedef enum {
122 AllocateAnyPages,
123 AllocateMaxAddress,
124 AllocateAddress,
125 MaxAllocateType
126 } EFI_ALLOCATE_TYPE;
129 * Preseve the attr on any range supplied.
130 * ConventialMemory must have WB,SR,SW when supplied.
131 * When allocating from ConventialMemory always make it WB,SR,SW
132 * When returning to ConventialMemory always make it WB,SR,SW
133 * When getting the memory map, or on RT for runtime types
136 typedef enum {
137 EfiReservedMemoryType,
138 EfiLoaderCode,
139 EfiLoaderData,
140 EfiBootServicesCode,
141 EfiBootServicesData,
142 EfiRuntimeServicesCode,
143 EfiRuntimeServicesData,
144 EfiConventionalMemory,
145 EfiUnusableMemory,
146 EfiACPIReclaimMemory,
147 EfiACPIMemoryNVS,
148 EfiMemoryMappedIO,
149 EfiMemoryMappedIOPortSpace,
150 EfiPalCode,
151 EfiMaxMemoryType
152 } EFI_MEMORY_TYPE;
154 /* possible caching types for the memory range */
155 #define EFI_MEMORY_UC 0x0000000000000001
156 #define EFI_MEMORY_WC 0x0000000000000002
157 #define EFI_MEMORY_WT 0x0000000000000004
158 #define EFI_MEMORY_WB 0x0000000000000008
159 #define EFI_MEMORY_UCE 0x0000000000000010
161 /* physical memory protection on range */
162 #define EFI_MEMORY_WP 0x0000000000001000
163 #define EFI_MEMORY_RP 0x0000000000002000
164 #define EFI_MEMORY_XP 0x0000000000004000
166 /* range requires a runtime mapping */
167 #define EFI_MEMORY_RUNTIME 0x8000000000000000
169 #define EFI_MEMORY_DESCRIPTOR_VERSION 1
170 typedef struct {
171 UINT32 Type; /* 32 bit padding */
172 EFI_PHYSICAL_ADDRESS PhysicalStart;
173 EFI_VIRTUAL_ADDRESS VirtualStart;
174 UINT64 NumberOfPages;
175 UINT64 Attribute;
176 } EFI_MEMORY_DESCRIPTOR;
179 * International Language
182 typedef UINT8 ISO_639_2;
183 #define ISO_639_2_ENTRY_SIZE 3
185 #define EFI_PAGE_SIZE 4096
186 #define EFI_PAGE_MASK 0xFFF
187 #define EFI_PAGE_SHIFT 12
189 #define EFI_SIZE_TO_PAGES(a) \
190 ( ((a) >> EFI_PAGE_SHIFT) + ((a) & EFI_PAGE_MASK ? 1 : 0) )
192 #endif