This commit is contained in:
yshang1 2007-01-12 04:02:02 +00:00
parent 8ef571dfb5
commit 69a99cc635
1 changed files with 26 additions and 25 deletions

View File

@ -56,7 +56,7 @@ AcquireRecordBuffer (
Node = GetFirstNode (&mRecordsBuffer); Node = GetFirstNode (&mRecordsBuffer);
RemoveEntryList (Node); RemoveEntryList (Node);
Record = CR (Node, DATAHUB_STATUSCODE_RECORD, Node, DATAHUB_STATUS_CODE_SIGNATURE); Record = _CR (Node, DATAHUB_STATUSCODE_RECORD, Node);
} else { } else {
if (CurrentTpl > EFI_TPL_NOTIFY) { if (CurrentTpl > EFI_TPL_NOTIFY) {
gBS->RestoreTPL (CurrentTpl); gBS->RestoreTPL (CurrentTpl);
@ -85,26 +85,36 @@ AcquireRecordBuffer (
/** /**
Release a mRecordBuffer entry allocated by AcquirRecordBuffer (). Retrieve one record from Records FIFO. The record would be removed from FIFO and
release to free record buffer.
@param Record Point to record buffer which is acquired by AcquirRecordBuffer() @return !NULL Point to record, which is ready to be logged.
@return NULL the FIFO of record is empty.
**/ **/
DATAHUB_STATUSCODE_RECORD *
RetrieveRecord (
VOID VOID
FreeRecordBuffer (
IN DATAHUB_STATUSCODE_RECORD *Record
) )
{ {
DATAHUB_STATUSCODE_RECORD *Record = NULL;
LIST_ENTRY *Node;
EFI_TPL CurrentTpl; EFI_TPL CurrentTpl;
ASSERT (Record != NULL);
CurrentTpl = gBS->RaiseTPL (EFI_TPL_HIGH_LEVEL); CurrentTpl = gBS->RaiseTPL (EFI_TPL_HIGH_LEVEL);
if (!IsListEmpty (&mRecordsFifo)) {
Node = GetFirstNode (&mRecordsFifo);
Record = CR (Node, DATAHUB_STATUSCODE_RECORD, Node, DATAHUB_STATUS_CODE_SIGNATURE);
RemoveEntryList (&Record->Node); RemoveEntryList (&Record->Node);
InsertTailList (&mRecordsBuffer, &Record->Node); InsertTailList (&mRecordsBuffer, &Record->Node);
Record->Signature = 0;
}
gBS->RestoreTPL (CurrentTpl); gBS->RestoreTPL (CurrentTpl);
return Record;
} }
@ -229,20 +239,16 @@ LogDataHubEventCallBack (
DATAHUB_STATUSCODE_RECORD *Record; DATAHUB_STATUSCODE_RECORD *Record;
UINT32 Size; UINT32 Size;
UINT64 DataRecordClass; UINT64 DataRecordClass;
LIST_ENTRY *Node;
EFI_TPL CurrentTpl;
// //
// 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) {
CurrentTpl = gBS->RaiseTPL (EFI_TPL_HIGH_LEVEL); Record = RetrieveRecord ();
if (Record == NULL) {
for (Node = mRecordsFifo.ForwardLink; Node != &mRecordsFifo;) { break;
Record = CR (Node, DATAHUB_STATUSCODE_RECORD, Node, DATAHUB_STATUS_CODE_SIGNATURE); }
Node = Node->ForwardLink;
// //
// Add in the size of the header we added. // Add in the size of the header we added.
// //
@ -277,12 +283,7 @@ LogDataHubEventCallBack (
Size Size
); );
FreeRecordBuffer (Record);
} }
gBS->RestoreTPL (CurrentTpl);
} }