From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wr1-f66.google.com (mail-wr1-f66.google.com [209.85.221.66]) by mx.groups.io with SMTP id smtpd.web12.4963.1574083925588222372 for ; Mon, 18 Nov 2019 05:32:06 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@akeo-ie.20150623.gappssmtp.com header.s=20150623 header.b=kN8I32pU; spf=none, err=permanent DNS error (domain: akeo.ie, ip: 209.85.221.66, mailfrom: pete@akeo.ie) Received: by mail-wr1-f66.google.com with SMTP id e6so19522194wrw.1 for ; Mon, 18 Nov 2019 05:32:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=akeo-ie.20150623.gappssmtp.com; s=20150623; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=bhknmFGHXCWDjzNrlYDS/3w49YRUBO3HUwCtJU9jzSI=; b=kN8I32pUxXmoK5JfIeUt4fvvafrvY83AiMe6gOucPQbHq1sMbEyPILGay4GQeKOeXD Kkv1lvarimF350BAwGljgClO+sPZfB9Ks/UAv70giH19iN7PmYNwYcMIho5hu6LY63zj QGJG8Dj0HpUV0O6SCrGR02EYWkKIvpRJf0Hu7dBJe7Sl2HPbLyTo6pXCe6uGO9mV98Hn RAl5E+eUX3cmw0tNdTKP0Ur538Snc+uZfqCtFTZRtXs0AFj1iwu9NcawvOHHpXs5kEf5 R20LodTTw3JcFWHXN1vp4HKDs6MTahp3askmeSHTVV8580hOCZR/9I3qd6ZeohDey7TR mpuw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=bhknmFGHXCWDjzNrlYDS/3w49YRUBO3HUwCtJU9jzSI=; b=R0/PJ95kNTp3nofWp/cjtvnaF7O7KyTjwJzMp5YYB8XEexGfc5HbwUGqUaZSU9Rr4F Fif0guPw7NxfTDaxyac3A5ZCT2UtXKu//ScOXXCflwN7qnM+A9nTf/Lh0jGvSmbPNIvK XbzTLUDmhFl+/Dd4bah3tHpfdpXuSGpHlUkkFNGWbewr5t2+0WN0CWD1oTf9I08/9Z5M Xz4YtqPA0Eg6AabMMTG1oJZ3NMSfEPx6d6Y8u9KLfFQUt+8fqcRa6YIJDUe2F0QMbYia iNmYBJK9I5UlomWlDATwI7RjKeOuoJj2ClnafNkflX2Op3V6n0ckcQyO5VdRw1lg64gQ MtbQ== X-Gm-Message-State: APjAAAXWicTPxqBtcpPH6j9zZktQHMzKsyNW7wa3HtqGfR07yoHUyqbR 5clq2HHlp2ZZ7w45Qoc/XNo9bA== X-Google-Smtp-Source: APXvYqxnyHbE6SDCPcnhS7xOvvUTPSVrJpaGBjGdb93PK7aj+M3sZfXUJx08J4Hvhq4qq3qQzKC6GA== X-Received: by 2002:adf:ed49:: with SMTP id u9mr27160978wro.259.1574083924062; Mon, 18 Nov 2019 05:32:04 -0800 (PST) Return-Path: Received: from [10.0.0.122] ([84.203.67.47]) by smtp.googlemail.com with ESMTPSA id v9sm22558741wrs.95.2019.11.18.05.32.02 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 18 Nov 2019 05:32:02 -0800 (PST) Subject: Re: [edk2-platforms][PATCH 6/8] Platform/RPi: Replace Mailbox and Watchdog addresses with PCDs To: =?UTF-8?Q?Philippe_Mathieu-Daud=c3=a9?= , devel@edk2.groups.io, Samer El-Haj-Mahmoud Cc: ard.biesheuvel@linaro.org, leif.lindholm@linaro.org References: <20191114160740.10072-1-pete@akeo.ie> <20191114160740.10072-7-pete@akeo.ie> <6f581579-2444-d9e8-4474-cab6b28e93a9@redhat.com> From: "Pete Batard" Message-ID: <4aa869a1-52b3-f724-9899-6c9c580a0b95@akeo.ie> Date: Mon, 18 Nov 2019 13:32:01 +0000 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.9.1 MIME-Version: 1.0 In-Reply-To: <6f581579-2444-d9e8-4474-cab6b28e93a9@redhat.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-GB Content-Transfer-Encoding: 8bit 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 >> >> 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 >> --- >>   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 >> >