3 * Copyright (c) 2013-2015, ARM Limited. All rights reserved.
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
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.
15 #ifndef __BDS_ENTRY_H__
16 #define __BDS_ENTRY_H__
18 #define IS_DEVICE_PATH_NODE(node,type,subtype) \
19 (((node)->Type == (type)) && ((node)->SubType == (subtype)))
22 This is defined by the UEFI specs, don't change it
25 UINT16 LoadOptionIndex
;
26 EFI_LOAD_OPTION
*LoadOption
;
30 UINT16 FilePathListLength
;
32 EFI_DEVICE_PATH_PROTOCOL
*FilePathList
;
35 UINTN OptionalDataSize
;
39 Connect a Device Path and return the handle of the driver that support this DevicePath
41 @param DevicePath Device Path of the File to connect
42 @param Handle Handle of the driver that support this DevicePath
43 @param RemainingDevicePath Remaining DevicePath nodes that do not match the driver DevicePath
45 @retval EFI_SUCCESS A driver that matches the Device Path has been found
46 @retval EFI_NOT_FOUND No handles match the search.
47 @retval EFI_INVALID_PARAMETER DevicePath or Handle is NULL
51 BdsConnectDevicePath (
52 IN EFI_DEVICE_PATH_PROTOCOL
* DevicePath
,
53 OUT EFI_HANDLE
*Handle
,
54 OUT EFI_DEVICE_PATH_PROTOCOL
**RemainingDevicePath
58 Connect all DXE drivers
60 @retval EFI_SUCCESS All drivers have been connected
61 @retval EFI_NOT_FOUND No handles match the search.
62 @retval EFI_OUT_OF_RESOURCES There is not resource pool memory to store the matching results.
66 BdsConnectAllDrivers (
71 Return the value of a global variable defined by its VariableName.
72 The variable must be defined with the VendorGuid gEfiGlobalVariableGuid.
74 @param VariableName A Null-terminated string that is the name of the vendor's
76 @param DefaultValue Value returned by the function if the variable does not exist
77 @param DataSize On input, the size in bytes of the return Data buffer.
78 On output the size of data returned in Data.
79 @param Value Value read from the UEFI Variable or copy of the default value
80 if the UEFI Variable does not exist
82 @retval EFI_SUCCESS All drivers have been connected
83 @retval EFI_NOT_FOUND No handles match the search.
84 @retval EFI_OUT_OF_RESOURCES There is not resource pool memory to store the matching results.
88 GetGlobalEnvironmentVariable (
89 IN CONST CHAR16
* VariableName
,
90 IN VOID
* DefaultValue
,
96 Return the value of the variable defined by its VariableName and VendorGuid
98 @param VariableName A Null-terminated string that is the name of the vendor's
100 @param VendorGuid A unique identifier for the vendor.
101 @param DefaultValue Value returned by the function if the variable does not exist
102 @param DataSize On input, the size in bytes of the return Data buffer.
103 On output the size of data returned in Data.
104 @param Value Value read from the UEFI Variable or copy of the default value
105 if the UEFI Variable does not exist
107 @retval EFI_SUCCESS All drivers have been connected
108 @retval EFI_NOT_FOUND No handles match the search.
109 @retval EFI_OUT_OF_RESOURCES There is not resource pool memory to store the matching results.
113 GetEnvironmentVariable (
114 IN CONST CHAR16
* VariableName
,
115 IN EFI_GUID
* VendorGuid
,
116 IN VOID
* DefaultValue
,
122 BootOptionFromLoadOptionIndex (
123 IN UINT16 LoadOptionIndex
,
124 OUT BDS_LOAD_OPTION
** BdsLoadOption
128 BootOptionFromLoadOptionVariable (
129 IN CHAR16
* BootVariableName
,
130 OUT BDS_LOAD_OPTION
** BdsLoadOption
134 BootOptionToLoadOptionVariable (
135 IN BDS_LOAD_OPTION
* BdsLoadOption
139 BootOptionAllocateBootIndex (
144 Start an EFI Application from a Device Path
146 @param ParentImageHandle Handle of the calling image
147 @param DevicePath Location of the EFI Application
149 @retval EFI_SUCCESS All drivers have been connected
150 @retval EFI_NOT_FOUND The Linux kernel Device Path has not been found
151 @retval EFI_OUT_OF_RESOURCES There is not enough resource memory to store the matching results.
155 BdsStartEfiApplication (
156 IN EFI_HANDLE ParentImageHandle
,
157 IN EFI_DEVICE_PATH_PROTOCOL
*DevicePath
,
158 IN UINTN LoadOptionsSize
,
164 IN EFI_DEVICE_PATH
*DevicePath
,
165 IN EFI_ALLOCATE_TYPE Type
,
166 IN OUT EFI_PHYSICAL_ADDRESS
* Image
,
171 * Call BS.ExitBootServices with the appropriate Memory Map information
174 ShutdownUefiBootServices (
179 Locate an EFI application in a the Firmware Volumes by its name
181 @param EfiAppGuid Guid of the EFI Application into the Firmware Volume
182 @param DevicePath EFI Device Path of the EFI application
184 @return EFI_SUCCESS The function completed successfully.
185 @return EFI_NOT_FOUND The protocol could not be located.
186 @return EFI_OUT_OF_RESOURCES There are not enough resources to find the protocol.
190 LocateEfiApplicationInFvByName (
191 IN CONST CHAR16
* EfiAppName
,
192 OUT EFI_DEVICE_PATH
**DevicePath
196 Locate an EFI application in a the Firmware Volumes by its GUID
198 @param EfiAppGuid Guid of the EFI Application into the Firmware Volume
199 @param DevicePath EFI Device Path of the EFI application
201 @return EFI_SUCCESS The function completed successfully.
202 @return EFI_NOT_FOUND The protocol could not be located.
203 @return EFI_OUT_OF_RESOURCES There are not enough resources to find the protocol.
207 LocateEfiApplicationInFvByGuid (
208 IN CONST EFI_GUID
*EfiAppGuid
,
209 OUT EFI_DEVICE_PATH
**DevicePath