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