Remove the reference of UefiDevicePath.h.
[mirror_edk2.git] / MdePkg / Include / Uefi / UefiSpec.h
CommitLineData
959ccb23 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 - 2007, 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 <Uefi/UefiMultiPhase.h>\r
25\r
26#include <Protocol/DevicePath.h>\r
27#include <Protocol/SimpleTextIn.h>\r
28#include <Protocol/SimpleTextOut.h>\r
29\r
959ccb23 30//\r
31// Enumeration of memory allocation.\r
32// \r
33typedef enum {\r
34 AllocateAnyPages,\r
35 AllocateMaxAddress,\r
36 AllocateAddress,\r
37 MaxAllocateType\r
38} EFI_ALLOCATE_TYPE;\r
39\r
40\r
41//\r
42// possible caching types for the memory range\r
43//\r
44#define EFI_MEMORY_UC 0x0000000000000001ULL\r
45#define EFI_MEMORY_WC 0x0000000000000002ULL\r
46#define EFI_MEMORY_WT 0x0000000000000004ULL\r
47#define EFI_MEMORY_WB 0x0000000000000008ULL\r
48#define EFI_MEMORY_UCE 0x0000000000000010ULL\r
49\r
50//\r
51// physical memory protection on range\r
52//\r
00edb218
A
53#define EFI_MEMORY_WP 0x0000000000001000ULL\r
54#define EFI_MEMORY_RP 0x0000000000002000ULL\r
55#define EFI_MEMORY_XP 0x0000000000004000ULL\r
959ccb23 56\r
57//\r
58// range requires a runtime mapping\r
59//\r
60#define EFI_MEMORY_RUNTIME 0x8000000000000000ULL\r
61\r
62#define EFI_MEMORY_DESCRIPTOR_VERSION 1\r
63typedef struct {\r
00edb218
A
64 UINT32 Type;\r
65 EFI_PHYSICAL_ADDRESS PhysicalStart;\r
66 EFI_VIRTUAL_ADDRESS VirtualStart;\r
67 UINT64 NumberOfPages;\r
68 UINT64 Attribute;\r
959ccb23 69} EFI_MEMORY_DESCRIPTOR;\r
70\r
71//\r
72// Build macros to find next EFI_MEMORY_DESCRIPTOR.\r
73// \r
74#define NextMemoryDescriptor(_Ptr, _Size) ((EFI_MEMORY_DESCRIPTOR *) (((UINT8 *) (_Ptr)) + (_Size)))\r
75#define NEXT_MEMORY_DESCRIPTOR(_Ptr, _Size) NextMemoryDescriptor (_Ptr, _Size)\r
76\r
77//\r
78// Declare forward referenced data structures\r
79//\r
80typedef struct _EFI_SYSTEM_TABLE EFI_SYSTEM_TABLE;\r
81\r
82/**\r
83 Allocates memory pages from the system.\r
84\r
85 @param Type The type of allocation to perform.\r
86 @param MemoryType The type of memory to allocate.\r
87 @param Pages The number of contiguous 4 KB pages to allocate.\r
88 @param Memory Pointer to a physical address. On input, the way in which the address is\r
89 used depends on the value of Type.\r
90\r
91 @retval EFI_SUCCESS The requested pages were allocated.\r
92 @retval EFI_INVALID_PARAMETER 1) Type is not AllocateAnyPages or\r
93 AllocateMaxAddress or AllocateAddress.\r
94 2) MemoryType is in the range\r
95 EfiMaxMemoryType..0x7FFFFFFF.\r
96 @retval EFI_OUT_OF_RESOURCES The pages could not be allocated.\r
97 @retval EFI_NOT_FOUND The requested pages could not be found.\r
98\r
99**/\r
100typedef\r
101EFI_STATUS\r
102(EFIAPI *EFI_ALLOCATE_PAGES) (\r
103 IN EFI_ALLOCATE_TYPE Type,\r
104 IN EFI_MEMORY_TYPE MemoryType,\r
105 IN UINTN Pages,\r
106 IN OUT EFI_PHYSICAL_ADDRESS *Memory\r
107 );\r
108\r
109/**\r
110 Frees memory pages.\r
111\r
112 @param Memory The base physical address of the pages to be freed.\r
113 @param Pages The number of contiguous 4 KB pages to free.\r
114\r
115 @retval EFI_SUCCESS The requested pages were freed.\r
116 @retval EFI_INVALID_PARAMETER Memory is not a page-aligned address or Pages is invalid.\r
117 @retval EFI_NOT_FOUND The requested memory pages were not allocated with\r
118 AllocatePages().\r
119\r
120**/\r
121typedef\r
122EFI_STATUS\r
123(EFIAPI *EFI_FREE_PAGES) (\r
124 IN EFI_PHYSICAL_ADDRESS Memory,\r
125 IN UINTN Pages\r
126 );\r
127\r
128/**\r
129 Returns the current memory map.\r
130\r
131 @param MemoryMapSize A pointer to the size, in bytes, of the MemoryMap buffer.\r
132 @param MemoryMap A pointer to the buffer in which firmware places the current memory\r
133 map.\r
134 @param MapKey A pointer to the location in which firmware returns the key for the\r
135 current memory map.\r
136 @param DescriptorSize A pointer to the location in which firmware returns the size, in bytes, of\r
137 an individual EFI_MEMORY_DESCRIPTOR.\r
138 @param DescriptorVersion A pointer to the location in which firmware returns the version number\r
139 associated with the EFI_MEMORY_DESCRIPTOR.\r
140\r
141 @retval EFI_SUCCESS The memory map was returned in the MemoryMap buffer.\r
142 @retval EFI_BUFFER_TOO_SMALL The MemoryMap buffer was too small. The current buffer size\r
143 needed to hold the memory map is returned in MemoryMapSize.\r
144 @retval EFI_INVALID_PARAMETER 1) MemoryMapSize is NULL.\r
145 2) The MemoryMap buffer is not too small and MemoryMap is\r
146 NULL.\r
147\r
148**/\r
149typedef\r
150EFI_STATUS\r
151(EFIAPI *EFI_GET_MEMORY_MAP) (\r
152 IN OUT UINTN *MemoryMapSize,\r
153 IN OUT EFI_MEMORY_DESCRIPTOR *MemoryMap,\r
154 OUT UINTN *MapKey,\r
155 OUT UINTN *DescriptorSize,\r
156 OUT UINT32 *DescriptorVersion\r
157 );\r
158\r
159/**\r
160 Allocates pool memory.\r
161\r
162 @param PoolType The type of pool to allocate.\r
163 @param Size The number of bytes to allocate from the pool.\r
164 @param Buffer A pointer to a pointer to the allocated buffer if the call succeeds;\r
165 undefined otherwise.\r
166\r
167 @retval EFI_SUCCESS The requested number of bytes was allocated.\r
168 @retval EFI_OUT_OF_RESOURCES The pool requested could not be allocated.\r
169 @retval EFI_INVALID_PARAMETER PoolType was invalid.\r
170\r
171**/\r
172typedef\r
173EFI_STATUS\r
174(EFIAPI *EFI_ALLOCATE_POOL) (\r
175 IN EFI_MEMORY_TYPE PoolType,\r
176 IN UINTN Size,\r
177 OUT VOID **Buffer\r
178 );\r
179\r
180/**\r
181 Returns pool memory to the system.\r
182\r
183 @param Buffer Pointer to the buffer to free.\r
184\r
185 @retval EFI_SUCCESS The memory was returned to the system.\r
186 @retval EFI_INVALID_PARAMETER Buffer was invalid.\r
187\r
188**/\r
189typedef\r
190EFI_STATUS\r
191(EFIAPI *EFI_FREE_POOL) (\r
192 IN VOID *Buffer\r
193 );\r
194\r
195/**\r
196 Changes the runtime addressing mode of EFI firmware from physical to virtual.\r
197\r
198 @param MemoryMapSize The size in bytes of VirtualMap.\r
199 @param DescriptorSize The size in bytes of an entry in the VirtualMap.\r
200 @param DescriptorVersion The version of the structure entries in VirtualMap.\r
201 @param VirtualMap An array of memory descriptors which contain new virtual\r
202 address mapping information for all runtime ranges.\r
203\r
204 @retval EFI_SUCCESS The virtual address map has been applied.\r
205 @retval EFI_UNSUPPORTED EFI firmware is not at runtime, or the EFI firmware is already in\r
206 virtual address mapped mode.\r
207 @retval EFI_INVALID_PARAMETER DescriptorSize or DescriptorVersion is invalid.\r
208 @retval EFI_NO_MAPPING A virtual address was not supplied for a range in the memory\r
209 map that requires a mapping.\r
210 @retval EFI_NOT_FOUND A virtual address was supplied for an address that is not found\r
211 in the memory map.\r
212\r
213**/\r
214typedef\r
215EFI_STATUS\r
216(EFIAPI *EFI_SET_VIRTUAL_ADDRESS_MAP) (\r
217 IN UINTN MemoryMapSize,\r
218 IN UINTN DescriptorSize,\r
219 IN UINT32 DescriptorVersion,\r
220 IN EFI_MEMORY_DESCRIPTOR *VirtualMap\r
221 );\r
222\r
223/**\r
224 Connects one or more drivers to a controller.\r
225\r
226 @param ControllerHandle The handle of the controller to which driver(s) are to be connected.\r
227 @param DriverImageHandle A pointer to an ordered list handles that support the\r
228 EFI_DRIVER_BINDING_PROTOCOL.\r
229 @param RemainingDevicePath A pointer to the device path that specifies a child of the\r
230 controller specified by ControllerHandle.\r
231 @param Recursive If TRUE, then ConnectController() is called recursively\r
232 until the entire tree of controllers below the controller specified\r
233 by ControllerHandle have been created. If FALSE, then\r
234 the tree of controllers is only expanded one level.\r
235\r
236 @retval EFI_SUCCESS 1) One or more drivers were connected to ControllerHandle.\r
237 2) No drivers were connected to ControllerHandle, but\r
238 RemainingDevicePath is not NULL, and it is an End Device\r
239 Path Node.\r
240 @retval EFI_INVALID_PARAMETER ControllerHandle is not a valid EFI_HANDLE.\r
241 @retval EFI_NOT_FOUND 1) There are no EFI_DRIVER_BINDING_PROTOCOL instances\r
242 present in the system.\r
243 2) No drivers were connected to ControllerHandle.\r
244\r
245**/\r
246typedef\r
247EFI_STATUS\r
248(EFIAPI *EFI_CONNECT_CONTROLLER) (\r
249 IN EFI_HANDLE ControllerHandle,\r
250 IN EFI_HANDLE *DriverImageHandle, OPTIONAL\r
251 IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath, OPTIONAL\r
252 IN BOOLEAN Recursive\r
253 );\r
254\r
255/**\r
256 Disconnects one or more drivers from a controller.\r
257\r
258 @param ControllerHandle The handle of the controller from which driver(s) are to be disconnected.\r
259 @param DriverImageHandle The driver to disconnect from ControllerHandle.\r
260 @param ChildHandle The handle of the child to destroy.\r
261\r
262 @retval EFI_SUCCESS 1) One or more drivers were disconnected from the controller.\r
263 2) On entry, no drivers are managing ControllerHandle.\r
264 3) DriverImageHandle is not NULL, and on entry\r
265 DriverImageHandle is not managing ControllerHandle.\r
266\r
267 @retval EFI_INVALID_PARAMETER One ore more parameters are invalid.\r
268 @retval EFI_OUT_OF_RESOURCES There are not enough resources available to disconnect any drivers from\r
269 ControllerHandle.\r
270 @retval EFI_DEVICE_ERROR The controller could not be disconnected because of a device error.\r
271\r
272**/\r
273typedef\r
274EFI_STATUS\r
275(EFIAPI *EFI_DISCONNECT_CONTROLLER) (\r
276 IN EFI_HANDLE ControllerHandle,\r
277 IN EFI_HANDLE DriverImageHandle, OPTIONAL\r
278 IN EFI_HANDLE ChildHandle OPTIONAL\r
279 );\r
280\r
281\r
282\r
283//\r
284// ConvertPointer DebugDisposition type.\r
285//\r
286#define EFI_OPTIONAL_PTR 0x00000001\r
287#define EFI_OPTIONAL_POINTER EFI_OPTIONAL_PTR\r
288\r
289/**\r
290 Determines the new virtual address that is to be used on subsequent memory accesses.\r
291\r
292 @param DebugDisposition Supplies type information for the pointer being converted.\r
293 @param Address A pointer to a pointer that is to be fixed to be the value needed\r
294 for the new virtual address mappings being applied.\r
295\r
296 @retval EFI_SUCCESS The pointer pointed to by Address was modified.\r
297 @retval EFI_INVALID_PARAMETER 1) Address is NULL.\r
298 2) *Address is NULL and DebugDisposition does\r
299 not have the EFI_OPTIONAL_PTR bit set.\r
300 @retval EFI_NOT_FOUND The pointer pointed to by Address was not found to be part\r
301 of the current memory map. This is normally fatal.\r
302\r
303**/\r
304typedef\r
305EFI_STATUS\r
306(EFIAPI *EFI_CONVERT_POINTER) (\r
307 IN UINTN DebugDisposition,\r
308 IN OUT VOID **Address\r
309 );\r
310\r
311\r
312//\r
313