]> git.proxmox.com Git - mirror_edk2.git/commitdiff
PcAtChipsetPkg/PcRtc: Add two new PCD for RTC Index/Target registers
authorRuiyu Ni <ruiyu.ni@intel.com>
Fri, 25 May 2018 08:29:48 +0000 (16:29 +0800)
committerRuiyu Ni <ruiyu.ni@intel.com>
Mon, 28 May 2018 06:49:29 +0000 (14:49 +0800)
In certain HW implementation, the BIT7 of RTC Index register(0x70) is
for NMI sources enable/disable but the BIT7 of 0x70 cannot be read
before writing. Software which doesn't want to change the NMI sources
enable/disable setting can write to the alias register 0x74, through
which only BIT0 ~ BIT6 of 0x70 is modified.
So two new PCDs are added so that platform can have the flexibility
to change the default RTC register addresses from 0x70/0x71 to
0x74/0x75.
With the new PCDs added, it can also support special HW that provides
RTC storage in a different register pairs.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>
Reviewed-by: Star Zeng <star.zeng@intel.com>
PcAtChipsetPkg/PcAtChipsetPkg.dec
PcAtChipsetPkg/PcAtChipsetPkg.uni
PcAtChipsetPkg/PcatRealTimeClockRuntimeDxe/PcRtc.c
PcAtChipsetPkg/PcatRealTimeClockRuntimeDxe/PcRtc.h
PcAtChipsetPkg/PcatRealTimeClockRuntimeDxe/PcatRealTimeClockRuntimeDxe.inf

index f11d2045a43014cd195fd9e3dcdb79d37c45cece..ace7fb7e885ebb95e08eca1c64b8c8d02d357177 100644 (file)
@@ -4,7 +4,7 @@
 # This package is designed to public interfaces and implementation which follows\r
 # PcAt defacto standard.\r
 #\r
-# Copyright (c) 2009 - 2015, Intel Corporation. All rights reserved.<BR>\r
+# Copyright (c) 2009 - 2018, Intel Corporation. All rights reserved.<BR>\r
 # Copyright (c) 2017, AMD Inc. All rights reserved.<BR>\r
 #\r
 # This program and the accompanying materials\r
   # @Prompt Initial value for Register_D in RTC.\r
   gPcAtChipsetPkgTokenSpaceGuid.PcdInitialValueRtcRegisterD|0x00|UINT8|0x0000001D\r
 \r
+  ## Specifies RTC Index Register address in I/O space.\r
+  # @Prompt RTC Index Register address\r
+  gPcAtChipsetPkgTokenSpaceGuid.PcdRtcIndexRegister|0x70|UINT8|0x0000001E\r
+\r
+  ## Specifies RTC Target Register address in I/O space.\r
+  # @Prompt RTC Target Register address\r
+  gPcAtChipsetPkgTokenSpaceGuid.PcdRtcTargetRegister|0x71|UINT8|0x0000001F\r
+\r
 [UserExtensions.TianoCore."ExtraFiles"]\r
   PcAtChipsetPkgExtra.uni\r
index 00169ce307b977e7320e8bd4a9db61e163253ad8..2f62b2610ecafc312c50f941a7337e0c8ce7cada 100644 (file)
@@ -4,7 +4,7 @@
 // This package is designed to public interfaces and implementation which follows\r
 // PcAt defacto standard.\r
 //\r
-// Copyright (c) 2009 - 2015, Intel Corporation. All rights reserved.<BR>\r
+// Copyright (c) 2009 - 2018, Intel Corporation. All rights reserved.<BR>\r
 //\r
 // This program and the accompanying materials\r
 // are licensed and made available under the terms and conditions of the BSD License\r
 \r
 #string STR_gPcAtChipsetPkgTokenSpaceGuid_PcdInitialValueRtcRegisterD_PROMPT  #language en-US "Initial value for Register_D in RTC."\r
 #string STR_gPcAtChipsetPkgTokenSpaceGuid_PcdInitialValueRtcRegisterD_HELP    #language en-US "Specifies the initial value for Register_D in RTC."\r
+\r
+#string STR_gPcAtChipsetPkgTokenSpaceGuid_PcdRtcIndexRegister_PROMPT          #language en-US "RTC Index Register address"\r
+#string STR_gPcAtChipsetPkgTokenSpaceGuid_PcdRtcIndexRegister_HELP            #language en-US "Specifies RTC Index Register address in I/O space."\r
+\r
+#string STR_gPcAtChipsetPkgTokenSpaceGuid_PcdRtcTargetRegister_PROMPT         #language en-US "RTC Target Register address"\r
+#string STR_gPcAtChipsetPkgTokenSpaceGuid_PcdRtcTargetRegister_HELP           #language en-US "Specifies RTC Target Register address in I/O space."\r
index c032e16217c3d858b93186a5cf49eae8bd21833e..caecd0ac1ee6ec5db634665161f069c1fac5d031 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
   RTC Architectural Protocol GUID as defined in DxeCis 0.96.\r
 \r
-Copyright (c) 2006 - 2016, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>\r
 Copyright (c) 2017, AMD Inc. All rights reserved.<BR>\r
 \r
 This program and the accompanying materials\r
@@ -72,8 +72,8 @@ RtcRead (
   IN  UINT8 Address\r
   )\r
 {\r
-  IoWrite8 (PCAT_RTC_ADDRESS_REGISTER, (UINT8) (Address | (UINT8) (IoRead8 (PCAT_RTC_ADDRESS_REGISTER) & 0x80)));\r
-  return IoRead8 (PCAT_RTC_DATA_REGISTER);\r
+  IoWrite8 (PcdGet8 (PcdRtcIndexRegister), (UINT8) (Address | (UINT8) (IoRead8 (PcdGet8 (PcdRtcIndexRegister)) & 0x80)));\r
+  return IoRead8 (PcdGet8 (PcdRtcTargetRegister));\r
 }\r
 \r
 /**\r
@@ -90,8 +90,8 @@ RtcWrite (
   IN  UINT8   Data\r
   )\r
 {\r
-  IoWrite8 (PCAT_RTC_ADDRESS_REGISTER, (UINT8) (Address | (UINT8) (IoRead8 (PCAT_RTC_ADDRESS_REGISTER) & 0x80)));\r
-  IoWrite8 (PCAT_RTC_DATA_REGISTER, Data);\r
+  IoWrite8 (PcdGet8 (PcdRtcIndexRegister), (UINT8) (Address | (UINT8) (IoRead8 (PcdGet8 (PcdRtcIndexRegister)) & 0x80)));\r
+  IoWrite8 (PcdGet8 (PcdRtcTargetRegister), Data);\r
 }\r
 \r
 /**\r
index 8aeb12c88ad1d92a337c940f9123c4c95811946a..3b68f8cc9ed9c240ebfb46a2dc4db18b6807e015 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
   Header file for real time clock driver.\r
 \r
-Copyright (c) 2006 - 2016, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>\r
 Copyright (c) 2017, AMD Inc. All rights reserved.<BR>\r
 \r
 This program and the accompanying materials\r
@@ -47,9 +47,6 @@ typedef struct {
 \r
 extern PC_RTC_MODULE_GLOBALS  mModuleGlobal;\r
 \r
-#define PCAT_RTC_ADDRESS_REGISTER 0x70\r
-#define PCAT_RTC_DATA_REGISTER    0x71\r
-\r
 //\r
 // Dallas DS12C887 Real Time Clock\r
 //\r
index 1b2b063623720113d1adb6b2891d397f55e31fde..4d1360744d60955bc3b09b9bece86f0633a55ee8 100644 (file)
@@ -4,7 +4,7 @@
 # This driver provides GetTime, SetTime, GetWakeupTime, SetWakeupTime services to Runtime Service Table.\r
 # It will install a tagging protocol with gEfiRealTimeClockArchProtocolGuid.\r
 #\r
-# Copyright (c) 2006 - 2015, Intel Corporation. All rights reserved.<BR>\r
+# Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>\r
 # Copyright (c) 2017, AMD Inc. All rights reserved.<BR>\r
 #\r
 # This program and the accompanying materials\r
@@ -77,6 +77,8 @@
   gEfiMdeModulePkgTokenSpaceGuid.PcdRealTimeClockUpdateTimeout  ## CONSUMES\r
   gPcAtChipsetPkgTokenSpaceGuid.PcdMinimalValidYear             ## CONSUMES\r
   gPcAtChipsetPkgTokenSpaceGuid.PcdMaximalValidYear             ## CONSUMES\r
+  gPcAtChipsetPkgTokenSpaceGuid.PcdRtcIndexRegister             ## CONSUMES\r
+  gPcAtChipsetPkgTokenSpaceGuid.PcdRtcTargetRegister            ## CONSUMES\r
 \r
 [Depex]\r
   gEfiVariableArchProtocolGuid AND gEfiVariableWriteArchProtocolGuid\r