Revert back the change. For now, ECP only support build mode with EFI_SPECIFICATION_VERSION = 0x00020000 and PI_SPECIFICATION_VERSION = 0x00000009.

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@5959 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
qwang12 2008-09-24 07:00:59 +00:00
parent 5385a57969
commit ce7a12fba0
3 changed files with 92 additions and 85 deletions

View File

@ -23,7 +23,9 @@ Abstract:
#include EFI_GUID_DEFINITION (StatusCodeDataTypeId) #include EFI_GUID_DEFINITION (StatusCodeDataTypeId)
#include EFI_ARCH_PROTOCOL_DEFINITION (StatusCode) #include EFI_ARCH_PROTOCOL_DEFINITION (StatusCode)
#if (EFI_SPECIFICATION_VERSION >= 0x00020000)
STATIC EFI_STATUS_CODE_PROTOCOL *gStatusCode = NULL; STATIC EFI_STATUS_CODE_PROTOCOL *gStatusCode = NULL;
#endif
EFI_STATUS EFI_STATUS
EfiLibReportStatusCode ( EfiLibReportStatusCode (
@ -56,37 +58,34 @@ Returns:
--*/ --*/
{ {
EFI_STATUS Status; EFI_STATUS Status;
Status = EFI_UNSUPPORTED;
if (gRT->Hdr.Revision >= 0x00020000) { #if (EFI_SPECIFICATION_VERSION >= 0x00020000)
if (gStatusCode == NULL) { if (gStatusCode == NULL) {
if (gBS == NULL) { if (gBS == NULL) {
return EFI_UNSUPPORTED; return EFI_UNSUPPORTED;
} }
Status = gBS->LocateProtocol (&gEfiStatusCodeRuntimeProtocolGuid, NULL, (VOID **)&gStatusCode); Status = gBS->LocateProtocol (&gEfiStatusCodeRuntimeProtocolGuid, NULL, (VOID **)&gStatusCode);
if (EFI_ERROR (Status) || gStatusCode == NULL) { if (EFI_ERROR (Status) || gStatusCode == NULL) {
return EFI_UNSUPPORTED; return EFI_UNSUPPORTED;
} }
} }
Status = gStatusCode->ReportStatusCode (Type, Value, Instance, CallerId, Data); Status = gStatusCode->ReportStatusCode (Type, Value, Instance, CallerId, Data);
} else {
if (gRT == NULL) {
return EFI_UNSUPPORTED;
}
//
// 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; return Status;
#else
if (gRT == NULL) {
return EFI_UNSUPPORTED;
}
//
// Check whether EFI_RUNTIME_SERVICES has Tiano Extension
//
Status = EFI_UNSUPPORTED;
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);
}
return Status;
#endif
} }
EFI_STATUS EFI_STATUS

View File

@ -1,6 +1,6 @@
/*++ /*++
Copyright (c) 2005 - 2008, Intel Corporation Copyright (c) 2004 - 2008, Intel Corporation
All rights reserved. This program and the accompanying materials All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License 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 which accompanies this distribution. The full text of the license may be found at
@ -42,7 +42,9 @@ EFI_CPU_IO_PROTOCOL *gCpuIo;
BOOLEAN mEfiAtRuntime = FALSE; BOOLEAN mEfiAtRuntime = FALSE;
FVB_ENTRY *mFvbEntry; FVB_ENTRY *mFvbEntry;
#if (EFI_SPECIFICATION_VERSION >= 0x00020000)
static EFI_STATUS_CODE_PROTOCOL *gStatusCode = NULL; static EFI_STATUS_CODE_PROTOCOL *gStatusCode = NULL;
#endif
EFI_STATUS EFI_STATUS
EfiConvertPointer ( EfiConvertPointer (
@ -211,10 +213,12 @@ Returns:
// Update global for Runtime Services Table and IO // Update global for Runtime Services Table and IO
// //
EfiConvertInternalPointer ((VOID **) &gCpuIo); EfiConvertInternalPointer ((VOID **) &gCpuIo);
#if (EFI_SPECIFICATION_VERSION >= 0x00020000)
if (gStatusCode != NULL) { if (gStatusCode != NULL) {
EfiConvertInternalPointer ((VOID **) &gStatusCode->ReportStatusCode); EfiConvertInternalPointer ((VOID **) &gStatusCode->ReportStatusCode);
EfiConvertInternalPointer ((VOID **) &gStatusCode); EfiConvertInternalPointer ((VOID **) &gStatusCode);
} }
#endif
EfiConvertInternalPointer ((VOID **) &mRT); EfiConvertInternalPointer ((VOID **) &mRT);
// //
@ -270,10 +274,12 @@ Returns:
Status = EfiLibGetSystemConfigurationTable (&gEfiDxeServicesTableGuid, (VOID **) &gDS); Status = EfiLibGetSystemConfigurationTable (&gEfiDxeServicesTableGuid, (VOID **) &gDS);
ASSERT_EFI_ERROR (Status); ASSERT_EFI_ERROR (Status);
#if (EFI_SPECIFICATION_VERSION >= 0x00020000)
Status = gBS->LocateProtocol (&gEfiStatusCodeRuntimeProtocolGuid, NULL, (VOID **)&gStatusCode); Status = gBS->LocateProtocol (&gEfiStatusCodeRuntimeProtocolGuid, NULL, (VOID **)&gStatusCode);
if (EFI_ERROR (Status)) { if (EFI_ERROR (Status)) {
gStatusCode = NULL; gStatusCode = NULL;
} }
#endif
Status = gBS->LocateProtocol (&gEfiCpuIoProtocolGuid, NULL, (VOID **) &gCpuIo); Status = gBS->LocateProtocol (&gEfiCpuIoProtocolGuid, NULL, (VOID **) &gCpuIo);
if (EFI_ERROR (Status)) { if (EFI_ERROR (Status)) {
@ -399,10 +405,12 @@ Returns:
mRT = SystemTable->RuntimeServices; mRT = SystemTable->RuntimeServices;
ASSERT (mRT != NULL); ASSERT (mRT != NULL);
#if (EFI_SPECIFICATION_VERSION >= 0x00020000)
Status = gBS->LocateProtocol (&gEfiStatusCodeRuntimeProtocolGuid, NULL, (VOID **)&gStatusCode); Status = gBS->LocateProtocol (&gEfiStatusCodeRuntimeProtocolGuid, NULL, (VOID **)&gStatusCode);
if (EFI_ERROR (Status)) { if (EFI_ERROR (Status)) {
gStatusCode = NULL; gStatusCode = NULL;
} }
#endif
Status = gBS->LocateProtocol (&gEfiCpuIoProtocolGuid, NULL, (VOID **) &gCpuIo); Status = gBS->LocateProtocol (&gEfiCpuIoProtocolGuid, NULL, (VOID **) &gCpuIo);
if (EFI_ERROR (Status)) { if (EFI_ERROR (Status)) {
@ -656,6 +664,7 @@ Returns:
return mRT->SetVariable (VariableName, VendorGuid, Attributes, DataSize, Data); return mRT->SetVariable (VariableName, VendorGuid, Attributes, DataSize, Data);
} }
#if (EFI_SPECIFICATION_VERSION >= 0x00020000) #if (EFI_SPECIFICATION_VERSION >= 0x00020000)
EFI_STATUS EFI_STATUS
@ -694,7 +703,6 @@ Returns:
#endif #endif
EFI_STATUS EFI_STATUS
EfiGetNextHighMonotonicCount ( EfiGetNextHighMonotonicCount (
OUT UINT32 *HighCount OUT UINT32 *HighCount
@ -781,35 +789,31 @@ Returns:
--*/ --*/
{ {
EFI_STATUS Status; EFI_STATUS Status;
Status = EFI_UNSUPPORTED;
if (mRT->Hdr.Revision >= 0x00020000) { #if (EFI_SPECIFICATION_VERSION >= 0x00020000)
if (gStatusCode == NULL) { if (gStatusCode == NULL) {
if (EfiAtRuntime ()) { if (EfiAtRuntime ()) {
return EFI_UNSUPPORTED; return EFI_UNSUPPORTED;
} }
Status = gBS->LocateProtocol (&gEfiStatusCodeRuntimeProtocolGuid, NULL, (VOID **)&gStatusCode); Status = gBS->LocateProtocol (&gEfiStatusCodeRuntimeProtocolGuid, NULL, (VOID **)&gStatusCode);
if (EFI_ERROR (Status) || gStatusCode == NULL) { if (EFI_ERROR (Status) || gStatusCode == NULL) {
return EFI_UNSUPPORTED; return EFI_UNSUPPORTED;
} }
} }
Status = gStatusCode->ReportStatusCode (CodeType, Value, Instance, CallerId, Data); Status = gStatusCode->ReportStatusCode (CodeType, Value, Instance, CallerId, Data);
} else { #else
if (mRT == NULL) { if (mRT == NULL) {
return EFI_UNSUPPORTED; return EFI_UNSUPPORTED;
} }
// //
// Check whether EFI_RUNTIME_SERVICES has Tiano Extension // Check whether EFI_RUNTIME_SERVICES has Tiano Extension
// //
Status = EFI_UNSUPPORTED; Status = EFI_UNSUPPORTED;
#if (EFI_SPECIFICATION_VERSION < 0x00020000) if (mRT->Hdr.Revision == EFI_SPECIFICATION_VERSION &&
if (mRT->Hdr.Revision == EFI_SPECIFICATION_VERSION && mRT->Hdr.HeaderSize == sizeof (EFI_RUNTIME_SERVICES) &&
mRT->Hdr.HeaderSize == sizeof (EFI_RUNTIME_SERVICES) && mRT->ReportStatusCode != NULL) {
mRT->ReportStatusCode != NULL) {
Status = mRT->ReportStatusCode (CodeType, Value, Instance, CallerId, Data); Status = mRT->ReportStatusCode (CodeType, Value, Instance, CallerId, Data);
}
#endif #endif
}
}
return Status; return Status;
} }

View File

@ -42,7 +42,9 @@ EFI_CPU_IO_PROTOCOL *gCpuIo;
BOOLEAN mEfiAtRuntime = FALSE; BOOLEAN mEfiAtRuntime = FALSE;
FVB_ENTRY *mFvbEntry; FVB_ENTRY *mFvbEntry;
#if (EFI_SPECIFICATION_VERSION >= 0x00020000)
static EFI_STATUS_CODE_PROTOCOL *gStatusCode = NULL; static EFI_STATUS_CODE_PROTOCOL *gStatusCode = NULL;
#endif
EFI_STATUS EFI_STATUS
EfiConvertPointer ( EfiConvertPointer (
@ -211,10 +213,12 @@ Returns:
// Update global for Runtime Services Table and IO // Update global for Runtime Services Table and IO
// //
EfiConvertInternalPointer ((VOID **) &gCpuIo); EfiConvertInternalPointer ((VOID **) &gCpuIo);
#if (EFI_SPECIFICATION_VERSION >= 0x00020000)
if (gStatusCode != NULL) { if (gStatusCode != NULL) {
EfiConvertInternalPointer ((VOID **) &gStatusCode->ReportStatusCode); EfiConvertInternalPointer ((VOID **) &gStatusCode->ReportStatusCode);
EfiConvertInternalPointer ((VOID **) &gStatusCode); EfiConvertInternalPointer ((VOID **) &gStatusCode);
} }
#endif
EfiConvertInternalPointer ((VOID **) &mRT); EfiConvertInternalPointer ((VOID **) &mRT);
// //
@ -270,10 +274,12 @@ Returns:
Status = EfiLibGetSystemConfigurationTable (&gEfiDxeServicesTableGuid, (VOID **) &gDS); Status = EfiLibGetSystemConfigurationTable (&gEfiDxeServicesTableGuid, (VOID **) &gDS);
ASSERT_EFI_ERROR (Status); ASSERT_EFI_ERROR (Status);
#if (EFI_SPECIFICATION_VERSION >= 0x00020000)
Status = gBS->LocateProtocol (&gEfiStatusCodeRuntimeProtocolGuid, NULL, (VOID **)&gStatusCode); Status = gBS->LocateProtocol (&gEfiStatusCodeRuntimeProtocolGuid, NULL, (VOID **)&gStatusCode);
if (EFI_ERROR (Status)) { if (EFI_ERROR (Status)) {
gStatusCode = NULL; gStatusCode = NULL;
} }
#endif
Status = gBS->LocateProtocol (&gEfiCpuIoProtocolGuid, NULL, (VOID **) &gCpuIo); Status = gBS->LocateProtocol (&gEfiCpuIoProtocolGuid, NULL, (VOID **) &gCpuIo);
if (EFI_ERROR (Status)) { if (EFI_ERROR (Status)) {
@ -399,10 +405,12 @@ Returns:
mRT = SystemTable->RuntimeServices; mRT = SystemTable->RuntimeServices;
ASSERT (mRT != NULL); ASSERT (mRT != NULL);
#if (EFI_SPECIFICATION_VERSION >= 0x00020000)
Status = gBS->LocateProtocol (&gEfiStatusCodeRuntimeProtocolGuid, NULL, (VOID **)&gStatusCode); Status = gBS->LocateProtocol (&gEfiStatusCodeRuntimeProtocolGuid, NULL, (VOID **)&gStatusCode);
if (EFI_ERROR (Status)) { if (EFI_ERROR (Status)) {
gStatusCode = NULL; gStatusCode = NULL;
} }
#endif
Status = gBS->LocateProtocol (&gEfiCpuIoProtocolGuid, NULL, (VOID **) &gCpuIo); Status = gBS->LocateProtocol (&gEfiCpuIoProtocolGuid, NULL, (VOID **) &gCpuIo);
if (EFI_ERROR (Status)) { if (EFI_ERROR (Status)) {
@ -781,35 +789,31 @@ Returns:
--*/ --*/
{ {
EFI_STATUS Status; EFI_STATUS Status;
Status = EFI_UNSUPPORTED;
if (mRT->Hdr.Revision >= 0x00020000) { #if (EFI_SPECIFICATION_VERSION >= 0x00020000)
if (gStatusCode == NULL) { if (gStatusCode == NULL) {
if (EfiAtRuntime ()) { if (EfiAtRuntime ()) {
return EFI_UNSUPPORTED; return EFI_UNSUPPORTED;
} }
Status = gBS->LocateProtocol (&gEfiStatusCodeRuntimeProtocolGuid, NULL, (VOID **)&gStatusCode); Status = gBS->LocateProtocol (&gEfiStatusCodeRuntimeProtocolGuid, NULL, (VOID **)&gStatusCode);
if (EFI_ERROR (Status) || gStatusCode == NULL) { if (EFI_ERROR (Status) || gStatusCode == NULL) {
return EFI_UNSUPPORTED; return EFI_UNSUPPORTED;
} }
} }
Status = gStatusCode->ReportStatusCode (CodeType, Value, Instance, CallerId, Data); Status = gStatusCode->ReportStatusCode (CodeType, Value, Instance, CallerId, Data);
} else { #else
if (mRT == NULL) { if (mRT == NULL) {
return EFI_UNSUPPORTED; return EFI_UNSUPPORTED;
} }
// //
// Check whether EFI_RUNTIME_SERVICES has Tiano Extension // Check whether EFI_RUNTIME_SERVICES has Tiano Extension
// //
Status = EFI_UNSUPPORTED; Status = EFI_UNSUPPORTED;
#if (EFI_SPECIFICATION_VERSION < 0x00020000) if (mRT->Hdr.Revision == EFI_SPECIFICATION_VERSION &&
if (mRT->Hdr.Revision == EFI_SPECIFICATION_VERSION && mRT->Hdr.HeaderSize == sizeof (EFI_RUNTIME_SERVICES) &&
mRT->Hdr.HeaderSize == sizeof (EFI_RUNTIME_SERVICES) && mRT->ReportStatusCode != NULL) {
mRT->ReportStatusCode != NULL) {
Status = mRT->ReportStatusCode (CodeType, Value, Instance, CallerId, Data); Status = mRT->ReportStatusCode (CodeType, Value, Instance, CallerId, Data);
}
#endif #endif
}
}
return Status; return Status;
} }