]> CyberLeo.Net >> Repos - FreeBSD/releng/10.0.git/blob - sys/boot/efi/include/efidef.h
- Copy stable/10 (r259064) to releng/10.0 as part of the
[FreeBSD/releng/10.0.git] / sys / boot / efi / include / efidef.h
1 /* $FreeBSD$ */
2 #ifndef _EFI_DEF_H
3 #define _EFI_DEF_H
4
5 /*++
6
7 Copyright (c)  1999 - 2002 Intel Corporation. All rights reserved
8 This software and associated documentation (if any) is furnished
9 under a license and may only be used or copied in accordance
10 with the terms of the license. Except as permitted by such
11 license, no part of this software or documentation may be
12 reproduced, stored in a retrieval system, or transmitted in any
13 form or by any means without the express written consent of
14 Intel Corporation.
15
16 Module Name:
17
18     efidef.h
19
20 Abstract:
21
22     EFI definitions
23
24
25
26
27 Revision History
28
29 --*/
30
31 typedef UINT16          CHAR16;
32 typedef UINT8           CHAR8;
33 typedef UINT8           BOOLEAN;
34
35 #ifndef TRUE
36     #define TRUE    ((BOOLEAN) 1)
37     #define FALSE   ((BOOLEAN) 0)
38 #endif
39
40 #ifndef NULL
41     #define NULL    ((VOID *) 0)
42 #endif
43
44 typedef UINTN           EFI_STATUS;
45 typedef UINT64          EFI_LBA;
46 typedef UINTN           EFI_TPL;
47 typedef VOID            *EFI_HANDLE;
48 typedef VOID            *EFI_EVENT;
49
50
51 //
52 // Prototype argument decoration for EFI parameters to indicate
53 // their direction
54 //
55 // IN - argument is passed into the function
56 // OUT - argument (pointer) is returned from the function
57 // OPTIONAL - argument is optional
58 //
59
60 #ifndef IN
61     #define IN
62     #define OUT
63     #define OPTIONAL
64 #endif
65
66
67 //
68 // A GUID
69 //
70
71 typedef struct {          
72     UINT32  Data1;
73     UINT16  Data2;
74     UINT16  Data3;
75     UINT8   Data4[8]; 
76 } EFI_GUID;
77
78
79 //
80 // Time
81 //
82
83 typedef struct {          
84     UINT16      Year;       // 1998 - 20XX
85     UINT8       Month;      // 1 - 12
86     UINT8       Day;        // 1 - 31
87     UINT8       Hour;       // 0 - 23
88     UINT8       Minute;     // 0 - 59
89     UINT8       Second;     // 0 - 59
90     UINT8       Pad1;
91     UINT32      Nanosecond; // 0 - 999,999,999
92     INT16       TimeZone;   // -1440 to 1440 or 2047
93     UINT8       Daylight;
94     UINT8       Pad2;
95 } EFI_TIME;
96
97 // Bit definitions for EFI_TIME.Daylight
98 #define EFI_TIME_ADJUST_DAYLIGHT    0x01
99 #define EFI_TIME_IN_DAYLIGHT        0x02
100
101 // Value definition for EFI_TIME.TimeZone
102 #define EFI_UNSPECIFIED_TIMEZONE    0x07FF
103
104
105
106 //
107 // Networking
108 //
109
110 typedef struct {
111     UINT8                   Addr[4];
112 } EFI_IPv4_ADDRESS;
113
114 typedef struct {
115     UINT8                   Addr[16];
116 } EFI_IPv6_ADDRESS;
117
118 typedef struct {
119     UINT8                   Addr[32];
120 } EFI_MAC_ADDRESS;
121
122 //
123 // Memory
124 //
125
126 typedef UINT64          EFI_PHYSICAL_ADDRESS;
127 typedef UINT64          EFI_VIRTUAL_ADDRESS;
128
129 typedef enum {
130     AllocateAnyPages,
131     AllocateMaxAddress,
132     AllocateAddress,
133     MaxAllocateType
134 } EFI_ALLOCATE_TYPE;
135
136 //Preseve the attr on any range supplied.
137 //ConventialMemory must have WB,SR,SW when supplied.
138 //When allocating from ConventialMemory always make it WB,SR,SW
139 //When returning to ConventialMemory always make it WB,SR,SW
140 //When getting the memory map, or on RT for runtime types
141
142
143 typedef enum {
144     EfiReservedMemoryType,
145     EfiLoaderCode,
146     EfiLoaderData,
147     EfiBootServicesCode,
148     EfiBootServicesData,
149     EfiRuntimeServicesCode,
150     EfiRuntimeServicesData,
151     EfiConventionalMemory,
152     EfiUnusableMemory,
153     EfiACPIReclaimMemory,
154     EfiACPIMemoryNVS,
155     EfiMemoryMappedIO,
156     EfiMemoryMappedIOPortSpace,
157     EfiPalCode,
158     EfiMaxMemoryType
159 } EFI_MEMORY_TYPE;
160
161 // possible caching types for the memory range
162 #define EFI_MEMORY_UC           0x0000000000000001
163 #define EFI_MEMORY_WC           0x0000000000000002
164 #define EFI_MEMORY_WT           0x0000000000000004
165 #define EFI_MEMORY_WB           0x0000000000000008
166 #define EFI_MEMORY_UCE          0x0000000000000010  
167
168 // physical memory protection on range 
169 #define EFI_MEMORY_WP           0x0000000000001000
170 #define EFI_MEMORY_RP           0x0000000000002000
171 #define EFI_MEMORY_XP           0x0000000000004000
172
173 // range requires a runtime mapping
174 #define EFI_MEMORY_RUNTIME      0x8000000000000000
175
176 #define EFI_MEMORY_DESCRIPTOR_VERSION  1
177 typedef struct {
178     UINT32                          Type;           // Field size is 32 bits followed by 32 bit pad
179     EFI_PHYSICAL_ADDRESS            PhysicalStart;  // Field size is 64 bits
180     EFI_VIRTUAL_ADDRESS             VirtualStart;   // Field size is 64 bits
181     UINT64                          NumberOfPages;  // Field size is 64 bits
182     UINT64                          Attribute;      // Field size is 64 bits
183 } EFI_MEMORY_DESCRIPTOR;
184
185 //
186 // International Language
187 //
188
189 typedef UINT8   ISO_639_2;
190 #define ISO_639_2_ENTRY_SIZE    3
191
192 //
193 //
194 //
195
196 #define EFI_PAGE_SIZE   4096
197 #define EFI_PAGE_MASK   0xFFF
198 #define EFI_PAGE_SHIFT  12
199
200 #define EFI_SIZE_TO_PAGES(a)  \
201     ( ((a) >> EFI_PAGE_SHIFT) + (((a) & EFI_PAGE_MASK) ? 1 : 0) )
202
203 #endif