I am facing an issue in accessing BAR address that enumerated in Linux due to bug in my hardware(Address decoder).
With enumerated Linux bar address if we access my device register from Linux host will result in garbage value, This is due to hardware Address multiplexer decode issue (device will access only if upper most 5 bit should be in zero). Bar address should be in below range.
0x04000000 0x08000000 0x0c000000
Is there any way to change in Kernel.
I tried below change but it not worked out, so please help me how to change to fixed address for my devices
Tried below things today in kernel.
In e820_reserve_resources() API tried to reserve memory range between 0x08000000 and 0x08ffffff. Below is the code snippet.
#
res->name = e820_type_to_string(e820->map[i].type);
res->start = e820->map[i].addr;
res->end = end;
res->flags = e820_type_to_iomem_type(e820->map[i].type);
res->desc = e820_type_to_iores_desc(e820->map[i].type);
#if 1
printk(KERN_INFO "TESTCHIP e820_reserve_resources name= %s - start_addr = 0x%x - end = 0x%x flasg = %x desc = %x\n", res->name, res->start, res->end, res->flags, res->desc);
if(res->start == 0x100000) { // Address range check Silambarasan
res->end = 0x07FFFFFF;
printk(KERN_INFO "TESTCHIP end = 0x%x\n",res->end);
res->flags |= IORESOURCE_BUSY;
insert_resource(&iomem_resource, res);
res++;
res->name = "reserved";
res->start = 0x08000000;
res->end = 0x08FFFFFF;
res->flags = 0x200;
res->desc = 0;
}
#endif
#######################################
With the above changes able to see the memory reserved in cat /proc/iomem section as below.
00000000-00000fff : reserved
00001000-0009d7ff : System RAM
0009d800-0009ffff : reserved
000a0000-000bffff : PCI Bus 0000:00
000c0000-000cfdff : Video ROM
000d0000-000d3fff : PCI Bus 0000:00
000d4000-000d7fff : PCI Bus 0000:00
000d8000-000dbfff : PCI Bus 0000:00
000dc000-000dffff : PCI Bus 0000:00
000e0000-000fffff : reserved
000e0000-000e3fff : PCI Bus 0000:00
000e4000-000e7fff : PCI Bus 0000:00
000f0000-000fffff : System ROM
00100000-07ffffff : System RAM
01000000-016768e9 : Kernel code
016768ea-01d3677f : Kernel data
01f4e000-0214cfff : Kernel bss
08000000-08ffffff : reserved
2f000000-36ffffff : Crash kernel
b609d000-b60a3fff : ACPI Non-volatile Storage
b60a4000-b6506fff : System RAM
Now trying to allocate the above reserved memory to the PCI bridge in pdev_assign_fixed_resource() function. In this when I try to allocate the reserve memory it allocated as virtual memory for the device.