diff options
author | Ruiyu Ni <ruiyu.ni@intel.com> | 2015-12-01 01:56:57 +0000 |
---|---|---|
committer | vanjeff <vanjeff@Edk2> | 2015-12-01 01:56:57 +0000 |
commit | 988a36669834068d2ba69df9a1598d740513662e (patch) | |
tree | c6a0852f06be2533b00cab70087e353dad8c6383 /MdeModulePkg | |
parent | d76a00635f5061a96b6d17c1b68de9d2732fce55 (diff) | |
download | edk2-platforms-988a36669834068d2ba69df9a1598d740513662e.tar.xz |
MdeModulePkg/BDS: Do not pass unnecessary option to boot option
BDS puts a special GUID in boot option optional data for
auto-discovered boot option. But when launching that boot
option, the BDS core unconditionally pass the special GUID
to the executable.
A good written application/OS loader can ignore the unexpected
parameters, but BDS core should still avoid passing the
unnecessary GUID.
(Sync patch r19007 from main trunk.)
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>
Reviewed-by: Eric Dong <eric.dong@intel.com>
git-svn-id: https://svn.code.sf.net/p/edk2/code/branches/UDK2015@19072 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'MdeModulePkg')
-rw-r--r-- | MdeModulePkg/Library/UefiBootManagerLib/BmBoot.c | 32 |
1 files changed, 27 insertions, 5 deletions
diff --git a/MdeModulePkg/Library/UefiBootManagerLib/BmBoot.c b/MdeModulePkg/Library/UefiBootManagerLib/BmBoot.c index 4afd9c25ff..59366885c4 100644 --- a/MdeModulePkg/Library/UefiBootManagerLib/BmBoot.c +++ b/MdeModulePkg/Library/UefiBootManagerLib/BmBoot.c @@ -53,6 +53,28 @@ EfiBootManagerRegisterLegacyBootSupport ( }
/**
+ Return TRUE when the boot option is auto-created instead of manually added.
+
+ @param BootOption Pointer to the boot option to check.
+
+ @retval TRUE The boot option is auto-created.
+ @retval FALSE The boot option is manually added.
+**/
+BOOLEAN
+BmIsAutoCreateBootOption (
+ EFI_BOOT_MANAGER_LOAD_OPTION *BootOption
+ )
+{
+ if ((BootOption->OptionalDataSize == sizeof (EFI_GUID)) &&
+ CompareGuid ((EFI_GUID *) BootOption->OptionalData, &mBmAutoCreateBootOptionGuid)
+ ) {
+ return TRUE;
+ } else {
+ return FALSE;
+ }
+}
+
+/**
For a bootable Device path, return its boot type.
@param DevicePath The bootable device Path to check
@@ -1738,8 +1760,10 @@ EfiBootManagerBoot ( Status = gBS->HandleProtocol (ImageHandle, &gEfiLoadedImageProtocolGuid, (VOID **) &ImageInfo);
ASSERT_EFI_ERROR (Status);
- ImageInfo->LoadOptionsSize = BootOption->OptionalDataSize;
- ImageInfo->LoadOptions = BootOption->OptionalData;
+ if (!BmIsAutoCreateBootOption (BootOption)) {
+ ImageInfo->LoadOptionsSize = BootOption->OptionalDataSize;
+ ImageInfo->LoadOptions = BootOption->OptionalData;
+ }
//
// Clean to NULL because the image is loaded directly from the firmwares boot manager.
@@ -2155,9 +2179,7 @@ EfiBootManagerRefreshAllBootOption ( for (Index = 0; Index < NvBootOptionCount; Index++) {
if (((DevicePathType (NvBootOptions[Index].FilePath) != BBS_DEVICE_PATH) ||
(DevicePathSubType (NvBootOptions[Index].FilePath) != BBS_BBS_DP)
- ) &&
- (NvBootOptions[Index].OptionalDataSize == sizeof (EFI_GUID)) &&
- CompareGuid ((EFI_GUID *) NvBootOptions[Index].OptionalData, &mBmAutoCreateBootOptionGuid)
+ ) && BmIsAutoCreateBootOption (&NvBootOptions[Index])
) {
//
// Only check those added by BDS
|