diff options
author | zwei4 <david.wei@intel.com> | 2017-09-06 14:32:09 +0800 |
---|---|---|
committer | zwei4 <david.wei@intel.com> | 2017-09-08 15:59:53 +0800 |
commit | 787000c45fbb200261b71ac56d973f9cf445eda6 (patch) | |
tree | c69161043194cc357456f0baba61716507039053 | |
parent | b2eadc332f263dc0274fb4bedd2e5491c4ed2497 (diff) | |
download | edk2-platforms-787000c45fbb200261b71ac56d973f9cf445eda6.tar.xz |
Clean up CMOS code.
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: zwei4 <david.wei@intel.com>
10 files changed, 15 insertions, 142 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]
diff --git a/Platform/BroxtonPlatformPkg/Common/Library/PlatformSecLib/Vtf0PlatformSecLib.inf b/Platform/BroxtonPlatformPkg/Common/Library/PlatformSecLib/Vtf0PlatformSecLib.inf index 0ef6ccee2d..0b9fb453ae 100644 --- a/Platform/BroxtonPlatformPkg/Common/Library/PlatformSecLib/Vtf0PlatformSecLib.inf +++ b/Platform/BroxtonPlatformPkg/Common/Library/PlatformSecLib/Vtf0PlatformSecLib.inf @@ -63,7 +63,6 @@ [LibraryClasses]
PerformanceLib
LocalApicLib
- CmosAccessLib
DebugLib
[Pcd.common]
diff --git a/Platform/BroxtonPlatformPkg/Common/PlatformSettings/PlatformDxe/Platform.c b/Platform/BroxtonPlatformPkg/Common/PlatformSettings/PlatformDxe/Platform.c index 7733dd0ac5..abe635d906 100644 --- a/Platform/BroxtonPlatformPkg/Common/PlatformSettings/PlatformDxe/Platform.c +++ b/Platform/BroxtonPlatformPkg/Common/PlatformSettings/PlatformDxe/Platform.c @@ -255,30 +255,6 @@ EnableAcpiCallback ( }
-#if (ENBDT_PF_ENABLE == 1) //BXTP
-VOID
-EFIAPI
-CheckCmosBatteryLost (
- VOID
- )
-{
- UINT8 Buffer8 = 0;
-
- if (!CheckCmosBatteryStatus ()) {
- Buffer8 = MmioRead8 (PMC_BASE_ADDRESS + R_PMC_GEN_PMCON_1);
-
- //
- // CMOS Battery then clear status
- //
- if (Buffer8 & B_PMC_GEN_PMCON_RTC_PWR_STS) {
- Buffer8 &= ~B_PMC_GEN_PMCON_RTC_PWR_STS;
- MmioWrite8 (PMC_BASE_ADDRESS + R_PMC_GEN_PMCON_1, Buffer8);
- }
- }
-}
-#endif //#if (ENBDT_PF_ENABLE == 1) //BXTP
-
-
VOID
PlatformScInitBeforeBoot (
VOID
@@ -877,7 +853,6 @@ InitializePlatform ( }
#if (ENBDT_PF_ENABLE == 1) //BXTP
- CheckCmosBatteryLost ();
#ifdef SENSOR_INFO_VAR_SUPPORT
InitializeSensorInfoVariable (); // Initialize Sensor Info variable
diff --git a/Platform/BroxtonPlatformPkg/Common/PlatformSettings/PlatformDxe/PlatformDxe.inf b/Platform/BroxtonPlatformPkg/Common/PlatformSettings/PlatformDxe/PlatformDxe.inf index 37eaf4623c..7516a15489 100644 --- a/Platform/BroxtonPlatformPkg/Common/PlatformSettings/PlatformDxe/PlatformDxe.inf +++ b/Platform/BroxtonPlatformPkg/Common/PlatformSettings/PlatformDxe/PlatformDxe.inf @@ -65,7 +65,6 @@ DxeSaPolicyLib
ConfigBlockLib
GpioLib
- BasePlatformCmosLib
[Guids]
gEfiBiosIdGuid
diff --git a/Platform/BroxtonPlatformPkg/PlatformDsc/LibraryClasses.IA32.PEI.dsc b/Platform/BroxtonPlatformPkg/PlatformDsc/LibraryClasses.IA32.PEI.dsc index d4617aa42e..7fa43ea832 100644 --- a/Platform/BroxtonPlatformPkg/PlatformDsc/LibraryClasses.IA32.PEI.dsc +++ b/Platform/BroxtonPlatformPkg/PlatformDsc/LibraryClasses.IA32.PEI.dsc @@ -61,7 +61,6 @@ FspPolicyInitLib|$(PLATFORM_PACKAGE_COMMON)/Library/PeiFspPolicyInitLib/PeiFspPolicyInitLib.inf
FspWrapperPlatformResetLib|$(PLATFORM_PACKAGE_COMMON)/FspSupport/Library/PeiFspWrapperPlatformResetLib/PeiFspWrapperPlatformResetLib.inf
- BasePlatformCmosLib|$(PLATFORM_PACKAGE_COMMON)/Library/PlatformCmosLib/PlatformCmosLib.inf
DebugPrintErrorLevelLib|MdePkg/Library/BaseDebugPrintErrorLevelLib/BaseDebugPrintErrorLevelLib.inf
Tcg2PhysicalPresenceLib|SecurityPkg/Library/PeiTcg2PhysicalPresenceLib/PeiTcg2PhysicalPresenceLib.inf
diff --git a/Platform/BroxtonPlatformPkg/PlatformDsc/LibraryClasses.dsc b/Platform/BroxtonPlatformPkg/PlatformDsc/LibraryClasses.dsc index a1023764e6..a4bc20973d 100644 --- a/Platform/BroxtonPlatformPkg/PlatformDsc/LibraryClasses.dsc +++ b/Platform/BroxtonPlatformPkg/PlatformDsc/LibraryClasses.dsc @@ -113,8 +113,6 @@ SynchronizationLib|MdePkg/Library/BaseSynchronizationLib/BaseSynchronizationLib.inf
SecurityManagementLib|MdeModulePkg/Library/DxeSecurityManagementLib/DxeSecurityManagementLib.inf
IoApicLib|PcAtChipsetPkg/Library/BaseIoApicLib/BaseIoApicLib.inf
- CmosAccessLib|$(PLATFORM_PACKAGE_COMMON)/Library/BaseCmosAccessLib/BaseCmosAccessLib.inf
- BaseCmosAccessLib|$(PLATFORM_PACKAGE_COMMON)/Library/BaseCmosAccessLib/BaseCmosAccessLib.inf
PostCodeLib|$(PLATFORM_PACKAGE_COMMON)/Library/BasePostCodeLibPort80Ex/BasePostCodeLibPort80Ex.inf
DebugPrintErrorLevelLib|MdePkg/Library/BaseDebugPrintErrorLevelLib/BaseDebugPrintErrorLevelLib.inf
!if $(USB_ENABLE) == TRUE
@@ -155,7 +153,6 @@ # Platform
#
ResetSystemLib|$(PLATFORM_PACKAGE_COMMON)/Library/ResetSystemLib/ResetSystemLib.inf
- PlatformCmosLib|$(PLATFORM_PACKAGE_COMMON)/Library/PlatformCmosLib/PlatformCmosLib.inf
PlatformPostCodeMapLib|$(PLATFORM_PACKAGE_COMMON)/Library/BasePlatformPostCodeMapLib/BasePlatformPostCodeMapLib.inf
TimerLib|$(PLATFORM_PACKAGE_COMMON)/Library/IntelScAcpiTimerLib/IntelScAcpiTimerLib.inf
@@ -190,7 +187,6 @@ PchSerialIoUartLib|$(PLATFORM_SI_PACKAGE)/SouthCluster/Library/PeiDxeSmmPchSerialIoUartLib/PeiDxeSmmPchSerialIoUartLib.inf
PchSerialIoLib|$(PLATFORM_SI_PACKAGE)/SouthCluster/Library/PeiDxeSmmPchSerialIoLib/PeiDxeSmmPchSerialIoLib.inf
- SerialPortParameterLib|$(PLATFORM_PACKAGE_COMMON)/Library/BaseSerialPortParameterLibCmos/BaseSerialPortParameterLibCmos.inf
BiosIdLib|$(PLATFORM_PACKAGE_COMMON)/Library/BiosIdLib/BiosIdLib.inf
CpuIA32Lib|$(PLATFORM_PACKAGE_COMMON)/Library/CpuIA32Lib/CpuIA32Lib.inf
@@ -235,8 +231,6 @@ !endif
SmmCpuPlatformHookLib|UefiCpuPkg/Library/SmmCpuPlatformHookLibNull/SmmCpuPlatformHookLibNull.inf
- BasePlatformCmosLib|$(PLATFORM_PACKAGE_COMMON)/Library/PlatformCmosLib/PlatformCmosLib.inf
-
PmicLib|$(PLATFORM_PACKAGE_COMMON)/Library/PmicLib/PmicLibNull.inf
#
diff --git a/Platform/BroxtonPlatformPkg/PlatformDsc/PcdsFixedAtBuild.dsc b/Platform/BroxtonPlatformPkg/PlatformDsc/PcdsFixedAtBuild.dsc index 793e285ae9..b7cefdca09 100644 --- a/Platform/BroxtonPlatformPkg/PlatformDsc/PcdsFixedAtBuild.dsc +++ b/Platform/BroxtonPlatformPkg/PlatformDsc/PcdsFixedAtBuild.dsc @@ -76,8 +76,6 @@ gEfiIntelFrameworkModulePkgTokenSpaceGuid.PcdBiosVideoCheckVbeEnable|TRUE
gEfiIntelFrameworkModulePkgTokenSpaceGuid.PcdBiosVideoCheckVgaEnable|TRUE
- #Overrides the CMOS Flag to disable ISA serial debug
- gClientCommonModuleTokenSpaceGuid.PcdStatusCodeFlagsCmosIndex|0x5C
gEfiBxtTokenSpaceGuid.PcdPmcGcrBaseAddress|0xFE043000
!if $(SOURCE_DEBUG_ENABLE) == TRUE
|