From cb44bbdb8e15fc40362e6b0542be196c15c04615 Mon Sep 17 00:00:00 2001 From: dtang2 Date: Fri, 3 Nov 2006 02:40:21 +0000 Subject: 1. Bug fix for "EDK GenericBds WriteBootToOsPerformanceData() uses AcpiReclaimMemory"; 2. Bug fix for "[FT] in new BDS, add a long item in Boot Option will cause an empty line appear"; 3. Bug fix for "In "SetBootNextValue" page,description does not display properly" git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@1889 6f19259b-4bc3-4df7-8a09-765794883524 --- .../Dxe/PlatformBds/Generic/BootMaint/BBSsupport.c | 94 ++++++++++++++++++++- .../Generic/BootMngr/BootManagerStrings.uni | Bin 3942 -> 3948 bytes 2 files changed, 90 insertions(+), 4 deletions(-) (limited to 'EdkNt32Pkg/Dxe') diff --git a/EdkNt32Pkg/Dxe/PlatformBds/Generic/BootMaint/BBSsupport.c b/EdkNt32Pkg/Dxe/PlatformBds/Generic/BootMaint/BBSsupport.c index a33be4b046..c9f2402eb1 100644 --- a/EdkNt32Pkg/Dxe/PlatformBds/Generic/BootMaint/BBSsupport.c +++ b/EdkNt32Pkg/Dxe/PlatformBds/Generic/BootMaint/BBSsupport.c @@ -36,6 +36,26 @@ AsciiToUnicodeSize ( IN UINTN Size, OUT UINT16 *u ) +/*++ + + Routine Description: + + Translate the first n characters of an Ascii string to + Unicode characters. The count n is indicated by parameter + Size. If Size is greater than the length of string, then + the entire string is translated. + + Arguments: + + a - Pointer to input Ascii string. + Size - The number of characters to translate. + u - Pointer to output Unicode string buffer. + + Returns: + + None + +--*/ { UINTN i; @@ -43,12 +63,12 @@ AsciiToUnicodeSize ( while (a[i] != 0) { u[i] = (CHAR16) a[i]; if (i == Size) { - u[i] = 0; break; } i++; } + u[i] = 0; } VOID @@ -156,6 +176,32 @@ BdsCreateLegacyBootOption ( IN OUT UINT16 **BootOrderList, IN OUT UINTN *BootOrderListSize ) +/*++ + + Routine Description: + + Create a legacy boot option for the specified entry of + BBS table, save it as variable, and append it to the boot + order list. + + Arguments: + + CurrentBbsEntry - Pointer to current BBS table. + CurrentBbsDevPath - Pointer to the Device Path Protocol instance of BBS + Index - Index of the specified entry in BBS table. + BootOrderList - On input, the original boot order list. + On output, the new boot order list attached with the + created node. + BootOrderListSize - On input, the original size of boot order list. + - On output, the size of new boot order list. + + Returns: + + EFI_SUCCESS - Boot Option successfully created. + EFI_OUT_OF_RESOURCES - Fail to allocate necessary memory. + Other - Error occurs while setting variable. + +--*/ { EFI_STATUS Status; UINT16 CurrentBootOptionNo; @@ -267,6 +313,8 @@ BdsCreateLegacyBootOption ( CopyMem (NewBootOrderList, *BootOrderList, *BootOrderListSize); } + SafeFreePool (*BootOrderList); + BootOrderLastIndex = (UINTN) (*BootOrderListSize / sizeof (UINT16)); NewBootOrderList[BootOrderLastIndex] = CurrentBootOptionNo; *BootOrderListSize += sizeof (UINT16); @@ -352,6 +400,25 @@ EFI_STATUS BdsDeleteAllInvalidLegacyBootOptions ( VOID ) +/*++ + + Routine Description: + + Delete all the invalid legacy boot options. + + Arguments: + + None. + + Returns: + + EFI_SUCCESS - All invalide legacy boot options are deleted. + EFI_OUT_OF_RESOURCES - Fail to allocate necessary memory. + EFI_NOT_FOUND - Fail to retrive variable of boot order. + Other - Error occurs while setting variable or locating + protocol. + +--*/ { UINT16 *BootOrder; UINT8 *BootOptionVar; @@ -367,6 +434,8 @@ BdsDeleteAllInvalidLegacyBootOptions ( EFI_LEGACY_BIOS_PROTOCOL *LegacyBios; UINTN Index; UINT16 BootOption[10]; + UINT16 BootDesc[100]; + BOOLEAN DescStringMatch; Status = EFI_SUCCESS; BootOrder = NULL; @@ -417,11 +486,28 @@ BdsDeleteAllInvalidLegacyBootOptions ( Index++; continue; } + + // + // Check if BBS Description String is changed + // + DescStringMatch = FALSE; + + BdsBuildLegacyDevNameString ( + &LocalBbsTable[BbsIndex], + BbsIndex, + sizeof(BootDesc), + BootDesc + ); + + if (StrCmp (BootDesc, (UINT16*)(BootOptionVar + sizeof (UINT32) + sizeof (UINT16))) == 0) { + DescStringMatch = TRUE; + } if (!((LocalBbsTable[BbsIndex].BootPriority == BBS_IGNORE_ENTRY) || - (LocalBbsTable[BbsIndex].BootPriority == BBS_DO_NOT_BOOT_FROM) || - (LocalBbsTable[BbsIndex].BootPriority == BBS_LOWEST_PRIORITY)) && - LocalBbsTable[BbsIndex].DeviceType == BbsEntry->DeviceType) { + (LocalBbsTable[BbsIndex].BootPriority == BBS_DO_NOT_BOOT_FROM) || + (LocalBbsTable[BbsIndex].BootPriority == BBS_LOWEST_PRIORITY)) && + (LocalBbsTable[BbsIndex].DeviceType == BbsEntry->DeviceType) && + DescStringMatch) { Index++; continue; } diff --git a/EdkNt32Pkg/Dxe/PlatformBds/Generic/BootMngr/BootManagerStrings.uni b/EdkNt32Pkg/Dxe/PlatformBds/Generic/BootMngr/BootManagerStrings.uni index e875cfbee1..684ac2f348 100644 Binary files a/EdkNt32Pkg/Dxe/PlatformBds/Generic/BootMngr/BootManagerStrings.uni and b/EdkNt32Pkg/Dxe/PlatformBds/Generic/BootMngr/BootManagerStrings.uni differ -- cgit v1.2.3