public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [PATCH] ArmPlatformPkg/PL011SerialPortLib: use untyped PCD for register base
@ 2018-12-17 18:51 Ard Biesheuvel
  2018-12-18 10:01 ` Philippe Mathieu-Daudé
  2018-12-20 15:20 ` Leif Lindholm
  0 siblings, 2 replies; 4+ messages in thread
From: Ard Biesheuvel @ 2018-12-17 18:51 UTC (permalink / raw)
  To: edk2-devel

Use an untyped PCD reference for PcdSerialRegisterBase, so that the
library gets built without hardcoded values, permitting modules to
override the default serial port. This allows SerialDxe to use a
different serial port from the one used for DEBUG output (which
often gets occluded due to the console driver clearing the screen)

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
---
 ArmPlatformPkg/Library/PL011SerialPortLib/PL011SerialPortLib.c   | 14 +++++++-------
 ArmPlatformPkg/Library/PL011SerialPortLib/PL011SerialPortLib.inf |  4 +++-
 2 files changed, 10 insertions(+), 8 deletions(-)

diff --git a/ArmPlatformPkg/Library/PL011SerialPortLib/PL011SerialPortLib.c b/ArmPlatformPkg/Library/PL011SerialPortLib/PL011SerialPortLib.c
index 212991d63859..d576f79c3e6e 100644
--- a/ArmPlatformPkg/Library/PL011SerialPortLib/PL011SerialPortLib.c
+++ b/ArmPlatformPkg/Library/PL011SerialPortLib/PL011SerialPortLib.c
@@ -48,7 +48,7 @@ SerialPortInitialize (
   StopBits = (EFI_STOP_BITS_TYPE) FixedPcdGet8 (PcdUartDefaultStopBits);
 
   return PL011UartInitializePort (
-           (UINTN)FixedPcdGet64 (PcdSerialRegisterBase),
+           (UINTN)PcdGet64 (PcdSerialRegisterBase),
            PL011UartClockGetFreq(),
            &BaudRate,
            &ReceiveFifoDepth,
@@ -75,7 +75,7 @@ SerialPortWrite (
   IN UINTN     NumberOfBytes
   )
 {
-  return PL011UartWrite ((UINTN)FixedPcdGet64 (PcdSerialRegisterBase), Buffer, NumberOfBytes);
+  return PL011UartWrite ((UINTN)PcdGet64 (PcdSerialRegisterBase), Buffer, NumberOfBytes);
 }
 
 /**
@@ -95,7 +95,7 @@ SerialPortRead (
   IN  UINTN     NumberOfBytes
 )
 {
-  return PL011UartRead ((UINTN)FixedPcdGet64 (PcdSerialRegisterBase), Buffer, NumberOfBytes);
+  return PL011UartRead ((UINTN)PcdGet64 (PcdSerialRegisterBase), Buffer, NumberOfBytes);
 }
 
 /**
@@ -111,7 +111,7 @@ SerialPortPoll (
   VOID
   )
 {
-  return PL011UartPoll ((UINTN)FixedPcdGet64 (PcdSerialRegisterBase));
+  return PL011UartPoll ((UINTN)PcdGet64 (PcdSerialRegisterBase));
 }
 /**
   Set new attributes to PL011.
@@ -156,7 +156,7 @@ SerialPortSetAttributes (
   )
 {
   return PL011UartInitializePort (
-           (UINTN)FixedPcdGet64 (PcdSerialRegisterBase),
+           (UINTN)PcdGet64 (PcdSerialRegisterBase),
            PL011UartClockGetFreq(),
            BaudRate,
            ReceiveFifoDepth,
@@ -198,7 +198,7 @@ SerialPortSetControl (
   IN UINT32  Control
   )
 {
-  return PL011UartSetControl ((UINTN)FixedPcdGet64 (PcdSerialRegisterBase), Control);
+  return PL011UartSetControl ((UINTN)PcdGet64 (PcdSerialRegisterBase), Control);
 }
 
 /**
@@ -239,5 +239,5 @@ SerialPortGetControl (
   OUT UINT32  *Control
   )
 {
-  return PL011UartGetControl ((UINTN)FixedPcdGet64 (PcdSerialRegisterBase), Control);
+  return PL011UartGetControl ((UINTN)PcdGet64 (PcdSerialRegisterBase), Control);
 }
diff --git a/ArmPlatformPkg/Library/PL011SerialPortLib/PL011SerialPortLib.inf b/ArmPlatformPkg/Library/PL011SerialPortLib/PL011SerialPortLib.inf
index 5ce5b2f5304c..bca7bed875c6 100644
--- a/ArmPlatformPkg/Library/PL011SerialPortLib/PL011SerialPortLib.inf
+++ b/ArmPlatformPkg/Library/PL011SerialPortLib/PL011SerialPortLib.inf
@@ -36,8 +36,10 @@
   MdeModulePkg/MdeModulePkg.dec
   ArmPlatformPkg/ArmPlatformPkg.dec
 
-[FixedPcd]
+[Pcd]
   gEfiMdeModulePkgTokenSpaceGuid.PcdSerialRegisterBase
+
+[FixedPcd]
   gEfiMdePkgTokenSpaceGuid.PcdUartDefaultBaudRate
   gEfiMdePkgTokenSpaceGuid.PcdUartDefaultDataBits
   gEfiMdePkgTokenSpaceGuid.PcdUartDefaultParity
-- 
2.17.1



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

* Re: [PATCH] ArmPlatformPkg/PL011SerialPortLib: use untyped PCD for register base
  2018-12-17 18:51 [PATCH] ArmPlatformPkg/PL011SerialPortLib: use untyped PCD for register base Ard Biesheuvel
@ 2018-12-18 10:01 ` Philippe Mathieu-Daudé
  2018-12-20 15:20 ` Leif Lindholm
  1 sibling, 0 replies; 4+ messages in thread
From: Philippe Mathieu-Daudé @ 2018-12-18 10:01 UTC (permalink / raw)
  To: Ard Biesheuvel, edk2-devel

On 12/17/18 7:51 PM, Ard Biesheuvel wrote:
> Use an untyped PCD reference for PcdSerialRegisterBase, so that the
> library gets built without hardcoded values, permitting modules to
> override the default serial port. This allows SerialDxe to use a
> different serial port from the one used for DEBUG output (which
> often gets occluded due to the console driver clearing the screen)

You missed the trailing '.' :)

> 
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>

Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>

> ---
>  ArmPlatformPkg/Library/PL011SerialPortLib/PL011SerialPortLib.c   | 14 +++++++-------
>  ArmPlatformPkg/Library/PL011SerialPortLib/PL011SerialPortLib.inf |  4 +++-
>  2 files changed, 10 insertions(+), 8 deletions(-)
> 
> diff --git a/ArmPlatformPkg/Library/PL011SerialPortLib/PL011SerialPortLib.c b/ArmPlatformPkg/Library/PL011SerialPortLib/PL011SerialPortLib.c
> index 212991d63859..d576f79c3e6e 100644
> --- a/ArmPlatformPkg/Library/PL011SerialPortLib/PL011SerialPortLib.c
> +++ b/ArmPlatformPkg/Library/PL011SerialPortLib/PL011SerialPortLib.c
> @@ -48,7 +48,7 @@ SerialPortInitialize (
>    StopBits = (EFI_STOP_BITS_TYPE) FixedPcdGet8 (PcdUartDefaultStopBits);
>  
>    return PL011UartInitializePort (
> -           (UINTN)FixedPcdGet64 (PcdSerialRegisterBase),
> +           (UINTN)PcdGet64 (PcdSerialRegisterBase),
>             PL011UartClockGetFreq(),
>             &BaudRate,
>             &ReceiveFifoDepth,
> @@ -75,7 +75,7 @@ SerialPortWrite (
>    IN UINTN     NumberOfBytes
>    )
>  {
> -  return PL011UartWrite ((UINTN)FixedPcdGet64 (PcdSerialRegisterBase), Buffer, NumberOfBytes);
> +  return PL011UartWrite ((UINTN)PcdGet64 (PcdSerialRegisterBase), Buffer, NumberOfBytes);
>  }
>  
>  /**
> @@ -95,7 +95,7 @@ SerialPortRead (
>    IN  UINTN     NumberOfBytes
>  )
>  {
> -  return PL011UartRead ((UINTN)FixedPcdGet64 (PcdSerialRegisterBase), Buffer, NumberOfBytes);
> +  return PL011UartRead ((UINTN)PcdGet64 (PcdSerialRegisterBase), Buffer, NumberOfBytes);
>  }
>  
>  /**
> @@ -111,7 +111,7 @@ SerialPortPoll (
>    VOID
>    )
>  {
> -  return PL011UartPoll ((UINTN)FixedPcdGet64 (PcdSerialRegisterBase));
> +  return PL011UartPoll ((UINTN)PcdGet64 (PcdSerialRegisterBase));
>  }
>  /**
>    Set new attributes to PL011.
> @@ -156,7 +156,7 @@ SerialPortSetAttributes (
>    )
>  {
>    return PL011UartInitializePort (
> -           (UINTN)FixedPcdGet64 (PcdSerialRegisterBase),
> +           (UINTN)PcdGet64 (PcdSerialRegisterBase),
>             PL011UartClockGetFreq(),
>             BaudRate,
>             ReceiveFifoDepth,
> @@ -198,7 +198,7 @@ SerialPortSetControl (
>    IN UINT32  Control
>    )
>  {
> -  return PL011UartSetControl ((UINTN)FixedPcdGet64 (PcdSerialRegisterBase), Control);
> +  return PL011UartSetControl ((UINTN)PcdGet64 (PcdSerialRegisterBase), Control);
>  }
>  
>  /**
> @@ -239,5 +239,5 @@ SerialPortGetControl (
>    OUT UINT32  *Control
>    )
>  {
> -  return PL011UartGetControl ((UINTN)FixedPcdGet64 (PcdSerialRegisterBase), Control);
> +  return PL011UartGetControl ((UINTN)PcdGet64 (PcdSerialRegisterBase), Control);
>  }
> diff --git a/ArmPlatformPkg/Library/PL011SerialPortLib/PL011SerialPortLib.inf b/ArmPlatformPkg/Library/PL011SerialPortLib/PL011SerialPortLib.inf
> index 5ce5b2f5304c..bca7bed875c6 100644
> --- a/ArmPlatformPkg/Library/PL011SerialPortLib/PL011SerialPortLib.inf
> +++ b/ArmPlatformPkg/Library/PL011SerialPortLib/PL011SerialPortLib.inf
> @@ -36,8 +36,10 @@
>    MdeModulePkg/MdeModulePkg.dec
>    ArmPlatformPkg/ArmPlatformPkg.dec
>  
> -[FixedPcd]
> +[Pcd]
>    gEfiMdeModulePkgTokenSpaceGuid.PcdSerialRegisterBase
> +
> +[FixedPcd]
>    gEfiMdePkgTokenSpaceGuid.PcdUartDefaultBaudRate
>    gEfiMdePkgTokenSpaceGuid.PcdUartDefaultDataBits
>    gEfiMdePkgTokenSpaceGuid.PcdUartDefaultParity
> 


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

* Re: [PATCH] ArmPlatformPkg/PL011SerialPortLib: use untyped PCD for register base
  2018-12-17 18:51 [PATCH] ArmPlatformPkg/PL011SerialPortLib: use untyped PCD for register base Ard Biesheuvel
  2018-12-18 10:01 ` Philippe Mathieu-Daudé
@ 2018-12-20 15:20 ` Leif Lindholm
  2018-12-20 17:35   ` Ard Biesheuvel
  1 sibling, 1 reply; 4+ messages in thread
From: Leif Lindholm @ 2018-12-20 15:20 UTC (permalink / raw)
  To: Ard Biesheuvel; +Cc: edk2-devel

On Mon, Dec 17, 2018 at 07:51:45PM +0100, Ard Biesheuvel wrote:
> Use an untyped PCD reference for PcdSerialRegisterBase, so that the
> library gets built without hardcoded values, permitting modules to
> override the default serial port. This allows SerialDxe to use a
> different serial port from the one used for DEBUG output (which
> often gets occluded due to the console driver clearing the screen)
> 
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>

Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>

> ---
>  ArmPlatformPkg/Library/PL011SerialPortLib/PL011SerialPortLib.c   | 14 +++++++-------
>  ArmPlatformPkg/Library/PL011SerialPortLib/PL011SerialPortLib.inf |  4 +++-
>  2 files changed, 10 insertions(+), 8 deletions(-)
> 
> diff --git a/ArmPlatformPkg/Library/PL011SerialPortLib/PL011SerialPortLib.c b/ArmPlatformPkg/Library/PL011SerialPortLib/PL011SerialPortLib.c
> index 212991d63859..d576f79c3e6e 100644
> --- a/ArmPlatformPkg/Library/PL011SerialPortLib/PL011SerialPortLib.c
> +++ b/ArmPlatformPkg/Library/PL011SerialPortLib/PL011SerialPortLib.c
> @@ -48,7 +48,7 @@ SerialPortInitialize (
>    StopBits = (EFI_STOP_BITS_TYPE) FixedPcdGet8 (PcdUartDefaultStopBits);
>  
>    return PL011UartInitializePort (
> -           (UINTN)FixedPcdGet64 (PcdSerialRegisterBase),
> +           (UINTN)PcdGet64 (PcdSerialRegisterBase),
>             PL011UartClockGetFreq(),
>             &BaudRate,
>             &ReceiveFifoDepth,
> @@ -75,7 +75,7 @@ SerialPortWrite (
>    IN UINTN     NumberOfBytes
>    )
>  {
> -  return PL011UartWrite ((UINTN)FixedPcdGet64 (PcdSerialRegisterBase), Buffer, NumberOfBytes);
> +  return PL011UartWrite ((UINTN)PcdGet64 (PcdSerialRegisterBase), Buffer, NumberOfBytes);
>  }
>  
>  /**
> @@ -95,7 +95,7 @@ SerialPortRead (
>    IN  UINTN     NumberOfBytes
>  )
>  {
> -  return PL011UartRead ((UINTN)FixedPcdGet64 (PcdSerialRegisterBase), Buffer, NumberOfBytes);
> +  return PL011UartRead ((UINTN)PcdGet64 (PcdSerialRegisterBase), Buffer, NumberOfBytes);
>  }
>  
>  /**
> @@ -111,7 +111,7 @@ SerialPortPoll (
>    VOID
>    )
>  {
> -  return PL011UartPoll ((UINTN)FixedPcdGet64 (PcdSerialRegisterBase));
> +  return PL011UartPoll ((UINTN)PcdGet64 (PcdSerialRegisterBase));
>  }
>  /**
>    Set new attributes to PL011.
> @@ -156,7 +156,7 @@ SerialPortSetAttributes (
>    )
>  {
>    return PL011UartInitializePort (
> -           (UINTN)FixedPcdGet64 (PcdSerialRegisterBase),
> +           (UINTN)PcdGet64 (PcdSerialRegisterBase),
>             PL011UartClockGetFreq(),
>             BaudRate,
>             ReceiveFifoDepth,
> @@ -198,7 +198,7 @@ SerialPortSetControl (
>    IN UINT32  Control
>    )
>  {
> -  return PL011UartSetControl ((UINTN)FixedPcdGet64 (PcdSerialRegisterBase), Control);
> +  return PL011UartSetControl ((UINTN)PcdGet64 (PcdSerialRegisterBase), Control);
>  }
>  
>  /**
> @@ -239,5 +239,5 @@ SerialPortGetControl (
>    OUT UINT32  *Control
>    )
>  {
> -  return PL011UartGetControl ((UINTN)FixedPcdGet64 (PcdSerialRegisterBase), Control);
> +  return PL011UartGetControl ((UINTN)PcdGet64 (PcdSerialRegisterBase), Control);
>  }
> diff --git a/ArmPlatformPkg/Library/PL011SerialPortLib/PL011SerialPortLib.inf b/ArmPlatformPkg/Library/PL011SerialPortLib/PL011SerialPortLib.inf
> index 5ce5b2f5304c..bca7bed875c6 100644
> --- a/ArmPlatformPkg/Library/PL011SerialPortLib/PL011SerialPortLib.inf
> +++ b/ArmPlatformPkg/Library/PL011SerialPortLib/PL011SerialPortLib.inf
> @@ -36,8 +36,10 @@
>    MdeModulePkg/MdeModulePkg.dec
>    ArmPlatformPkg/ArmPlatformPkg.dec
>  
> -[FixedPcd]
> +[Pcd]
>    gEfiMdeModulePkgTokenSpaceGuid.PcdSerialRegisterBase
> +
> +[FixedPcd]
>    gEfiMdePkgTokenSpaceGuid.PcdUartDefaultBaudRate
>    gEfiMdePkgTokenSpaceGuid.PcdUartDefaultDataBits
>    gEfiMdePkgTokenSpaceGuid.PcdUartDefaultParity
> -- 
> 2.17.1
> 


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

* Re: [PATCH] ArmPlatformPkg/PL011SerialPortLib: use untyped PCD for register base
  2018-12-20 15:20 ` Leif Lindholm
@ 2018-12-20 17:35   ` Ard Biesheuvel
  0 siblings, 0 replies; 4+ messages in thread
From: Ard Biesheuvel @ 2018-12-20 17:35 UTC (permalink / raw)
  To: Leif Lindholm; +Cc: edk2-devel@lists.01.org

On Thu, 20 Dec 2018 at 16:20, Leif Lindholm <leif.lindholm@linaro.org> wrote:
>
> On Mon, Dec 17, 2018 at 07:51:45PM +0100, Ard Biesheuvel wrote:
> > Use an untyped PCD reference for PcdSerialRegisterBase, so that the
> > library gets built without hardcoded values, permitting modules to
> > override the default serial port. This allows SerialDxe to use a
> > different serial port from the one used for DEBUG output (which
> > often gets occluded due to the console driver clearing the screen)
> >
> > Contributed-under: TianoCore Contribution Agreement 1.1
> > Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
>
> Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>
>

Thanks

Pushed as 6f42f9a54bf0..5a9b3eb8e5fb

> > ---
> >  ArmPlatformPkg/Library/PL011SerialPortLib/PL011SerialPortLib.c   | 14 +++++++-------
> >  ArmPlatformPkg/Library/PL011SerialPortLib/PL011SerialPortLib.inf |  4 +++-
> >  2 files changed, 10 insertions(+), 8 deletions(-)
> >
> > diff --git a/ArmPlatformPkg/Library/PL011SerialPortLib/PL011SerialPortLib.c b/ArmPlatformPkg/Library/PL011SerialPortLib/PL011SerialPortLib.c
> > index 212991d63859..d576f79c3e6e 100644
> > --- a/ArmPlatformPkg/Library/PL011SerialPortLib/PL011SerialPortLib.c
> > +++ b/ArmPlatformPkg/Library/PL011SerialPortLib/PL011SerialPortLib.c
> > @@ -48,7 +48,7 @@ SerialPortInitialize (
> >    StopBits = (EFI_STOP_BITS_TYPE) FixedPcdGet8 (PcdUartDefaultStopBits);
> >
> >    return PL011UartInitializePort (
> > -           (UINTN)FixedPcdGet64 (PcdSerialRegisterBase),
> > +           (UINTN)PcdGet64 (PcdSerialRegisterBase),
> >             PL011UartClockGetFreq(),
> >             &BaudRate,
> >             &ReceiveFifoDepth,
> > @@ -75,7 +75,7 @@ SerialPortWrite (
> >    IN UINTN     NumberOfBytes
> >    )
> >  {
> > -  return PL011UartWrite ((UINTN)FixedPcdGet64 (PcdSerialRegisterBase), Buffer, NumberOfBytes);
> > +  return PL011UartWrite ((UINTN)PcdGet64 (PcdSerialRegisterBase), Buffer, NumberOfBytes);
> >  }
> >
> >  /**
> > @@ -95,7 +95,7 @@ SerialPortRead (
> >    IN  UINTN     NumberOfBytes
> >  )
> >  {
> > -  return PL011UartRead ((UINTN)FixedPcdGet64 (PcdSerialRegisterBase), Buffer, NumberOfBytes);
> > +  return PL011UartRead ((UINTN)PcdGet64 (PcdSerialRegisterBase), Buffer, NumberOfBytes);
> >  }
> >
> >  /**
> > @@ -111,7 +111,7 @@ SerialPortPoll (
> >    VOID
> >    )
> >  {
> > -  return PL011UartPoll ((UINTN)FixedPcdGet64 (PcdSerialRegisterBase));
> > +  return PL011UartPoll ((UINTN)PcdGet64 (PcdSerialRegisterBase));
> >  }
> >  /**
> >    Set new attributes to PL011.
> > @@ -156,7 +156,7 @@ SerialPortSetAttributes (
> >    )
> >  {
> >    return PL011UartInitializePort (
> > -           (UINTN)FixedPcdGet64 (PcdSerialRegisterBase),
> > +           (UINTN)PcdGet64 (PcdSerialRegisterBase),
> >             PL011UartClockGetFreq(),
> >             BaudRate,
> >             ReceiveFifoDepth,
> > @@ -198,7 +198,7 @@ SerialPortSetControl (
> >    IN UINT32  Control
> >    )
> >  {
> > -  return PL011UartSetControl ((UINTN)FixedPcdGet64 (PcdSerialRegisterBase), Control);
> > +  return PL011UartSetControl ((UINTN)PcdGet64 (PcdSerialRegisterBase), Control);
> >  }
> >
> >  /**
> > @@ -239,5 +239,5 @@ SerialPortGetControl (
> >    OUT UINT32  *Control
> >    )
> >  {
> > -  return PL011UartGetControl ((UINTN)FixedPcdGet64 (PcdSerialRegisterBase), Control);
> > +  return PL011UartGetControl ((UINTN)PcdGet64 (PcdSerialRegisterBase), Control);
> >  }
> > diff --git a/ArmPlatformPkg/Library/PL011SerialPortLib/PL011SerialPortLib.inf b/ArmPlatformPkg/Library/PL011SerialPortLib/PL011SerialPortLib.inf
> > index 5ce5b2f5304c..bca7bed875c6 100644
> > --- a/ArmPlatformPkg/Library/PL011SerialPortLib/PL011SerialPortLib.inf
> > +++ b/ArmPlatformPkg/Library/PL011SerialPortLib/PL011SerialPortLib.inf
> > @@ -36,8 +36,10 @@
> >    MdeModulePkg/MdeModulePkg.dec
> >    ArmPlatformPkg/ArmPlatformPkg.dec
> >
> > -[FixedPcd]
> > +[Pcd]
> >    gEfiMdeModulePkgTokenSpaceGuid.PcdSerialRegisterBase
> > +
> > +[FixedPcd]
> >    gEfiMdePkgTokenSpaceGuid.PcdUartDefaultBaudRate
> >    gEfiMdePkgTokenSpaceGuid.PcdUartDefaultDataBits
> >    gEfiMdePkgTokenSpaceGuid.PcdUartDefaultParity
> > --
> > 2.17.1
> >


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

end of thread, other threads:[~2018-12-20 17:36 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-12-17 18:51 [PATCH] ArmPlatformPkg/PL011SerialPortLib: use untyped PCD for register base Ard Biesheuvel
2018-12-18 10:01 ` Philippe Mathieu-Daudé
2018-12-20 15:20 ` Leif Lindholm
2018-12-20 17:35   ` Ard Biesheuvel

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