blob: 9fa687041860f2f74dbdcac2c9af6b676280d237 [file] [log] [blame]
Vishal Bhoj82c80712015-12-15 21:13:33 +05301/** @file
2*
3* Copyright (c) 2013, 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
18typedef UINT8* EFI_LOAD_OPTION;
19
20/**
21 This is defined by the UEFI specs, don't change it
22**/
23typedef struct {
24 UINT16 LoadOptionIndex;
25 EFI_LOAD_OPTION LoadOption;
26 UINTN LoadOptionSize;
27
28 UINT32 Attributes;
29 UINT16 FilePathListLength;
30 CHAR16 *Description;
31 EFI_DEVICE_PATH_PROTOCOL *FilePathList;
32
33 VOID* OptionalData;
34 UINTN OptionalDataSize;
35} BDS_LOAD_OPTION;
36
37/**
38 Connect a Device Path and return the handle of the driver that support this DevicePath
39
40 @param DevicePath Device Path of the File to connect
41 @param Handle Handle of the driver that support this DevicePath
42 @param RemainingDevicePath Remaining DevicePath nodes that do not match the driver DevicePath
43
44 @retval EFI_SUCCESS A driver that matches the Device Path has been found
45 @retval EFI_NOT_FOUND No handles match the search.
46 @retval EFI_INVALID_PARAMETER DevicePath or Handle is NULL
47
48**/
49EFI_STATUS
50BdsConnectDevicePath (
51 IN EFI_DEVICE_PATH_PROTOCOL* DevicePath,
52 OUT EFI_HANDLE *Handle,
53 OUT EFI_DEVICE_PATH_PROTOCOL **RemainingDevicePath
54 );
55
56/**
57 Connect all DXE drivers
58
59 @retval EFI_SUCCESS All drivers have been connected
60 @retval EFI_NOT_FOUND No handles match the search.
61 @retval EFI_OUT_OF_RESOURCES There is not resource pool memory to store the matching results.
62
63**/
64EFI_STATUS
65BdsConnectAllDrivers (
66 VOID
67 );
68
69/**
70 Return the value of a global variable defined by its VariableName.
71 The variable must be defined with the VendorGuid gEfiGlobalVariableGuid.
72
73 @param VariableName A Null-terminated string that is the name of the vendor's
74 variable.
75 @param DefaultValue Value returned by the function if the variable does not exist
76 @param DataSize On input, the size in bytes of the return Data buffer.
77 On output the size of data returned in Data.
78 @param Value Value read from the UEFI Variable or copy of the default value
79 if the UEFI Variable does not exist
80
81 @retval EFI_SUCCESS All drivers have been connected
82 @retval EFI_NOT_FOUND No handles match the search.
83 @retval EFI_OUT_OF_RESOURCES There is not resource pool memory to store the matching results.
84
85**/
86EFI_STATUS
87GetGlobalEnvironmentVariable (
88 IN CONST CHAR16* VariableName,
89 IN VOID* DefaultValue,
90 IN OUT UINTN* Size,
91 OUT VOID** Value
92 );
93
94/**
95 Return the value of the variable defined by its VariableName and VendorGuid
96
97 @param VariableName A Null-terminated string that is the name of the vendor's
98 variable.
99 @param VendorGuid A unique identifier for the vendor.
100 @param DefaultValue Value returned by the function if the variable does not exist
101 @param DataSize On input, the size in bytes of the return Data buffer.
102 On output the size of data returned in Data.
103 @param Value Value read from the UEFI Variable or copy of the default value
104 if the UEFI Variable does not exist
105
106 @retval EFI_SUCCESS All drivers have been connected
107 @retval EFI_NOT_FOUND No handles match the search.
108 @retval EFI_OUT_OF_RESOURCES There is not resource pool memory to store the matching results.
109
110**/
111EFI_STATUS
112GetEnvironmentVariable (
113 IN CONST CHAR16* VariableName,
114 IN EFI_GUID* VendorGuid,
115 IN VOID* DefaultValue,
116 IN OUT UINTN* Size,
117 OUT VOID** Value
118 );
119
120EFI_STATUS
121BootOptionFromLoadOptionIndex (
122 IN UINT16 LoadOptionIndex,
123 OUT BDS_LOAD_OPTION** BdsLoadOption
124 );
125
126EFI_STATUS
127BootOptionFromLoadOptionVariable (
128 IN CHAR16* BootVariableName,
129 OUT BDS_LOAD_OPTION** BdsLoadOption
130 );
131
132EFI_STATUS
133BootOptionToLoadOptionVariable (
134 IN BDS_LOAD_OPTION* BdsLoadOption
135 );
136
137UINT16
138BootOptionAllocateBootIndex (
139 VOID
140 );
141
142/**
143 Start a Linux kernel from a Device Path
144
145 @param LinuxKernel Device Path to the Linux Kernel
146 @param Parameters Linux kernel arguments
147
148 @retval EFI_SUCCESS All drivers have been connected
149 @retval EFI_NOT_FOUND The Linux kernel Device Path has not been found
150 @retval EFI_OUT_OF_RESOURCES There is not enough resource memory to store the matching results.
151
152**/
153EFI_STATUS
154BdsBootLinuxAtag (
155 IN EFI_DEVICE_PATH_PROTOCOL* LinuxKernelDevicePath,
156 IN EFI_DEVICE_PATH_PROTOCOL* InitrdDevicePath,
157 IN CONST CHAR8* Arguments
158 );
159
160/**
161 Start a Linux kernel from a Device Path
162
163 @param LinuxKernel Device Path to the Linux Kernel
164 @param Parameters Linux kernel arguments
165 @param Fdt Device Path to the Flat Device Tree
166
167 @retval EFI_SUCCESS All drivers have been connected
168 @retval EFI_NOT_FOUND The Linux kernel Device Path has not been found
169 @retval EFI_OUT_OF_RESOURCES There is not enough resource memory to store the matching results.
170
171**/
172EFI_STATUS
173BdsBootLinuxFdt (
174 IN EFI_DEVICE_PATH_PROTOCOL* LinuxKernelDevicePath,
175 IN EFI_DEVICE_PATH_PROTOCOL* InitrdDevicePath,
176 IN CONST CHAR8* Arguments,
177 IN EFI_DEVICE_PATH_PROTOCOL* FdtDevicePath
178 );
179
180/**
181 Start an EFI Application from a Device Path
182
183 @param ParentImageHandle Handle of the calling image
184 @param DevicePath Location of the EFI Application
185
186 @retval EFI_SUCCESS All drivers have been connected
187 @retval EFI_NOT_FOUND The Linux kernel Device Path has not been found
188 @retval EFI_OUT_OF_RESOURCES There is not enough resource memory to store the matching results.
189
190**/
191EFI_STATUS
192BdsStartEfiApplication (
193 IN EFI_HANDLE ParentImageHandle,
194 IN EFI_DEVICE_PATH_PROTOCOL *DevicePath,
195 IN UINTN LoadOptionsSize,
196 IN VOID* LoadOptions
197 );
198
199/**
200 Start an EFI Application from any Firmware Volume
201
202 @param EfiApp EFI Application Name
203
204 @retval EFI_SUCCESS All drivers have been connected
205 @retval EFI_NOT_FOUND The Linux kernel Device Path has not been found
206 @retval EFI_OUT_OF_RESOURCES There is not enough resource memory to store the matching results.
207
208**/
209EFI_STATUS
210BdsLoadApplication (
211 IN EFI_HANDLE ParentImageHandle,
212 IN CHAR16* EfiApp,
213 IN UINTN LoadOptionsSize,
214 IN VOID* LoadOptions
215 );
216
217EFI_STATUS
218BdsLoadImage (
219 IN EFI_DEVICE_PATH *DevicePath,
220 IN EFI_ALLOCATE_TYPE Type,
221 IN OUT EFI_PHYSICAL_ADDRESS* Image,
222 OUT UINTN *FileSize
223 );
224
225#endif