From mboxrd@z Thu Jan 1 00:00:00 1970 Subject: Re: [edk2-devel] [PATCH V2 00/10] Platform/RaspberryPi: Utilize SPI flash for EFI variables To: Jeremy Linton ,devel@edk2.groups.io From: "Jeff Booher-Kaeding" X-Originating-Location: Austin, Texas, US (217.140.111.153) X-Originating-Platform: Mac Safari 15.3 User-Agent: GROUPS.IO Web Poster MIME-Version: 1.0 Date: Thu, 10 Feb 2022 08:38:51 -0800 References: <20220102054924.1195762-1-jeremy.linton@arm.com> In-Reply-To: <20220102054924.1195762-1-jeremy.linton@arm.com> Message-ID: <24052.1644511131924554376@groups.io> Content-Type: multipart/alternative; boundary="l1gfZ03kj3C3kY9wCRXz" --l1gfZ03kj3C3kY9wCRXz Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Patches applied cleanly & built with no issues. No issues spotted in functi= onal testing & passes the SCT tests required by SBBR. -Jeff On Sat, Jan 1, 2022 at 09:49 PM, Jeremy Linton wrote: >=20 > The RPi4 has a SPI flash with unused capacity. This set detects if > that capacity is sufficient for a UEFI variable store and utilizes > it as such. This fixes a long list of problems, and along the way likely > also fixes a random boot failure caused by the FaultTolerantWriteDxe > garbage collecting, and erasing the flash volume header which is being > used to return information about the underlying variable storage capacity= =3D >=20 > . >=20 > This set was dependent on an earlier, mostly ignored set of changes to > move the GPIO/etc devices into their own SSDT and disable them. Because > of that, the two sets have been merged. >=20 > Why is that? Because the SPI flash is mux'ed with the PWM used to play > audio out the 3.5mm audio jack on this device. This causes a long list > of problems we must try and avoid, starting with the fact that the pins > need to be controlled by the uefi runtime service. The other problem is > obviously that any time a variable is updated, if the user is utilizing > the 3.5mm audio they will hear clicks and pops. Turns out that behavior > isn't unique to this patch set because the low level boot/etc exhibits th= =3D >=20 > is > when running in a TFA+uboot/edk2 environment. A fairly small tweak to TFA > fixes the majority of this, and the remaining runtime problems caused > by this patch actually are very slight and generally not noticeable unles= =3D >=20 > s > one goes looking for them. OTOH, we revert to the earlier non persisted > variable store if the firmware is running in a DT only mode, or the > user enables the ACPI GPIO block. >=20 > V1->V2: > Move Rhpx.asl into GPIO SSDT, this fixes a windows problem if the > GPIO description is removed. > Add longer explanation to Readme.md as well as update it to note > CM4/RPi400, newer menu item variables, etc. > Various code cleanups caught by updated PatchCheck > More agressive ifdef'ing out RPi4 only code for RPi3 >=20 > Jeremy Linton (10): > Platform/RaspberryPi: Cleanup menu visibility > Platform/RaspberryPi: Give the user control over the XHCI mailbox > Platform/RaspberryPi: Move GPIO/SPI/I2C to SSDT > Platform/RaspberryPi: Add menu item to enable/disable GPIO > Platform/RaspberryPi: Add constants for controlling SPI > Platform/RaspberryPi: Add mailbox cmd to control audio amp > Platform/RaspberryPi: Add SPI/GPIO to memory map > Platform/RaspberryPi: Allow pin function selection at runtime > Platform/RaspberryPi: Add SPI flash variable store. > Platform/RaspberryPi: Update RPi4 Readme >=20 > Platform/RaspberryPi/AcpiTables/AcpiTables.inf | 1 + > Platform/RaspberryPi/AcpiTables/Dsdt.asl | 7 - > Platform/RaspberryPi/AcpiTables/GpuDevs.asl | 126 ---- > Platform/RaspberryPi/AcpiTables/SsdtGpio.asl | 159 +++++ > Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxe.c | 47 ++ > .../RaspberryPi/Drivers/ConfigDxe/ConfigDxe.inf | 2 + > .../RaspberryPi/Drivers/ConfigDxe/ConfigDxeHii.uni | 10 + > .../RaspberryPi/Drivers/ConfigDxe/ConfigDxeHii.vfr | 36 +- > Platform/RaspberryPi/Drivers/FdtDxe/FdtDxe.c | 4 + > Platform/RaspberryPi/Drivers/FdtDxe/FdtDxe.inf | 1 + > .../Drivers/RpiFirmwareDxe/RpiFirmwareDxe.c | 60 +- > .../Drivers/VarBlockServiceDxe/FvbInfo.c | 8 +- > .../Drivers/VarBlockServiceDxe/VarBlockService.c | 657 +++++++++++++++=3D > +++++- > .../Drivers/VarBlockServiceDxe/VarBlockService.h | 10 + > .../VarBlockServiceDxe/VarBlockServiceDxe.c | 38 +- > .../VarBlockServiceDxe/VarBlockServiceDxe.inf | 6 + > Platform/RaspberryPi/Include/ConfigVars.h | 4 + > .../RaspberryPi/Include/IndustryStandard/RpiMbox.h | 1 + > .../RaspberryPi/Include/Protocol/RpiFirmware.h | 7 + > Platform/RaspberryPi/RPi3/RPi3.dsc | 12 + > Platform/RaspberryPi/RPi4/RPi4.dsc | 14 + > Platform/RaspberryPi/RPi4/Readme.md | 63 +- > Platform/RaspberryPi/RaspberryPi.dec | 2 + > .../Bcm283x/Include/IndustryStandard/Bcm2836.h | 34 ++ > Silicon/Broadcom/Bcm283x/Include/Library/GpioLib.h | 6 + > Silicon/Broadcom/Bcm283x/Library/GpioLib/GpioLib.c | 16 +- > 26 files changed, 1160 insertions(+), 171 deletions(-) > create mode 100644 Platform/RaspberryPi/AcpiTables/SsdtGpio.asl >=20 > --=3D20 > 2.13.7 --l1gfZ03kj3C3kY9wCRXz Content-Type: text/html; charset="utf-8" Content-Transfer-Encoding: quoted-printable
Patches applied cleanly & built with no issues. No issues spotted = in functional testing & passes the SCT tests required by SBBR.
-Jeff

On Sat, Jan 1, 2022 at 09:49 PM, Jeremy Linton wrote:
The RPi4 has a SPI flash with unused capacity. This set detects= if
that capacity is sufficient for a UEFI variable store and utilizes=
it as such. This fixes a long list of problems, and along the way lik= ely
also fixes a random boot failure caused by the FaultTolerantWriteD= xe
garbage collecting, and erasing the flash volume header which is be= ing
used to return information about the underlying variable storage c= apacity=3D
.

This set was dependent on an earlier, mostly i= gnored set of changes to
move the GPIO/etc devices into their own SSDT= and disable them. Because
of that, the two sets have been merged.

Why is that? Because the SPI flash is mux'ed with the PWM used to p= lay
audio out the 3.5mm audio jack on this device. This causes a long = list
of problems we must try and avoid, starting with the fact that th= e pins
need to be controlled by the uefi runtime service. The other pr= oblem is
obviously that any time a variable is updated, if the user is= utilizing
the 3.5mm audio they will hear clicks and pops. Turns out t= hat behavior
isn't unique to this patch set because the low level boot= /etc exhibits th=3D
is
when running in a TFA+uboot/edk2 environme= nt. A fairly small tweak to TFA
fixes the majority of this, and the re= maining runtime problems caused
by this patch actually are very slight= and generally not noticeable unles=3D
s
one goes looking for the= m. OTOH, we revert to the earlier non persisted
variable store if the = firmware is running in a DT only mode, or the
user enables the ACPI GP= IO block.

V1->V2:
Move Rhpx.asl into GPIO SSDT, this fix= es a windows problem if the
GPIO description is removed.
Add long= er explanation to Readme.md as well as update it to note
CM4/RPi400, n= ewer menu item variables, etc.
Various code cleanups caught by updated= PatchCheck
More agressive ifdef'ing out RPi4 only code for RPi3
=
Jeremy Linton (10):
Platform/RaspberryPi: Cleanup menu visibilit= y
Platform/RaspberryPi: Give the user control over the XHCI mailboxPlatform/RaspberryPi: Move GPIO/SPI/I2C to SSDT
Platform/RaspberryP= i: Add menu item to enable/disable GPIO
Platform/RaspberryPi: Add cons= tants for controlling SPI
Platform/RaspberryPi: Add mailbox cmd to con= trol audio amp
Platform/RaspberryPi: Add SPI/GPIO to memory map
P= latform/RaspberryPi: Allow pin function selection at runtime
Platform/= RaspberryPi: Add SPI flash variable store.
Platform/RaspberryPi: Updat= e RPi4 Readme

Platform/RaspberryPi/AcpiTables/AcpiTables.inf | 1= +
Platform/RaspberryPi/AcpiTables/Dsdt.asl | 7 -
Platform/Raspbe= rryPi/AcpiTables/GpuDevs.asl | 126 ----
Platform/RaspberryPi/AcpiTable= s/SsdtGpio.asl | 159 +++++
Platform/RaspberryPi/Drivers/ConfigDxe/Conf= igDxe.c | 47 ++
.../RaspberryPi/Drivers/ConfigDxe/ConfigDxe.inf | 2 +<= br />.../RaspberryPi/Drivers/ConfigDxe/ConfigDxeHii.uni | 10 +
.../Ras= pberryPi/Drivers/ConfigDxe/ConfigDxeHii.vfr | 36 +-
Platform/Raspberry= Pi/Drivers/FdtDxe/FdtDxe.c | 4 +
Platform/RaspberryPi/Drivers/FdtDxe/F= dtDxe.inf | 1 +
.../Drivers/RpiFirmwareDxe/RpiFirmwareDxe.c | 60 +-.../Drivers/VarBlockServiceDxe/FvbInfo.c | 8 +-
.../Drivers/VarBloc= kServiceDxe/VarBlockService.c | 657 +++++++++++++++=3D
+++++-
...= /Drivers/VarBlockServiceDxe/VarBlockService.h | 10 +
.../VarBlockServi= ceDxe/VarBlockServiceDxe.c | 38 +-
.../VarBlockServiceDxe/VarBlockServ= iceDxe.inf | 6 +
Platform/RaspberryPi/Include/ConfigVars.h | 4 +
= .../RaspberryPi/Include/IndustryStandard/RpiMbox.h | 1 +
.../Raspberry= Pi/Include/Protocol/RpiFirmware.h | 7 +
Platform/RaspberryPi/RPi3/RPi3= .dsc | 12 +
Platform/RaspberryPi/RPi4/RPi4.dsc | 14 +
Platform/Ra= spberryPi/RPi4/Readme.md | 63 +-
Platform/RaspberryPi/RaspberryPi.dec = | 2 +
.../Bcm283x/Include/IndustryStandard/Bcm2836.h | 34 ++
Sili= con/Broadcom/Bcm283x/Include/Library/GpioLib.h | 6 +
Silicon/Broadcom/= Bcm283x/Library/GpioLib/GpioLib.c | 16 +-
26 files changed, 1160 inser= tions(+), 171 deletions(-)
create mode 100644 Platform/RaspberryPi/Acp= iTables/SsdtGpio.asl

--=3D20
2.13.7
--l1gfZ03kj3C3kY9wCRXz--