From c71071397fa1a757e724a7c11274307a137ef627 Mon Sep 17 00:00:00 2001 From: Kilian Krause Date: Wed, 13 Aug 2025 16:58:47 +0200 Subject: [PATCH] soc/intel/common/fast_spi: Add static bus scanning MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add scan_bus operation to fast_spi device operations to enable discovery of statically defined child devices. This allows device drivers such as drivers/pc80/tpm that are physically connected to the fast_spi bus to be properly enumerated and initialized during device tree scanning. Without this change, child devices defined in devicetree under fast_spi would not be discovered, preventing proper driver binding and initialization. Example devicetree configuration: ``` device ref fast_spi on chip drivers/pc80/tpm # SPI TPM header device pnp 0c31.0 on end end end ``` Without a .scan_bus hook in fast_spi_dev_ops, coreboot's BS_DEV_ENUMERATE phase never creates the pnp 0c31.0 device. As a result, in BS_DEV_RESOURCES you see, that the device PNP 0c31.0 is missing its function "read_resources": ``` (in BS_DEV_ENUMERATE) [DEBUG] scan_bus: bus PCI: 00:00:1f.4 finished in 11 msecs [DEBUG] scan_bus: bus DOMAIN: 00000000 finished in 1510 msecs [SPEW ] scan_static_bus for Root Device done ... (in BS_DEV_RESOURCES) [SPEW ] PCI: 00:00:1f.5 read_resources segment group 0 bus 0 [ERROR] PNP: 0c31.0 missing read_resources [SPEW ] PCI: 00:00:1f.5 read_resources segment group 0 bus 0 done [SPEW ] DOMAIN: 00000000 read_resources segment group 0 bus 0 done [SPEW ] Root Device read_resources segment group 0 bus 0 done [INFO ] Done reading resources. ``` With the implementation of scan_bus, the log shows that the resources are allocated correctly: ``` (in BS_DEV_ENUMERATE) [DEBUG] scan_bus: bus PCI: 00:00:1f.4 finished in 11 msecs [DEBUG] PCI: 00:00:1f.5 scanning... [SPEW ] scan_static_bus for PCI: 00:00:1f.5 [DEBUG] PNP: 0c31.0 enabled [SPEW ] scan_static_bus for PCI: 00:00:1f.5 done [DEBUG] scan_bus: bus PCI: 00:00:1f.5 finished in 14 msecs [DEBUG] scan_bus: bus DOMAIN: 00000000 finished in 1536 msecs [SPEW ] scan_static_bus for Root Device done ... (in BS_DEV_RESOURCES) [SPEW ] PCI: 00:00:1f.5 read_resources segment group 0 bus 0 [SPEW ] dev: PNP: 0c31.0, index: 0x0, base: 0xfed40000, size: 0x5000 [SPEW ] PCI: 00:00:1f.5 read_resources segment group 0 bus 0 done [SPEW ] DOMAIN: 00000000 read_resources segment group 0 bus 0 done [SPEW ] Root Device read_resources segment group 0 bus 0 done [INFO ] Done reading resources. ``` TEST=Verified on Siemens mc_rpl1 mainboard. TPM device properly enumerated with scan_bus implementation. Change-Id: I4049d2d3cd5132362a7efd551dc9dd78cd24b9eb Signed-off-by: Kilian Krause Reviewed-on: https://review.coreboot.org/c/coreboot/+/88966 Reviewed-by: Paul Menzel Reviewed-by: Mario Scheithauer Reviewed-by: Jérémy Compostella Tested-by: build bot (Jenkins) Reviewed-by: Werner Zeh --- src/soc/intel/common/block/fast_spi/fast_spi.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/soc/intel/common/block/fast_spi/fast_spi.c b/src/soc/intel/common/block/fast_spi/fast_spi.c index f7abaa2743..627ab28e9b 100644 --- a/src/soc/intel/common/block/fast_spi/fast_spi.c +++ b/src/soc/intel/common/block/fast_spi/fast_spi.c @@ -558,6 +558,7 @@ static struct device_operations fast_spi_dev_ops = { .acpi_fill_ssdt = fast_spi_fill_ssdt, .acpi_name = fast_spi_acpi_name, .ops_pci = &pci_dev_ops_pci, + .scan_bus = scan_static_bus, }; static const unsigned short pci_device_ids[] = {