* [Patch][edk2-platforms/devel-MinnowBoard3-UDK2017 1/2] Clean up CMOS code.
@ 2017-09-08 7:22 zwei4
2017-09-08 7:22 ` [Patch][edk2-platforms/devel-MinnowBoard3-UDK2017 2/2] BroxtonPlatformPkg: RTC initialize zwei4
0 siblings, 1 reply; 2+ messages in thread
From: zwei4 @ 2017-09-08 7:22 UTC (permalink / raw)
To: edk2-devel
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: zwei4 <david.wei@intel.com>
---
.../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.<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 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.<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 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.<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 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.<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 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
^ permalink raw reply related [flat|nested] 2+ messages in thread
* [Patch][edk2-platforms/devel-MinnowBoard3-UDK2017 2/2] BroxtonPlatformPkg: RTC initialize
2017-09-08 7:22 [Patch][edk2-platforms/devel-MinnowBoard3-UDK2017 1/2] Clean up CMOS code zwei4
@ 2017-09-08 7:22 ` zwei4
0 siblings, 0 replies; 2+ messages in thread
From: zwei4 @ 2017-09-08 7:22 UTC (permalink / raw)
To: edk2-devel
Force RTC century to 20 in case core driver has failed to
initialize it.
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: zwei4 <david.wei@intel.com>
---
.../Common/PlatformSettings/PlatformDxe/Platform.c | 5 +++
.../PlatformSettings/PlatformDxe/PlatformDxe.h | 6 +++
.../PlatformSettings/PlatformDxe/PlatformDxe.inf | 1 +
.../Common/PlatformSettings/PlatformDxe/Rtc.c | 51 ++++++++++++++++++++++
4 files changed, 63 insertions(+)
create mode 100644 Platform/BroxtonPlatformPkg/Common/PlatformSettings/PlatformDxe/Rtc.c
diff --git a/Platform/BroxtonPlatformPkg/Common/PlatformSettings/PlatformDxe/Platform.c b/Platform/BroxtonPlatformPkg/Common/PlatformSettings/PlatformDxe/Platform.c
index abe635d90..a6d251ded 100644
--- a/Platform/BroxtonPlatformPkg/Common/PlatformSettings/PlatformDxe/Platform.c
+++ b/Platform/BroxtonPlatformPkg/Common/PlatformSettings/PlatformDxe/Platform.c
@@ -390,6 +390,11 @@ ReadyToBootFunction (
mPciLanInfo = NULL;
}
+ //
+ // Set RTC century in case RTC core driver failed to initialize it.
+ //
+ AdjustRtcCentury ();
+
return;
}
diff --git a/Platform/BroxtonPlatformPkg/Common/PlatformSettings/PlatformDxe/PlatformDxe.h b/Platform/BroxtonPlatformPkg/Common/PlatformSettings/PlatformDxe/PlatformDxe.h
index 1475c4cab..a27277bb7 100644
--- a/Platform/BroxtonPlatformPkg/Common/PlatformSettings/PlatformDxe/PlatformDxe.h
+++ b/Platform/BroxtonPlatformPkg/Common/PlatformSettings/PlatformDxe/PlatformDxe.h
@@ -235,6 +235,12 @@ InitSioPlatformPolicy (
VOID
);
+VOID
+EFIAPI
+AdjustRtcCentury (
+ VOID
+ );
+
//
// Global externs
//
diff --git a/Platform/BroxtonPlatformPkg/Common/PlatformSettings/PlatformDxe/PlatformDxe.inf b/Platform/BroxtonPlatformPkg/Common/PlatformSettings/PlatformDxe/PlatformDxe.inf
index 7516a1548..ee8fd5a68 100644
--- a/Platform/BroxtonPlatformPkg/Common/PlatformSettings/PlatformDxe/PlatformDxe.inf
+++ b/Platform/BroxtonPlatformPkg/Common/PlatformSettings/PlatformDxe/PlatformDxe.inf
@@ -33,6 +33,7 @@
PciDevice.c
IchTcoReset.c
SensorVar.c
+ Rtc.c
[Packages]
MdePkg/MdePkg.dec
diff --git a/Platform/BroxtonPlatformPkg/Common/PlatformSettings/PlatformDxe/Rtc.c b/Platform/BroxtonPlatformPkg/Common/PlatformSettings/PlatformDxe/Rtc.c
new file mode 100644
index 000000000..4b6ab285e
--- /dev/null
+++ b/Platform/BroxtonPlatformPkg/Common/PlatformSettings/PlatformDxe/Rtc.c
@@ -0,0 +1,51 @@
+/** @file
+ Adjust Default System Time.
+
+ Copyright (c) 2015 - 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 that accompanies this distribution.
+ The full text of the license may be found at
+ http://opensource.org/licenses/bsd-license.php.
+
+ THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+
+--*/
+
+#include <PlatformDxe.h>
+
+//
+// Date and time initial values.
+// They are used if the RTC values are invalid during driver initialization
+//
+#define RTC_INIT_SECOND 0
+#define RTC_INIT_MINUTE 0
+#define RTC_INIT_HOUR 0
+
+#define RTC_ADDRESS_CENTURY 50
+
+#define RTC_ADDRESS_REGISTER 0x70
+#define RTC_DATA_REGISTER 0x71
+
+/**
+ Set RTC century to 20 in case RTC core driver failed to initialize it.
+
+**/
+VOID
+EFIAPI
+AdjustRtcCentury (
+ VOID
+ )
+{
+
+ UINT8 Century;
+
+ Century = 20;
+ Century = DecimalToBcd8 (20);
+ IoWrite8 (RTC_ADDRESS_REGISTER, (UINT8) (RTC_ADDRESS_CENTURY | (UINT8) (IoRead8 (PCAT_RTC_ADDRESS_REGISTER) & 0x80)));
+ IoWrite8 (RTC_DATA_REGISTER, Century);
+ Century = IoRead8(RTC_DATA_REGISTER);
+
+ return;
+}
--
2.14.1.windows.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2017-09-08 7:20 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-09-08 7:22 [Patch][edk2-platforms/devel-MinnowBoard3-UDK2017 1/2] Clean up CMOS code zwei4
2017-09-08 7:22 ` [Patch][edk2-platforms/devel-MinnowBoard3-UDK2017 2/2] BroxtonPlatformPkg: RTC initialize zwei4
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox