ArmPlatformPkg/PL011SerialPortLib: use untyped PCD for register base

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: Philippe Mathieu-Daudé <philmd@redhat.com>
Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>
This commit is contained in:
Ard Biesheuvel
2018-12-17 19:51:45 +01:00
parent 6f42f9a54b
commit 5a9b3eb8e5
2 changed files with 10 additions and 8 deletions

View File

@@ -48,7 +48,7 @@ SerialPortInitialize (
StopBits = (EFI_STOP_BITS_TYPE) FixedPcdGet8 (PcdUartDefaultStopBits); StopBits = (EFI_STOP_BITS_TYPE) FixedPcdGet8 (PcdUartDefaultStopBits);
return PL011UartInitializePort ( return PL011UartInitializePort (
(UINTN)FixedPcdGet64 (PcdSerialRegisterBase), (UINTN)PcdGet64 (PcdSerialRegisterBase),
PL011UartClockGetFreq(), PL011UartClockGetFreq(),
&BaudRate, &BaudRate,
&ReceiveFifoDepth, &ReceiveFifoDepth,
@@ -75,7 +75,7 @@ SerialPortWrite (
IN UINTN NumberOfBytes 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 IN UINTN NumberOfBytes
) )
{ {
return PL011UartRead ((UINTN)FixedPcdGet64 (PcdSerialRegisterBase), Buffer, NumberOfBytes); return PL011UartRead ((UINTN)PcdGet64 (PcdSerialRegisterBase), Buffer, NumberOfBytes);
} }
/** /**
@@ -111,7 +111,7 @@ SerialPortPoll (
VOID VOID
) )
{ {
return PL011UartPoll ((UINTN)FixedPcdGet64 (PcdSerialRegisterBase)); return PL011UartPoll ((UINTN)PcdGet64 (PcdSerialRegisterBase));
} }
/** /**
Set new attributes to PL011. Set new attributes to PL011.
@@ -156,7 +156,7 @@ SerialPortSetAttributes (
) )
{ {
return PL011UartInitializePort ( return PL011UartInitializePort (
(UINTN)FixedPcdGet64 (PcdSerialRegisterBase), (UINTN)PcdGet64 (PcdSerialRegisterBase),
PL011UartClockGetFreq(), PL011UartClockGetFreq(),
BaudRate, BaudRate,
ReceiveFifoDepth, ReceiveFifoDepth,
@@ -198,7 +198,7 @@ SerialPortSetControl (
IN UINT32 Control IN UINT32 Control
) )
{ {
return PL011UartSetControl ((UINTN)FixedPcdGet64 (PcdSerialRegisterBase), Control); return PL011UartSetControl ((UINTN)PcdGet64 (PcdSerialRegisterBase), Control);
} }
/** /**
@@ -239,5 +239,5 @@ SerialPortGetControl (
OUT UINT32 *Control OUT UINT32 *Control
) )
{ {
return PL011UartGetControl ((UINTN)FixedPcdGet64 (PcdSerialRegisterBase), Control); return PL011UartGetControl ((UINTN)PcdGet64 (PcdSerialRegisterBase), Control);
} }

View File

@@ -36,8 +36,10 @@
MdeModulePkg/MdeModulePkg.dec MdeModulePkg/MdeModulePkg.dec
ArmPlatformPkg/ArmPlatformPkg.dec ArmPlatformPkg/ArmPlatformPkg.dec
[FixedPcd] [Pcd]
gEfiMdeModulePkgTokenSpaceGuid.PcdSerialRegisterBase gEfiMdeModulePkgTokenSpaceGuid.PcdSerialRegisterBase
[FixedPcd]
gEfiMdePkgTokenSpaceGuid.PcdUartDefaultBaudRate gEfiMdePkgTokenSpaceGuid.PcdUartDefaultBaudRate
gEfiMdePkgTokenSpaceGuid.PcdUartDefaultDataBits gEfiMdePkgTokenSpaceGuid.PcdUartDefaultDataBits
gEfiMdePkgTokenSpaceGuid.PcdUartDefaultParity gEfiMdePkgTokenSpaceGuid.PcdUartDefaultParity