The return value after calls to functions CoreProcessFvImageFile, CoreStartImage, CoreGetDepexSectionAndPreProccess, CoreInternalAddMemorySpace, CoreAddIoSpace, CoreAllocateMemorySpace and CoreCloseProtocol is stored in Status, but it is not made of any use and later Status gets overridden.
An option assuming this no Status check is deliberate, would be to remove the return value storage in Status. Otherwise, simply add Status check and appropriate debug messages (the patch does this). REF: https://bugzilla.tianocore.org/show_bug.cgi?id=4219 Cc: Dandan Bi <dandan...@intel.com> Cc: Liming Gao <gaolim...@byosoft.com.cn> Signed-off-by: Ranbir Singh <rsi...@ventanamicro.com> --- MdeModulePkg/Core/Dxe/Dispatcher/Dispatcher.c | 15 +++++++++++++++ MdeModulePkg/Core/Dxe/Gcd/Gcd.c | 15 +++++++++++++++ MdeModulePkg/Core/Dxe/Image/Image.c | 3 +++ 3 files changed, 33 insertions(+) diff --git a/MdeModulePkg/Core/Dxe/Dispatcher/Dispatcher.c b/MdeModulePkg/Core/Dxe/Dispatcher/Dispatcher.c index cf9d55687766..f53a2513457a 100644 --- a/MdeModulePkg/Core/Dxe/Dispatcher/Dispatcher.c +++ b/MdeModulePkg/Core/Dxe/Dispatcher/Dispatcher.c @@ -506,6 +506,10 @@ CoreDispatcher ( // Produce a firmware volume block protocol for FvImage so it gets dispatched from. // Status = CoreProcessFvImageFile (DriverEntry->Fv, DriverEntry->FvHandle, &DriverEntry->FileName); + if (EFI_ERROR (Status)) { + DEBUG ((DEBUG_DISPATCH, "Failed to produce a FVB protocol for Fv %p FvHandle %p and FileName %g.\n", + DriverEntry->Fv, DriverEntry->FvHandle, &DriverEntry->FileName)); + } } else { REPORT_STATUS_CODE_WITH_EXTENDED_DATA ( EFI_PROGRESS_CODE, @@ -516,6 +520,10 @@ CoreDispatcher ( ASSERT (DriverEntry->ImageHandle != NULL); Status = CoreStartImage (DriverEntry->ImageHandle, NULL, NULL); + if (EFI_ERROR (Status)) { + DEBUG ((DEBUG_DISPATCH, "Failed to transfer control to a loaded image's entry point for ImageHandle %p.\n", + DriverEntry->ImageHandle)); + } REPORT_STATUS_CODE_WITH_EXTENDED_DATA ( EFI_PROGRESS_CODE, @@ -549,6 +557,13 @@ CoreDispatcher ( // If Section Extraction Protocol did not let the Depex be read before retry the read // Status = CoreGetDepexSectionAndPreProccess (DriverEntry); + if (EFI_ERROR (Status)) { + if (Status == EFI_PROTOCOL_ERROR) { + DEBUG ((DEBUG_DISPATCH, "Section extraction protocol failure for DriverEntry %p.\n", DriverEntry)); + } else { + DEBUG ((DEBUG_DISPATCH, "No Depex, assume UEFI 2.0 driver model for DriverEntry %p.\n", DriverEntry)); + } + } } if (DriverEntry->Dependent) { diff --git a/MdeModulePkg/Core/Dxe/Gcd/Gcd.c b/MdeModulePkg/Core/Dxe/Gcd/Gcd.c index 39fa2adf9366..384fee600d85 100644 --- a/MdeModulePkg/Core/Dxe/Gcd/Gcd.c +++ b/MdeModulePkg/Core/Dxe/Gcd/Gcd.c @@ -2638,6 +2638,9 @@ CoreInitializeGcdServices ( ResourceHob->ResourceLength, Capabilities ); + if (EFI_ERROR (Status)) { + DEBUG ((DEBUG_GCD, "Failed to add a segment of memory to GCD map, Status = %r\n", Status)); + } } if (GcdIoType != EfiGcdIoTypeNonExistent) { @@ -2646,6 +2649,9 @@ CoreInitializeGcdServices ( ResourceHob->PhysicalStart, ResourceHob->ResourceLength ); + if (EFI_ERROR (Status)) { + DEBUG ((DEBUG_GCD, "Failed to add reserved I/O or I/O resources, Status = %r\n", Status)); + } } } } @@ -2668,6 +2674,9 @@ CoreInitializeGcdServices ( gDxeCoreImageHandle, NULL ); + if (EFI_ERROR (Status)) { + DEBUG ((DEBUG_GCD, "Failed to allocate memory space, Status = %r\n", Status)); + } } // @@ -2715,6 +2724,9 @@ CoreInitializeGcdServices ( gDxeCoreImageHandle, NULL ); + if (EFI_ERROR (Status)) { + DEBUG ((DEBUG_GCD, "Failed to allocate memory space, Status = %r\n", Status)); + } } } @@ -2763,6 +2775,9 @@ CoreInitializeGcdServices ( gDxeCoreImageHandle, NULL ); + if (EFI_ERROR (Status)) { + DEBUG ((DEBUG_GCD, "Failed to allocate memory space, Status = %r\n", Status)); + } } } } diff --git a/MdeModulePkg/Core/Dxe/Image/Image.c b/MdeModulePkg/Core/Dxe/Image/Image.c index 9dbfb2a1fad2..769e2d379051 100644 --- a/MdeModulePkg/Core/Dxe/Image/Image.c +++ b/MdeModulePkg/Core/Dxe/Image/Image.c @@ -1010,6 +1010,9 @@ CoreUnloadAndCloseImage ( Image->Handle, OpenInfo[OpenInfoIndex].ControllerHandle ); + if (EFI_ERROR (Status)) { + DEBUG ((DEBUG_WARN, "Failed to close protocol on Handle %p\n", HandleBuffer[HandleIndex])); + } } } -- 2.34.1 -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#109106): https://edk2.groups.io/g/devel/message/109106 Mute This Topic: https://groups.io/mt/101612682/21656 Group Owner: devel+ow...@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-