From 15cd6a822c3b96cc3d5e12d4ec271b686e7d0bd8 Mon Sep 17 00:00:00 2001 From: lgao4 Date: Mon, 23 Feb 2009 14:31:09 +0000 Subject: Add conditional check before output status code. git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@7603 6f19259b-4bc3-4df7-8a09-765794883524 --- .../ReportStatusCodeLib.c | 32 +++++++++++++--------- 1 file changed, 19 insertions(+), 13 deletions(-) (limited to 'IntelFrameworkModulePkg/Library/DxeReportStatusCodeLibFramework') diff --git a/IntelFrameworkModulePkg/Library/DxeReportStatusCodeLibFramework/ReportStatusCodeLib.c b/IntelFrameworkModulePkg/Library/DxeReportStatusCodeLibFramework/ReportStatusCodeLib.c index f29831563c..9e35cdda90 100644 --- a/IntelFrameworkModulePkg/Library/DxeReportStatusCodeLibFramework/ReportStatusCodeLib.c +++ b/IntelFrameworkModulePkg/Library/DxeReportStatusCodeLibFramework/ReportStatusCodeLib.c @@ -48,22 +48,28 @@ InternalReportStatusCode ( IN EFI_STATUS_CODE_DATA *Data OPTIONAL ) { - // - // If gStatusCode is NULL, then see if a Status Code Protocol instance is present - // in the handle database. - // - if (mReportStatusCode == NULL) { - mReportStatusCode = InternalGetReportStatusCode (); + if ((ReportProgressCodeEnabled() && ((Type) & EFI_STATUS_CODE_TYPE_MASK) == EFI_PROGRESS_CODE) || + (ReportErrorCodeEnabled() && ((Type) & EFI_STATUS_CODE_TYPE_MASK) == EFI_ERROR_CODE) || + (ReportDebugCodeEnabled() && ((Type) & EFI_STATUS_CODE_TYPE_MASK) == EFI_DEBUG_CODE)) { + // + // If gStatusCode is NULL, then see if a Status Code Protocol instance is present + // in the handle database. + // if (mReportStatusCode == NULL) { - return EFI_UNSUPPORTED; + mReportStatusCode = InternalGetReportStatusCode (); + if (mReportStatusCode == 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 (*mReportStatusCode) (Type, Value, Instance, (EFI_GUID *)CallerId, Data); } - - // - // 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 (*mReportStatusCode) (Type, Value, Instance, (EFI_GUID *)CallerId, Data); + + return EFI_UNSUPPORTED; } -- cgit v1.2.3