mirror of https://github.com/acidanthera/audk.git
Do not call LocateProtocol when the current TPL is above or equal TPL_NOTIFY.
Signed-off-by: niruiyu Reviewed-by: mdkinney git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@12696 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
parent
801401877e
commit
f0d711eb1b
|
@ -1,7 +1,7 @@
|
||||||
/** @file
|
/** @file
|
||||||
Report Status Code Library for DXE Phase.
|
Report Status Code Library for DXE Phase.
|
||||||
|
|
||||||
Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>
|
Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.<BR>
|
||||||
This program and the accompanying materials
|
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
|
||||||
|
@ -45,6 +45,7 @@ InternalGetReportStatusCode (
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
EFI_STATUS Status;
|
EFI_STATUS Status;
|
||||||
|
EFI_TPL Tpl;
|
||||||
|
|
||||||
if (mReportStatusCodeLibStatusCodeProtocol != NULL) {
|
if (mReportStatusCodeLibStatusCodeProtocol != NULL) {
|
||||||
return;
|
return;
|
||||||
|
@ -53,10 +54,18 @@ InternalGetReportStatusCode (
|
||||||
//
|
//
|
||||||
// Check gBS just in case ReportStatusCode is called before gBS is initialized.
|
// Check gBS just in case ReportStatusCode is called before gBS is initialized.
|
||||||
//
|
//
|
||||||
if (gBS != NULL && gBS->LocateProtocol != NULL) {
|
if ((gBS != NULL) && (gBS->LocateProtocol != NULL) && (gBS->RaiseTPL != NULL) && (gBS->RestoreTPL != NULL)) {
|
||||||
Status = gBS->LocateProtocol (&gEfiStatusCodeRuntimeProtocolGuid, NULL, (VOID**) &mReportStatusCodeLibStatusCodeProtocol);
|
//
|
||||||
if (EFI_ERROR (Status)) {
|
// Retrieve the current TPL
|
||||||
mReportStatusCodeLibStatusCodeProtocol = NULL;
|
//
|
||||||
|
Tpl = gBS->RaiseTPL (TPL_HIGH_LEVEL);
|
||||||
|
gBS->RestoreTPL (Tpl);
|
||||||
|
|
||||||
|
if (Tpl < TPL_NOTIFY) {
|
||||||
|
Status = gBS->LocateProtocol (&gEfiStatusCodeRuntimeProtocolGuid, NULL, (VOID**) &mReportStatusCodeLibStatusCodeProtocol);
|
||||||
|
if (EFI_ERROR (Status)) {
|
||||||
|
mReportStatusCodeLibStatusCodeProtocol = NULL;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -496,7 +505,10 @@ ReportStatusCodeEx (
|
||||||
ASSERT (!((ExtendedData == NULL) && (ExtendedDataSize != 0)));
|
ASSERT (!((ExtendedData == NULL) && (ExtendedDataSize != 0)));
|
||||||
ASSERT (!((ExtendedData != NULL) && (ExtendedDataSize == 0)));
|
ASSERT (!((ExtendedData != NULL) && (ExtendedDataSize == 0)));
|
||||||
|
|
||||||
if (gBS == NULL || gBS->AllocatePool == NULL || gBS->FreePool == NULL) {
|
if ((gBS == NULL) ||
|
||||||
|
(gBS->AllocatePool == NULL) || (gBS->FreePool == NULL) ||
|
||||||
|
(gBS->RaiseTPL == NULL) || (gBS->RestoreTPL == NULL)
|
||||||
|
) {
|
||||||
return EFI_UNSUPPORTED;
|
return EFI_UNSUPPORTED;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue