summaryrefslogtreecommitdiffstats
path: root/MdePkg
diff options
context:
space:
mode:
authormdkinney <mdkinney@6f19259b-4bc3-4df7-8a09-765794883524>2010-12-18 00:24:34 +0000
committermdkinney <mdkinney@6f19259b-4bc3-4df7-8a09-765794883524>2010-12-18 00:24:34 +0000
commitccc96db96eca4c65f0172adcdbdfb211b4e703ed (patch)
treef1187804a7f8bd656b70ced39bfdcc5791bf4ad1 /MdePkg
parentb35a5f731c499f1fb5b6817c77ceaff4ef0f896b (diff)
downloadedk2-ccc96db96eca4c65f0172adcdbdfb211b4e703ed.tar.gz
edk2-ccc96db96eca4c65f0172adcdbdfb211b4e703ed.tar.bz2
edk2-ccc96db96eca4c65f0172adcdbdfb211b4e703ed.zip
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
Diffstat (limited to 'MdePkg')
-rw-r--r--MdePkg/Library/BaseDebugLibSerialPort/BaseDebugLibSerialPort.inf1
-rw-r--r--MdePkg/Library/BaseDebugLibSerialPort/DebugLib.c28
2 files changed, 25 insertions, 4 deletions
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.<BR>
+ Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>
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
@@ -27,6 +32,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.
If any bit in ErrorLevel is also set in PcdDebugPrintErrorLevel, then print
@@ -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