summaryrefslogtreecommitdiff
path: root/IntelFrameworkModulePkg/Universal/StatusCode/RuntimeDxe
diff options
context:
space:
mode:
authorlgao4 <lgao4@6f19259b-4bc3-4df7-8a09-765794883524>2010-07-05 09:01:39 +0000
committerlgao4 <lgao4@6f19259b-4bc3-4df7-8a09-765794883524>2010-07-05 09:01:39 +0000
commitc945216e70ce93c2c1166bc286624aeff591eff1 (patch)
tree7105556d9f8f5cc7a0c845ac5758177673e7eb95 /IntelFrameworkModulePkg/Universal/StatusCode/RuntimeDxe
parentbe63a20a025d5a7b792bf6ff33b91d22323e19d8 (diff)
downloadedk2-platforms-c945216e70ce93c2c1166bc286624aeff591eff1.tar.xz
Fix the issues that StatusCode can't work when PcdStatusCodeUseMemory is set to TRUE or PcdStatusCodeUseDataHub is set to TRUE.
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@10631 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'IntelFrameworkModulePkg/Universal/StatusCode/RuntimeDxe')
-rw-r--r--IntelFrameworkModulePkg/Universal/StatusCode/RuntimeDxe/DataHubStatusCodeWorker.c17
-rw-r--r--IntelFrameworkModulePkg/Universal/StatusCode/RuntimeDxe/StatusCodeRuntimeDxe.c114
2 files changed, 63 insertions, 68 deletions
diff --git a/IntelFrameworkModulePkg/Universal/StatusCode/RuntimeDxe/DataHubStatusCodeWorker.c b/IntelFrameworkModulePkg/Universal/StatusCode/RuntimeDxe/DataHubStatusCodeWorker.c
index 5c1616e14b..ffee2f9c2a 100644
--- a/IntelFrameworkModulePkg/Universal/StatusCode/RuntimeDxe/DataHubStatusCodeWorker.c
+++ b/IntelFrameworkModulePkg/Universal/StatusCode/RuntimeDxe/DataHubStatusCodeWorker.c
@@ -1,7 +1,7 @@
/** @file
Data Hub status code worker.
- Copyright (c) 2006 - 2009, Intel Corporation. All rights reserved.<BR>
+ Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>
This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
@@ -24,7 +24,7 @@ EFI_EVENT mLogDataHubEvent;
//
// Cache data hub protocol.
//
-EFI_DATA_HUB_PROTOCOL *mDataHubProtocol;
+EFI_DATA_HUB_PROTOCOL *mDataHubProtocol = NULL;
/**
@@ -189,6 +189,7 @@ DataHubStatusCodeReportWorker (
BASE_LIST Marker;
CHAR8 *Format;
UINTN CharCount;
+ EFI_STATUS Status;
//
// Use atom operation to avoid the reentant of report.
@@ -205,6 +206,13 @@ DataHubStatusCodeReportWorker (
return EFI_DEVICE_ERROR;
}
+ if (mDataHubProtocol == NULL) {
+ Status = DataHubStatusCodeInitializeWorker ();
+ if (EFI_ERROR (Status)) {
+ return Status;
+ }
+ }
+
Record = AcquireRecordBuffer ();
if (Record == NULL) {
//
@@ -358,7 +366,10 @@ DataHubStatusCodeInitializeWorker (
NULL,
(VOID **) &mDataHubProtocol
);
- ASSERT_EFI_ERROR (Status);
+ if (EFI_ERROR (Status)) {
+ mDataHubProtocol = NULL;
+ return Status;
+ }
//
// Create a Notify Event to log data in Data Hub
diff --git a/IntelFrameworkModulePkg/Universal/StatusCode/RuntimeDxe/StatusCodeRuntimeDxe.c b/IntelFrameworkModulePkg/Universal/StatusCode/RuntimeDxe/StatusCodeRuntimeDxe.c
index cb2c271124..6435e1f727 100644
--- a/IntelFrameworkModulePkg/Universal/StatusCode/RuntimeDxe/StatusCodeRuntimeDxe.c
+++ b/IntelFrameworkModulePkg/Universal/StatusCode/RuntimeDxe/StatusCodeRuntimeDxe.c
@@ -1,7 +1,7 @@
/** @file
Status code driver for IA32/X64/EBC architecture.
- Copyright (c) 2006 - 2009, Intel Corporation. All rights reserved.<BR>
+ Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>
This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
@@ -205,9 +205,8 @@ InitializationDispatcherWorker (
EFI_STATUS Status;
MEMORY_STATUSCODE_PACKET_HEADER *PacketHeader;
MEMORY_STATUSCODE_RECORD *Record;
- UINTN ExpectedPacketIndex;
UINTN Index;
- VOID *HobStart;
+ UINTN MaxRecordNumber;
//
// If enable UseSerial, then initialize serial port.
@@ -226,8 +225,7 @@ InitializationDispatcherWorker (
ASSERT_EFI_ERROR (Status);
}
if (FeaturePcdGet (PcdStatusCodeUseDataHub)) {
- Status = DataHubStatusCodeInitializeWorker ();
- ASSERT_EFI_ERROR (Status);
+ DataHubStatusCodeInitializeWorker ();
}
if (FeaturePcdGet (PcdStatusCodeUseOEM)) {
//
@@ -245,73 +243,59 @@ InitializationDispatcherWorker (
// 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) {
+ if (Hob.Raw != NULL) {
PacketHeader = (MEMORY_STATUSCODE_PACKET_HEADER *) GET_GUID_HOB_DATA (Hob.Guid);
- if (PacketHeader->PacketIndex == ExpectedPacketIndex) {
- Record = (MEMORY_STATUSCODE_RECORD *) (PacketHeader + 1);
- for (Index = 0; Index < PacketHeader->RecordIndex; Index++) {
- //
- // Dispatch records to devices based on feature flag.
- //
- if (FeaturePcdGet (PcdStatusCodeUseSerial)) {
- SerialStatusCodeReportWorker (
- Record[Index].CodeType,
- Record[Index].Value,
- Record[Index].Instance,
- NULL,
- NULL
- );
- }
- if (FeaturePcdGet (PcdStatusCodeUseMemory)) {
- RtMemoryStatusCodeReportWorker (
- Record[Index].CodeType,
- Record[Index].Value,
- Record[Index].Instance
- );
- }
- if (FeaturePcdGet (PcdStatusCodeUseDataHub)) {
- DataHubStatusCodeReportWorker (
- Record[Index].CodeType,
- Record[Index].Value,
- Record[Index].Instance,
- NULL,
- NULL
- );
- }
- if (FeaturePcdGet (PcdStatusCodeUseOEM)) {
- //
- // Call OEM hook status code library API to report status code to OEM device
- //
- OemHookStatusCodeReport (
- Record[Index].CodeType,
- Record[Index].Value,
- Record[Index].Instance,
- NULL,
- NULL
- );
- }
- }
- ExpectedPacketIndex++;
-
+ Record = (MEMORY_STATUSCODE_RECORD *) (PacketHeader + 1);
+ MaxRecordNumber = (UINTN) PacketHeader->RecordIndex;
+ if (PacketHeader->PacketIndex > 0) {
//
- // See whether there is gap of packet or not
+ // Record has been wrapped around. So, record number has arrived at max number.
//
- if (HobStart != NULL) {
- HobStart = NULL;
- Hob.Raw = HobStart;
- continue;
- }
- } else if (HobStart != NULL) {
+ MaxRecordNumber = (UINTN) PacketHeader->MaxRecordsNumber;
+ }
+ for (Index = 0; Index < MaxRecordNumber; Index++) {
//
- // Cache the found packet for improve the performance
+ // Dispatch records to devices based on feature flag.
//
- HobStart = Hob.Raw;
+ if (FeaturePcdGet (PcdStatusCodeUseSerial)) {
+ SerialStatusCodeReportWorker (
+ Record[Index].CodeType,
+ Record[Index].Value,
+ Record[Index].Instance,
+ NULL,
+ NULL
+ );
+ }
+ if (FeaturePcdGet (PcdStatusCodeUseMemory)) {
+ RtMemoryStatusCodeReportWorker (
+ Record[Index].CodeType,
+ Record[Index].Value,
+ Record[Index].Instance
+ );
+ }
+ if (FeaturePcdGet (PcdStatusCodeUseDataHub)) {
+ DataHubStatusCodeReportWorker (
+ Record[Index].CodeType,
+ Record[Index].Value,
+ Record[Index].Instance,
+ NULL,
+ NULL
+ );
+ }
+ if (FeaturePcdGet (PcdStatusCodeUseOEM)) {
+ //
+ // Call OEM hook status code library API to report status code to OEM device
+ //
+ OemHookStatusCodeReport (
+ Record[Index].CodeType,
+ Record[Index].Value,
+ Record[Index].Instance,
+ NULL,
+ NULL
+ );
+ }
}
-
- Hob.Raw = GetNextGuidHob (&gMemoryStatusCodeRecordGuid, Hob.Raw);
}
}
}