Skip to content

Commit

Permalink
Platform/RPi: Replace Bcm283x SoC base register address with a PCD
Browse files Browse the repository at this point in the history
Define BCM2836_SOC_REGISTERS from PcdBcm283xRegistersAddress. This is
needed in preparation for adding Raspberry Pi 4 support, since the two
Pi's have a different base addresses for the Bcm283x specific registers.

Signed-off-by: Pete Batard <pete@akeo.ie>
Reviewed-by: Philippe Mathieu-Daude <philmd@redhat.com>
Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>
  • Loading branch information
samerhaj authored and Leif Lindholm committed Nov 19, 2019
1 parent 837450f commit e46085f
Show file tree
Hide file tree
Showing 12 changed files with 43 additions and 5 deletions.
@@ -1,5 +1,6 @@
#/** @file
#
# Copyright (c) 2019, ARM Limited. All rights reserved.
# Copyright (c) 2017, Andrei Warkentin <andrey.warkentin@gmail.com>
# Copyright (c) Microsoft Corporation. All rights reserved.
#
Expand Down Expand Up @@ -41,6 +42,7 @@
gRaspberryPiFirmwareProtocolGuid ## CONSUMES

[Pcd]
gBcm283xTokenSpaceGuid.PcdBcm283xRegistersAddress
gRaspberryPiTokenSpaceGuid.PcdSdIsArasan

[Depex]
Expand Down
2 changes: 2 additions & 0 deletions Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxe.inf
@@ -1,5 +1,6 @@
#/** @file
#
# Copyright (c) 2019, ARM Limited. All rights reserved.
# Copyright (c) 2018, Andrei Warkentin <andrey.warkentin@gmail.com>
#
# SPDX-License-Identifier: BSD-2-Clause-Patent
Expand Down Expand Up @@ -54,6 +55,7 @@
gRaspberryPiConfigAppliedProtocolGuid ## PRODUCES

[Pcd]
gBcm283xTokenSpaceGuid.PcdBcm283xRegistersAddress
gRaspberryPiTokenSpaceGuid.PcdCpuClock
gRaspberryPiTokenSpaceGuid.PcdCustomCpuClock
gRaspberryPiTokenSpaceGuid.PcdSdIsArasan
Expand Down
4 changes: 4 additions & 0 deletions Platform/RaspberryPi/Drivers/DwUsbHostDxe/DwUsbHostDxe.inf
@@ -1,5 +1,6 @@
#/** @file
#
# Copyright (c) 2019, ARM Limited. All rights reserved.
# Copyright (c) 2017-2018, Andrei Warkentin <andrey.warkentin@gmail.com>
# Copyright (c) 2015-2016, Linaro Limited. All rights reserved.
#
Expand Down Expand Up @@ -51,5 +52,8 @@
gEfiUsb2HcProtocolGuid
gRaspberryPiFirmwareProtocolGuid

[FixedPcd]
gBcm283xTokenSpaceGuid.PcdBcm283xRegistersAddress

[Depex]
gRaspberryPiFirmwareProtocolGuid
@@ -1,5 +1,5 @@
#/** @file
#
# Copyright (c) 2019, ARM Limited. All rights reserved.
# Copyright (c) 2017-2018, Andrei Warkentin <andrey.warkentin@gmail.com>
# Copyright (c) 2016, Linaro, Ltd. All rights reserved.
#
Expand Down Expand Up @@ -40,5 +40,8 @@
[Protocols]
gRaspberryPiFirmwareProtocolGuid ## PRODUCES

[FixedPcd]
gBcm283xTokenSpaceGuid.PcdBcm283xRegistersAddress

[Depex]
TRUE
2 changes: 2 additions & 0 deletions Platform/RaspberryPi/Drivers/SdHostDxe/SdHostDxe.inf
@@ -1,5 +1,6 @@
#/** @file
#
# Copyright (c) 2019, ARM Limited. All rights reserved.
# Copyright (c) 2017, Andrei Warkentin <andrey.warkentin@gmail.com>
# Copyright (c) Microsoft Corporation. All rights reserved.
#
Expand Down Expand Up @@ -43,6 +44,7 @@
gRaspberryPiFirmwareProtocolGuid ## CONSUMES

[Pcd]
gBcm283xTokenSpaceGuid.PcdBcm283xRegistersAddress
gRaspberryPiTokenSpaceGuid.PcdSdIsArasan

[Depex]
Expand Down
3 changes: 2 additions & 1 deletion Platform/RaspberryPi/Library/PlatformLib/PlatformLib.inf
Expand Up @@ -2,7 +2,7 @@
#
# Copyright (c) 2017-2018, Andrei Warkentin <andrey.warkentin@gmail.com>
# Copyright (c) 2014-2016, Linaro Limited. All rights reserved.
# Copyright (c) 2011-2014, ARM Limited. All rights reserved.
# Copyright (c) 2011-2019, ARM Limited. All rights reserved.
#
# SPDX-License-Identifier: BSD-2-Clause-Patent
#
Expand Down Expand Up @@ -47,6 +47,7 @@
gArmTokenSpaceGuid.PcdArmPrimaryCoreMask
gArmTokenSpaceGuid.PcdArmPrimaryCore
gArmTokenSpaceGuid.PcdFdSize
gBcm283xTokenSpaceGuid.PcdBcm283xRegistersAddress
gEmbeddedTokenSpaceGuid.PcdDmaDeviceOffset
gArmTokenSpaceGuid.PcdSystemMemoryBase
gArmTokenSpaceGuid.PcdSystemMemorySize
Expand Down
7 changes: 6 additions & 1 deletion Platform/RaspberryPi/RPi3/RPi3.dsc
@@ -1,6 +1,6 @@
# @file
#
# Copyright (c) 2011-2015, ARM Limited. All rights reserved.
# Copyright (c) 2011 - 2019, ARM Limited. All rights reserved.
# Copyright (c) 2014, Linaro Limited. All rights reserved.
# Copyright (c) 2015 - 2016, Intel Corporation. All rights reserved.
# Copyright (c) 2017 - 2018, Andrei Warkentin <andrey.warkentin@gmail.com>
Expand Down Expand Up @@ -372,6 +372,11 @@
gArmTokenSpaceGuid.PcdSystemMemoryBase|0x00400000
gArmTokenSpaceGuid.PcdSystemMemorySize|0x3FC00000

#
# Device specific addresses
#
gBcm283xTokenSpaceGuid.PcdBcm283xRegistersAddress|0x3f000000

## NS16550 compatible UART
gEfiMdeModulePkgTokenSpaceGuid.PcdSerialRegisterBase|0x3f215040
gEfiMdeModulePkgTokenSpaceGuid.PcdSerialUseMmio|TRUE
Expand Down
7 changes: 7 additions & 0 deletions Silicon/Broadcom/Bcm283x/Bcm283x.dec
@@ -1,5 +1,6 @@
## @file
#
# Copyright (c) 2019, ARM Limited. All rights reserved.
# Copyright (c) 2019, Pete Batard <pete@akeo.ie>
#
# SPDX-License-Identifier: BSD-2-Clause-Patent
Expand All @@ -14,3 +15,9 @@

[Includes]
Include

[Guids]
gBcm283xTokenSpaceGuid = {0x82f36a92, 0xfb7e, 0x43a1, {0xb9, 0x9e, 0x49, 0x13, 0x3f, 0xc7, 0xa4, 0x2e}}

[PcdsFixedAtBuild.common]
gBcm283xTokenSpaceGuid.PcdBcm283xRegistersAddress|0x0|UINT32|0x00000001
@@ -1,5 +1,5 @@
#/** @file
#
# Copyright (c) 2019, ARM Limited. All rights reserved.
# Copyright (c) 2017, Andrei Warkentin <andrey.warkentin@gmail.com>
# Copyright (c) 2016 Linaro, Ltd. All rights reserved.
#
Expand Down Expand Up @@ -27,6 +27,7 @@
BaseLib
DebugLib
IoLib
PcdLib
UefiBootServicesTableLib
UefiLib
UefiDriverEntryPoint
Expand All @@ -36,6 +37,7 @@
gEfiCpuArchProtocolGuid ## CONSUMES ## NOTIFY

[FixedPcd]
gBcm283xTokenSpaceGuid.PcdBcm283xRegistersAddress
gEmbeddedTokenSpaceGuid.PcdInterruptBaseAddress

[Depex]
Expand Down
5 changes: 5 additions & 0 deletions Silicon/Broadcom/Bcm283x/Drivers/RngDxe/RngDxe.inf
@@ -1,5 +1,6 @@
#/** @file
#
# Copyright (c) 2019, ARM Limited. All rights reserved.
# Copyright (c) 2019 Linaro, Ltd. All rights reserved.
#
# SPDX-License-Identifier: BSD-2-Clause-Patent
Expand All @@ -26,6 +27,7 @@
BaseMemoryLib
DebugLib
IoLib
PcdLib
UefiBootServicesTableLib
UefiDriverEntryPoint

Expand All @@ -35,5 +37,8 @@
[Guids]
gEfiRngAlgorithmRaw

[FixedPcd]
gBcm283xTokenSpaceGuid.PcdBcm283xRegistersAddress

[Depex]
TRUE
3 changes: 2 additions & 1 deletion Silicon/Broadcom/Bcm283x/Include/IndustryStandard/Bcm2836.h
@@ -1,5 +1,6 @@
/** @file
*
* Copyright (c) 2019, ARM Limited. All rights reserved.
* Copyright (c) 2017, Andrei Warkentin <andrey.warkentin@gmail.com>
* Copyright (c) 2016, Linaro Limited. All rights reserved.
*
Expand All @@ -13,7 +14,7 @@
/*
* Both "core" and SoC perpherals (1M each).
*/
#define BCM2836_SOC_REGISTERS 0x3f000000
#define BCM2836_SOC_REGISTERS (FixedPcdGet64 (PcdBcm283xRegistersAddress))
#define BCM2836_SOC_REGISTER_LENGTH 0x02000000

/*
Expand Down
4 changes: 4 additions & 0 deletions Silicon/Broadcom/Bcm283x/Library/GpioLib/GpioLib.inf
Expand Up @@ -2,6 +2,7 @@
#
# Manipulate GPIOs.
#
# Copyright (c) 2019, ARM Limited. All rights reserved.
# Copyright (c) 2018, Andrei Warkentin <andrey.warkentin@gmail.com>
#
# SPDX-License-Identifier: BSD-2-Clause-Patent
Expand Down Expand Up @@ -30,4 +31,7 @@
DebugLib
IoLib

[FixedPcd]
gBcm283xTokenSpaceGuid.PcdBcm283xRegistersAddress

[Guids]

0 comments on commit e46085f

Please sign in to comment.