From: "Pete Batard" <pete@akeo.ie>
To: "Philippe Mathieu-Daudé" <philmd@redhat.com>,
devel@edk2.groups.io,
"Samer El-Haj-Mahmoud" <samer@elhajmahmoud.com>
Cc: ard.biesheuvel@linaro.org, leif.lindholm@linaro.org
Subject: Re: [edk2-platforms][PATCH 6/8] Platform/RPi: Replace Mailbox and Watchdog addresses with PCDs
Date: Mon, 18 Nov 2019 13:32:01 +0000 [thread overview]
Message-ID: <4aa869a1-52b3-f724-9899-6c9c580a0b95@akeo.ie> (raw)
In-Reply-To: <6f581579-2444-d9e8-4474-cab6b28e93a9@redhat.com>
Hi Philippe,
On 2019.11.18 11:13, Philippe Mathieu-Daudé wrote:
> Hi Pete, Samer,
>
> On 11/14/19 5:07 PM, Pete Batard wrote:
>> From: Samer El-Haj-Mahmoud <samer@elhajmahmoud.com>
>>
>> Set BCM2836_WDOG_BASE_ADDRESS and BCM2836_MBOX_BASE_ADDRESS to
>> using PCDs instead of hard-coded addresses. This is needed in
>> preparation for adding Raspberry Pi 4 support.
>>
>> Signed-off-by: Pete Batard <pete@akeo.ie>
>> ---
>> Platform/RaspberryPi/Drivers/RpiFirmwareDxe/RpiFirmwareDxe.inf | 1 +
>> Platform/RaspberryPi/Library/PlatformLib/PlatformLib.inf | 1 +
>> Platform/RaspberryPi/RPi3/RPi3.dsc | 3 +++
>> Silicon/Broadcom/Bcm283x/Bcm283x.dec | 2 ++
>> Silicon/Broadcom/Bcm283x/Include/IndustryStandard/Bcm2836.h | 4 ++--
>> 5 files changed, 9 insertions(+), 2 deletions(-)
>>
>> diff --git
>> a/Platform/RaspberryPi/Drivers/RpiFirmwareDxe/RpiFirmwareDxe.inf
>> b/Platform/RaspberryPi/Drivers/RpiFirmwareDxe/RpiFirmwareDxe.inf
>> index a3fc0fa49a3c..527cee8bacc1 100644
>> --- a/Platform/RaspberryPi/Drivers/RpiFirmwareDxe/RpiFirmwareDxe.inf
>> +++ b/Platform/RaspberryPi/Drivers/RpiFirmwareDxe/RpiFirmwareDxe.inf
>> @@ -42,6 +42,7 @@ [Protocols]
>> [FixedPcd]
>> gBcm283xTokenSpaceGuid.PcdBcm283xRegistersAddress
>> + gBcm283xTokenSpaceGuid.PcdMboxBaseAddress
>> [Depex]
>> TRUE
>> diff --git a/Platform/RaspberryPi/Library/PlatformLib/PlatformLib.inf
>> b/Platform/RaspberryPi/Library/PlatformLib/PlatformLib.inf
>> index c0e2a75451c3..f627fca2e406 100644
>> --- a/Platform/RaspberryPi/Library/PlatformLib/PlatformLib.inf
>> +++ b/Platform/RaspberryPi/Library/PlatformLib/PlatformLib.inf
>> @@ -58,6 +58,7 @@ [FixedPcd]
>> gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwSpareSize
>> gBcm27xxTokenSpaceGuid.PcdBcm27xxRegistersAddress
>> gBcm283xTokenSpaceGuid.PcdBcm283xRegistersAddress
>> + gBcm283xTokenSpaceGuid.PcdMboxBaseAddress
>> [Ppis]
>> gArmMpCoreInfoPpiGuid
>> diff --git a/Platform/RaspberryPi/RPi3/RPi3.dsc
>> b/Platform/RaspberryPi/RPi3/RPi3.dsc
>> index 4e5a9f0b05e6..88af37e6edaa 100644
>> --- a/Platform/RaspberryPi/RPi3/RPi3.dsc
>> +++ b/Platform/RaspberryPi/RPi3/RPi3.dsc
>> @@ -376,6 +376,9 @@ [PcdsFixedAtBuild.common]
>> # Device specific addresses
>> #
>> gBcm283xTokenSpaceGuid.PcdBcm283xRegistersAddress|0x3f000000
>
> The RegistersAddress 'base' changes in the 2711,
>
>> + gBcm283xTokenSpaceGuid.PcdMboxBaseAddress|0x3f00b880
>> + gBcm283xTokenSpaceGuid.PcdWdogBaseAddress|0x3f100000
>
> but the BaseAddress 'offset' stay constant.
>
> Why not use this approach instead?
>
> #define BCM2836_WDOG_OFFSET 0x00100000
> #define BCM2836_WDOG_BASE_ADDRESS \
> (FixedPcdGet64 (PcdBcm283xRegistersAddress) \
> + BCM2836_WDOG_OFFSET)
>
> (and similarly with other devices).
I guess we might have been initially worried that some of the offsets
might not be the same between Bcm2386 and Bcm2711 (which I agree is
unlikely... but you never know what a SoC manufacturer might do).
I have however confirmed that the offsets are the same for the registers
we use. I will therefore send a v2 with the change you suggest.
Regards,
/Pete
>
>> ## NS16550 compatible UART
>> gEfiMdeModulePkgTokenSpaceGuid.PcdSerialRegisterBase|0x3f215040
>> gEfiMdeModulePkgTokenSpaceGuid.PcdSerialUseMmio|TRUE
>> diff --git a/Silicon/Broadcom/Bcm283x/Bcm283x.dec
>> b/Silicon/Broadcom/Bcm283x/Bcm283x.dec
>> index 5b839b00d286..fe1907cb8cf1 100644
>> --- a/Silicon/Broadcom/Bcm283x/Bcm283x.dec
>> +++ b/Silicon/Broadcom/Bcm283x/Bcm283x.dec
>> @@ -21,3 +21,5 @@ [Guids]
>> [PcdsFixedAtBuild.common]
>>
>> gBcm283xTokenSpaceGuid.PcdBcm283xRegistersAddress|0x0|UINT32|0x00000001
>> + gBcm283xTokenSpaceGuid.PcdMboxBaseAddress|0x0|UINT32|0x00000002
>> + gBcm283xTokenSpaceGuid.PcdWdogBaseAddress|0x0|UINT32|0x00000003
>> diff --git
>> a/Silicon/Broadcom/Bcm283x/Include/IndustryStandard/Bcm2836.h
>> b/Silicon/Broadcom/Bcm283x/Include/IndustryStandard/Bcm2836.h
>> index 8bd68c234bfd..6bc21f0ddcf8 100644
>> --- a/Silicon/Broadcom/Bcm283x/Include/IndustryStandard/Bcm2836.h
>> +++ b/Silicon/Broadcom/Bcm283x/Include/IndustryStandard/Bcm2836.h
>> @@ -23,7 +23,7 @@
>> #define BCM2836_DMA_DEVICE_OFFSET 0xc0000000
>> /* watchdog constants */
>> -#define BCM2836_WDOG_BASE_ADDRESS 0x3f100000
>> +#define BCM2836_WDOG_BASE_ADDRESS
>> (FixedPcdGet64 (PcdWdogBaseAddress))
>> #define BCM2836_WDOG_PASSWORD 0x5a000000
>> #define BCM2836_WDOG_RSTC_OFFSET 0x0000001c
>> #define BCM2836_WDOG_WDOG_OFFSET 0x00000024
>> @@ -31,7 +31,7 @@
>> #define BCM2836_WDOG_RSTC_WRCFG_FULL_RESET 0x00000020
>> /* mailbox interface constants */
>> -#define BCM2836_MBOX_BASE_ADDRESS 0x3f00b880
>> +#define BCM2836_MBOX_BASE_ADDRESS
>> (FixedPcdGet64 (PcdMboxBaseAddress))
>> #define BCM2836_MBOX_READ_OFFSET 0x00000000
>> #define BCM2836_MBOX_STATUS_OFFSET 0x00000018
>> #define BCM2836_MBOX_CONFIG_OFFSET 0x0000001c
>>
>
next prev parent reply other threads:[~2019-11-18 13:32 UTC|newest]
Thread overview: 33+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-11-14 16:07 [edk2-platforms][PATCH 0/8] Platform/RPi: Early Raspberry Pi 4 groundwork Pete Batard
2019-11-14 16:07 ` [edk2-platforms][PATCH 1/8] Platform/RPi: Add model family detection Pete Batard
2019-11-14 16:36 ` [edk2-devel] " Michael Brown
2019-11-14 16:55 ` Pete Batard
2019-11-18 17:51 ` Leif Lindholm
2019-11-18 17:58 ` Pete Batard
2019-11-18 18:05 ` Leif Lindholm
2019-11-18 18:32 ` Pete Batard
2019-11-19 15:07 ` Ard Biesheuvel
2019-11-19 16:30 ` [edk2-devel] " Pete Batard
2019-11-20 10:27 ` Leif Lindholm
2019-11-20 21:50 ` Pete Batard
2019-11-21 8:55 ` Laszlo Ersek
2019-11-21 9:04 ` Laszlo Ersek
2019-11-21 20:02 ` Pete Batard
2019-11-14 16:07 ` [edk2-platforms][PATCH 2/8] Platform/RPi: Replace Bcm283x SoC base register address with a PCD Pete Batard
2019-11-18 16:48 ` Leif Lindholm
2019-11-18 17:19 ` [edk2-devel] " samer.el-haj-mahmoud
2019-11-18 17:26 ` Leif Lindholm
2019-11-14 16:07 ` [edk2-platforms][PATCH 3/8] Silicon/Broadcom: Add Bcm2711 header Pete Batard
2019-11-18 16:50 ` Leif Lindholm
2019-11-14 16:07 ` [edk2-platforms][PATCH 4/8] Platform/RPi: Read more variables from VideoCore during early init Pete Batard
2019-11-18 17:11 ` Leif Lindholm
2019-11-14 16:07 ` [edk2-platforms][PATCH 5/8] Platform/RPi: Clean up and improve early memory init Pete Batard
2019-11-18 17:20 ` Leif Lindholm
2019-11-18 17:34 ` Pete Batard
2019-11-18 17:38 ` Leif Lindholm
2019-11-18 17:40 ` Pete Batard
2019-11-14 16:07 ` [edk2-platforms][PATCH 6/8] Platform/RPi: Replace Mailbox and Watchdog addresses with PCDs Pete Batard
2019-11-18 11:13 ` Philippe Mathieu-Daudé
2019-11-18 13:32 ` Pete Batard [this message]
2019-11-14 16:07 ` [edk2-platforms][PATCH 7/8] Platform/RPi: Replace MMCHS1BASE define with a PCD Pete Batard
2019-11-14 16:07 ` [edk2-platforms][PATCH 8/8] Platform/RPi: Replace DW2_USB_BASE_ADDRESS " Pete Batard
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-list from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4aa869a1-52b3-f724-9899-6c9c580a0b95@akeo.ie \
--to=devel@edk2.groups.io \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox