From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by spool.mail.gandi.net (Postfix) with ESMTPS id 3E874D8026E for ; Wed, 17 Jan 2024 21:36:23 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=ecFAj6Pq1FNlho3mrM1HUiYLAzIWZYU78lhHIoGUh/Q=; c=relaxed/simple; d=groups.io; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References:MIME-Version:Precedence:List-Subscribe:List-Help:Sender:List-Id:Mailing-List:Delivered-To:Reply-To:List-Unsubscribe-Post:List-Unsubscribe:Content-Transfer-Encoding; s=20140610; t=1705527382; v=1; b=VehadBDU8uk9zF3t/a3Vg0IwfES0zLXp1xEwOla7sOUk0wizJ52ssvP9v70d5j379Ipu2zT7 UKZ4YYiu0kKCYzKgpUxfoeYl4noODsxF+b9PcYllCWOXufqi+ncZeRhBh3uF2F8LSNISwpe8BZY HqBscEaUgNfak1VyFTOny+2U= X-Received: by 127.0.0.2 with SMTP id maS1YY7687511xGKoFvWuuuF; Wed, 17 Jan 2024 13:36:22 -0800 X-Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by mx.groups.io with SMTP id smtpd.web10.629.1705527379189720949 for ; Wed, 17 Jan 2024 13:36:19 -0800 X-Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 5E1ED165C; Wed, 17 Jan 2024 13:37:05 -0800 (PST) X-Received: from u200865.usa.arm.com (unknown [10.119.39.253]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 289653F73F; Wed, 17 Jan 2024 13:36:19 -0800 (PST) From: "Jeremy Linton" To: devel@edk2.groups.io Cc: ardb+tianocore@kernel.org, quic_llindhol@quicinc.com, Jeremy Linton Subject: [edk2-devel] [PATCH v2 5/5] Platform/RaspberryPi: Update PCIe MMIO window for DT Date: Wed, 17 Jan 2024 15:36:14 -0600 Message-ID: <20240117213614.4188518-6-jeremy.linton@arm.com> In-Reply-To: <20240117213614.4188518-1-jeremy.linton@arm.com> References: <20240117213614.4188518-1-jeremy.linton@arm.com> MIME-Version: 1.0 Precedence: Bulk List-Subscribe: List-Help: 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,jeremy.linton@arm.com List-Unsubscribe-Post: List-Unsubscribe=One-Click List-Unsubscribe: X-Gm-Message-State: ZqUWy3BiTpVzkzi0Vi23pa9kx7686176AA= Content-Transfer-Encoding: quoted-printable X-GND-Status: LEGIT Authentication-Results: spool.mail.gandi.net; dkim=pass header.d=groups.io header.s=20140610 header.b=VehadBDU; spf=pass (spool.mail.gandi.net: domain of bounce@groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce@groups.io; dmarc=fail reason="SPF not aligned (relaxed), DKIM not aligned (relaxed)" header.from=arm.com (policy=none) Since we are updating the DT memory map and telling it how we have configured the PCIe, there isn't a reason for moving the MMIO window. In fact this appears to fix OpenBSD+DT as well as it makes the linux XHCI reset sequence happier. Signed-off-by: Jeremy Linton --- Platform/RaspberryPi/Drivers/FdtDxe/FdtDxe.c | 22 +++++++++++++++++++ .../RaspberryPi/Drivers/FdtDxe/FdtDxe.inf | 6 +++++ 2 files changed, 28 insertions(+) diff --git a/Platform/RaspberryPi/Drivers/FdtDxe/FdtDxe.c b/Platform/Rasp= berryPi/Drivers/FdtDxe/FdtDxe.c index dd4fc0a05e..a247aa36ed 100644 --- a/Platform/RaspberryPi/Drivers/FdtDxe/FdtDxe.c +++ b/Platform/RaspberryPi/Drivers/FdtDxe/FdtDxe.c @@ -375,6 +375,28 @@ SyncPcie ( return EFI_NOT_FOUND; } =20 + // move the MMIO window too + DmaRanges[0] =3D cpu_to_fdt32 (0x02000000); //non prefech 32-bit + DmaRanges[1] =3D cpu_to_fdt32 (FixedPcdGet64 (PcdBcm27xxPciBusMmioAdr)= >> 32); //bus addr @ 0x0f8000000 + DmaRanges[2] =3D cpu_to_fdt32 (FixedPcdGet64 (PcdBcm27xxPciBusMmioAdr)= & MAX_UINT32); + DmaRanges[3] =3D cpu_to_fdt32 (FixedPcdGet64 (PcdBcm27xxPciCpuMmioAdr)= >> 32); //cpu addr @ 0x600000000 + DmaRanges[4] =3D cpu_to_fdt32 (FixedPcdGet64 (PcdBcm27xxPciCpuMmioAdr)= & MAX_UINT32); + DmaRanges[5] =3D cpu_to_fdt32 (0x00000000); + DmaRanges[6] =3D cpu_to_fdt32 (FixedPcdGet32 (PcdBcm27xxPciBusMmioLen)= + 1); // len =3D 0x4000 0000 + + DEBUG ((DEBUG_INFO, "%a: Updating PCIe ranges\n", __func__)); + + /* + * Match ranges (BAR/MMIO) with the EDK2+ACPI setup we are using. + */ + Retval =3D fdt_setprop (mFdtImage, Node, "ranges", + DmaRanges, sizeof DmaRanges); + if (Retval !=3D 0) { + DEBUG ((DEBUG_ERROR, "%a: failed to locate PCIe MMIO 'ranges' proper= ty (%d)\n", + __func__, Retval)); + return EFI_NOT_FOUND; + } + if (PcdGet32 (PcdXhciReload) !=3D 1) { return EFI_SUCCESS; } diff --git a/Platform/RaspberryPi/Drivers/FdtDxe/FdtDxe.inf b/Platform/Ra= spberryPi/Drivers/FdtDxe/FdtDxe.inf index d9fb6ee480..90e138af7c 100644 --- a/Platform/RaspberryPi/Drivers/FdtDxe/FdtDxe.inf +++ b/Platform/RaspberryPi/Drivers/FdtDxe/FdtDxe.inf @@ -23,6 +23,7 @@ MdePkg/MdePkg.dec MdeModulePkg/MdeModulePkg.dec Platform/RaspberryPi/RaspberryPi.dec + Silicon/Broadcom/Bcm27xx/Bcm27xx.dec =20 [LibraryClasses] BaseLib @@ -44,6 +45,11 @@ =20 [FixedPcd] gRaspberryPiTokenSpaceGuid.PcdFdtBaseAddress + gBcm27xxTokenSpaceGuid.PcdBcm27xxPciRegBase + gBcm27xxTokenSpaceGuid.PcdBcm27xxPciBusMmioAdr + gBcm27xxTokenSpaceGuid.PcdBcm27xxPciBusMmioLen + gBcm27xxTokenSpaceGuid.PcdBcm27xxPciCpuMmioAdr + =20 [Pcd] gRaspberryPiTokenSpaceGuid.PcdSystemTableMode --=20 2.43.0 -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#113965): https://edk2.groups.io/g/devel/message/113965 Mute This Topic: https://groups.io/mt/103796311/7686176 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io] -=-=-=-=-=-=-=-=-=-=-=-