From 7caf72a907ef9b71e7c8f1c27c5b4eda98225689 Mon Sep 17 00:00:00 2001 From: niruiyu Date: Mon, 22 Nov 2010 05:25:03 +0000 Subject: [PATCH] Use PcdResetOnMemoryTypeInformationChange in MdeModulePkg to control whether to reset system when memory type information changes. Check memory type information after signaling the ReadyToBoot event. git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@11080 6f19259b-4bc3-4df7-8a09-765794883524 --- .../Library/GenericBdsLib/BdsBoot.c | 6 ++++ .../Library/GenericBdsLib/BdsMisc.c | 35 ++++--------------- .../Library/GenericBdsLib/GenericBdsLib.inf | 3 +- .../Library/GenericBdsLib/InternalBdsLib.h | 9 +++++ 4 files changed, 23 insertions(+), 30 deletions(-) diff --git a/IntelFrameworkModulePkg/Library/GenericBdsLib/BdsBoot.c b/IntelFrameworkModulePkg/Library/GenericBdsLib/BdsBoot.c index a6a91186f1..8ee0b3e698 100644 --- a/IntelFrameworkModulePkg/Library/GenericBdsLib/BdsBoot.c +++ b/IntelFrameworkModulePkg/Library/GenericBdsLib/BdsBoot.c @@ -227,6 +227,12 @@ BdsLibBootViaBootOption ( // EfiSignalEventReadyToBoot(); + // + // Adjust the different type memory page number just before booting + // and save the updated info into the variable for next boot to use + // + BdsSetMemoryTypeInformationVariable (); + // // Set Boot Current diff --git a/IntelFrameworkModulePkg/Library/GenericBdsLib/BdsMisc.c b/IntelFrameworkModulePkg/Library/GenericBdsLib/BdsMisc.c index 3d2e199e52..1e88922630 100644 --- a/IntelFrameworkModulePkg/Library/GenericBdsLib/BdsMisc.c +++ b/IntelFrameworkModulePkg/Library/GenericBdsLib/BdsMisc.c @@ -1096,21 +1096,12 @@ BdsLibGetImageHeader ( } /** - - This routine is a notification function for legayc boot or exit boot - service event. It will adjust the memory information for different - memory type and save them into the variables for next boot. - - - @param Event The event that triggered this notification function. - @param Context Pointer to the notification functions context. - + This routine adjust the memory information for different memory type and + save them into the variables for next boot. **/ VOID -EFIAPI BdsSetMemoryTypeInformationVariable ( - EFI_EVENT Event, - VOID *Context + VOID ) { EFI_STATUS Status; @@ -1238,17 +1229,15 @@ BdsSetMemoryTypeInformationVariable ( // so the new Memory Type Information setting will be used to guarantee that an S4 // entry/resume cycle will not fail. // - if (MemoryTypeInformationModified) { - DEBUG ((EFI_D_ERROR, "Memory Type Information settings change. Warm Reset!!!\n")); + if (MemoryTypeInformationModified && PcdGetBool (PcdResetOnMemoryTypeInformationChange)) { + DEBUG ((EFI_D_INFO, "Memory Type Information settings change. Warm Reset!!!\n")); gRT->ResetSystem (EfiResetWarm, EFI_SUCCESS, 0, NULL); } } } /** - This routine register a function to adjust the different type memory page number - just before booting and save the updated info into the variable for next boot to use. - + This routine is kept for backward compatibility. **/ VOID EFIAPI @@ -1256,18 +1245,6 @@ BdsLibSaveMemoryTypeInformation ( VOID ) { - EFI_STATUS Status; - EFI_EVENT ReadyToBootEvent; - - Status = EfiCreateEventReadyToBootEx ( - TPL_CALLBACK, - BdsSetMemoryTypeInformationVariable, - NULL, - &ReadyToBootEvent - ); - if (EFI_ERROR (Status)) { - DEBUG ((DEBUG_ERROR,"Bds Set Memory Type Informationa Variable Fails\n")); - } } diff --git a/IntelFrameworkModulePkg/Library/GenericBdsLib/GenericBdsLib.inf b/IntelFrameworkModulePkg/Library/GenericBdsLib/GenericBdsLib.inf index 8db77c12a6..1f773f3571 100644 --- a/IntelFrameworkModulePkg/Library/GenericBdsLib/GenericBdsLib.inf +++ b/IntelFrameworkModulePkg/Library/GenericBdsLib/GenericBdsLib.inf @@ -116,4 +116,5 @@ gEfiMdePkgTokenSpaceGuid.PcdUgaConsumeSupport [Pcd] - gEfiIntelFrameworkModulePkgTokenSpaceGuid.PcdShellFile + gEfiMdeModulePkgTokenSpaceGuid.PcdResetOnMemoryTypeInformationChange + gEfiIntelFrameworkModulePkgTokenSpaceGuid.PcdShellFile \ No newline at end of file diff --git a/IntelFrameworkModulePkg/Library/GenericBdsLib/InternalBdsLib.h b/IntelFrameworkModulePkg/Library/GenericBdsLib/InternalBdsLib.h index 90ffa610da..326aa91203 100644 --- a/IntelFrameworkModulePkg/Library/GenericBdsLib/InternalBdsLib.h +++ b/IntelFrameworkModulePkg/Library/GenericBdsLib/InternalBdsLib.h @@ -111,4 +111,13 @@ BdsLibGetImageHeader ( OUT EFI_IMAGE_OPTIONAL_HEADER_PTR_UNION Hdr ); +/** + This routine adjust the memory information for different memory type and + save them into the variables for next boot. +**/ +VOID +BdsSetMemoryTypeInformationVariable ( + VOID + ); + #endif // _BDS_LIB_H_ -- 2.39.2