From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by mx.groups.io with SMTP id smtpd.web11.9305.1641102583240960003 for ; Sat, 01 Jan 2022 21:49:44 -0800 Authentication-Results: mx.groups.io; dkim=missing; spf=pass (domain: arm.com, ip: 217.140.110.172, mailfrom: jeremy.linton@arm.com) 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 CC163139F; Sat, 1 Jan 2022 21:49:43 -0800 (PST) Received: from u200856.usa.arm.com (unknown [172.31.20.19]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 670F83F5A1; Sat, 1 Jan 2022 21:49:43 -0800 (PST) From: "Jeremy Linton" To: devel@edk2.groups.io Cc: pete@akeo.ie, ardb+tianocore@kernel.org, leif@nuviainc.com, awarkentin@vmware.com, Sunny.Wang@arm.com, samer.el-haj-mahmoud@arm.com, mariobalanica02@gmail.com, Jeremy Linton , Ard Biesheuvel Subject: [PATCH V2 07/10] Platform/RaspberryPi: Add SPI/GPIO to memory map Date: Sat, 1 Jan 2022 23:49:21 -0600 Message-Id: <20220102054924.1195762-8-jeremy.linton@arm.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20220102054924.1195762-1-jeremy.linton@arm.com> References: <20220102054924.1195762-1-jeremy.linton@arm.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable A large reason for using the SPI flash on this platform is that it can be updated without OS interference at rutime. In order for that to happen we need both the SPI, as well as the GPIO which is used to change the pinmux from the PWM device to SPI added to the UEFI memory map as being used by the runtime service. Tested-by: Ard Biesheuvel Signed-off-by: Jeremy Linton --- Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxe.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxe.c b/Platfor= m/RaspberryPi/Drivers/ConfigDxe/ConfigDxe.c index de7eb769ea..b0db3312c5 100644 --- a/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxe.c +++ b/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxe.c @@ -503,6 +503,22 @@ ApplyVariables ( DEBUG ((DEBUG_INFO, "Current CPU speed is %u MHz\n", Rate / FREQ_1_M= HZ)); } =20 + if (mModelFamily =3D=3D 4) { + Status =3D gDS->AddMemorySpace (EfiGcdMemoryTypeMemoryMappedIo, BCM2= 836_SPI0_BASE_ADDRESS, + SIZE_4KB, EFI_MEMORY_UC | EFI_MEMORY_R= UNTIME); + ASSERT_EFI_ERROR (Status); + Status =3D gDS->SetMemorySpaceAttributes (BCM2836_SPI0_BASE_ADDRESS, + SIZE_4KB, EFI_MEMORY_UC|EFI_= MEMORY_RUNTIME); + + Status =3D gDS->AddMemorySpace (EfiGcdMemoryTypeMemoryMappedIo, GPIO= _BASE_ADDRESS, + SIZE_4KB, EFI_MEMORY_UC | EFI_MEMORY_R= UNTIME); + ASSERT_EFI_ERROR (Status); + Status =3D gDS->SetMemorySpaceAttributes (GPIO_BASE_ADDRESS, + SIZE_4KB, EFI_MEMORY_UC|EFI_= MEMORY_RUNTIME); + + ASSERT_EFI_ERROR (Status); + } + if (mModelFamily >=3D 4 && PcdGet32 (PcdRamMoreThan3GB) !=3D 0 && PcdGet32 (PcdRamLimitTo3GB) =3D=3D 0) { UINT64 SystemMemorySize; --=20 2.13.7