From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 86A1820945C1A for ; Fri, 8 Sep 2017 00:20:03 -0700 (PDT) Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by orsmga105.jf.intel.com with ESMTP; 08 Sep 2017 00:22:55 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.42,360,1500966000"; d="scan'208";a="149574851" Received: from zwei4-mobl1.ccr.corp.intel.com ([10.239.193.132]) by fmsmga006.fm.intel.com with ESMTP; 08 Sep 2017 00:22:54 -0700 From: zwei4 To: edk2-devel@lists.01.org Date: Fri, 8 Sep 2017 15:22:47 +0800 Message-Id: <20170908072248.23540-1-david.wei@intel.com> X-Mailer: git-send-email 2.14.1.windows.1 Subject: [Patch][edk2-platforms/devel-MinnowBoard3-UDK2017 1/2] Clean up CMOS code. X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Sep 2017 07:20:03 -0000 Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: zwei4 --- .../Library/BaseSerialPortLib/BaseSerialPortLib.c | 69 +++------------------- .../BaseSerialPortLib/BaseSerialPortLib.inf | 3 +- .../BaseSerialPortLib/BaseSerialPortLibNoInit.c | 46 ++------------- .../BaseSerialPortLib/BaseSerialPortLibNoInit.inf | 3 +- .../Library/PlatformSecLib/Vtf0PlatformSecLib.inf | 1 - .../Common/PlatformSettings/PlatformDxe/Platform.c | 25 -------- .../PlatformSettings/PlatformDxe/PlatformDxe.inf | 1 - .../PlatformDsc/LibraryClasses.IA32.PEI.dsc | 1 - .../PlatformDsc/LibraryClasses.dsc | 6 -- .../PlatformDsc/PcdsFixedAtBuild.dsc | 2 - 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 5fc9d8c71..2c63f9878 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.
+ Copyright (c) 2012 - 2017, 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 @@ -18,9 +18,7 @@ #include #include #include -#include #include -#include #include #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 0e78ab288..5ea0c4657 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.
+# Copyright (c) 2012 - 2017, 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 @@ -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 e7e8179d1..f9e96338b 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.
+ Copyright (c) 2012 - 2017, 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 @@ -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 8120ff26d..6a9cf86b2 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.
+# Copyright (c) 2012 - 2017, 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 @@ -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 0ef6ccee2..0b9fb453a 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 7733dd0ac..abe635d90 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 37eaf4623..7516a1548 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 d4617aa42..7fa43ea83 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 a1023764e..a4bc20973 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 793e285ae..b7cefdca0 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 -- 2.14.1.windows.1