public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Jeremy Linton" <jeremy.linton@arm.com>
To: devel@edk2.groups.io
Cc: ardb+tianocore@kernel.org, quic_llindhol@quicinc.com,
	Jeremy Linton <jeremy.linton@arm.com>
Subject: [edk2-devel] [PATCH 0/7] RaspberryPi: SPI Variables, again
Date: Wed, 10 Jan 2024 18:04:03 -0600	[thread overview]
Message-ID: <20240111000412.2734985-1-jeremy.linton@arm.com> (raw)

There is a 512KB SPI flash EEPROM on the RPi4, which is used to hold
the early boot firmware. Versions of this this firmware which predate
the network recovery have 160-300+KB unused, which is a perfect place
to drop a UEFI variable store.

This code scans the region and makes the decision at runtime if there
is sufficient space available and falls back to updating the SD/USB
firmware image if not. This behavior is now enabled/disabled at
compile time with -DSPI_VARIABLES=1/0

This is a rehash of a previous set I posted from a few years back, and
I'm largely re-posting it because its still useful for people who are
willing to back that firmware down to gain the functionality, as well
as fixing a crash caused by the variable store code garbage collecting
the storage region when it starts to get full

Beyond providing some example SPI programming on the platform, it also
moves I2C/SPI/GPIO devices which are debatably usable on Linux in
ACPI mode into its own SSDT.

Jeremy Linton (7):
  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.

 .../RaspberryPi/AcpiTables/AcpiTables.inf     |   1 +
 Platform/RaspberryPi/AcpiTables/Dsdt.asl      |   7 -
 Platform/RaspberryPi/AcpiTables/GpuDevs.asl   | 126 ----
 Platform/RaspberryPi/AcpiTables/SsdtGpio.asl  | 159 +++++
 .../RaspberryPi/Drivers/ConfigDxe/ConfigDxe.c |  37 +
 .../Drivers/ConfigDxe/ConfigDxe.inf           |   1 +
 .../Drivers/ConfigDxe/ConfigDxeHii.uni        |   5 +
 .../Drivers/ConfigDxe/ConfigDxeHii.vfr        |  15 +
 .../Drivers/RpiFirmwareDxe/RpiFirmwareDxe.c   |  60 +-
 .../Drivers/VarBlockServiceDxe/FvbInfo.c      |   8 +-
 .../VarBlockServiceDxe/VarBlockService.c      | 669 +++++++++++++++++-
 .../VarBlockServiceDxe/VarBlockService.h      |  10 +
 .../VarBlockServiceDxe/VarBlockServiceDxe.c   |  69 +-
 .../VarBlockServiceDxe/VarBlockServiceDxe.inf |   7 +
 Platform/RaspberryPi/Include/ConfigVars.h     |   4 +
 .../Include/IndustryStandard/RpiMbox.h        |   1 +
 .../Include/Protocol/RpiFirmware.h            |   7 +
 Platform/RaspberryPi/RPi3/RPi3.dsc            |   6 +
 Platform/RaspberryPi/RPi4/RPi4.dsc            |  12 +-
 Platform/RaspberryPi/RaspberryPi.dec          |   1 +
 .../Include/IndustryStandard/Bcm2836.h        |  34 +
 .../Bcm283x/Include/Library/GpioLib.h         |   6 +
 .../Bcm283x/Library/GpioLib/GpioLib.c         |  16 +-
 23 files changed, 1100 insertions(+), 161 deletions(-)
 create mode 100644 Platform/RaspberryPi/AcpiTables/SsdtGpio.asl

-- 
2.43.0



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#113549): https://edk2.groups.io/g/devel/message/113549
Mute This Topic: https://groups.io/mt/103653085/7686176
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io]
-=-=-=-=-=-=-=-=-=-=-=-



             reply	other threads:[~2024-01-11  0:04 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-11  0:04 Jeremy Linton [this message]
2024-01-11  0:04 ` [edk2-devel] [PATCH 1/7] Platform/RaspberryPi: Move GPIO/SPI/I2C to SSDT Jeremy Linton
2024-01-11  0:04 ` [edk2-devel] [PATCH 2/7] Platform/RaspberryPi: Add menu item to enable/disable GPIO Jeremy Linton
2024-01-11  0:04 ` [edk2-devel] [PATCH 3/7] Platform/RaspberryPi: Add constants for controlling SPI Jeremy Linton
2024-01-11  0:04 ` [edk2-devel] [PATCH 4/7] Platform/RaspberryPi: Add mailbox cmd to control audio amp Jeremy Linton
2024-01-11  0:04 ` [edk2-devel] [PATCH 5/7] Platform/RaspberryPi: Add SPI/GPIO to memory map Jeremy Linton
2024-01-11  0:04 ` [edk2-devel] [PATCH 6/7] Platform/RaspberryPi: Allow pin function selection at runtime Jeremy Linton
2024-01-11  0:04 ` [edk2-devel] [PATCH 7/7] Platform/RaspberryPi: Add SPI flash variable store Jeremy Linton

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240111000412.2734985-1-jeremy.linton@arm.com \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox