Myles Watson wrote:
I'm tired of staring at this piece of code wondering why printk isn't working as I expected. Can someone point out what I've obviously missed?
code (inserted in pci_device.c in pci_get_resource() right before the limit mask and return): if (resource->flags) { printk(BIOS_DEBUG, "%s resource base %08lx limit %08lx size %08lx flags %08lx\n", dev_path(dev), resource->base, resource->limit, resource->size, resource->flags);
printk(BIOS_DEBUG, "\t%s size %lx align %lx gran %lx\n", dev_path(dev), resource->size, resource->align, resource->gran); printk(BIOS_DEBUG, " just broken size %08lx\n", resource->size); printk(BIOS_DEBUG, " broken align %lx\n", resource->align); printk(BIOS_DEBUG, "%s resource size %08lx flags %08lx\n", dev_path(dev), resource->size, resource->flags); printk(BIOS_DEBUG, "%s align %lx gran %lx\n", dev_path(dev), resource->align, resource->gran); }
output: PCI: 01:00.0 resource base 00000000 limit 00000000 size ffffffff flags 00000000 PCI: 01:00.0 size 1000 align 0 gran c just broken size 00001000 broken align c PCI: 01:00.0 resource size 00001000 flags 00000000 PCI: 01:00.0 align c gran c
Notice that size is ffffffff in the first, 0x1000 in the rest. Align is 0 in the first, c in the rest.
It looks like printk is botching it. I don't know how else to explain it. Is there a limit to the number of arguments you can pass to printk? Thanks, Myles
I have seen this too, with v2, occasionally.
Make sure the printk fetches 4 bytes from the stack when the parameter is 4 bytes.
Which gcc are you using?