diff --git a/device/device.c b/device/device.c index 2a0d251294..da86a64b95 100644 --- a/device/device.c +++ b/device/device.c @@ -446,10 +446,10 @@ void compute_allocate_resource(struct bus *bus, struct resource *bridge, * resource type specific. */ if (bridge->flags & IORESOURCE_IO) { - min_align = log2(DEVICE_IO_ALIGN); + min_align = log2c(DEVICE_IO_ALIGN); } if (bridge->flags & IORESOURCE_MEM) { - min_align = log2(DEVICE_MEM_ALIGN); + min_align = log2c(DEVICE_MEM_ALIGN); } /* Make certain we have read in all of the resources. */ diff --git a/include/lib.h b/include/lib.h index 9a614820c0..31c685daaa 100644 --- a/include/lib.h +++ b/include/lib.h @@ -28,7 +28,13 @@ */ #define ARRAY_SIZE(a) (sizeof(a) / sizeof((a)[0])) -int log2(unsigned int n); +/* you have to explicity pick logc2 (ceiling) or log2f (floor) + * it is a no-op if you KNOW that your number is a power of 2. + * It is important to know what you are doing otherwise. + * example: log2c(72) is 7, log2f(72) is 6! + */ +int log2c(unsigned int n); +int log2f(unsigned int n); void udelay(unsigned int usecs); void mdelay(unsigned int msecs); diff --git a/include/spd_ddr2.h b/include/spd_ddr2.h index a1deb36c96..4e28bb57f5 100644 --- a/include/spd_ddr2.h +++ b/include/spd_ddr2.h @@ -86,3 +86,6 @@ #define SPD_TRFC 42 /* add byte 0x40 bit [6:4] , so final val42+ table[((val40>>4) & 0x7)] + (val40 & 1)*256*/ #define SPD_TREF 12 + +/* prototypes for dealing with spd */ +u8 spd_read_byte(u16 device, u8 address);