Unfortunately I’m no longer the owner of the driver and it’s changed beyond all recognition :-(
I do have some of the before and after changes and your email though :-)
PFA modified driver code.
Actually, the way you were getting the handle of pci_dev* doesn’t seem to be correct. (binding of device with driver is missing because of that)
I modified it to look like a typical PCIe end point device driver and with few hacks I could even confirm that the DMA/HW address returned by pci_allloc_consistent() API is what it is supposed to be.
I’ve modified your driver to the extent to make sure it works fine. You may have to modify it further (if required) accordingly.
In our original driver the init function took no parameters and tried to look up the device using pci_get_device()
struct pci_dev *gDev = NULL;
static int XPCIe_init(void)
gDev = pci_get_device (PCI_VENDOR_ID_XILINX, PCI_DEVICE_ID_XILINX_PCIE, gDev);
In your modified version the init function was formed as shown below and had the pci device supplied to it
static int XPCIe_init(struct pci_dev *pdev, const struct pci_device_id *ent)
gDev = pdev;
This was all it took to make it work.