summaryrefslogtreecommitdiff
path: root/MdeModulePkg/Library/DxeReportStatusCodeLib
diff options
context:
space:
mode:
authorxli24 <xli24@6f19259b-4bc3-4df7-8a09-765794883524>2009-12-31 03:53:06 +0000
committerxli24 <xli24@6f19259b-4bc3-4df7-8a09-765794883524>2009-12-31 03:53:06 +0000
commit4adf000886c2328d8dbbcd00b88e671286e9300f (patch)
treed0ef7aaa6a3c73d69089e70ca71e94a077018d46 /MdeModulePkg/Library/DxeReportStatusCodeLib
parentff482c5692e4011d7d096442c945b478f1bad40b (diff)
downloadedk2-platforms-4adf000886c2328d8dbbcd00b88e671286e9300f.tar.xz
Refine DxeReportStatusCodeLib and RuntimeDxeReportStatusCodeLib.
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@9651 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'MdeModulePkg/Library/DxeReportStatusCodeLib')
-rw-r--r--MdeModulePkg/Library/DxeReportStatusCodeLib/DxeReportStatusCodeLib.inf3
-rw-r--r--MdeModulePkg/Library/DxeReportStatusCodeLib/ReportStatusCodeLib.c61
2 files changed, 32 insertions, 32 deletions
diff --git a/MdeModulePkg/Library/DxeReportStatusCodeLib/DxeReportStatusCodeLib.inf b/MdeModulePkg/Library/DxeReportStatusCodeLib/DxeReportStatusCodeLib.inf
index 65e05fdce2..e1e72797d0 100644
--- a/MdeModulePkg/Library/DxeReportStatusCodeLib/DxeReportStatusCodeLib.inf
+++ b/MdeModulePkg/Library/DxeReportStatusCodeLib/DxeReportStatusCodeLib.inf
@@ -38,7 +38,6 @@
[LibraryClasses]
PcdLib
BaseMemoryLib
- MemoryAllocationLib
UefiBootServicesTableLib
DebugLib
UefiRuntimeServicesTableLib
@@ -49,7 +48,7 @@
gEfiStatusCodeDataTypeDebugGuid ## CONSUMES
[Protocols]
- gEfiStatusCodeRuntimeProtocolGuid ## SOMETIMES_CONSUMES (Used if revision of the EFI Specification is not less than 0x20000)
+ gEfiStatusCodeRuntimeProtocolGuid ## CONSUMES
[Pcd.common]
gEfiMdePkgTokenSpaceGuid.PcdReportStatusCodePropertyMask
diff --git a/MdeModulePkg/Library/DxeReportStatusCodeLib/ReportStatusCodeLib.c b/MdeModulePkg/Library/DxeReportStatusCodeLib/ReportStatusCodeLib.c
index f32e167d94..8c456bebf4 100644
--- a/MdeModulePkg/Library/DxeReportStatusCodeLib/ReportStatusCodeLib.c
+++ b/MdeModulePkg/Library/DxeReportStatusCodeLib/ReportStatusCodeLib.c
@@ -13,53 +13,56 @@
**/
#include <Library/ReportStatusCodeLib.h>
+#include <Library/BaseLib.h>
#include <Library/DebugLib.h>
#include <Library/UefiBootServicesTableLib.h>
-#include <Library/BaseLib.h>
#include <Library/BaseMemoryLib.h>
-#include <Library/MemoryAllocationLib.h>
#include <Library/PcdLib.h>
-#include <Library/UefiRuntimeServicesTableLib.h>
#include <Library/DevicePathLib.h>
+#include <Protocol/StatusCode.h>
+
#include <Guid/StatusCodeDataTypeId.h>
#include <Guid/StatusCodeDataTypeDebug.h>
-#include <Protocol/StatusCode.h>
-EFI_REPORT_STATUS_CODE mReportStatusCode = NULL;
+EFI_STATUS_CODE_PROTOCOL *mReportStatusCodeLibStatusCodeProtocol = NULL;
/**
Locate the report status code service.
- @return Function pointer to the report status code service.
- NULL is returned if no status code service is available.
+ Retrieve ReportStatusCode() API of Report Status Code Protocol.
**/
-EFI_REPORT_STATUS_CODE
+VOID
InternalGetReportStatusCode (
VOID
)
{
- EFI_STATUS_CODE_PROTOCOL *StatusCodeProtocol;
- EFI_STATUS Status;
+ EFI_STATUS Status;
+
+ if (mReportStatusCodeLibStatusCodeProtocol != NULL) {
+ return;
+ }
+ //
+ // Check gBS just in case ReportStatusCode is called before gBS is initialized.
+ //
if (gBS != NULL && gBS->LocateProtocol != NULL) {
- Status = gBS->LocateProtocol (&gEfiStatusCodeRuntimeProtocolGuid, NULL, (VOID**)&StatusCodeProtocol);
- if (!EFI_ERROR (Status) && StatusCodeProtocol != NULL) {
- return StatusCodeProtocol->ReportStatusCode;
+ Status = gBS->LocateProtocol (&gEfiStatusCodeRuntimeProtocolGuid, NULL, (VOID**) &mReportStatusCodeLibStatusCodeProtocol);
+ if (EFI_ERROR (Status)) {
+ mReportStatusCodeLibStatusCodeProtocol = NULL;
}
}
-
- return NULL;
}
/**
- Internal worker function that reports a status code through the status code service.
+ Internal worker function that reports a status code through the Report Status Code Protocol.
- If status code service is not cached, then this function checks if status code service is
- available in system. If status code service is not available, then EFI_UNSUPPORTED is
- returned. If status code service is present, then it is cached in mReportStatusCode.
- Finally this function reports status code through the status code service.
+ If status code service is not cached, then this function checks if Report Status Code
+ Protocol is available in system. If Report Status Code Protocol is not available, then
+ EFI_UNSUPPORTED is returned. If Report Status Code Protocol is present, then it is
+ cached in mReportStatusCodeLibStatusCodeProtocol. Finally this function reports status
+ code through the Report Status Code Protocol.
@param Type Status code type.
@param Value Status code value.
@@ -71,7 +74,7 @@ InternalGetReportStatusCode (
optional parameter that may be NULL.
@retval EFI_SUCCESS The status code was reported.
- @retval EFI_UNSUPPORTED Status code service is not available.
+ @retval EFI_UNSUPPORTED Report Status Code Protocol is not available.
@retval EFI_UNSUPPORTED Status code type is not supported.
**/
@@ -88,19 +91,17 @@ InternalReportStatusCode (
(ReportErrorCodeEnabled() && ((Type) & EFI_STATUS_CODE_TYPE_MASK) == EFI_ERROR_CODE) ||
(ReportDebugCodeEnabled() && ((Type) & EFI_STATUS_CODE_TYPE_MASK) == EFI_DEBUG_CODE)) {
//
- // If mReportStatusCode is NULL, then check if status code service is available in system.
+ // If mReportStatusCodeLibStatusCodeProtocol is NULL, then check if Report Status Code Protocol is available in system.
//
- if (mReportStatusCode == NULL) {
- mReportStatusCode = InternalGetReportStatusCode ();
- if (mReportStatusCode == NULL) {
- return EFI_UNSUPPORTED;
- }
+ InternalGetReportStatusCode ();
+ if (mReportStatusCodeLibStatusCodeProtocol == NULL) {
+ return EFI_UNSUPPORTED;
}
-
+
//
- // A status code service is present in system, so pass in all the parameters to the service.
+ // A Report Status Code Protocol is present in system, so pass in all the parameters to the service.
//
- return (*mReportStatusCode) (Type, Value, Instance, (EFI_GUID *)CallerId, Data);
+ return mReportStatusCodeLibStatusCodeProtocol->ReportStatusCode (Type, Value, Instance, (EFI_GUID *)CallerId, Data);
}
return EFI_UNSUPPORTED;