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 an EFI Application from a Device Path 142 143 @param ParentImageHandle Handle of the calling image 144 @param DevicePath Location of the EFI Application 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 BdsStartEfiApplication ( 153 IN EFI_HANDLE ParentImageHandle, 154 IN EFI_DEVICE_PATH_PROTOCOL *DevicePath, 155 IN UINTN LoadOptionsSize, 156 IN VOID* LoadOptions 157 ); 158 159 EFI_STATUS 160 BdsLoadImage ( 161 IN EFI_DEVICE_PATH *DevicePath, 162 IN EFI_ALLOCATE_TYPE Type, 163 IN OUT EFI_PHYSICAL_ADDRESS* Image, 164 OUT UINTN *FileSize 165 ); 166 167 /** 168 * Call BS.ExitBootServices with the appropriate Memory Map information 169 */ 170 EFI_STATUS 171 ShutdownUefiBootServices ( 172 VOID 173 ); 174 175 /** 176 Locate an EFI application in a the Firmware Volumes by its name 177 178 @param EfiAppGuid Guid of the EFI Application into the Firmware Volume 179 @param DevicePath EFI Device Path of the EFI application 180 181 @return EFI_SUCCESS The function completed successfully. 182 @return EFI_NOT_FOUND The protocol could not be located. 183 @return EFI_OUT_OF_RESOURCES There are not enough resources to find the protocol. 184 185 **/ 186 EFI_STATUS 187 LocateEfiApplicationInFvByName ( 188 IN CONST CHAR16* EfiAppName, 189 OUT EFI_DEVICE_PATH **DevicePath 190 ); 191 192 /** 193 Locate an EFI application in a the Firmware Volumes by its GUID 194 195 @param EfiAppGuid Guid of the EFI Application into the Firmware Volume 196 @param DevicePath EFI Device Path of the EFI application 197 198 @return EFI_SUCCESS The function completed successfully. 199 @return EFI_NOT_FOUND The protocol could not be located. 200 @return EFI_OUT_OF_RESOURCES There are not enough resources to find the protocol. 201 202 **/ 203 EFI_STATUS 204 LocateEfiApplicationInFvByGuid ( 205 IN CONST EFI_GUID *EfiAppGuid, 206 OUT EFI_DEVICE_PATH **DevicePath 207 ); 208 209 #endif 210