From cb44bbdb8e15fc40362e6b0542be196c15c04615 Mon Sep 17 00:00:00 2001 From: dtang2 Date: Fri, 3 Nov 2006 02:40:21 +0000 Subject: [PATCH 1/1] 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 --- .../SetupBrowser/Dxe/Presentation.c | 6 +- .../UserInterface/SetupBrowser/Dxe/Ui.c | 13 ++- .../Generic/BootMaint/BBSsupport.c | 94 +++++++++++++++++- .../Generic/BootMngr/BootManagerStrings.uni | Bin 3942 -> 3948 bytes .../Library/EdkGenericBdsLib/Performance.c | 13 +-- 5 files changed, 111 insertions(+), 15 deletions(-) diff --git a/EdkModulePkg/Universal/UserInterface/SetupBrowser/Dxe/Presentation.c b/EdkModulePkg/Universal/UserInterface/SetupBrowser/Dxe/Presentation.c index cf3d0004d9..7b219c85bb 100644 --- a/EdkModulePkg/Universal/UserInterface/SetupBrowser/Dxe/Presentation.c +++ b/EdkModulePkg/Universal/UserInterface/SetupBrowser/Dxe/Presentation.c @@ -9,7 +9,7 @@ THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. Module Name: - Presentation.c + Presentation.c Abstract: @@ -732,7 +732,7 @@ Returns: PrintStringAt (SecCol, BottomRowOfHelp, gEnterString); } } else { - PrintStringAt (StartColumnOfHelp, BottomRowOfHelp, gEnterCommitString); + PrintStringAt (SecCol, BottomRowOfHelp, gEnterCommitString); // // If it is a selected numeric with manual input, display different message @@ -740,7 +740,7 @@ Returns: if ((Selection->ThisTag->Operand == EFI_IFR_NUMERIC_OP) && (Selection->ThisTag->Step == 0)) { PrintStringAt (SecCol, TopRowOfHelp, gNumericInput); } else if (Selection->ThisTag->Operand != EFI_IFR_ORDERED_LIST_OP) { - PrintAt (SecCol, BottomRowOfHelp, (CHAR16 *) L"%c%c%s", ARROW_UP, ARROW_DOWN, gMoveHighlight); + PrintAt (StartColumnOfHelp, BottomRowOfHelp, L"%c%c%s", ARROW_UP, ARROW_DOWN, gMoveHighlight); } if (Selection->ThisTag->Operand == EFI_IFR_ORDERED_LIST_OP) { diff --git a/EdkModulePkg/Universal/UserInterface/SetupBrowser/Dxe/Ui.c b/EdkModulePkg/Universal/UserInterface/SetupBrowser/Dxe/Ui.c index 0d512fd34e..7a2ec04403 100644 --- a/EdkModulePkg/Universal/UserInterface/SetupBrowser/Dxe/Ui.c +++ b/EdkModulePkg/Universal/UserInterface/SetupBrowser/Dxe/Ui.c @@ -806,7 +806,7 @@ UpdateStatusBar ( gScreenDimensions.BottomRow - 1, NvUpdateMessage ); - gResetRequired = (BOOLEAN) (gResetRequired | (Flags & RESET_REQUIRED)); + gResetRequired = (BOOLEAN) (gResetRequired | ((Flags & EFI_IFR_FLAG_RESET_REQUIRED) == EFI_IFR_FLAG_RESET_REQUIRED)); gNvUpdateRequired = TRUE; } else { @@ -1222,6 +1222,15 @@ Returns: // Ensure we have got a valid buffer // if (*OutputString != NULL) { + + // + //NARROW_CHAR can not be printed in screen, so if a line only contain the two CHARs: 'NARROW_CHAR + CHAR_CARRIAGE_RETURN' , it is a empty line in Screen. + //To avoid displaying this empty line in screen, just skip the two CHARs here. + // + if ((InputString[*Index] == NARROW_CHAR) && (InputString[*Index + 1] == CHAR_CARRIAGE_RETURN)) { + *Index = *Index + 2; + } + // // Fast-forward the string and see if there is a carriage-return in the string // @@ -1441,7 +1450,7 @@ Returns: UI_MENU_OPTION *PreviousMenuOption; EFI_IFR_BINARY *IfrBinary; UI_CONTROL_FLAG ControlFlag; - EFI_SCREEN_DESCRIPTOR LocalScreen; + EFI_SCREEN_DESCRIPTOR LocalScreen; EFI_FILE_FORM_TAGS *FileFormTags; MENU_REFRESH_ENTRY *MenuRefreshEntry; MENU_REFRESH_ENTRY *OldMenuRefreshEntry; 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 e875cfbee1c5c72580059ccf00ee85fe221cb10b..684ac2f3483dab723b323fed6cdf846e14656835 100644 GIT binary patch delta 29 kcmaDR_eO4m7ni_9MFoZehJ1!nh9U+9hRKSXL%4)k0f=h{w*UYD delta 23 ecmaDO_e^es7Z;ZTLjglRLn%WM!{#V1AyxocVFob( diff --git a/EdkNt32Pkg/Library/EdkGenericBdsLib/Performance.c b/EdkNt32Pkg/Library/EdkGenericBdsLib/Performance.c index c7b6bc9d5d..80b98563f0 100644 --- a/EdkNt32Pkg/Library/EdkGenericBdsLib/Performance.c +++ b/EdkNt32Pkg/Library/EdkGenericBdsLib/Performance.c @@ -232,9 +232,10 @@ Returns: // // Allocate a block of memory that contain performance data to OS // + mAcpiLowMemoryBase = 0xFFFFFFFF; Status = gBS->AllocatePages ( - AllocateAnyPages, - EfiACPIReclaimMemory, + AllocateMaxAddress, + EfiReservedMemoryType, 4, &mAcpiLowMemoryBase ); @@ -242,7 +243,7 @@ Returns: return ; } - mAcpiLowMemoryLength = 0x1000; + mAcpiLowMemoryLength = EFI_PAGES_TO_SIZE(4); Ptr = (UINT8 *) ((UINT32) mAcpiLowMemoryBase + sizeof (PERF_HEADER)); LimitCount = (mAcpiLowMemoryLength - sizeof (PERF_HEADER)) / sizeof (PERF_DATA); @@ -261,7 +262,7 @@ Returns: &Cpu ); if (EFI_ERROR (Status)) { - gBS->FreePages (mAcpiLowMemoryBase, 1); + gBS->FreePages (mAcpiLowMemoryBase, 4); return ; } // @@ -269,7 +270,7 @@ Returns: // Status = Cpu->GetTimerValue (Cpu, 0, &(CurrentTicker), &TimerPeriod); if (EFI_ERROR (Status)) { - gBS->FreePages (mAcpiLowMemoryBase, 1); + gBS->FreePages (mAcpiLowMemoryBase, 4); return ; } @@ -294,7 +295,7 @@ Returns: &Handles ); if (EFI_ERROR (Status)) { - gBS->FreePages (mAcpiLowMemoryBase, 1); + gBS->FreePages (mAcpiLowMemoryBase, 4); return ; } // -- 2.39.2