On 2/26/20 11:11 PM, Laszlo Ersek wrote:
In the CoreStartImage() function [MdeModulePkg/Core/Dxe/Image/Image.c], if
the image entry point returns a failure code, then the DXE Core logs a
helpful DEBUG_ERROR message, with the following format string:

   "Error: Image at %11p start failed: %r\n"

Do similarly in the SMM Core (update the message slightly).

Cc: Ard Biesheuvel <ard.biesheu...@linaro.org>
Cc: Eric Dong <eric.d...@intel.com>
Cc: Hao A Wu <hao.a...@intel.com>
Cc: Igor Mammedov <imamm...@redhat.com>
Cc: Jian J Wang <jian.j.w...@intel.com>
Cc: Jiewen Yao <jiewen....@intel.com>
Cc: Jordan Justen <jordan.l.jus...@intel.com>
Cc: Michael Kinney <michael.d.kin...@intel.com>
Cc: Philippe Mathieu-Daudé <phi...@redhat.com>
Cc: Ray Ni <ray...@intel.com>
Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=1512
Signed-off-by: Laszlo Ersek <ler...@redhat.com>
Acked-by: Ard Biesheuvel <ard.biesheu...@linaro.org>
---

Notes:
     v2:

     - Pick up Ard's Acked-by, which is conditional on approval from Intel
       reviewers on Cc. (I'd like to save Ard the churn of re-acking
       unmodified patches.)

  MdeModulePkg/Core/PiSmmCore/Dispatcher.c | 6 ++++++
  1 file changed, 6 insertions(+)

diff --git a/MdeModulePkg/Core/PiSmmCore/Dispatcher.c 
b/MdeModulePkg/Core/PiSmmCore/Dispatcher.c
index 9bec731e5312..76ee9e0b89cc 100644
--- a/MdeModulePkg/Core/PiSmmCore/Dispatcher.c
+++ b/MdeModulePkg/Core/PiSmmCore/Dispatcher.c
@@ -883,44 +883,50 @@ SmmDispatcher (
        RemoveEntryList (&DriverEntry->ScheduledLink);
REPORT_STATUS_CODE_WITH_EXTENDED_DATA (
          EFI_PROGRESS_CODE,
          EFI_SOFTWARE_SMM_DRIVER | EFI_SW_PC_INIT_BEGIN,
          &DriverEntry->ImageHandle,
          sizeof (DriverEntry->ImageHandle)
          );
//
        // Cache state of SmmEntryPointRegistered before calling entry point
        //
        PreviousSmmEntryPointRegistered = 
gSmmCorePrivate->SmmEntryPointRegistered;
//
        // For each SMM driver, pass NULL as ImageHandle
        //
        RegisterSmramProfileImage (DriverEntry, TRUE);
        PERF_START_IMAGE_BEGIN (DriverEntry->ImageHandle);
        Status = 
((EFI_IMAGE_ENTRY_POINT)(UINTN)DriverEntry->ImageEntryPoint)(DriverEntry->ImageHandle,
 gST);
        PERF_START_IMAGE_END (DriverEntry->ImageHandle);
        if (EFI_ERROR(Status)){
+        DEBUG ((
+          DEBUG_ERROR,
+          "Error: SMM image at %11p start failed: %r\n",
+          DriverEntry->SmmLoadedImage.ImageBase,
+          Status
+          ));
          UnregisterSmramProfileImage (DriverEntry, TRUE);
          SmmFreePages(DriverEntry->ImageBuffer, DriverEntry->NumberOfPage);
          //
          // Uninstall LoadedImage
          //
          Status = gBS->UninstallProtocolInterface (
                          DriverEntry->ImageHandle,
                          &gEfiLoadedImageProtocolGuid,
                          DriverEntry->LoadedImage
                          );
          if (!EFI_ERROR (Status)) {
            if (DriverEntry->LoadedImage->FilePath != NULL) {
              gBS->FreePool (DriverEntry->LoadedImage->FilePath);
            }
            gBS->FreePool (DriverEntry->LoadedImage);
          }
          Status = SmmUninstallProtocolInterface (
                     DriverEntry->SmmImageHandle,
                     &gEfiLoadedImageProtocolGuid,
                     &DriverEntry->SmmLoadedImage
                     );
          if (!EFI_ERROR(Status)) {


Reviewed-by: Philippe Mathieu-Daude <phi...@redhat.com>


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#55200): https://edk2.groups.io/g/devel/message/55200
Mute This Topic: https://groups.io/mt/71575164/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to