public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [PATCH 0/2] Define PCD's for RTC init values
@ 2017-10-31 17:54 Leo Duran
  2017-10-31 17:54 ` [PATCH 1/2] PcAtChipsetPkg: Define FixePCD's for RTC register values Leo Duran
  2017-10-31 17:54 ` [PATCH 2/2] PcAtChipsetPkg/PcatRealTimeClockRuntimeDxe: Replace RTC macros Leo Duran
  0 siblings, 2 replies; 5+ messages in thread
From: Leo Duran @ 2017-10-31 17:54 UTC (permalink / raw)
  To: edk2-devel

We have an RTC implementation that requires non-standard
initial values for the A/B/D registers, so this patch-set
replaces the macros defined in PcRtc.h with FixedPCD's
that allow for platform-specific configurations.

The changes all localized to the PcAtChipsetPkg, and should be
completely non-intrusive.

Leo Duran (2):
  PcAtChipsetPkg: Define FixePCD's for RTC register values
  PcAtChipsetPkg/PcatRealTimeClockRuntimeDxe: Replace RTC macros

 PcAtChipsetPkg/PcAtChipsetPkg.dec                           | 13 +++++++++++++
 PcAtChipsetPkg/PcatRealTimeClockRuntimeDxe/PcRtc.c          |  8 +++++---
 PcAtChipsetPkg/PcatRealTimeClockRuntimeDxe/PcRtc.h          |  9 ++-------
 .../PcatRealTimeClockRuntimeDxe.inf                         | 11 +++++++++--
 4 files changed, 29 insertions(+), 12 deletions(-)

-- 
2.7.4



^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH 1/2] PcAtChipsetPkg: Define FixePCD's for RTC register values
  2017-10-31 17:54 [PATCH 0/2] Define PCD's for RTC init values Leo Duran
@ 2017-10-31 17:54 ` Leo Duran
  2017-11-08  6:30   ` Ni, Ruiyu
  2017-10-31 17:54 ` [PATCH 2/2] PcAtChipsetPkg/PcatRealTimeClockRuntimeDxe: Replace RTC macros Leo Duran
  1 sibling, 1 reply; 5+ messages in thread
From: Leo Duran @ 2017-10-31 17:54 UTC (permalink / raw)
  To: edk2-devel; +Cc: Leo Duran, Ruiyu Ni

Define FixedPCD's to replace macros in RTC driver, to allow
for platform-specific configurations.

Cc: Ruiyu Ni <ruiyu.ni@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Leo Duran <leo.duran@amd.com>
---
 PcAtChipsetPkg/PcAtChipsetPkg.dec | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/PcAtChipsetPkg/PcAtChipsetPkg.dec b/PcAtChipsetPkg/PcAtChipsetPkg.dec
index b0b2b62..f11d204 100644
--- a/PcAtChipsetPkg/PcAtChipsetPkg.dec
+++ b/PcAtChipsetPkg/PcAtChipsetPkg.dec
@@ -5,6 +5,7 @@
 # PcAt defacto standard.
 #
 # Copyright (c) 2009 - 2015, Intel Corporation. All rights reserved.<BR>
+# Copyright (c) 2017, AMD Inc. All rights reserved.<BR>
 #
 # This program and the accompanying materials
 # are licensed and made available under the terms and conditions of the BSD License
@@ -181,5 +182,17 @@
   # @Prompt Reset Control Register value for cold reset
   gPcAtChipsetPkgTokenSpaceGuid.PcdResetControlValueColdReset|0xFE|UINT8|0x0000001A
 
+  ## Specifies the initial value for Register_A in RTC.
+  # @Prompt Initial value for Register_A in RTC.
+  gPcAtChipsetPkgTokenSpaceGuid.PcdInitialValueRtcRegisterA|0x26|UINT8|0x0000001B
+
+  ## Specifies the initial value for Register_B in RTC.
+  # @Prompt Initial value for Register_B in RTC.
+  gPcAtChipsetPkgTokenSpaceGuid.PcdInitialValueRtcRegisterB|0x02|UINT8|0x0000001C
+
+  ## Specifies the initial value for Register_D in RTC.
+  # @Prompt Initial value for Register_D in RTC.
+  gPcAtChipsetPkgTokenSpaceGuid.PcdInitialValueRtcRegisterD|0x00|UINT8|0x0000001D
+
 [UserExtensions.TianoCore."ExtraFiles"]
   PcAtChipsetPkgExtra.uni
-- 
2.7.4



^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH 2/2] PcAtChipsetPkg/PcatRealTimeClockRuntimeDxe: Replace RTC macros
  2017-10-31 17:54 [PATCH 0/2] Define PCD's for RTC init values Leo Duran
  2017-10-31 17:54 ` [PATCH 1/2] PcAtChipsetPkg: Define FixePCD's for RTC register values Leo Duran
@ 2017-10-31 17:54 ` Leo Duran
  1 sibling, 0 replies; 5+ messages in thread
From: Leo Duran @ 2017-10-31 17:54 UTC (permalink / raw)
  To: edk2-devel; +Cc: Leo Duran, Ruiyu Ni

Use FixedPCD's to set platform-specific values for RTC registers.

Specifically, the replaced macros are:
1) RTC_INIT_REGISTER_A
2) RTC_INIT_REGISTER_B
3) RTC_INIT_REGISTER_D

Cc: Ruiyu Ni <ruiyu.ni@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Leo Duran <leo.duran@amd.com>
---
 PcAtChipsetPkg/PcatRealTimeClockRuntimeDxe/PcRtc.c            |  8 +++++---
 PcAtChipsetPkg/PcatRealTimeClockRuntimeDxe/PcRtc.h            |  9 ++-------
 .../PcatRealTimeClockRuntimeDxe.inf                           | 11 +++++++++--
 3 files changed, 16 insertions(+), 12 deletions(-)

diff --git a/PcAtChipsetPkg/PcatRealTimeClockRuntimeDxe/PcRtc.c b/PcAtChipsetPkg/PcatRealTimeClockRuntimeDxe/PcRtc.c
index 857918d..c032e16 100644
--- a/PcAtChipsetPkg/PcatRealTimeClockRuntimeDxe/PcRtc.c
+++ b/PcAtChipsetPkg/PcatRealTimeClockRuntimeDxe/PcRtc.c
@@ -2,6 +2,8 @@
   RTC Architectural Protocol GUID as defined in DxeCis 0.96.
 
 Copyright (c) 2006 - 2016, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2017, AMD Inc. All rights reserved.<BR>
+
 This program and the accompanying materials
 are licensed and made available under the terms and conditions of the BSD License
 which accompanies this distribution.  The full text of the license may be found at
@@ -128,7 +130,7 @@ PcRtcInit (
   // Make sure Division Chain is properly configured,
   // or RTC clock won't "tick" -- time won't increment
   //
-  RegisterA.Data = RTC_INIT_REGISTER_A;
+  RegisterA.Data = FixedPcdGet8 (PcdInitialValueRtcRegisterA);
   RtcWrite (RTC_ADDRESS_REGISTER_A, RegisterA.Data);
 
   //
@@ -144,7 +146,7 @@ PcRtcInit (
   //
   // Clear RTC register D
   //
-  RegisterD.Data = RTC_INIT_REGISTER_D;
+  RegisterD.Data = FixedPcdGet8 (PcdInitialValueRtcRegisterD);
   RtcWrite (RTC_ADDRESS_REGISTER_D, RegisterD.Data);
 
   //
@@ -176,7 +178,7 @@ PcRtcInit (
   // Set RTC configuration after get original time
   // The value of bit AIE should be reserved.
   //
-  RegisterB.Data = RTC_INIT_REGISTER_B | (RegisterB.Data & BIT5);
+  RegisterB.Data = FixedPcdGet8 (PcdInitialValueRtcRegisterB) | (RegisterB.Data & BIT5);
   RtcWrite (RTC_ADDRESS_REGISTER_B, RegisterB.Data);
 
   //
diff --git a/PcAtChipsetPkg/PcatRealTimeClockRuntimeDxe/PcRtc.h b/PcAtChipsetPkg/PcatRealTimeClockRuntimeDxe/PcRtc.h
index ba6092d..8aeb12c 100644
--- a/PcAtChipsetPkg/PcatRealTimeClockRuntimeDxe/PcRtc.h
+++ b/PcAtChipsetPkg/PcatRealTimeClockRuntimeDxe/PcRtc.h
@@ -2,6 +2,8 @@
   Header file for real time clock driver.
 
 Copyright (c) 2006 - 2016, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2017, AMD Inc. All rights reserved.<BR>
+
 This program and the accompanying materials
 are licensed and made available under the terms and conditions of the BSD License
 which accompanies this distribution.  The full text of the license may be found at
@@ -75,13 +77,6 @@ extern PC_RTC_MODULE_GLOBALS  mModuleGlobal;
 #define RTC_INIT_DAY    1
 #define RTC_INIT_MONTH  1
 
-//
-// Register initial values
-//
-#define RTC_INIT_REGISTER_A 0x26
-#define RTC_INIT_REGISTER_B 0x02
-#define RTC_INIT_REGISTER_D 0x0
-
 #pragma pack(1)
 //
 // Register A
diff --git a/PcAtChipsetPkg/PcatRealTimeClockRuntimeDxe/PcatRealTimeClockRuntimeDxe.inf b/PcAtChipsetPkg/PcatRealTimeClockRuntimeDxe/PcatRealTimeClockRuntimeDxe.inf
index dd746a2..1b2b063 100644
--- a/PcAtChipsetPkg/PcatRealTimeClockRuntimeDxe/PcatRealTimeClockRuntimeDxe.inf
+++ b/PcAtChipsetPkg/PcatRealTimeClockRuntimeDxe/PcatRealTimeClockRuntimeDxe.inf
@@ -5,6 +5,8 @@
 # It will install a tagging protocol with gEfiRealTimeClockArchProtocolGuid.
 #
 # Copyright (c) 2006 - 2015, Intel Corporation. All rights reserved.<BR>
+# Copyright (c) 2017, AMD Inc. All rights reserved.<BR>
+#
 # This program and the accompanying materials
 # are licensed and made available under the terms and conditions of the BSD License
 # which accompanies this distribution.  The full text of the license may be found at
@@ -66,13 +68,18 @@
   ## SOMETIMES_CONSUMES ## SystemTable
   gEfiAcpiTableGuid
 
-[Depex]
-  gEfiVariableArchProtocolGuid AND gEfiVariableWriteArchProtocolGuid
+[FixedPcd]
+  gPcAtChipsetPkgTokenSpaceGuid.PcdInitialValueRtcRegisterA     ## CONSUMES
+  gPcAtChipsetPkgTokenSpaceGuid.PcdInitialValueRtcRegisterB     ## CONSUMES
+  gPcAtChipsetPkgTokenSpaceGuid.PcdInitialValueRtcRegisterD     ## CONSUMES
   
 [Pcd]
   gEfiMdeModulePkgTokenSpaceGuid.PcdRealTimeClockUpdateTimeout  ## CONSUMES
   gPcAtChipsetPkgTokenSpaceGuid.PcdMinimalValidYear             ## CONSUMES
   gPcAtChipsetPkgTokenSpaceGuid.PcdMaximalValidYear             ## CONSUMES
 
+[Depex]
+  gEfiVariableArchProtocolGuid AND gEfiVariableWriteArchProtocolGuid
+
 [UserExtensions.TianoCore."ExtraFiles"]
   PcRtcExtra.uni
-- 
2.7.4



^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH 1/2] PcAtChipsetPkg: Define FixePCD's for RTC register values
  2017-10-31 17:54 ` [PATCH 1/2] PcAtChipsetPkg: Define FixePCD's for RTC register values Leo Duran
@ 2017-11-08  6:30   ` Ni, Ruiyu
  2017-11-20 16:39     ` Duran, Leo
  0 siblings, 1 reply; 5+ messages in thread
From: Ni, Ruiyu @ 2017-11-08  6:30 UTC (permalink / raw)
  To: Leo Duran, edk2-devel@lists.01.org

Reviewed-by: Ruiyu Ni <ruiyu.ni@intel.com>

Thanks/Ray

> -----Original Message-----
> From: Leo Duran [mailto:leo.duran@amd.com]
> Sent: Wednesday, November 1, 2017 1:55 AM
> To: edk2-devel@lists.01.org
> Cc: Leo Duran <leo.duran@amd.com>; Ni, Ruiyu <ruiyu.ni@intel.com>
> Subject: [PATCH 1/2] PcAtChipsetPkg: Define FixePCD's for RTC register
> values
> 
> Define FixedPCD's to replace macros in RTC driver, to allow for platform-
> specific configurations.
> 
> Cc: Ruiyu Ni <ruiyu.ni@intel.com>
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: Leo Duran <leo.duran@amd.com>
> ---
>  PcAtChipsetPkg/PcAtChipsetPkg.dec | 13 +++++++++++++
>  1 file changed, 13 insertions(+)
> 
> diff --git a/PcAtChipsetPkg/PcAtChipsetPkg.dec
> b/PcAtChipsetPkg/PcAtChipsetPkg.dec
> index b0b2b62..f11d204 100644
> --- a/PcAtChipsetPkg/PcAtChipsetPkg.dec
> +++ b/PcAtChipsetPkg/PcAtChipsetPkg.dec
> @@ -5,6 +5,7 @@
>  # PcAt defacto standard.
>  #
>  # Copyright (c) 2009 - 2015, Intel Corporation. All rights reserved.<BR>
> +# Copyright (c) 2017, AMD Inc. All rights reserved.<BR>
>  #
>  # This program and the accompanying materials  # are licensed and made
> available under the terms and conditions of the BSD License @@ -181,5
> +182,17 @@
>    # @Prompt Reset Control Register value for cold reset
> 
> gPcAtChipsetPkgTokenSpaceGuid.PcdResetControlValueColdReset|0xFE|UI
> NT8|0x0000001A
> 
> +  ## Specifies the initial value for Register_A in RTC.
> +  # @Prompt Initial value for Register_A in RTC.
> +
> +
> gPcAtChipsetPkgTokenSpaceGuid.PcdInitialValueRtcRegisterA|0x26|UINT8|
> 0
> + x0000001B
> +
> +  ## Specifies the initial value for Register_B in RTC.
> +  # @Prompt Initial value for Register_B in RTC.
> +
> +
> gPcAtChipsetPkgTokenSpaceGuid.PcdInitialValueRtcRegisterB|0x02|UINT8|
> 0
> + x0000001C
> +
> +  ## Specifies the initial value for Register_D in RTC.
> +  # @Prompt Initial value for Register_D in RTC.
> +
> +
> gPcAtChipsetPkgTokenSpaceGuid.PcdInitialValueRtcRegisterD|0x00|UINT8|
> 0
> + x0000001D
> +
>  [UserExtensions.TianoCore."ExtraFiles"]
>    PcAtChipsetPkgExtra.uni
> --
> 2.7.4



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH 1/2] PcAtChipsetPkg: Define FixePCD's for RTC register values
  2017-11-08  6:30   ` Ni, Ruiyu
@ 2017-11-20 16:39     ` Duran, Leo
  0 siblings, 0 replies; 5+ messages in thread
From: Duran, Leo @ 2017-11-20 16:39 UTC (permalink / raw)
  To: 'Ni, Ruiyu', edk2-devel@lists.01.org

Are we OK with pushing this patch-set?
If so, is that something you can do, Ray?

Thanks,
Leo.

> -----Original Message-----
> From: Ni, Ruiyu [mailto:ruiyu.ni@intel.com]
> Sent: Wednesday, November 08, 2017 12:30 AM
> To: Duran, Leo <leo.duran@amd.com>; edk2-devel@lists.01.org
> Subject: RE: [PATCH 1/2] PcAtChipsetPkg: Define FixePCD's for RTC register
> values
> 
> Reviewed-by: Ruiyu Ni <ruiyu.ni@intel.com>
> 
> Thanks/Ray
> 
> > -----Original Message-----
> > From: Leo Duran [mailto:leo.duran@amd.com]
> > Sent: Wednesday, November 1, 2017 1:55 AM
> > To: edk2-devel@lists.01.org
> > Cc: Leo Duran <leo.duran@amd.com>; Ni, Ruiyu <ruiyu.ni@intel.com>
> > Subject: [PATCH 1/2] PcAtChipsetPkg: Define FixePCD's for RTC register
> > values
> >
> > Define FixedPCD's to replace macros in RTC driver, to allow for
> > platform- specific configurations.
> >
> > Cc: Ruiyu Ni <ruiyu.ni@intel.com>
> > Contributed-under: TianoCore Contribution Agreement 1.1
> > Signed-off-by: Leo Duran <leo.duran@amd.com>
> > ---
> >  PcAtChipsetPkg/PcAtChipsetPkg.dec | 13 +++++++++++++
> >  1 file changed, 13 insertions(+)
> >
> > diff --git a/PcAtChipsetPkg/PcAtChipsetPkg.dec
> > b/PcAtChipsetPkg/PcAtChipsetPkg.dec
> > index b0b2b62..f11d204 100644
> > --- a/PcAtChipsetPkg/PcAtChipsetPkg.dec
> > +++ b/PcAtChipsetPkg/PcAtChipsetPkg.dec
> > @@ -5,6 +5,7 @@
> >  # PcAt defacto standard.
> >  #
> >  # Copyright (c) 2009 - 2015, Intel Corporation. All rights
> > reserved.<BR>
> > +# Copyright (c) 2017, AMD Inc. All rights reserved.<BR>
> >  #
> >  # This program and the accompanying materials  # are licensed and
> > made available under the terms and conditions of the BSD License @@
> > -181,5
> > +182,17 @@
> >    # @Prompt Reset Control Register value for cold reset
> >
> >
> gPcAtChipsetPkgTokenSpaceGuid.PcdResetControlValueColdReset|0xFE|UI
> > NT8|0x0000001A
> >
> > +  ## Specifies the initial value for Register_A in RTC.
> > +  # @Prompt Initial value for Register_A in RTC.
> > +
> > +
> >
> gPcAtChipsetPkgTokenSpaceGuid.PcdInitialValueRtcRegisterA|0x26|UINT8|
> > 0
> > + x0000001B
> > +
> > +  ## Specifies the initial value for Register_B in RTC.
> > +  # @Prompt Initial value for Register_B in RTC.
> > +
> > +
> >
> gPcAtChipsetPkgTokenSpaceGuid.PcdInitialValueRtcRegisterB|0x02|UINT8|
> > 0
> > + x0000001C
> > +
> > +  ## Specifies the initial value for Register_D in RTC.
> > +  # @Prompt Initial value for Register_D in RTC.
> > +
> > +
> >
> gPcAtChipsetPkgTokenSpaceGuid.PcdInitialValueRtcRegisterD|0x00|UINT8|
> > 0
> > + x0000001D
> > +
> >  [UserExtensions.TianoCore."ExtraFiles"]
> >    PcAtChipsetPkgExtra.uni
> > --
> > 2.7.4



^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2017-11-20 16:34 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-10-31 17:54 [PATCH 0/2] Define PCD's for RTC init values Leo Duran
2017-10-31 17:54 ` [PATCH 1/2] PcAtChipsetPkg: Define FixePCD's for RTC register values Leo Duran
2017-11-08  6:30   ` Ni, Ruiyu
2017-11-20 16:39     ` Duran, Leo
2017-10-31 17:54 ` [PATCH 2/2] PcAtChipsetPkg/PcatRealTimeClockRuntimeDxe: Replace RTC macros Leo Duran

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox