summaryrefslogtreecommitdiff
path: root/Platform/BroxtonPlatformPkg/Common/Library/BaseSerialPortLib
diff options
context:
space:
mode:
authorzwei4 <david.wei@intel.com>2017-09-06 14:32:09 +0800
committerzwei4 <david.wei@intel.com>2017-09-08 15:59:53 +0800
commit787000c45fbb200261b71ac56d973f9cf445eda6 (patch)
treec69161043194cc357456f0baba61716507039053 /Platform/BroxtonPlatformPkg/Common/Library/BaseSerialPortLib
parentb2eadc332f263dc0274fb4bedd2e5491c4ed2497 (diff)
downloadedk2-platforms-787000c45fbb200261b71ac56d973f9cf445eda6.tar.xz
Clean up CMOS code.
Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: zwei4 <david.wei@intel.com>
Diffstat (limited to 'Platform/BroxtonPlatformPkg/Common/Library/BaseSerialPortLib')
-rw-r--r--Platform/BroxtonPlatformPkg/Common/Library/BaseSerialPortLib/BaseSerialPortLib.c69
-rw-r--r--Platform/BroxtonPlatformPkg/Common/Library/BaseSerialPortLib/BaseSerialPortLib.inf3
-rw-r--r--Platform/BroxtonPlatformPkg/Common/Library/BaseSerialPortLib/BaseSerialPortLibNoInit.c46
-rw-r--r--Platform/BroxtonPlatformPkg/Common/Library/BaseSerialPortLib/BaseSerialPortLibNoInit.inf3
4 files changed, 15 insertions, 106 deletions
diff --git a/Platform/BroxtonPlatformPkg/Common/Library/BaseSerialPortLib/BaseSerialPortLib.c b/Platform/BroxtonPlatformPkg/Common/Library/BaseSerialPortLib/BaseSerialPortLib.c
index 5fc9d8c71f..2c63f9878f 100644
--- a/Platform/BroxtonPlatformPkg/Common/Library/BaseSerialPortLib/BaseSerialPortLib.c
+++ b/Platform/BroxtonPlatformPkg/Common/Library/BaseSerialPortLib/BaseSerialPortLib.c
@@ -1,7 +1,7 @@
/** @file
Serial I/O Port library functions with no library constructor/destructor.
- Copyright (c) 2012 - 2016, Intel Corporation. All rights reserved.<BR>
+ Copyright (c) 2012 - 2017, 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
@@ -18,9 +18,7 @@
#include <Library/IoLib.h>
#include <Library/PcdLib.h>
#include <Library/SerialPortLib.h>
-#include <Library/SerialPortParameterLib.h>
#include <Library/PlatformHookLib.h>
-#include <Library/CmosAccessLib.h>
#include <Library/ScSerialIoUartLib.h>
#ifdef TRACE_HUB_DEBUGLIB_USAGE
@@ -104,13 +102,12 @@ UARTInitialize (
//
// Calculate divisor for baud generator
//
- BaudRate = GetSerialPortBaudRate ();
+ BaudRate = PcdGet32 (PcdSerialBaudRate);
if ((BaudRate == 0) || ((BaudRate % 9600) != 0)) {
//
// If Serail Baud Rate is not valid, set it to the default value
//
BaudRate = PcdGet32 (PcdSerialBaudRate);
- SetSerialPortBaudRate (BaudRate);
}
Divisor = MAX_BAUD_RATE / BaudRate;
@@ -174,23 +171,8 @@ SerialPortInitialize (
VOID
)
{
- UINT8 CmosStatusCodeFlags;
- CmosStatusCodeFlags = GetDebugInterface ();
- if ((!(CmosStatusCodeFlags & STATUS_CODE_CMOS_VALID)) || (CmosStatusCodeFlags & STATUS_CODE_CMOS_INVALID)) {
- CmosStatusCodeFlags = STATUS_CODE_USE_SERIALIO | STATUS_CODE_CMOS_VALID;
- SetDebugInterface (CmosStatusCodeFlags);
- }
- //
- // no init for MEM
- //
-
- if (CmosStatusCodeFlags & STATUS_CODE_USE_SERIALIO) {
- PchSerialIoUartInit (PcdGet8 (PcdSerialIoUartNumber), TRUE, 115200, 3, FALSE);
- }
- //
- // no init for TRACEHUB
- //
+ PchSerialIoUartInit (PcdGet8 (PcdSerialIoUartNumber), TRUE, 115200, 3, FALSE);
return RETURN_SUCCESS;
}
@@ -307,19 +289,8 @@ SerialPortWrite (
IN UINTN NumberOfBytes
)
{
- UINT8 CmosStatusCodeFlags;
- CmosStatusCodeFlags = GetDebugInterface ();
- if ((!(CmosStatusCodeFlags & STATUS_CODE_CMOS_VALID)) || (CmosStatusCodeFlags & STATUS_CODE_CMOS_INVALID)) {
- //
- // invalid cmos value, it means action was attempted before Init
- //
- return RETURN_NOT_READY;
- }
-
- if (CmosStatusCodeFlags & STATUS_CODE_USE_SERIALIO) {
- PchSerialIoUartOut (PcdGet8 (PcdSerialIoUartNumber), Buffer, NumberOfBytes);
- }
+ PchSerialIoUartOut (PcdGet8 (PcdSerialIoUartNumber), Buffer, NumberOfBytes);
return RETURN_SUCCESS;
}
@@ -399,21 +370,9 @@ SerialPortRead (
IN UINTN NumberOfBytes
)
{
- UINT8 CmosStatusCodeFlags;
-
- CmosStatusCodeFlags = GetDebugInterface ();
- if ((!(CmosStatusCodeFlags & STATUS_CODE_CMOS_VALID)) || (CmosStatusCodeFlags & STATUS_CODE_CMOS_INVALID)) {
- //
- // invalid cmos value, it means action was attempted before Init
- //
- return RETURN_NOT_READY;
- }
-
-
- if (CmosStatusCodeFlags & STATUS_CODE_USE_SERIALIO) {
- PchSerialIoUartIn (PcdGet8 (PcdSerialIoUartNumber), Buffer, NumberOfBytes, FALSE);
- }
+ PchSerialIoUartIn (PcdGet8 (PcdSerialIoUartNumber), Buffer, NumberOfBytes, FALSE);
+
return RETURN_SUCCESS;
}
@@ -475,23 +434,11 @@ SerialPortPoll (
VOID
)
{
- UINT8 CmosStatusCodeFlags;
- BOOLEAN Status;
-
- CmosStatusCodeFlags = GetDebugInterface ();
- if ((!(CmosStatusCodeFlags & STATUS_CODE_CMOS_VALID)) || (CmosStatusCodeFlags & STATUS_CODE_CMOS_INVALID)) {
- //
- // invalid cmos value, it means action was attempted before Init
- //
- return FALSE;
- }
+ BOOLEAN Status;
Status = FALSE;
-
- if (CmosStatusCodeFlags & STATUS_CODE_USE_SERIALIO) {
- Status |= PchSerialIoUartPoll (PcdGet8 (PcdSerialIoUartNumber));
- }
+ Status |= PchSerialIoUartPoll (PcdGet8 (PcdSerialIoUartNumber));
return Status;
}
diff --git a/Platform/BroxtonPlatformPkg/Common/Library/BaseSerialPortLib/BaseSerialPortLib.inf b/Platform/BroxtonPlatformPkg/Common/Library/BaseSerialPortLib/BaseSerialPortLib.inf
index 0e78ab2887..5ea0c46577 100644
--- a/Platform/BroxtonPlatformPkg/Common/Library/BaseSerialPortLib/BaseSerialPortLib.inf
+++ b/Platform/BroxtonPlatformPkg/Common/Library/BaseSerialPortLib/BaseSerialPortLib.inf
@@ -1,7 +1,7 @@
## @file
# Component description file for Serial I/O Port library functions.
#
-# Copyright (c) 2012 - 2016, Intel Corporation. All rights reserved.<BR>
+# Copyright (c) 2012 - 2017, 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
@@ -32,7 +32,6 @@
IoLib
PciLib
TimerLib
- SerialPortParameterLib
PchSerialIoUartLib
[Packages]
diff --git a/Platform/BroxtonPlatformPkg/Common/Library/BaseSerialPortLib/BaseSerialPortLibNoInit.c b/Platform/BroxtonPlatformPkg/Common/Library/BaseSerialPortLib/BaseSerialPortLibNoInit.c
index e7e8179d1c..f9e96338b0 100644
--- a/Platform/BroxtonPlatformPkg/Common/Library/BaseSerialPortLib/BaseSerialPortLibNoInit.c
+++ b/Platform/BroxtonPlatformPkg/Common/Library/BaseSerialPortLib/BaseSerialPortLibNoInit.c
@@ -1,7 +1,7 @@
/** @file
Serial I/O Port library functions with no library constructor/destructor.
- Copyright (c) 2012 - 2016, Intel Corporation. All rights reserved.<BR>
+ Copyright (c) 2012 - 2017, 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
@@ -198,21 +198,8 @@ SerialPortWrite (
IN UINTN NumberOfBytes
)
{
- UINT8 CmosStatusCodeFlags;
- CmosStatusCodeFlags = GetDebugInterface ();
-
- if ((!(CmosStatusCodeFlags & STATUS_CODE_CMOS_VALID)) || (CmosStatusCodeFlags & STATUS_CODE_CMOS_INVALID)) {
-
- //
- // invalid cmos value, it means action was attempted before Init
- //
- return RETURN_NOT_READY;
- }
-
- if (CmosStatusCodeFlags & STATUS_CODE_USE_SERIALIO) {
- PchSerialIoUartOut (PcdGet8 (PcdSerialIoUartNumber), Buffer, NumberOfBytes);
- }
+ PchSerialIoUartOut (PcdGet8 (PcdSerialIoUartNumber), Buffer, NumberOfBytes);
return RETURN_SUCCESS;
}
@@ -293,21 +280,9 @@ SerialPortRead (
IN UINTN NumberOfBytes
)
{
- UINT8 CmosStatusCodeFlags;
-
- CmosStatusCodeFlags = GetDebugInterface ();
- if ((!(CmosStatusCodeFlags & STATUS_CODE_CMOS_VALID)) || (CmosStatusCodeFlags & STATUS_CODE_CMOS_INVALID)) {
-
- //
- // invalid cmos value, it means action was attempted before Init
- //
- return RETURN_NOT_READY;
- }
+ PchSerialIoUartIn (PcdGet8 (PcdSerialIoUartNumber), Buffer, NumberOfBytes, FALSE);
- if (CmosStatusCodeFlags & STATUS_CODE_USE_SERIALIO) {
- PchSerialIoUartIn (PcdGet8 (PcdSerialIoUartNumber), Buffer, NumberOfBytes, FALSE);
- }
return RETURN_SUCCESS;
}
@@ -369,23 +344,12 @@ SerialPortPoll (
VOID
)
{
- UINT8 CmosStatusCodeFlags;
- BOOLEAN Status;
-
- CmosStatusCodeFlags = GetDebugInterface ();
- if ((!(CmosStatusCodeFlags & STATUS_CODE_CMOS_VALID)) || (CmosStatusCodeFlags & STATUS_CODE_CMOS_INVALID)) {
- //
- // invalid cmos value, it means action was attempted before Init
- //
- return FALSE;
- }
+ BOOLEAN Status;
Status = FALSE;
- if (CmosStatusCodeFlags & STATUS_CODE_USE_SERIALIO) {
- Status |= PchSerialIoUartPoll (PcdGet8 (PcdSerialIoUartNumber));
- }
+ Status |= PchSerialIoUartPoll (PcdGet8 (PcdSerialIoUartNumber));
return Status;
}
diff --git a/Platform/BroxtonPlatformPkg/Common/Library/BaseSerialPortLib/BaseSerialPortLibNoInit.inf b/Platform/BroxtonPlatformPkg/Common/Library/BaseSerialPortLib/BaseSerialPortLibNoInit.inf
index 8120ff26dd..6a9cf86b25 100644
--- a/Platform/BroxtonPlatformPkg/Common/Library/BaseSerialPortLib/BaseSerialPortLibNoInit.inf
+++ b/Platform/BroxtonPlatformPkg/Common/Library/BaseSerialPortLib/BaseSerialPortLibNoInit.inf
@@ -1,7 +1,7 @@
## @file
# Component description file for Serial I/O Port library functions.
#
-# Copyright (c) 2012 - 2016, Intel Corporation. All rights reserved.<BR>
+# Copyright (c) 2012 - 2017, 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
@@ -32,7 +32,6 @@
IoLib
PciLib
TimerLib
- SerialPortParameterLib
PchSerialIoUartLib
[Packages]