DF-5468 / rombar_probe.sh
#!/bin/sh # DF-5468 — demonstrate that the ROM path of vga_pci_map_bios() is dead on # spec-conformant devices: the PCI ROM BAR enable bit (bit 0, RW per spec) # survives the 0xffffffff sizing readback, and DF's lazy pci_alloc_map() # then classifies the BAR as an I/O BAR (PCI_BAR_IO(testval)==1), so the # SYS_RES_MEMORY allocation for rid PCIR_BIOS always fails. # # Run as root on the DragonFly QEMU guest. Harmless: the BAR is restored. # # Expected output: # testval=0xffff0001 <- enable bit set => PCI_BAR_IO => misclassified # and (via the df5467 KLD or a drm attach) dmesg shows: # vgapci0: vga_pci_alloc_resource failed # VGA=pci0:0:2:0 echo "current ROM BAR (0x30): $(pciconf -r $VGA 0x30)" pciconf -w $VGA 0x30 0xffffffff echo "sizing readback : $(pciconf -r $VGA 0x30)" pciconf -w $VGA 0x30 0xfebc0000 echo "restored : $(pciconf -r $VGA 0x30)" echo echo "kernel-side proof (unseeded vga_pci_map_bios attempt):" dmesg | grep -E "vga_pci_alloc_resource failed" | tail -3 echo echo "bit0 of the readback is the ROM decode-enable bit (RW per PCI spec);" echo "pci_alloc_map() (sys/bus/pci/pci.c:3933-3966) runs PCI_BAR_MEM(testval)" echo "on exactly this value and rejects the SYS_RES_MEMORY request." |