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 9B20A74003A for ; Thu, 11 Jan 2024 00:04:17 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=LSGYubbW/0VaRH3xZ3EuXdhjryvk8d2Wj2kv+/VNiwQ=; c=relaxed/simple; d=groups.io; h=From:To:Cc:Subject:Date:Message-ID: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=1704931456; v=1; b=kL14jIJIsm6/c6YBU21miBBH4d5rsJp6WSul8RbTPDVTiMTIUlHrVqW2YHVlpsVKUbTIhiOa v8tfUIaGjyDErhLf7s1usLpqGFnZUFE6kgiAvlFwB35BNt6wyRfrGlelTDAAe0Rz7BFk4vhpbGn CR7ONiWAKjjnIjlvpCLAoXhM= X-Received: by 127.0.0.2 with SMTP id Teg1YY7687511xiMk3IVA9Z8; Wed, 10 Jan 2024 16:04:16 -0800 X-Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by mx.groups.io with SMTP id smtpd.web10.9451.1704931455510816881 for ; Wed, 10 Jan 2024 16:04:15 -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 045382F4; Wed, 10 Jan 2024 16:05:01 -0800 (PST) X-Received: from u200865.usa.arm.com (unknown [172.31.20.19]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id E1ECC3F5A1; Wed, 10 Jan 2024 16:04:14 -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 0/7] RaspberryPi: SPI Variables, again Date: Wed, 10 Jan 2024 18:04:03 -0600 Message-ID: <20240111000412.2734985-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: lYtXyEDvZg0rh47DQ1DW7I1xx7686176AA= 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=kL14jIJI; dmarc=fail reason="SPF not aligned (relaxed), DKIM not aligned (relaxed)" header.from=arm.com (policy=none); spf=pass (spool.mail.gandi.net: domain of bounce@groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce@groups.io 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=3D1/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 --=20 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] -=-=-=-=-=-=-=-=-=-=-=-