1) Sync EdkCompatibilityPkg with EDK 1.04. The changes includes:
1.1) Bug fixes. (For details, please check Documents & files: Snapshot/Release Notes at https://edk.tianocore.org/servlets/ProjectDocumentList?folderID=43&expandFolder=43&folderID=6) 1.2) Add new UEFI protocol definitions for AbsolutePointer, FormBrowser2, HiiConfigAccess, HiiConfigRouting, HiiDatabase, HiiFont, HiiImage, HiiString, SimpleTextInputEx, DPC protocol. 1.3) Add Smbios 2.5, 2.6 supports. Incompatible changes hilighted: 1) EFI_MANAGED_NETWORK_PROTOCOL_GUID changed. 2) EFI_IP4_IPCONFIG_DATA changed. 2) Add in EdkCompatibilityPkg/EdkCompatibilityPkg.dsc to build all libraries in this package. git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@4624 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
@@ -0,0 +1,138 @@
|
||||
/*++
|
||||
|
||||
Copyright (c) 2004 - 2005, 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
|
||||
http://opensource.org/licenses/bsd-license.php
|
||||
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
|
||||
Module Name:
|
||||
|
||||
MonoStatusCode.h
|
||||
|
||||
Abstract:
|
||||
|
||||
Monolithic single PEIM to provide the status code functionality.
|
||||
The PEIM is a blend of libraries that correspond to the different status code
|
||||
listeners that a platform installs.
|
||||
|
||||
--*/
|
||||
|
||||
#ifndef _MONO_STATUS_CODE_H_
|
||||
#define _MONO_STATUS_CODE_H_
|
||||
|
||||
//
|
||||
// Statements that include other files.
|
||||
//
|
||||
#include "Tiano.h"
|
||||
#include "Pei.h"
|
||||
#include "PeiLib.h"
|
||||
#include "EfiCommonLib.h"
|
||||
|
||||
//
|
||||
// Driver Produced DXE Protocol Prototypes
|
||||
//
|
||||
#include EFI_PPI_PRODUCER (StatusCode)
|
||||
|
||||
//
|
||||
// Driver Consumed DXE Protocol Prototypes
|
||||
//
|
||||
#include EFI_ARCH_PROTOCOL_CONSUMER (StatusCode)
|
||||
|
||||
//
|
||||
// Driver GUID includes
|
||||
//
|
||||
#include EFI_GUID_DEFINITION (StatusCode)
|
||||
#include EFI_GUID_DEFINITION (StatusCodeCallerId)
|
||||
#include EFI_GUID_DEFINITION (GlobalVariable)
|
||||
|
||||
extern EFI_GUID mStatusCodeRuntimeGuid;
|
||||
|
||||
//
|
||||
// Platform specific function Declarations. These must be implemented in a
|
||||
// subdirectory named PlatformName in a file named PlatformStatusCode.c.
|
||||
// See D845GRG\PlatformStatusCode.c for an example of a simple status code
|
||||
// implementation.
|
||||
// See Nt32\PlatformStatusCode.c for an example of a status code implementation
|
||||
// that relocates itself into memory.
|
||||
//
|
||||
//
|
||||
// This is the driver entry point and must be defined.
|
||||
//
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
InstallMonoStatusCode (
|
||||
IN EFI_FFS_FILE_HEADER *FfsHeader,
|
||||
IN EFI_PEI_SERVICES **PeiServices
|
||||
)
|
||||
;
|
||||
|
||||
//
|
||||
// This is the platform function to initialize the listeners desired by the
|
||||
// platform.
|
||||
//
|
||||
VOID
|
||||
PlatformInitializeStatusCode (
|
||||
IN EFI_FFS_FILE_HEADER *FfsHeader,
|
||||
IN EFI_PEI_SERVICES **PeiServices
|
||||
)
|
||||
;
|
||||
|
||||
//
|
||||
// This is the platform function that calls all of the listeners desired by the
|
||||
// platform.
|
||||
//
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
PlatformReportStatusCode (
|
||||
IN EFI_PEI_SERVICES **PeiServices,
|
||||
IN EFI_STATUS_CODE_TYPE CodeType,
|
||||
IN EFI_STATUS_CODE_VALUE Value,
|
||||
IN UINT32 Instance,
|
||||
IN EFI_GUID * CallerId,
|
||||
IN EFI_STATUS_CODE_DATA * Data OPTIONAL
|
||||
)
|
||||
;
|
||||
|
||||
//
|
||||
// Platform independent function Declarations
|
||||
//
|
||||
//
|
||||
// Initialize the status code listeners and publish the status code PPI.
|
||||
//
|
||||
VOID
|
||||
EFIAPI
|
||||
InitializeMonoStatusCode (
|
||||
IN EFI_FFS_FILE_HEADER *FfsHeader,
|
||||
IN EFI_PEI_SERVICES **PeiServices
|
||||
)
|
||||
;
|
||||
|
||||
//
|
||||
// Convert a DXE status code call into a PEI status code call.
|
||||
//
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
TranslateDxeStatusCodeToPeiStatusCode (
|
||||
IN EFI_STATUS_CODE_TYPE CodeType,
|
||||
IN EFI_STATUS_CODE_VALUE Value,
|
||||
IN UINT32 Instance,
|
||||
IN EFI_GUID * CallerId,
|
||||
IN EFI_STATUS_CODE_DATA * Data OPTIONAL
|
||||
)
|
||||
;
|
||||
|
||||
//
|
||||
// Publish a HOB that contains the listener to be used by DXE.
|
||||
//
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
InitializeDxeReportStatusCode (
|
||||
IN EFI_PEI_SERVICES **PeiServices
|
||||
)
|
||||
;
|
||||
|
||||
#endif
|
@@ -1,6 +1,6 @@
|
||||
/*++
|
||||
|
||||
Copyright (c) 2004 - 2006, Intel Corporation
|
||||
Copyright (c) 2004 - 2007, 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
|
||||
@@ -26,27 +26,29 @@ Abstract:
|
||||
#include "BsDataHubStatusCode.h"
|
||||
|
||||
//
|
||||
// Globals only work at BootService Time. NOT at Runtime!
|
||||
// Initialize FIFO to cache records.
|
||||
//
|
||||
static EFI_DATA_HUB_PROTOCOL *mDataHub;
|
||||
static EFI_LIST_ENTRY *mRecordHead;
|
||||
static EFI_LIST_ENTRY *mRecordTail;
|
||||
static INTN mRecordNum = 0;
|
||||
static EFI_EVENT mLogDataHubEvent;
|
||||
static EFI_LOCK mStatusCodeReportLock = EFI_INITIALIZE_LOCK_VARIABLE(EFI_TPL_HIGH_LEVEL);
|
||||
static BOOLEAN mEventHandlerActive = FALSE;
|
||||
STATIC EFI_LIST_ENTRY mRecordsFifo = INITIALIZE_LIST_HEAD_VARIABLE (mRecordsFifo);
|
||||
STATIC EFI_LIST_ENTRY mRecordsBuffer = INITIALIZE_LIST_HEAD_VARIABLE (mRecordsBuffer);
|
||||
STATIC EFI_EVENT mLogDataHubEvent;
|
||||
STATIC BOOLEAN mEventHandlerActive = FALSE;
|
||||
|
||||
//
|
||||
// Cache data hub protocol.
|
||||
//
|
||||
STATIC EFI_DATA_HUB_PROTOCOL *mDataHubProtocol;
|
||||
|
||||
STATUS_CODE_RECORD_LIST *
|
||||
AllocateRecordBuffer (
|
||||
STATIC
|
||||
DATA_HUB_STATUS_CODE_DATA_RECORD *
|
||||
AcquireRecordBuffer (
|
||||
VOID
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
Allocate a new record list node and initialize it.
|
||||
Inserting the node into the list isn't the task of this function.
|
||||
Return one DATAHUB_STATUSCODE_RECORD space.
|
||||
The size of free record pool would be extend, if the pool is empty.
|
||||
|
||||
Arguments:
|
||||
|
||||
@@ -58,32 +60,59 @@ Returns:
|
||||
|
||||
--*/
|
||||
{
|
||||
STATUS_CODE_RECORD_LIST *DataBuffer;
|
||||
DATAHUB_STATUSCODE_RECORD *Record;
|
||||
EFI_TPL CurrentTpl;
|
||||
EFI_LIST_ENTRY *Node;
|
||||
UINT32 Index;
|
||||
|
||||
DataBuffer = NULL;
|
||||
Record = NULL;
|
||||
CurrentTpl = gBS->RaiseTPL (EFI_TPL_HIGH_LEVEL);
|
||||
|
||||
gBS->AllocatePool (EfiBootServicesData, sizeof (STATUS_CODE_RECORD_LIST), &DataBuffer);
|
||||
if (DataBuffer == NULL) {
|
||||
return NULL;
|
||||
if (!IsListEmpty (&mRecordsBuffer)) {
|
||||
Node = GetFirstNode (&mRecordsBuffer);
|
||||
RemoveEntryList (Node);
|
||||
|
||||
Record = _CR (Node, DATAHUB_STATUSCODE_RECORD, Node);
|
||||
} else {
|
||||
if (CurrentTpl > EFI_TPL_NOTIFY) {
|
||||
gBS->RestoreTPL (CurrentTpl);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
gBS->RestoreTPL (CurrentTpl);
|
||||
|
||||
gBS->AllocatePool (EfiBootServicesData, sizeof (DATAHUB_STATUSCODE_RECORD) * 16, &Record);
|
||||
if (Record == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
EfiCommonLibZeroMem (Record, sizeof (DATAHUB_STATUSCODE_RECORD) * 16);
|
||||
|
||||
|
||||
CurrentTpl = gBS->RaiseTPL (EFI_TPL_HIGH_LEVEL);
|
||||
for (Index = 1; Index < 16; Index++) {
|
||||
InsertTailList (&mRecordsBuffer, &Record[Index].Node);
|
||||
}
|
||||
}
|
||||
|
||||
EfiCommonLibZeroMem (DataBuffer, sizeof (STATUS_CODE_RECORD_LIST));
|
||||
DataBuffer->Signature = BS_DATA_HUB_STATUS_CODE_SIGNATURE;
|
||||
Record->Signature = BS_DATA_HUB_STATUS_CODE_SIGNATURE;
|
||||
InsertTailList (&mRecordsFifo, &Record->Node);
|
||||
|
||||
return DataBuffer;
|
||||
gBS->RestoreTPL (CurrentTpl);
|
||||
|
||||
return (DATA_HUB_STATUS_CODE_DATA_RECORD *) (Record->Data);
|
||||
}
|
||||
|
||||
STATIC
|
||||
DATA_HUB_STATUS_CODE_DATA_RECORD *
|
||||
AquireEmptyRecordBuffer (
|
||||
RetrieveRecord (
|
||||
VOID
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
Acquire an empty record buffer from the record list if there's free node,
|
||||
or allocate one new node and insert it to the list if the list is full and
|
||||
the function isn't run in EFI_TPL_HIGH_LEVEL.
|
||||
Retrieve one record from Records FIFO. The record would be removed from FIFO and
|
||||
release to free record buffer.
|
||||
|
||||
Arguments:
|
||||
|
||||
@@ -91,111 +120,34 @@ Arguments:
|
||||
|
||||
Returns:
|
||||
|
||||
Pointer to new record buffer. NULL if none available.
|
||||
Point to record which is ready to be logged, or NULL if the FIFO of record is empty.
|
||||
|
||||
--*/
|
||||
--*/
|
||||
{
|
||||
EFI_TPL OldTpl;
|
||||
STATUS_CODE_RECORD_LIST *DataBuffer;
|
||||
DATA_HUB_STATUS_CODE_DATA_RECORD *RecordData;
|
||||
DATAHUB_STATUSCODE_RECORD *Record;
|
||||
EFI_LIST_ENTRY *Node;
|
||||
EFI_TPL CurrentTpl;
|
||||
|
||||
RecordData = NULL;
|
||||
|
||||
CurrentTpl = gBS->RaiseTPL (EFI_TPL_HIGH_LEVEL);
|
||||
|
||||
DataBuffer = NULL;
|
||||
if (!IsListEmpty (&mRecordsFifo)) {
|
||||
Node = GetFirstNode (&mRecordsFifo);
|
||||
Record = CR (Node, DATAHUB_STATUSCODE_RECORD, Node, BS_DATA_HUB_STATUS_CODE_SIGNATURE);
|
||||
|
||||
//
|
||||
// This function must be reentrant because an event with higher priority may interrupt it
|
||||
// and also report status code.
|
||||
//
|
||||
EfiAcquireLock (&mStatusCodeReportLock);
|
||||
if (mRecordTail != mRecordHead->ForwardLink) {
|
||||
if (mRecordNum != 0) {
|
||||
mRecordHead = mRecordHead->ForwardLink;
|
||||
}
|
||||
DataBuffer = CR (mRecordHead, STATUS_CODE_RECORD_LIST, Link, BS_DATA_HUB_STATUS_CODE_SIGNATURE);
|
||||
mRecordNum++;
|
||||
EfiReleaseLock (&mStatusCodeReportLock);
|
||||
|
||||
//
|
||||
// Initalize the record buffer is the responsibility of the producer,
|
||||
// because the consummer is in a lock so must keep it short.
|
||||
//
|
||||
EfiCommonLibZeroMem (&DataBuffer->RecordBuffer[0], BYTES_PER_BUFFER);
|
||||
} else if (mRecordNum < MAX_RECORD_NUM) {
|
||||
//
|
||||
// The condition of "mRecordNum < MAX_RECORD_NUM" is not promised,
|
||||
// because mRecodeNum may be increased out of this lock.
|
||||
//
|
||||
EfiReleaseLock (&mStatusCodeReportLock);
|
||||
|
||||
//
|
||||
// Can't allocate additional buffer in EFI_TPL_HIGH_LEVEL.
|
||||
// Reporting too many status code in EFI_TPL_HIGH_LEVEL may cause status code lost.
|
||||
//
|
||||
OldTpl = gBS->RaiseTPL (EFI_TPL_HIGH_LEVEL);
|
||||
if (OldTpl == EFI_TPL_HIGH_LEVEL) {
|
||||
return NULL;
|
||||
}
|
||||
gBS->RestoreTPL (OldTpl);
|
||||
DataBuffer = AllocateRecordBuffer ();
|
||||
if (DataBuffer == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
EfiAcquireLock (&mStatusCodeReportLock);
|
||||
InsertHeadList (mRecordHead, &DataBuffer->Link);
|
||||
mRecordHead = mRecordHead->ForwardLink;
|
||||
mRecordNum++;
|
||||
EfiReleaseLock (&mStatusCodeReportLock);
|
||||
} else {
|
||||
EfiReleaseLock (&mStatusCodeReportLock);
|
||||
return NULL;
|
||||
RemoveEntryList (&Record->Node);
|
||||
InsertTailList (&mRecordsBuffer, &Record->Node);
|
||||
Record->Signature = 0;
|
||||
RecordData = (DATA_HUB_STATUS_CODE_DATA_RECORD *) Record->Data;
|
||||
}
|
||||
|
||||
return (DATA_HUB_STATUS_CODE_DATA_RECORD *) DataBuffer->RecordBuffer;
|
||||
gBS->RestoreTPL (CurrentTpl);
|
||||
|
||||
return RecordData;
|
||||
}
|
||||
|
||||
EFI_STATUS
|
||||
ReleaseRecordBuffer (
|
||||
IN STATUS_CODE_RECORD_LIST *RecordBuffer
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
Release a buffer in the list, remove some nodes to keep the list inital length.
|
||||
|
||||
Arguments:
|
||||
|
||||
RecordBuffer - Buffer to release
|
||||
|
||||
Returns:
|
||||
|
||||
EFI_SUCCESS - If DataRecord is valid
|
||||
EFI_UNSUPPORTED - The record list has empty
|
||||
|
||||
--*/
|
||||
{
|
||||
ASSERT (RecordBuffer != NULL);
|
||||
|
||||
//
|
||||
// The consummer needn't to be reentrient and the producer won't do any meaningful thing
|
||||
// when consummer is logging records.
|
||||
//
|
||||
if (mRecordNum <= 0) {
|
||||
return EFI_UNSUPPORTED;
|
||||
} else if (mRecordNum > INITIAL_RECORD_NUM) {
|
||||
mRecordTail = mRecordTail->ForwardLink;
|
||||
RemoveEntryList (&RecordBuffer->Link);
|
||||
mRecordNum--;
|
||||
gBS->FreePool (RecordBuffer);
|
||||
} else {
|
||||
if (mRecordNum != 1) {
|
||||
mRecordTail = mRecordTail->ForwardLink;
|
||||
}
|
||||
mRecordNum--;
|
||||
}
|
||||
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
EFI_BOOTSERVICE
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
BsDataHubReportStatusCode (
|
||||
@@ -222,31 +174,32 @@ Returns:
|
||||
|
||||
--*/
|
||||
{
|
||||
DATA_HUB_STATUS_CODE_DATA_RECORD *DataHub;
|
||||
UINT32 ErrorLevel;
|
||||
VA_LIST Marker;
|
||||
CHAR8 *Format;
|
||||
UINTN Index;
|
||||
CHAR16 FormatBuffer[BYTES_PER_RECORD];
|
||||
|
||||
DataHub = NULL;
|
||||
DATA_HUB_STATUS_CODE_DATA_RECORD *Record;
|
||||
UINT32 ErrorLevel;
|
||||
VA_LIST Marker;
|
||||
CHAR8 *Format;
|
||||
CHAR16 FormatBuffer[BYTES_PER_RECORD];
|
||||
UINTN Index;
|
||||
|
||||
//
|
||||
// See whether in runtime phase or not.
|
||||
//
|
||||
if (EfiAtRuntime ()) {
|
||||
//
|
||||
// For now all we do is post code at runtime
|
||||
//
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
//
|
||||
// If we had an error while in our event handler, then do nothing so
|
||||
// that we don't get in an endless loop.
|
||||
// Discard new DataHubRecord caused by DataHub->LogData()
|
||||
//
|
||||
if (mEventHandlerActive) {
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
DataHub = (DATA_HUB_STATUS_CODE_DATA_RECORD *) AquireEmptyRecordBuffer ();
|
||||
if (DataHub == NULL) {
|
||||
Record = AcquireRecordBuffer ();
|
||||
if (Record == NULL) {
|
||||
//
|
||||
// There are no empty record buffer in private buffers
|
||||
//
|
||||
@@ -255,24 +208,15 @@ Returns:
|
||||
//
|
||||
// Construct Data Hub Extended Data
|
||||
//
|
||||
DataHub->CodeType = CodeType;
|
||||
DataHub->Value = Value;
|
||||
DataHub->Instance = Instance;
|
||||
Record->CodeType = CodeType;
|
||||
Record->Value = Value;
|
||||
Record->Instance = Instance;
|
||||
|
||||
if (CallerId != NULL) {
|
||||
EfiCopyMem (&DataHub->CallerId, CallerId, sizeof (EFI_GUID));
|
||||
} else {
|
||||
EfiZeroMem (&DataHub->CallerId, sizeof (EFI_GUID));
|
||||
EfiCopyMem (&Record->CallerId, CallerId, sizeof (EFI_GUID));
|
||||
}
|
||||
|
||||
if (Data == NULL) {
|
||||
EfiZeroMem (&DataHub->Data, sizeof (EFI_STATUS_CODE_DATA));
|
||||
} else {
|
||||
//
|
||||
// Copy generic Header
|
||||
//
|
||||
EfiCopyMem (&DataHub->Data, Data, sizeof (EFI_STATUS_CODE_DATA));
|
||||
|
||||
if (Data != NULL) {
|
||||
if (ReportStatusCodeExtractDebugInfo (Data, &ErrorLevel, &Marker, &Format)) {
|
||||
//
|
||||
// Convert Ascii Format string to Unicode.
|
||||
@@ -287,26 +231,25 @@ Returns:
|
||||
// Put processed string into the buffer
|
||||
//
|
||||
Index = VSPrint (
|
||||
(UINT16 *) (DataHub + 1),
|
||||
(CHAR16 *) (Record + 1),
|
||||
BYTES_PER_RECORD - (sizeof (DATA_HUB_STATUS_CODE_DATA_RECORD)),
|
||||
FormatBuffer,
|
||||
Marker
|
||||
);
|
||||
|
||||
//
|
||||
// DATA_HUB_STATUS_CODE_DATA_RECORD followed by VSPrint String Buffer
|
||||
//
|
||||
DataHub->Data.Size = (UINT16) (Index * sizeof (CHAR16));
|
||||
|
||||
|
||||
EfiCopyMem (&Record->Data.Type, &gEfiStatusCodeDataTypeDebugGuid, sizeof (EFI_GUID));
|
||||
Record->Data.HeaderSize = Data->HeaderSize;
|
||||
Record->Data.Size = (UINT16) (Index * sizeof (CHAR16));
|
||||
} else {
|
||||
//
|
||||
// Default behavior is to copy optional data
|
||||
// Copy status code data header
|
||||
//
|
||||
if (Data->Size > (BYTES_PER_RECORD - sizeof (DATA_HUB_STATUS_CODE_DATA_RECORD))) {
|
||||
DataHub->Data.Size = (UINT16) (BYTES_PER_RECORD - sizeof (DATA_HUB_STATUS_CODE_DATA_RECORD));
|
||||
}
|
||||
EfiCopyMem (&Record->Data, Data, sizeof (EFI_STATUS_CODE_DATA));
|
||||
|
||||
EfiCopyMem (DataHub + 1, Data + 1, DataHub->Data.Size);
|
||||
if (Data->Size > BYTES_PER_RECORD - sizeof (DATA_HUB_STATUS_CODE_DATA_RECORD)) {
|
||||
Record->Data.Size = (UINT16) (BYTES_PER_RECORD - sizeof (DATA_HUB_STATUS_CODE_DATA_RECORD));
|
||||
}
|
||||
EfiCopyMem ((VOID *) (Record + 1), Data + 1, Record->Data.Size);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -339,39 +282,34 @@ Returns:
|
||||
|
||||
--*/
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
DATA_HUB_STATUS_CODE_DATA_RECORD *DataRecord;
|
||||
UINTN Size;
|
||||
DATA_HUB_STATUS_CODE_DATA_RECORD *Record;
|
||||
UINT32 Size;
|
||||
UINT64 DataRecordClass;
|
||||
EFI_LIST_ENTRY *Link;
|
||||
STATUS_CODE_RECORD_LIST *BufferEntry;
|
||||
|
||||
//
|
||||
// Set our global flag so we don't recurse if we get an error here.
|
||||
// Set global flag so we don't recurse if DataHub->LogData eventually causes new DataHubRecord
|
||||
//
|
||||
mEventHandlerActive = TRUE;
|
||||
|
||||
//
|
||||
// Log DataRecord in Data Hub.
|
||||
// If there are multiple DataRecords, Log all of them.
|
||||
// Journal records fifo to find all record entry.
|
||||
//
|
||||
Link = mRecordTail;
|
||||
|
||||
while (mRecordNum != 0) {
|
||||
BufferEntry = CR (Link, STATUS_CODE_RECORD_LIST, Link, BS_DATA_HUB_STATUS_CODE_SIGNATURE);
|
||||
DataRecord = (DATA_HUB_STATUS_CODE_DATA_RECORD *) (BufferEntry->RecordBuffer);
|
||||
Link = Link->ForwardLink;
|
||||
|
||||
while (1) {
|
||||
Record = RetrieveRecord ();
|
||||
if (Record == NULL) {
|
||||
break;
|
||||
}
|
||||
//
|
||||
// Add in the size of the header we added.
|
||||
//
|
||||
Size = sizeof (DATA_HUB_STATUS_CODE_DATA_RECORD) + DataRecord->Data.Size;
|
||||
Size = sizeof (DATA_HUB_STATUS_CODE_DATA_RECORD) + (UINT32) Record->Data.Size;
|
||||
|
||||
if ((DataRecord->CodeType & EFI_STATUS_CODE_TYPE_MASK) == EFI_PROGRESS_CODE) {
|
||||
if ((Record->CodeType & EFI_STATUS_CODE_TYPE_MASK) == EFI_PROGRESS_CODE) {
|
||||
DataRecordClass = EFI_DATA_RECORD_CLASS_PROGRESS_CODE;
|
||||
} else if ((DataRecord->CodeType & EFI_STATUS_CODE_TYPE_MASK) == EFI_ERROR_CODE) {
|
||||
} else if ((Record->CodeType & EFI_STATUS_CODE_TYPE_MASK) == EFI_ERROR_CODE) {
|
||||
DataRecordClass = EFI_DATA_RECORD_CLASS_ERROR;
|
||||
} else if ((DataRecord->CodeType & EFI_STATUS_CODE_TYPE_MASK) == EFI_DEBUG_CODE) {
|
||||
} else if ((Record->CodeType & EFI_STATUS_CODE_TYPE_MASK) == EFI_DEBUG_CODE) {
|
||||
DataRecordClass = EFI_DATA_RECORD_CLASS_DEBUG;
|
||||
} else {
|
||||
//
|
||||
@@ -383,45 +321,27 @@ Returns:
|
||||
EFI_DATA_RECORD_CLASS_PROGRESS_CODE;
|
||||
}
|
||||
|
||||
if (((DataRecord->Instance & EFI_D_ERROR) != 0) &&
|
||||
(((DataRecord->Instance & EFI_D_POOL) != 0) || ((DataRecord->Instance & EFI_D_PAGE) != 0))
|
||||
) {
|
||||
//
|
||||
// If memory error, do not call LogData ().
|
||||
//
|
||||
ErrorPrint (L"ERROR", "Memory Error\n");
|
||||
Status = EFI_OUT_OF_RESOURCES;
|
||||
} else {
|
||||
//
|
||||
// We don't log EFI_D_POOL and EFI_D_PAGE debug info to datahub
|
||||
// to avoid recursive logging due to the memory allocation in datahub
|
||||
//
|
||||
if (DataRecordClass != EFI_DATA_RECORD_CLASS_DEBUG ||
|
||||
((DataRecord->Instance & EFI_D_POOL) == 0 && (DataRecord->Instance & EFI_D_PAGE) == 0)) {
|
||||
//
|
||||
// Log DataRecord in Data Hub
|
||||
//
|
||||
Status = mDataHub->LogData (
|
||||
mDataHub,
|
||||
&gEfiStatusCodeGuid,
|
||||
&gEfiStatusCodeRuntimeProtocolGuid,
|
||||
DataRecordClass,
|
||||
DataRecord,
|
||||
(UINT32) Size
|
||||
);
|
||||
}
|
||||
}
|
||||
//
|
||||
// Log DataRecord in Data Hub
|
||||
//
|
||||
|
||||
mDataHubProtocol->LogData (
|
||||
mDataHubProtocol,
|
||||
&gEfiStatusCodeGuid,
|
||||
&gEfiStatusCodeRuntimeProtocolGuid,
|
||||
DataRecordClass,
|
||||
Record,
|
||||
Size
|
||||
);
|
||||
|
||||
ReleaseRecordBuffer (BufferEntry);
|
||||
}
|
||||
|
||||
mEventHandlerActive = FALSE;
|
||||
|
||||
return ;
|
||||
}
|
||||
|
||||
EFI_BOOTSERVICE
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
BsDataHubInitializeStatusCode (
|
||||
IN EFI_HANDLE ImageHandle,
|
||||
IN EFI_SYSTEM_TABLE *SystemTable
|
||||
@@ -444,38 +364,14 @@ Returns:
|
||||
--*/
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
STATUS_CODE_RECORD_LIST *DataBuffer;
|
||||
UINTN Index1;
|
||||
|
||||
DataBuffer = NULL;
|
||||
|
||||
Status = gBS->LocateProtocol (&gEfiDataHubProtocolGuid, NULL, &mDataHub);
|
||||
//
|
||||
// Should never fail due to dependency grammer
|
||||
//
|
||||
Status = gBS->LocateProtocol (
|
||||
&gEfiDataHubProtocolGuid,
|
||||
NULL,
|
||||
(VOID **) &mDataHubProtocol
|
||||
);
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
|
||||
//
|
||||
// Initialize a record list with length not greater than INITIAL_RECORD_NUM.
|
||||
// If no buffer can be allocated, return EFI_OUT_OF_RESOURCES.
|
||||
//
|
||||
DataBuffer = AllocateRecordBuffer ();
|
||||
if (DataBuffer == NULL) {
|
||||
return EFI_OUT_OF_RESOURCES;
|
||||
}
|
||||
mRecordHead = &DataBuffer->Link;
|
||||
mRecordTail = mRecordHead;
|
||||
InitializeListHead (mRecordHead);
|
||||
|
||||
for (Index1 = 1; Index1 < INITIAL_RECORD_NUM; Index1++) {
|
||||
DataBuffer = AllocateRecordBuffer ();
|
||||
if (DataBuffer == NULL) {
|
||||
break;
|
||||
}
|
||||
InsertHeadList (mRecordHead, &DataBuffer->Link);
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// Create a Notify Event to log data in Data Hub
|
||||
//
|
||||
@@ -487,5 +383,9 @@ Returns:
|
||||
&mLogDataHubEvent
|
||||
);
|
||||
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
|
@@ -1,6 +1,6 @@
|
||||
/*++
|
||||
|
||||
Copyright (c) 2004 - 2006, Intel Corporation
|
||||
Copyright (c) 2004 - 2007, 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
|
||||
@@ -52,7 +52,6 @@ Abstract:
|
||||
// Private data declarations
|
||||
//
|
||||
#define MAX_RECORD_NUM 1000
|
||||
#define INITIAL_RECORD_NUM 20
|
||||
#define BYTES_PER_RECORD EFI_STATUS_CODE_DATA_MAX_SIZE
|
||||
#define BYTES_PER_BUFFER (BYTES_PER_RECORD * sizeof (UINT8))
|
||||
|
||||
@@ -60,77 +59,63 @@ Abstract:
|
||||
|
||||
typedef struct {
|
||||
UINTN Signature;
|
||||
EFI_LIST_ENTRY Link;
|
||||
UINT8 RecordBuffer[BYTES_PER_RECORD];
|
||||
} STATUS_CODE_RECORD_LIST;
|
||||
EFI_LIST_ENTRY Node;
|
||||
UINT8 Data[BYTES_PER_RECORD];
|
||||
} DATAHUB_STATUSCODE_RECORD;
|
||||
|
||||
//
|
||||
// Function prototypes
|
||||
//
|
||||
STATUS_CODE_RECORD_LIST *
|
||||
AllocateRecordBuffer (
|
||||
VOID
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
BsDataHubInitializeStatusCode (
|
||||
IN EFI_HANDLE ImageHandle,
|
||||
IN EFI_SYSTEM_TABLE *SystemTable
|
||||
);
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
Allocate a new record list node and initialize it.
|
||||
Inserting the node into the list isn't the task of this function.
|
||||
Install a data hub listener.
|
||||
|
||||
Arguments:
|
||||
|
||||
None
|
||||
(Standard EFI Image entry - EFI_IMAGE_ENTRY_POINT)
|
||||
|
||||
Returns:
|
||||
|
||||
A pointer to the new allocated node or NULL if non available
|
||||
|
||||
--*/
|
||||
|
||||
DATA_HUB_STATUS_CODE_DATA_RECORD *
|
||||
AquireEmptyRecordBuffer (
|
||||
VOID
|
||||
);
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
Acquire an empty record buffer from the record list if there's free node,
|
||||
or allocate one new node and insert it to the list if the list is full and
|
||||
the function isn't run in EFI_TPL_HIGH_LEVEL.
|
||||
|
||||
Arguments:
|
||||
|
||||
None
|
||||
|
||||
Returns:
|
||||
|
||||
Pointer to new record buffer. NULL if none available.
|
||||
EFI_SUCCESS - Logging Hub protocol installed
|
||||
Other - No protocol installed, unload driver.
|
||||
|
||||
--*/
|
||||
|
||||
EFI_STATUS
|
||||
ReleaseRecordBuffer (
|
||||
IN STATUS_CODE_RECORD_LIST *RecordBuffer
|
||||
EFIAPI
|
||||
BsDataHubReportStatusCode (
|
||||
IN EFI_STATUS_CODE_TYPE CodeType,
|
||||
IN EFI_STATUS_CODE_VALUE Value,
|
||||
IN UINT32 Instance,
|
||||
IN EFI_GUID * CallerId,
|
||||
IN EFI_STATUS_CODE_DATA * Data OPTIONAL
|
||||
);
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
Release a buffer in the list, remove some nodes to keep the list inital length.
|
||||
Boot service report status code listener. This function logs the status code
|
||||
into the data hub.
|
||||
|
||||
Arguments:
|
||||
|
||||
RecordBuffer - Buffer to release
|
||||
Same as gRT->ReportStatusCode (See Tiano Runtime Specification)
|
||||
|
||||
Returns:
|
||||
|
||||
EFI_SUCCESS - If DataRecord is valid
|
||||
EFI_UNSUPPORTED - The record list has empty
|
||||
None
|
||||
|
||||
--*/
|
||||
|
||||
void
|
||||
VOID
|
||||
EFIAPI
|
||||
LogDataHubEventHandler (
|
||||
IN EFI_EVENT Event,
|
||||
|
@@ -1,6 +1,6 @@
|
||||
/*++
|
||||
|
||||
Copyright (c) 2004 - 2005, Intel Corporation
|
||||
Copyright (c) 2004 - 2007, 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
|
||||
@@ -2095,6 +2095,7 @@ Returns:
|
||||
#endif
|
||||
|
||||
VOID
|
||||
EFIAPI
|
||||
BsSerialInitializeStatusCode (
|
||||
IN EFI_HANDLE ImageHandle,
|
||||
IN EFI_SYSTEM_TABLE *SystemTable
|
||||
@@ -2189,6 +2190,9 @@ Returns:
|
||||
} while ((Data & LSR_TXRDY) == 0);
|
||||
|
||||
IoWrite8 (gComBase, Character);
|
||||
#ifdef SERIAL_OUTPUT_STALL
|
||||
EfiStall (SERIAL_OUTPUT_STALL);
|
||||
#endif
|
||||
}
|
||||
|
||||
VOID
|
||||
|
@@ -1,6 +1,6 @@
|
||||
/*++
|
||||
|
||||
Copyright (c) 2004 - 2005, Intel Corporation
|
||||
Copyright (c) 2004 - 2007, 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
|
||||
@@ -31,6 +31,7 @@ Abstract:
|
||||
// Initialization function
|
||||
//
|
||||
VOID
|
||||
EFIAPI
|
||||
BsDataHubInitializeStatusCode (
|
||||
IN EFI_HANDLE ImageHandle,
|
||||
IN EFI_SYSTEM_TABLE *SystemTable
|
||||
@@ -41,6 +42,7 @@ BsDataHubInitializeStatusCode (
|
||||
// Status code reporting function
|
||||
//
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
BsDataHubReportStatusCode (
|
||||
IN EFI_STATUS_CODE_TYPE CodeType,
|
||||
IN EFI_STATUS_CODE_VALUE Value,
|
||||
|
@@ -1,6 +1,6 @@
|
||||
/*++
|
||||
|
||||
Copyright (c) 2004 - 2005, Intel Corporation
|
||||
Copyright (c) 2004 - 2007, 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
|
||||
@@ -31,6 +31,7 @@ Abstract:
|
||||
// Initialization function
|
||||
//
|
||||
VOID
|
||||
EFIAPI
|
||||
BsSerialInitializeStatusCode (
|
||||
IN EFI_HANDLE ImageHandle,
|
||||
IN EFI_SYSTEM_TABLE *SystemTable
|
||||
@@ -41,6 +42,7 @@ BsSerialInitializeStatusCode (
|
||||
// Status code reporting function
|
||||
//
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
BsSerialReportStatusCode (
|
||||
IN EFI_STATUS_CODE_TYPE CodeType,
|
||||
IN EFI_STATUS_CODE_VALUE Value,
|
||||
|
@@ -1,6 +1,6 @@
|
||||
/*++
|
||||
|
||||
Copyright (c) 2004 - 2005, Intel Corporation
|
||||
Copyright (c) 2004 - 2007, 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
|
||||
@@ -31,6 +31,7 @@ Abstract:
|
||||
// Initialization function
|
||||
//
|
||||
VOID
|
||||
EFIAPI
|
||||
RtMemoryInitializeStatusCode (
|
||||
IN EFI_HANDLE ImageHandle,
|
||||
IN EFI_SYSTEM_TABLE *SystemTable
|
||||
@@ -41,6 +42,7 @@ RtMemoryInitializeStatusCode (
|
||||
// Status code reporting function
|
||||
//
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
RtMemoryReportStatusCode (
|
||||
IN EFI_STATUS_CODE_TYPE CodeType,
|
||||
IN EFI_STATUS_CODE_VALUE Value,
|
||||
@@ -55,7 +57,7 @@ RtMemoryReportStatusCode (
|
||||
//
|
||||
typedef
|
||||
EFI_STATUS
|
||||
(*PLATFORM_REPORT_STATUS_CODE) (
|
||||
(EFIAPI *PLATFORM_REPORT_STATUS_CODE) (
|
||||
IN EFI_STATUS_CODE_TYPE Type,
|
||||
IN EFI_STATUS_CODE_VALUE Value,
|
||||
IN UINT32 Instance,
|
||||
@@ -64,6 +66,7 @@ EFI_STATUS
|
||||
);
|
||||
|
||||
VOID
|
||||
EFIAPI
|
||||
PlaybackStatusCodes (
|
||||
IN PLATFORM_REPORT_STATUS_CODE ReportStatusCode
|
||||
)
|
||||
|
@@ -1,6 +1,6 @@
|
||||
/*++
|
||||
|
||||
Copyright (c) 2004 - 2005, Intel Corporation
|
||||
Copyright (c) 2004 - 2007, 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
|
||||
@@ -32,6 +32,7 @@ Abstract:
|
||||
// Initialization function
|
||||
//
|
||||
VOID
|
||||
EFIAPI
|
||||
RtPlatformInitializeStatusCode (
|
||||
IN EFI_HANDLE ImageHandle,
|
||||
IN EFI_SYSTEM_TABLE *SystemTable
|
||||
@@ -42,6 +43,7 @@ RtPlatformInitializeStatusCode (
|
||||
// Status code reporting function
|
||||
//
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
RtPlatformReportStatusCode (
|
||||
IN EFI_STATUS_CODE_TYPE CodeType,
|
||||
IN EFI_STATUS_CODE_VALUE Value,
|
||||
|
@@ -1,6 +1,6 @@
|
||||
/*++
|
||||
|
||||
Copyright (c) 2004 - 2005, Intel Corporation
|
||||
Copyright (c) 2004 - 2007, 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
|
||||
@@ -31,6 +31,7 @@ Abstract:
|
||||
// Status code reporting function
|
||||
//
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
RtPort80ReportStatusCode (
|
||||
IN EFI_STATUS_CODE_TYPE CodeType,
|
||||
IN EFI_STATUS_CODE_VALUE Value,
|
||||
|
Reference in New Issue
Block a user