Sync all bug fixes between EDK1.04 and EDK1.06 into EdkCompatibilityPkg.

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@11094 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
lgao4
2010-11-26 01:54:49 +00:00
parent 68bb5ce77e
commit 3e99020dbf
183 changed files with 15250 additions and 2636 deletions

View File

@ -1,6 +1,6 @@
/*++
Copyright (c) 2004 - 2006, Intel Corporation. All rights reserved.<BR>
Copyright (c) 2004 - 2010, Intel Corporation. All rights reserved.<BR>
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
@ -19,12 +19,85 @@ Abstract:
#include "Tiano.h"
#include "EfiDriverLib.h"
#include "PeiHob.h"
#include EFI_PROTOCOL_DEFINITION (DevicePath)
#include EFI_GUID_DEFINITION (Hob)
#include EFI_GUID_DEFINITION (StatusCodeDataTypeId)
#include EFI_ARCH_PROTOCOL_DEFINITION (StatusCode)
#if (EFI_SPECIFICATION_VERSION >= 0x00020000)
STATIC EFI_STATUS_CODE_PROTOCOL *gStatusCode = NULL;
EFI_REPORT_STATUS_CODE gReportStatusCode = NULL;
VOID
EFIAPI
OnStatusCodeInstall (
IN EFI_EVENT Event,
IN VOID *Context
)
{
EFI_STATUS Status;
EFI_STATUS_CODE_PROTOCOL *StatusCode;
Status = gBS->LocateProtocol (&gEfiStatusCodeRuntimeProtocolGuid, NULL, (VOID **) &StatusCode);
if (!EFI_ERROR (Status)) {
gReportStatusCode = StatusCode->ReportStatusCode;
}
}
EFI_STATUS
GetPeiProtocol (
IN EFI_GUID *ProtocolGuid,
IN VOID **Interface
)
/*++
Routine Description:
Searches for a Protocol Interface passed from PEI through a HOB
Arguments:
ProtocolGuid - The Protocol GUID to search for in the HOB List
Interface - A pointer to the interface for the Protocol GUID
Returns:
EFI_SUCCESS - The Protocol GUID was found and its interface is returned in Interface
EFI_NOT_FOUND - The Protocol GUID was not found in the HOB List
--*/
{
EFI_STATUS Status;
EFI_PEI_HOB_POINTERS GuidHob;
//
// Get Hob list
//
Status = EfiLibGetSystemConfigurationTable (&gEfiHobListGuid, (VOID **) &GuidHob.Raw);
if (EFI_ERROR (Status)) {
return Status;
}
for (Status = EFI_NOT_FOUND; EFI_ERROR (Status);) {
if (END_OF_HOB_LIST (GuidHob)) {
Status = EFI_NOT_FOUND;
break;
}
if (GET_HOB_TYPE (GuidHob) == EFI_HOB_TYPE_GUID_EXTENSION) {
if (EfiCompareGuid (ProtocolGuid, &GuidHob.Guid->Name)) {
Status = EFI_SUCCESS;
*Interface = (VOID *) *(UINTN *) ((UINT8 *) (&GuidHob.Guid->Name) + sizeof (EFI_GUID));
}
}
GuidHob.Raw = GET_NEXT_HOB (GuidHob);
}
return Status;
}
#endif
EFI_STATUS
@ -59,18 +132,28 @@ Returns:
{
EFI_STATUS Status;
#if (EFI_SPECIFICATION_VERSION >= 0x00020000)
if (gStatusCode == NULL) {
#if (EFI_SPECIFICATION_VERSION >= 0x00020000)
if (gReportStatusCode == NULL) {
//
// Because we've installed the protocol notification on EfiStatusCodeRuntimeProtocol,
// running here indicates that the StatusCode driver has not started yet.
//
if (gBS == NULL) {
//
// Running here only when StatusCode driver never starts.
//
return EFI_UNSUPPORTED;
}
Status = gBS->LocateProtocol (&gEfiStatusCodeRuntimeProtocolGuid, NULL, (VOID **)&gStatusCode);
if (EFI_ERROR (Status) || gStatusCode == NULL) {
//
// Try to get the PEI version of ReportStatusCode.
//
Status = GetPeiProtocol (&gEfiStatusCodeRuntimeProtocolGuid, (VOID **) &gReportStatusCode);
if (EFI_ERROR (Status)) {
return EFI_UNSUPPORTED;
}
}
Status = gStatusCode->ReportStatusCode (Type, Value, Instance, CallerId, Data);
return Status;
Status = gReportStatusCode (Type, Value, Instance, CallerId, Data);
#else
if (gRT == NULL) {
return EFI_UNSUPPORTED;
@ -84,8 +167,8 @@ Returns:
gRT->ReportStatusCode != NULL) {
Status = gRT->ReportStatusCode (Type, Value, Instance, CallerId, Data);
}
return Status;
#endif
return Status;
}
EFI_STATUS