MMIO register space was off by 4 bytes, bottom bits of PCI BAR registers are not part of the address.
Test boot on real hardware:
PCI device 00:14.7 (vd=1022:7813 c=0805)
Searching bootorder for: /pci@i0cf8/*@14,7 sdhci@0xfeb25500 ver=1001 cap=31fe3fb2 2570 sdcard_set_frequency 63 400 8000 sdcard_pio command stop (code=1) sdcard_set_frequency 63 25000 200 Found sdcard at 0xfeb25500: SD card SD01G 982MiB Registering bootable: SD card SD01G 982MiB (type:2 prio:103 data:f46e0)
Signed-off-by: Kyösti Mälkki kyosti.malkki@gmail.com --- src/hw/sdcard.c | 1 + 1 file changed, 1 insertion(+)
diff --git a/src/hw/sdcard.c b/src/hw/sdcard.c index d80b473..be726d2 100644 --- a/src/hw/sdcard.c +++ b/src/hw/sdcard.c @@ -527,6 +527,7 @@ sdcard_pci_setup(void *data) wait_preempt(); // Avoid pci_config_readl when preempting // XXX - bars dependent on slot index register in pci config space u32 regs = pci_config_readl(pci->bdf, PCI_BASE_ADDRESS_0); + regs &= PCI_BASE_ADDRESS_MEM_MASK; pci_config_maskw(pci->bdf, PCI_COMMAND, 0, PCI_COMMAND_IO | PCI_COMMAND_MEMORY | PCI_COMMAND_MASTER); int prio = bootprio_find_pci_device(pci);