mirror of https://github.com/acidanthera/audk.git
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:
parent
5f4eb6b6d5
commit
a93763b74d
|
@ -22,8 +22,11 @@
|
|||
|
||||
Initialize OEM status code device .
|
||||
|
||||
|
||||
@return Status of initialization of OEM status code device.
|
||||
|
||||
**/
|
||||
VOID
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
OemHookStatusCodeInitialize (
|
||||
VOID
|
||||
|
|
|
@ -22,6 +22,8 @@
|
|||
|
||||
Programmed hardware of Serial port.
|
||||
|
||||
@return Status of Serial Port Device initialization.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
|
|
|
@ -18,14 +18,16 @@
|
|||
|
||||
Initialize OEM status code device .
|
||||
|
||||
@return Always return EFI_SUCCESS.
|
||||
|
||||
**/
|
||||
VOID
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
OemHookStatusCodeInitialize (
|
||||
VOID
|
||||
)
|
||||
{
|
||||
return;
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -53,7 +55,7 @@ OemHookStatusCodeInitialize (
|
|||
|
||||
@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
|
||||
|
|
|
@ -53,6 +53,7 @@ ReportDispatcher (
|
|||
//
|
||||
// Declaration of status code protocol.
|
||||
//
|
||||
STATIC
|
||||
EFI_STATUS_CODE_PROTOCOL mEfiStatusCodeProtocol = {
|
||||
ReportDispatcher
|
||||
};
|
||||
|
|
|
@ -18,14 +18,18 @@
|
|||
//
|
||||
// Initialize FIFO to cache records.
|
||||
//
|
||||
STATIC
|
||||
EFI_LOCK mFifoLock = EFI_INITIALIZE_LOCK_VARIABLE (EFI_TPL_HIGH_LEVEL);
|
||||
STATIC
|
||||
LIST_ENTRY mRecordsFifo = INITIALIZE_LIST_HEAD_VARIABLE (mRecordsFifo);
|
||||
STATIC
|
||||
UINTN mNumberOfRecords = 0;
|
||||
|
||||
STATIC
|
||||
EFI_EVENT mLogDataHubEvent;
|
||||
//
|
||||
// Cache data hub protocol.
|
||||
//
|
||||
STATIC
|
||||
EFI_DATA_HUB_PROTOCOL *mDataHubProtocol;
|
||||
|
||||
|
||||
|
|
|
@ -40,6 +40,7 @@ InitializationDispatcherWorker (
|
|||
)
|
||||
{
|
||||
EFI_PEI_HOB_POINTERS Hob;
|
||||
EFI_STATUS Status;
|
||||
MEMORY_STATUSCODE_PACKET_HEADER *PacketHeader;
|
||||
MEMORY_STATUSCODE_RECORD *Record;
|
||||
UINTN ExpectedPacketIndex = 0;
|
||||
|
@ -52,19 +53,24 @@ InitializationDispatcherWorker (
|
|||
// if enable UseDataHub, then initialize data hub status code worker.
|
||||
//
|
||||
if (FeaturePcdGet (PcdStatusCodeUseEfiSerial)) {
|
||||
EfiSerialStatusCodeInitializeWorker ();
|
||||
Status = EfiSerialStatusCodeInitializeWorker ();
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
}
|
||||
if (FeaturePcdGet (PcdStatusCodeUseHardSerial)) {
|
||||
SerialPortInitialize ();
|
||||
Status = SerialPortInitialize ();
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
}
|
||||
if (FeaturePcdGet (PcdStatusCodeUseRuntimeMemory)) {
|
||||
RtMemoryStatusCodeInitializeWorker ();
|
||||
Status = RtMemoryStatusCodeInitializeWorker ();
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
}
|
||||
if (FeaturePcdGet (PcdStatusCodeUseDataHub)) {
|
||||
DataHubStatusCodeInitializeWorker ();
|
||||
Status = DataHubStatusCodeInitializeWorker ();
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
}
|
||||
if (FeaturePcdGet (PcdStatusCodeUseOEM)) {
|
||||
OemHookStatusCodeInitialize ();
|
||||
Status = OemHookStatusCodeInitialize ();
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
}
|
||||
|
||||
//
|
||||
|
|
|
@ -119,6 +119,9 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
|||
<GuidCNames Usage="SOMETIMES_CONSUMED">
|
||||
<GuidCName>gEfiStatusCodeDataTypeStringGuid</GuidCName>
|
||||
</GuidCNames>
|
||||
<GuidCNames Usage="SOMETIMES_CONSUMED">
|
||||
<GuidCName>gEfiStatusCodeSpecificDataGuid</GuidCName>
|
||||
</GuidCNames>
|
||||
<GuidCNames Usage="SOMETIMES_CONSUMED">
|
||||
<GuidCName>gEfiStatusCodeGuid</GuidCName>
|
||||
</GuidCNames>
|
||||
|
|
|
@ -34,7 +34,9 @@ RtMemoryStatusCodeInitializeWorker (
|
|||
//
|
||||
RtMemoryStatusCodeTable =
|
||||
(RUNTIME_MEMORY_STATUSCODE_HEADER *) AllocatePool (
|
||||
sizeof (RUNTIME_MEMORY_STATUSCODE_HEADER) + PcdGet16 (PcdStatusCodeRuntimeMemorySize) * 1024
|
||||
sizeof (RUNTIME_MEMORY_STATUSCODE_HEADER) +
|
||||
PcdGet16 (PcdStatusCodeRuntimeMemorySize) *
|
||||
1024
|
||||
);
|
||||
|
||||
ASSERT (NULL != RtMemoryStatusCodeTable);
|
||||
|
@ -111,7 +113,6 @@ RtMemoryStatusCodeReportWorker (
|
|||
RtMemoryStatusCodeTable->RecordIndex = 0;
|
||||
}
|
||||
|
||||
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
|
|
|
@ -15,7 +15,8 @@
|
|||
|
||||
**/
|
||||
|
||||
EFI_SERIAL_IO_PROTOCOL *SerialIoProtocol;
|
||||
STATIC
|
||||
EFI_SERIAL_IO_PROTOCOL *mSerialIoProtocol;
|
||||
|
||||
/**
|
||||
Initialize serial status code worker.
|
||||
|
@ -33,7 +34,7 @@ EfiSerialStatusCodeInitializeWorker (
|
|||
Status = gBS->LocateProtocol (
|
||||
&gEfiSerialIoProtocolGuid,
|
||||
NULL,
|
||||
(VOID **) &SerialIoProtocol
|
||||
(VOID **) &mSerialIoProtocol
|
||||
);
|
||||
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
|
@ -67,7 +68,8 @@ EfiSerialStatusCodeInitializeWorker (
|
|||
|
||||
@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
|
||||
|
@ -89,6 +91,11 @@ SerialStatusCodeReportWorker (
|
|||
VA_LIST Marker;
|
||||
EFI_DEBUG_INFO *DebugInfo;
|
||||
|
||||
|
||||
if (FeaturePcdGet (PcdStatusCodeUseEfiSerial) && EfiAtRuntime ()) {
|
||||
return EFI_DEVICE_ERROR;
|
||||
}
|
||||
|
||||
Buffer[0] = '\0';
|
||||
|
||||
if (Data != NULL &&
|
||||
|
@ -130,10 +137,18 @@ SerialStatusCodeReportWorker (
|
|||
//
|
||||
// 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) {
|
||||
|
@ -145,7 +160,7 @@ SerialStatusCodeReportWorker (
|
|||
);
|
||||
}
|
||||
|
||||
if (Data) {
|
||||
if (Data != NULL) {
|
||||
CharCount += AsciiSPrint (
|
||||
&Buffer[CharCount - 1],
|
||||
(EFI_STATUS_CODE_DATA_MAX_SIZE - (sizeof (Buffer[0]) * CharCount)),
|
||||
|
@ -160,9 +175,22 @@ SerialStatusCodeReportWorker (
|
|||
"\n\r"
|
||||
);
|
||||
} 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 {
|
||||
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);
|
||||
}
|
||||
if (FeaturePcdGet (PcdStatusCodeUseEfiSerial)) {
|
||||
SerialIoProtocol->Write (
|
||||
SerialIoProtocol,
|
||||
mSerialIoProtocol->Write (
|
||||
mSerialIoProtocol,
|
||||
&CharCount,
|
||||
Buffer
|
||||
);
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
|
||||
@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 *
|
||||
|
@ -36,7 +36,10 @@ CreateMemoryStatusCodePacket (
|
|||
PacketHeader =
|
||||
(MEMORY_STATUSCODE_PACKET_HEADER *) BuildGuidHob (
|
||||
&gMemoryStatusCodeRecordGuid,
|
||||
(PcdGet16 (PcdStatusCodeMemorySize) * 1024) + sizeof (MEMORY_STATUSCODE_PACKET_HEADER));
|
||||
PcdGet16 (PcdStatusCodeMemorySize) *
|
||||
1024 +
|
||||
sizeof (MEMORY_STATUSCODE_PACKET_HEADER)
|
||||
);
|
||||
ASSERT (PacketHeader != NULL);
|
||||
|
||||
PacketHeader->MaxRecordsNumber = (PcdGet16 (PcdStatusCodeMemorySize) * 1024)/ sizeof (MEMORY_STATUSCODE_RECORD);
|
||||
|
|
|
@ -19,8 +19,8 @@
|
|||
|
||||
/**
|
||||
Report status code to all supported device.
|
||||
*
|
||||
*
|
||||
|
||||
|
||||
@param PeiServices
|
||||
|
||||
@param Type Indicates the type of status code being reported.
|
||||
|
@ -53,11 +53,12 @@ ReportDispatcher (
|
|||
IN EFI_STATUS_CODE_DATA *Data OPTIONAL
|
||||
);
|
||||
|
||||
|
||||
STATIC
|
||||
EFI_PEI_PROGRESS_CODE_PPI mStatusCodePpi = {
|
||||
ReportDispatcher
|
||||
};
|
||||
|
||||
STATIC
|
||||
EFI_PEI_PPI_DESCRIPTOR mStatusCodePpiDescriptor = {
|
||||
EFI_PEI_PPI_DESCRIPTOR_PPI | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST,
|
||||
&gEfiPeiStatusCodePpiGuid,
|
||||
|
@ -66,8 +67,8 @@ EFI_PEI_PPI_DESCRIPTOR mStatusCodePpiDescriptor = {
|
|||
|
||||
/**
|
||||
Report status code to all supported device.
|
||||
*
|
||||
*
|
||||
|
||||
|
||||
@param PeiServices
|
||||
|
||||
@param CodeType Indicates the type of status code being reported.
|
||||
|
@ -154,13 +155,16 @@ PeiStatusCodeDriverEntry (
|
|||
// if enable UseOEM, then initialize Oem status code.
|
||||
//
|
||||
if (FeaturePcdGet (PcdStatusCodeUseSerial)) {
|
||||
SerialPortInitialize();
|
||||
Status = SerialPortInitialize();
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
}
|
||||
if (FeaturePcdGet (PcdStatusCodeUseMemory)) {
|
||||
MemoryStatusCodeInitializeWorker ();
|
||||
Status = MemoryStatusCodeInitializeWorker ();
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
}
|
||||
if (FeaturePcdGet (PcdStatusCodeUseOEM)) {
|
||||
OemHookStatusCodeInitialize ();
|
||||
Status = OemHookStatusCodeInitialize ();
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
}
|
||||
|
||||
//
|
||||
|
|
|
@ -75,6 +75,9 @@
|
|||
<GuidCNames Usage="SOMETIMES_CONSUMED">
|
||||
<GuidCName>gMemoryStatusCodeRecordGuid</GuidCName>
|
||||
</GuidCNames>
|
||||
<GuidCNames Usage="SOMETIMES_CONSUMED">
|
||||
<GuidCName>gEfiStatusCodeSpecificDataGuid</GuidCName>
|
||||
</GuidCNames>
|
||||
</Guids>
|
||||
<Externs>
|
||||
<Specification>EFI_SPECIFICATION_VERSION 0x00020000</Specification>
|
||||
|
|
|
@ -103,7 +103,14 @@ SerialStatusCodeReportWorker (
|
|||
//
|
||||
// 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.
|
||||
|
@ -133,9 +140,22 @@ SerialStatusCodeReportWorker (
|
|||
"\n\r"
|
||||
);
|
||||
} 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 {
|
||||
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
|
||||
);
|
||||
}
|
||||
|
||||
//
|
||||
|
|
Loading…
Reference in New Issue