I'm currently working on porting a kernel module for a VME bridge from 2.6 to 3.16.
The device is capable of mapping a VME address space to PCI, where the address range that is mapped into can be set by the driver. So the kernel module first tries to find an available region in address space by doing a loop like this
for (pciAddr=MEM_START; pciAddr<MEM_STOP; pciAddr+=STEP) {
if (check_mem_region(pci_Addr, size)==0)
break;
}
request_mem_region(pciAddr, size, modulename);
which should be changed to
for (pciAddr=MEM_START; pciAddr<MEM_STOP; pciAddr+=STEP) {
if (request_mem_region(pciAddr, size, modulename)!=0)
break;
}
for newer Kernels. This works fine for the 2.6 Kernel, but for the newer 3.16 both variants return the first region (starting at MEM_START) as available, but subsequent reads in this address range fail, returning always 0xff.
MEM_START is defined as 0x40000000, and /proc/iomem shows
40000000-401fffff : PCI Bus 0000:01
in one of the lines. When changing MEM_START to another address which is free according to /proc/iomem, everything works.
So it seems that request_mem_region() returns success for a region which is not available, and does this only for newer Kernels. What could be the reason for this behavior?