I'm trying to build some virtual PCI device, to emulate a real PCI device, so I can reuse Windows drivers... It is a multiport UART card, but that isn't important. I'd be happy to post code, once I get it working, as this has been a heck of a learning curve!
Anyways, my problem is the MMIO PCI bar. When I create a standard PCI IO BAR, I can set the size down to 8 ports, no problem. However, when I do MMIO, it seems the minimum size if 4096 bytes, or _4K.
Here is the MMIO part (0x80 is the width (128)).
Code: Select all
rc = PDMDevHlpPCIIORegionCreateMmio(pDevIns, 0 /*iPciRegion*/, 0x80, PCI_ADDRESS_SPACE_MEM, PLX_MMIOWrite, PLX_MMIORead, NULL /*pvUser*/, IOMMMIO_FLAGS_READ_PASSTHRU | IOMMMIO_FLAGS_WRITE_PASSTHRU, "DigiClassicBoardPCI8", &pThis->hMmioPLX);
Code: Select all
rc = PDMDevHlpPCIIORegionCreateIo(pDevIns, 1 /*iPciRegion*/, 0x80 /*cPorts*/, PLX_IOWrite, PLX_IORead, NULL /*pvUser*/, "DigiClassicBoardPCI8", NULL /*paExtDescs*/, &pThis->hIoPLX); AssertRCReturn(rc, rc);
IO clearly works, but MMIO is 4K.
Real hardware looks like (which is correct).
I understand that BAR moves around. It's the hBAR that is giving me problems (hBAR, again, the readback after writing all 1's).
If I go to 8K, 16K, 32K, etc, the hBAR is correctly set. I just can't seem to go below 4K. The problem is that the driver calls BS on the port size, and refuses to load fully.
So, my question is, is it possible to go below a 4096 byte window?
My device was placed on Bus 0 by PDM. I register it with a simple PDMDevHlpPCIRegister(pDevIns, pPciDev);
Is Bus 0 special? Is it MSI / MSI-X? PCIe? Does that have a 4K minimum limit? I see a few _4K consts in the code referring to a spec. Do I need to attach another PCI bus? If so, I don't know how to set that part up. I figured out how to attach UARTs and their associated downstream (upstream?) drivers, but PCI doesn't seem to have settings, so I don't know how to call it out.
Any help or leads would be greatly appreciated. Thank you for you time, too!