summaryrefslogtreecommitdiff
path: root/IntelFrameworkModulePkg
diff options
context:
space:
mode:
authorxli24 <xli24@6f19259b-4bc3-4df7-8a09-765794883524>2009-04-27 06:14:50 +0000
committerxli24 <xli24@6f19259b-4bc3-4df7-8a09-765794883524>2009-04-27 06:14:50 +0000
commita8cbf345063feb5b34d3dadd87ba32fc3f4ab7f6 (patch)
tree35dc643d35ca9354d164a0e1c349d6b028bcb4d9 /IntelFrameworkModulePkg
parent27e87dab26709b7b03a6b7cb275a38e7ea915606 (diff)
downloadedk2-a8cbf345063feb5b34d3dadd87ba32fc3f4ab7f6.zip
edk2-a8cbf345063feb5b34d3dadd87ba32fc3f4ab7f6.tar.gz
edk2-a8cbf345063feb5b34d3dadd87ba32fc3f4ab7f6.tar.bz2
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
Diffstat (limited to 'IntelFrameworkModulePkg')
-rw-r--r--IntelFrameworkModulePkg/Universal/StatusCode/Dxe/DataHubStatusCodeWorker.c107
-rw-r--r--IntelFrameworkModulePkg/Universal/StatusCode/Dxe/DxeStatusCode.c20
-rw-r--r--IntelFrameworkModulePkg/Universal/StatusCode/Dxe/DxeStatusCode.h227
-rw-r--r--IntelFrameworkModulePkg/Universal/StatusCode/Dxe/DxeStatusCode.inf21
-rw-r--r--IntelFrameworkModulePkg/Universal/StatusCode/Dxe/DxeStatusCodeCommon.c128
-rw-r--r--IntelFrameworkModulePkg/Universal/StatusCode/Dxe/RtMemoryStatusCodeWorker.c92
-rw-r--r--IntelFrameworkModulePkg/Universal/StatusCode/Dxe/SerialStatusCodeWorker.c66
7 files changed, 283 insertions, 378 deletions
diff --git a/IntelFrameworkModulePkg/Universal/StatusCode/Dxe/DataHubStatusCodeWorker.c b/IntelFrameworkModulePkg/Universal/StatusCode/Dxe/DataHubStatusCodeWorker.c
index 3cf5088..e55113c 100644
--- a/IntelFrameworkModulePkg/Universal/StatusCode/Dxe/DataHubStatusCodeWorker.c
+++ b/IntelFrameworkModulePkg/Universal/StatusCode/Dxe/DataHubStatusCodeWorker.c
@@ -1,7 +1,7 @@
/** @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
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
@@ -28,12 +28,14 @@ EFI_DATA_HUB_PROTOCOL *mDataHubProtocol;
/**
- Return one DATAHUB_STATUSCODE_RECORD space.
- The size of free record pool would be extend, if the pool is empty.
+ Retrieve one record of from free record buffer. This record is removed from
+ 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.
- @retval !NULL Point to buffer of record.
+ @return Pointer to the free record.
+ NULL means failure to allocate new memeory for free record buffer.
**/
DATA_HUB_STATUS_CODE_DATA_RECORD *
@@ -49,6 +51,9 @@ AcquireRecordBuffer (
CurrentTpl = gBS->RaiseTPL (TPL_HIGH_LEVEL);
if (!IsListEmpty (&mRecordsBuffer)) {
+ //
+ // Strip one entry from free record buffer.
+ //
Node = GetFirstNode (&mRecordsBuffer);
RemoveEntryList (Node);
@@ -62,13 +67,20 @@ AcquireRecordBuffer (
return NULL;
}
+ //
+ // If free record buffer is exhausted, then allocate 16 new records for it.
+ //
gBS->RestoreTPL (CurrentTpl);
Record = (DATAHUB_STATUSCODE_RECORD *) AllocateZeroPool (sizeof (DATAHUB_STATUSCODE_RECORD) * 16);
- if (NULL == Record) {
+ if (Record == NULL) {
return NULL;
}
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++) {
InsertTailList (&mRecordsBuffer, &Record[Index].Node);
}
@@ -84,11 +96,10 @@ AcquireRecordBuffer (
/**
- Retrieve one record from Records FIFO. The record would be removed from FIFO and
- release to free record buffer.
+ Retrieve one record from Records FIFO. The record would be removed from FIFO.
- @return !NULL Point to record, which is ready to be logged.
- @return NULL the FIFO of record is empty.
+ @return Point to record, which is ready to be logged.
+ NULL means the FIFO of record is empty.
**/
DATA_HUB_STATUS_CODE_DATA_RECORD *
@@ -96,17 +107,19 @@ RetrieveRecord (
VOID
)
{
- DATA_HUB_STATUS_CODE_DATA_RECORD *RecordData = NULL;
+ DATA_HUB_STATUS_CODE_DATA_RECORD *RecordData;
DATAHUB_STATUSCODE_RECORD *Record;
LIST_ENTRY *Node;
EFI_TPL CurrentTpl;
+ RecordData = NULL;
+
CurrentTpl = gBS->RaiseTPL (TPL_HIGH_LEVEL);
if (!IsListEmpty (&mRecordsFifo)) {
Node = GetFirstNode (&mRecordsFifo);
Record = CR (Node, DATAHUB_STATUSCODE_RECORD, Node, DATAHUB_STATUS_CODE_SIGNATURE);
- ASSERT (NULL != Record);
+ ASSERT (Record != NULL);
RemoveEntryList (&Record->Node);
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
- from AcquireRecordBuffer.
+ @param RecordData Pointer to the record to release.
**/
VOID
@@ -133,7 +145,7 @@ ReleaseRecord (
EFI_TPL CurrentTpl;
Record = CR (RecordData, DATAHUB_STATUSCODE_RECORD, Data[0], DATAHUB_STATUS_CODE_SIGNATURE);
- ASSERT (NULL != Record);
+ ASSERT (Record != NULL);
CurrentTpl = gBS->RaiseTPL (TPL_HIGH_LEVEL);
@@ -143,36 +155,24 @@ ReleaseRecord (
gBS->RestoreTPL (CurrentTpl);
}
-
-
/**
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 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. 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_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.
+ @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.
+
+ @retval EFI_SUCCESS The function completed successfully.
+ @retval EFI_DEVICE_ERROR Function is reentered.
+ @retval EFI_DEVICE_ERROR Function is called at runtime.
+ @retval EFI_OUT_OF_RESOURCES Fail to allocate memory for free record buffer.
**/
EFI_STATUS
@@ -190,12 +190,11 @@ DataHubStatusCodeReportWorker (
CHAR8 *Format;
UINTN CharCount;
-
//
// Use atom operation to avoid the reentant of report.
// 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;
}
@@ -234,7 +233,7 @@ DataHubStatusCodeReportWorker (
Marker
);
//
- // Change record data type from DebugType to String Type.
+ // Change record data type to DebugType.
//
CopyGuid (&Record->Data.Type, &gEfiStatusCodeDataTypeDebugGuid);
Record->Data.HeaderSize = Data->HeaderSize;
@@ -281,7 +280,7 @@ LogDataHubEventCallBack (
// Use atom operation to avoid the reentant of report.
// If current status is not zero, then the function is reentrancy.
//
- if (1 == InterlockedCompareExchange32 (&mLogDataHubStatus, 0, 1)) {
+ if (InterlockedCompareExchange32 (&mLogDataHubStatus, 0, 1) == 1) {
return;
}
@@ -289,7 +288,10 @@ LogDataHubEventCallBack (
// Log DataRecord in Data Hub.
// 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 ();
if (Record == NULL) {
break;
@@ -318,7 +320,6 @@ LogDataHubEventCallBack (
//
// Log DataRecord in Data Hub
//
-
mDataHubProtocol->LogData (
mDataHubProtocol,
&gEfiDataHubStatusCodeRecordGuid,
@@ -339,10 +340,10 @@ LogDataHubEventCallBack (
/**
- Initialize data hubstatus code.
- Create a data hub listener.
+ Locate Data Hub Protocol and create event for logging data
+ as initialization for data hub status code worker.
- @return The function always return EFI_SUCCESS
+ @retval EFI_SUCCESS Initialization is successful.
**/
EFI_STATUS
diff --git a/IntelFrameworkModulePkg/Universal/StatusCode/Dxe/DxeStatusCode.c b/IntelFrameworkModulePkg/Universal/StatusCode/Dxe/DxeStatusCode.c
index 9f5ae55..55ae84a 100644
--- a/IntelFrameworkModulePkg/Universal/StatusCode/Dxe/DxeStatusCode.c
+++ b/IntelFrameworkModulePkg/Universal/StatusCode/Dxe/DxeStatusCode.c
@@ -13,7 +13,7 @@
DXE -> 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
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
@@ -27,7 +27,6 @@
#include "DxeStatusCode.h"
/**
-
Dispatch initialization request to sub status code devices based on
customized feature flags.
@@ -41,7 +40,7 @@ InitializationDispatcherWorker (
EFI_STATUS Status;
MEMORY_STATUSCODE_PACKET_HEADER *PacketHeader;
MEMORY_STATUSCODE_RECORD *Record;
- UINTN ExpectedPacketIndex = 0;
+ UINTN ExpectedPacketIndex;
UINTN Index;
VOID *HobStart;
@@ -55,6 +54,9 @@ InitializationDispatcherWorker (
ASSERT_EFI_ERROR (Status);
}
if (FeaturePcdGet (PcdStatusCodeUseHardSerial)) {
+ //
+ // Call Serial Port Lib API to initialize serial port.
+ //
Status = SerialPortInitialize ();
ASSERT_EFI_ERROR (Status);
}
@@ -67,18 +69,22 @@ InitializationDispatcherWorker (
ASSERT_EFI_ERROR (Status);
}
if (FeaturePcdGet (PcdStatusCodeUseOEM)) {
+ //
+ // Call OEM hook status code library API to initialize OEM device for status code.
+ //
Status = OemHookStatusCodeInitialize ();
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,
// then output record to support replay device.
//
+ ExpectedPacketIndex = 0;
Hob.Raw = GetFirstGuidHob (&gMemoryStatusCodeRecordGuid);
HobStart = Hob.Raw;
while (Hob.Raw != NULL) {
@@ -103,7 +109,6 @@ InitializationDispatcherWorker (
if (FeaturePcdGet (PcdStatusCodeReplayInRuntimeMemory) &&
FeaturePcdGet (PcdStatusCodeUseRuntimeMemory)) {
RtMemoryStatusCodeReportWorker (
- gDxeStatusCode.RtMemoryStatusCodeTable[PHYSICAL_MODE],
Record[Index].CodeType,
Record[Index].Value,
Record[Index].Instance
@@ -121,6 +126,9 @@ InitializationDispatcherWorker (
}
if (FeaturePcdGet (PcdStatusCodeReplayInOEM) &&
FeaturePcdGet (PcdStatusCodeUseOEM)) {
+ //
+ // Call OEM hook status code library API to report status code to OEM device
+ //
OemHookStatusCodeReport (
Record[Index].CodeType,
Record[Index].Value,
@@ -135,7 +143,7 @@ InitializationDispatcherWorker (
//
// See whether there is gap of packet or not
//
- if (NULL != HobStart) {
+ if (HobStart != NULL) {
HobStart = NULL;
Hob.Raw = HobStart;
continue;
diff --git a/IntelFrameworkModulePkg/Universal/StatusCode/Dxe/DxeStatusCode.h b/IntelFrameworkModulePkg/Universal/StatusCode/Dxe/DxeStatusCode.h
index 4004deb..8fb5488 100644
--- a/IntelFrameworkModulePkg/Universal/StatusCode/Dxe/DxeStatusCode.h
+++ b/IntelFrameworkModulePkg/Universal/StatusCode/Dxe/DxeStatusCode.h
@@ -1,6 +1,7 @@
/** @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
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
@@ -11,8 +12,8 @@
**/
-#ifndef __DXE_STATUS_CODE_H__
-#define __DXE_STATUS_CODE_H__
+#ifndef __STATUS_CODE_RUNTIME_DXE_H__
+#define __STATUS_CODE_RUNTIME_DXE_H__
#include <FrameworkDxe.h>
@@ -44,26 +45,12 @@
//
// 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')
-//
-// 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 {
UINTN Signature;
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;
@@ -76,26 +63,44 @@ typedef struct {
UINT32 MaxRecordsNumber;
} 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.
+ 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.
- Dispatch initialization request to sub status code devices based on
- customized feature flags.
+ @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.
+
+**/
VOID
InitializationDispatcherWorker (
VOID
@@ -103,9 +108,9 @@ InitializationDispatcherWorker (
/**
- Initialize serial status code worker.
-
- @return The function always return EFI_SUCCESS
+ Locates Serial I/O Protocol as initialization for serial status code worker.
+
+ @retval EFI_SUCCESS Serial I/O Protocol is successfully located.
**/
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.
-
- @param CodeType Indicates the type of status code being reported. Type EFI_STATUS_CODE_TYPE is defined in "Related Definitions" below.
-
- @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. 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 .
+
+ @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.
+
+ @retval EFI_SUCCESS Status code reported to serial I/O successfully.
+ @retval EFI_DEVICE_ERROR EFI serial device cannot work after ExitBootService() is called.
+ @retval EFI_DEVICE_ERROR EFI serial device cannot work with TPL higher than TPL_CALLBACK.
**/
EFI_STATUS
@@ -153,9 +148,9 @@ SerialStatusCodeReportWorker (
);
/**
- Initialize runtime memory status code.
-
- @return The function always return EFI_SUCCESS
+ Initialize runtime memory status code table as initialization for runtime memory status code worker
+
+ @retval EFI_SUCCESS Runtime memory status code table successfully initialized.
**/
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.
-
- @param RtMemoryStatusCodeTable
- Point to Runtime memory table header.
-
- @param CodeType Indicates the type of status code being reported. Type EFI_STATUS_CODE_TYPE is defined in "Related Definitions" below.
-
- @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. 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.
+
+ @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.
+
+ @retval EFI_SUCCESS Status code successfully recorded in runtime memory status code table.
**/
EFI_STATUS
RtMemoryStatusCodeReportWorker (
- RUNTIME_MEMORY_STATUSCODE_HEADER *RtMemoryStatusCodeTable,
IN EFI_STATUS_CODE_TYPE CodeType,
IN EFI_STATUS_CODE_VALUE Value,
IN UINT32 Instance
);
/**
- Initialize data hubstatus code.
- Create a data hub listener.
+ Locate Data Hub Protocol and create event for logging data
+ as initialization for data hub status code worker.
- @return The function always return EFI_SUCCESS
+ @retval EFI_SUCCESS Initialization is successful.
**/
EFI_STATUS
@@ -211,31 +198,21 @@ DataHubStatusCodeInitializeWorker (
/**
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 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. 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_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.
+ @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.
+
+ @retval EFI_SUCCESS The function completed successfully.
+ @retval EFI_DEVICE_ERROR Function is reentered.
+ @retval EFI_DEVICE_ERROR Function is called at runtime.
+ @retval EFI_OUT_OF_RESOURCES Fail to allocate memory for free record buffer.
**/
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
EFIAPI
VirtualAddressChangeCallBack (
@@ -258,18 +241,4 @@ VirtualAddressChangeCallBack (
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
diff --git a/IntelFrameworkModulePkg/Universal/StatusCode/Dxe/DxeStatusCode.inf b/IntelFrameworkModulePkg/Universal/StatusCode/Dxe/DxeStatusCode.inf
index 1fece54..3df5174 100644
--- a/IntelFrameworkModulePkg/Universal/StatusCode/Dxe/DxeStatusCode.inf
+++ b/IntelFrameworkModulePkg/Universal/StatusCode/Dxe/DxeStatusCode.inf
@@ -1,9 +1,7 @@
#/** @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.
#
# All rights reserved. This program and the accompanying materials
@@ -75,15 +73,16 @@
[Guids]
- gEfiDataHubStatusCodeRecordGuid # SOMETIMES_CONSUMED
- gMemoryStatusCodeRecordGuid # SOMETIMES_CONSUMED
- gEfiStatusCodeDataTypeDebugGuid # PROTOCOL ALWAYS_CONSUMED
- gEfiEventExitBootServicesGuid
+ gEfiDataHubStatusCodeRecordGuid ## SOMETIMES_CONSUMES (Needed if Data Hub is supported for status code.)
+ gEfiStatusCodeDataTypeDebugGuid ## SOMETIMES_CONSUMES (Needed if Data Hub is supported for status code.)
+ gMemoryStatusCodeRecordGuid ## CONSUMES ## HOB
+ gEfiEventVirtualAddressChangeGuid ## CONSUMES ## Event
+
[Protocols]
- gEfiStatusCodeRuntimeProtocolGuid # PROTOCOL ALWAYS_CONSUMED
- gEfiDataHubProtocolGuid # PROTOCOL ALWAYS_CONSUMED
- gEfiSerialIoProtocolGuid # PROTOCOL ALWAYS_CONSUMED
+ gEfiStatusCodeRuntimeProtocolGuid ## PRODUCES
+ gEfiDataHubProtocolGuid ## SOMETIMES_CONSUMES (Needed if Data Hub is supported for status code.)
+ gEfiSerialIoProtocolGuid ## SOMETIMES_CONSUMES (Needed if Serial is supported for status code.)
[FeaturePcd.common]
diff --git a/IntelFrameworkModulePkg/Universal/StatusCode/Dxe/DxeStatusCodeCommon.c b/IntelFrameworkModulePkg/Universal/StatusCode/Dxe/DxeStatusCodeCommon.c
index 954e827..2a156a5 100644
--- a/IntelFrameworkModulePkg/Universal/StatusCode/Dxe/DxeStatusCodeCommon.c
+++ b/IntelFrameworkModulePkg/Universal/StatusCode/Dxe/DxeStatusCodeCommon.c
@@ -14,47 +14,8 @@
#include "DxeStatusCode.h"
-//
-// Event for Exit Boot Services Callback
-//
-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
- );
+EFI_EVENT mVirtualAddressChangeEvent = NULL;
+EFI_HANDLE mHandle = NULL;
//
// 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 = {
- //
- // Initialize nest status as non nested.
- //
- 0,
- {NULL, NULL}
-};
+UINT32 mStatusCodeNestStatus = 0;
/**
+ 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 SystemTable Pointer to the System Table
-
- @return The function always returns success.
+ @param ImageHandle The firmware allocated handle for the EFI image.
+ @param SystemTable A pointer to the EFI System Table.
+
+ @retval EFI_SUCCESS The entry point is executed successfully.
**/
EFI_STATUS
@@ -91,7 +49,6 @@ DxeStatusCodeDriverEntry (
IN EFI_SYSTEM_TABLE *SystemTable
)
{
- EFI_HANDLE Handle = NULL;
EFI_STATUS Status;
//
@@ -100,11 +57,10 @@ DxeStatusCodeDriverEntry (
InitializationDispatcherWorker ();
//
- // Install Status Code Architectural Protocol implementation as defined in Tiano
- // Architecture Specification.
+ // Install Status Code Runtime Protocol implementation as defined in PI Specification.
//
Status = gBS->InstallMultipleProtocolInterfaces (
- &Handle,
+ &mHandle,
&gEfiStatusCodeRuntimeProtocolGuid,
&mEfiStatusCodeProtocol,
NULL
@@ -116,39 +72,33 @@ DxeStatusCodeDriverEntry (
TPL_NOTIFY,
VirtualAddressChangeCallBack,
NULL,
- &gEfiEventExitBootServicesGuid,
- &mExitBootServicesEvent
+ &gEfiEventVirtualAddressChangeGuid,
+ &mVirtualAddressChangeEvent
);
ASSERT_EFI_ERROR (Status);
- return Status;
+ return EFI_SUCCESS;
}
/**
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.
- 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.
+
+ 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
@@ -165,7 +115,7 @@ ReportDispatcher (
// Use atom operation to avoid the reentant of report.
// 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;
}
@@ -180,7 +130,6 @@ ReportDispatcher (
}
if (FeaturePcdGet (PcdStatusCodeUseRuntimeMemory)) {
RtMemoryStatusCodeReportWorker (
- gDxeStatusCode.RtMemoryStatusCodeTable[PHYSICAL_MODE],
CodeType,
Value,
Instance
@@ -196,6 +145,9 @@ ReportDispatcher (
);
}
if (FeaturePcdGet (PcdStatusCodeUseOEM)) {
+ //
+ // Call OEM hook status code library API to report status code to OEM device
+ //
OemHookStatusCodeReport (
CodeType,
Value,
@@ -208,7 +160,7 @@ ReportDispatcher (
//
// Restore the nest status of report
//
- InterlockedCompareExchange32 (&gDxeStatusCode.StatusCodeNestStatus, 1, 0);
+ InterlockedCompareExchange32 (&mStatusCodeNestStatus, 1, 0);
return EFI_SUCCESS;
}
@@ -235,7 +187,7 @@ VirtualAddressChangeCallBack (
//
EfiConvertPointer (
0,
- (VOID **) &gDxeStatusCode.RtMemoryStatusCodeTable[PHYSICAL_MODE]
+ (VOID **) &mRtMemoryStatusCodeTable
);
}
diff --git a/IntelFrameworkModulePkg/Universal/StatusCode/Dxe/RtMemoryStatusCodeWorker.c b/IntelFrameworkModulePkg/Universal/StatusCode/Dxe/RtMemoryStatusCodeWorker.c
index de2ccf3..3d0855f 100644
--- a/IntelFrameworkModulePkg/Universal/StatusCode/Dxe/RtMemoryStatusCodeWorker.c
+++ b/IntelFrameworkModulePkg/Universal/StatusCode/Dxe/RtMemoryStatusCodeWorker.c
@@ -1,7 +1,7 @@
/** @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
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
@@ -14,10 +14,12 @@
#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
@@ -25,26 +27,21 @@ RtMemoryStatusCodeInitializeWorker (
VOID
)
{
- RUNTIME_MEMORY_STATUSCODE_HEADER *RtMemoryStatusCodeTable;
-
//
// Allocate runtime memory status code pool.
//
- RtMemoryStatusCodeTable =
- (RUNTIME_MEMORY_STATUSCODE_HEADER *) AllocateRuntimePool (
- sizeof (RUNTIME_MEMORY_STATUSCODE_HEADER) +
- PcdGet16 (PcdStatusCodeRuntimeMemorySize) *
- 1024
- );
-
- ASSERT (NULL != RtMemoryStatusCodeTable);
-
- RtMemoryStatusCodeTable->RecordIndex = 0;
- RtMemoryStatusCodeTable->NumberOfRecords = 0;
- RtMemoryStatusCodeTable->MaxRecordsNumber =
+ mRtMemoryStatusCodeTable = AllocateRuntimePool (
+ sizeof (RUNTIME_MEMORY_STATUSCODE_HEADER) +
+ PcdGet16 (PcdStatusCodeRuntimeMemorySize) *
+ 1024
+ );
+ ASSERT (mRtMemoryStatusCodeTable != NULL);
+
+ mRtMemoryStatusCodeTable->RecordIndex = 0;
+ mRtMemoryStatusCodeTable->NumberOfRecords = 0;
+ mRtMemoryStatusCodeTable->MaxRecordsNumber =
(PcdGet16 (PcdStatusCodeRuntimeMemorySize) * 1024) / sizeof (MEMORY_STATUSCODE_RECORD);
- gDxeStatusCode.RtMemoryStatusCodeTable[PHYSICAL_MODE] = RtMemoryStatusCodeTable;
return EFI_SUCCESS;
}
@@ -53,29 +50,21 @@ RtMemoryStatusCodeInitializeWorker (
Report status code into runtime memory. If the runtime pool is full, roll back to the
first record and overwrite it.
- @param RtMemoryStatusCodeTable
- Point to Runtime memory table header.
-
- @param CodeType Indicates the type of status code being reported. Type EFI_STATUS_CODE_TYPE is defined in "Related Definitions" below.
-
- @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. 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 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 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.
+ @retval EFI_SUCCESS Status code successfully recorded in runtime memory status code table.
**/
EFI_STATUS
RtMemoryStatusCodeReportWorker (
- RUNTIME_MEMORY_STATUSCODE_HEADER *RtMemoryStatusCodeTable,
IN EFI_STATUS_CODE_TYPE CodeType,
IN EFI_STATUS_CODE_VALUE Value,
IN UINT32 Instance
@@ -83,32 +72,33 @@ RtMemoryStatusCodeReportWorker (
{
MEMORY_STATUSCODE_RECORD *Record;
- ASSERT (NULL != RtMemoryStatusCodeTable);
-
//
// Locate current record buffer.
//
- Record = (MEMORY_STATUSCODE_RECORD *) (RtMemoryStatusCodeTable + 1);
- Record = &Record[RtMemoryStatusCodeTable->RecordIndex++];
+ Record = (MEMORY_STATUSCODE_RECORD *) (mRtMemoryStatusCodeTable + 1);
+ Record = &Record[mRtMemoryStatusCodeTable->RecordIndex++];
//
// Save status code.
//
- Record->CodeType = CodeType;
- Record->Value = Value;
- Record->Instance = Instance;
+ Record->CodeType = CodeType;
+ Record->Value = Value;
+ Record->Instance = Instance;
//
- // Record total number of records, we compare the number with max records number,
- // 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.
+ // If record index equals to max record number, then wrap around record index to zero.
+ //
+ // The reader of status code should compare the number of records with max records number,
+ // 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.
//
- RtMemoryStatusCodeTable->NumberOfRecords++;
- if (RtMemoryStatusCodeTable->RecordIndex == RtMemoryStatusCodeTable->MaxRecordsNumber) {
+ mRtMemoryStatusCodeTable->NumberOfRecords++;
+ if (mRtMemoryStatusCodeTable->RecordIndex == mRtMemoryStatusCodeTable->MaxRecordsNumber) {
//
- // Roll back record index.
+ // Wrap around record index.
//
- RtMemoryStatusCodeTable->RecordIndex = 0;
+ mRtMemoryStatusCodeTable->RecordIndex = 0;
}
return EFI_SUCCESS;
diff --git a/IntelFrameworkModulePkg/Universal/StatusCode/Dxe/SerialStatusCodeWorker.c b/IntelFrameworkModulePkg/Universal/StatusCode/Dxe/SerialStatusCodeWorker.c
index 5281728..d9ec8c5 100644
--- a/IntelFrameworkModulePkg/Universal/StatusCode/Dxe/SerialStatusCodeWorker.c
+++ b/IntelFrameworkModulePkg/Universal/StatusCode/Dxe/SerialStatusCodeWorker.c
@@ -1,7 +1,7 @@
/** @file
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
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
@@ -17,9 +17,9 @@
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
@@ -44,30 +44,20 @@ EfiSerialStatusCodeInitializeWorker (
/**
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 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. 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 .
+ @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.
+
+ @retval EFI_SUCCESS Status code reported to serial I/O successfully.
+ @retval EFI_DEVICE_ERROR EFI serial device cannot work after ExitBootService() is called.
+ @retval EFI_DEVICE_ERROR EFI serial device cannot work with TPL higher than TPL_CALLBACK.
**/
EFI_STATUS
@@ -87,17 +77,12 @@ SerialStatusCodeReportWorker (
UINT32 LineNumber;
UINTN CharCount;
VA_LIST Marker;
- EFI_TPL CurrentTpl;
-
if (FeaturePcdGet (PcdStatusCodeUseEfiSerial)) {
if (EfiAtRuntime ()) {
return EFI_DEVICE_ERROR;
}
- CurrentTpl = gBS->RaiseTPL (TPL_HIGH_LEVEL);
- gBS->RestoreTPL (CurrentTpl);
-
- if (CurrentTpl > TPL_CALLBACK ) {
+ if (EfiGetCurrentTpl () > TPL_CALLBACK ) {
return EFI_DEVICE_ERROR;
}
}
@@ -140,12 +125,7 @@ SerialStatusCodeReportWorker (
Value,
Instance
);
-
- //
- // Make sure we don't try to print values that weren't
- // intended to be printed, especially NULL GUID pointers.
- //
-
+
if (CallerId != NULL) {
CharCount += AsciiSPrint (
&Buffer[CharCount - 1],
@@ -170,6 +150,9 @@ SerialStatusCodeReportWorker (
"\n\r"
);
} else if ((CodeType & EFI_STATUS_CODE_TYPE_MASK) == EFI_PROGRESS_CODE) {
+ //
+ // Print PROGRESS information into output buffer.
+ //
CharCount = AsciiSPrint (
Buffer,
EFI_STATUS_CODE_DATA_MAX_SIZE,
@@ -178,6 +161,9 @@ SerialStatusCodeReportWorker (
Instance
);
} else {
+ //
+ // Code type is not defined.
+ //
CharCount = AsciiSPrint (
Buffer,
EFI_STATUS_CODE_DATA_MAX_SIZE,
@@ -191,7 +177,7 @@ SerialStatusCodeReportWorker (
if (FeaturePcdGet (PcdStatusCodeUseHardSerial)) {
//
- // Callout to SerialPort Lib function to do print.
+ // Call SerialPort Lib function to do print.
//
SerialPortWrite ((UINT8 *) Buffer, CharCount);
}