[PATCH V2 07/10] Platform/RaspberryPi: Add SPI/GPIO to memory map
Jeremy Linton
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 <ardb@...>
Signed-off-by: Jeremy Linton <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
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 <ardb@...>
Signed-off-by: Jeremy Linton <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