Follow up tracker:

EDKT236, EDKT237, EDKT232, EDKT229 , EDKT233

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@1418 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
yshang1 2006-09-01 05:37:49 +00:00
parent 5f4eb6b6d5
commit a93763b74d
13 changed files with 116 additions and 36 deletions

View File

@ -22,8 +22,11 @@
Initialize OEM status code device . Initialize OEM status code device .
@return Status of initialization of OEM status code device.
**/ **/
VOID EFI_STATUS
EFIAPI EFIAPI
OemHookStatusCodeInitialize ( OemHookStatusCodeInitialize (
VOID VOID

View File

@ -22,6 +22,8 @@
Programmed hardware of Serial port. Programmed hardware of Serial port.
@return Status of Serial Port Device initialization.
**/ **/
EFI_STATUS EFI_STATUS
EFIAPI EFIAPI

View File

@ -18,14 +18,16 @@
Initialize OEM status code device . Initialize OEM status code device .
@return Always return EFI_SUCCESS.
**/ **/
VOID EFI_STATUS
EFIAPI EFIAPI
OemHookStatusCodeInitialize ( OemHookStatusCodeInitialize (
VOID VOID
) )
{ {
return; return EFI_SUCCESS;
} }
/** /**
@ -53,7 +55,7 @@ OemHookStatusCodeInitialize (
@param Data This optional parameter may be used to pass additional data @param Data This optional parameter may be used to pass additional data
@return The function always return EFI_SUCCESS. @return The function always return EFI_UNSUPPORTED.
**/ **/
EFI_STATUS EFI_STATUS

View File

@ -52,7 +52,8 @@ ReportDispatcher (
// //
// Declaration of status code protocol. // Declaration of status code protocol.
// //
STATIC
EFI_STATUS_CODE_PROTOCOL mEfiStatusCodeProtocol = { EFI_STATUS_CODE_PROTOCOL mEfiStatusCodeProtocol = {
ReportDispatcher ReportDispatcher
}; };

View File

@ -18,14 +18,18 @@
// //
// Initialize FIFO to cache records. // Initialize FIFO to cache records.
// //
STATIC
EFI_LOCK mFifoLock = EFI_INITIALIZE_LOCK_VARIABLE (EFI_TPL_HIGH_LEVEL); EFI_LOCK mFifoLock = EFI_INITIALIZE_LOCK_VARIABLE (EFI_TPL_HIGH_LEVEL);
STATIC
LIST_ENTRY mRecordsFifo = INITIALIZE_LIST_HEAD_VARIABLE (mRecordsFifo); LIST_ENTRY mRecordsFifo = INITIALIZE_LIST_HEAD_VARIABLE (mRecordsFifo);
STATIC
UINTN mNumberOfRecords = 0; UINTN mNumberOfRecords = 0;
STATIC
EFI_EVENT mLogDataHubEvent; EFI_EVENT mLogDataHubEvent;
// //
// Cache data hub protocol. // Cache data hub protocol.
// //
STATIC
EFI_DATA_HUB_PROTOCOL *mDataHubProtocol; EFI_DATA_HUB_PROTOCOL *mDataHubProtocol;

View File

@ -40,6 +40,7 @@ InitializationDispatcherWorker (
) )
{ {
EFI_PEI_HOB_POINTERS Hob; EFI_PEI_HOB_POINTERS Hob;
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 = 0;
@ -52,19 +53,24 @@ InitializationDispatcherWorker (
// if enable UseDataHub, then initialize data hub status code worker. // if enable UseDataHub, then initialize data hub status code worker.
// //
if (FeaturePcdGet (PcdStatusCodeUseEfiSerial)) { if (FeaturePcdGet (PcdStatusCodeUseEfiSerial)) {
EfiSerialStatusCodeInitializeWorker (); Status = EfiSerialStatusCodeInitializeWorker ();
ASSERT_EFI_ERROR (Status);
} }
if (FeaturePcdGet (PcdStatusCodeUseHardSerial)) { if (FeaturePcdGet (PcdStatusCodeUseHardSerial)) {
SerialPortInitialize (); Status = SerialPortInitialize ();
ASSERT_EFI_ERROR (Status);
} }
if (FeaturePcdGet (PcdStatusCodeUseRuntimeMemory)) { if (FeaturePcdGet (PcdStatusCodeUseRuntimeMemory)) {
RtMemoryStatusCodeInitializeWorker (); Status = RtMemoryStatusCodeInitializeWorker ();
ASSERT_EFI_ERROR (Status);
} }
if (FeaturePcdGet (PcdStatusCodeUseDataHub)) { if (FeaturePcdGet (PcdStatusCodeUseDataHub)) {
DataHubStatusCodeInitializeWorker (); Status = DataHubStatusCodeInitializeWorker ();
ASSERT_EFI_ERROR (Status);
} }
if (FeaturePcdGet (PcdStatusCodeUseOEM)) { if (FeaturePcdGet (PcdStatusCodeUseOEM)) {
OemHookStatusCodeInitialize (); Status = OemHookStatusCodeInitialize ();
ASSERT_EFI_ERROR (Status);
} }
// //

View File

@ -119,6 +119,9 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
<GuidCNames Usage="SOMETIMES_CONSUMED"> <GuidCNames Usage="SOMETIMES_CONSUMED">
<GuidCName>gEfiStatusCodeDataTypeStringGuid</GuidCName> <GuidCName>gEfiStatusCodeDataTypeStringGuid</GuidCName>
</GuidCNames> </GuidCNames>
<GuidCNames Usage="SOMETIMES_CONSUMED">
<GuidCName>gEfiStatusCodeSpecificDataGuid</GuidCName>
</GuidCNames>
<GuidCNames Usage="SOMETIMES_CONSUMED"> <GuidCNames Usage="SOMETIMES_CONSUMED">
<GuidCName>gEfiStatusCodeGuid</GuidCName> <GuidCName>gEfiStatusCodeGuid</GuidCName>
</GuidCNames> </GuidCNames>

View File

@ -34,7 +34,9 @@ RtMemoryStatusCodeInitializeWorker (
// //
RtMemoryStatusCodeTable = RtMemoryStatusCodeTable =
(RUNTIME_MEMORY_STATUSCODE_HEADER *) AllocatePool ( (RUNTIME_MEMORY_STATUSCODE_HEADER *) AllocatePool (
sizeof (RUNTIME_MEMORY_STATUSCODE_HEADER) + PcdGet16 (PcdStatusCodeRuntimeMemorySize) * 1024 sizeof (RUNTIME_MEMORY_STATUSCODE_HEADER) +
PcdGet16 (PcdStatusCodeRuntimeMemorySize) *
1024
); );
ASSERT (NULL != RtMemoryStatusCodeTable); ASSERT (NULL != RtMemoryStatusCodeTable);
@ -111,7 +113,6 @@ RtMemoryStatusCodeReportWorker (
RtMemoryStatusCodeTable->RecordIndex = 0; RtMemoryStatusCodeTable->RecordIndex = 0;
} }
return EFI_SUCCESS; return EFI_SUCCESS;
} }

View File

@ -15,7 +15,8 @@
**/ **/
EFI_SERIAL_IO_PROTOCOL *SerialIoProtocol; STATIC
EFI_SERIAL_IO_PROTOCOL *mSerialIoProtocol;
/** /**
Initialize serial status code worker. Initialize serial status code worker.
@ -33,7 +34,7 @@ EfiSerialStatusCodeInitializeWorker (
Status = gBS->LocateProtocol ( Status = gBS->LocateProtocol (
&gEfiSerialIoProtocolGuid, &gEfiSerialIoProtocolGuid,
NULL, NULL,
(VOID **) &SerialIoProtocol (VOID **) &mSerialIoProtocol
); );
ASSERT_EFI_ERROR (Status); ASSERT_EFI_ERROR (Status);
@ -67,7 +68,8 @@ EfiSerialStatusCodeInitializeWorker (
@param Data This optional parameter may be used to pass additional data @param Data This optional parameter may be used to pass additional data
@return The function always return EFI_SUCCESS. @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
@ -89,6 +91,11 @@ SerialStatusCodeReportWorker (
VA_LIST Marker; VA_LIST Marker;
EFI_DEBUG_INFO *DebugInfo; EFI_DEBUG_INFO *DebugInfo;
if (FeaturePcdGet (PcdStatusCodeUseEfiSerial) && EfiAtRuntime ()) {
return EFI_DEVICE_ERROR;
}
Buffer[0] = '\0'; Buffer[0] = '\0';
if (Data != NULL && if (Data != NULL &&
@ -130,10 +137,18 @@ SerialStatusCodeReportWorker (
// //
// Print ERROR information into output buffer. // Print ERROR information into output buffer.
// //
CharCount = AsciiSPrint (Buffer, EFI_STATUS_CODE_DATA_MAX_SIZE, "ERROR: C%x:V%x I%x", CodeType, Value, Instance); CharCount = AsciiSPrint (
Buffer,
EFI_STATUS_CODE_DATA_MAX_SIZE,
"ERROR: C%x:V%x I%x",
CodeType,
Value,
Instance
);
// //
// Make sure we don't try to print values that weren't intended to be printed, especially NULL GUID pointers. // 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) {
@ -145,7 +160,7 @@ SerialStatusCodeReportWorker (
); );
} }
if (Data) { if (Data != NULL) {
CharCount += AsciiSPrint ( CharCount += AsciiSPrint (
&Buffer[CharCount - 1], &Buffer[CharCount - 1],
(EFI_STATUS_CODE_DATA_MAX_SIZE - (sizeof (Buffer[0]) * CharCount)), (EFI_STATUS_CODE_DATA_MAX_SIZE - (sizeof (Buffer[0]) * CharCount)),
@ -160,9 +175,22 @@ 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) {
CharCount = AsciiSPrint (Buffer, EFI_STATUS_CODE_DATA_MAX_SIZE, "PROGRESS CODE: V%x I%x\n\r", Value, Instance); CharCount = AsciiSPrint (
Buffer,
EFI_STATUS_CODE_DATA_MAX_SIZE,
"PROGRESS CODE: V%x I%x\n\r",
Value,
Instance
);
} else { } else {
CharCount = AsciiSPrint (Buffer, EFI_STATUS_CODE_DATA_MAX_SIZE, "Undefined: C%x:V%x I%x\n\r", CodeType, Value, Instance); CharCount = AsciiSPrint (
Buffer,
EFI_STATUS_CODE_DATA_MAX_SIZE,
"Undefined: C%x:V%x I%x\n\r",
CodeType,
Value,
Instance
);
} }
@ -173,8 +201,8 @@ SerialStatusCodeReportWorker (
SerialPortWrite ((UINT8 *) Buffer, CharCount); SerialPortWrite ((UINT8 *) Buffer, CharCount);
} }
if (FeaturePcdGet (PcdStatusCodeUseEfiSerial)) { if (FeaturePcdGet (PcdStatusCodeUseEfiSerial)) {
SerialIoProtocol->Write ( mSerialIoProtocol->Write (
SerialIoProtocol, mSerialIoProtocol,
&CharCount, &CharCount,
Buffer Buffer
); );

View File

@ -20,7 +20,7 @@
@param PacketIndex Index of records packet. @param PacketIndex Index of records packet.
@return The function always return EFI_SUCCESS @return Always return pointer of memory status code packet.
**/ **/
MEMORY_STATUSCODE_PACKET_HEADER * MEMORY_STATUSCODE_PACKET_HEADER *
@ -36,7 +36,10 @@ CreateMemoryStatusCodePacket (
PacketHeader = PacketHeader =
(MEMORY_STATUSCODE_PACKET_HEADER *) BuildGuidHob ( (MEMORY_STATUSCODE_PACKET_HEADER *) BuildGuidHob (
&gMemoryStatusCodeRecordGuid, &gMemoryStatusCodeRecordGuid,
(PcdGet16 (PcdStatusCodeMemorySize) * 1024) + sizeof (MEMORY_STATUSCODE_PACKET_HEADER)); PcdGet16 (PcdStatusCodeMemorySize) *
1024 +
sizeof (MEMORY_STATUSCODE_PACKET_HEADER)
);
ASSERT (PacketHeader != NULL); ASSERT (PacketHeader != NULL);
PacketHeader->MaxRecordsNumber = (PcdGet16 (PcdStatusCodeMemorySize) * 1024)/ sizeof (MEMORY_STATUSCODE_RECORD); PacketHeader->MaxRecordsNumber = (PcdGet16 (PcdStatusCodeMemorySize) * 1024)/ sizeof (MEMORY_STATUSCODE_RECORD);

View File

@ -19,8 +19,8 @@
/** /**
Report status code to all supported device. Report status code to all supported device.
*
*
@param PeiServices @param PeiServices
@param Type Indicates the type of status code being reported. @param Type Indicates the type of status code being reported.
@ -53,11 +53,12 @@ ReportDispatcher (
IN EFI_STATUS_CODE_DATA *Data OPTIONAL IN EFI_STATUS_CODE_DATA *Data OPTIONAL
); );
STATIC
EFI_PEI_PROGRESS_CODE_PPI mStatusCodePpi = { EFI_PEI_PROGRESS_CODE_PPI mStatusCodePpi = {
ReportDispatcher ReportDispatcher
}; };
STATIC
EFI_PEI_PPI_DESCRIPTOR mStatusCodePpiDescriptor = { EFI_PEI_PPI_DESCRIPTOR mStatusCodePpiDescriptor = {
EFI_PEI_PPI_DESCRIPTOR_PPI | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST, EFI_PEI_PPI_DESCRIPTOR_PPI | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST,
&gEfiPeiStatusCodePpiGuid, &gEfiPeiStatusCodePpiGuid,
@ -66,8 +67,8 @@ EFI_PEI_PPI_DESCRIPTOR mStatusCodePpiDescriptor = {
/** /**
Report status code to all supported device. Report status code to all supported device.
*
*
@param PeiServices @param PeiServices
@param CodeType Indicates the type of status code being reported. @param CodeType Indicates the type of status code being reported.
@ -154,13 +155,16 @@ PeiStatusCodeDriverEntry (
// if enable UseOEM, then initialize Oem status code. // if enable UseOEM, then initialize Oem status code.
// //
if (FeaturePcdGet (PcdStatusCodeUseSerial)) { if (FeaturePcdGet (PcdStatusCodeUseSerial)) {
SerialPortInitialize(); Status = SerialPortInitialize();
ASSERT_EFI_ERROR (Status);
} }
if (FeaturePcdGet (PcdStatusCodeUseMemory)) { if (FeaturePcdGet (PcdStatusCodeUseMemory)) {
MemoryStatusCodeInitializeWorker (); Status = MemoryStatusCodeInitializeWorker ();
ASSERT_EFI_ERROR (Status);
} }
if (FeaturePcdGet (PcdStatusCodeUseOEM)) { if (FeaturePcdGet (PcdStatusCodeUseOEM)) {
OemHookStatusCodeInitialize (); Status = OemHookStatusCodeInitialize ();
ASSERT_EFI_ERROR (Status);
} }
// //

View File

@ -75,6 +75,9 @@
<GuidCNames Usage="SOMETIMES_CONSUMED"> <GuidCNames Usage="SOMETIMES_CONSUMED">
<GuidCName>gMemoryStatusCodeRecordGuid</GuidCName> <GuidCName>gMemoryStatusCodeRecordGuid</GuidCName>
</GuidCNames> </GuidCNames>
<GuidCNames Usage="SOMETIMES_CONSUMED">
<GuidCName>gEfiStatusCodeSpecificDataGuid</GuidCName>
</GuidCNames>
</Guids> </Guids>
<Externs> <Externs>
<Specification>EFI_SPECIFICATION_VERSION 0x00020000</Specification> <Specification>EFI_SPECIFICATION_VERSION 0x00020000</Specification>

View File

@ -103,7 +103,14 @@ SerialStatusCodeReportWorker (
// //
// Print ERROR information into output buffer. // Print ERROR information into output buffer.
// //
CharCount = AsciiSPrint (Buffer, EFI_STATUS_CODE_DATA_MAX_SIZE, "ERROR: C%x:V%x I%x", CodeType, Value, Instance); CharCount = AsciiSPrint (
Buffer,
EFI_STATUS_CODE_DATA_MAX_SIZE,
"ERROR: C%x:V%x I%x",
CodeType,
Value,
Instance
);
// //
// Make sure we don't try to print values that weren't intended to be printed, especially NULL GUID pointers. // Make sure we don't try to print values that weren't intended to be printed, especially NULL GUID pointers.
@ -133,9 +140,22 @@ 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) {
CharCount = AsciiSPrint (Buffer, EFI_STATUS_CODE_DATA_MAX_SIZE, "PROGRESS CODE: V%x I%x\n\r", Value, Instance); CharCount = AsciiSPrint (
Buffer,
EFI_STATUS_CODE_DATA_MAX_SIZE,
"PROGRESS CODE: V%x I%x\n\r",
Value,
Instance
);
} else { } else {
CharCount = AsciiSPrint (Buffer, EFI_STATUS_CODE_DATA_MAX_SIZE, "Undefined: C%x:V%x I%x\n\r", CodeType, Value, Instance); CharCount = AsciiSPrint (
Buffer,
EFI_STATUS_CODE_DATA_MAX_SIZE,
"Undefined: C%x:V%x I%x\n\r",
CodeType,
Value,
Instance
);
} }
// //