From ab8cc80b8ae9f0f4443aa06dd66de0fa8f49ec2c Mon Sep 17 00:00:00 2001 From: klu2 Date: Mon, 31 Aug 2009 07:13:33 +0000 Subject: Beatify the debug string for displaying boot device when boot EFI device path. git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@9209 6f19259b-4bc3-4df7-8a09-765794883524 --- .../Library/GenericBdsLib/BdsBoot.c | 63 +++++++++++++++++++++- 1 file changed, 62 insertions(+), 1 deletion(-) (limited to 'IntelFrameworkModulePkg/Library/GenericBdsLib') diff --git a/IntelFrameworkModulePkg/Library/GenericBdsLib/BdsBoot.c b/IntelFrameworkModulePkg/Library/GenericBdsLib/BdsBoot.c index 7c47a87333..0eb59e89c8 100644 --- a/IntelFrameworkModulePkg/Library/GenericBdsLib/BdsBoot.c +++ b/IntelFrameworkModulePkg/Library/GenericBdsLib/BdsBoot.c @@ -253,8 +253,69 @@ BdsLibBootViaBootOption ( Status = SecurityProtocol->FileAuthenticationState (SecurityProtocol, 0, DevicePath); } - DEBUG ((DEBUG_INFO | DEBUG_LOAD, "Booting %S\n", Option->Description)); + DEBUG_CODE_BEGIN(); + UINTN DevicePathTypeValue; + CHAR16 *HiiString; + CHAR16 *BootStringNumber; + UINTN BufferSize; + + DevicePathTypeValue = BdsGetBootTypeFromDevicePath (Option->DevicePath); + + // + // store number string of boot option temporary. + // + HiiString = NULL; + switch (DevicePathTypeValue) { + case BDS_EFI_ACPI_FLOPPY_BOOT: + HiiString = L"EFI Floppy"; + break; + case BDS_EFI_MEDIA_CDROM_BOOT: + case BDS_EFI_MESSAGE_SATA_BOOT: + case BDS_EFI_MESSAGE_ATAPI_BOOT: + HiiString = L"EFI DVD/CDROM"; + break; + case BDS_EFI_MESSAGE_USB_DEVICE_BOOT: + HiiString = L"EFI USB Device"; + break; + case BDS_EFI_MESSAGE_SCSI_BOOT: + HiiString = L"EFI SCSI Device"; + break; + case BDS_EFI_MESSAGE_MISC_BOOT: + HiiString = L"EFI Misc Device"; + break; + case BDS_EFI_MESSAGE_MAC_BOOT: + HiiString = L"EFI Network"; + break; + case BBS_DEVICE_PATH: + // + // Do nothing for legacy boot option. + // + break; + default: + DEBUG((EFI_D_INFO, "Can not find HiiString for given device path type 0x%x\n", DevicePathTypeValue)); + } + // + // If found Hii description string then cat Hii string with original description. + // + if (HiiString != NULL) { + BootStringNumber = Option->Description; + BufferSize = StrSize(BootStringNumber); + BufferSize += StrSize(HiiString); + Option->Description = AllocateZeroPool(BufferSize); + StrCpy (Option->Description, HiiString); + if (StrnCmp (BootStringNumber, L"0", 1) != 0) { + StrCat (Option->Description, L" "); + StrCat (Option->Description, BootStringNumber); + } + + FreePool (BootStringNumber); + } + + DEBUG ((DEBUG_INFO | DEBUG_LOAD, "Booting %S\n", Option->Description)); + + DEBUG_CODE_END(); + Status = gBS->LoadImage ( TRUE, mBdsImageHandle, -- cgit v1.2.3