From: qhuang8 Date: Fri, 12 Sep 2008 07:54:40 +0000 (+0000) Subject: Fix the bug in GlueLib that we should depend on the gRT revision to use the proper... X-Git-Tag: edk2-stable201903~20334 X-Git-Url: https://git.proxmox.com/?p=mirror_edk2.git;a=commitdiff_plain;h=33629bba69a3fc8e77b14677bbe8a00c879a3d6c Fix the bug in GlueLib that we should depend on the gRT revision to use the proper report status code function. git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@5889 6f19259b-4bc3-4df7-8a09-765794883524 --- diff --git a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/DxeReportStatusCodeLib/ReportStatusCodeLib.c b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/DxeReportStatusCodeLib/ReportStatusCodeLib.c index 2178d742e1..0526d22073 100644 --- a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/DxeReportStatusCodeLib/ReportStatusCodeLib.c +++ b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/DxeReportStatusCodeLib/ReportStatusCodeLib.c @@ -22,13 +22,11 @@ Abstract: #include "EdkIIGlueDxe.h" -#if (EFI_SPECIFICATION_VERSION >= 0x00020000) // // Global pointer to the Status Code Protocol // static EFI_STATUS_CODE_PROTOCOL *gStatusCode = NULL; -#endif /** Internal worker function that reports a status code through the Status Code Protocol @@ -63,32 +61,32 @@ InternalReportStatusCode ( IN EFI_STATUS_CODE_DATA *Data OPTIONAL ) { -#if (EFI_SPECIFICATION_VERSION >= 0x00020000) - EFI_STATUS Status; - // - // If gStatusCode is NULL, then see if a Status Code Protocol instance is present - // in the handle database. - // - if (gStatusCode == NULL) { - Status = gBS->LocateProtocol (&gEfiStatusCodeRuntimeProtocolGuid, NULL, (VOID **)&gStatusCode); - if (EFI_ERROR (Status) || gStatusCode == NULL) { - return EFI_UNSUPPORTED; - } + if (gRT == NULL) { + return EFI_UNSUPPORTED; } - // - // A Status Code Protocol is present in the handle database, so pass in all the - // parameters to the ReportStatusCode() service of the Status Code Protocol - // - return (gStatusCode->ReportStatusCode) (Type, Value, Instance, (EFI_GUID *)CallerId, Data); - -#else - - return (gRT->ReportStatusCode) (Type, Value, Instance, (EFI_GUID *)CallerId, Data); + if (gRT->Hdr.Revision >= 0x00020000) { + // + // If gStatusCode is NULL, then see if a Status Code Protocol instance is present + // in the handle database. + // + if (gStatusCode == NULL) { + Status = gBS->LocateProtocol (&gEfiStatusCodeRuntimeProtocolGuid, NULL, (VOID **)&gStatusCode); + if (EFI_ERROR (Status) || gStatusCode == NULL) { + return EFI_UNSUPPORTED; + } + } -#endif + // + // A Status Code Protocol is present in the handle database, so pass in all the + // parameters to the ReportStatusCode() service of the Status Code Protocol + // + return (gStatusCode->ReportStatusCode) (Type, Value, Instance, (EFI_GUID *)CallerId, Data); + } else { + return (gRT->ReportStatusCode) (Type, Value, Instance, (EFI_GUID *)CallerId, Data); + } }