[coreboot] Extra pairs of eyes

Myles Watson mylesgw at gmail.com
Wed Oct 15 04:47:50 CEST 2008



> -----Original Message-----
> From: ron minnich [mailto:rminnich at gmail.com]
> Sent: Tuesday, October 14, 2008 3:29 PM
> To: Myles Watson
> Cc: Coreboot
> Subject: Re: Extra pairs of eyes
> 
> 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.

Should I go through and make all the resource holders resource_t instead of
unsigned long?  They're mixed right now.

I was expecting that my 64-bit values would lose their upper bits, but I
wasn't expecting what I got.

Thanks,
Myles





More information about the coreboot mailing list