Originally BDS only creates boot options for removable media, the patch creates boot options for fixed media as well.

Signed-off-by: niruiyu
Reviewed-by: li-elvin

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@11707 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
niruiyu 2011-05-26 06:34:07 +00:00
parent 3d0a23854e
commit 35bc0e9f02
1 changed files with 78 additions and 74 deletions

View File

@ -1,7 +1,7 @@
/** @file /** @file
BDS Lib functions which relate with create or process the boot option. BDS Lib functions which relate with create or process the boot option.
Copyright (c) 2004 - 2010, Intel Corporation. All rights reserved.<BR> Copyright (c) 2004 - 2011, Intel Corporation. All rights reserved.<BR>
This program and the accompanying materials This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at which accompanies this distribution. The full text of the license may be found at
@ -1406,6 +1406,8 @@ BdsLibEnumerateAllBootOption (
UINTN NumberBlockIoHandles; UINTN NumberBlockIoHandles;
EFI_HANDLE *BlockIoHandles; EFI_HANDLE *BlockIoHandles;
EFI_BLOCK_IO_PROTOCOL *BlkIo; EFI_BLOCK_IO_PROTOCOL *BlkIo;
BOOLEAN Removable[2];
UINTN RemovableIndex;
UINTN Index; UINTN Index;
UINTN NumOfLoadFileHandles; UINTN NumOfLoadFileHandles;
EFI_HANDLE *LoadFileHandles; EFI_HANDLE *LoadFileHandles;
@ -1428,6 +1430,8 @@ BdsLibEnumerateAllBootOption (
EFI_IMAGE_OPTIONAL_HEADER_UNION HdrData; EFI_IMAGE_OPTIONAL_HEADER_UNION HdrData;
EFI_IMAGE_OPTIONAL_HEADER_PTR_UNION Hdr; EFI_IMAGE_OPTIONAL_HEADER_PTR_UNION Hdr;
Removable[0] = FALSE;
Removable[1] = TRUE;
FloppyNumber = 0; FloppyNumber = 0;
CdromNumber = 0; CdromNumber = 0;
UsbNumber = 0; UsbNumber = 0;
@ -1480,7 +1484,7 @@ BdsLibEnumerateAllBootOption (
BdsDeleteAllInvalidEfiBootOption (); BdsDeleteAllInvalidEfiBootOption ();
// //
// Parse removable media // Parse removable media followed by fixed media
// //
gBS->LocateHandleBuffer ( gBS->LocateHandleBuffer (
ByProtocol, ByProtocol,
@ -1490,20 +1494,19 @@ BdsLibEnumerateAllBootOption (
&BlockIoHandles &BlockIoHandles
); );
for (RemovableIndex = 0; RemovableIndex < 2; RemovableIndex++) {
for (Index = 0; Index < NumberBlockIoHandles; Index++) { for (Index = 0; Index < NumberBlockIoHandles; Index++) {
Status = gBS->HandleProtocol ( Status = gBS->HandleProtocol (
BlockIoHandles[Index], BlockIoHandles[Index],
&gEfiBlockIoProtocolGuid, &gEfiBlockIoProtocolGuid,
(VOID **) &BlkIo (VOID **) &BlkIo
); );
if (!EFI_ERROR (Status)) {
if (!BlkIo->Media->RemovableMedia) {
// //
// skip the non-removable block devices // skip the fixed block io then the removable block io
// //
if (EFI_ERROR (Status) || (BlkIo->Media->RemovableMedia == Removable[RemovableIndex])) {
continue; continue;
} }
}
DevicePath = DevicePathFromHandle (BlockIoHandles[Index]); DevicePath = DevicePathFromHandle (BlockIoHandles[Index]);
DevicePathType = BdsGetBootTypeFromDevicePath (DevicePath); DevicePathType = BdsGetBootTypeFromDevicePath (DevicePath);
@ -1567,6 +1570,7 @@ BdsLibEnumerateAllBootOption (
break; break;
} }
} }
}
if (NumberBlockIoHandles != 0) { if (NumberBlockIoHandles != 0) {
FreePool (BlockIoHandles); FreePool (BlockIoHandles);