amd: Fall back to reading rom3 range in case of ROM Armor
AMD is pushing ROM Armor forward, which leaves the SPI handling to
the PSP and only a mailbox interface (guarded by SMM) for the main
CPU. With the current ROM Armor 3, there is no opt-out in the BIOS
setup anymore.
Only access left for the main CPU is the read-only memory mapping.
We make this available when active ROM Armor is detected (SPI BAR
register reads all ff). Probing of the flash size is peculiar, we
can only try to guess it when memory contents look repetitive.
To not pollute the `amd_spi100` driver, we start a new one.
Story: https://icon.sourcearcade.org/posts/amd_firmware_reading/
Change-Id: Ib4866084fe80853fd66501176dbc6b766750062f
Signed-off-by: Nico Huber <nico.h@gmx.de>
Reviewed-on: https://review.sourcearcade.org/c/flashprog/+/350
diff --git a/include/programmer.h b/include/programmer.h
index 11d15a8..43f7023 100644
--- a/include/programmer.h
+++ b/include/programmer.h
@@ -382,6 +382,9 @@
/* amd_imc.c */
int handle_imc(struct pci_dev *);
+/* amd_rom3read.c */
+int amd_rom3read_probe(const void *spibar, const void *rom2, const void *rom3, size_t rom3_len);
+
/* amd_spi100.c */
int amd_spi100_probe(void *const spibar, void *const memory_mapping, const size_t mapped_len);