mirror of https://github.com/acidanthera/audk.git
Update EfiLibReportStatusCode in ECP EfiDriverLib and EfiRuntimeLib libraries to check uefi version in runtime not in build time.
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@5947 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
parent
90d6d599d9
commit
bdabfae78d
|
@ -23,9 +23,7 @@ Abstract:
|
|||
#include EFI_GUID_DEFINITION (StatusCodeDataTypeId)
|
||||
#include EFI_ARCH_PROTOCOL_DEFINITION (StatusCode)
|
||||
|
||||
#if (EFI_SPECIFICATION_VERSION >= 0x00020000)
|
||||
STATIC EFI_STATUS_CODE_PROTOCOL *gStatusCode = NULL;
|
||||
#endif
|
||||
|
||||
EFI_STATUS
|
||||
EfiLibReportStatusCode (
|
||||
|
@ -59,7 +57,9 @@ Returns:
|
|||
{
|
||||
EFI_STATUS Status;
|
||||
|
||||
#if (EFI_SPECIFICATION_VERSION >= 0x00020000)
|
||||
Status = EFI_UNSUPPORTED;
|
||||
|
||||
if (gRT->Hdr.Revision >= 0x00020000) {
|
||||
if (gStatusCode == NULL) {
|
||||
if (gBS == NULL) {
|
||||
return EFI_UNSUPPORTED;
|
||||
|
@ -70,8 +70,7 @@ Returns:
|
|||
}
|
||||
}
|
||||
Status = gStatusCode->ReportStatusCode (Type, Value, Instance, CallerId, Data);
|
||||
return Status;
|
||||
#else
|
||||
} else {
|
||||
if (gRT == NULL) {
|
||||
return EFI_UNSUPPORTED;
|
||||
}
|
||||
|
@ -79,13 +78,15 @@ Returns:
|
|||
// Check whether EFI_RUNTIME_SERVICES has Tiano Extension
|
||||
//
|
||||
Status = EFI_UNSUPPORTED;
|
||||
#if (EFI_SPECIFICATION_VERSION < 0x00020000)
|
||||
if (gRT->Hdr.Revision == EFI_SPECIFICATION_VERSION &&
|
||||
gRT->Hdr.HeaderSize == sizeof (EFI_RUNTIME_SERVICES) &&
|
||||
gRT->ReportStatusCode != NULL) {
|
||||
Status = gRT->ReportStatusCode (Type, Value, Instance, CallerId, Data);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
return Status;
|
||||
#endif
|
||||
}
|
||||
|
||||
EFI_STATUS
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*++
|
||||
|
||||
Copyright (c) 2004 - 2008, Intel Corporation
|
||||
Copyright (c) 2005 - 2008, Intel Corporation
|
||||
All rights reserved. This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
|
@ -42,9 +42,7 @@ EFI_CPU_IO_PROTOCOL *gCpuIo;
|
|||
BOOLEAN mEfiAtRuntime = FALSE;
|
||||
FVB_ENTRY *mFvbEntry;
|
||||
|
||||
#if (EFI_SPECIFICATION_VERSION >= 0x00020000)
|
||||
static EFI_STATUS_CODE_PROTOCOL *gStatusCode = NULL;
|
||||
#endif
|
||||
|
||||
EFI_STATUS
|
||||
EfiConvertPointer (
|
||||
|
@ -213,12 +211,10 @@ Returns:
|
|||
// Update global for Runtime Services Table and IO
|
||||
//
|
||||
EfiConvertInternalPointer ((VOID **) &gCpuIo);
|
||||
#if (EFI_SPECIFICATION_VERSION >= 0x00020000)
|
||||
if (gStatusCode != NULL) {
|
||||
EfiConvertInternalPointer ((VOID **) &gStatusCode->ReportStatusCode);
|
||||
EfiConvertInternalPointer ((VOID **) &gStatusCode);
|
||||
}
|
||||
#endif
|
||||
EfiConvertInternalPointer ((VOID **) &mRT);
|
||||
|
||||
//
|
||||
|
@ -274,12 +270,10 @@ Returns:
|
|||
Status = EfiLibGetSystemConfigurationTable (&gEfiDxeServicesTableGuid, (VOID **) &gDS);
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
|
||||
#if (EFI_SPECIFICATION_VERSION >= 0x00020000)
|
||||
Status = gBS->LocateProtocol (&gEfiStatusCodeRuntimeProtocolGuid, NULL, (VOID **)&gStatusCode);
|
||||
if (EFI_ERROR (Status)) {
|
||||
gStatusCode = NULL;
|
||||
}
|
||||
#endif
|
||||
|
||||
Status = gBS->LocateProtocol (&gEfiCpuIoProtocolGuid, NULL, (VOID **) &gCpuIo);
|
||||
if (EFI_ERROR (Status)) {
|
||||
|
@ -405,12 +399,10 @@ Returns:
|
|||
mRT = SystemTable->RuntimeServices;
|
||||
ASSERT (mRT != NULL);
|
||||
|
||||
#if (EFI_SPECIFICATION_VERSION >= 0x00020000)
|
||||
Status = gBS->LocateProtocol (&gEfiStatusCodeRuntimeProtocolGuid, NULL, (VOID **)&gStatusCode);
|
||||
if (EFI_ERROR (Status)) {
|
||||
gStatusCode = NULL;
|
||||
}
|
||||
#endif
|
||||
|
||||
Status = gBS->LocateProtocol (&gEfiCpuIoProtocolGuid, NULL, (VOID **) &gCpuIo);
|
||||
if (EFI_ERROR (Status)) {
|
||||
|
@ -664,7 +656,6 @@ Returns:
|
|||
return mRT->SetVariable (VariableName, VendorGuid, Attributes, DataSize, Data);
|
||||
}
|
||||
|
||||
|
||||
#if (EFI_SPECIFICATION_VERSION >= 0x00020000)
|
||||
|
||||
EFI_STATUS
|
||||
|
@ -703,6 +694,7 @@ Returns:
|
|||
|
||||
#endif
|
||||
|
||||
|
||||
EFI_STATUS
|
||||
EfiGetNextHighMonotonicCount (
|
||||
OUT UINT32 *HighCount
|
||||
|
@ -790,7 +782,9 @@ Returns:
|
|||
{
|
||||
EFI_STATUS Status;
|
||||
|
||||
#if (EFI_SPECIFICATION_VERSION >= 0x00020000)
|
||||
Status = EFI_UNSUPPORTED;
|
||||
|
||||
if (mRT->Hdr.Revision >= 0x00020000) {
|
||||
if (gStatusCode == NULL) {
|
||||
if (EfiAtRuntime ()) {
|
||||
return EFI_UNSUPPORTED;
|
||||
|
@ -801,7 +795,7 @@ Returns:
|
|||
}
|
||||
}
|
||||
Status = gStatusCode->ReportStatusCode (CodeType, Value, Instance, CallerId, Data);
|
||||
#else
|
||||
} else {
|
||||
if (mRT == NULL) {
|
||||
return EFI_UNSUPPORTED;
|
||||
}
|
||||
|
@ -809,11 +803,13 @@ Returns:
|
|||
// Check whether EFI_RUNTIME_SERVICES has Tiano Extension
|
||||
//
|
||||
Status = EFI_UNSUPPORTED;
|
||||
#if (EFI_SPECIFICATION_VERSION < 0x00020000)
|
||||
if (mRT->Hdr.Revision == EFI_SPECIFICATION_VERSION &&
|
||||
mRT->Hdr.HeaderSize == sizeof (EFI_RUNTIME_SERVICES) &&
|
||||
mRT->ReportStatusCode != NULL) {
|
||||
Status = mRT->ReportStatusCode (CodeType, Value, Instance, CallerId, Data);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
return Status;
|
||||
}
|
||||
|
|
|
@ -42,9 +42,7 @@ EFI_CPU_IO_PROTOCOL *gCpuIo;
|
|||
BOOLEAN mEfiAtRuntime = FALSE;
|
||||
FVB_ENTRY *mFvbEntry;
|
||||
|
||||
#if (EFI_SPECIFICATION_VERSION >= 0x00020000)
|
||||
static EFI_STATUS_CODE_PROTOCOL *gStatusCode = NULL;
|
||||
#endif
|
||||
|
||||
EFI_STATUS
|
||||
EfiConvertPointer (
|
||||
|
@ -213,12 +211,10 @@ Returns:
|
|||
// Update global for Runtime Services Table and IO
|
||||
//
|
||||
EfiConvertInternalPointer ((VOID **) &gCpuIo);
|
||||
#if (EFI_SPECIFICATION_VERSION >= 0x00020000)
|
||||
if (gStatusCode != NULL) {
|
||||
EfiConvertInternalPointer ((VOID **) &gStatusCode->ReportStatusCode);
|
||||
EfiConvertInternalPointer ((VOID **) &gStatusCode);
|
||||
}
|
||||
#endif
|
||||
EfiConvertInternalPointer ((VOID **) &mRT);
|
||||
|
||||
//
|
||||
|
@ -274,12 +270,10 @@ Returns:
|
|||
Status = EfiLibGetSystemConfigurationTable (&gEfiDxeServicesTableGuid, (VOID **) &gDS);
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
|
||||
#if (EFI_SPECIFICATION_VERSION >= 0x00020000)
|
||||
Status = gBS->LocateProtocol (&gEfiStatusCodeRuntimeProtocolGuid, NULL, (VOID **)&gStatusCode);
|
||||
if (EFI_ERROR (Status)) {
|
||||
gStatusCode = NULL;
|
||||
}
|
||||
#endif
|
||||
|
||||
Status = gBS->LocateProtocol (&gEfiCpuIoProtocolGuid, NULL, (VOID **) &gCpuIo);
|
||||
if (EFI_ERROR (Status)) {
|
||||
|
@ -405,12 +399,10 @@ Returns:
|
|||
mRT = SystemTable->RuntimeServices;
|
||||
ASSERT (mRT != NULL);
|
||||
|
||||
#if (EFI_SPECIFICATION_VERSION >= 0x00020000)
|
||||
Status = gBS->LocateProtocol (&gEfiStatusCodeRuntimeProtocolGuid, NULL, (VOID **)&gStatusCode);
|
||||
if (EFI_ERROR (Status)) {
|
||||
gStatusCode = NULL;
|
||||
}
|
||||
#endif
|
||||
|
||||
Status = gBS->LocateProtocol (&gEfiCpuIoProtocolGuid, NULL, (VOID **) &gCpuIo);
|
||||
if (EFI_ERROR (Status)) {
|
||||
|
@ -790,7 +782,9 @@ Returns:
|
|||
{
|
||||
EFI_STATUS Status;
|
||||
|
||||
#if (EFI_SPECIFICATION_VERSION >= 0x00020000)
|
||||
Status = EFI_UNSUPPORTED;
|
||||
|
||||
if (mRT->Hdr.Revision >= 0x00020000) {
|
||||
if (gStatusCode == NULL) {
|
||||
if (EfiAtRuntime ()) {
|
||||
return EFI_UNSUPPORTED;
|
||||
|
@ -801,7 +795,7 @@ Returns:
|
|||
}
|
||||
}
|
||||
Status = gStatusCode->ReportStatusCode (CodeType, Value, Instance, CallerId, Data);
|
||||
#else
|
||||
} else {
|
||||
if (mRT == NULL) {
|
||||
return EFI_UNSUPPORTED;
|
||||
}
|
||||
|
@ -809,11 +803,13 @@ Returns:
|
|||
// Check whether EFI_RUNTIME_SERVICES has Tiano Extension
|
||||
//
|
||||
Status = EFI_UNSUPPORTED;
|
||||
#if (EFI_SPECIFICATION_VERSION < 0x00020000)
|
||||
if (mRT->Hdr.Revision == EFI_SPECIFICATION_VERSION &&
|
||||
mRT->Hdr.HeaderSize == sizeof (EFI_RUNTIME_SERVICES) &&
|
||||
mRT->ReportStatusCode != NULL) {
|
||||
Status = mRT->ReportStatusCode (CodeType, Value, Instance, CallerId, Data);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
return Status;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue