]> git.proxmox.com Git - mirror_edk2.git/blame - MdePkg/Include/Uefi/UefiSpec.h
Fix track EDKT104: If a module use PCD, MSA of this module should use PcdLib libraryC...
[mirror_edk2.git] / MdePkg / Include / Uefi / UefiSpec.h
Content-type: text/html ]> git.proxmox.com Git - mirror_edk2.git/blame - MdePkg/Include/Uefi/UefiSpec.h


500 - Internal Server Error

Malformed UTF-8 character (fatal) at (eval 6) line 1, <$fd> line 790.
CommitLineData
878ddf1f 1/** @file\r
2 Include file that supportes UEFI.\r
3 \r
4 This include file must only contain things defined in the UEFI 2.0 specification.\r
5 If a code construct is defined in the UEFI 2.0 specification it must be included\r
6 by this include file.\r
7 \r
8 Copyright (c) 2006, Intel Corporation\r
9 All rights reserved. This program and the accompanying materials\r
10 are licensed and made available under the terms and conditions of the BSD License\r
11 which accompanies this distribution. The full text of the license may be found at\r
12 http://opensource.org/licenses/bsd-license.php\r
13 \r
14 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
15 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
16 \r
17 Module Name: UefiSpec.h\r
18 \r
19**/\r
20\r
21#ifndef __UEFI_SPEC_H__\r
22#define __UEFI_SPEC_H__\r
23\r
24#include <Common/MultiPhase.h>\r
25\r
878ddf1f 26//\r
27// EFI Data Types derived from other EFI data types.\r
28//\r
878ddf1f 29#define NULL_HANDLE ((VOID *) 0)\r
30\r
30a60d29 31typedef VOID *EFI_EVENT;\r
878ddf1f 32typedef UINTN EFI_TPL;\r
33\r
878ddf1f 34//\r
35// Networking\r
36//\r
37typedef struct {\r
38 UINT8 Addr[4];\r
39} EFI_IPv4_ADDRESS;\r
40\r
41typedef struct {\r
42 UINT8 Addr[16];\r
43} EFI_IPv6_ADDRESS;\r
44\r
45typedef struct {\r
46 UINT8 Addr[32];\r
47} EFI_MAC_ADDRESS;\r
48\r
49typedef union {\r
50 UINT32 Addr[4];\r
51 EFI_IPv4_ADDRESS v4;\r
52 EFI_IPv6_ADDRESS v6;\r
53} EFI_IP_ADDRESS;\r
54\r
55\r
56typedef enum {\r
57 AllocateAnyPages,\r
58 AllocateMaxAddress,\r
59 AllocateAddress,\r
60 MaxAllocateType\r
61} EFI_ALLOCATE_TYPE;\r
62\r
63\r
64//\r
65// possible caching types for the memory range\r
66//\r
67#define EFI_MEMORY_UC 0x0000000000000001ULL\r
68#define EFI_MEMORY_WC 0x0000000000000002ULL\r
69#define EFI_MEMORY_WT 0x0000000000000004ULL\r
70#define EFI_MEMORY_WB 0x0000000000000008ULL\r
71#define EFI_MEMORY_UCE 0x0000000000000010ULL\r
72\r
73//\r
74// physical memory protection on range\r
75//\r
76#define EFI_MEMORY_WP 0x0000000000001000ULL\r
77#define EFI_MEMORY_RP 0x0000000000002000ULL\r
78#define EFI_MEMORY_XP 0x0000000000004000ULL\r
79\r
80//\r
81// range requires a runtime mapping\r
82//\r
83#define EFI_MEMORY_RUNTIME 0x8000000000000000ULL\r
84\r
85typedef UINT64 EFI_VIRTUAL_ADDRESS;\r
86\r
87#define EFI_MEMORY_DESCRIPTOR_VERSION 1\r
88typedef struct {\r
89 UINT32 Type;\r
90 UINT32 Pad;\r
91 EFI_PHYSICAL_ADDRESS PhysicalStart;\r
92 EFI_VIRTUAL_ADDRESS VirtualStart;\r
93 UINT64 NumberOfPages;\r
94 UINT64 Attribute;\r
95} EFI_MEMORY_DESCRIPTOR;\r
96\r
97//\r
98// EFI_FIELD_OFFSET - returns the byte offset to a field within a structure\r
99//\r
100#define EFI_FIELD_OFFSET(TYPE,Field) ((UINTN)(&(((TYPE *) 0)->Field)))\r
101\r
102#include <Protocol/DevicePath.h>\r
103#include <Protocol/SimpleTextIn.h>\r
104#include <Protocol/SimpleTextOut.h>\r
105\r
106//\r
107// Declare forward referenced data structures\r
108//\r
30a60d29 109typedef struct _EFI_SYSTEM_TABLE EFI_SYSTEM_TABLE;\r
878ddf1f 110\r
111/**\r
112 Allocates memory pages from the system.\r
113 \r
114 @param Type The type of allocation to perform.\r
115 @param MemoryType The type of memory to allocate.\r
116 @param Pages The number of contiguous 4 KB pages to allocate.\r
117 @param Memory Pointer to a physical address. On input, the way in which the address is\r
118 used depends on the value of Type. \r
119 \r
120 @retval EFI_SUCCESS The requested pages were allocated.\r
121 @retval EFI_INVALID_PARAMETER 1) Type is not AllocateAnyPages or\r
122 AllocateMaxAddress or AllocateAddress.\r
123 2) MemoryType is in the range\r
124 EfiMaxMemoryType..0x7FFFFFFF.\r
125 @retval EFI_OUT_OF_RESOURCES The pages could not be allocated.\r
126 @retval EFI_NOT_FOUND The requested pages could not be found.\r
127 \r
128**/ \r
129typedef \r
130EFI_STATUS \r
131(EFIAPI *EFI_ALLOCATE_PAGES) (\r
30a60d29
LG
132 IN EFI_ALLOCATE_TYPE Type,\r
133 IN EFI_MEMORY_TYPE MemoryType,\r
134 IN UINTN Pages,\r
135 IN OUT EFI_PHYSICAL_ADDRESS *Memory\r
878ddf1f 136 );\r
137\r
138/**\r
139 Frees memory pages.\r
140 \r
141 @param Memory The base physical address of the pages to be freed.\r
142 @param Pages The number of contiguous 4 KB pages to free.\r
143 \r
144 @retval EFI_SUCCESS The requested pages were freed.\r
145 @retval EFI_INVALID_PARAMETER Memory is not a page-aligned address or Pages is invalid. \r
146 @retval EFI_NOT_FOUND The requested memory pages were not allocated with\r
147 AllocatePages().\r
148 \r
149**/ \r
150typedef\r
151EFI_STATUS\r
152(EFIAPI *EFI_FREE_PAGES) (\r
30a60d29
LG
153 IN EFI_PHYSICAL_ADDRESS Memory,\r
154 IN UINTN Pages\r
878ddf1f 155 );\r
156\r
157/**\r
158 Returns the current memory map.\r
159 \r
160 @param MemoryMapSize A pointer to the size, in bytes, of the MemoryMap buffer.\r
161 @param MemoryMap A pointer to the buffer in which firmware places the current memory\r
162 map.\r
163 @param MapKey A pointer to the location in which firmware returns the key for the\r
164 current memory map. \r
165 @param DescriptorSize A pointer to the location in which firmware returns the size, in bytes, of\r
166 an individual EFI_MEMORY_DESCRIPTOR. \r
167 @param DescriptorVersion A pointer to the location in which firmware returns the version number\r
168 associated with the EFI_MEMORY_DESCRIPTOR. \r
169 \r
170 @retval EFI_SUCCESS The memory map was returned in the MemoryMap buffer.\r
171 @retval EFI_BUFFER_TOO_SMALL The MemoryMap buffer was too small. The current buffer size\r
172 needed to hold the memory map is returned in MemoryMapSize.\r
173 @retval EFI_INVALID_PARAMETER 1) MemoryMapSize is NULL.\r
174 2) The MemoryMap buffer is not too small and MemoryMap is\r
175 NULL. \r
176 \r
177**/ \r
178typedef\r
179EFI_STATUS\r
180(EFIAPI *EFI_GET_MEMORY_MAP) (\r
30a60d29
LG
181 IN OUT UINTN *MemoryMapSize,\r
182 IN OUT EFI_MEMORY_DESCRIPTOR *MemoryMap,\r
183 OUT UINTN *MapKey,\r
184 OUT UINTN *DescriptorSize,\r
185 OUT UINT32 *DescriptorVersion\r
878ddf1f 186 );\r
187\r
188#define NextMemoryDescriptor(_Ptr, _Size) ((EFI_MEMORY_DESCRIPTOR *) (((UINT8 *) (_Ptr)) + (_Size)))\r
189#define NEXT_MEMORY_DESCRIPTOR(_Ptr, _Size) NextMemoryDescriptor (_Ptr, _Size)\r
190\r
191/**\r
192 Allocates pool memory.\r
193 \r
194 @param PoolType The type of pool to allocate.\r
195 @param Size The number of bytes to allocate from the pool. \r
196 @param Buffer A pointer to a pointer to the allocated buffer if the call succeeds;\r
197 undefined otherwise. \r
198 \r
199 @retval EFI_SUCCESS The requested number of bytes was allocated.\r
200 @retval EFI_OUT_OF_RESOURCES The pool requested could not be allocated. \r
201 @retval EFI_INVALID_PARAMETER PoolType was invalid. \r
202 \r
203**/ \r
204typedef\r
205EFI_STATUS\r
206(EFIAPI *EFI_ALLOCATE_POOL) (\r
30a60d29
LG
207 IN EFI_MEMORY_TYPE PoolType,\r
208 IN UINTN Size,\r
209 OUT VOID **Buffer\r
878ddf1f 210 );\r
211\r
212/**\r
213 Returns pool memory to the system.\r
214 \r
215 @param Buffer Pointer to the buffer to free. \r
216 \r
217 @retval EFI_SUCCESS The memory was returned to the system. \r
218 @retval EFI_INVALID_PARAMETER Buffer was invalid.\r
219 \r
220**/ \r
221typedef\r
222EFI_STATUS\r
223(EFIAPI *EFI_FREE_POOL) (\r
30a60d29 224 IN VOID *Buffer\r
878ddf1f 225 );\r
226\r
227/**\r
228 Changes the runtime addressing mode of EFI firmware from physical to virtual.\r
229 \r
230 @param MemoryMapSize The size in bytes of VirtualMap.\r
231 @param DescriptorSize The size in bytes of an entry in the VirtualMap.\r
232 @param DescriptorVersion The version of the structure entries in VirtualMap.\r
233 @param VirtualMap An array of memory descriptors which contain new virtual\r
234 address mapping information for all runtime ranges.\r
235 \r
236 @retval EFI_SUCCESS The virtual address map has been applied.\r
237 @retval EFI_UNSUPPORTED EFI firmware is not at runtime, or the EFI firmware is already in\r
238 virtual address mapped mode. \r
239 @retval EFI_INVALID_PARAMETER DescriptorSize or DescriptorVersion is invalid. \r
240 @retval EFI_NO_MAPPING A virtual address was not supplied for a range in the memory\r
241 map that requires a mapping. \r
242 @retval EFI_NOT_FOUND A virtual address was supplied for an address that is not found\r
243 in the memory map. \r
244 \r
245**/ \r
246typedef\r
247EFI_STATUS\r
248(EFIAPI *EFI_SET_VIRTUAL_ADDRESS_MAP) (\r
30a60d29
LG
249 IN UINTN MemoryMapSize,\r
250 IN UINTN DescriptorSize,\r
251 IN UINT32 DescriptorVersion,\r
252 IN EFI_MEMORY_DESCRIPTOR *VirtualMap\r
878ddf1f 253 );\r
254\r
255/**\r
256 Connects one or more drivers to a controller.\r
257 \r
258 @param ControllerHandle The handle of the controller to which driver(s) are to be connected.\r
259 @param DriverImageHandle A pointer to an ordered list handles that support the\r
260 EFI_DRIVER_BINDING_PROTOCOL. \r
261 @param RemainingDevicePath A pointer to the device path that specifies a child of the\r
262 controller specified by ControllerHandle. \r
263 @param Recursive If TRUE, then ConnectController() is called recursively \r
264 until the entire tree of controllers below the controller specified\r
265 by ControllerHandle have been created. If FALSE, then \r
266 the tree of controllers is only expanded one level. \r
267 \r
268 @retval EFI_SUCCESS 1) One or more drivers were connected to ControllerHandle.\r
269 2) No drivers were connected to ControllerHandle, but \r
270 RemainingDevicePath is not NULL, and it is an End Device\r
271 Path Node. \r
272 @retval EFI_INVALID_PARAMETER ControllerHandle is not a valid EFI_HANDLE. \r
273 @retval EFI_NOT_FOUND 1) There are no EFI_DRIVER_BINDING_PROTOCOL instances\r
274 present in the system. \r
275 2) No drivers were connected to ControllerHandle.\r
276 \r
277**/ \r
278typedef\r
279EFI_STATUS\r
280(EFIAPI *EFI_CONNECT_CONTROLLER) (\r
281 IN EFI_HANDLE ControllerHandle,\r
282 IN EFI_HANDLE *DriverImageHandle, OPTIONAL\r
283 IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath, OPTIONAL\r
284 IN BOOLEAN Recursive\r
285 );\r
286\r
287/**\r
288 Disconnects one or more drivers from a controller.\r
289 \r
290 @param ControllerHandle The handle of the controller from which driver(s) are to be disconnected.\r
291 @param DriverImageHandle The driver to disconnect from ControllerHandle. \r
292 @param ChildHandle The handle of the child to destroy. \r
293 \r
294 @retval EFI_SUCCESS 1) One or more drivers were disconnected from the controller.\r
295 2) On entry, no drivers are managing ControllerHandle.\r
296 3) DriverImageHandle is not NULL, and on entry\r
297 DriverImageHandle is not managing ControllerHandle.\r
298 \r
299 @retval EFI_INVALID_PARAMETER One ore more parameters are invalid.\r
300 @retval EFI_OUT_OF_RESOURCES There are not enough resources available to disconnect any drivers from\r
301 ControllerHandle. \r
302 @retval EFI_DEVICE_ERROR The controller could not be disconnected because of a device error. \r
303 \r
304**/ \r
305typedef\r
306EFI_STATUS\r
307(EFIAPI *EFI_DISCONNECT_CONTROLLER) (\r
30a60d29
LG
308 IN EFI_HANDLE ControllerHandle,\r
309 IN EFI_HANDLE DriverImageHandle, OPTIONAL\r
310 IN EFI_HANDLE ChildHandle OPTIONAL\r
878ddf1f 311 );\r
312\r
313//\r
314// ConvertPointer DebugDisposition type.\r
315//\r
316#define EFI_OPTIONAL_PTR 0x00000001\r
317#define EFI_OPTIONAL_POINTER EFI_OPTIONAL_PTR\r
318\r
319/**\r
320 Determines the new virtual address that is to be used on subsequent memory accesses.\r
321 \r
322 @param DebugDisposition Supplies type information for the pointer being converted.\r
323 @param Address A pointer to a pointer that is to be fixed to be the value needed\r
324 for the new virtual address mappings being applied. \r
325 \r
326 @retval EFI_SUCCESS The pointer pointed to by Address was modified. \r
327 @retval EFI_INVALID_PARAMETER 1) Address is NULL.\r
328 2) *Address is NULL and DebugDisposition does\r
329 not have the EFI_OPTIONAL_PTR bit set. \r
330 @retval EFI_NOT_FOUND The pointer pointed to by Address was not found to be part\r
331 of the current memory map. This is normally fatal. \r
332 \r
333**/ \r
334typedef\r
335EFI_STATUS\r
336(EFIAPI *EFI_CONVERT_POINTER) (\r
30a60d29 337 IN UINTN DebugDisposition,\r
878ddf1f 338 IN OUT VOID **Address\r
339 );\r
340\r
341//\r
342// EFI Event Types (name defined in spec)\r
343//\r
344#define EVENT_TIMER 0x80000000\r
345#define EVENT_RUNTIME 0x40000000\r
346#define EVENT_RUNTIME_CONTEXT 0x20000000\r
347\r
348#define EVENT_NOTIFY_WAIT 0x00000100\r
349#define EVENT_NOTIFY_SIGNAL 0x00000200\r
350\r
351#define EVENT_SIGNAL_EXIT_BOOT_SERVICES 0x00000201\r
352#define EVENT_SIGNAL_VIRTUAL_ADDRESS_CHANGE 0x60000202\r
353\r
354#if ((EDK_RELEASE_VERSION != 0) && (EFI_SPECIFICATION_VERSION < 0x00020000))\r
355//\r
356// Prior to UEFI 2.0 Tiano extended these enums. This was replaced by\r
357// CreateEventEx() Event Groups in UEFI 2.0\r
358//\r
359#define EFI_EVENT_NOTIFY_SIGNAL_ALL 0x00000400\r
360\r
361#define EFI_EVENT_SIGNAL_READY_TO_BOOT 0x00000203\r
362#define EFI_EVENT_SIGNAL_LEGACY_BOOT 0x00000204\r
363\r
364#endif\r
365\r
366//\r
367// EFI Event Types (name following coding style)\r
368//\r
369#define EFI_EVENT_TIMER EVENT_TIMER\r
370#define EFI_EVENT_RUNTIME EVENT_RUNTIME\r
371#define EFI_EVENT_RUNTIME_CONTEXT EVENT_RUNTIME_CONTEXT\r
372\r
373#define EFI_EVENT_NOTIFY_WAIT EVENT_NOTIFY_WAIT\r
374#define EFI_EVENT_NOTIFY_SIGNAL EVENT_NOTIFY_SIGNAL\r
375\r
376#define EFI_EVENT_SIGNAL_EXIT_BOOT_SERVICES EVENT_SIGNAL_EXIT_BOOT_SERVICES\r
377#define EFI_EVENT_SIGNAL_VIRTUAL_ADDRESS_CHANGE EVENT_SIGNAL_VIRTUAL_ADDRESS_CHANGE\r
378\r
379\r
380/** \r
381 Invoke a notification event\r
382 \r
383 @param Event Event whose notification function is being invoked.\r
384