From nobody Mon May 6 03:30:32 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) client-ip=66.175.222.12; envelope-from=bounce+27952+50690+1787277+3901457@groups.io; helo=web01.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+50690+1787277+3901457@groups.io ARC-Seal: i=1; a=rsa-sha256; t=1573747676; cv=none; d=zoho.com; s=zohoarc; b=hMRuBw6E5lPvOwWx0X9q8A27LPaoouJYOnGdOwhVld2/xA4TsK4s6VB71guAwXdjsGxIJZow0Uls/7SbiNtqGVfwN/pLI+uaakURmBTZWA4sRhZ8tKLMm55SlsmQAerjeYubjuHs8ep0c9LZLBD8oNE4+V+oMfr5WhdNEkr+ZKI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1573747676; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Id:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To; bh=vWWUEd5A8MtevfWICDez9kvoyvey2Zv/R7sI9ktNN1Q=; b=eavqglVY9EROecXMu65R0NzuMQNDVxxQqLPs9HrgIXwtMnnrOPqjZUSUnDhezN/so/CbmXhWH7dpOGhxQvHqXGvU/muM82+A9eZAYfcpT7XajMymROpsuMuN+Vj4gflm66prdvZoBHZPbxla5c1R3HBdEB/8WtQohsCK12cOYNU= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=pass; spf=pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+50690+1787277+3901457@groups.io Received: from web01.groups.io (web01.groups.io [66.175.222.12]) by mx.zohomail.com with SMTPS id 157374767679469.90101393765951; Thu, 14 Nov 2019 08:07:56 -0800 (PST) Return-Path: X-Received: by 127.0.0.2 with SMTP id 2HTPYY1788612xKuubYf1psx; Thu, 14 Nov 2019 08:07:55 -0800 X-Received: from mail-wr1-f67.google.com (mail-wr1-f67.google.com [209.85.221.67]) by mx.groups.io with SMTP id smtpd.web10.6492.1573747674773957432 for ; Thu, 14 Nov 2019 08:07:55 -0800 X-Received: by mail-wr1-f67.google.com with SMTP id i10so7107606wrs.7 for ; Thu, 14 Nov 2019 08:07:54 -0800 (PST) X-Gm-Message-State: 90YtMGA1xZJRbXwRBm5cQSGyx1787277AA= X-Google-Smtp-Source: APXvYqw4g/8sNnMa8P9K4lw0g2hyfxjMzBZseONWYGbzmFqjumj5uDpLMry7mNLp3prdv/kVdvYBCw== X-Received: by 2002:a05:6000:1083:: with SMTP id y3mr8548900wrw.290.1573747673066; Thu, 14 Nov 2019 08:07:53 -0800 (PST) X-Received: from localhost.localdomain ([84.203.67.47]) by smtp.gmail.com with ESMTPSA id a16sm6793088wmd.11.2019.11.14.08.07.51 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 14 Nov 2019 08:07:52 -0800 (PST) From: "Pete Batard" To: devel@edk2.groups.io Cc: ard.biesheuvel@linaro.org, leif.lindholm@linaro.org, philmd@redhat.com Subject: [edk2-devel] [edk2-platforms][PATCH 1/8] Platform/RPi: Add model family detection Date: Thu, 14 Nov 2019 16:07:33 +0000 Message-Id: <20191114160740.10072-2-pete@akeo.ie> In-Reply-To: <20191114160740.10072-1-pete@akeo.ie> References: <20191114160740.10072-1-pete@akeo.ie> MIME-Version: 1.0 Precedence: Bulk List-Unsubscribe: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,pete@akeo.ie Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1573747675; bh=SxcAl1C8wUqRaSWDgpsdlfG0OFWoEvLbGXTC8wr3vDw=; h=Cc:Date:From:Reply-To:Subject:To; b=gZ2nLbKP82WNCmGjs3G7aM+d3lmWvhoEeixwzwoKC1cH8OlrvzuzeJMefcb2mZAT+CT FVOA16I5CkC0ytw7Q2W+ikcJAtJBcLIxeNPW7RMcxJtDsYBJENIhg8xNca0SszISQtBxJ CnxSMhTWSkOIsdM+umHph9Ok5JCX33MOVnQ= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Type: text/plain; charset="utf-8" From: Samer El-Haj-Mahmoud Add GetModelFamily to RASPBERRY_PI_FIRMWARE_PROTOCOL. This uses the board revision to return a numeric value representing the RPi family (1=3DRPi, 2=3DRPi2, 3=3DRPi3 and 4=3DRPi4). Knowing the Pi family will help us set the SD card routing when we introduce support for the Pi 4 and should also be easier to maintain than if using individual model detection. Also add a missing entry for the "Raspberry Pi Compute Module 3+" in RpiFirmwareGetModelName (). Signed-off-by: Pete Batard --- Platform/RaspberryPi/Drivers/RpiFirmwareDxe/RpiFirmwareDxe.c | 64 ++++++++= ++++++++++++ Platform/RaspberryPi/Include/Protocol/RpiFirmware.h | 8 +++ 2 files changed, 72 insertions(+) diff --git a/Platform/RaspberryPi/Drivers/RpiFirmwareDxe/RpiFirmwareDxe.c b= /Platform/RaspberryPi/Drivers/RpiFirmwareDxe/RpiFirmwareDxe.c index 9b4aa068857c..dd61ef089ca7 100644 --- a/Platform/RaspberryPi/Drivers/RpiFirmwareDxe/RpiFirmwareDxe.c +++ b/Platform/RaspberryPi/Drivers/RpiFirmwareDxe/RpiFirmwareDxe.c @@ -1,5 +1,6 @@ /** @file * + * Copyright (c) 2019, ARM Limited. All rights reserved. * Copyright (c) 2017-2018, Andrei Warkentin * Copyright (c) 2016, Linaro, Ltd. All rights reserved. * @@ -595,6 +596,8 @@ RpiFirmwareGetModelName ( return "Raspberry Pi 3 Model B+"; case 0x0E: return "Raspberry Pi 3 Model A+"; + case 0x10: + return "Raspberry Pi Compute Module 3+"; case 0x11: return "Raspberry Pi 4 Model B"; default: @@ -602,6 +605,66 @@ RpiFirmwareGetModelName ( } } =20 +STATIC +EFI_STATUS +EFIAPI +RPiFirmwareGetModelFamily ( + OUT UINT32 *ModelFamily + ) +{ + EFI_STATUS Status; + UINT32 Revision; + UINT32 ModelId; + + Status =3D RpiFirmwareGetModelRevision(&Revision); + if (EFI_ERROR(Status)) { + DEBUG ((DEBUG_ERROR, + "%a: Could not get the board revision: Status =3D=3D %r\n", + __FUNCTION__, Status)); + return EFI_DEVICE_ERROR; + } else { + ModelId =3D (Revision >> 4) & 0xFF; + } + + switch (ModelId) { + // www.raspberrypi.org/documentation/hardware/raspberrypi/revision-codes= /README.md + case 0x00: // Raspberry Pi Model A + case 0x01: // Raspberry Pi Model B + case 0x02: // Raspberry Pi Model A+ + case 0x03: // Raspberry Pi Model B+ + case 0x06: // Raspberry Pi Compute Module 1 + case 0x09: // Raspberry Pi Zero + case 0x0C: // Raspberry Pi Zero W + *ModelFamily =3D 1; + break; + case 0x04: // Raspberry Pi 2 Model B + *ModelFamily =3D 2; + break; + case 0x08: // Raspberry Pi 3 Model B + case 0x0A: // Raspberry Pi Compute Module 3 + case 0x0D: // Raspberry Pi 3 Model B+ + case 0x0E: // Raspberry Pi 3 Model A+ + case 0x10: // Raspberry Pi Compute Module 3+ + *ModelFamily =3D 3; + break; + case 0x11: // Raspberry Pi 4 Model B + *ModelFamily =3D 4; + break; + default: + *ModelFamily =3D 0; + break; + } + + if (*ModelFamily =3D=3D 0) { + DEBUG ((DEBUG_ERROR, + "%a: Unknown Raspberry Pi model family : ModelId =3D=3D 0x%x\n", + __FUNCTION__, ModelId)); + return EFI_UNSUPPORTED; + } + + return EFI_SUCCESS; +} + STATIC CHAR8* EFIAPI @@ -1168,6 +1231,7 @@ STATIC RASPBERRY_PI_FIRMWARE_PROTOCOL mRpiFirmwarePro= tocol =3D { RpiFirmwareGetModel, RpiFirmwareGetModelRevision, RpiFirmwareGetModelName, + RPiFirmwareGetModelFamily, RpiFirmwareGetFirmwareRevision, RpiFirmwareGetManufacturerName, RpiFirmwareGetCpuName, diff --git a/Platform/RaspberryPi/Include/Protocol/RpiFirmware.h b/Platform= /RaspberryPi/Include/Protocol/RpiFirmware.h index e49d6e6132d9..e3287e3c040f 100644 --- a/Platform/RaspberryPi/Include/Protocol/RpiFirmware.h +++ b/Platform/RaspberryPi/Include/Protocol/RpiFirmware.h @@ -1,5 +1,6 @@ /** @file * + * Copyright (c) 2019, ARM Limited. All rights reserved. * Copyright (c) 2016, Linaro Limited. All rights reserved. * * SPDX-License-Identifier: BSD-2-Clause-Patent @@ -102,6 +103,12 @@ CHAR8* INTN ModelId ); =20 +typedef +EFI_STATUS +(EFIAPI *GET_MODEL_FAMILY) ( + UINT32 *ModelFamily + ); + typedef EFI_STATUS (EFIAPI *GET_FIRMWARE_REVISION) ( @@ -143,6 +150,7 @@ typedef struct { GET_MODEL GetModel; GET_MODEL_REVISION GetModelRevision; GET_MODEL_NAME GetModelName; + GET_MODEL_FAMILY GetModelFamily; GET_FIRMWARE_REVISION GetFirmwareRevision; GET_MANUFACTURER_NAME GetManufacturerName; GET_CPU_NAME GetCpuName; --=20 2.21.0.windows.1 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#50690): https://edk2.groups.io/g/devel/message/50690 Mute This Topic: https://groups.io/mt/57792459/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- From nobody Mon May 6 03:30:32 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) client-ip=66.175.222.12; envelope-from=bounce+27952+50691+1787277+3901457@groups.io; helo=web01.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+50691+1787277+3901457@groups.io ARC-Seal: i=1; a=rsa-sha256; t=1573747680; cv=none; d=zoho.com; s=zohoarc; b=SVePyC7TiSXcFhhsTQWl1uhtwflgfBGitHFOTCQfuIwyENbl7+9orQROaawSPnn7DbIlP3C7Yo/VbHVeYT+GXEhvnoNPsrZlIjw+GqJ9udxB1Y4x2IbEfqWaOLFs4hB+kuZIYJMxVB+WHqW2gX3RQEq6aC5pr2k3BYIAbZfytO4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1573747680; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Id:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To; bh=sKyeIeOpCk05Q5meq/6CZ2F6SpOUESLOVKGwmipLbgU=; b=eHMyBHkROEFn0xgIAiMnSfrr3Z7jOz+Py2ETkUH/LKwMG7O5Tju1Nb8Mu+f4f03QSt7Nd8QUlSXVNNpargTAIZpljG7G4ysznNadtHaGX2gYUGtnAHMfwo8jVq2yIqEJVdGZVCfDbdHT4bg+aVfs5bFG5ozw79pygvqLt3uHxDU= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=pass; spf=pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+50691+1787277+3901457@groups.io Received: from web01.groups.io (web01.groups.io [66.175.222.12]) by mx.zohomail.com with SMTPS id 1573747679925845.9251142962639; Thu, 14 Nov 2019 08:07:59 -0800 (PST) Return-Path: X-Received: by 127.0.0.2 with SMTP id k2psYY1788612xV5Mqj6EChQ; Thu, 14 Nov 2019 08:07:58 -0800 X-Received: from mail-wr1-f66.google.com (mail-wr1-f66.google.com [209.85.221.66]) by mx.groups.io with SMTP id smtpd.web09.6383.1573747677456414388 for ; Thu, 14 Nov 2019 08:07:57 -0800 X-Received: by mail-wr1-f66.google.com with SMTP id n1so7085197wra.10 for ; Thu, 14 Nov 2019 08:07:57 -0800 (PST) X-Gm-Message-State: 4qY6jvKFFwO2SilgdYXYwqysx1787277AA= X-Google-Smtp-Source: APXvYqzTeDnCHJiMtHEcySFh0SmKPAzwlSjlkEQqdJZbDutyM10fXgRf+7CH6jeCgvUu6mq84YBxlQ== X-Received: by 2002:adf:9323:: with SMTP id 32mr8922633wro.15.1573747675554; Thu, 14 Nov 2019 08:07:55 -0800 (PST) X-Received: from localhost.localdomain ([84.203.67.47]) by smtp.gmail.com with ESMTPSA id a16sm6793088wmd.11.2019.11.14.08.07.53 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 14 Nov 2019 08:07:54 -0800 (PST) From: "Pete Batard" To: devel@edk2.groups.io Cc: ard.biesheuvel@linaro.org, leif.lindholm@linaro.org, philmd@redhat.com Subject: [edk2-devel] [edk2-platforms][PATCH 2/8] Platform/RPi: Replace Bcm283x SoC base register address with a PCD Date: Thu, 14 Nov 2019 16:07:34 +0000 Message-Id: <20191114160740.10072-3-pete@akeo.ie> In-Reply-To: <20191114160740.10072-1-pete@akeo.ie> References: <20191114160740.10072-1-pete@akeo.ie> MIME-Version: 1.0 Precedence: Bulk List-Unsubscribe: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,pete@akeo.ie Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1573747678; bh=AUR6MvkX+2UWCklyw2WVaM2E+YROArxwPzz1+PcuPQQ=; h=Cc:Date:From:Reply-To:Subject:To; b=SCiDp0HfjPjTxuH62jdWoT66fcVUQHX+SyZ5N+KPcIZgGEnBqNbiz7kK+scMeKNJXrf eM/g9jVHRvbdi516FfUnb+yrS0FKpk3gAzG/WKb3Brf5BLumm6Ja624yumoutYhedinQU G3snGg8Nke/ttdDPrktQa/pajteMOEGiBsc= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Type: text/plain; charset="utf-8" From: Samer El-Haj-Mahmoud 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 --- Platform/RaspberryPi/Drivers/ArasanMmcHostDxe/ArasanMmcHostDxe.inf | 2 ++ Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxe.inf | 2 ++ Platform/RaspberryPi/Drivers/DwUsbHostDxe/DwUsbHostDxe.inf | 4 ++++ Platform/RaspberryPi/Drivers/RpiFirmwareDxe/RpiFirmwareDxe.inf | 5 +++= +- Platform/RaspberryPi/Drivers/SdHostDxe/SdHostDxe.inf | 2 ++ Platform/RaspberryPi/Library/PlatformLib/PlatformLib.inf | 3 ++- Platform/RaspberryPi/RPi3/RPi3.dsc | 6 +++= ++- Silicon/Broadcom/Bcm283x/Bcm283x.dec | 7 +++= ++++ Silicon/Broadcom/Bcm283x/Drivers/InterruptDxe/InterruptDxe.inf | 4 +++- Silicon/Broadcom/Bcm283x/Drivers/RngDxe/RngDxe.inf | 5 +++= ++ Silicon/Broadcom/Bcm283x/Include/IndustryStandard/Bcm2836.h | 3 ++- Silicon/Broadcom/Bcm283x/Library/GpioLib/GpioLib.inf | 4 ++++ 12 files changed, 42 insertions(+), 5 deletions(-) diff --git a/Platform/RaspberryPi/Drivers/ArasanMmcHostDxe/ArasanMmcHostDxe= .inf b/Platform/RaspberryPi/Drivers/ArasanMmcHostDxe/ArasanMmcHostDxe.inf index 3f0d7b6b9e9d..034c8c449f00 100644 --- a/Platform/RaspberryPi/Drivers/ArasanMmcHostDxe/ArasanMmcHostDxe.inf +++ b/Platform/RaspberryPi/Drivers/ArasanMmcHostDxe/ArasanMmcHostDxe.inf @@ -1,5 +1,6 @@ #/** @file # +# Copyright (c) 2019, ARM Limited. All rights reserved. # Copyright (c) 2017, Andrei Warkentin # Copyright (c) Microsoft Corporation. All rights reserved. # @@ -42,6 +43,7 @@ [Protocols] =20 [Pcd] gRaspberryPiTokenSpaceGuid.PcdSdIsArasan + gBcm283xTokenSpaceGuid.PcdBcm283xRegistersAddress =20 [Depex] gRaspberryPiFirmwareProtocolGuid AND gRaspberryPiConfigAppliedProtocolGu= id diff --git a/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxe.inf b/Platfor= m/RaspberryPi/Drivers/ConfigDxe/ConfigDxe.inf index 28fc2682b585..4f4fdef4e003 100644 --- a/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxe.inf +++ b/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxe.inf @@ -1,5 +1,6 @@ #/** @file # +# Copyright (c) 2019, ARM Limited. All rights reserved. # Copyright (c) 2018, Andrei Warkentin # # SPDX-License-Identifier: BSD-2-Clause-Patent @@ -66,6 +67,7 @@ [Pcd] gRaspberryPiTokenSpaceGuid.PcdDebugShowUEFIExit gRaspberryPiTokenSpaceGuid.PcdDisplayEnableScaledVModes gRaspberryPiTokenSpaceGuid.PcdDisplayEnableSShot + gBcm283xTokenSpaceGuid.PcdBcm283xRegistersAddress =20 [FeaturePcd] =20 diff --git a/Platform/RaspberryPi/Drivers/DwUsbHostDxe/DwUsbHostDxe.inf b/P= latform/RaspberryPi/Drivers/DwUsbHostDxe/DwUsbHostDxe.inf index e880c2fb0261..8817f20622d6 100644 --- a/Platform/RaspberryPi/Drivers/DwUsbHostDxe/DwUsbHostDxe.inf +++ b/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 # Copyright (c) 2015-2016, Linaro Limited. All rights reserved. # @@ -51,5 +52,8 @@ [Protocols] gEfiUsb2HcProtocolGuid gRaspberryPiFirmwareProtocolGuid =20 +[FixedPcd] + gBcm283xTokenSpaceGuid.PcdBcm283xRegistersAddress + [Depex] gRaspberryPiFirmwareProtocolGuid diff --git a/Platform/RaspberryPi/Drivers/RpiFirmwareDxe/RpiFirmwareDxe.inf= b/Platform/RaspberryPi/Drivers/RpiFirmwareDxe/RpiFirmwareDxe.inf index 87bca98fec28..a3fc0fa49a3c 100644 --- a/Platform/RaspberryPi/Drivers/RpiFirmwareDxe/RpiFirmwareDxe.inf +++ b/Platform/RaspberryPi/Drivers/RpiFirmwareDxe/RpiFirmwareDxe.inf @@ -1,5 +1,5 @@ #/** @file -# +# Copyright (c) 2019, ARM Limited. All rights reserved. # Copyright (c) 2017-2018, Andrei Warkentin # Copyright (c) 2016, Linaro, Ltd. All rights reserved. # @@ -40,5 +40,8 @@ [LibraryClasses] [Protocols] gRaspberryPiFirmwareProtocolGuid ## PRODUCES =20 +[FixedPcd] + gBcm283xTokenSpaceGuid.PcdBcm283xRegistersAddress + [Depex] TRUE diff --git a/Platform/RaspberryPi/Drivers/SdHostDxe/SdHostDxe.inf b/Platfor= m/RaspberryPi/Drivers/SdHostDxe/SdHostDxe.inf index 7386ff251864..b99f197bb007 100644 --- a/Platform/RaspberryPi/Drivers/SdHostDxe/SdHostDxe.inf +++ b/Platform/RaspberryPi/Drivers/SdHostDxe/SdHostDxe.inf @@ -1,5 +1,6 @@ #/** @file # +# Copyright (c) 2019, ARM Limited. All rights reserved. # Copyright (c) 2017, Andrei Warkentin # Copyright (c) Microsoft Corporation. All rights reserved. # @@ -44,6 +45,7 @@ [Protocols] =20 [Pcd] gRaspberryPiTokenSpaceGuid.PcdSdIsArasan + gBcm283xTokenSpaceGuid.PcdBcm283xRegistersAddress =20 [Depex] gRaspberryPiFirmwareProtocolGuid AND gRaspberryPiConfigAppliedProtocolGu= id diff --git a/Platform/RaspberryPi/Library/PlatformLib/PlatformLib.inf b/Pla= tform/RaspberryPi/Library/PlatformLib/PlatformLib.inf index ed986034b957..85462febdd8d 100644 --- a/Platform/RaspberryPi/Library/PlatformLib/PlatformLib.inf +++ b/Platform/RaspberryPi/Library/PlatformLib/PlatformLib.inf @@ -2,7 +2,7 @@ # # Copyright (c) 2017-2018, Andrei Warkentin # 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 # @@ -54,6 +54,7 @@ [FixedPcd] gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableSize gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwWorkingSize gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwSpareSize + gBcm283xTokenSpaceGuid.PcdBcm283xRegistersAddress =20 [Ppis] gArmMpCoreInfoPpiGuid diff --git a/Platform/RaspberryPi/RPi3/RPi3.dsc b/Platform/RaspberryPi/RPi3= /RPi3.dsc index a0365c5cf606..4e5a9f0b05e6 100644 --- a/Platform/RaspberryPi/RPi3/RPi3.dsc +++ b/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 @@ -372,6 +372,10 @@ [PcdsFixedAtBuild.common] gArmTokenSpaceGuid.PcdSystemMemoryBase|0x00400000 gArmTokenSpaceGuid.PcdSystemMemorySize|0x3FC00000 =20 + # + # Device specific addresses + # + gBcm283xTokenSpaceGuid.PcdBcm283xRegistersAddress|0x3f000000 ## NS16550 compatible UART gEfiMdeModulePkgTokenSpaceGuid.PcdSerialRegisterBase|0x3f215040 gEfiMdeModulePkgTokenSpaceGuid.PcdSerialUseMmio|TRUE diff --git a/Silicon/Broadcom/Bcm283x/Bcm283x.dec b/Silicon/Broadcom/Bcm283= x/Bcm283x.dec index ec62ff27fbb3..5b839b00d286 100644 --- a/Silicon/Broadcom/Bcm283x/Bcm283x.dec +++ b/Silicon/Broadcom/Bcm283x/Bcm283x.dec @@ -1,5 +1,6 @@ ## @file # +# Copyright (c) 2019, ARM Limited. All rights reserved. # Copyright (c) 2019, Pete Batard # # SPDX-License-Identifier: BSD-2-Clause-Patent @@ -14,3 +15,9 @@ [Defines] =20 [Includes] Include + +[Guids] + gBcm283xTokenSpaceGuid =3D {0x82f36a92, 0xfb7e, 0x43a1, {0xb9, 0x9e, 0x4= 9, 0x13, 0x3f, 0xc7, 0xa4, 0x2e}} + +[PcdsFixedAtBuild.common] + gBcm283xTokenSpaceGuid.PcdBcm283xRegistersAddress|0x0|UINT32|0x00000001 diff --git a/Silicon/Broadcom/Bcm283x/Drivers/InterruptDxe/InterruptDxe.inf= b/Silicon/Broadcom/Bcm283x/Drivers/InterruptDxe/InterruptDxe.inf index cdce11a51e14..6c58df5c3285 100644 --- a/Silicon/Broadcom/Bcm283x/Drivers/InterruptDxe/InterruptDxe.inf +++ b/Silicon/Broadcom/Bcm283x/Drivers/InterruptDxe/InterruptDxe.inf @@ -1,5 +1,5 @@ #/** @file -# +# Copyright (c) 2019, ARM Limited. All rights reserved. # Copyright (c) 2017, Andrei Warkentin # Copyright (c) 2016 Linaro, Ltd. All rights reserved. # @@ -30,6 +30,7 @@ [LibraryClasses] UefiBootServicesTableLib UefiLib UefiDriverEntryPoint + PcdLib =20 [Protocols] gHardwareInterruptProtocolGuid ## PRODUCES @@ -37,6 +38,7 @@ [Protocols] =20 [FixedPcd] gEmbeddedTokenSpaceGuid.PcdInterruptBaseAddress + gBcm283xTokenSpaceGuid.PcdBcm283xRegistersAddress =20 [Depex] TRUE diff --git a/Silicon/Broadcom/Bcm283x/Drivers/RngDxe/RngDxe.inf b/Silicon/B= roadcom/Bcm283x/Drivers/RngDxe/RngDxe.inf index cb1695bd2dfc..4481d71aaff0 100644 --- a/Silicon/Broadcom/Bcm283x/Drivers/RngDxe/RngDxe.inf +++ b/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 @@ -28,6 +29,7 @@ [LibraryClasses] IoLib UefiBootServicesTableLib UefiDriverEntryPoint + PcdLib =20 [Protocols] gEfiRngProtocolGuid ## PRODUCES @@ -35,5 +37,8 @@ [Protocols] [Guids] gEfiRngAlgorithmRaw =20 +[FixedPcd] + gBcm283xTokenSpaceGuid.PcdBcm283xRegistersAddress + [Depex] TRUE diff --git a/Silicon/Broadcom/Bcm283x/Include/IndustryStandard/Bcm2836.h b/= Silicon/Broadcom/Bcm283x/Include/IndustryStandard/Bcm2836.h index 4007301228be..8bd68c234bfd 100644 --- a/Silicon/Broadcom/Bcm283x/Include/IndustryStandard/Bcm2836.h +++ b/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 * Copyright (c) 2016, Linaro Limited. All rights reserved. * @@ -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 =20 /* diff --git a/Silicon/Broadcom/Bcm283x/Library/GpioLib/GpioLib.inf b/Silicon= /Broadcom/Bcm283x/Library/GpioLib/GpioLib.inf index 50da4eb771f3..ff1b5af6db6e 100644 --- a/Silicon/Broadcom/Bcm283x/Library/GpioLib/GpioLib.inf +++ b/Silicon/Broadcom/Bcm283x/Library/GpioLib/GpioLib.inf @@ -2,6 +2,7 @@ # # Manipulate GPIOs. # +# Copyright (c) 2019, ARM Limited. All rights reserved. # Copyright (c) 2018, Andrei Warkentin # # SPDX-License-Identifier: BSD-2-Clause-Patent @@ -30,4 +31,7 @@ [LibraryClasses] DebugLib IoLib =20 +[FixedPcd] + gBcm283xTokenSpaceGuid.PcdBcm283xRegistersAddress + [Guids] --=20 2.21.0.windows.1 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#50691): https://edk2.groups.io/g/devel/message/50691 Mute This Topic: https://groups.io/mt/57792526/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- From nobody Mon May 6 03:30:32 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) client-ip=66.175.222.12; envelope-from=bounce+27952+50692+1787277+3901457@groups.io; helo=web01.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+50692+1787277+3901457@groups.io ARC-Seal: i=1; a=rsa-sha256; t=1573747681; cv=none; d=zoho.com; s=zohoarc; b=mO9LN4JkqAc92HYu6uYPyA6cndPZbPtglc6GpqaHJQqi9AIsJPjgn0ubwzforg070e0h1DfVMssgkSNDX/daWcXuEs+rJm9jB6q0/3XDix5w4t28eSqxOSAoBjzdLUOBJvj0PQ2r+ayxDowX1jOI5Cx3yu19MhW9GjrkWscsS5s= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1573747681; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Id:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To; bh=15CD4DpS2Pemr+LoFRH8muVqD+njXW67GaISj5oChrQ=; b=I1oeI8mX4dHhdU9/JUv/x7R+yv0DgcAuxUkclvx0EYLFiADCIqDJhG8R4qmSJgiOMbuc2s71a3HoDlpafvKzrGugqydTLGNxeoFKQHFJCpJcfkYn1QeeXhjZuLgBD4gRRc4pYCO1dHlaTCertmHMF/BY3I09ZQJJWf72ml1zTqQ= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=pass; spf=pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+50692+1787277+3901457@groups.io Received: from web01.groups.io (web01.groups.io [66.175.222.12]) by mx.zohomail.com with SMTPS id 1573747681173123.69748925545264; Thu, 14 Nov 2019 08:08:01 -0800 (PST) Return-Path: X-Received: by 127.0.0.2 with SMTP id J2VYYY1788612xRn5As1dePi; Thu, 14 Nov 2019 08:08:00 -0800 X-Received: from mail-wr1-f65.google.com (mail-wr1-f65.google.com [209.85.221.65]) by mx.groups.io with SMTP id smtpd.web09.6385.1573747679432280361 for ; Thu, 14 Nov 2019 08:07:59 -0800 X-Received: by mail-wr1-f65.google.com with SMTP id w9so7139258wrr.0 for ; Thu, 14 Nov 2019 08:07:59 -0800 (PST) X-Gm-Message-State: p0Xg7ZB4aH8q0hxz9mQJGFs4x1787277AA= X-Google-Smtp-Source: APXvYqydwPNw/BgsVUqrDniHlgxCRR+AVyPqOGoVFZJj3ROYDxQ/tR+8YUJ5FXoA8oG6gj5xB8UU8g== X-Received: by 2002:a5d:4403:: with SMTP id z3mr8503828wrq.44.1573747676692; Thu, 14 Nov 2019 08:07:56 -0800 (PST) X-Received: from localhost.localdomain ([84.203.67.47]) by smtp.gmail.com with ESMTPSA id a16sm6793088wmd.11.2019.11.14.08.07.55 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 14 Nov 2019 08:07:56 -0800 (PST) From: "Pete Batard" To: devel@edk2.groups.io Cc: ard.biesheuvel@linaro.org, leif.lindholm@linaro.org, philmd@redhat.com Subject: [edk2-devel] [edk2-platforms][PATCH 3/8] Silicon/Broadcom: Add Bcm2711 header Date: Thu, 14 Nov 2019 16:07:35 +0000 Message-Id: <20191114160740.10072-4-pete@akeo.ie> In-Reply-To: <20191114160740.10072-1-pete@akeo.ie> References: <20191114160740.10072-1-pete@akeo.ie> MIME-Version: 1.0 Precedence: Bulk List-Unsubscribe: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,pete@akeo.ie Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1573747680; bh=VweUaWQDkaRyZA1NfIr1KdoUFljoGcY4trf4xzhzFtw=; h=Cc:Date:From:Reply-To:Subject:To; b=lNrSoJ+1sdtwd8TjmGvCR/51esn1hvewY7KfVyMIs2yYeMVIAFMxXA8y43fZJV4BQfr BsD+hif/iCsNOIQAbwSf5NvAtmaBesgJzaN5xtQHknanIbPDZdmkkpjkfLAOP3pZBHol6 aTdFH+3CVT1XASA0IpYIzhHXvgWmpq7k1+8= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Type: text/plain; charset="utf-8" Bcm2711 is the SoC used by the Raspberry Pi 4. For the most part it is backward compatible with the Bcm283x SoC used by older models but some new Bcm2711 registers have been introduced such as the ones for PCIe. We therefore introduce a new Bcm27xx module, which contains only the base address for the new registers for now (set from a PCD as is the case for Bcm283x) but which should get populated further as we add support for the Raspberry Pi 4. Signed-off-by: Pete Batard Reviewed-by: Leif Lindholm --- Silicon/Broadcom/Bcm27xx/Bcm27xx.dec | 22 +++++++++= +++++++++++ Silicon/Broadcom/Bcm27xx/Include/IndustryStandard/Bcm2711.h | 15 +++++++++= ++++ 2 files changed, 37 insertions(+) diff --git a/Silicon/Broadcom/Bcm27xx/Bcm27xx.dec b/Silicon/Broadcom/Bcm27x= x/Bcm27xx.dec new file mode 100644 index 000000000000..815302f6d209 --- /dev/null +++ b/Silicon/Broadcom/Bcm27xx/Bcm27xx.dec @@ -0,0 +1,22 @@ +## @file +# +# Copyright (c) 2019, Pete Batard +# +# SPDX-License-Identifier: BSD-2-Clause-Patent +# +## + +[Defines] + DEC_SPECIFICATION =3D 0x0001001A + PACKAGE_NAME =3D Bcm27xxPkg + PACKAGE_GUID =3D D4B585C5-EBCA-4779-B974-05A3CF2F10C4 + PACKAGE_VERSION =3D 1.0 + +[Includes] + Include + +[Guids] + gBcm27xxTokenSpaceGuid =3D {0x44045e56, 0x7056, 0x4be6, {0x88, 0xc0, 0x4= 9, 0x0c, 0x67, 0x90, 0x2f, 0xba}} + +[PcdsFixedAtBuild.common] + gBcm27xxTokenSpaceGuid.PcdBcm27xxRegistersAddress|0x0|UINT32|0x00000001 diff --git a/Silicon/Broadcom/Bcm27xx/Include/IndustryStandard/Bcm2711.h b/= Silicon/Broadcom/Bcm27xx/Include/IndustryStandard/Bcm2711.h new file mode 100644 index 000000000000..389667714214 --- /dev/null +++ b/Silicon/Broadcom/Bcm27xx/Include/IndustryStandard/Bcm2711.h @@ -0,0 +1,15 @@ +/** @file + * + * Copyright (c) 2019, Pete Batard . + * + * SPDX-License-Identifier: BSD-2-Clause-Patent + * + **/ + +#ifndef __BCM2711_H__ +#define __BCM2711_H__ + +#define BCM2711_SOC_REGISTERS (FixedPcdGet64 (PcdBcm27xxRegi= stersAddress)) +#define BCM2711_SOC_REGISTER_LENGTH 0x02000000 + +#endif /*__BCM2711_H__ */ --=20 2.21.0.windows.1 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#50692): https://edk2.groups.io/g/devel/message/50692 Mute This Topic: https://groups.io/mt/57792551/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- From nobody Mon May 6 03:30:32 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) client-ip=66.175.222.12; envelope-from=bounce+27952+50693+1787277+3901457@groups.io; helo=web01.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+50693+1787277+3901457@groups.io ARC-Seal: i=1; a=rsa-sha256; t=1573747682; cv=none; d=zoho.com; s=zohoarc; b=leLsnmy6EavEV+ziVO+NEQ8VlI9zBn/iC5zW2gXZfESL85MqLHZzyEke43O1REBRAhEkxy0UExThal6Xce68v8MgTJNIo10F/dhzVPBIcZoHMJkvDB1hcqFiCycTHDyeZgec3d1FV82lItqhgHMAt0+Vvj/9LBUJH/ukDQKlDzk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1573747682; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Id:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To; bh=Nwhju36h2Tz6jUsz48NdFpwVMdasEdjWyKBhUXoPPcM=; b=cMLnvEIhsP1l2pgamMuWcPpTh1wc07kj590R35/otsZtQOZHYwMybB82Os2Z+OaS428mgGgGQajVsfAkG0UJ23ve6KYZ5oH5wMxlWUT7NmpnYAUJH3qh2gxZ2Mso2+f2M//Ww16abn1KLniwE8fSnncsltqipKRRfTYQN5duB7M= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=pass; spf=pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+50693+1787277+3901457@groups.io Received: from web01.groups.io (web01.groups.io [66.175.222.12]) by mx.zohomail.com with SMTPS id 1573747682148655.0028626298421; Thu, 14 Nov 2019 08:08:02 -0800 (PST) Return-Path: X-Received: by 127.0.0.2 with SMTP id 4xABYY1788612x6cCLkiNfEp; Thu, 14 Nov 2019 08:08:01 -0800 X-Received: from mail-wr1-f65.google.com (mail-wr1-f65.google.com [209.85.221.65]) by mx.groups.io with SMTP id smtpd.web11.6520.1573747679927292720 for ; Thu, 14 Nov 2019 08:08:00 -0800 X-Received: by mail-wr1-f65.google.com with SMTP id s5so7125377wrw.2 for ; Thu, 14 Nov 2019 08:07:59 -0800 (PST) X-Gm-Message-State: 3kr29lGH2oeXRsmPKBbwKQGcx1787277AA= X-Google-Smtp-Source: APXvYqzHa12PV7ySOOm7UwUrJNGL07ZKMSI8wk7M6bg2Q8cl02B0yBqbfurPPZZni0BZR+4RHwRfOQ== X-Received: by 2002:a5d:4412:: with SMTP id z18mr8713276wrq.149.1573747678238; Thu, 14 Nov 2019 08:07:58 -0800 (PST) X-Received: from localhost.localdomain ([84.203.67.47]) by smtp.gmail.com with ESMTPSA id a16sm6793088wmd.11.2019.11.14.08.07.56 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 14 Nov 2019 08:07:57 -0800 (PST) From: "Pete Batard" To: devel@edk2.groups.io Cc: ard.biesheuvel@linaro.org, leif.lindholm@linaro.org, philmd@redhat.com Subject: [edk2-devel] [edk2-platforms][PATCH 4/8] Platform/RPi: Read more variables from VideoCore during early init Date: Thu, 14 Nov 2019 16:07:36 +0000 Message-Id: <20191114160740.10072-5-pete@akeo.ie> In-Reply-To: <20191114160740.10072-1-pete@akeo.ie> References: <20191114160740.10072-1-pete@akeo.ie> MIME-Version: 1.0 Precedence: Bulk List-Unsubscribe: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,pete@akeo.ie Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1573747681; bh=IuYsJeEX3F2gqtt0eYaRXpHkidS6+s0zUgcX+yd9VHY=; h=Cc:Date:From:Reply-To:Subject:To; b=O5BByBPgMKhr3Zd0+9qS6f2FJ+UxUQLtrUzytxALuAgUf7RN4ohMhng2xpl5/guRo5k pkJSJ9ST5/AvxYCs2us8GFsZ0dJXn0ltOBIgNVt0bLebLaZw3mOICvZENRDmcl4FFUYYq uP8TlQ91DGG2VKmuZc2wItswCnQL9H4AkLY= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Type: text/plain; charset="utf-8" Besides the base memory size, we can read the GPU/VideoCore base as well as the model during early init, which we'll need for improving the memory mapping. This patch adds the retrieval of these variables, as well as some early debug display of their values (which can be useful) and also removes unused variables such as mGPUMemoryBase and mGPUMemoryLength. Signed-off-by: Pete Batard --- Platform/RaspberryPi/Include/IndustryStandard/RpiMbox.h | 1 + Platform/RaspberryPi/Library/PlatformLib/AArch64/RaspberryPiHelper.S | 75 = ++++++++++++++++++-- Platform/RaspberryPi/Library/PlatformLib/RaspberryPiMem.c | 14 = +++- 3 files changed, 84 insertions(+), 6 deletions(-) diff --git a/Platform/RaspberryPi/Include/IndustryStandard/RpiMbox.h b/Plat= form/RaspberryPi/Include/IndustryStandard/RpiMbox.h index d3b6f117cfdf..584786a61dfd 100644 --- a/Platform/RaspberryPi/Include/IndustryStandard/RpiMbox.h +++ b/Platform/RaspberryPi/Include/IndustryStandard/RpiMbox.h @@ -34,6 +34,7 @@ #define RPI_MBOX_GET_MAC_ADDRESS 0x00010003 #define RPI_MBOX_GET_BOARD_SERIAL 0x00010004 #define RPI_MBOX_GET_ARM_MEMSIZE 0x00010005 +#define RPI_MBOX_GET_VC_MEMSIZE 0x00010006 =20 #define RPI_MBOX_SET_POWER_STATE 0x00028001 =20 diff --git a/Platform/RaspberryPi/Library/PlatformLib/AArch64/RaspberryPiHe= lper.S b/Platform/RaspberryPi/Library/PlatformLib/AArch64/RaspberryPiHelper= .S index 36af208d12d8..49a132c722f1 100644 --- a/Platform/RaspberryPi/Library/PlatformLib/AArch64/RaspberryPiHelper.S +++ b/Platform/RaspberryPi/Library/PlatformLib/AArch64/RaspberryPiHelper.S @@ -1,5 +1,6 @@ /** @file * + * Copyright (c) 2019, Pete Batard * Copyright (c) 2016, Linaro Limited. All rights reserved. * Copyright (c) 2011-2013, ARM Limited. All rights reserved. * @@ -52,24 +53,90 @@ ASM_FUNC (ArmPlatformPeiBootAction) ldr wzr, [x4, #BCM2836_MBOX_READ_OFFSET] dmb ld =20 + ldr w0, .Lmembase + adr x2, mSystemMemoryBase + str x0, [x2] + ldr w0, .Lmemsize sub x0, x0, #1 - adr x1, mSystemMemoryEnd - str x0, [x1] + adr x2, mSystemMemoryEnd + str x0, [x2] + + adr x0, .Lvcinfo_buffer + orr x0, x0, #RPI_MBOX_VC_CHANNEL + add x0, x0, x1 + + poll BCM2836_MBOX_STATUS_FULL + str w0, [x4, #BCM2836_MBOX_WRITE_OFFSET] + dmb sy + poll BCM2836_MBOX_STATUS_EMPTY + dmb sy + ldr wzr, [x4, #BCM2836_MBOX_READ_OFFSET] + dmb ld + + ldr w0, .Lvcbase + adr x2, mVideoCoreBase + str x0, [x2] + + ldr w0, .Lvcsize + adr x2, mVideoCoreSize + str x0, [x2] + + adr x0, .Lrevinfo_buffer + orr x0, x0, #RPI_MBOX_VC_CHANNEL + add x0, x0, x1 + + poll BCM2836_MBOX_STATUS_FULL + str w0, [x4, #BCM2836_MBOX_WRITE_OFFSET] + dmb sy + poll BCM2836_MBOX_STATUS_EMPTY + dmb sy + ldr wzr, [x4, #BCM2836_MBOX_READ_OFFSET] + dmb ld + + ldr w0, .Lrevision + adr x2, mBoardRevision + str w0, [x2] + ret =20 .align 4 .Lmeminfo_buffer: - .long .Lbuffer_size + .long .Lmeminfo_size .long 0x0 .long RPI_MBOX_GET_ARM_MEMSIZE .long 8 // buf size .long 0 // input len +.Lmembase: .long 0 // mem base .Lmemsize: .long 0 // mem size .long 0 // end tag - .set .Lbuffer_size, . - .Lmeminfo_buffer + .set .Lmeminfo_size, . - .Lmeminfo_buffer + +.Lvcinfo_buffer: + .long .Lvcinfo_size + .long 0x0 + .long RPI_MBOX_GET_VC_MEMSIZE + .long 8 // buf size + .long 0 // input len +.Lvcbase: + .long 0 // videocore base +.Lvcsize: + .long 0 // videocore size + .long 0 // end tag + .set .Lvcinfo_size, . - .Lvcinfo_buffer + +.Lrevinfo_buffer: + .long .Lrevinfo_size + .long 0x0 + .long RPI_MBOX_GET_BOARD_REVISION + .long 4 // buf size + .long 0 // input len +.Lrevision: + .long 0 // revision + .long 0 // end tag + .set .Lrevinfo_size, . - .Lrevinfo_buffer =20 //UINTN //ArmPlatformGetPrimaryCoreMpId ( diff --git a/Platform/RaspberryPi/Library/PlatformLib/RaspberryPiMem.c b/Pl= atform/RaspberryPi/Library/PlatformLib/RaspberryPiMem.c index 97d5af5260c6..2bfd3f020a6e 100644 --- a/Platform/RaspberryPi/Library/PlatformLib/RaspberryPiMem.c +++ b/Platform/RaspberryPi/Library/PlatformLib/RaspberryPiMem.c @@ -12,9 +12,11 @@ #include #include =20 +UINT64 mSystemMemoryBase; extern UINT64 mSystemMemoryEnd; -extern UINT64 mGPUMemoryBase; -extern UINT64 mGPUMemoryLength; +UINT64 mVideoCoreBase; +UINT64 mVideoCoreSize; +UINT32 mBoardRevision; =20 #define VariablesSize (FixedPcdGet32(PcdFlashNvStorageVariableSize) + \ FixedPcdGet32(PcdFlashNvStorageFtwWorkingSize) + \ @@ -87,6 +89,14 @@ ArmPlatformGetVirtualMemoryMap ( IN ARM_MEMORY_REGION_DESCRIPTOR** VirtualMemoryMap ) { + // Early output of the info we got from VideoCore can prove valuable. + DEBUG ((DEBUG_INFO, "Board Rev: 0x%lX\n", mBoardRevision)); + DEBUG ((DEBUG_INFO, "Base RAM : 0x%ll08X (Size 0x%ll08X)\n", mSystemMemo= ryBase, mSystemMemoryEnd + 1)); + DEBUG ((DEBUG_INFO, "VideoCore: 0x%ll08X (Size 0x%ll08X)\n", mVideoCoreB= ase, mVideoCoreSize)); + + ASSERT (mSystemMemoryBase =3D=3D 0); + ASSERT (VirtualMemoryMap !=3D NULL); + RaspberryPiMemoryRegionDescriptor[3].Length =3D mSystemMemoryEnd + 1 - FixedPcdGet64 (PcdSystemMemoryBase); =20 --=20 2.21.0.windows.1 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#50693): https://edk2.groups.io/g/devel/message/50693 Mute This Topic: https://groups.io/mt/57792566/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- From nobody Mon May 6 03:30:32 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) client-ip=66.175.222.12; envelope-from=bounce+27952+50694+1787277+3901457@groups.io; helo=web01.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+50694+1787277+3901457@groups.io ARC-Seal: i=1; a=rsa-sha256; t=1573747685; cv=none; d=zoho.com; s=zohoarc; b=cn4N/KaPU4M6s1xbUmG6Zw3WZIr0Y+316ZflkfcXQxnBiYNS89nYoOpIsTBrsOy1+t7Ubr4vvapacmCbOgxN4rU1ez/kOPMSQ0oRXXpLNXKLlAsmwpdsFAOZ6aD37F8vIRWqvJne6mcIcCA07AVmefpTg5XYD1hnV5vASdDBzIk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1573747685; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Id:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To; bh=cDX+fJVoyBBRv5OC6o3S3yMcMKgV2z0Wr3N/GY5/jVs=; b=W/2F65ziV70JxrNEmJqvgb1XRjrkvVPkunldAbNzQ2RfdV6r1L2zHStXzMOGxmRbRel6KOPAkd+Q36z34ckXCqYZS9WVYNmPsRPMVH7iAS5J3ZbyJKXzYzIwDxiSLae6Shc3ozs/ssVccDyODn2eEJazfsQ6RdELwPcKnKZeKSk= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=pass; spf=pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+50694+1787277+3901457@groups.io Received: from web01.groups.io (web01.groups.io [66.175.222.12]) by mx.zohomail.com with SMTPS id 157374768536265.86878984512555; Thu, 14 Nov 2019 08:08:05 -0800 (PST) Return-Path: X-Received: by 127.0.0.2 with SMTP id a3IlYY1788612xcLguwUnqyZ; Thu, 14 Nov 2019 08:08:04 -0800 X-Received: from mail-wr1-f67.google.com (mail-wr1-f67.google.com [209.85.221.67]) by mx.groups.io with SMTP id smtpd.web09.6390.1573747683757275630 for ; Thu, 14 Nov 2019 08:08:04 -0800 X-Received: by mail-wr1-f67.google.com with SMTP id l7so7111248wrp.6 for ; Thu, 14 Nov 2019 08:08:03 -0800 (PST) X-Gm-Message-State: ywWYviaZfV3Y76ibrIBXEZInx1787277AA= X-Google-Smtp-Source: APXvYqyUmu3dUXgPuxIO5Phq/wgdKyeMN1mRuO4WnQXDeUxrkhdCDYui/grwbpQaR33vmTLopexPCQ== X-Received: by 2002:adf:fad1:: with SMTP id a17mr1942327wrs.328.1573747681646; Thu, 14 Nov 2019 08:08:01 -0800 (PST) X-Received: from localhost.localdomain ([84.203.67.47]) by smtp.gmail.com with ESMTPSA id a16sm6793088wmd.11.2019.11.14.08.07.58 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 14 Nov 2019 08:08:00 -0800 (PST) From: "Pete Batard" To: devel@edk2.groups.io Cc: ard.biesheuvel@linaro.org, leif.lindholm@linaro.org, philmd@redhat.com Subject: [edk2-devel] [edk2-platforms][PATCH 5/8] Platform/RPi: Clean up and improve early memory init Date: Thu, 14 Nov 2019 16:07:37 +0000 Message-Id: <20191114160740.10072-6-pete@akeo.ie> In-Reply-To: <20191114160740.10072-1-pete@akeo.ie> References: <20191114160740.10072-1-pete@akeo.ie> MIME-Version: 1.0 Precedence: Bulk List-Unsubscribe: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,pete@akeo.ie Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1573747684; bh=yg7Kle00C+cRMTdqR5kOU8VCmp+DB4//s8PZgyqeX9A=; h=Cc:Date:From:Reply-To:Subject:To; b=ajv5+X2EPhzu23pMtuaE0mJMNnSuRZD3gNm+qOd+gLlCfKmmjEJ4BcObH+cXqjwiDV3 0RHlIxiosE0Q5J2DYUo9M+BdddAp7piqx1XrQMs1bYyP0pnHbLEgMCw7kcRoWGJhGhowP vJVzVa+kObuVJtsgRM/W3LqhE42AWAJbHnE= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Type: text/plain; charset="utf-8" This patch improves memory initialization for the Raspberry Pi Platform by: Using VideoCore mailbox data to reserve only the regions that are actually mapped. Especially, besides the base RAM size, which was already set using VideoCore data, we can set the GPU/VideoCore base address as well as the extended RAM, which is the memory beyond 1 GB that is available on models such as the Raspberry Pi 4 (for the 2GB or 4GB versions). Introducing a new PcdExtendedMemoryBase PCD for the base address of the extended memory region, which currently cannot be retrieved from VideoCore (MBOX_GET_ARM_MEMSIZE still only returns a single region on Bcm2711). Introducing a new RpiPlatformGetVirtualMemoryInfo() companion call to ArmPlatformGetVirtualMemoryMap() that allows us greatly simplify the registration of each segment in MemoryPeim() as well as making it easier to maintain for future models. We also fix SoC register space that should have been marked as reserved but wasn't until now and remove the unreferenced mSystemMemoryEnd extern in MemoryInitPeiLib.c. Signed-off-by: Pete Batard --- Platform/RaspberryPi/Include/Library/RPiMem.h | 26 += ++ Platform/RaspberryPi/Library/MemoryInitPeiLib/MemoryInitPeiLib.c | 94 += +++---- Platform/RaspberryPi/Library/MemoryInitPeiLib/MemoryInitPeiLib.inf | 1 + Platform/RaspberryPi/Library/PlatformLib/PlatformLib.inf | 3 + Platform/RaspberryPi/Library/PlatformLib/RaspberryPiMem.c | 242 += ++++++++++--------- Platform/RaspberryPi/RaspberryPi.dec | 1 + 6 files changed, 210 insertions(+), 157 deletions(-) diff --git a/Platform/RaspberryPi/Include/Library/RPiMem.h b/Platform/Raspb= erryPi/Include/Library/RPiMem.h new file mode 100644 index 000000000000..0bfc697ed094 --- /dev/null +++ b/Platform/RaspberryPi/Include/Library/RPiMem.h @@ -0,0 +1,26 @@ +/** @file + * + * Copyright (c) 2019, Pete Batard + * + * SPDX-License-Identifier: BSD-2-Clause-Patent + * + **/ + +#ifndef __RPI_MEM_H__ +#define __RPI_MEM_H__ + +#define RPI_MEM_BASIC_REGION 0 +#define RPI_MEM_RUNTIME_REGION 1 +#define RPI_MEM_RESERVED_REGION 2 + +typedef struct { + CONST CHAR16* Name; + UINTN Type; +} RPI_MEMORY_REGION_INFO; + +VOID +RpiPlatformGetVirtualMemoryInfo ( + IN RPI_MEMORY_REGION_INFO** MemoryInfo + ); + +#endif /* __RPI_MEM_H__ */ diff --git a/Platform/RaspberryPi/Library/MemoryInitPeiLib/MemoryInitPeiLib= .c b/Platform/RaspberryPi/Library/MemoryInitPeiLib/MemoryInitPeiLib.c index 60cf397f8baa..3a0f7e19e993 100644 --- a/Platform/RaspberryPi/Library/MemoryInitPeiLib/MemoryInitPeiLib.c +++ b/Platform/RaspberryPi/Library/MemoryInitPeiLib/MemoryInitPeiLib.c @@ -15,8 +15,7 @@ #include #include #include - -extern UINT64 mSystemMemoryEnd; +#include =20 VOID BuildMemoryTypeInformationHob ( @@ -39,23 +38,32 @@ InitMmu ( } } =20 +STATIC +VOID +AddBasicMemoryRegion ( + IN ARM_MEMORY_REGION_DESCRIPTOR *Desc +) +{ + BuildResourceDescriptorHob ( + EFI_RESOURCE_SYSTEM_MEMORY, + EFI_RESOURCE_ATTRIBUTE_PRESENT | + EFI_RESOURCE_ATTRIBUTE_INITIALIZED | + EFI_RESOURCE_ATTRIBUTE_WRITE_COMBINEABLE | + EFI_RESOURCE_ATTRIBUTE_WRITE_THROUGH_CACHEABLE | + EFI_RESOURCE_ATTRIBUTE_WRITE_BACK_CACHEABLE | + EFI_RESOURCE_ATTRIBUTE_TESTED, + Desc->PhysicalBase, + Desc->Length + ); +} + STATIC VOID AddRuntimeServicesRegion ( IN ARM_MEMORY_REGION_DESCRIPTOR *Desc ) { - BuildResourceDescriptorHob ( - EFI_RESOURCE_SYSTEM_MEMORY, - EFI_RESOURCE_ATTRIBUTE_PRESENT | - EFI_RESOURCE_ATTRIBUTE_INITIALIZED | - EFI_RESOURCE_ATTRIBUTE_WRITE_COMBINEABLE | - EFI_RESOURCE_ATTRIBUTE_WRITE_THROUGH_CACHEABLE | - EFI_RESOURCE_ATTRIBUTE_WRITE_BACK_CACHEABLE | - EFI_RESOURCE_ATTRIBUTE_TESTED, - Desc->PhysicalBase, - Desc->Length - ); + AddBasicMemoryRegion (Desc); =20 BuildMemoryAllocationHob ( Desc->PhysicalBase, @@ -70,17 +78,7 @@ AddReservedMemoryRegion ( IN ARM_MEMORY_REGION_DESCRIPTOR *Desc ) { - BuildResourceDescriptorHob ( - EFI_RESOURCE_SYSTEM_MEMORY, - EFI_RESOURCE_ATTRIBUTE_PRESENT | - EFI_RESOURCE_ATTRIBUTE_INITIALIZED | - EFI_RESOURCE_ATTRIBUTE_WRITE_COMBINEABLE | - EFI_RESOURCE_ATTRIBUTE_WRITE_THROUGH_CACHEABLE | - EFI_RESOURCE_ATTRIBUTE_WRITE_BACK_CACHEABLE | - EFI_RESOURCE_ATTRIBUTE_TESTED, - Desc->PhysicalBase, - Desc->Length - ); + AddBasicMemoryRegion (Desc); =20 BuildMemoryAllocationHob ( Desc->PhysicalBase, @@ -89,6 +87,12 @@ AddReservedMemoryRegion ( ); } =20 +void (*AddRegion[]) (IN ARM_MEMORY_REGION_DESCRIPTOR *Desc) =3D { + AddBasicMemoryRegion, + AddRuntimeServicesRegion, + AddReservedMemoryRegion, + }; + /*++ =20 Routine Description: @@ -113,36 +117,28 @@ MemoryPeim ( ) { ARM_MEMORY_REGION_DESCRIPTOR *MemoryTable; + RPI_MEMORY_REGION_INFO *MemoryInfo; + UINTN Index; =20 // Get Virtual Memory Map from the Platform Library ArmPlatformGetVirtualMemoryMap (&MemoryTable); =20 - // Ensure PcdSystemMemorySize has been set - ASSERT (PcdGet64 (PcdSystemMemorySize) !=3D 0); + // Get additional info not provided by MemoryTable + RpiPlatformGetVirtualMemoryInfo (&MemoryInfo); =20 - // FD without variable store - AddReservedMemoryRegion (&MemoryTable[0]); - - // Variable store. - AddRuntimeServicesRegion (&MemoryTable[1]); - - // Trusted Firmware region - AddReservedMemoryRegion (&MemoryTable[2]); - - // Usable memory. - BuildResourceDescriptorHob ( - EFI_RESOURCE_SYSTEM_MEMORY, - EFI_RESOURCE_ATTRIBUTE_PRESENT | - EFI_RESOURCE_ATTRIBUTE_INITIALIZED | - EFI_RESOURCE_ATTRIBUTE_WRITE_COMBINEABLE | - EFI_RESOURCE_ATTRIBUTE_WRITE_THROUGH_CACHEABLE | - EFI_RESOURCE_ATTRIBUTE_WRITE_BACK_CACHEABLE | - EFI_RESOURCE_ATTRIBUTE_TESTED, - MemoryTable[3].PhysicalBase, - MemoryTable[3].Length - ); - - AddReservedMemoryRegion (&MemoryTable[4]); + // Register each memory region + for (Index =3D 0; MemoryTable[Index].Length !=3D 0; Index++) { + ASSERT (MemoryInfo[Index].Type < ARRAY_SIZE (AddRegion)); + DEBUG ((DEBUG_INFO, "%s:\n" + "\tPhysicalBase: 0x%lX\n" + "\tVirtualBase: 0x%lX\n" + "\tLength: 0x%lX\n", + MemoryInfo[Index].Name, + MemoryTable[Index].PhysicalBase, + MemoryTable[Index].VirtualBase, + MemoryTable[Index].Length)); + AddRegion[MemoryInfo[Index].Type] (&MemoryTable[Index]); + } =20 // Build Memory Allocation Hob InitMmu (MemoryTable); diff --git a/Platform/RaspberryPi/Library/MemoryInitPeiLib/MemoryInitPeiLib= .inf b/Platform/RaspberryPi/Library/MemoryInitPeiLib/MemoryInitPeiLib.inf index 0084c010936d..d39210c7a4f1 100644 --- a/Platform/RaspberryPi/Library/MemoryInitPeiLib/MemoryInitPeiLib.inf +++ b/Platform/RaspberryPi/Library/MemoryInitPeiLib/MemoryInitPeiLib.inf @@ -24,6 +24,7 @@ [Packages] EmbeddedPkg/EmbeddedPkg.dec ArmPkg/ArmPkg.dec ArmPlatformPkg/ArmPlatformPkg.dec + Platform/RaspberryPi/RaspberryPi.dec =20 [LibraryClasses] DebugLib diff --git a/Platform/RaspberryPi/Library/PlatformLib/PlatformLib.inf b/Pla= tform/RaspberryPi/Library/PlatformLib/PlatformLib.inf index 85462febdd8d..c0e2a75451c3 100644 --- a/Platform/RaspberryPi/Library/PlatformLib/PlatformLib.inf +++ b/Platform/RaspberryPi/Library/PlatformLib/PlatformLib.inf @@ -22,6 +22,7 @@ [Packages] EmbeddedPkg/EmbeddedPkg.dec ArmPkg/ArmPkg.dec ArmPlatformPkg/ArmPlatformPkg.dec + Silicon/Broadcom/Bcm27xx/Bcm27xx.dec Silicon/Broadcom/Bcm283x/Bcm283x.dec Platform/RaspberryPi/RaspberryPi.dec =20 @@ -50,10 +51,12 @@ [FixedPcd] gEmbeddedTokenSpaceGuid.PcdDmaDeviceOffset gArmTokenSpaceGuid.PcdSystemMemoryBase gArmTokenSpaceGuid.PcdSystemMemorySize + gRaspberryPiTokenSpaceGuid.PcdExtendedMemoryBase gRaspberryPiTokenSpaceGuid.PcdNvStorageEventLogSize gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableSize gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwWorkingSize gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwSpareSize + gBcm27xxTokenSpaceGuid.PcdBcm27xxRegistersAddress gBcm283xTokenSpaceGuid.PcdBcm283xRegistersAddress =20 [Ppis] diff --git a/Platform/RaspberryPi/Library/PlatformLib/RaspberryPiMem.c b/Pl= atform/RaspberryPi/Library/PlatformLib/RaspberryPiMem.c index 2bfd3f020a6e..1a6a13b9591b 100644 --- a/Platform/RaspberryPi/Library/PlatformLib/RaspberryPiMem.c +++ b/Platform/RaspberryPi/Library/PlatformLib/RaspberryPiMem.c @@ -1,7 +1,9 @@ /** @file * + * Copyright (c) 2019, Pete Batard * Copyright (c) 2017-2018, Andrey Warkentin * Copyright (c) 2014, Linaro Limited. All rights reserved. + * Copyright (c) 2013-2018, ARM Limited. All rights reserved. * * SPDX-License-Identifier: BSD-2-Clause-Patent * @@ -9,8 +11,11 @@ =20 #include #include -#include #include +#include +#include +#include +#include =20 UINT64 mSystemMemoryBase; extern UINT64 mSystemMemoryEnd; @@ -18,6 +23,13 @@ UINT64 mVideoCoreBase; UINT64 mVideoCoreSize; UINT32 mBoardRevision; =20 + +// The total number of descriptors, including the final "end-of-table" des= criptor. +#define MAX_VIRTUAL_MEMORY_MAP_DESCRIPTORS 10 + +STATIC BOOLEAN VirtualMemoryInfoInitialized =3D FALSE; +STATIC RPI_MEMORY_REGION_INFO VirtualMemoryInfo[MAX_VIRTUAL_MEMORY_MAP_D= ESCRIPTORS]; + #define VariablesSize (FixedPcdGet32(PcdFlashNvStorageVariableSize) + \ FixedPcdGet32(PcdFlashNvStorageFtwWorkingSize) + \ FixedPcdGet32(PcdFlashNvStorageFtwSpareSize) + \ @@ -29,49 +41,6 @@ UINT32 mBoardRevision; =20 #define ATFBase (FixedPcdGet64(PcdFdBaseAddress) + FixedPcdGet32(PcdFdSize= )) =20 -STATIC ARM_MEMORY_REGION_DESCRIPTOR RaspberryPiMemoryRegionDescriptor[] = =3D { - { - /* Firmware Volume. */ - FixedPcdGet64 (PcdFdBaseAddress), FixedPcdGet64 (PcdFdBaseAddress), - FixedPcdGet32 (PcdFdSize) - VariablesSize, - ARM_MEMORY_REGION_ATTRIBUTE_WRITE_BACK - }, - { - /* Variables Volume. */ - VariablesBase, VariablesBase, - VariablesSize, - ARM_MEMORY_REGION_ATTRIBUTE_WRITE_BACK - }, - { - /* ATF reserved RAM. */ - ATFBase, ATFBase, - FixedPcdGet64 (PcdSystemMemoryBase) - ATFBase, - ARM_MEMORY_REGION_ATTRIBUTE_WRITE_BACK - }, - { - /* System RAM. */ - FixedPcdGet64 (PcdSystemMemoryBase), FixedPcdGet64 (PcdSystemMemoryBas= e), - 0, - ARM_MEMORY_REGION_ATTRIBUTE_WRITE_BACK - }, - { - /* Reserved GPU RAM. */ - 0, - 0, - 0, - ARM_MEMORY_REGION_ATTRIBUTE_DEVICE - }, - { - /* SOC registers. */ - BCM2836_SOC_REGISTERS, - BCM2836_SOC_REGISTERS, - BCM2836_SOC_REGISTER_LENGTH, - ARM_MEMORY_REGION_ATTRIBUTE_DEVICE - }, - { - } -}; - /** Return the Virtual Memory Map of your platform =20 @@ -89,6 +58,11 @@ ArmPlatformGetVirtualMemoryMap ( IN ARM_MEMORY_REGION_DESCRIPTOR** VirtualMemoryMap ) { + UINTN Index =3D 0; + UINTN GpuIndex; + INT64 ExtendedMemorySize; + ARM_MEMORY_REGION_DESCRIPTOR *VirtualMemoryTable; + // Early output of the info we got from VideoCore can prove valuable. DEBUG ((DEBUG_INFO, "Board Rev: 0x%lX\n", mBoardRevision)); DEBUG ((DEBUG_INFO, "Base RAM : 0x%ll08X (Size 0x%ll08X)\n", mSystemMemo= ryBase, mSystemMemoryEnd + 1)); @@ -97,68 +71,120 @@ ArmPlatformGetVirtualMemoryMap ( ASSERT (mSystemMemoryBase =3D=3D 0); ASSERT (VirtualMemoryMap !=3D NULL); =20 - RaspberryPiMemoryRegionDescriptor[3].Length =3D mSystemMemoryEnd + 1 - - FixedPcdGet64 (PcdSystemMemoryBase); - - RaspberryPiMemoryRegionDescriptor[4].PhysicalBase =3D - RaspberryPiMemoryRegionDescriptor[3].PhysicalBase + - RaspberryPiMemoryRegionDescriptor[3].Length; - - RaspberryPiMemoryRegionDescriptor[4].VirtualBase =3D - RaspberryPiMemoryRegionDescriptor[4].PhysicalBase; - - RaspberryPiMemoryRegionDescriptor[4].Length =3D - RaspberryPiMemoryRegionDescriptor[5].PhysicalBase - - RaspberryPiMemoryRegionDescriptor[4].PhysicalBase; - - DEBUG ((DEBUG_INFO, "FD:\n" - "\tPhysicalBase: 0x%lX\n" - "\tVirtualBase: 0x%lX\n" - "\tLength: 0x%lX\n", - RaspberryPiMemoryRegionDescriptor[0].PhysicalBase, - RaspberryPiMemoryRegionDescriptor[0].VirtualBase, - RaspberryPiMemoryRegionDescriptor[0].Length + - RaspberryPiMemoryRegionDescriptor[1].Length)); - - DEBUG ((DEBUG_INFO, "Variables (part of FD):\n" - "\tPhysicalBase: 0x%lX\n" - "\tVirtualBase: 0x%lX\n" - "\tLength: 0x%lX\n", - RaspberryPiMemoryRegionDescriptor[1].PhysicalBase, - RaspberryPiMemoryRegionDescriptor[1].VirtualBase, - RaspberryPiMemoryRegionDescriptor[1].Length)); - - DEBUG ((DEBUG_INFO, "ATF RAM:\n" - "\tPhysicalBase: 0x%lX\n" - "\tVirtualBase: 0x%lX\n" - "\tLength: 0x%lX\n", - RaspberryPiMemoryRegionDescriptor[2].PhysicalBase, - RaspberryPiMemoryRegionDescriptor[2].VirtualBase, - RaspberryPiMemoryRegionDescriptor[2].Length)); - - DEBUG ((DEBUG_INFO, "System RAM:\n" - "\tPhysicalBase: 0x%lX\n" - "\tVirtualBase: 0x%lX\n" - "\tLength: 0x%lX\n", - RaspberryPiMemoryRegionDescriptor[3].PhysicalBase, - RaspberryPiMemoryRegionDescriptor[3].VirtualBase, - RaspberryPiMemoryRegionDescriptor[3].Length)); - - DEBUG ((DEBUG_INFO, "GPU Reserved:\n" - "\tPhysicalBase: 0x%lX\n" - "\tVirtualBase: 0x%lX\n" - "\tLength: 0x%lX\n", - RaspberryPiMemoryRegionDescriptor[4].PhysicalBase, - RaspberryPiMemoryRegionDescriptor[4].VirtualBase, - RaspberryPiMemoryRegionDescriptor[4].Length)); - - DEBUG ((DEBUG_INFO, "SoC reserved:\n" - "\tPhysicalBase: 0x%lX\n" - "\tVirtualBase: 0x%lX\n" - "\tLength: 0x%lX\n", - RaspberryPiMemoryRegionDescriptor[5].PhysicalBase, - RaspberryPiMemoryRegionDescriptor[5].VirtualBase, - RaspberryPiMemoryRegionDescriptor[5].Length)); - - *VirtualMemoryMap =3D RaspberryPiMemoryRegionDescriptor; + VirtualMemoryTable =3D (ARM_MEMORY_REGION_DESCRIPTOR*)AllocatePages + (EFI_SIZE_TO_PAGES (sizeof (ARM_MEMORY_REGION_DESCR= IPTOR) * + MAX_VIRTUAL_MEMORY_MAP_DESCRIPTORS)); + if (VirtualMemoryTable =3D=3D NULL) { + return; + } + + + // Firmware Volume + VirtualMemoryTable[Index].PhysicalBase =3D FixedPcdGet64 (PcdFdBaseAd= dress); + VirtualMemoryTable[Index].VirtualBase =3D VirtualMemoryTable[Index].= PhysicalBase; + VirtualMemoryTable[Index].Length =3D FixedPcdGet32 (PcdFdSize) = - VariablesSize; + VirtualMemoryTable[Index].Attributes =3D ARM_MEMORY_REGION_ATTRIBUT= E_WRITE_BACK; + VirtualMemoryInfo[Index].Type =3D RPI_MEM_RESERVED_REGION; + VirtualMemoryInfo[Index++].Name =3D L"FD"; + + // Variable Volume + VirtualMemoryTable[Index].PhysicalBase =3D VariablesBase; + VirtualMemoryTable[Index].VirtualBase =3D VirtualMemoryTable[Index].= PhysicalBase; + VirtualMemoryTable[Index].Length =3D VariablesSize; + VirtualMemoryTable[Index].Attributes =3D ARM_MEMORY_REGION_ATTRIBUT= E_WRITE_BACK; + VirtualMemoryInfo[Index].Type =3D RPI_MEM_RUNTIME_REGION; + VirtualMemoryInfo[Index++].Name =3D L"FD Variables"; + + // TF-A reserved RAM + VirtualMemoryTable[Index].PhysicalBase =3D ATFBase; + VirtualMemoryTable[Index].VirtualBase =3D VirtualMemoryTable[Index].= PhysicalBase; + VirtualMemoryTable[Index].Length =3D FixedPcdGet64 (PcdSystemMe= moryBase) - ATFBase; + VirtualMemoryTable[Index].Attributes =3D ARM_MEMORY_REGION_ATTRIBUT= E_WRITE_BACK; + VirtualMemoryInfo[Index].Type =3D RPI_MEM_RESERVED_REGION; + VirtualMemoryInfo[Index++].Name =3D L"TF-A RAM"; + + // Base System RAM + VirtualMemoryTable[Index].PhysicalBase =3D FixedPcdGet64 (PcdSystemMe= moryBase); + VirtualMemoryTable[Index].VirtualBase =3D VirtualMemoryTable[Index].= PhysicalBase; + VirtualMemoryTable[Index].Length =3D mSystemMemoryEnd + 1 - Fix= edPcdGet64 (PcdSystemMemoryBase); + VirtualMemoryTable[Index].Attributes =3D ARM_MEMORY_REGION_ATTRIBUT= E_WRITE_BACK; + VirtualMemoryInfo[Index].Type =3D RPI_MEM_BASIC_REGION; + VirtualMemoryInfo[Index++].Name =3D L"Base System RAM"; + + // GPU Reserved + GpuIndex =3D Index; + VirtualMemoryTable[Index].PhysicalBase =3D mVideoCoreBase; + VirtualMemoryTable[Index].VirtualBase =3D VirtualMemoryTable[Index].= PhysicalBase; + VirtualMemoryTable[Index].Length =3D mVideoCoreSize; + VirtualMemoryTable[Index].Attributes =3D ARM_MEMORY_REGION_ATTRIBUT= E_DEVICE; + VirtualMemoryInfo[Index].Type =3D RPI_MEM_RESERVED_REGION; + VirtualMemoryInfo[Index++].Name =3D L"GPU Reserved"; + + // Compute the amount of extended RAM available on this platform + ExtendedMemorySize =3D SIZE_256MB; + ExtendedMemorySize <<=3D (mBoardRevision >> 20) & 0x07; + ExtendedMemorySize -=3D SIZE_1GB; + if (ExtendedMemorySize > 0) { + VirtualMemoryTable[Index].PhysicalBase =3D FixedPcdGet64 (PcdExtended= MemoryBase); + VirtualMemoryTable[Index].VirtualBase =3D VirtualMemoryTable[Index].= PhysicalBase; + VirtualMemoryTable[Index].Length =3D ExtendedMemorySize; + VirtualMemoryTable[Index].Attributes =3D ARM_MEMORY_REGION_ATTRIBUT= E_WRITE_BACK; + VirtualMemoryInfo[Index].Type =3D RPI_MEM_BASIC_REGION; + VirtualMemoryInfo[Index++].Name =3D L"Extended System RAM"; + } + + // Extended SoC registers (PCIe, genet, ...) + if (BCM2711_SOC_REGISTERS > 0) { + VirtualMemoryTable[Index].PhysicalBase =3D BCM2711_SOC_REGISTERS; + VirtualMemoryTable[Index].VirtualBase =3D VirtualMemoryTable[Index].= PhysicalBase; + VirtualMemoryTable[Index].Length =3D BCM2711_SOC_REGISTER_LENGT= H; + VirtualMemoryTable[Index].Attributes =3D ARM_MEMORY_REGION_ATTRIBUT= E_DEVICE; + VirtualMemoryInfo[Index].Type =3D RPI_MEM_RESERVED_REGION; + VirtualMemoryInfo[Index++].Name =3D L"SoC Reserved (27xx)"; + } + + // Base SoC registers + VirtualMemoryTable[Index].PhysicalBase =3D BCM2836_SOC_REGISTERS; + // On the Pi 3 the SoC registers may overlap VideoCore =3D> fix this + if (VirtualMemoryTable[GpuIndex].PhysicalBase + VirtualMemoryTable[GpuIn= dex].Length > VirtualMemoryTable[Index].PhysicalBase) { + VirtualMemoryTable[GpuIndex].Length =3D VirtualMemoryTable[Index].Phys= icalBase - VirtualMemoryTable[GpuIndex].PhysicalBase; + } + VirtualMemoryTable[Index].VirtualBase =3D VirtualMemoryTable[Index].= PhysicalBase; + VirtualMemoryTable[Index].Length =3D BCM2836_SOC_REGISTER_LENGT= H; + VirtualMemoryTable[Index].Attributes =3D ARM_MEMORY_REGION_ATTRIBUT= E_DEVICE; + VirtualMemoryInfo[Index].Type =3D RPI_MEM_RESERVED_REGION; + VirtualMemoryInfo[Index++].Name =3D L"SoC Reserved (283x)"; + + // End of Table + VirtualMemoryTable[Index].PhysicalBase =3D 0; + VirtualMemoryTable[Index].VirtualBase =3D 0; + VirtualMemoryTable[Index].Length =3D 0; + VirtualMemoryTable[Index++].Attributes =3D (ARM_MEMORY_REGION_ATTRIBU= TES)0; + + ASSERT(Index <=3D MAX_VIRTUAL_MEMORY_MAP_DESCRIPTORS); + + *VirtualMemoryMap =3D VirtualMemoryTable; + VirtualMemoryInfoInitialized =3D TRUE; +} + +/** + Return additional memory info not populated by the above call. + + This call should follow the one to ArmPlatformGetVirtualMemoryMap (). + +**/ +VOID +RpiPlatformGetVirtualMemoryInfo ( + IN RPI_MEMORY_REGION_INFO** MemoryInfo + ) +{ + ASSERT (VirtualMemoryInfo !=3D NULL); + + if (!VirtualMemoryInfoInitialized) { + DEBUG ((DEBUG_ERROR, + "ArmPlatformGetVirtualMemoryMap must be called before RpiPlatformGet= VirtualMemoryInfo.\n")); + return; + } + + *MemoryInfo =3D VirtualMemoryInfo; } diff --git a/Platform/RaspberryPi/RaspberryPi.dec b/Platform/RaspberryPi/Ra= spberryPi.dec index 3e9171eccb13..c7e17350544a 100644 --- a/Platform/RaspberryPi/RaspberryPi.dec +++ b/Platform/RaspberryPi/RaspberryPi.dec @@ -42,6 +42,7 @@ [PcdsFixedAtBuild.common] gRaspberryPiTokenSpaceGuid.PcdNvStorageVariableBase|0x0|UINT32|0x00000005 gRaspberryPiTokenSpaceGuid.PcdNvStorageFtwSpareBase|0x0|UINT32|0x00000006 gRaspberryPiTokenSpaceGuid.PcdNvStorageFtwWorkingBase|0x0|UINT32|0x00000= 007 + gRaspberryPiTokenSpaceGuid.PcdExtendedMemoryBase|0x0|UINT32|0x00000008 =20 [PcdsFixedAtBuild, PcdsPatchableInModule, PcdsDynamic, PcdsDynamicEx] gRaspberryPiTokenSpaceGuid.PcdCpuClock|0|UINT32|0x0000000d --=20 2.21.0.windows.1 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#50694): https://edk2.groups.io/g/devel/message/50694 Mute This Topic: https://groups.io/mt/57792636/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- From nobody Mon May 6 03:30:32 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) client-ip=66.175.222.12; envelope-from=bounce+27952+50695+1787277+3901457@groups.io; helo=web01.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+50695+1787277+3901457@groups.io ARC-Seal: i=1; a=rsa-sha256; t=1573747687; cv=none; d=zoho.com; s=zohoarc; b=hhULO2uWUrZKD2djlhez34XSqx4B3hxPa53yCYH2KAJllK+BO35STbBnbdAiKyR5KjmMcA6atCfpemzNGHOObf56S6lQig6nrbTLyDlVKaSmrEKZV7eGlawWuk2RaP7OeJk3Ktcvld+sxcUOkwUAgROGzElH2AV8mdPGhMnglRM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1573747687; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Id:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To; bh=iEgIhl9OZLllJSMy4GHJdJHO7qa7oPgzB9xDw8kGgzw=; b=LlfS0SaNYpXt6VNnnsvaetYQI/FJyvx1UFMcd1PJAoDp4W9wScQrkoOerx4qk6jvnyETdo6NgydDLAnwTKpcbPjDuMjzXnEDn5seBFXCeFfIPsCoHQG7IDgT4Ybvjx/jqHNeu3/z3/228/B9vPPRLNHDykAnBJOLbVnvpxFCb3o= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=pass; spf=pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+50695+1787277+3901457@groups.io Received: from web01.groups.io (web01.groups.io [66.175.222.12]) by mx.zohomail.com with SMTPS id 1573747687004296.84731369379585; Thu, 14 Nov 2019 08:08:07 -0800 (PST) Return-Path: X-Received: by 127.0.0.2 with SMTP id 2k6OYY1788612xoJceUBXHLy; Thu, 14 Nov 2019 08:08:06 -0800 X-Received: from mail-wm1-f68.google.com (mail-wm1-f68.google.com [209.85.128.68]) by mx.groups.io with SMTP id smtpd.web11.6525.1573747684925150847 for ; Thu, 14 Nov 2019 08:08:05 -0800 X-Received: by mail-wm1-f68.google.com with SMTP id z19so6532088wmk.3 for ; Thu, 14 Nov 2019 08:08:04 -0800 (PST) X-Gm-Message-State: MWeQW9tfc4oau5MikRWia947x1787277AA= X-Google-Smtp-Source: APXvYqyapV+L8o4o1NGb3HLpSpk5QAudc0Szbp3xIduIitqwgvwDBvg89rqCNOCF1sGFW0Fq1A0/rg== X-Received: by 2002:a1c:2d4b:: with SMTP id t72mr9291591wmt.112.1573747683104; Thu, 14 Nov 2019 08:08:03 -0800 (PST) X-Received: from localhost.localdomain ([84.203.67.47]) by smtp.gmail.com with ESMTPSA id a16sm6793088wmd.11.2019.11.14.08.08.01 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 14 Nov 2019 08:08:02 -0800 (PST) From: "Pete Batard" To: devel@edk2.groups.io Cc: ard.biesheuvel@linaro.org, leif.lindholm@linaro.org, philmd@redhat.com Subject: [edk2-devel] [edk2-platforms][PATCH 6/8] Platform/RPi: Replace Mailbox and Watchdog addresses with PCDs Date: Thu, 14 Nov 2019 16:07:38 +0000 Message-Id: <20191114160740.10072-7-pete@akeo.ie> In-Reply-To: <20191114160740.10072-1-pete@akeo.ie> References: <20191114160740.10072-1-pete@akeo.ie> MIME-Version: 1.0 Precedence: Bulk List-Unsubscribe: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,pete@akeo.ie Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1573747686; bh=BH+rrfnmyjf59txNSZf5pv44myuFGZUx9akbmuXh9hM=; h=Cc:Date:From:Reply-To:Subject:To; b=hNurLeLOm5mZF8NPyVYrb8ggQITmozIusdjEzM0k5G0FJosAeLHeHRvb/X346OE3zq2 GKiMdIYO+N5Ufw5YGqRtNT++/baK2e08uIcb+LpseXX4V2jgBFwu+AQiXs2c/8xiIJeKI 1s9gNKvifjpSKK4x2pg6GhM1i2PRwIqL4uo= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Type: text/plain; charset="utf-8" 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] =20 [FixedPcd] gBcm283xTokenSpaceGuid.PcdBcm283xRegistersAddress + gBcm283xTokenSpaceGuid.PcdMboxBaseAddress =20 [Depex] TRUE diff --git a/Platform/RaspberryPi/Library/PlatformLib/PlatformLib.inf b/Pla= tform/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 =20 [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 + gBcm283xTokenSpaceGuid.PcdMboxBaseAddress|0x3f00b880 + gBcm283xTokenSpaceGuid.PcdWdogBaseAddress|0x3f100000 + ## NS16550 compatible UART gEfiMdeModulePkgTokenSpaceGuid.PcdSerialRegisterBase|0x3f215040 gEfiMdeModulePkgTokenSpaceGuid.PcdSerialUseMmio|TRUE diff --git a/Silicon/Broadcom/Bcm283x/Bcm283x.dec b/Silicon/Broadcom/Bcm283= x/Bcm283x.dec index 5b839b00d286..fe1907cb8cf1 100644 --- a/Silicon/Broadcom/Bcm283x/Bcm283x.dec +++ b/Silicon/Broadcom/Bcm283x/Bcm283x.dec @@ -21,3 +21,5 @@ [Guids] =20 [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 =20 /* 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 =20 /* 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 --=20 2.21.0.windows.1 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#50695): https://edk2.groups.io/g/devel/message/50695 Mute This Topic: https://groups.io/mt/57792653/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- From nobody Mon May 6 03:30:32 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) client-ip=66.175.222.12; envelope-from=bounce+27952+50696+1787277+3901457@groups.io; helo=web01.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+50696+1787277+3901457@groups.io ARC-Seal: i=1; a=rsa-sha256; t=1573747688; cv=none; d=zoho.com; s=zohoarc; b=li4na9gQpAexfv7yBsUUuETvWBpWdZNuPDBEFI/9HJGNpF94V3O5+uCQ3hXnZtjeR8k0ivLr1O6AvYdDy5/iI0UTrzV9+/6fNWdT4Zyv46kAPkZyxCcFjVBra061n//s7/m7Bs0uPLkoAveW2aMoRiZ5nw1ReYdrCtbL3Mm40lU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1573747688; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Id:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To; bh=tnWalelvMv7tpeZ1ETu4xdNeZPnPXE9PXfoXiHFm+UQ=; b=HfXXAdTV6fuAr+rL+VBz7DWNiWYSW0C0P+FyNNat9rRnA9RGLiwU37QdOpqqvYMfUyfS6ne/tQRBjDI/YE1MGl7HAtpMo3rvFEIHKalNVgpmojJK9zG7USSiyfdXVNpijsJ7jGZ7T5ZIhGGR1W6pvGNSsQkBKISb3nXQB0loXBc= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=pass; spf=pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+50696+1787277+3901457@groups.io Received: from web01.groups.io (web01.groups.io [66.175.222.12]) by mx.zohomail.com with SMTPS id 157374768804681.94220906691828; Thu, 14 Nov 2019 08:08:08 -0800 (PST) Return-Path: X-Received: by 127.0.0.2 with SMTP id s1bOYY1788612xDkj2nlf9wm; Thu, 14 Nov 2019 08:08:07 -0800 X-Received: from mail-wr1-f66.google.com (mail-wr1-f66.google.com [209.85.221.66]) by mx.groups.io with SMTP id smtpd.web10.6498.1573747686221006402 for ; Thu, 14 Nov 2019 08:08:06 -0800 X-Received: by mail-wr1-f66.google.com with SMTP id s5so7125796wrw.2 for ; Thu, 14 Nov 2019 08:08:05 -0800 (PST) X-Gm-Message-State: a6kImaUT4qdrIxxmFigGpxTHx1787277AA= X-Google-Smtp-Source: APXvYqxaQMTtPEvkA+zJPZr7BGqvywnUbk2y2Pc77xTFybaY+oW4Y1o8egjdWlSfgQF2fVWvB03nyA== X-Received: by 2002:adf:c786:: with SMTP id l6mr8483113wrg.45.1573747684513; Thu, 14 Nov 2019 08:08:04 -0800 (PST) X-Received: from localhost.localdomain ([84.203.67.47]) by smtp.gmail.com with ESMTPSA id a16sm6793088wmd.11.2019.11.14.08.08.03 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 14 Nov 2019 08:08:04 -0800 (PST) From: "Pete Batard" To: devel@edk2.groups.io Cc: ard.biesheuvel@linaro.org, leif.lindholm@linaro.org, philmd@redhat.com Subject: [edk2-devel] [edk2-platforms][PATCH 7/8] Platform/RPi: Replace MMCHS1BASE define with a PCD Date: Thu, 14 Nov 2019 16:07:39 +0000 Message-Id: <20191114160740.10072-8-pete@akeo.ie> In-Reply-To: <20191114160740.10072-1-pete@akeo.ie> References: <20191114160740.10072-1-pete@akeo.ie> MIME-Version: 1.0 Precedence: Bulk List-Unsubscribe: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,pete@akeo.ie Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1573747687; bh=ldJ37mw8fcwyHINTPwSBqXLAS/QfXOmWbJUuTeRmSmo=; h=Cc:Date:From:Reply-To:Subject:To; b=n2tqMuePBfca08rAstgLyyIsVLcBmG6UjLl9kAVqyviLXXq3hYtBs4djfzo1GYmv8gb ccX5ZQ3IeOxC8oUUpM81BdCuGUalbBCLLePtKtzJ88Rk5/B7K4fW8eVkS2xLeCl6wySKy gLeAOM149+ukxqqZDWvLs4JEVq+jtp1LebE= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Type: text/plain; charset="utf-8" From: Samer El-Haj-Mahmoud Replace MMCHS1BASE with PcdMmcHs1BaseAddress. This is needed in preparation for adding Raspberry Pi 4 support Signed-off-by: Pete Batard --- Platform/RaspberryPi/Drivers/ArasanMmcHostDxe/ArasanMmcHostDxe.inf | 1 + Platform/RaspberryPi/RPi3/RPi3.dsc | 1 + Silicon/Broadcom/Bcm283x/Bcm283x.dec | 1 + Silicon/Broadcom/Bcm283x/Include/IndustryStandard/Bcm2836Sdio.h | 3 ++- 4 files changed, 5 insertions(+), 1 deletion(-) diff --git a/Platform/RaspberryPi/Drivers/ArasanMmcHostDxe/ArasanMmcHostDxe= .inf b/Platform/RaspberryPi/Drivers/ArasanMmcHostDxe/ArasanMmcHostDxe.inf index 034c8c449f00..0d7c57152107 100644 --- a/Platform/RaspberryPi/Drivers/ArasanMmcHostDxe/ArasanMmcHostDxe.inf +++ b/Platform/RaspberryPi/Drivers/ArasanMmcHostDxe/ArasanMmcHostDxe.inf @@ -44,6 +44,7 @@ [Protocols] [Pcd] gRaspberryPiTokenSpaceGuid.PcdSdIsArasan gBcm283xTokenSpaceGuid.PcdBcm283xRegistersAddress + gBcm283xTokenSpaceGuid.PcdMmcHs1BaseAddress =20 [Depex] gRaspberryPiFirmwareProtocolGuid AND gRaspberryPiConfigAppliedProtocolGu= id diff --git a/Platform/RaspberryPi/RPi3/RPi3.dsc b/Platform/RaspberryPi/RPi3= /RPi3.dsc index 88af37e6edaa..059549068e02 100644 --- a/Platform/RaspberryPi/RPi3/RPi3.dsc +++ b/Platform/RaspberryPi/RPi3/RPi3.dsc @@ -378,6 +378,7 @@ [PcdsFixedAtBuild.common] gBcm283xTokenSpaceGuid.PcdBcm283xRegistersAddress|0x3f000000 gBcm283xTokenSpaceGuid.PcdMboxBaseAddress|0x3f00b880 gBcm283xTokenSpaceGuid.PcdWdogBaseAddress|0x3f100000 + gBcm283xTokenSpaceGuid.PcdMmcHs1BaseAddress|0x3f300000 =20 ## NS16550 compatible UART gEfiMdeModulePkgTokenSpaceGuid.PcdSerialRegisterBase|0x3f215040 diff --git a/Silicon/Broadcom/Bcm283x/Bcm283x.dec b/Silicon/Broadcom/Bcm283= x/Bcm283x.dec index fe1907cb8cf1..5053077e6448 100644 --- a/Silicon/Broadcom/Bcm283x/Bcm283x.dec +++ b/Silicon/Broadcom/Bcm283x/Bcm283x.dec @@ -23,3 +23,4 @@ [PcdsFixedAtBuild.common] gBcm283xTokenSpaceGuid.PcdBcm283xRegistersAddress|0x0|UINT32|0x00000001 gBcm283xTokenSpaceGuid.PcdMboxBaseAddress|0x0|UINT32|0x00000002 gBcm283xTokenSpaceGuid.PcdWdogBaseAddress|0x0|UINT32|0x00000003 + gBcm283xTokenSpaceGuid.PcdMmcHs1BaseAddress|0x0|UINT32|0x00000004 diff --git a/Silicon/Broadcom/Bcm283x/Include/IndustryStandard/Bcm2836Sdio.= h b/Silicon/Broadcom/Bcm283x/Include/IndustryStandard/Bcm2836Sdio.h index fb0d02904156..ac2581d4cb64 100644 --- a/Silicon/Broadcom/Bcm283x/Include/IndustryStandard/Bcm2836Sdio.h +++ b/Silicon/Broadcom/Bcm283x/Include/IndustryStandard/Bcm2836Sdio.h @@ -1,5 +1,6 @@ /** @file * + * Copyright (c) 2019, ARM Limited. All rights reserved. * Copyright (c) Microsoft Corporation. All rights reserved. * * SPDX-License-Identifier: BSD-2-Clause-Patent @@ -10,7 +11,7 @@ #define __BCM2836_SDIO_H__ =20 //MMC/SD/SDIO1 register definitions. -#define MMCHS1BASE 0x3F300000 +#define MMCHS1BASE (FixedPcdGet64 (PcdMmcHs1BaseAddress)) =20 #define MMCHS_BLK (MMCHS1BASE + 0x4) #define BLEN_512BYTES (0x200UL << 0) --=20 2.21.0.windows.1 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#50696): https://edk2.groups.io/g/devel/message/50696 Mute This Topic: https://groups.io/mt/57792678/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- From nobody Mon May 6 03:30:32 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) client-ip=66.175.222.12; envelope-from=bounce+27952+50697+1787277+3901457@groups.io; helo=web01.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+50697+1787277+3901457@groups.io ARC-Seal: i=1; a=rsa-sha256; t=1573747693; cv=none; d=zoho.com; s=zohoarc; b=B+r/ufcLt8756xX+0hdUEJGIxe31z5UlxawIpXa8Fy4bRuQn89X4w4waWGvo2+EO4K0GZEGYfJKyPmkX573hHgQ/KlzUMJuKqx2VIDHiLEEmhgeU+rnOl/A9PFds2GDBNcEnND2vhHy2WapQQK5WgHhf0cUHYLHZDUW1T+ZUKIY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1573747693; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Id:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To; bh=OBTf32V8pgLmxUfBSbz2b68BBU66pT+MU8Cdu+H7E4U=; b=Xtk+S7JwXlsvJ+h+CjDY2TjXMO+LqqhPzS2tcm1Lr3C99G448TYfFMKCSldjCyt0V7XDcE2OqFdeH/5D9xZz68//fBQLHjkY+a0rAgDb0WNEeIjDnTResVnH9Wyy3NjTGdHJ2LPdWM6GgZmDQeyuUUJKxo3UdghmjFaSHF3jdaY= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=pass; spf=pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+50697+1787277+3901457@groups.io Received: from web01.groups.io (web01.groups.io [66.175.222.12]) by mx.zohomail.com with SMTPS id 1573747693025666.129337369446; Thu, 14 Nov 2019 08:08:13 -0800 (PST) Return-Path: X-Received: by 127.0.0.2 with SMTP id L9EJYY1788612xbTbhQZt5jr; Thu, 14 Nov 2019 08:08:12 -0800 X-Received: from mail-wm1-f66.google.com (mail-wm1-f66.google.com [209.85.128.66]) by mx.groups.io with SMTP id smtpd.web09.6391.1573747687720552123 for ; Thu, 14 Nov 2019 08:08:08 -0800 X-Received: by mail-wm1-f66.google.com with SMTP id b17so6530553wmj.2 for ; Thu, 14 Nov 2019 08:08:07 -0800 (PST) X-Gm-Message-State: NeCJgK6uvxjrQdOHQZ0gWumLx1787277AA= X-Google-Smtp-Source: APXvYqwIopHUG4/L0eO7DnZWauQNBHYUEO6/6Jl5XVoejkvTRFea0Ft//pJgqhXsTORIPr6ordEo8A== X-Received: by 2002:a1c:5fc4:: with SMTP id t187mr9069284wmb.142.1573747685758; Thu, 14 Nov 2019 08:08:05 -0800 (PST) X-Received: from localhost.localdomain ([84.203.67.47]) by smtp.gmail.com with ESMTPSA id a16sm6793088wmd.11.2019.11.14.08.08.04 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 14 Nov 2019 08:08:05 -0800 (PST) From: "Pete Batard" To: devel@edk2.groups.io Cc: ard.biesheuvel@linaro.org, leif.lindholm@linaro.org, philmd@redhat.com Subject: [edk2-devel] [edk2-platforms][PATCH 8/8] Platform/RPi: Replace DW2_USB_BASE_ADDRESS define with a PCD Date: Thu, 14 Nov 2019 16:07:40 +0000 Message-Id: <20191114160740.10072-9-pete@akeo.ie> In-Reply-To: <20191114160740.10072-1-pete@akeo.ie> References: <20191114160740.10072-1-pete@akeo.ie> MIME-Version: 1.0 Precedence: Bulk List-Unsubscribe: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,pete@akeo.ie Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1573747692; bh=3V4NGZ/P/HAQWA4EU1bHPmWvoLAtHWAOzNU54VpGpaI=; h=Cc:Date:From:Reply-To:Subject:To; b=pcSATe2AyJRGGF6MRMWnoadGTJFXtktDzffUVsbV1jQ7I/0irWXFitEQ+pG8oPIYRUP teeyP0be9HjFE1EAsrTtjUBlg4cH/a1TxNeO2rBw+iYWWHiJf1/zTrlGBiWX9ZBuiiSRE pvMPPNEU+v6nmFk8eWHFBNA1vLOrIy/ZYqw= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Type: text/plain; charset="utf-8" From: Samer El-Haj-Mahmoud Replace DW2_USB_BASE_ADDRESS with PcdDw2UsbBaseAddress. This is needed in preparation for adding Raspberry Pi 4 support. Signed-off-by: Pete Batard --- Platform/RaspberryPi/Drivers/DwUsbHostDxe/DwUsbHostDxe.inf | 1 + Platform/RaspberryPi/Drivers/DwUsbHostDxe/DwcHw.h | 4 ++-- Platform/RaspberryPi/RPi3/RPi3.dsc | 1 + Platform/RaspberryPi/RaspberryPi.dec | 1 + 4 files changed, 5 insertions(+), 2 deletions(-) diff --git a/Platform/RaspberryPi/Drivers/DwUsbHostDxe/DwUsbHostDxe.inf b/P= latform/RaspberryPi/Drivers/DwUsbHostDxe/DwUsbHostDxe.inf index 8817f20622d6..dc50f955f2fb 100644 --- a/Platform/RaspberryPi/Drivers/DwUsbHostDxe/DwUsbHostDxe.inf +++ b/Platform/RaspberryPi/Drivers/DwUsbHostDxe/DwUsbHostDxe.inf @@ -54,6 +54,7 @@ [Protocols] =20 [FixedPcd] gBcm283xTokenSpaceGuid.PcdBcm283xRegistersAddress + gRaspberryPiTokenSpaceGuid.PcdDw2UsbBaseAddress =20 [Depex] gRaspberryPiFirmwareProtocolGuid diff --git a/Platform/RaspberryPi/Drivers/DwUsbHostDxe/DwcHw.h b/Platform/R= aspberryPi/Drivers/DwUsbHostDxe/DwcHw.h index 88fd93934fd3..17daef60f967 100644 --- a/Platform/RaspberryPi/Drivers/DwUsbHostDxe/DwcHw.h +++ b/Platform/RaspberryPi/Drivers/DwUsbHostDxe/DwcHw.h @@ -1,5 +1,6 @@ /** @file * + * Copyright (c) 2019, ARM Limited. All rights reserved. * Copyright (c) 2017, Andrey Warkentin * Copyright (c) 2015-2016, Linaro Limited. All rights reserved. * @@ -10,8 +11,7 @@ #ifndef __DWCHW_H__ #define __DWCHW_H__ =20 -#define DW2_USB_BASE_ADDRESS 0x3f980000 - +#define DW2_USB_BASE_ADDRESS (FixedPcdGet64 (PcdDw2UsbBaseAddre= ss)) #define HSOTG_REG(x) (x) =20 #define HCCHAR(_ch) HSOTG_REG(0x0500 + 0x20 * (_ch)) diff --git a/Platform/RaspberryPi/RPi3/RPi3.dsc b/Platform/RaspberryPi/RPi3= /RPi3.dsc index 059549068e02..d7450d857bd5 100644 --- a/Platform/RaspberryPi/RPi3/RPi3.dsc +++ b/Platform/RaspberryPi/RPi3/RPi3.dsc @@ -379,6 +379,7 @@ [PcdsFixedAtBuild.common] gBcm283xTokenSpaceGuid.PcdMboxBaseAddress|0x3f00b880 gBcm283xTokenSpaceGuid.PcdWdogBaseAddress|0x3f100000 gBcm283xTokenSpaceGuid.PcdMmcHs1BaseAddress|0x3f300000 + gRaspberryPiTokenSpaceGuid.PcdDw2UsbBaseAddress|0x3f980000 =20 ## NS16550 compatible UART gEfiMdeModulePkgTokenSpaceGuid.PcdSerialRegisterBase|0x3f215040 diff --git a/Platform/RaspberryPi/RaspberryPi.dec b/Platform/RaspberryPi/Ra= spberryPi.dec index c7e17350544a..aa0c6e826866 100644 --- a/Platform/RaspberryPi/RaspberryPi.dec +++ b/Platform/RaspberryPi/RaspberryPi.dec @@ -43,6 +43,7 @@ [PcdsFixedAtBuild.common] gRaspberryPiTokenSpaceGuid.PcdNvStorageFtwSpareBase|0x0|UINT32|0x00000006 gRaspberryPiTokenSpaceGuid.PcdNvStorageFtwWorkingBase|0x0|UINT32|0x00000= 007 gRaspberryPiTokenSpaceGuid.PcdExtendedMemoryBase|0x0|UINT32|0x00000008 + gRaspberryPiTokenSpaceGuid.PcdDw2UsbBaseAddress|0x0|UINT32|0x00000009 =20 [PcdsFixedAtBuild, PcdsPatchableInModule, PcdsDynamic, PcdsDynamicEx] gRaspberryPiTokenSpaceGuid.PcdCpuClock|0|UINT32|0x0000000d --=20 2.21.0.windows.1 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#50697): https://edk2.groups.io/g/devel/message/50697 Mute This Topic: https://groups.io/mt/57792705/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-