From: mdkinney Date: Sat, 18 Dec 2010 00:24:34 +0000 (+0000) Subject: Add CONSTRUCTOR to BaseDebugLibSerialPort to call SerialPortInitialize() in the Seria... X-Git-Tag: edk2-stable201903~15292 X-Git-Url: https://git.proxmox.com/?p=mirror_edk2.git;a=commitdiff_plain;h=ccc96db96eca4c65f0172adcdbdfb211b4e703ed Add CONSTRUCTOR to BaseDebugLibSerialPort to call SerialPortInitialize() in the SerialPortLib to make sure the serial port hardware is in the proper state for use. git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@11183 6f19259b-4bc3-4df7-8a09-765794883524 --- diff --git a/MdePkg/Library/BaseDebugLibSerialPort/BaseDebugLibSerialPort.inf b/MdePkg/Library/BaseDebugLibSerialPort/BaseDebugLibSerialPort.inf index dd2a014db4..be636c89a2 100644 --- a/MdePkg/Library/BaseDebugLibSerialPort/BaseDebugLibSerialPort.inf +++ b/MdePkg/Library/BaseDebugLibSerialPort/BaseDebugLibSerialPort.inf @@ -21,6 +21,7 @@ MODULE_TYPE = BASE VERSION_STRING = 1.0 LIBRARY_CLASS = DebugLib + CONSTRUCTOR = BaseDebugLibSerialPortConstructor # # VALID_ARCHITECTURES = IA32 X64 IPF EBC diff --git a/MdePkg/Library/BaseDebugLibSerialPort/DebugLib.c b/MdePkg/Library/BaseDebugLibSerialPort/DebugLib.c index 2e1eb5be1a..b54fa15d98 100644 --- a/MdePkg/Library/BaseDebugLibSerialPort/DebugLib.c +++ b/MdePkg/Library/BaseDebugLibSerialPort/DebugLib.c @@ -1,8 +1,13 @@ /** @file Base Debug library instance base on Serial Port library. It uses PrintLib to send debug messages to serial port device. + + NOTE: If the Serial Port library enables hardware flow control, then a call + to DebugPrint() or DebugAssert() may hang if writes to the serial port are + being blocked. This may occur if a key(s) are pressed in a terminal emulator + used to monitor the DEBUG() and ASSERT() messages. - Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.
+ Copyright (c) 2006 - 2010, 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,6 +31,21 @@ // #define MAX_DEBUG_MESSAGE_LENGTH 0x100 +/** + The constructor function initialize the Serial Port Library + + @retval EFI_SUCCESS The constructor always returns RETURN_SUCCESS. + +**/ +RETURN_STATUS +EFIAPI +BaseDebugLibSerialPortConstructor ( + VOID + ) +{ + return SerialPortInitialize (); +} + /** Prints a debug message to the debug output device if the specified error level is enabled. @@ -60,7 +80,7 @@ DebugPrint ( // // Check driver debug mask value and global mask // - if ((ErrorLevel & PcdGet32(PcdDebugPrintErrorLevel)) == 0) { + if ((ErrorLevel & PcdGet32 (PcdDebugPrintErrorLevel)) == 0) { return; } @@ -74,7 +94,7 @@ DebugPrint ( // // Send the print string to a Serial Port // - SerialPortWrite ((UINT8 *) Buffer, AsciiStrLen(Buffer)); + SerialPortWrite ((UINT8 *)Buffer, AsciiStrLen (Buffer)); } @@ -117,7 +137,7 @@ DebugAssert ( // // Send the print string to the Console Output device // - SerialPortWrite ((UINT8 *) Buffer, AsciiStrLen(Buffer)); + SerialPortWrite ((UINT8 *)Buffer, AsciiStrLen (Buffer)); // // Generate a Breakpoint, DeadLoop, or NOP based on PCD settings