]> git.proxmox.com Git - mirror_edk2.git/blame - MdeModulePkg/Library/UefiBootManagerLib/BmMisc.c
MdeModulePkg: Apply uncrustify changes
[mirror_edk2.git] / MdeModulePkg / Library / UefiBootManagerLib / BmMisc.c
CommitLineData
067ed98a
RN
1/** @file\r
2 Misc library functions.\r
3\r
f7fdd620 4Copyright (c) 2011 - 2019, Intel Corporation. All rights reserved.<BR>\r
fb5848c5 5(C) Copyright 2016 Hewlett Packard Enterprise Development LP<BR>\r
9d510e61 6SPDX-License-Identifier: BSD-2-Clause-Patent\r
067ed98a
RN
7\r
8**/\r
9\r
10#include "InternalBm.h"\r
11\r
12/**\r
13 Delete the instance in Multi which matches partly with Single instance\r
14\r
15 @param Multi A pointer to a multi-instance device path data\r
16 structure.\r
17 @param Single A pointer to a single-instance device path data\r
18 structure.\r
19\r
20 @return This function will remove the device path instances in Multi which partly\r
21 match with the Single, and return the result device path. If there is no\r
22 remaining device path as a result, this function will return NULL.\r
23\r
24**/\r
25EFI_DEVICE_PATH_PROTOCOL *\r
26BmDelPartMatchInstance (\r
27 IN EFI_DEVICE_PATH_PROTOCOL *Multi,\r
28 IN EFI_DEVICE_PATH_PROTOCOL *Single\r
29 )\r
30{\r
31 EFI_DEVICE_PATH_PROTOCOL *Instance;\r
32 EFI_DEVICE_PATH_PROTOCOL *NewDevicePath;\r
33 EFI_DEVICE_PATH_PROTOCOL *TempNewDevicePath;\r
34 UINTN InstanceSize;\r
35 UINTN SingleDpSize;\r
36\r
37 NewDevicePath = NULL;\r
38 TempNewDevicePath = NULL;\r
39\r
1436aea4 40 if ((Multi == NULL) || (Single == NULL)) {\r
067ed98a
RN
41 return Multi;\r
42 }\r
43\r
1436aea4
MK
44 Instance = GetNextDevicePathInstance (&Multi, &InstanceSize);\r
45 SingleDpSize = GetDevicePathSize (Single) - END_DEVICE_PATH_LENGTH;\r
46 InstanceSize -= END_DEVICE_PATH_LENGTH;\r
067ed98a
RN
47\r
48 while (Instance != NULL) {\r
067ed98a
RN
49 if (CompareMem (Instance, Single, MIN (SingleDpSize, InstanceSize)) != 0) {\r
50 //\r
51 // Append the device path instance which does not match with Single\r
52 //\r
53 TempNewDevicePath = NewDevicePath;\r
1436aea4 54 NewDevicePath = AppendDevicePathInstance (NewDevicePath, Instance);\r
067ed98a 55 if (TempNewDevicePath != NULL) {\r
1436aea4 56 FreePool (TempNewDevicePath);\r
067ed98a
RN
57 }\r
58 }\r
1436aea4
MK
59\r
60 FreePool (Instance);\r
067ed98a
RN
61 Instance = GetNextDevicePathInstance (&Multi, &InstanceSize);\r
62 InstanceSize -= END_DEVICE_PATH_LENGTH;\r
63 }\r
64\r
65 return NewDevicePath;\r
66}\r
67\r
68/**\r
69 Function compares a device path data structure to that of all the nodes of a\r
70 second device path instance.\r
71\r
72 @param Multi A pointer to a multi-instance device path data\r
73 structure.\r
74 @param Single A pointer to a single-instance device path data\r
75 structure.\r
76\r
77 @retval TRUE If the Single device path is contained within Multi device path.\r
78 @retval FALSE The Single device path is not match within Multi device path.\r
79\r
80**/\r
81BOOLEAN\r
82BmMatchDevicePaths (\r
83 IN EFI_DEVICE_PATH_PROTOCOL *Multi,\r
84 IN EFI_DEVICE_PATH_PROTOCOL *Single\r
85 )\r
86{\r
87 EFI_DEVICE_PATH_PROTOCOL *DevicePath;\r
88 EFI_DEVICE_PATH_PROTOCOL *DevicePathInst;\r
89 UINTN Size;\r
90\r
1436aea4 91 if ((Multi == NULL) || (Single == NULL)) {\r
067ed98a
RN
92 return FALSE;\r
93 }\r
94\r
95 DevicePath = Multi;\r
96 DevicePathInst = GetNextDevicePathInstance (&DevicePath, &Size);\r
97\r
98 //\r
99 // Search for the match of 'Single' in 'Multi'\r
100 //\r
101 while (DevicePathInst != NULL) {\r
102 //\r
103 // If the single device path is found in multiple device paths,\r
104 // return success\r
105 //\r
106 if (CompareMem (Single, DevicePathInst, Size) == 0) {\r
107 FreePool (DevicePathInst);\r
108 return TRUE;\r
109 }\r
110\r
111 FreePool (DevicePathInst);\r
112 DevicePathInst = GetNextDevicePathInstance (&DevicePath, &Size);\r
113 }\r
114\r
115 return FALSE;\r
116}\r
117\r
118/**\r
d1102dba 119 This routine adjust the memory information for different memory type and\r
665b26ba
RN
120 save them into the variables for next boot. It resets the system when\r
121 memory information is updated and the current boot option belongs to\r
024bdafc
RN
122 boot category instead of application category. It doesn't count the\r
123 reserved memory occupied by RAM Disk.\r
665b26ba 124\r
024bdafc
RN
125 @param Boot TRUE if current boot option belongs to boot\r
126 category instead of application category.\r
067ed98a
RN
127**/\r
128VOID\r
129BmSetMemoryTypeInformationVariable (\r
1436aea4 130 IN BOOLEAN Boot\r
067ed98a
RN
131 )\r
132{\r
133 EFI_STATUS Status;\r
134 EFI_MEMORY_TYPE_INFORMATION *PreviousMemoryTypeInformation;\r
135 EFI_MEMORY_TYPE_INFORMATION *CurrentMemoryTypeInformation;\r
136 UINTN VariableSize;\r
137 UINTN Index;\r
138 UINTN Index1;\r
139 UINT32 Previous;\r
140 UINT32 Current;\r
141 UINT32 Next;\r
142 EFI_HOB_GUID_TYPE *GuidHob;\r
143 BOOLEAN MemoryTypeInformationModified;\r
144 BOOLEAN MemoryTypeInformationVariableExists;\r
145 EFI_BOOT_MODE BootMode;\r
146\r
147 MemoryTypeInformationModified = FALSE;\r
148 MemoryTypeInformationVariableExists = FALSE;\r
149\r
067ed98a
RN
150 BootMode = GetBootModeHob ();\r
151 //\r
152 // In BOOT_IN_RECOVERY_MODE, Variable region is not reliable.\r
153 //\r
154 if (BootMode == BOOT_IN_RECOVERY_MODE) {\r
155 return;\r
156 }\r
157\r
158 //\r
d1102dba 159 // Only check the the Memory Type Information variable in the boot mode\r
067ed98a
RN
160 // other than BOOT_WITH_DEFAULT_SETTINGS because the Memory Type\r
161 // Information is not valid in this boot mode.\r
162 //\r
163 if (BootMode != BOOT_WITH_DEFAULT_SETTINGS) {\r
164 VariableSize = 0;\r
1436aea4
MK
165 Status = gRT->GetVariable (\r
166 EFI_MEMORY_TYPE_INFORMATION_VARIABLE_NAME,\r
167 &gEfiMemoryTypeInformationGuid,\r
168 NULL,\r
169 &VariableSize,\r
170 NULL\r
171 );\r
067ed98a
RN
172 if (Status == EFI_BUFFER_TOO_SMALL) {\r
173 MemoryTypeInformationVariableExists = TRUE;\r
174 }\r
175 }\r
176\r
177 //\r
178 // Retrieve the current memory usage statistics. If they are not found, then\r
179 // no adjustments can be made to the Memory Type Information variable.\r
180 //\r
181 Status = EfiGetSystemConfigurationTable (\r
182 &gEfiMemoryTypeInformationGuid,\r
1436aea4 183 (VOID **)&CurrentMemoryTypeInformation\r
067ed98a 184 );\r
1436aea4 185 if (EFI_ERROR (Status) || (CurrentMemoryTypeInformation == NULL)) {\r
067ed98a
RN
186 return;\r
187 }\r
188\r
189 //\r
190 // Get the Memory Type Information settings from Hob if they exist,\r
191 // PEI is responsible for getting them from variable and build a Hob to save them.\r
192 // If the previous Memory Type Information is not available, then set defaults\r
193 //\r
194 GuidHob = GetFirstGuidHob (&gEfiMemoryTypeInformationGuid);\r
195 if (GuidHob == NULL) {\r
196 //\r
197 // If Platform has not built Memory Type Info into the Hob, just return.\r
198 //\r
199 return;\r
200 }\r
1436aea4 201\r
0dc3359a
RN
202 VariableSize = GET_GUID_HOB_DATA_SIZE (GuidHob);\r
203 PreviousMemoryTypeInformation = AllocateCopyPool (VariableSize, GET_GUID_HOB_DATA (GuidHob));\r
204 if (PreviousMemoryTypeInformation == NULL) {\r
205 return;\r
206 }\r
067ed98a
RN
207\r
208 //\r
209 // Use a heuristic to adjust the Memory Type Information for the next boot\r
210 //\r
87000d77
MK
211 DEBUG ((DEBUG_INFO, "Memory Previous Current Next \n"));\r
212 DEBUG ((DEBUG_INFO, " Type Pages Pages Pages \n"));\r
213 DEBUG ((DEBUG_INFO, "====== ======== ======== ========\n"));\r
067ed98a
RN
214\r
215 for (Index = 0; PreviousMemoryTypeInformation[Index].Type != EfiMaxMemoryType; Index++) {\r
067ed98a
RN
216 for (Index1 = 0; CurrentMemoryTypeInformation[Index1].Type != EfiMaxMemoryType; Index1++) {\r
217 if (PreviousMemoryTypeInformation[Index].Type == CurrentMemoryTypeInformation[Index1].Type) {\r
218 break;\r
219 }\r
220 }\r
1436aea4 221\r
067ed98a
RN
222 if (CurrentMemoryTypeInformation[Index1].Type == EfiMaxMemoryType) {\r
223 continue;\r
224 }\r
225\r
226 //\r
227 // Previous is the number of pages pre-allocated\r
228 // Current is the number of pages actually needed\r
229 //\r
230 Previous = PreviousMemoryTypeInformation[Index].NumberOfPages;\r
231 Current = CurrentMemoryTypeInformation[Index1].NumberOfPages;\r
232 Next = Previous;\r
233\r
234 //\r
235 // Inconsistent Memory Reserved across bootings may lead to S4 fail\r
236 // Write next varible to 125% * current when the pre-allocated memory is:\r
237 // 1. More than 150% of needed memory and boot mode is BOOT_WITH_DEFAULT_SETTING\r
238 // 2. Less than the needed memory\r
239 //\r
240 if ((Current + (Current >> 1)) < Previous) {\r
241 if (BootMode == BOOT_WITH_DEFAULT_SETTINGS) {\r
242 Next = Current + (Current >> 2);\r
243 }\r
244 } else if (Current > Previous) {\r
245 Next = Current + (Current >> 2);\r
246 }\r
1436aea4
MK
247\r
248 if ((Next > 0) && (Next < 4)) {\r
067ed98a
RN
249 Next = 4;\r
250 }\r
251\r
252 if (Next != Previous) {\r
253 PreviousMemoryTypeInformation[Index].NumberOfPages = Next;\r
1436aea4 254 MemoryTypeInformationModified = TRUE;\r
067ed98a
RN
255 }\r
256\r
87000d77 257 DEBUG ((DEBUG_INFO, " %02x %08x %08x %08x\n", PreviousMemoryTypeInformation[Index].Type, Previous, Current, Next));\r
067ed98a
RN
258 }\r
259\r
260 //\r
261 // If any changes were made to the Memory Type Information settings, then set the new variable value;\r
262 // Or create the variable in first boot.\r
263 //\r
264 if (MemoryTypeInformationModified || !MemoryTypeInformationVariableExists) {\r
265 Status = BmSetVariableAndReportStatusCodeOnError (\r
266 EFI_MEMORY_TYPE_INFORMATION_VARIABLE_NAME,\r
267 &gEfiMemoryTypeInformationGuid,\r
268 EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_BOOTSERVICE_ACCESS,\r
269 VariableSize,\r
270 PreviousMemoryTypeInformation\r
271 );\r
272\r
273 if (!EFI_ERROR (Status)) {\r
274 //\r
665b26ba
RN
275 // If the Memory Type Information settings have been modified and the boot option belongs to boot category,\r
276 // then reset the platform so the new Memory Type Information setting will be used to guarantee that an S4\r
067ed98a
RN
277 // entry/resume cycle will not fail.\r
278 //\r
0dc3359a 279 if (MemoryTypeInformationModified) {\r
87000d77 280 DEBUG ((DEBUG_INFO, "Memory Type Information settings change.\n"));\r
0dc3359a 281 if (Boot && PcdGetBool (PcdResetOnMemoryTypeInformationChange)) {\r
87000d77 282 DEBUG ((DEBUG_INFO, "...Warm Reset!!!\n"));\r
0dc3359a
RN
283 gRT->ResetSystem (EfiResetWarm, EFI_SUCCESS, 0, NULL);\r
284 }\r
067ed98a
RN
285 }\r
286 } else {\r
87000d77 287 DEBUG ((DEBUG_ERROR, "Memory Type Information settings cannot be saved. OS S4 may fail!\n"));\r
067ed98a
RN
288 }\r
289 }\r
1436aea4 290\r
0dc3359a 291 FreePool (PreviousMemoryTypeInformation);\r
067ed98a
RN
292}\r
293\r
294/**\r
295 Set the variable and report the error through status code upon failure.\r
296\r
297 @param VariableName A Null-terminated string that is the name of the vendor's variable.\r
298 Each VariableName is unique for each VendorGuid. VariableName must\r
299 contain 1 or more characters. If VariableName is an empty string,\r
300 then EFI_INVALID_PARAMETER is returned.\r
301 @param VendorGuid A unique identifier for the vendor.\r
302 @param Attributes Attributes bitmask to set for the variable.\r
d1102dba 303 @param DataSize The size in bytes of the Data buffer. Unless the EFI_VARIABLE_APPEND_WRITE,\r
4073f85d 304 or EFI_VARIABLE_TIME_BASED_AUTHENTICATED_WRITE_ACCESS attribute is set, a size of zero\r
d1102dba
LG
305 causes the variable to be deleted. When the EFI_VARIABLE_APPEND_WRITE attribute is\r
306 set, then a SetVariable() call with a DataSize of zero will not cause any change to\r
307 the variable value (the timestamp associated with the variable may be updated however\r
308 even if no new data value is provided,see the description of the\r
309 EFI_VARIABLE_AUTHENTICATION_2 descriptor below. In this case the DataSize will not\r
310 be zero since the EFI_VARIABLE_AUTHENTICATION_2 descriptor will be populated).\r
067ed98a
RN
311 @param Data The contents for the variable.\r
312\r
313 @retval EFI_SUCCESS The firmware has successfully stored the variable and its data as\r
314 defined by the Attributes.\r
315 @retval EFI_INVALID_PARAMETER An invalid combination of attribute bits, name, and GUID was supplied, or the\r
316 DataSize exceeds the maximum allowed.\r
317 @retval EFI_INVALID_PARAMETER VariableName is an empty string.\r
318 @retval EFI_OUT_OF_RESOURCES Not enough storage is available to hold the variable and its data.\r
319 @retval EFI_DEVICE_ERROR The variable could not be retrieved due to a hardware error.\r
320 @retval EFI_WRITE_PROTECTED The variable in question is read-only.\r
321 @retval EFI_WRITE_PROTECTED The variable in question cannot be deleted.\r
4073f85d
ZC
322 @retval EFI_SECURITY_VIOLATION The variable could not be written due to EFI_VARIABLE_TIME_BASED_AUTHENTICATED_WRITE_ACESS\r
323 being set, but the AuthInfo does NOT pass the validation check carried out by the firmware.\r
067ed98a
RN
324\r
325 @retval EFI_NOT_FOUND The variable trying to be updated or deleted was not found.\r
326**/\r
327EFI_STATUS\r
328BmSetVariableAndReportStatusCodeOnError (\r
1436aea4
MK
329 IN CHAR16 *VariableName,\r
330 IN EFI_GUID *VendorGuid,\r
331 IN UINT32 Attributes,\r
332 IN UINTN DataSize,\r
333 IN VOID *Data\r
067ed98a
RN
334 )\r
335{\r
336 EFI_STATUS Status;\r
337 EDKII_SET_VARIABLE_STATUS *SetVariableStatus;\r
338 UINTN NameSize;\r
339\r
340 Status = gRT->SetVariable (\r
341 VariableName,\r
342 VendorGuid,\r
343 Attributes,\r
344 DataSize,\r
345 Data\r
346 );\r
347 if (EFI_ERROR (Status)) {\r
1436aea4 348 NameSize = StrSize (VariableName);\r
067ed98a
RN
349 SetVariableStatus = AllocatePool (sizeof (EDKII_SET_VARIABLE_STATUS) + NameSize + DataSize);\r
350 if (SetVariableStatus != NULL) {\r
351 CopyGuid (&SetVariableStatus->Guid, VendorGuid);\r
352 SetVariableStatus->NameSize = NameSize;\r
353 SetVariableStatus->DataSize = DataSize;\r
354 SetVariableStatus->SetStatus = Status;\r
355 SetVariableStatus->Attributes = Attributes;\r
1436aea4
MK
356 CopyMem (SetVariableStatus + 1, VariableName, NameSize);\r
357 CopyMem (((UINT8 *)(SetVariableStatus + 1)) + NameSize, Data, DataSize);\r
067ed98a
RN
358\r
359 REPORT_STATUS_CODE_EX (\r
360 EFI_ERROR_CODE,\r
361 PcdGet32 (PcdErrorCodeSetVariable),\r
362 0,\r
363 NULL,\r
364 &gEdkiiStatusCodeDataTypeVariableGuid,\r
365 SetVariableStatus,\r
366 sizeof (EDKII_SET_VARIABLE_STATUS) + NameSize + DataSize\r
367 );\r
368\r
369 FreePool (SetVariableStatus);\r
370 }\r
371 }\r
372\r
373 return Status;\r
374}\r
375\r
067ed98a
RN
376/**\r
377 Print the device path info.\r
378\r
379 @param DevicePath The device path need to print.\r
380**/\r
381VOID\r
382BmPrintDp (\r
1436aea4 383 EFI_DEVICE_PATH_PROTOCOL *DevicePath\r
067ed98a
RN
384 )\r
385{\r
1436aea4 386 CHAR16 *Str;\r
067ed98a
RN
387\r
388 Str = ConvertDevicePathToText (DevicePath, FALSE, FALSE);\r
87000d77 389 DEBUG ((DEBUG_INFO, "%s", Str));\r
067ed98a
RN
390 if (Str != NULL) {\r
391 FreePool (Str);\r
392 }\r
393}\r
418e8cd9
RN
394\r
395/**\r
396 Convert a single character to number.\r
397 It assumes the input Char is in the scope of L'0' ~ L'9' and L'A' ~ L'F'\r
398\r
399 @param Char The input char which need to convert to int.\r
400\r
401 @return The converted 8-bit number or (UINTN) -1 if conversion failed.\r
402**/\r
403UINTN\r
404BmCharToUint (\r
1436aea4 405 IN CHAR16 Char\r
418e8cd9
RN
406 )\r
407{\r
408 if ((Char >= L'0') && (Char <= L'9')) {\r
16f69227 409 return (Char - L'0');\r
418e8cd9
RN
410 }\r
411\r
412 if ((Char >= L'A') && (Char <= L'F')) {\r
16f69227 413 return (Char - L'A' + 0xA);\r
418e8cd9
RN
414 }\r
415\r
1436aea4 416 return (UINTN)-1;\r
418e8cd9
RN
417}\r
418\r
b33af221
RN
419/**\r
420 Dispatch the deferred images that are returned from all DeferredImageLoad instances.\r
421\r
422 @retval EFI_SUCCESS At least one deferred image is loaded successfully and started.\r
423 @retval EFI_NOT_FOUND There is no deferred image.\r
424 @retval EFI_ACCESS_DENIED There are deferred images but all of them are failed to load.\r
425**/\r
426EFI_STATUS\r
427EFIAPI\r
428EfiBootManagerDispatchDeferredImages (\r
429 VOID\r
430 )\r
431{\r
1436aea4
MK
432 EFI_STATUS Status;\r
433 EFI_DEFERRED_IMAGE_LOAD_PROTOCOL *DeferredImage;\r
434 UINTN HandleCount;\r
435 EFI_HANDLE *Handles;\r
436 UINTN Index;\r
437 UINTN ImageIndex;\r
438 EFI_DEVICE_PATH_PROTOCOL *ImageDevicePath;\r
439 VOID *Image;\r
440 UINTN ImageSize;\r
441 BOOLEAN BootOption;\r
442 EFI_HANDLE ImageHandle;\r
443 UINTN ImageCount;\r
444 UINTN LoadCount;\r
b33af221
RN
445\r
446 //\r
447 // Find all the deferred image load protocols.\r
448 //\r
449 HandleCount = 0;\r
1436aea4
MK
450 Handles = NULL;\r
451 Status = gBS->LocateHandleBuffer (\r
452 ByProtocol,\r
453 &gEfiDeferredImageLoadProtocolGuid,\r
454 NULL,\r
455 &HandleCount,\r
456 &Handles\r
457 );\r
b33af221
RN
458 if (EFI_ERROR (Status)) {\r
459 return EFI_NOT_FOUND;\r
460 }\r
461\r
462 ImageCount = 0;\r
463 LoadCount = 0;\r
464 for (Index = 0; Index < HandleCount; Index++) {\r
1436aea4 465 Status = gBS->HandleProtocol (Handles[Index], &gEfiDeferredImageLoadProtocolGuid, (VOID **)&DeferredImage);\r
b33af221
RN
466 if (EFI_ERROR (Status)) {\r
467 continue;\r
468 }\r
469\r
1436aea4 470 for (ImageIndex = 0; ; ImageIndex++) {\r
b33af221
RN
471 //\r
472 // Load all the deferred images in this protocol instance.\r
473 //\r
474 Status = DeferredImage->GetImageInfo (\r
475 DeferredImage,\r
476 ImageIndex,\r
477 &ImageDevicePath,\r
1436aea4 478 (VOID **)&Image,\r
b33af221
RN
479 &ImageSize,\r
480 &BootOption\r
481 );\r
482 if (EFI_ERROR (Status)) {\r
483 break;\r
484 }\r
1436aea4 485\r
b33af221
RN
486 ImageCount++;\r
487 //\r
488 // Load and start the image.\r
489 //\r
490 Status = gBS->LoadImage (\r
1436aea4
MK
491 BootOption,\r
492 gImageHandle,\r
493 ImageDevicePath,\r
494 NULL,\r
495 0,\r
496 &ImageHandle\r
497 );\r
f7fdd620
DB
498 if (EFI_ERROR (Status)) {\r
499 //\r
500 // With EFI_SECURITY_VIOLATION retval, the Image was loaded and an ImageHandle was created\r
501 // with a valid EFI_LOADED_IMAGE_PROTOCOL, but the image can not be started right now.\r
502 // If the caller doesn't have the option to defer the execution of an image, we should\r
503 // unload image for the EFI_SECURITY_VIOLATION to avoid resource leak.\r
504 //\r
505 if (Status == EFI_SECURITY_VIOLATION) {\r
506 gBS->UnloadImage (ImageHandle);\r
507 }\r
508 } else {\r
b33af221
RN
509 LoadCount++;\r
510 //\r
511 // Before calling the image, enable the Watchdog Timer for\r
512 // a 5 Minute period\r
513 //\r
514 gBS->SetWatchdogTimer (5 * 60, 0x0000, 0x00, NULL);\r
d4305688 515 gBS->StartImage (ImageHandle, NULL, NULL);\r
b33af221
RN
516\r
517 //\r
518 // Clear the Watchdog Timer after the image returns.\r
519 //\r
520 gBS->SetWatchdogTimer (0x0000, 0x0000, 0x0000, NULL);\r
521 }\r
522 }\r
523 }\r
1436aea4 524\r
b33af221
RN
525 if (Handles != NULL) {\r
526 FreePool (Handles);\r
527 }\r
528\r
529 if (ImageCount == 0) {\r
530 return EFI_NOT_FOUND;\r
531 } else {\r
532 if (LoadCount == 0) {\r
533 return EFI_ACCESS_DENIED;\r
534 } else {\r
535 return EFI_SUCCESS;\r
536 }\r
537 }\r
538}\r