[coreboot] Extra pairs of eyes

ron minnich rminnich at gmail.com
Tue Oct 14 23:28:39 CEST 2008


On Tue, Oct 14, 2008 at 2:13 PM, Myles Watson <mylesgw at gmail.com> 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);

typedef u64 resource_t;
struct resource {
        resource_t base;        /* Base address of the resource */
        resource_t size;        /* Size of the resource */
        resource_t limit;       /* Largest valid value base + size -1 */
        unsigned long flags;    /* Descriptions of the kind of resource */
        unsigned long index;    /* Bus specific per device resource id */
        unsigned char align;    /* Required alignment (log 2) of the resource */
        unsigned char gran;     /* Granularity (log 2) of the resource */
        /* Alignment must be >= the granularity of the resource */
};

Look at the type of resource_t. 64 bits.
Your printk is printing 64-bit fields as 32 bits. Things are going to
get very confused.

A common problem.

ron




More information about the coreboot mailing list