1

I'm using PCIe bus on Freescale MPC8308 (as root complex) and the endpoint device is an ASIC with just one 256 MB memory region and just one BAR register. The device configuration space registers are readily accessible through "pciutils" package. At first I tried to access memory region by using mmap() but it didn't work. So at the next level, I prepared a device driver for the PCIe endpoint device which is a kernel module that I load into kernel after Linux booting.

In my driver the endpoint device is identified from device ID table but when I want to enable the device by pci_enable_device(), I see this error:

driver-pci 0000:00:00.0: device not available because of BAR 0 [0x000000-0xfffffff] collisions

Also when I want to allocate memory region for PCIe device by using pci_request_region(), it is not possible.

Here is the part of driver code which is not working:

pci_enable_result = pci_enable_device (pdev);
if (pci_enable_result)
{
  printk(KERN_INFO "PCI enable encountered a problem \n");
  return pci_enable_result;
}
else
{
  printk(KERN_INFO "PCI enable was succesfull \n");
}

And here is the result in "dmesg" :

driver-pci 0000:00:00.0: device not available because of BAR 0 [0x000000-0xfffffff] collisions

PCI enable encountered a problem

driver-pci: probe of 0000:00:00.0 failed with error -22

It is worth noting that in the driver I can read and write configuration registers correctly by using functions like pci_read_config_dword() and pci_write_config_dword().

What's the problem do you think? is it possible that the problem appears because the kernel initializes the device prior to kernel module? what should I do to prevent this to occur?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.