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