dev = PCI_GetDevice(0x1234, 0x1111, 0);\r
if(dev == -1)\r
base = VBE_DISPI_LFB_PHYSICAL_ADDRESS;\r
- else\r
- base = PCI_GetBAR(dev, 0);\r
+ else {\r
+ Log_Debug("BGA", "BARs %x,%x,%x,%x,%x,%x",\r
+ PCI_GetBAR(dev, 0), PCI_GetBAR(dev, 1), PCI_GetBAR(dev, 2),\r
+ PCI_GetBAR(dev, 3), PCI_GetBAR(dev, 4), PCI_GetBAR(dev, 5));\r
+ base = PCI_GetValidBAR(dev, 0, PCI_BARTYPE_MEM);\r
+ // TODO: Qemu/bochs have MMIO versions of the registers in BAR2\r
+ // - This range is non-indexed\r
+ //mmio_base = PCI_GetValidBAR(dev, 2, PCI_BARTYPE_MEM);\r
+ }\r
\r
// Map Framebuffer to hardware address\r
gBGA_Framebuffer = (void *) MM_MapHWPages(base, 768); // 768 pages (3Mb)\r