[edk2-devel] [PATCH 1/5] MdeModulePkg/PeiCore: Align fixed-address error behaviour

Marvin Häuser mhaeuser at posteo.de
Sat Aug 21 19:55:47 UTC 2021


Update the control flow to take the same actions for failed
fixed-address loading as if the feature was disabled. This
primarily removes code duplication.

Cc: Jian J Wang <jian.j.wang at intel.com>
Cc: Hao A Wu <hao.a.wu at intel.com>
Cc: Dandan Bi <dandan.bi at intel.com>
Cc: Liming Gao <gaoliming at byosoft.com.cn>
Cc: Debkumar De <debkumar.de at intel.com>
Cc: Harry Han <harry.han at intel.com>
Cc: Catharine West <catharine.west at intel.com>
Cc: Vitaly Cheptsov <vit9696 at protonmail.com>
Signed-off-by: Marvin Häuser <mhaeuser at posteo.de>
---
 MdeModulePkg/Core/Pei/Image/Image.c | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/MdeModulePkg/Core/Pei/Image/Image.c b/MdeModulePkg/Core/Pei/Image/Image.c
index 5af3895191a5..94adbed82e44 100644
--- a/MdeModulePkg/Core/Pei/Image/Image.c
+++ b/MdeModulePkg/Core/Pei/Image/Image.c
@@ -364,18 +364,18 @@ LoadAndRelocatePeCoffImage (
       AlignImageSize += ImageContext.SectionAlignment;

     }

 

+    Status = EFI_UNSUPPORTED;

+

     if (PcdGet64(PcdLoadModuleAtFixAddressEnable) != 0 && (Private->HobList.HandoffInformationTable->BootMode != BOOT_ON_S3_RESUME)) {

       Status = GetPeCoffImageFixLoadingAssignedAddress(&ImageContext, Private);

       if (EFI_ERROR (Status)){

         DEBUG ((EFI_D_INFO|EFI_D_LOAD, "LOADING MODULE FIXED ERROR: Failed to load module at fixed address. \n"));

-        //

-        // The PEIM is not assigned valid address, try to allocate page to load it.

-        //

-        Status = PeiServicesAllocatePages (EfiBootServicesCode,

-                                           EFI_SIZE_TO_PAGES ((UINT32) AlignImageSize),

-                                           &ImageContext.ImageAddress);

       }

-    } else {

+    }

+    if (EFI_ERROR (Status)){

+      //

+      // The PEIM is not assigned valid address, try to allocate page to load it.

+      //

       Status = PeiServicesAllocatePages (EfiBootServicesCode,

                                          EFI_SIZE_TO_PAGES ((UINT32) AlignImageSize),

                                          &ImageContext.ImageAddress);

-- 
2.31.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#79672): https://edk2.groups.io/g/devel/message/79672
Mute This Topic: https://groups.io/mt/85048609/1813853
Group Owner: devel+owner at edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [edk2-devel-archive at redhat.com]
-=-=-=-=-=-=-=-=-=-=-=-






More information about the edk2-devel-archive mailing list