Since commit
19c6d9feaaf8 ("MdePkg: Expand BaseIoLibIntrinsic (IoLib
class) library", 2017-01-14), IoWriteFifo8() has been widely available to
modules. Use it to print debug messages and assertion failures to the QEMU
debug port, rather than open-coded loops.
In the general case this speeds up logging, because debug messages will
now trap to QEMU once per message (as opposed to once per character), due
to "REP OUTSB" in "MdePkg/Library/BaseIoLibIntrinsic/*/IoFifoSev.nasm".
In SEV guests, there is no speedup (SEV doesn't support the REP prefix).
SEV is detected internally to BaseIoLibIntrinsic.
Cc: Brijesh Singh <brijesh.singh@amd.com>
Cc: Jordan Justen <jordan.l.justen@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Acked-by: Brijesh Singh <brijesh.singh@amd.com>
{\r
CHAR8 Buffer[MAX_DEBUG_MESSAGE_LENGTH];\r
VA_LIST Marker;\r
{\r
CHAR8 Buffer[MAX_DEBUG_MESSAGE_LENGTH];\r
VA_LIST Marker;\r
\r
//\r
// If Format is NULL, then ASSERT().\r
\r
//\r
// If Format is NULL, then ASSERT().\r
// Convert the DEBUG() message to an ASCII String\r
//\r
VA_START (Marker, Format);\r
// Convert the DEBUG() message to an ASCII String\r
//\r
VA_START (Marker, Format);\r
- AsciiVSPrint (Buffer, sizeof (Buffer), Format, Marker);\r
+ Length = AsciiVSPrint (Buffer, sizeof (Buffer), Format, Marker);\r
VA_END (Marker);\r
\r
//\r
// Send the print string to the debug I/O port\r
//\r
VA_END (Marker);\r
\r
//\r
// Send the print string to the debug I/O port\r
//\r
- for (Ptr = (UINT8 *) Buffer; *Ptr; Ptr++) {\r
- IoWrite8 (PcdGet16(PcdDebugIoPort), *Ptr);\r
- }\r
+ IoWriteFifo8 (PcdGet16 (PcdDebugIoPort), Length, Buffer);\r
)\r
{\r
CHAR8 Buffer[MAX_DEBUG_MESSAGE_LENGTH];\r
)\r
{\r
CHAR8 Buffer[MAX_DEBUG_MESSAGE_LENGTH];\r
\r
//\r
// Generate the ASSERT() message in Ascii format\r
//\r
\r
//\r
// Generate the ASSERT() message in Ascii format\r
//\r
- AsciiSPrint (Buffer, sizeof Buffer, "ASSERT %a(%Lu): %a\n", FileName,\r
- (UINT64)LineNumber, Description);\r
+ Length = AsciiSPrint (Buffer, sizeof Buffer, "ASSERT %a(%Lu): %a\n",\r
+ FileName, (UINT64)LineNumber, Description);\r
- // Send the print string to the Console Output device\r
+ // Send the print string to the debug I/O port\r
- for (Ptr = (UINT8 *) Buffer; *Ptr; Ptr++) {\r
- IoWrite8 (PcdGet16(PcdDebugIoPort), *Ptr);\r
- }\r
+ IoWriteFifo8 (PcdGet16 (PcdDebugIoPort), Length, Buffer);\r
\r
//\r
// Generate a Breakpoint, DeadLoop, or NOP based on PCD settings\r
\r
//\r
// Generate a Breakpoint, DeadLoop, or NOP based on PCD settings\r