From nobody Sun May 19 02:26:39 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+50881+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+50881+1787277+3901457@groups.io ARC-Seal: i=1; a=rsa-sha256; t=1574163507; cv=none; d=zoho.com; s=zohoarc; b=EpK8GhYB8HWkYp8rTnK5cgzOfg3Zct+wjjpaNctuhVDZ9333IldHlFmtt7amZA11+I0eTyvGWkTy6R7BvbqON4o43BIePpTMgltDlGKD7c9mM6orgyaavk+P1tTyVD7zMEWEvnfxJ5fcw/eKW2wUXqv5cOsVR2sqSBcbdHJv9hA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1574163507; 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=7Oi38AH5SQRIc+aOL87QkOhgT0m2A04D1Px6M/S3gZA=; b=bVY59GTlvluRJ3Su+z4C0TCpohyI5ZCwn43W+tuK3DVRNFrXfqxqgbPNaGx0KcM2RUonIbWjaQpqw8mZv/4flqj5LfE3RXWWGKhg9H1ySXc51Nvw8K+eYQa/EzmtVJd/Esyfk8ymklQOoU5x0ESjm9+5DPQ3xRg1fOq4L/Ne0Mc= 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+50881+1787277+3901457@groups.io Received: from web01.groups.io (web01.groups.io [66.175.222.12]) by mx.zohomail.com with SMTPS id 1574163507745809.2246421988102; Tue, 19 Nov 2019 03:38:27 -0800 (PST) Return-Path: X-Received: by 127.0.0.2 with SMTP id aaaaYY1788612xaaaaaaaaaa; Tue, 19 Nov 2019 03:38:27 -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.web11.19758.1574163506085155159 for ; Tue, 19 Nov 2019 03:38:26 -0800 X-Received: by mail-wr1-f67.google.com with SMTP id e6so23462777wrw.1 for ; Tue, 19 Nov 2019 03:38:25 -0800 (PST) X-Gm-Message-State: aaaaaaaaaaaaaaaaaaaaaaaax1787277AA= X-Google-Smtp-Source: APXvYqzQvlXLVV1EdSIakAdRQaJYkGixPqRfxAAAHP0N9T6fnxAfwabm+Qy0GJeovUCPcVOvcSzpxQ== X-Received: by 2002:a5d:4d4a:: with SMTP id a10mr27966884wru.35.1574163504277; Tue, 19 Nov 2019 03:38:24 -0800 (PST) X-Received: from localhost.localdomain ([84.203.67.47]) by smtp.gmail.com with ESMTPSA id j66sm2608273wma.19.2019.11.19.03.38.23 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 19 Nov 2019 03:38:23 -0800 (PST) From: "Pete Batard" To: devel@edk2.groups.io Cc: ard.biesheuvel@linaro.org, leif.lindholm@linaro.org, philmd@redhat.com, samer.el-haj-mahmoud@arm.com Subject: [edk2-devel] [edk2-platforms][PATCH v2 1/7] Platform/RPi: Add missing model name Date: Tue, 19 Nov 2019 11:38:03 +0000 Message-Id: <20191119113809.2472-2-pete@akeo.ie> In-Reply-To: <20191119113809.2472-1-pete@akeo.ie> References: <20191119113809.2472-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=1574163507; bh=wZ/BdsudxO0LW9+jBVZROPeSvNPW5CRXlEN5zRDv69g=; h=Cc:Date:From:Reply-To:Subject:To; b=NcnGRzThnuRTRL5mOxFNHDZpeEzzJK7LKVPHZJgk9NYgQejD8RCnvGDbR4iqDTVVDX7 q30RXpomzv23AOkJRsR9wznPzDO2PxuB7IwTxiP8NhrOLG+4C+/UQNrMiHWve56ehHboL 6HmEfj9QyK9C2owM2CF3KApl1Vnws2NKcpU= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Type: text/plain; charset="utf-8" From: Samer El-Haj-Mahmoud Add a missing entry for the "Raspberry Pi Compute Module 3+" in RpiFirmwareGetModelName (). Signed-off-by: Leif Lindholm Reviewed-by: Leif Lindholm Reviewed-by: Philippe Mathieu-Daude --- Platform/RaspberryPi/Drivers/RpiFirmwareDxe/RpiFirmwareDxe.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Platform/RaspberryPi/Drivers/RpiFirmwareDxe/RpiFirmwareDxe.c b= /Platform/RaspberryPi/Drivers/RpiFirmwareDxe/RpiFirmwareDxe.c index 9b4aa068857c..dcb434fabefe 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: --=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 (#50881): https://edk2.groups.io/g/devel/message/50881 Mute This Topic: https://groups.io/mt/60553572/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 Sun May 19 02:26:39 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+50882+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+50882+1787277+3901457@groups.io ARC-Seal: i=1; a=rsa-sha256; t=1574163509; cv=none; d=zoho.com; s=zohoarc; b=lGF+nIBfEeNNRUmc2yu+T7uHgO+HyzNkhQ1/zC9N3rYMEQTUVL1LYddt2vu8cE5cw/3hgvq2PeMVrFtoxurc/aUJoV0s/aNgVpPVM9FDE8rXbCyCBM6i2jHaJDQVopx7G1XNBC6MfP8/cd3ZIxn5lp8inaJAzQFrp9+bj8ftEos= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1574163509; 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=Y5XQzpK9XZc5i/375csBp5tZYBBUFKAD7Gxm3W1nHUM=; b=nL2BUDcah+nxOeJ/lVeK1ms1u4t/NhBtHCiBqHV6EhQuQWKzHj0gpuBB5qqxy3zK/Uowrzeh7glWmZjMugROJAedfjhXukphUG9sGpH1JHSDcPUrlFbe97tiyv7KG2blmLlG3XiPWOq6WJaDIiN1sAmSPaTY5NEwkXgcQEtoDjg= 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+50882+1787277+3901457@groups.io Received: from web01.groups.io (web01.groups.io [66.175.222.12]) by mx.zohomail.com with SMTPS id 1574163509510258.60433707944264; Tue, 19 Nov 2019 03:38:29 -0800 (PST) Return-Path: X-Received: by 127.0.0.2 with SMTP id aaaaYY1788612xaaaaaaaaaa; Tue, 19 Nov 2019 03:38:28 -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.10143.1574163507370033717 for ; Tue, 19 Nov 2019 03:38:27 -0800 X-Received: by mail-wr1-f67.google.com with SMTP id t1so23417444wrv.4 for ; Tue, 19 Nov 2019 03:38:27 -0800 (PST) X-Gm-Message-State: aaaaaaaaaaaaaaaaaaaaaaaax1787277AA= X-Google-Smtp-Source: APXvYqwNVaEbS/6OXyWbYgYgA3TolPn2NnMU+jgnaXsHKODxe2t1j686LC1/6LrzGorid209khHc8w== X-Received: by 2002:adf:f9c4:: with SMTP id w4mr35327967wrr.88.1574163505560; Tue, 19 Nov 2019 03:38:25 -0800 (PST) X-Received: from localhost.localdomain ([84.203.67.47]) by smtp.gmail.com with ESMTPSA id j66sm2608273wma.19.2019.11.19.03.38.24 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 19 Nov 2019 03:38:25 -0800 (PST) From: "Pete Batard" To: devel@edk2.groups.io Cc: ard.biesheuvel@linaro.org, leif.lindholm@linaro.org, philmd@redhat.com, samer.el-haj-mahmoud@arm.com Subject: [edk2-devel] [edk2-platforms][PATCH v2 2/7] Platform/RPi: Add model family detection Date: Tue, 19 Nov 2019 11:38:04 +0000 Message-Id: <20191119113809.2472-3-pete@akeo.ie> In-Reply-To: <20191119113809.2472-1-pete@akeo.ie> References: <20191119113809.2472-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=1574163508; bh=6m3NSSVrxppoGJsv/AEiF0aeYcbk5KB1ByFEmtXHH6Q=; h=Cc:Date:From:Reply-To:Subject:To; b=Yg2z3AevW+RpzP4G4wiRPgWHA+I1a4Le7D1TUGVvT1wQCe2MbDKVx3HDoozqJCwgnSk VPivnLLyGFym/7xgPqXekgmxLhWjdmXxMGVNNSGQLrY3AoZTxG+ZWLj+NXlSlAULf7yrn zxSDOPR/yXuam85vGXhF7Cacr3jmIhr19ZM= 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. Signed-off-by: Pete Batard Reviewed-by: Leif Lindholm --- Platform/RaspberryPi/Drivers/RpiFirmwareDxe/RpiFirmwareDxe.c | 61 ++++++++= ++++++++++++ Platform/RaspberryPi/Include/Protocol/RpiFirmware.h | 8 +++ 2 files changed, 69 insertions(+) diff --git a/Platform/RaspberryPi/Drivers/RpiFirmwareDxe/RpiFirmwareDxe.c b= /Platform/RaspberryPi/Drivers/RpiFirmwareDxe/RpiFirmwareDxe.c index dcb434fabefe..dd61ef089ca7 100644 --- a/Platform/RaspberryPi/Drivers/RpiFirmwareDxe/RpiFirmwareDxe.c +++ b/Platform/RaspberryPi/Drivers/RpiFirmwareDxe/RpiFirmwareDxe.c @@ -605,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 @@ -1171,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 (#50882): https://edk2.groups.io/g/devel/message/50882 Mute This Topic: https://groups.io/mt/60553573/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 Sun May 19 02:26:39 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+50883+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+50883+1787277+3901457@groups.io ARC-Seal: i=1; a=rsa-sha256; t=1574163511; cv=none; d=zoho.com; s=zohoarc; b=G1gVqAKKrS4HWEaRZfuhmAXW/wE1lTvxqJG6nf1cj8naOdZb0gGx0nkZq086S/9uVCgRyULepTRwkzKuVwLcxJH2SFy3wLLW/g6HzHotE+iOiEgi3gyEx1ywiGn29NYyq9CoIJqZFbpVCtKTapVzkJ+2Q1PE1XsUJmCbezSFEk0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1574163511; 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=+ogoNuQi/WZ8ud7B9src3PB8DYbxuN0arOFA12pXAK4=; b=hzdphAj6doE4b9LsV0TwegWhQ9yU0fSuD7sNvLXpamXJfaoSlWh4GUQD0UPIRMYD2xSD+blglOCDezO+cXHoCVB8jU1k4LuEor3Or8TlUGMLpaMJPNVO2V1jnlqXDFb67MLyVEIjPXQ7iRw9Ye6+TzKuwFk4LHDy7s1IwLPcu5M= 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+50883+1787277+3901457@groups.io Received: from web01.groups.io (web01.groups.io [66.175.222.12]) by mx.zohomail.com with SMTPS id 1574163511146919.4819356267845; Tue, 19 Nov 2019 03:38:31 -0800 (PST) Return-Path: X-Received: by 127.0.0.2 with SMTP id aaaaYY1788612xaaaaaaaaaa; Tue, 19 Nov 2019 03:38:30 -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.web10.10144.1574163509457035063 for ; Tue, 19 Nov 2019 03:38:29 -0800 X-Received: by mail-wr1-f65.google.com with SMTP id b3so23400322wrs.13 for ; Tue, 19 Nov 2019 03:38:29 -0800 (PST) X-Gm-Message-State: aaaaaaaaaaaaaaaaaaaaaaaax1787277AA= X-Google-Smtp-Source: APXvYqx8xkcqtAeB+StYCvhpFySzNMlE1n3f5UyqJkBYySm4lOajFSbfyYysyz+qFTo5pjdayNKIyA== X-Received: by 2002:adf:e58f:: with SMTP id l15mr13273399wrm.1.1574163507473; Tue, 19 Nov 2019 03:38:27 -0800 (PST) X-Received: from localhost.localdomain ([84.203.67.47]) by smtp.gmail.com with ESMTPSA id j66sm2608273wma.19.2019.11.19.03.38.25 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 19 Nov 2019 03:38:26 -0800 (PST) From: "Pete Batard" To: devel@edk2.groups.io Cc: ard.biesheuvel@linaro.org, leif.lindholm@linaro.org, philmd@redhat.com, samer.el-haj-mahmoud@arm.com Subject: [edk2-devel] [edk2-platforms][PATCH v2 3/7] Platform/RPi: Replace Bcm283x SoC base register address with a PCD Date: Tue, 19 Nov 2019 11:38:05 +0000 Message-Id: <20191119113809.2472-4-pete@akeo.ie> In-Reply-To: <20191119113809.2472-1-pete@akeo.ie> References: <20191119113809.2472-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=1574163510; bh=ZP1UIQw8clsS+/CQXl3yEnoMo1/N6Nx4VzVRWqPdlko=; h=Cc:Date:From:Reply-To:Subject:To; b=p0M2sFVt89Vxd+edbgYEtenuQJQU777S0UDV4SR4BTXiii0qwvWhf9VYg/sy/7vd6E/ 3/yad7T/49GwzcPkBBq0XqGFh2la4rxl7h8o7GzpUiX/eEstjCJEr7agyTVanC3gC7XUs WpRNHWoHlbr6FutpRRRduZDCymviM3829rg= 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 Reviewed-by: Leif Lindholm Reviewed-by: Philippe Mathieu-Daude --- 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 | 7 +++= +++- 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, 43 insertions(+), 5 deletions(-) diff --git a/Platform/RaspberryPi/Drivers/ArasanMmcHostDxe/ArasanMmcHostDxe= .inf b/Platform/RaspberryPi/Drivers/ArasanMmcHostDxe/ArasanMmcHostDxe.inf index 3f0d7b6b9e9d..6db8a1c5e400 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. # @@ -41,6 +42,7 @@ [Protocols] gRaspberryPiFirmwareProtocolGuid ## CONSUMES =20 [Pcd] + gBcm283xTokenSpaceGuid.PcdBcm283xRegistersAddress gRaspberryPiTokenSpaceGuid.PcdSdIsArasan =20 [Depex] diff --git a/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxe.inf b/Platfor= m/RaspberryPi/Drivers/ConfigDxe/ConfigDxe.inf index 28fc2682b585..817cb98c1933 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 @@ -54,6 +55,7 @@ [Protocols] gRaspberryPiConfigAppliedProtocolGuid ## PRODUCES =20 [Pcd] + gBcm283xTokenSpaceGuid.PcdBcm283xRegistersAddress gRaspberryPiTokenSpaceGuid.PcdCpuClock gRaspberryPiTokenSpaceGuid.PcdCustomCpuClock gRaspberryPiTokenSpaceGuid.PcdSdIsArasan 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..ca8b30700328 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. # @@ -43,6 +44,7 @@ [Protocols] gRaspberryPiFirmwareProtocolGuid ## CONSUMES =20 [Pcd] + gBcm283xTokenSpaceGuid.PcdBcm283xRegistersAddress gRaspberryPiTokenSpaceGuid.PcdSdIsArasan =20 [Depex] diff --git a/Platform/RaspberryPi/Library/PlatformLib/PlatformLib.inf b/Pla= tform/RaspberryPi/Library/PlatformLib/PlatformLib.inf index ed986034b957..bcc6f8b6ec13 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 # @@ -47,6 +47,7 @@ [FixedPcd] gArmTokenSpaceGuid.PcdArmPrimaryCoreMask gArmTokenSpaceGuid.PcdArmPrimaryCore gArmTokenSpaceGuid.PcdFdSize + gBcm283xTokenSpaceGuid.PcdBcm283xRegistersAddress gEmbeddedTokenSpaceGuid.PcdDmaDeviceOffset gArmTokenSpaceGuid.PcdSystemMemoryBase gArmTokenSpaceGuid.PcdSystemMemorySize diff --git a/Platform/RaspberryPi/RPi3/RPi3.dsc b/Platform/RaspberryPi/RPi3= /RPi3.dsc index a0365c5cf606..98c75e373fa7 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,11 @@ [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..f984c4b52623 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. # @@ -27,6 +27,7 @@ [LibraryClasses] BaseLib DebugLib IoLib + PcdLib UefiBootServicesTableLib UefiLib UefiDriverEntryPoint @@ -36,6 +37,7 @@ [Protocols] gEfiCpuArchProtocolGuid ## CONSUMES ## NOTIFY =20 [FixedPcd] + gBcm283xTokenSpaceGuid.PcdBcm283xRegistersAddress gEmbeddedTokenSpaceGuid.PcdInterruptBaseAddress =20 [Depex] diff --git a/Silicon/Broadcom/Bcm283x/Drivers/RngDxe/RngDxe.inf b/Silicon/B= roadcom/Bcm283x/Drivers/RngDxe/RngDxe.inf index cb1695bd2dfc..8eb90de85cfd 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 @@ -26,6 +27,7 @@ [LibraryClasses] BaseMemoryLib DebugLib IoLib + PcdLib UefiBootServicesTableLib UefiDriverEntryPoint =20 @@ -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 (#50883): https://edk2.groups.io/g/devel/message/50883 Mute This Topic: https://groups.io/mt/60553574/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 Sun May 19 02:26:39 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+50884+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+50884+1787277+3901457@groups.io ARC-Seal: i=1; a=rsa-sha256; t=1574163512; cv=none; d=zoho.com; s=zohoarc; b=eBJ8aSBIHN7wRzTAZ40uqltHv+lS6/X+oB3TKe1a+au4HTkIV56TASG1xW8nfyvCAXCtpP9RXKXbbZhA2ssjBUVuLGs7qaKr0aJrgc0WjXx0Ai5ScZ0UxdcIC4HXyR+0vFVjANis5ru83kWiiHOrvVbg8TMReMIdt6ipxpJySQA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1574163512; 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=ng3Q3RXwwRD/L/xZIuI39c1aLXS6/29KuJ2sd84OPU8=; b=Ry0JJCHYOyFz6kYS9436xpdn7vv1U2Piyro3swozUwFIQ3PmFaf22dBgukg6izlMpkN0o8HLi+fEH5AzJOzN4+zAkkTxwiq/NpDarfGytaxOYGFhLzwuwpJApHapJHJ8pTlRJMJsCT7MDKDdDvgHl2SYAmVzzsMfv2IZNryL/m0= 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+50884+1787277+3901457@groups.io Received: from web01.groups.io (web01.groups.io [66.175.222.12]) by mx.zohomail.com with SMTPS id 1574163512818360.3667068053214; Tue, 19 Nov 2019 03:38:32 -0800 (PST) Return-Path: X-Received: by 127.0.0.2 with SMTP id aaaaYY1788612xaaaaaaaaaa; Tue, 19 Nov 2019 03:38:31 -0800 X-Received: from mail-wr1-f42.google.com (mail-wr1-f42.google.com [209.85.221.42]) by mx.groups.io with SMTP id smtpd.web10.10145.1574163510573493545 for ; Tue, 19 Nov 2019 03:38:31 -0800 X-Received: by mail-wr1-f42.google.com with SMTP id a15so23410975wrf.9 for ; Tue, 19 Nov 2019 03:38:30 -0800 (PST) X-Gm-Message-State: aaaaaaaaaaaaaaaaaaaaaaaax1787277AA= X-Google-Smtp-Source: APXvYqyAu3xE1frE+pqOQcrOjS+VzHh1/DQct4L4L65uyR3aic4jA9ikYR9Dob2/wQ6j1+odpynpvg== X-Received: by 2002:a05:6000:10c5:: with SMTP id b5mr38519976wrx.121.1574163508806; Tue, 19 Nov 2019 03:38:28 -0800 (PST) X-Received: from localhost.localdomain ([84.203.67.47]) by smtp.gmail.com with ESMTPSA id j66sm2608273wma.19.2019.11.19.03.38.27 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 19 Nov 2019 03:38:28 -0800 (PST) From: "Pete Batard" To: devel@edk2.groups.io Cc: ard.biesheuvel@linaro.org, leif.lindholm@linaro.org, philmd@redhat.com, samer.el-haj-mahmoud@arm.com Subject: [edk2-devel] [edk2-platforms][PATCH v2 4/7] Platform/RPi: Use offsets for Bcm238x SoC register addresses Date: Tue, 19 Nov 2019 11:38:06 +0000 Message-Id: <20191119113809.2472-5-pete@akeo.ie> In-Reply-To: <20191119113809.2472-1-pete@akeo.ie> References: <20191119113809.2472-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=1574163511; bh=10fsWX2wgLnFYYR3kvoCKk2IiPlipRB/wdFTO3T0uDU=; h=Cc:Date:From:Reply-To:Subject:To; b=BW2wlku4DAJ1R+a0lmn01r/7NGbNS1/eiSS9jeLAO1qxUwuoAr3rkx/iz1NygLJbDFS XYKlseY8vVERzt8b4o8pjLiJLzP+r9HHnfMp4/YE2aJqr1V7shbWjBvRU8dIx7/zqqGwu 50Ethd9MksIoSwk4bRRDcBYVehkwUBr821I= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Type: text/plain; charset="utf-8" From: Samer El-Haj-Mahmoud Remove hardcoded base addresses for Mailbox, Watchdog, SDIO and DW2 USB and use an offset indexed on PcdBcm283xRegistersAddress instead. This is needed in preparation for adding Raspberry Pi 4 support. Signed-off-by: Pete Batard Reviewed-by: Leif Lindholm Reviewed-by: Philippe Mathieu-Daude --- Platform/RaspberryPi/Drivers/DwUsbHostDxe/DwcHw.h | 4 +++- Silicon/Broadcom/Bcm283x/Include/IndustryStandard/Bcm2836.h | 8 ++++++= -- Silicon/Broadcom/Bcm283x/Include/IndustryStandard/Bcm2836Sdio.h | 4 +++- 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/Platform/RaspberryPi/Drivers/DwUsbHostDxe/DwcHw.h b/Platform/R= aspberryPi/Drivers/DwUsbHostDxe/DwcHw.h index 88fd93934fd3..ddbf69a1d608 100644 --- a/Platform/RaspberryPi/Drivers/DwUsbHostDxe/DwcHw.h +++ b/Platform/RaspberryPi/Drivers/DwUsbHostDxe/DwcHw.h @@ -10,7 +10,9 @@ #ifndef __DWCHW_H__ #define __DWCHW_H__ =20 -#define DW2_USB_BASE_ADDRESS 0x3f980000 +#define DW2_USB_OFFSET 0x00980000 +#define DW2_USB_BASE_ADDRESS (FixedPcdGet64 (PcdBcm283xRegister= sAddress) \ + + DW2_USB_OFFSET) =20 #define HSOTG_REG(x) (x) =20 diff --git a/Silicon/Broadcom/Bcm283x/Include/IndustryStandard/Bcm2836.h b/= Silicon/Broadcom/Bcm283x/Include/IndustryStandard/Bcm2836.h index 8bd68c234bfd..72c8e9dc4b14 100644 --- a/Silicon/Broadcom/Bcm283x/Include/IndustryStandard/Bcm2836.h +++ b/Silicon/Broadcom/Bcm283x/Include/IndustryStandard/Bcm2836.h @@ -23,7 +23,9 @@ #define BCM2836_DMA_DEVICE_OFFSET 0xc0000000 =20 /* watchdog constants */ -#define BCM2836_WDOG_BASE_ADDRESS 0x3f100000 +#define BCM2836_WDOG_OFFSET 0x00100000 +#define BCM2836_WDOG_BASE_ADDRESS (FixedPcdGet64= (PcdBcm283xRegistersAddress) \ + + BCM2836_WDOG= _OFFSET) #define BCM2836_WDOG_PASSWORD 0x5a000000 #define BCM2836_WDOG_RSTC_OFFSET 0x0000001c #define BCM2836_WDOG_WDOG_OFFSET 0x00000024 @@ -31,7 +33,9 @@ #define BCM2836_WDOG_RSTC_WRCFG_FULL_RESET 0x00000020 =20 /* mailbox interface constants */ -#define BCM2836_MBOX_BASE_ADDRESS 0x3f00b880 +#define BCM2836_MBOX_OFFSET 0x0000b880 +#define BCM2836_MBOX_BASE_ADDRESS (FixedPcdGet64= (PcdBcm283xRegistersAddress) \ + + BCM2836_MBOX= _OFFSET) #define BCM2836_MBOX_READ_OFFSET 0x00000000 #define BCM2836_MBOX_STATUS_OFFSET 0x00000018 #define BCM2836_MBOX_CONFIG_OFFSET 0x0000001c diff --git a/Silicon/Broadcom/Bcm283x/Include/IndustryStandard/Bcm2836Sdio.= h b/Silicon/Broadcom/Bcm283x/Include/IndustryStandard/Bcm2836Sdio.h index fb0d02904156..708a1d7a4f47 100644 --- a/Silicon/Broadcom/Bcm283x/Include/IndustryStandard/Bcm2836Sdio.h +++ b/Silicon/Broadcom/Bcm283x/Include/IndustryStandard/Bcm2836Sdio.h @@ -10,7 +10,9 @@ #define __BCM2836_SDIO_H__ =20 //MMC/SD/SDIO1 register definitions. -#define MMCHS1BASE 0x3F300000 +#define MMCHS1_OFFSET 0x00300000 +#define MMCHS1BASE (FixedPcdGet64 (PcdBcm283xRegistersAddress) \ + + MMCHS1_OFFSET) =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 (#50884): https://edk2.groups.io/g/devel/message/50884 Mute This Topic: https://groups.io/mt/60553575/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 Sun May 19 02:26:39 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+50885+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+50885+1787277+3901457@groups.io ARC-Seal: i=1; a=rsa-sha256; t=1574163513; cv=none; d=zoho.com; s=zohoarc; b=DmWcP9SbdRRvRSFU7W0HtN/8VtIvedbei2tV8cXNYD4bIhHyROGJok/rVKlNpbvwszAvgim1doikFrLQo5NbaunSDgm3Zk+8vDQlD9nsk6ddRSSXUkjbg62rfHXRrYQ98d6+wH2kXZQfURe3kNLb2gXJEXc4aG5tWopRCziHQaY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1574163513; 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=93pn8mixQwzTgWZ/eAk/bmnk7MsQlL2Ntb0i4J+hySc=; b=P7BA7vL4gf9Vuq1GpQ7+Ffw8nIyxrCGhDUrK1oz/z7ndos7t2PFMiw1ZAdfi1dAFaN5eTNOgJvdj5Djph9XIS0kolqMW68RLPcE5GBtyOIrm2KAJ63CciVnUP33VhoGgyFleKaVADQ8w6rTWWIZPYasCKkKue1+Y9pJssX0kbbU= 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+50885+1787277+3901457@groups.io Received: from web01.groups.io (web01.groups.io [66.175.222.12]) by mx.zohomail.com with SMTPS id 1574163513932183.2684403697682; Tue, 19 Nov 2019 03:38:33 -0800 (PST) Return-Path: X-Received: by 127.0.0.2 with SMTP id aaaaYY1788612xaaaaaaaaaa; Tue, 19 Nov 2019 03:38:32 -0800 X-Received: from mail-wr1-f68.google.com (mail-wr1-f68.google.com [209.85.221.68]) by mx.groups.io with SMTP id smtpd.web11.19759.1574163511758959975 for ; Tue, 19 Nov 2019 03:38:32 -0800 X-Received: by mail-wr1-f68.google.com with SMTP id q15so10609771wrw.7 for ; Tue, 19 Nov 2019 03:38:31 -0800 (PST) X-Gm-Message-State: aaaaaaaaaaaaaaaaaaaaaaaax1787277AA= X-Google-Smtp-Source: APXvYqwcw1U0Yb8yS7zCrGvucVLTQOGIXLU98+gGOpgBbvdtEoBlj6+3EbQQLutSrH9A5MTnCWypLw== X-Received: by 2002:adf:f18c:: with SMTP id h12mr17385866wro.122.1574163509980; Tue, 19 Nov 2019 03:38:29 -0800 (PST) X-Received: from localhost.localdomain ([84.203.67.47]) by smtp.gmail.com with ESMTPSA id j66sm2608273wma.19.2019.11.19.03.38.28 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 19 Nov 2019 03:38:29 -0800 (PST) From: "Pete Batard" To: devel@edk2.groups.io Cc: ard.biesheuvel@linaro.org, leif.lindholm@linaro.org, philmd@redhat.com, samer.el-haj-mahmoud@arm.com Subject: [edk2-devel] [edk2-platforms][PATCH v2 5/7] Silicon/Broadcom: Add Bcm2711 header Date: Tue, 19 Nov 2019 11:38:07 +0000 Message-Id: <20191119113809.2472-6-pete@akeo.ie> In-Reply-To: <20191119113809.2472-1-pete@akeo.ie> References: <20191119113809.2472-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=1574163512; bh=cWvjnsL9MAb+FpJPw4kzg7EcBjyvpq5EXqIohvv0h8o=; h=Cc:Date:From:Reply-To:Subject:To; b=BAvL1Zuj/P1HotTDZvFGtxh8SXIvPS5XaPLQOk/3DsHe+ROtVflCvT7ncVBP4OniO3t V3fg+lbzEhsXGfTqvecM27o1tPU6dYnZSBNSk1c5b6mv8eCIEtaljMdyKTm/hyhjgbTR7 daAvNf/mNBSfMPh54AIlKaMyMah2TEuGEss= 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 Reviewed-by: Philippe Mathieu-Daude --- 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..356458024e84 --- /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 (#50885): https://edk2.groups.io/g/devel/message/50885 Mute This Topic: https://groups.io/mt/60553576/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 Sun May 19 02:26:39 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+50886+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+50886+1787277+3901457@groups.io ARC-Seal: i=1; a=rsa-sha256; t=1574163514; cv=none; d=zoho.com; s=zohoarc; b=T1NuZkIfaQL1qqdDk6dXzJ/nzGXuYHdnn+Fz5PxRR6pajDKM9eFOEJzjHjUqAUqfqoRIwrnZBnvBr8GER3U99bKE2xhsfBhWZDZKd5jkmV7gtiHPvRyNwUSC46/q2fBFauTcXfLXQKYMFJiZXRNeZkLOVh+PROMJuaPp8tLJSKk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1574163514; 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=bIkc4niKiYV+JjV8TOJ5ecXOTeWc7u8wC31v1fdhHVo=; b=b6cEfOGQ/cqOuwWC6+jGYQZziIm8Jk8t9iQGhAfmOj8kKzQxci+EuFnRcj/WTl+B3KaYu3Ew/ut60JY0b/qp934ii4GNZu2L00KWHxyAszcWCQxhUjZc15PZE/lL4KCg/nV4Q01nECwok1PELIJ/pljSA4AyeXX3xidemGK895I= 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+50886+1787277+3901457@groups.io Received: from web01.groups.io (web01.groups.io [66.175.222.12]) by mx.zohomail.com with SMTPS id 1574163514696440.2985553593893; Tue, 19 Nov 2019 03:38:34 -0800 (PST) Return-Path: X-Received: by 127.0.0.2 with SMTP id aaaaYY1788612xaaaaaaaaaa; Tue, 19 Nov 2019 03:38:34 -0800 X-Received: from mail-wr1-f68.google.com (mail-wr1-f68.google.com [209.85.221.68]) by mx.groups.io with SMTP id smtpd.web12.19884.1574163513040597955 for ; Tue, 19 Nov 2019 03:38:33 -0800 X-Received: by mail-wr1-f68.google.com with SMTP id r10so23419171wrx.3 for ; Tue, 19 Nov 2019 03:38:32 -0800 (PST) X-Gm-Message-State: aaaaaaaaaaaaaaaaaaaaaaaax1787277AA= X-Google-Smtp-Source: APXvYqwDESSUhfw+tXZl1N7SRH9hoJQYk/v+O4DTdcMnyzSjzWJNvQj4SLqaVyrqT9CoBsAGTdSznw== X-Received: by 2002:adf:f308:: with SMTP id i8mr23524273wro.319.1574163511205; Tue, 19 Nov 2019 03:38:31 -0800 (PST) X-Received: from localhost.localdomain ([84.203.67.47]) by smtp.gmail.com with ESMTPSA id j66sm2608273wma.19.2019.11.19.03.38.30 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 19 Nov 2019 03:38:30 -0800 (PST) From: "Pete Batard" To: devel@edk2.groups.io Cc: ard.biesheuvel@linaro.org, leif.lindholm@linaro.org, philmd@redhat.com, samer.el-haj-mahmoud@arm.com Subject: [edk2-devel] [edk2-platforms][PATCH v2 6/7] Platform/RPi: Read more variables from VideoCore during early init Date: Tue, 19 Nov 2019 11:38:08 +0000 Message-Id: <20191119113809.2472-7-pete@akeo.ie> In-Reply-To: <20191119113809.2472-1-pete@akeo.ie> References: <20191119113809.2472-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=1574163514; bh=fW/B0mrsfFC/ltXzBJkOymsZu8+JFa1AA3yEeyPd4EM=; h=Cc:Date:From:Reply-To:Subject:To; b=oFqoESmqTFbZETE1BuA/+50BYnQH6e6xAFpAJv7StJ4TMWFTf681AC4s9ZXSyzvkIZI feGB8b3fiVveF7TujHBsrKtMBEeuiRAZWWgeIV5v122+r/woIrwo5+EUdbZgfSpdJt09H jBvB1YdWY81Hv96brcflhnVsXtpei7j98UM= 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 Reviewed-by: Leif Lindholm --- Platform/RaspberryPi/Include/IndustryStandard/RpiMbox.h | 1 + Platform/RaspberryPi/Library/PlatformLib/AArch64/RaspberryPiHelper.S | 76 = ++++++++++++++++++-- Platform/RaspberryPi/Library/PlatformLib/RaspberryPiMem.c | 14 = +++- 3 files changed, 85 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..cc58406e1bfc 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. * @@ -39,6 +40,7 @@ ASM_FUNC (ArmPlatformPeiBootAction) adr x0, .Lmeminfo_buffer mov x1, #FixedPcdGet64 (PcdDmaDeviceOffset) orr x0, x0, #RPI_MBOX_VC_CHANNEL + // x1 holds the value of PcdDmaDeviceOffset throughout this function add x0, x0, x1 =20 MOV32 (x4, BCM2836_MBOX_BASE_ADDRESS) @@ -52,24 +54,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 (#50886): https://edk2.groups.io/g/devel/message/50886 Mute This Topic: https://groups.io/mt/60553577/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 Sun May 19 02:26:39 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+50887+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+50887+1787277+3901457@groups.io ARC-Seal: i=1; a=rsa-sha256; t=1574163517; cv=none; d=zoho.com; s=zohoarc; b=kebQ5hL+GiKUUXT2IuPnt0L0ZNG/boTwG3xzwoxot9KQXVeJqo8y5LxzH4LGzAULOT7woGtLjT2TffiVXrRZs0K3CiRYEosxGlhj6yoTLeFVIczJlmHED3F3kLB71R4eDCosb1Tf+ZbGiwkKS3H5zXwJJvmdLB1bcc7xdYFA5hE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1574163517; 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=GAgWg8hB9VnKPN00sGSUHkVMskrg49v34w0N60lXIIc=; b=fRqoPyjTkcrS8z9CHHMq2WGlf+f2MUGpDUDnKnQibMvU/mmEbJTfP2TU/I3Cu1tDLQeffYH+diP6G1kDKaSZ8/ZvHf1M61GuQf4CiMH2tWs7jFO3dpnJ4Sg8/2gZjk7aW3rDxnHXt0ipxPWfonTRczfcc9qNVyTMdq8VhQhyUsQ= 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+50887+1787277+3901457@groups.io Received: from web01.groups.io (web01.groups.io [66.175.222.12]) by mx.zohomail.com with SMTPS id 1574163517934186.5910823126303; Tue, 19 Nov 2019 03:38:37 -0800 (PST) Return-Path: X-Received: by 127.0.0.2 with SMTP id aaaaYY1788612xaaaaaaaaaa; Tue, 19 Nov 2019 03:38:37 -0800 X-Received: from mail-wm1-f65.google.com (mail-wm1-f65.google.com [209.85.128.65]) by mx.groups.io with SMTP id smtpd.web12.19889.1574163516330259614 for ; Tue, 19 Nov 2019 03:38:36 -0800 X-Received: by mail-wm1-f65.google.com with SMTP id 8so3189337wmo.0 for ; Tue, 19 Nov 2019 03:38:36 -0800 (PST) X-Gm-Message-State: aaaaaaaaaaaaaaaaaaaaaaaax1787277AA= X-Google-Smtp-Source: APXvYqyA88+AqWMaxdKYODb4huQYa3MFQcUPtH9QCZ5fm4ac1q4FSYhYYybDCfTJwgk5OacMvmk1tA== X-Received: by 2002:a1c:6a0d:: with SMTP id f13mr5240482wmc.164.1574163514177; Tue, 19 Nov 2019 03:38:34 -0800 (PST) X-Received: from localhost.localdomain ([84.203.67.47]) by smtp.gmail.com with ESMTPSA id j66sm2608273wma.19.2019.11.19.03.38.31 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 19 Nov 2019 03:38:33 -0800 (PST) From: "Pete Batard" To: devel@edk2.groups.io Cc: ard.biesheuvel@linaro.org, leif.lindholm@linaro.org, philmd@redhat.com, samer.el-haj-mahmoud@arm.com Subject: [edk2-devel] [edk2-platforms][PATCH v2 7/7] Platform/RPi: Clean up and improve early memory init Date: Tue, 19 Nov 2019 11:38:09 +0000 Message-Id: <20191119113809.2472-8-pete@akeo.ie> In-Reply-To: <20191119113809.2472-1-pete@akeo.ie> References: <20191119113809.2472-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=1574163517; bh=R1LxShxV6e1P0IhlICkPTdjbxTjRRmn8FwGIVR7PkTc=; h=Cc:Date:From:Reply-To:Subject:To; b=uHVpUVGl0dX3hymb+C0t+eVLEoMMdH6NPKL5hhTZyoZvPwSEzbDmmAGM+J3Clye45yI +yVwNzKB0kcnw9efjTbg9CpzUSt83Do+rj31EHoJ6JiyhWMnzMaEBW5qSTk7Y+KhqicAO DtWptKsfs8j5om07tiiUhBsJytBNQnjhT4Q= 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. RaspberryPiMem.c incorporates some code from ArmJunoMem.c. Signed-off-by: Pete Batard Reviewed-by: Leif Lindholm --- 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..9d38e4b6cfb3 --- /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 bcc6f8b6ec13..77cdbe399a06 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 @@ -47,10 +48,12 @@ [FixedPcd] gArmTokenSpaceGuid.PcdArmPrimaryCoreMask gArmTokenSpaceGuid.PcdArmPrimaryCore gArmTokenSpaceGuid.PcdFdSize + gBcm27xxTokenSpaceGuid.PcdBcm27xxRegistersAddress gBcm283xTokenSpaceGuid.PcdBcm283xRegistersAddress gEmbeddedTokenSpaceGuid.PcdDmaDeviceOffset gArmTokenSpaceGuid.PcdSystemMemoryBase gArmTokenSpaceGuid.PcdSystemMemorySize + gRaspberryPiTokenSpaceGuid.PcdExtendedMemoryBase gRaspberryPiTokenSpaceGuid.PcdNvStorageEventLogSize gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableSize gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwWorkingSize diff --git a/Platform/RaspberryPi/Library/PlatformLib/RaspberryPiMem.c b/Pl= atform/RaspberryPi/Library/PlatformLib/RaspberryPiMem.c index 2bfd3f020a6e..cc761bea1307 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 (#50887): https://edk2.groups.io/g/devel/message/50887 Mute This Topic: https://groups.io/mt/60553578/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-