]> git.proxmox.com Git - mirror_edk2.git/blob - ArmPkg/Include/Library/BdsLib.h
c6416db8ae79aabb0d46edb1ad86a44348064ce6
[mirror_edk2.git] / ArmPkg / Include / Library / BdsLib.h
1 /** @file
2 *
3 * Copyright (c) 2013-2015, ARM Limited. All rights reserved.
4 *
5 * This program and the accompanying materials
6 * are licensed and made available under the terms and conditions of the BSD License
7 * which accompanies this distribution. The full text of the license may be found at
8 * http://opensource.org/licenses/bsd-license.php
9 *
10 * THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
12 *
13 **/
14
15 #ifndef __BDS_ENTRY_H__
16 #define __BDS_ENTRY_H__
17
18 /**
19 This is defined by the UEFI specs, don't change it
20 **/
21 typedef struct {
22 UINT16 LoadOptionIndex;
23 EFI_LOAD_OPTION *LoadOption;
24 UINTN LoadOptionSize;
25
26 UINT32 Attributes;
27 UINT16 FilePathListLength;
28 CHAR16 *Description;
29 EFI_DEVICE_PATH_PROTOCOL *FilePathList;
30
31 VOID* OptionalData;
32 UINTN OptionalDataSize;
33 } BDS_LOAD_OPTION;
34
35 /**
36 Connect a Device Path and return the handle of the driver that support this DevicePath
37
38 @param DevicePath Device Path of the File to connect
39 @param Handle Handle of the driver that support this DevicePath
40 @param RemainingDevicePath Remaining DevicePath nodes that do not match the driver DevicePath
41
42 @retval EFI_SUCCESS A driver that matches the Device Path has been found
43 @retval EFI_NOT_FOUND No handles match the search.
44 @retval EFI_INVALID_PARAMETER DevicePath or Handle is NULL
45
46 **/
47 EFI_STATUS
48 BdsConnectDevicePath (
49 IN EFI_DEVICE_PATH_PROTOCOL* DevicePath,
50 OUT EFI_HANDLE *Handle,
51 OUT EFI_DEVICE_PATH_PROTOCOL **RemainingDevicePath
52 );
53
54 /**
55 Connect all DXE drivers
56
57 @retval EFI_SUCCESS All drivers have been connected
58 @retval EFI_NOT_FOUND No handles match the search.
59 @retval EFI_OUT_OF_RESOURCES There is not resource pool memory to store the matching results.
60
61 **/
62 EFI_STATUS
63 BdsConnectAllDrivers (
64 VOID
65 );
66
67 /**
68 Return the value of a global variable defined by its VariableName.
69 The variable must be defined with the VendorGuid gEfiGlobalVariableGuid.
70
71 @param VariableName A Null-terminated string that is the name of the vendor's
72 variable.
73 @param DefaultValue Value returned by the function if the variable does not exist
74 @param DataSize On input, the size in bytes of the return Data buffer.
75 On output the size of data returned in Data.
76 @param Value Value read from the UEFI Variable or copy of the default value
77 if the UEFI Variable does not exist
78
79 @retval EFI_SUCCESS All drivers have been connected
80 @retval EFI_NOT_FOUND No handles match the search.
81 @retval EFI_OUT_OF_RESOURCES There is not resource pool memory to store the matching results.
82
83 **/
84 EFI_STATUS
85 GetGlobalEnvironmentVariable (
86 IN CONST CHAR16* VariableName,
87 IN VOID* DefaultValue,
88 IN OUT UINTN* Size,
89 OUT VOID** Value
90 );
91
92 /**
93 Return the value of the variable defined by its VariableName and VendorGuid
94
95 @param VariableName A Null-terminated string that is the name of the vendor's
96 variable.
97 @param VendorGuid A unique identifier for the vendor.
98 @param DefaultValue Value returned by the function if the variable does not exist
99 @param DataSize On input, the size in bytes of the return Data buffer.
100 On output the size of data returned in Data.
101 @param Value Value read from the UEFI Variable or copy of the default value
102 if the UEFI Variable does not exist
103
104 @retval EFI_SUCCESS All drivers have been connected
105 @retval EFI_NOT_FOUND No handles match the search.
106 @retval EFI_OUT_OF_RESOURCES There is not resource pool memory to store the matching results.
107
108 **/
109 EFI_STATUS
110 GetEnvironmentVariable (
111 IN CONST CHAR16* VariableName,
112 IN EFI_GUID* VendorGuid,
113 IN VOID* DefaultValue,
114 IN OUT UINTN* Size,
115 OUT VOID** Value
116 );
117
118 EFI_STATUS
119 BootOptionFromLoadOptionIndex (
120 IN UINT16 LoadOptionIndex,
121 OUT BDS_LOAD_OPTION** BdsLoadOption
122 );
123
124 EFI_STATUS
125 BootOptionFromLoadOptionVariable (
126 IN CHAR16* BootVariableName,
127 OUT BDS_LOAD_OPTION** BdsLoadOption
128 );
129
130 EFI_STATUS
131 BootOptionToLoadOptionVariable (
132 IN BDS_LOAD_OPTION* BdsLoadOption
133 );
134
135 UINT16
136 BootOptionAllocateBootIndex (
137 VOID
138 );
139
140 /**
141 Start a Linux kernel from a Device Path
142
143 @param LinuxKernel Device Path to the Linux Kernel
144 @param Parameters Linux kernel arguments
145
146 @retval EFI_SUCCESS All drivers have been connected
147 @retval EFI_NOT_FOUND The Linux kernel Device Path has not been found
148 @retval EFI_OUT_OF_RESOURCES There is not enough resource memory to store the matching results.
149
150 **/
151 EFI_STATUS
152 BdsBootLinuxAtag (
153 IN EFI_DEVICE_PATH_PROTOCOL* LinuxKernelDevicePath,
154 IN EFI_DEVICE_PATH_PROTOCOL* InitrdDevicePath,
155 IN CONST CHAR8* Arguments
156 );
157
158 /**
159 Start a Linux kernel from a Device Path
160
161 @param[in] LinuxKernelDevicePath Device Path to the Linux Kernel
162 @param[in] InitrdDevicePath Device Path to the Initrd
163 @param[in] Arguments Linux kernel arguments
164
165 @retval EFI_SUCCESS All drivers have been connected
166 @retval EFI_NOT_FOUND The Linux kernel Device Path has not been found
167 @retval EFI_OUT_OF_RESOURCES There is not enough resource memory to store the matching results.
168
169 **/
170 EFI_STATUS
171 BdsBootLinuxFdt (
172 IN EFI_DEVICE_PATH_PROTOCOL* LinuxKernelDevicePath,
173 IN EFI_DEVICE_PATH_PROTOCOL* InitrdDevicePath,
174 IN CONST CHAR8* Arguments
175 );
176
177 /**
178 Start an EFI Application from a Device Path
179
180 @param ParentImageHandle Handle of the calling image
181 @param DevicePath Location of the EFI Application
182
183 @retval EFI_SUCCESS All drivers have been connected
184 @retval EFI_NOT_FOUND The Linux kernel Device Path has not been found
185 @retval EFI_OUT_OF_RESOURCES There is not enough resource memory to store the matching results.
186
187 **/
188 EFI_STATUS
189 BdsStartEfiApplication (
190 IN EFI_HANDLE ParentImageHandle,
191 IN EFI_DEVICE_PATH_PROTOCOL *DevicePath,
192 IN UINTN LoadOptionsSize,
193 IN VOID* LoadOptions
194 );
195
196 /**
197 Start an EFI Application from any Firmware Volume
198
199 @param EfiApp EFI Application Name
200
201 @retval EFI_SUCCESS All drivers have been connected
202 @retval EFI_NOT_FOUND The Linux kernel Device Path has not been found
203 @retval EFI_OUT_OF_RESOURCES There is not enough resource memory to store the matching results.
204
205 **/
206 EFI_STATUS
207 BdsLoadApplication (
208 IN EFI_HANDLE ParentImageHandle,
209 IN CHAR16* EfiApp,
210 IN UINTN LoadOptionsSize,
211 IN VOID* LoadOptions
212 );
213
214 EFI_STATUS
215 BdsLoadImage (
216 IN EFI_DEVICE_PATH *DevicePath,
217 IN EFI_ALLOCATE_TYPE Type,
218 IN OUT EFI_PHYSICAL_ADDRESS* Image,
219 OUT UINTN *FileSize
220 );
221
222 /**
223 * Call BS.ExitBootServices with the appropriate Memory Map information
224 */
225 EFI_STATUS
226 ShutdownUefiBootServices (
227 VOID
228 );
229
230 #endif