Code Scrub for Status Code Runtime Dxe driver.
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@8178 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
@ -1,7 +1,7 @@
|
|||||||
/** @file
|
/** @file
|
||||||
Data Hub status code worker in DXE.
|
Data Hub status code worker.
|
||||||
|
|
||||||
Copyright (c) 2006, Intel Corporation
|
Copyright (c) 2006 - 2009, 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
|
||||||
@ -28,12 +28,14 @@ EFI_DATA_HUB_PROTOCOL *mDataHubProtocol;
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Return one DATAHUB_STATUSCODE_RECORD space.
|
Retrieve one record of from free record buffer. This record is removed from
|
||||||
The size of free record pool would be extend, if the pool is empty.
|
free record buffer.
|
||||||
|
|
||||||
|
This function retrieves one record from free record buffer.
|
||||||
|
If the pool has been exhausted, then new memory would be allocated for it.
|
||||||
|
|
||||||
@retval NULL Can not allocate free memeory for record.
|
@return Pointer to the free record.
|
||||||
@retval !NULL Point to buffer of record.
|
NULL means failure to allocate new memeory for free record buffer.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
DATA_HUB_STATUS_CODE_DATA_RECORD *
|
DATA_HUB_STATUS_CODE_DATA_RECORD *
|
||||||
@ -49,6 +51,9 @@ AcquireRecordBuffer (
|
|||||||
CurrentTpl = gBS->RaiseTPL (TPL_HIGH_LEVEL);
|
CurrentTpl = gBS->RaiseTPL (TPL_HIGH_LEVEL);
|
||||||
|
|
||||||
if (!IsListEmpty (&mRecordsBuffer)) {
|
if (!IsListEmpty (&mRecordsBuffer)) {
|
||||||
|
//
|
||||||
|
// Strip one entry from free record buffer.
|
||||||
|
//
|
||||||
Node = GetFirstNode (&mRecordsBuffer);
|
Node = GetFirstNode (&mRecordsBuffer);
|
||||||
RemoveEntryList (Node);
|
RemoveEntryList (Node);
|
||||||
|
|
||||||
@ -62,13 +67,20 @@ AcquireRecordBuffer (
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// If free record buffer is exhausted, then allocate 16 new records for it.
|
||||||
|
//
|
||||||
gBS->RestoreTPL (CurrentTpl);
|
gBS->RestoreTPL (CurrentTpl);
|
||||||
Record = (DATAHUB_STATUSCODE_RECORD *) AllocateZeroPool (sizeof (DATAHUB_STATUSCODE_RECORD) * 16);
|
Record = (DATAHUB_STATUSCODE_RECORD *) AllocateZeroPool (sizeof (DATAHUB_STATUSCODE_RECORD) * 16);
|
||||||
if (NULL == Record) {
|
if (Record == NULL) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
CurrentTpl = gBS->RaiseTPL (TPL_HIGH_LEVEL);
|
CurrentTpl = gBS->RaiseTPL (TPL_HIGH_LEVEL);
|
||||||
|
//
|
||||||
|
// Here we only insert 15 new records to the free record buffer, for the first record
|
||||||
|
// will be returned immediately.
|
||||||
|
//
|
||||||
for (Index = 1; Index < 16; Index++) {
|
for (Index = 1; Index < 16; Index++) {
|
||||||
InsertTailList (&mRecordsBuffer, &Record[Index].Node);
|
InsertTailList (&mRecordsBuffer, &Record[Index].Node);
|
||||||
}
|
}
|
||||||
@ -84,11 +96,10 @@ AcquireRecordBuffer (
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Retrieve one record from Records FIFO. The record would be removed from FIFO and
|
Retrieve one record from Records FIFO. The record would be removed from FIFO.
|
||||||
release to free record buffer.
|
|
||||||
|
|
||||||
@return !NULL Point to record, which is ready to be logged.
|
@return Point to record, which is ready to be logged.
|
||||||
@return NULL the FIFO of record is empty.
|
NULL means the FIFO of record is empty.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
DATA_HUB_STATUS_CODE_DATA_RECORD *
|
DATA_HUB_STATUS_CODE_DATA_RECORD *
|
||||||
@ -96,17 +107,19 @@ RetrieveRecord (
|
|||||||
VOID
|
VOID
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
DATA_HUB_STATUS_CODE_DATA_RECORD *RecordData = NULL;
|
DATA_HUB_STATUS_CODE_DATA_RECORD *RecordData;
|
||||||
DATAHUB_STATUSCODE_RECORD *Record;
|
DATAHUB_STATUSCODE_RECORD *Record;
|
||||||
LIST_ENTRY *Node;
|
LIST_ENTRY *Node;
|
||||||
EFI_TPL CurrentTpl;
|
EFI_TPL CurrentTpl;
|
||||||
|
|
||||||
|
RecordData = NULL;
|
||||||
|
|
||||||
CurrentTpl = gBS->RaiseTPL (TPL_HIGH_LEVEL);
|
CurrentTpl = gBS->RaiseTPL (TPL_HIGH_LEVEL);
|
||||||
|
|
||||||
if (!IsListEmpty (&mRecordsFifo)) {
|
if (!IsListEmpty (&mRecordsFifo)) {
|
||||||
Node = GetFirstNode (&mRecordsFifo);
|
Node = GetFirstNode (&mRecordsFifo);
|
||||||
Record = CR (Node, DATAHUB_STATUSCODE_RECORD, Node, DATAHUB_STATUS_CODE_SIGNATURE);
|
Record = CR (Node, DATAHUB_STATUSCODE_RECORD, Node, DATAHUB_STATUS_CODE_SIGNATURE);
|
||||||
ASSERT (NULL != Record);
|
ASSERT (Record != NULL);
|
||||||
|
|
||||||
RemoveEntryList (&Record->Node);
|
RemoveEntryList (&Record->Node);
|
||||||
RecordData = (DATA_HUB_STATUS_CODE_DATA_RECORD *) Record->Data;
|
RecordData = (DATA_HUB_STATUS_CODE_DATA_RECORD *) Record->Data;
|
||||||
@ -118,10 +131,9 @@ RetrieveRecord (
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Release Records to FIFO.
|
Release given record and return it to free record buffer.
|
||||||
|
|
||||||
@param RecordData Point to the record buffer allocated
|
@param RecordData Pointer to the record to release.
|
||||||
from AcquireRecordBuffer.
|
|
||||||
|
|
||||||
**/
|
**/
|
||||||
VOID
|
VOID
|
||||||
@ -133,7 +145,7 @@ ReleaseRecord (
|
|||||||
EFI_TPL CurrentTpl;
|
EFI_TPL CurrentTpl;
|
||||||
|
|
||||||
Record = CR (RecordData, DATAHUB_STATUSCODE_RECORD, Data[0], DATAHUB_STATUS_CODE_SIGNATURE);
|
Record = CR (RecordData, DATAHUB_STATUSCODE_RECORD, Data[0], DATAHUB_STATUS_CODE_SIGNATURE);
|
||||||
ASSERT (NULL != Record);
|
ASSERT (Record != NULL);
|
||||||
|
|
||||||
CurrentTpl = gBS->RaiseTPL (TPL_HIGH_LEVEL);
|
CurrentTpl = gBS->RaiseTPL (TPL_HIGH_LEVEL);
|
||||||
|
|
||||||
@ -143,36 +155,24 @@ ReleaseRecord (
|
|||||||
gBS->RestoreTPL (CurrentTpl);
|
gBS->RestoreTPL (CurrentTpl);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Report status code into DataHub.
|
Report status code into DataHub.
|
||||||
|
|
||||||
@param CodeType Indicates the type of status code being reported. Type EFI_STATUS_CODE_TYPE is defined in "Related Definitions" below.
|
@param CodeType Indicates the type of status code being reported.
|
||||||
|
@param Value Describes the current status of a hardware or software entity.
|
||||||
|
This included information about the class and subclass that is used to
|
||||||
|
classify the entity as well as an operation.
|
||||||
|
@param Instance The enumeration of a hardware or software entity within
|
||||||
|
the system. Valid instance numbers start with 1.
|
||||||
|
@param CallerId This optional parameter may be used to identify the caller.
|
||||||
|
This parameter allows the status code driver to apply different rules to
|
||||||
|
different callers.
|
||||||
|
@param Data This optional parameter may be used to pass additional data.
|
||||||
|
|
||||||
@param Value Describes the current status of a hardware or software entity.
|
@retval EFI_SUCCESS The function completed successfully.
|
||||||
This included information about the class and subclass that is used to classify the entity
|
@retval EFI_DEVICE_ERROR Function is reentered.
|
||||||
as well as an operation. For progress codes, the operation is the current activity.
|
@retval EFI_DEVICE_ERROR Function is called at runtime.
|
||||||
For error codes, it is the exception. For debug codes, it is not defined at this time.
|
@retval EFI_OUT_OF_RESOURCES Fail to allocate memory for free record buffer.
|
||||||
Type EFI_STATUS_CODE_VALUE is defined in "Related Definitions" below.
|
|
||||||
Specific values are discussed in the Intel? Platform Innovation Framework for EFI Status Code Specification.
|
|
||||||
|
|
||||||
@param Instance The enumeration of a hardware or software entity within the system.
|
|
||||||
A system may contain multiple entities that match a class/subclass pairing.
|
|
||||||
The instance differentiates between them. An instance of 0 indicates that instance information is unavailable,
|
|
||||||
not meaningful, or not relevant. Valid instance numbers start with 1.
|
|
||||||
|
|
||||||
|
|
||||||
@param CallerId This optional parameter may be used to identify the caller.
|
|
||||||
This parameter allows the status code driver to apply different rules to different callers.
|
|
||||||
Type EFI_GUID is defined in InstallProtocolInterface() in the UEFI 2.0 Specification.
|
|
||||||
|
|
||||||
|
|
||||||
@param Data This optional parameter may be used to pass additional data
|
|
||||||
|
|
||||||
@retval EFI_OUT_OF_RESOURCES Can not acquire record buffer.
|
|
||||||
@retval EFI_DEVICE_ERROR EFI serial device can not work after ExitBootService() is called .
|
|
||||||
@retval EFI_SUCCESS Success to cache status code and signal log data event.
|
|
||||||
|
|
||||||
**/
|
**/
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
@ -190,12 +190,11 @@ DataHubStatusCodeReportWorker (
|
|||||||
CHAR8 *Format;
|
CHAR8 *Format;
|
||||||
UINTN CharCount;
|
UINTN CharCount;
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Use atom operation to avoid the reentant of report.
|
// Use atom operation to avoid the reentant of report.
|
||||||
// If current status is not zero, then the function is reentrancy.
|
// If current status is not zero, then the function is reentrancy.
|
||||||
//
|
//
|
||||||
if (1 == InterlockedCompareExchange32 (&mLogDataHubStatus, 0, 0)) {
|
if (InterlockedCompareExchange32 (&mLogDataHubStatus, 0, 0) == 1) {
|
||||||
return EFI_DEVICE_ERROR;
|
return EFI_DEVICE_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -234,7 +233,7 @@ DataHubStatusCodeReportWorker (
|
|||||||
Marker
|
Marker
|
||||||
);
|
);
|
||||||
//
|
//
|
||||||
// Change record data type from DebugType to String Type.
|
// Change record data type to DebugType.
|
||||||
//
|
//
|
||||||
CopyGuid (&Record->Data.Type, &gEfiStatusCodeDataTypeDebugGuid);
|
CopyGuid (&Record->Data.Type, &gEfiStatusCodeDataTypeDebugGuid);
|
||||||
Record->Data.HeaderSize = Data->HeaderSize;
|
Record->Data.HeaderSize = Data->HeaderSize;
|
||||||
@ -281,7 +280,7 @@ LogDataHubEventCallBack (
|
|||||||
// Use atom operation to avoid the reentant of report.
|
// Use atom operation to avoid the reentant of report.
|
||||||
// If current status is not zero, then the function is reentrancy.
|
// If current status is not zero, then the function is reentrancy.
|
||||||
//
|
//
|
||||||
if (1 == InterlockedCompareExchange32 (&mLogDataHubStatus, 0, 1)) {
|
if (InterlockedCompareExchange32 (&mLogDataHubStatus, 0, 1) == 1) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -289,7 +288,10 @@ LogDataHubEventCallBack (
|
|||||||
// Log DataRecord in Data Hub.
|
// Log DataRecord in Data Hub.
|
||||||
// Journal records fifo to find all record entry.
|
// Journal records fifo to find all record entry.
|
||||||
//
|
//
|
||||||
while (1) {
|
while (TRUE) {
|
||||||
|
//
|
||||||
|
// Retrieve record from record FIFO until no more record can be retrieved.
|
||||||
|
//
|
||||||
Record = RetrieveRecord ();
|
Record = RetrieveRecord ();
|
||||||
if (Record == NULL) {
|
if (Record == NULL) {
|
||||||
break;
|
break;
|
||||||
@ -318,7 +320,6 @@ LogDataHubEventCallBack (
|
|||||||
//
|
//
|
||||||
// Log DataRecord in Data Hub
|
// Log DataRecord in Data Hub
|
||||||
//
|
//
|
||||||
|
|
||||||
mDataHubProtocol->LogData (
|
mDataHubProtocol->LogData (
|
||||||
mDataHubProtocol,
|
mDataHubProtocol,
|
||||||
&gEfiDataHubStatusCodeRecordGuid,
|
&gEfiDataHubStatusCodeRecordGuid,
|
||||||
@ -339,10 +340,10 @@ LogDataHubEventCallBack (
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Initialize data hubstatus code.
|
Locate Data Hub Protocol and create event for logging data
|
||||||
Create a data hub listener.
|
as initialization for data hub status code worker.
|
||||||
|
|
||||||
@return The function always return EFI_SUCCESS
|
@retval EFI_SUCCESS Initialization is successful.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
|
@ -13,7 +13,7 @@
|
|||||||
DXE -> This driver
|
DXE -> This driver
|
||||||
RT -> This driver
|
RT -> This driver
|
||||||
|
|
||||||
Copyright (c) 2006, Intel Corporation
|
Copyright (c) 2006 - 2009, 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
|
||||||
@ -27,7 +27,6 @@
|
|||||||
#include "DxeStatusCode.h"
|
#include "DxeStatusCode.h"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
||||||
Dispatch initialization request to sub status code devices based on
|
Dispatch initialization request to sub status code devices based on
|
||||||
customized feature flags.
|
customized feature flags.
|
||||||
|
|
||||||
@ -41,7 +40,7 @@ InitializationDispatcherWorker (
|
|||||||
EFI_STATUS Status;
|
EFI_STATUS Status;
|
||||||
MEMORY_STATUSCODE_PACKET_HEADER *PacketHeader;
|
MEMORY_STATUSCODE_PACKET_HEADER *PacketHeader;
|
||||||
MEMORY_STATUSCODE_RECORD *Record;
|
MEMORY_STATUSCODE_RECORD *Record;
|
||||||
UINTN ExpectedPacketIndex = 0;
|
UINTN ExpectedPacketIndex;
|
||||||
UINTN Index;
|
UINTN Index;
|
||||||
VOID *HobStart;
|
VOID *HobStart;
|
||||||
|
|
||||||
@ -55,6 +54,9 @@ InitializationDispatcherWorker (
|
|||||||
ASSERT_EFI_ERROR (Status);
|
ASSERT_EFI_ERROR (Status);
|
||||||
}
|
}
|
||||||
if (FeaturePcdGet (PcdStatusCodeUseHardSerial)) {
|
if (FeaturePcdGet (PcdStatusCodeUseHardSerial)) {
|
||||||
|
//
|
||||||
|
// Call Serial Port Lib API to initialize serial port.
|
||||||
|
//
|
||||||
Status = SerialPortInitialize ();
|
Status = SerialPortInitialize ();
|
||||||
ASSERT_EFI_ERROR (Status);
|
ASSERT_EFI_ERROR (Status);
|
||||||
}
|
}
|
||||||
@ -67,18 +69,22 @@ InitializationDispatcherWorker (
|
|||||||
ASSERT_EFI_ERROR (Status);
|
ASSERT_EFI_ERROR (Status);
|
||||||
}
|
}
|
||||||
if (FeaturePcdGet (PcdStatusCodeUseOEM)) {
|
if (FeaturePcdGet (PcdStatusCodeUseOEM)) {
|
||||||
|
//
|
||||||
|
// Call OEM hook status code library API to initialize OEM device for status code.
|
||||||
|
//
|
||||||
Status = OemHookStatusCodeInitialize ();
|
Status = OemHookStatusCodeInitialize ();
|
||||||
ASSERT_EFI_ERROR (Status);
|
ASSERT_EFI_ERROR (Status);
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Replay Status code which saved in GUID'ed HOB to all supported device.
|
// Replay Status code which saved in GUID'ed HOB to all supported devices.
|
||||||
//
|
//
|
||||||
|
|
||||||
//
|
//
|
||||||
// Journal GUID'ed HOBs to find all record entry, if found,
|
// Journal GUID'ed HOBs to find all record entry, if found,
|
||||||
// then output record to support replay device.
|
// then output record to support replay device.
|
||||||
//
|
//
|
||||||
|
ExpectedPacketIndex = 0;
|
||||||
Hob.Raw = GetFirstGuidHob (&gMemoryStatusCodeRecordGuid);
|
Hob.Raw = GetFirstGuidHob (&gMemoryStatusCodeRecordGuid);
|
||||||
HobStart = Hob.Raw;
|
HobStart = Hob.Raw;
|
||||||
while (Hob.Raw != NULL) {
|
while (Hob.Raw != NULL) {
|
||||||
@ -103,7 +109,6 @@ InitializationDispatcherWorker (
|
|||||||
if (FeaturePcdGet (PcdStatusCodeReplayInRuntimeMemory) &&
|
if (FeaturePcdGet (PcdStatusCodeReplayInRuntimeMemory) &&
|
||||||
FeaturePcdGet (PcdStatusCodeUseRuntimeMemory)) {
|
FeaturePcdGet (PcdStatusCodeUseRuntimeMemory)) {
|
||||||
RtMemoryStatusCodeReportWorker (
|
RtMemoryStatusCodeReportWorker (
|
||||||
gDxeStatusCode.RtMemoryStatusCodeTable[PHYSICAL_MODE],
|
|
||||||
Record[Index].CodeType,
|
Record[Index].CodeType,
|
||||||
Record[Index].Value,
|
Record[Index].Value,
|
||||||
Record[Index].Instance
|
Record[Index].Instance
|
||||||
@ -121,6 +126,9 @@ InitializationDispatcherWorker (
|
|||||||
}
|
}
|
||||||
if (FeaturePcdGet (PcdStatusCodeReplayInOEM) &&
|
if (FeaturePcdGet (PcdStatusCodeReplayInOEM) &&
|
||||||
FeaturePcdGet (PcdStatusCodeUseOEM)) {
|
FeaturePcdGet (PcdStatusCodeUseOEM)) {
|
||||||
|
//
|
||||||
|
// Call OEM hook status code library API to report status code to OEM device
|
||||||
|
//
|
||||||
OemHookStatusCodeReport (
|
OemHookStatusCodeReport (
|
||||||
Record[Index].CodeType,
|
Record[Index].CodeType,
|
||||||
Record[Index].Value,
|
Record[Index].Value,
|
||||||
@ -135,7 +143,7 @@ InitializationDispatcherWorker (
|
|||||||
//
|
//
|
||||||
// See whether there is gap of packet or not
|
// See whether there is gap of packet or not
|
||||||
//
|
//
|
||||||
if (NULL != HobStart) {
|
if (HobStart != NULL) {
|
||||||
HobStart = NULL;
|
HobStart = NULL;
|
||||||
Hob.Raw = HobStart;
|
Hob.Raw = HobStart;
|
||||||
continue;
|
continue;
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
/** @file
|
/** @file
|
||||||
|
Internal include file of Status Code Runtime DXE Driver.
|
||||||
|
|
||||||
Copyright (c) 2006, Intel Corporation
|
Copyright (c) 2006 - 2009, 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
|
||||||
@ -11,8 +12,8 @@
|
|||||||
|
|
||||||
**/
|
**/
|
||||||
|
|
||||||
#ifndef __DXE_STATUS_CODE_H__
|
#ifndef __STATUS_CODE_RUNTIME_DXE_H__
|
||||||
#define __DXE_STATUS_CODE_H__
|
#define __STATUS_CODE_RUNTIME_DXE_H__
|
||||||
|
|
||||||
|
|
||||||
#include <FrameworkDxe.h>
|
#include <FrameworkDxe.h>
|
||||||
@ -44,26 +45,12 @@
|
|||||||
//
|
//
|
||||||
// Data hub worker definition
|
// Data hub worker definition
|
||||||
//
|
//
|
||||||
#define MAX_NUMBER_DATAHUB_RECORDS 1000
|
|
||||||
#define DATAHUB_BYTES_PER_RECORD EFI_STATUS_CODE_DATA_MAX_SIZE
|
|
||||||
#define EMPTY_RECORD_TAG 0xFF
|
|
||||||
#define DATAHUB_STATUS_CODE_SIGNATURE SIGNATURE_32 ('B', 'D', 'H', 'S')
|
#define DATAHUB_STATUS_CODE_SIGNATURE SIGNATURE_32 ('B', 'D', 'H', 'S')
|
||||||
|
|
||||||
//
|
|
||||||
// Address type of pointer.
|
|
||||||
// The point type always equal to PHYSICAL_MODE on IA32/X64/EBC architecture
|
|
||||||
// Otherwise, VIRTUAL_MODE/PHYSICAL_MODE would be used on Ipf architecture,
|
|
||||||
//
|
|
||||||
typedef enum {
|
|
||||||
PHYSICAL_MODE,
|
|
||||||
VIRTUAL_MODE
|
|
||||||
} PROCESSOR_MODE;
|
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
UINTN Signature;
|
UINTN Signature;
|
||||||
LIST_ENTRY Node;
|
LIST_ENTRY Node;
|
||||||
|
UINT8 Data[sizeof(DATA_HUB_STATUS_CODE_DATA_RECORD) + EFI_STATUS_CODE_DATA_MAX_SIZE];
|
||||||
UINT8 Data[sizeof (DATA_HUB_STATUS_CODE_DATA_RECORD) + EFI_STATUS_CODE_DATA_MAX_SIZE];
|
|
||||||
} DATAHUB_STATUSCODE_RECORD;
|
} DATAHUB_STATUSCODE_RECORD;
|
||||||
|
|
||||||
|
|
||||||
@ -76,25 +63,43 @@ typedef struct {
|
|||||||
UINT32 MaxRecordsNumber;
|
UINT32 MaxRecordsNumber;
|
||||||
} RUNTIME_MEMORY_STATUSCODE_HEADER;
|
} RUNTIME_MEMORY_STATUSCODE_HEADER;
|
||||||
|
|
||||||
|
extern RUNTIME_MEMORY_STATUSCODE_HEADER *mRtMemoryStatusCodeTable;
|
||||||
typedef struct {
|
|
||||||
//
|
|
||||||
// Report operation nest status.
|
|
||||||
// If it is set, then the report operation has nested.
|
|
||||||
//
|
|
||||||
UINT32 StatusCodeNestStatus;
|
|
||||||
//
|
|
||||||
// Runtime status code management header, the records buffer is following it.
|
|
||||||
//
|
|
||||||
RUNTIME_MEMORY_STATUSCODE_HEADER *RtMemoryStatusCodeTable[2];
|
|
||||||
} DXE_STATUS_CODE_CONTROLLER;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Report status code to all supported device.
|
||||||
|
|
||||||
Dispatch initialization request to sub status code devices based on
|
This function implements EFI_STATUS_CODE_PROTOCOL.ReportStatusCode().
|
||||||
|
It calls into the workers which dispatches the platform specific listeners.
|
||||||
|
|
||||||
|
@param Type Indicates the type of status code being reported.
|
||||||
|
@param Value Describes the current status of a hardware or software entity.
|
||||||
|
This included information about the class and subclass that is used to
|
||||||
|
classify the entity as well as an operation.
|
||||||
|
@param Instance The enumeration of a hardware or software entity within
|
||||||
|
the system. Valid instance numbers start with 1.
|
||||||
|
@param CallerId This optional parameter may be used to identify the caller.
|
||||||
|
This parameter allows the status code driver to apply different rules to
|
||||||
|
different callers.
|
||||||
|
@param Data This optional parameter may be used to pass additional data.
|
||||||
|
|
||||||
|
@retval EFI_SUCCESS The function completed successfully
|
||||||
|
@retval EFI_DEVICE_ERROR The function should not be completed due to a device error.
|
||||||
|
|
||||||
|
**/
|
||||||
|
EFI_STATUS
|
||||||
|
EFIAPI
|
||||||
|
ReportDispatcher (
|
||||||
|
IN EFI_STATUS_CODE_TYPE CodeType,
|
||||||
|
IN EFI_STATUS_CODE_VALUE Value,
|
||||||
|
IN UINT32 Instance,
|
||||||
|
IN EFI_GUID *CallerId OPTIONAL,
|
||||||
|
IN EFI_STATUS_CODE_DATA *Data OPTIONAL
|
||||||
|
);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Dispatch initialization request to sub status code devices based on
|
||||||
customized feature flags.
|
customized feature flags.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
VOID
|
VOID
|
||||||
InitializationDispatcherWorker (
|
InitializationDispatcherWorker (
|
||||||
@ -103,9 +108,9 @@ InitializationDispatcherWorker (
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Initialize serial status code worker.
|
Locates Serial I/O Protocol as initialization for serial status code worker.
|
||||||
|
|
||||||
@return The function always return EFI_SUCCESS
|
@retval EFI_SUCCESS Serial I/O Protocol is successfully located.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
@ -116,31 +121,21 @@ EfiSerialStatusCodeInitializeWorker (
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
Convert status code value and extended data to readable ASCII string, send string to serial I/O device.
|
Convert status code value and extended data to readable ASCII string, send string to serial I/O device.
|
||||||
|
|
||||||
|
@param CodeType Indicates the type of status code being reported.
|
||||||
|
@param Value Describes the current status of a hardware or software entity.
|
||||||
|
This included information about the class and subclass that is used to
|
||||||
|
classify the entity as well as an operation.
|
||||||
|
@param Instance The enumeration of a hardware or software entity within
|
||||||
|
the system. Valid instance numbers start with 1.
|
||||||
|
@param CallerId This optional parameter may be used to identify the caller.
|
||||||
|
This parameter allows the status code driver to apply different rules to
|
||||||
|
different callers.
|
||||||
|
@param Data This optional parameter may be used to pass additional data.
|
||||||
|
|
||||||
@param CodeType Indicates the type of status code being reported. Type EFI_STATUS_CODE_TYPE is defined in "Related Definitions" below.
|
@retval EFI_SUCCESS Status code reported to serial I/O successfully.
|
||||||
|
@retval EFI_DEVICE_ERROR EFI serial device cannot work after ExitBootService() is called.
|
||||||
@param Value Describes the current status of a hardware or software entity.
|
@retval EFI_DEVICE_ERROR EFI serial device cannot work with TPL higher than TPL_CALLBACK.
|
||||||
This included information about the class and subclass that is used to classify the entity
|
|
||||||
as well as an operation. For progress codes, the operation is the current activity.
|
|
||||||
For error codes, it is the exception. For debug codes, it is not defined at this time.
|
|
||||||
Type EFI_STATUS_CODE_VALUE is defined in "Related Definitions" below.
|
|
||||||
Specific values are discussed in the Intel? Platform Innovation Framework for EFI Status Code Specification.
|
|
||||||
|
|
||||||
@param Instance The enumeration of a hardware or software entity within the system.
|
|
||||||
A system may contain multiple entities that match a class/subclass pairing.
|
|
||||||
The instance differentiates between them. An instance of 0 indicates that instance information is unavailable,
|
|
||||||
not meaningful, or not relevant. Valid instance numbers start with 1.
|
|
||||||
|
|
||||||
|
|
||||||
@param CallerId This optional parameter may be used to identify the caller.
|
|
||||||
This parameter allows the status code driver to apply different rules to different callers.
|
|
||||||
Type EFI_GUID is defined in InstallProtocolInterface() in the UEFI 2.0 Specification.
|
|
||||||
|
|
||||||
|
|
||||||
@param Data This optional parameter may be used to pass additional data
|
|
||||||
|
|
||||||
@retval EFI_SUCCESS Success to report status code to serial I/O.
|
|
||||||
@retval EFI_DEVICE_ERROR EFI serial device can not work after ExitBootService() is called .
|
|
||||||
|
|
||||||
**/
|
**/
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
@ -153,9 +148,9 @@ SerialStatusCodeReportWorker (
|
|||||||
);
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Initialize runtime memory status code.
|
Initialize runtime memory status code table as initialization for runtime memory status code worker
|
||||||
|
|
||||||
@return The function always return EFI_SUCCESS
|
@retval EFI_SUCCESS Runtime memory status code table successfully initialized.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
@ -164,42 +159,34 @@ RtMemoryStatusCodeInitializeWorker (
|
|||||||
);
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Report status code into runtime memory. If the runtime pool is full, roll back to the
|
Report status code into runtime memory. If the runtime pool is full, roll back to the
|
||||||
first record and overwrite it.
|
first record and overwrite it.
|
||||||
|
|
||||||
@param RtMemoryStatusCodeTable
|
@param CodeType Indicates the type of status code being reported.
|
||||||
Point to Runtime memory table header.
|
@param Value Describes the current status of a hardware or software entity.
|
||||||
|
This included information about the class and subclass that is used to
|
||||||
@param CodeType Indicates the type of status code being reported. Type EFI_STATUS_CODE_TYPE is defined in "Related Definitions" below.
|
classify the entity as well as an operation.
|
||||||
|
@param Instance The enumeration of a hardware or software entity within
|
||||||
@param Value Describes the current status of a hardware or software entity.
|
the system. Valid instance numbers start with 1.
|
||||||
This included information about the class and subclass that is used to classify the entity
|
@param CallerId This optional parameter may be used to identify the caller.
|
||||||
as well as an operation. For progress codes, the operation is the current activity.
|
This parameter allows the status code driver to apply different rules to
|
||||||
For error codes, it is the exception. For debug codes, it is not defined at this time.
|
different callers.
|
||||||
Type EFI_STATUS_CODE_VALUE is defined in "Related Definitions" below.
|
|
||||||
Specific values are discussed in the Intel? Platform Innovation Framework for EFI Status Code Specification.
|
@retval EFI_SUCCESS Status code successfully recorded in runtime memory status code table.
|
||||||
|
|
||||||
@param Instance The enumeration of a hardware or software entity within the system.
|
|
||||||
A system may contain multiple entities that match a class/subclass pairing.
|
|
||||||
The instance differentiates between them. An instance of 0 indicates that instance information is unavailable,
|
|
||||||
not meaningful, or not relevant. Valid instance numbers start with 1.
|
|
||||||
|
|
||||||
@return The function always return EFI_SUCCESS.
|
|
||||||
|
|
||||||
**/
|
**/
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
RtMemoryStatusCodeReportWorker (
|
RtMemoryStatusCodeReportWorker (
|
||||||
RUNTIME_MEMORY_STATUSCODE_HEADER *RtMemoryStatusCodeTable,
|
|
||||||
IN EFI_STATUS_CODE_TYPE CodeType,
|
IN EFI_STATUS_CODE_TYPE CodeType,
|
||||||
IN EFI_STATUS_CODE_VALUE Value,
|
IN EFI_STATUS_CODE_VALUE Value,
|
||||||
IN UINT32 Instance
|
IN UINT32 Instance
|
||||||
);
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Initialize data hubstatus code.
|
Locate Data Hub Protocol and create event for logging data
|
||||||
Create a data hub listener.
|
as initialization for data hub status code worker.
|
||||||
|
|
||||||
@return The function always return EFI_SUCCESS
|
@retval EFI_SUCCESS Initialization is successful.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
@ -211,31 +198,21 @@ DataHubStatusCodeInitializeWorker (
|
|||||||
/**
|
/**
|
||||||
Report status code into DataHub.
|
Report status code into DataHub.
|
||||||
|
|
||||||
@param CodeType Indicates the type of status code being reported. Type EFI_STATUS_CODE_TYPE is defined in "Related Definitions" below.
|
@param CodeType Indicates the type of status code being reported.
|
||||||
|
@param Value Describes the current status of a hardware or software entity.
|
||||||
|
This included information about the class and subclass that is used to
|
||||||
|
classify the entity as well as an operation.
|
||||||
|
@param Instance The enumeration of a hardware or software entity within
|
||||||
|
the system. Valid instance numbers start with 1.
|
||||||
|
@param CallerId This optional parameter may be used to identify the caller.
|
||||||
|
This parameter allows the status code driver to apply different rules to
|
||||||
|
different callers.
|
||||||
|
@param Data This optional parameter may be used to pass additional data.
|
||||||
|
|
||||||
@param Value Describes the current status of a hardware or software entity.
|
@retval EFI_SUCCESS The function completed successfully.
|
||||||
This included information about the class and subclass that is used to classify the entity
|
@retval EFI_DEVICE_ERROR Function is reentered.
|
||||||
as well as an operation. For progress codes, the operation is the current activity.
|
@retval EFI_DEVICE_ERROR Function is called at runtime.
|
||||||
For error codes, it is the exception. For debug codes, it is not defined at this time.
|
@retval EFI_OUT_OF_RESOURCES Fail to allocate memory for free record buffer.
|
||||||
Type EFI_STATUS_CODE_VALUE is defined in "Related Definitions" below.
|
|
||||||
Specific values are discussed in the Intel? Platform Innovation Framework for EFI Status Code Specification.
|
|
||||||
|
|
||||||
@param Instance The enumeration of a hardware or software entity within the system.
|
|
||||||
A system may contain multiple entities that match a class/subclass pairing.
|
|
||||||
The instance differentiates between them. An instance of 0 indicates that instance information is unavailable,
|
|
||||||
not meaningful, or not relevant. Valid instance numbers start with 1.
|
|
||||||
|
|
||||||
|
|
||||||
@param CallerId This optional parameter may be used to identify the caller.
|
|
||||||
This parameter allows the status code driver to apply different rules to different callers.
|
|
||||||
Type EFI_GUID is defined in InstallProtocolInterface() in the UEFI 2.0 Specification.
|
|
||||||
|
|
||||||
|
|
||||||
@param Data This optional parameter may be used to pass additional data
|
|
||||||
|
|
||||||
@retval EFI_OUT_OF_RESOURCES Can not acquire record buffer.
|
|
||||||
@retval EFI_DEVICE_ERROR EFI serial device can not work after ExitBootService() is called .
|
|
||||||
@retval EFI_SUCCESS Success to cache status code and signal log data event.
|
|
||||||
|
|
||||||
**/
|
**/
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
@ -248,9 +225,15 @@ DataHubStatusCodeReportWorker (
|
|||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
//
|
/**
|
||||||
// Declaration for callback Event.
|
Virtual address change notification call back. It converts global pointer
|
||||||
//
|
to virtual address.
|
||||||
|
|
||||||
|
@param Event Event whose notification function is being invoked.
|
||||||
|
@param Context Pointer to the notification function's context, which is
|
||||||
|
always zero in current implementation.
|
||||||
|
|
||||||
|
**/
|
||||||
VOID
|
VOID
|
||||||
EFIAPI
|
EFIAPI
|
||||||
VirtualAddressChangeCallBack (
|
VirtualAddressChangeCallBack (
|
||||||
@ -258,18 +241,4 @@ VirtualAddressChangeCallBack (
|
|||||||
IN VOID *Context
|
IN VOID *Context
|
||||||
);
|
);
|
||||||
|
|
||||||
//
|
|
||||||
// Declaration for original Entry Point.
|
|
||||||
//
|
|
||||||
EFI_STATUS
|
|
||||||
EFIAPI
|
|
||||||
DxeStatusCodeDriverEntry (
|
|
||||||
IN EFI_HANDLE ImageHandle,
|
|
||||||
IN EFI_SYSTEM_TABLE *SystemTable
|
|
||||||
);
|
|
||||||
|
|
||||||
//
|
|
||||||
// declaration of DXE status code controller.
|
|
||||||
//
|
|
||||||
extern DXE_STATUS_CODE_CONTROLLER gDxeStatusCode;
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -1,9 +1,7 @@
|
|||||||
#/** @file
|
#/** @file
|
||||||
# DXE status code driver.
|
# Status Code Runtime Dxe driver that supports multiple devices and produces
|
||||||
|
# Status Code Runtime Protocol.
|
||||||
#
|
#
|
||||||
# Status Code Architectural Protocol implementation as defined in Tiano
|
|
||||||
# Architecture Specification. This driver has limited functionality
|
|
||||||
# at runtime and will not log to Data Hub at runtime.
|
|
||||||
# Copyright (c) 2006 - 2009, Intel Corporation.
|
# Copyright (c) 2006 - 2009, Intel Corporation.
|
||||||
#
|
#
|
||||||
# All rights reserved. This program and the accompanying materials
|
# All rights reserved. This program and the accompanying materials
|
||||||
@ -75,15 +73,16 @@
|
|||||||
|
|
||||||
|
|
||||||
[Guids]
|
[Guids]
|
||||||
gEfiDataHubStatusCodeRecordGuid # SOMETIMES_CONSUMED
|
gEfiDataHubStatusCodeRecordGuid ## SOMETIMES_CONSUMES (Needed if Data Hub is supported for status code.)
|
||||||
gMemoryStatusCodeRecordGuid # SOMETIMES_CONSUMED
|
gEfiStatusCodeDataTypeDebugGuid ## SOMETIMES_CONSUMES (Needed if Data Hub is supported for status code.)
|
||||||
gEfiStatusCodeDataTypeDebugGuid # PROTOCOL ALWAYS_CONSUMED
|
gMemoryStatusCodeRecordGuid ## CONSUMES ## HOB
|
||||||
gEfiEventExitBootServicesGuid
|
gEfiEventVirtualAddressChangeGuid ## CONSUMES ## Event
|
||||||
|
|
||||||
|
|
||||||
[Protocols]
|
[Protocols]
|
||||||
gEfiStatusCodeRuntimeProtocolGuid # PROTOCOL ALWAYS_CONSUMED
|
gEfiStatusCodeRuntimeProtocolGuid ## PRODUCES
|
||||||
gEfiDataHubProtocolGuid # PROTOCOL ALWAYS_CONSUMED
|
gEfiDataHubProtocolGuid ## SOMETIMES_CONSUMES (Needed if Data Hub is supported for status code.)
|
||||||
gEfiSerialIoProtocolGuid # PROTOCOL ALWAYS_CONSUMED
|
gEfiSerialIoProtocolGuid ## SOMETIMES_CONSUMES (Needed if Serial is supported for status code.)
|
||||||
|
|
||||||
|
|
||||||
[FeaturePcd.common]
|
[FeaturePcd.common]
|
||||||
|
@ -14,47 +14,8 @@
|
|||||||
|
|
||||||
#include "DxeStatusCode.h"
|
#include "DxeStatusCode.h"
|
||||||
|
|
||||||
//
|
EFI_EVENT mVirtualAddressChangeEvent = NULL;
|
||||||
// Event for Exit Boot Services Callback
|
EFI_HANDLE mHandle = NULL;
|
||||||
//
|
|
||||||
EFI_EVENT mExitBootServicesEvent = NULL;
|
|
||||||
|
|
||||||
/**
|
|
||||||
Report status code to all supported device.
|
|
||||||
Calls into the workers which dispatches the platform specific
|
|
||||||
listeners.
|
|
||||||
|
|
||||||
@param Type Indicates the type of status code being reported.
|
|
||||||
The type EFI_STATUS_CODE_TYPE is defined in "Related Definitions" below.
|
|
||||||
@param Value Describes the current status of a hardware or software entity.
|
|
||||||
This includes information about the class and subclass that is used to classify the entity
|
|
||||||
as well as an operation. For progress codes, the operation is the current activity.
|
|
||||||
For error codes, it is the exception. For debug codes, it is not defined at this time.
|
|
||||||
Type EFI_STATUS_CODE_VALUE is defined in "Related Definitions" below.
|
|
||||||
Specific values are discussed in the Intel? Platform Innovation Framework for EFI Status Code Specification.
|
|
||||||
@param Instance The enumeration of a hardware or software entity within the system.
|
|
||||||
A system may contain multiple entities that match a class/subclass pairing.
|
|
||||||
The instance differentiates between them. An instance of 0 indicates that instance
|
|
||||||
information is unavailable, not meaningful, or not relevant. Valid instance numbers start with 1.
|
|
||||||
@param CallerId This optional parameter may be used to identify the caller.
|
|
||||||
This parameter allows the status code driver to apply different rules to different callers.
|
|
||||||
@param Data This optional parameter may be used to pass additional data.
|
|
||||||
Type EFI_STATUS_CODE_DATA is defined in "Related Definitions" below.
|
|
||||||
The contents of this data type may have additional GUID-specific data. The standard GUIDs and
|
|
||||||
their associated data structures are defined in the Intel? Platform Innovation Framework for EFI Status Codes Specification.
|
|
||||||
|
|
||||||
@return Always return EFI_SUCCESS.
|
|
||||||
|
|
||||||
**/
|
|
||||||
EFI_STATUS
|
|
||||||
EFIAPI
|
|
||||||
ReportDispatcher (
|
|
||||||
IN EFI_STATUS_CODE_TYPE Type,
|
|
||||||
IN EFI_STATUS_CODE_VALUE Value,
|
|
||||||
IN UINT32 Instance,
|
|
||||||
IN EFI_GUID *CallerId OPTIONAL,
|
|
||||||
IN EFI_STATUS_CODE_DATA *Data OPTIONAL
|
|
||||||
);
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Declaration of status code protocol.
|
// Declaration of status code protocol.
|
||||||
@ -64,24 +25,21 @@ EFI_STATUS_CODE_PROTOCOL mEfiStatusCodeProtocol = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
//
|
//
|
||||||
// Delaration of DXE status code controller
|
// Report operation nest status.
|
||||||
|
// If it is set, then the report operation has nested.
|
||||||
//
|
//
|
||||||
DXE_STATUS_CODE_CONTROLLER gDxeStatusCode = {
|
UINT32 mStatusCodeNestStatus = 0;
|
||||||
//
|
|
||||||
// Initialize nest status as non nested.
|
|
||||||
//
|
|
||||||
0,
|
|
||||||
{NULL, NULL}
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Entry point of DXE Status Code Driver.
|
||||||
|
|
||||||
Install the ReportStatusCode runtime service.
|
This function is the entry point of this DXE Status Code Driver.
|
||||||
|
It installs Status Code Runtime Protocol, and registers event for EVT_SIGNAL_VIRTUAL_ADDRESS_CHANGE.
|
||||||
|
|
||||||
@param ImageHandle Image handle of the loaded driver
|
@param ImageHandle The firmware allocated handle for the EFI image.
|
||||||
@param SystemTable Pointer to the System Table
|
@param SystemTable A pointer to the EFI System Table.
|
||||||
|
|
||||||
@return The function always returns success.
|
@retval EFI_SUCCESS The entry point is executed successfully.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
@ -91,7 +49,6 @@ DxeStatusCodeDriverEntry (
|
|||||||
IN EFI_SYSTEM_TABLE *SystemTable
|
IN EFI_SYSTEM_TABLE *SystemTable
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
EFI_HANDLE Handle = NULL;
|
|
||||||
EFI_STATUS Status;
|
EFI_STATUS Status;
|
||||||
|
|
||||||
//
|
//
|
||||||
@ -100,11 +57,10 @@ DxeStatusCodeDriverEntry (
|
|||||||
InitializationDispatcherWorker ();
|
InitializationDispatcherWorker ();
|
||||||
|
|
||||||
//
|
//
|
||||||
// Install Status Code Architectural Protocol implementation as defined in Tiano
|
// Install Status Code Runtime Protocol implementation as defined in PI Specification.
|
||||||
// Architecture Specification.
|
|
||||||
//
|
//
|
||||||
Status = gBS->InstallMultipleProtocolInterfaces (
|
Status = gBS->InstallMultipleProtocolInterfaces (
|
||||||
&Handle,
|
&mHandle,
|
||||||
&gEfiStatusCodeRuntimeProtocolGuid,
|
&gEfiStatusCodeRuntimeProtocolGuid,
|
||||||
&mEfiStatusCodeProtocol,
|
&mEfiStatusCodeProtocol,
|
||||||
NULL
|
NULL
|
||||||
@ -116,39 +72,33 @@ DxeStatusCodeDriverEntry (
|
|||||||
TPL_NOTIFY,
|
TPL_NOTIFY,
|
||||||
VirtualAddressChangeCallBack,
|
VirtualAddressChangeCallBack,
|
||||||
NULL,
|
NULL,
|
||||||
&gEfiEventExitBootServicesGuid,
|
&gEfiEventVirtualAddressChangeGuid,
|
||||||
&mExitBootServicesEvent
|
&mVirtualAddressChangeEvent
|
||||||
);
|
);
|
||||||
ASSERT_EFI_ERROR (Status);
|
ASSERT_EFI_ERROR (Status);
|
||||||
|
|
||||||
return Status;
|
return EFI_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Report status code to all supported device.
|
Report status code to all supported device.
|
||||||
Calls into the workers which dispatches the platform specific
|
|
||||||
listeners.
|
|
||||||
|
|
||||||
@param CodeType Indicates the type of status code being reported.
|
This function implements EFI_STATUS_CODE_PROTOCOL.ReportStatusCode().
|
||||||
The type EFI_STATUS_CODE_TYPE is defined in "Related Definitions" below.
|
It calls into the workers which dispatches the platform specific listeners.
|
||||||
@param Value Describes the current status of a hardware or software entity.
|
|
||||||
This includes information about the class and subclass that is used to classify the entity
|
|
||||||
as well as an operation. For progress codes, the operation is the current activity.
|
|
||||||
For error codes, it is the exception. For debug codes, it is not defined at this time.
|
|
||||||
Type EFI_STATUS_CODE_VALUE is defined in "Related Definitions" below.
|
|
||||||
Specific values are discussed in the Intel? Platform Innovation Framework for EFI Status Code Specification.
|
|
||||||
@param Instance The enumeration of a hardware or software entity within the system.
|
|
||||||
A system may contain multiple entities that match a class/subclass pairing.
|
|
||||||
The instance differentiates between them. An instance of 0 indicates that instance
|
|
||||||
information is unavailable, not meaningful, or not relevant. Valid instance numbers start with 1.
|
|
||||||
@param CallerId This optional parameter may be used to identify the caller.
|
|
||||||
This parameter allows the status code driver to apply different rules to different callers.
|
|
||||||
@param Data This optional parameter may be used to pass additional data.
|
|
||||||
Type EFI_STATUS_CODE_DATA is defined in "Related Definitions" below.
|
|
||||||
The contents of this data type may have additional GUID-specific data. The standard GUIDs and
|
|
||||||
their associated data structures are defined in the Intel? Platform Innovation Framework for EFI Status Codes Specification.
|
|
||||||
|
|
||||||
@return Always return EFI_SUCCESS.
|
@param Type Indicates the type of status code being reported.
|
||||||
|
@param Value Describes the current status of a hardware or software entity.
|
||||||
|
This included information about the class and subclass that is used to
|
||||||
|
classify the entity as well as an operation.
|
||||||
|
@param Instance The enumeration of a hardware or software entity within
|
||||||
|
the system. Valid instance numbers start with 1.
|
||||||
|
@param CallerId This optional parameter may be used to identify the caller.
|
||||||
|
This parameter allows the status code driver to apply different rules to
|
||||||
|
different callers.
|
||||||
|
@param Data This optional parameter may be used to pass additional data.
|
||||||
|
|
||||||
|
@retval EFI_SUCCESS The function completed successfully
|
||||||
|
@retval EFI_DEVICE_ERROR The function should not be completed due to a device error.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
@ -165,7 +115,7 @@ ReportDispatcher (
|
|||||||
// Use atom operation to avoid the reentant of report.
|
// Use atom operation to avoid the reentant of report.
|
||||||
// If current status is not zero, then the function is reentrancy.
|
// If current status is not zero, then the function is reentrancy.
|
||||||
//
|
//
|
||||||
if (1 == InterlockedCompareExchange32 (&gDxeStatusCode.StatusCodeNestStatus, 0, 1)) {
|
if (InterlockedCompareExchange32 (&mStatusCodeNestStatus, 0, 1) == 1) {
|
||||||
return EFI_DEVICE_ERROR;
|
return EFI_DEVICE_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -180,7 +130,6 @@ ReportDispatcher (
|
|||||||
}
|
}
|
||||||
if (FeaturePcdGet (PcdStatusCodeUseRuntimeMemory)) {
|
if (FeaturePcdGet (PcdStatusCodeUseRuntimeMemory)) {
|
||||||
RtMemoryStatusCodeReportWorker (
|
RtMemoryStatusCodeReportWorker (
|
||||||
gDxeStatusCode.RtMemoryStatusCodeTable[PHYSICAL_MODE],
|
|
||||||
CodeType,
|
CodeType,
|
||||||
Value,
|
Value,
|
||||||
Instance
|
Instance
|
||||||
@ -196,6 +145,9 @@ ReportDispatcher (
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
if (FeaturePcdGet (PcdStatusCodeUseOEM)) {
|
if (FeaturePcdGet (PcdStatusCodeUseOEM)) {
|
||||||
|
//
|
||||||
|
// Call OEM hook status code library API to report status code to OEM device
|
||||||
|
//
|
||||||
OemHookStatusCodeReport (
|
OemHookStatusCodeReport (
|
||||||
CodeType,
|
CodeType,
|
||||||
Value,
|
Value,
|
||||||
@ -208,7 +160,7 @@ ReportDispatcher (
|
|||||||
//
|
//
|
||||||
// Restore the nest status of report
|
// Restore the nest status of report
|
||||||
//
|
//
|
||||||
InterlockedCompareExchange32 (&gDxeStatusCode.StatusCodeNestStatus, 1, 0);
|
InterlockedCompareExchange32 (&mStatusCodeNestStatus, 1, 0);
|
||||||
|
|
||||||
return EFI_SUCCESS;
|
return EFI_SUCCESS;
|
||||||
}
|
}
|
||||||
@ -235,7 +187,7 @@ VirtualAddressChangeCallBack (
|
|||||||
//
|
//
|
||||||
EfiConvertPointer (
|
EfiConvertPointer (
|
||||||
0,
|
0,
|
||||||
(VOID **) &gDxeStatusCode.RtMemoryStatusCodeTable[PHYSICAL_MODE]
|
(VOID **) &mRtMemoryStatusCodeTable
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/** @file
|
/** @file
|
||||||
Runtime memory status code worker in DXE.
|
Runtime memory status code worker.
|
||||||
|
|
||||||
Copyright (c) 2006, Intel Corporation
|
Copyright (c) 2006 - 2009, 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
|
||||||
@ -14,10 +14,12 @@
|
|||||||
|
|
||||||
#include "DxeStatusCode.h"
|
#include "DxeStatusCode.h"
|
||||||
|
|
||||||
|
RUNTIME_MEMORY_STATUSCODE_HEADER *mRtMemoryStatusCodeTable;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Initialize runtime memory status code.
|
Initialize runtime memory status code table as initialization for runtime memory status code worker
|
||||||
|
|
||||||
@return The function always return EFI_SUCCESS
|
@retval EFI_SUCCESS Runtime memory status code table successfully initialized.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
@ -25,26 +27,21 @@ RtMemoryStatusCodeInitializeWorker (
|
|||||||
VOID
|
VOID
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
RUNTIME_MEMORY_STATUSCODE_HEADER *RtMemoryStatusCodeTable;
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Allocate runtime memory status code pool.
|
// Allocate runtime memory status code pool.
|
||||||
//
|
//
|
||||||
RtMemoryStatusCodeTable =
|
mRtMemoryStatusCodeTable = AllocateRuntimePool (
|
||||||
(RUNTIME_MEMORY_STATUSCODE_HEADER *) AllocateRuntimePool (
|
sizeof (RUNTIME_MEMORY_STATUSCODE_HEADER) +
|
||||||
sizeof (RUNTIME_MEMORY_STATUSCODE_HEADER) +
|
PcdGet16 (PcdStatusCodeRuntimeMemorySize) *
|
||||||
PcdGet16 (PcdStatusCodeRuntimeMemorySize) *
|
1024
|
||||||
1024
|
);
|
||||||
);
|
ASSERT (mRtMemoryStatusCodeTable != NULL);
|
||||||
|
|
||||||
ASSERT (NULL != RtMemoryStatusCodeTable);
|
mRtMemoryStatusCodeTable->RecordIndex = 0;
|
||||||
|
mRtMemoryStatusCodeTable->NumberOfRecords = 0;
|
||||||
RtMemoryStatusCodeTable->RecordIndex = 0;
|
mRtMemoryStatusCodeTable->MaxRecordsNumber =
|
||||||
RtMemoryStatusCodeTable->NumberOfRecords = 0;
|
|
||||||
RtMemoryStatusCodeTable->MaxRecordsNumber =
|
|
||||||
(PcdGet16 (PcdStatusCodeRuntimeMemorySize) * 1024) / sizeof (MEMORY_STATUSCODE_RECORD);
|
(PcdGet16 (PcdStatusCodeRuntimeMemorySize) * 1024) / sizeof (MEMORY_STATUSCODE_RECORD);
|
||||||
|
|
||||||
gDxeStatusCode.RtMemoryStatusCodeTable[PHYSICAL_MODE] = RtMemoryStatusCodeTable;
|
|
||||||
return EFI_SUCCESS;
|
return EFI_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -53,29 +50,21 @@ RtMemoryStatusCodeInitializeWorker (
|
|||||||
Report status code into runtime memory. If the runtime pool is full, roll back to the
|
Report status code into runtime memory. If the runtime pool is full, roll back to the
|
||||||
first record and overwrite it.
|
first record and overwrite it.
|
||||||
|
|
||||||
@param RtMemoryStatusCodeTable
|
@param CodeType Indicates the type of status code being reported.
|
||||||
Point to Runtime memory table header.
|
@param Value Describes the current status of a hardware or software entity.
|
||||||
|
This included information about the class and subclass that is used to
|
||||||
@param CodeType Indicates the type of status code being reported. Type EFI_STATUS_CODE_TYPE is defined in "Related Definitions" below.
|
classify the entity as well as an operation.
|
||||||
|
@param Instance The enumeration of a hardware or software entity within
|
||||||
|
the system. Valid instance numbers start with 1.
|
||||||
|
@param CallerId This optional parameter may be used to identify the caller.
|
||||||
|
This parameter allows the status code driver to apply different rules to
|
||||||
|
different callers.
|
||||||
|
|
||||||
@param Value Describes the current status of a hardware or software entity.
|
@retval EFI_SUCCESS Status code successfully recorded in runtime memory status code table.
|
||||||
This included information about the class and subclass that is used to classify the entity
|
|
||||||
as well as an operation. For progress codes, the operation is the current activity.
|
|
||||||
For error codes, it is the exception. For debug codes, it is not defined at this time.
|
|
||||||
Type EFI_STATUS_CODE_VALUE is defined in "Related Definitions" below.
|
|
||||||
Specific values are discussed in the Intel? Platform Innovation Framework for EFI Status Code Specification.
|
|
||||||
|
|
||||||
@param Instance The enumeration of a hardware or software entity within the system.
|
|
||||||
A system may contain multiple entities that match a class/subclass pairing.
|
|
||||||
The instance differentiates between them. An instance of 0 indicates that instance information is unavailable,
|
|
||||||
not meaningful, or not relevant. Valid instance numbers start with 1.
|
|
||||||
|
|
||||||
@return The function always return EFI_SUCCESS.
|
|
||||||
|
|
||||||
**/
|
**/
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
RtMemoryStatusCodeReportWorker (
|
RtMemoryStatusCodeReportWorker (
|
||||||
RUNTIME_MEMORY_STATUSCODE_HEADER *RtMemoryStatusCodeTable,
|
|
||||||
IN EFI_STATUS_CODE_TYPE CodeType,
|
IN EFI_STATUS_CODE_TYPE CodeType,
|
||||||
IN EFI_STATUS_CODE_VALUE Value,
|
IN EFI_STATUS_CODE_VALUE Value,
|
||||||
IN UINT32 Instance
|
IN UINT32 Instance
|
||||||
@ -83,32 +72,33 @@ RtMemoryStatusCodeReportWorker (
|
|||||||
{
|
{
|
||||||
MEMORY_STATUSCODE_RECORD *Record;
|
MEMORY_STATUSCODE_RECORD *Record;
|
||||||
|
|
||||||
ASSERT (NULL != RtMemoryStatusCodeTable);
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Locate current record buffer.
|
// Locate current record buffer.
|
||||||
//
|
//
|
||||||
Record = (MEMORY_STATUSCODE_RECORD *) (RtMemoryStatusCodeTable + 1);
|
Record = (MEMORY_STATUSCODE_RECORD *) (mRtMemoryStatusCodeTable + 1);
|
||||||
Record = &Record[RtMemoryStatusCodeTable->RecordIndex++];
|
Record = &Record[mRtMemoryStatusCodeTable->RecordIndex++];
|
||||||
|
|
||||||
//
|
//
|
||||||
// Save status code.
|
// Save status code.
|
||||||
//
|
//
|
||||||
Record->CodeType = CodeType;
|
Record->CodeType = CodeType;
|
||||||
Record->Value = Value;
|
Record->Value = Value;
|
||||||
Record->Instance = Instance;
|
Record->Instance = Instance;
|
||||||
|
|
||||||
//
|
//
|
||||||
// Record total number of records, we compare the number with max records number,
|
// If record index equals to max record number, then wrap around record index to zero.
|
||||||
// if it is bigger than the max number, then the roll back had happened, the record index points to
|
|
||||||
// the first record. if it is less then max number, then the zero index is the first record.
|
|
||||||
//
|
//
|
||||||
RtMemoryStatusCodeTable->NumberOfRecords++;
|
// The reader of status code should compare the number of records with max records number,
|
||||||
if (RtMemoryStatusCodeTable->RecordIndex == RtMemoryStatusCodeTable->MaxRecordsNumber) {
|
// If it is equal to or larger than the max number, then the wrap-around had happened,
|
||||||
|
// so the first record is pointed by record index.
|
||||||
|
// If it is less then max number, index of the first record is zero.
|
||||||
|
//
|
||||||
|
mRtMemoryStatusCodeTable->NumberOfRecords++;
|
||||||
|
if (mRtMemoryStatusCodeTable->RecordIndex == mRtMemoryStatusCodeTable->MaxRecordsNumber) {
|
||||||
//
|
//
|
||||||
// Roll back record index.
|
// Wrap around record index.
|
||||||
//
|
//
|
||||||
RtMemoryStatusCodeTable->RecordIndex = 0;
|
mRtMemoryStatusCodeTable->RecordIndex = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
return EFI_SUCCESS;
|
return EFI_SUCCESS;
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/** @file
|
/** @file
|
||||||
Serial I/O status code reporting worker.
|
Serial I/O status code reporting worker.
|
||||||
|
|
||||||
Copyright (c) 2006, Intel Corporation
|
Copyright (c) 2006 - 2009, 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
|
||||||
@ -17,9 +17,9 @@
|
|||||||
EFI_SERIAL_IO_PROTOCOL *mSerialIoProtocol;
|
EFI_SERIAL_IO_PROTOCOL *mSerialIoProtocol;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Initialize serial status code worker.
|
Locates Serial I/O Protocol as initialization for serial status code worker.
|
||||||
|
|
||||||
@return The function always return EFI_SUCCESS
|
@retval EFI_SUCCESS Serial I/O Protocol is successfully located.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
@ -44,30 +44,20 @@ EfiSerialStatusCodeInitializeWorker (
|
|||||||
/**
|
/**
|
||||||
Convert status code value and extended data to readable ASCII string, send string to serial I/O device.
|
Convert status code value and extended data to readable ASCII string, send string to serial I/O device.
|
||||||
|
|
||||||
@param CodeType Indicates the type of status code being reported. Type EFI_STATUS_CODE_TYPE is defined in "Related Definitions" below.
|
@param CodeType Indicates the type of status code being reported.
|
||||||
|
@param Value Describes the current status of a hardware or software entity.
|
||||||
@param Value Describes the current status of a hardware or software entity.
|
This included information about the class and subclass that is used to
|
||||||
This included information about the class and subclass that is used to classify the entity
|
classify the entity as well as an operation.
|
||||||
as well as an operation. For progress codes, the operation is the current activity.
|
@param Instance The enumeration of a hardware or software entity within
|
||||||
For error codes, it is the exception. For debug codes, it is not defined at this time.
|
the system. Valid instance numbers start with 1.
|
||||||
Type EFI_STATUS_CODE_VALUE is defined in "Related Definitions" below.
|
@param CallerId This optional parameter may be used to identify the caller.
|
||||||
Specific values are discussed in the Intel? Platform Innovation Framework for EFI Status Code Specification.
|
This parameter allows the status code driver to apply different rules to
|
||||||
|
different callers.
|
||||||
@param Instance The enumeration of a hardware or software entity within the system.
|
@param Data This optional parameter may be used to pass additional data.
|
||||||
A system may contain multiple entities that match a class/subclass pairing.
|
|
||||||
The instance differentiates between them. An instance of 0 indicates that instance information is unavailable,
|
|
||||||
not meaningful, or not relevant. Valid instance numbers start with 1.
|
|
||||||
|
|
||||||
|
@retval EFI_SUCCESS Status code reported to serial I/O successfully.
|
||||||
@param CallerId This optional parameter may be used to identify the caller.
|
@retval EFI_DEVICE_ERROR EFI serial device cannot work after ExitBootService() is called.
|
||||||
This parameter allows the status code driver to apply different rules to different callers.
|
@retval EFI_DEVICE_ERROR EFI serial device cannot work with TPL higher than TPL_CALLBACK.
|
||||||
Type EFI_GUID is defined in InstallProtocolInterface() in the UEFI 2.0 Specification.
|
|
||||||
|
|
||||||
|
|
||||||
@param Data This optional parameter may be used to pass additional data
|
|
||||||
|
|
||||||
@retval EFI_SUCCESS Success to report status code to serial I/O.
|
|
||||||
@retval EFI_DEVICE_ERROR EFI serial device can not work after ExitBootService() is called .
|
|
||||||
|
|
||||||
**/
|
**/
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
@ -87,17 +77,12 @@ SerialStatusCodeReportWorker (
|
|||||||
UINT32 LineNumber;
|
UINT32 LineNumber;
|
||||||
UINTN CharCount;
|
UINTN CharCount;
|
||||||
VA_LIST Marker;
|
VA_LIST Marker;
|
||||||
EFI_TPL CurrentTpl;
|
|
||||||
|
|
||||||
|
|
||||||
if (FeaturePcdGet (PcdStatusCodeUseEfiSerial)) {
|
if (FeaturePcdGet (PcdStatusCodeUseEfiSerial)) {
|
||||||
if (EfiAtRuntime ()) {
|
if (EfiAtRuntime ()) {
|
||||||
return EFI_DEVICE_ERROR;
|
return EFI_DEVICE_ERROR;
|
||||||
}
|
}
|
||||||
CurrentTpl = gBS->RaiseTPL (TPL_HIGH_LEVEL);
|
if (EfiGetCurrentTpl () > TPL_CALLBACK ) {
|
||||||
gBS->RestoreTPL (CurrentTpl);
|
|
||||||
|
|
||||||
if (CurrentTpl > TPL_CALLBACK ) {
|
|
||||||
return EFI_DEVICE_ERROR;
|
return EFI_DEVICE_ERROR;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -140,12 +125,7 @@ SerialStatusCodeReportWorker (
|
|||||||
Value,
|
Value,
|
||||||
Instance
|
Instance
|
||||||
);
|
);
|
||||||
|
|
||||||
//
|
|
||||||
// Make sure we don't try to print values that weren't
|
|
||||||
// intended to be printed, especially NULL GUID pointers.
|
|
||||||
//
|
|
||||||
|
|
||||||
if (CallerId != NULL) {
|
if (CallerId != NULL) {
|
||||||
CharCount += AsciiSPrint (
|
CharCount += AsciiSPrint (
|
||||||
&Buffer[CharCount - 1],
|
&Buffer[CharCount - 1],
|
||||||
@ -170,6 +150,9 @@ SerialStatusCodeReportWorker (
|
|||||||
"\n\r"
|
"\n\r"
|
||||||
);
|
);
|
||||||
} else if ((CodeType & EFI_STATUS_CODE_TYPE_MASK) == EFI_PROGRESS_CODE) {
|
} else if ((CodeType & EFI_STATUS_CODE_TYPE_MASK) == EFI_PROGRESS_CODE) {
|
||||||
|
//
|
||||||
|
// Print PROGRESS information into output buffer.
|
||||||
|
//
|
||||||
CharCount = AsciiSPrint (
|
CharCount = AsciiSPrint (
|
||||||
Buffer,
|
Buffer,
|
||||||
EFI_STATUS_CODE_DATA_MAX_SIZE,
|
EFI_STATUS_CODE_DATA_MAX_SIZE,
|
||||||
@ -178,6 +161,9 @@ SerialStatusCodeReportWorker (
|
|||||||
Instance
|
Instance
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
|
//
|
||||||
|
// Code type is not defined.
|
||||||
|
//
|
||||||
CharCount = AsciiSPrint (
|
CharCount = AsciiSPrint (
|
||||||
Buffer,
|
Buffer,
|
||||||
EFI_STATUS_CODE_DATA_MAX_SIZE,
|
EFI_STATUS_CODE_DATA_MAX_SIZE,
|
||||||
@ -191,7 +177,7 @@ SerialStatusCodeReportWorker (
|
|||||||
|
|
||||||
if (FeaturePcdGet (PcdStatusCodeUseHardSerial)) {
|
if (FeaturePcdGet (PcdStatusCodeUseHardSerial)) {
|
||||||
//
|
//
|
||||||
// Callout to SerialPort Lib function to do print.
|
// Call SerialPort Lib function to do print.
|
||||||
//
|
//
|
||||||
SerialPortWrite ((UINT8 *) Buffer, CharCount);
|
SerialPortWrite ((UINT8 *) Buffer, CharCount);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user