This patch removes all printk format warnings from my LBv3 build (Qemu
x86 config). This was tested with gcc 4.1.0 on x86.
However, the code at various locations is not 64bit clean at all and
will probably break down once we have more than 4GB of RAM. My patch
doesn't change that, it is merely intended to fix the warnings for
improper printk usage.
Beware: Before the patch is committed, a diff of the output of a LB boot
(before and after the patch) needs to be verified. Each change of output
should look reasonable, if not, please holler so I can fix the code.
Signed-off-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006(a)gmx.net>
Index: LinuxBIOSv3/superio/winbond/w83627hf/superio.c
===================================================================
--- LinuxBIOSv3/superio/winbond/w83627hf/superio.c (Revision 464)
+++ LinuxBIOSv3/superio/winbond/w83627hf/superio.c (Arbeitskopie)
@@ -107,7 +107,7 @@
value &= 0xff & hwm_reg_values[i+1];
value |= 0xff & hwm_reg_values[i+2];
- printk(BIOS_SPEW, "base = 0x%04x, reg = 0x%02x, value = 0x%02x\r\n", base, reg,value);
+ printk(BIOS_SPEW, "base = 0x%04lx, reg = 0x%02x, value = 0x%02x\r\n", base, reg,value);
pnp_write_index(base, reg, value);
}
Index: LinuxBIOSv3/device/device.c
===================================================================
--- LinuxBIOSv3/device/device.c (Revision 464)
+++ LinuxBIOSv3/device/device.c (Arbeitskopie)
@@ -130,10 +130,10 @@
int i;
printk(BIOS_SPEW, "%s: find %s\n", __func__, dev_id_string(id));
for (i = 0; all_constructors[i]; i++) {
- printk(BIOS_SPEW, "%s: check all_constructors[i] 0x%lx\n",
+ printk(BIOS_SPEW, "%s: check all_constructors[i] %p\n",
__func__, all_constructors[i]);
for (c = all_constructors[i]; c->ops; c++) {
- printk(BIOS_SPEW, "%s: cons 0x%lx, cons id %s\n",
+ printk(BIOS_SPEW, "%s: cons %p, cons id %s\n",
__func__, c, dev_id_string(&c->id));
if ((!c->ops) || (!c->ops->constructor)) {
continue;
@@ -164,7 +164,7 @@
struct constructor *c;
c = find_constructor(id);
- printk(BIOS_SPEW, "%s: constructor is 0x%lx\n", __func__, c);
+ printk(BIOS_SPEW, "%s: constructor is %p\n", __func__, c);
if(c && c->ops && c->ops->constructor)
c->ops->constructor(dev, c);
@@ -485,7 +485,7 @@
base += size;
printk(BIOS_SPEW,
- "%s %02x * [0x%08Lx - 0x%08Lx] %s\n",
+ "%s %02lx * [0x%08Lx - 0x%08Lx] %s\n",
dev_path(dev),
resource->index,
resource->base,
Index: LinuxBIOSv3/device/pnp_device.c
===================================================================
--- LinuxBIOSv3/device/pnp_device.c (Revision 464)
+++ LinuxBIOSv3/device/pnp_device.c (Arbeitskopie)
@@ -87,7 +87,7 @@
{
if (!(resource->flags & IORESOURCE_ASSIGNED)) {
printk(BIOS_ERR,
- "ERROR: %s %02x %s size: 0x%010Lx not assigned\n",
+ "ERROR: %s %02lx %s size: 0x%010Lx not assigned\n",
dev_path(dev), resource->index, resource_type(resource),
resource->size);
return;
@@ -101,7 +101,7 @@
} else if (resource->flags & IORESOURCE_IRQ) {
pnp_set_irq(dev, resource->index, resource->base);
} else {
- printk(BIOS_ERR, "ERROR: %s %02x unknown resource type\n",
+ printk(BIOS_ERR, "ERROR: %s %02lx unknown resource type\n",
dev_path(dev), resource->index);
return;
}
Index: LinuxBIOSv3/device/pci_rom.c
===================================================================
--- LinuxBIOSv3/device/pci_rom.c (Revision 464)
+++ LinuxBIOSv3/device/pci_rom.c (Arbeitskopie)
@@ -47,7 +47,7 @@
return NULL;
}
- printk(BIOS_DEBUG, "ROM address for %s = %x\n", dev_path(dev),
+ printk(BIOS_DEBUG, "ROM address for %s = %lx\n", dev_path(dev),
rom_address);
if (!dev->on_mainboard) {
@@ -131,7 +131,7 @@
return NULL; // Only one VGA supported.
#endif
printk(BIOS_DEBUG,
- "Copying VGA ROM image from 0x%x to 0x%x, 0x%x bytes\n",
+ "Copying VGA ROM image from %p to 0x%x, 0x%x bytes\n",
rom_header, PCI_VGA_RAM_IMAGE_START, rom_size);
memcpy((void *)PCI_VGA_RAM_IMAGE_START, rom_header, rom_size);
vga_inited = 1;
@@ -139,7 +139,7 @@
#endif
} else {
printk(BIOS_DEBUG,
- "Copying non-VGA ROM image from 0x%x to 0x%x, 0x%x bytes\n",
+ "Copying non-VGA ROM image from %p to %p, 0x%x bytes\n",
rom_header, pci_ram_image_start, rom_size);
memcpy(pci_ram_image_start, rom_header, rom_size);
pci_ram_image_start += rom_size;
Index: LinuxBIOSv3/device/pci_device.c
===================================================================
--- LinuxBIOSv3/device/pci_device.c (Revision 464)
+++ LinuxBIOSv3/device/pci_device.c (Arbeitskopie)
@@ -210,7 +210,7 @@
if (moving == 0) {
if (value != 0) {
printk(BIOS_DEBUG,
- "%s register %02x(%08x), read-only ignoring it\n",
+ "%s register %02lx(%08lx), read-only ignoring it\n",
dev_path(dev), index, value);
}
resource->flags = 0;
@@ -309,7 +309,7 @@
if (moving == 0) {
if (value != 0) {
printk(BIOS_DEBUG,
- "%s register %02x(%08x), read-only ignoring it\n",
+ "%s register %02lx(%08lx), read-only ignoring it\n",
dev_path(dev), index, value);
}
resource->flags = 0;
@@ -456,7 +456,7 @@
/* Make certain the resource has actually been set. */
if (!(resource->flags & IORESOURCE_ASSIGNED)) {
printk(BIOS_ERR,
- "ERROR: %s %02x %s size: 0x%010Lx not assigned\n",
+ "ERROR: %s %02lx %s size: 0x%010Lx not assigned\n",
dev_path(dev), resource->index, resource_type(resource),
resource->size);
return;
@@ -537,7 +537,7 @@
} else {
/* Don't let me think I stored the resource. */
resource->flags &= ~IORESOURCE_STORED;
- printk(BIOS_ERR, "ERROR: invalid resource->index %x\n",
+ printk(BIOS_ERR, "ERROR: invalid resource->index %lx\n",
resource->index);
}
report_resource_stored(dev, resource, "");
Index: LinuxBIOSv3/device/device_util.c
===================================================================
--- LinuxBIOSv3/device/device_util.c (Revision 464)
+++ LinuxBIOSv3/device/device_util.c (Arbeitskopie)
@@ -602,7 +602,7 @@
#endif
}
printk(BIOS_DEBUG,
- "%s %02x <- [0x%010Lx - 0x%010Lx] %s%s%s\n",
+ "%s %02lx <- [0x%010Lx - 0x%010Lx] %s%s%s\n",
dev_path(dev),
resource->index,
base, end, buf, resource_type(resource), comment);
@@ -643,7 +643,7 @@
resource_search_t search, void *gp)
{
struct device *curdev;
- printk(BIOS_SPEW, "%s: mask %x type %x \n", __func__, type_mask, type);
+ printk(BIOS_SPEW, "%s: mask %lx type %lx \n", __func__, type_mask, type);
for (curdev = all_devices; curdev; curdev = curdev->next) {
int i;
printk(BIOS_SPEW,
@@ -656,9 +656,9 @@
for (i = 0; i < curdev->resources; i++) {
struct resource *resource = &curdev->resource[i];
printk(BIOS_SPEW,
- "%s: dev %s, resource %d, flags %x base 0x%lx size 0x%lx\n",
+ "%s: dev %s, resource %d, flags %lx base 0x%llx size 0x%llx\n",
__func__, curdev->dtsname, i, resource->flags,
- (u32) resource->base, (u32) resource->size);
+ resource->base, resource->size);
/* If it isn't the right kind of resource ignore it. */
if ((resource->flags & type_mask) != type) {
continue;
Index: LinuxBIOSv3/lib/elfboot.c
===================================================================
--- LinuxBIOSv3/lib/elfboot.c (Revision 464)
+++ LinuxBIOSv3/lib/elfboot.c (Arbeitskopie)
@@ -69,9 +69,9 @@
mtype = mem->map[i].type;
mstart = unpack_lb64(mem->map[i].start);
mend = mstart + unpack_lb64(mem->map[i].size);
- printk(BIOS_ERR, " [0x%016lx, 0x%016lx) %s\n",
- (unsigned long)mstart,
- (unsigned long)mend,
+ printk(BIOS_ERR, " [0x%016llx, 0x%016llx) %s\n",
+ mstart,
+ mend,
(mtype == LB_MEM_RAM)?"RAM":"Reserved");
}
@@ -101,14 +101,14 @@
printk(BIOS_DEBUG, "Dropping empty segment\n");
continue;
}
- printk(BIOS_DEBUG, "New segment addr 0x%lx size 0x%lx offset 0x%lx filesize 0x%lx\n",
+ printk(BIOS_DEBUG, "New segment addr 0x%x size 0x%x offset 0x%x filesize 0x%x\n",
phdr[i].p_paddr, phdr[i].p_memsz, phdr[i].p_offset, phdr[i].p_filesz);
/* Clean up the values */
size = phdr[i].p_filesz;
if (phdr[i].p_filesz > phdr[i].p_memsz) {
size = phdr[i].p_memsz;
}
- printk(BIOS_DEBUG, "(cleaned up) New segment addr 0x%lx size 0x%lx offset 0x%lx\n",
+ printk(BIOS_DEBUG, "(cleaned up) New segment addr 0x%x size 0x%x offset 0x%x\n",
phdr[i].p_paddr, size, phdr[i].p_offset);
/* Verify the memory addresses in the segment are valid */
@@ -150,7 +150,7 @@
/* what the hell is boot_successful? */
//boot_successful();
- printk(BIOS_DEBUG, "Jumping to boot code at 0x%x\n", entry);
+ printk(BIOS_DEBUG, "Jumping to boot code at %p\n", entry);
post_code(0xfe);
/* Jump to kernel */
Index: LinuxBIOSv3/northbridge/intel/i440bxemulation/i440bx.c
===================================================================
--- LinuxBIOSv3/northbridge/intel/i440bxemulation/i440bx.c (Revision 464)
+++ LinuxBIOSv3/northbridge/intel/i440bxemulation/i440bx.c (Arbeitskopie)
@@ -79,7 +79,7 @@
resource->size = ((resource_t) sizek) << 10;
resource->flags = IORESOURCE_MEM | IORESOURCE_CACHEABLE |
IORESOURCE_FIXED | IORESOURCE_STORED | IORESOURCE_ASSIGNED;
- printk(BIOS_DEBUG, "%s: add ram resoource %d bytes\n", __func__,
+ printk(BIOS_DEBUG, "%s: add ram resoource %lld bytes\n", __func__,
resource->size);
}
Index: LinuxBIOSv3/util/x86emu/vm86.c
===================================================================
--- LinuxBIOSv3/util/x86emu/vm86.c (Revision 464)
+++ LinuxBIOSv3/util/x86emu/vm86.c (Arbeitskopie)
@@ -543,14 +543,14 @@
eax, ebx, ecx, edx);
printk(BIOS_DEBUG, "biosint: ebp 0x%lx esp 0x%lx edi 0x%lx esi 0x%lx\n",
ebp, esp, edi, esi);
- printk(BIOS_DEBUG, "biosint: ip 0x%x cs 0x%x flags 0x%x\n",
+ printk(BIOS_DEBUG, "biosint: ip 0x%lx cs 0x%lx flags 0x%lx\n",
ip, cs, flags);
// cases in a good compiler are just as good as your own tables.
switch (intnumber) {
case 0 ... 15:
// These are not BIOS service, but the CPU-generated exceptions
- printk(BIOS_INFO, "biosint: Oops, exception %u\n", intnumber);
+ printk(BIOS_INFO, "biosint: Oops, exception %lu\n", intnumber);
if (esp < 0x1000) {
printk(BIOS_DEBUG, "Stack contents: ");
while (esp < 0x1000) {
@@ -578,7 +578,7 @@
&ebx, &edx, &ecx, &eax, &flags);
break;
default:
- printk(BIOS_INFO, "BIOSINT: Unsupport int #0x%x\n",
+ printk(BIOS_INFO, "BIOSINT: Unsupport int #0x%lx\n",
intnumber);
break;
}
Index: LinuxBIOSv3/arch/x86/linuxbios_table.c
===================================================================
--- LinuxBIOSv3/arch/x86/linuxbios_table.c (Revision 464)
+++ LinuxBIOSv3/arch/x86/linuxbios_table.c (Arbeitskopie)
@@ -177,8 +177,8 @@
{
int entries;
- printk(BIOS_DEBUG, "%s: start 0x%lx size 0x%lx\n",
- __func__, (u32)start, (u32)size);
+ printk(BIOS_DEBUG, "%s: start 0x%llx size 0x%llx\n",
+ __func__, start, size);
entries = (mem->size - sizeof(*mem))/sizeof(mem->map[0]);
mem->map[entries].start = pack_lb64(start);
@@ -231,7 +231,7 @@
head->table_checksum = compute_ip_checksum(first_rec, head->table_bytes);
head->header_checksum = 0;
head->header_checksum = compute_ip_checksum(head, sizeof(*head));
- printk(BIOS_DEBUG,"Wrote LinuxBIOS table at: %p - %p checksum %lx\n",
+ printk(BIOS_DEBUG,"Wrote LinuxBIOS table at: %p - %p checksum %x\n",
head, rec, head->table_checksum);
return (unsigned long)rec;
}
@@ -244,7 +244,7 @@
printk(BIOS_DEBUG, "%s: # entries %d\n", __func__, entries);
for(i = 0; i < entries; i++)
printk(BIOS_INFO, " #%d: base 0x%x size 0x%x\n",
- i, (u32)mem->map[i].start.lo, mem->map[i].size.lo);
+ i, mem->map[i].start.lo, mem->map[i].size.lo);
/* Sort the lb memory ranges */
for(i = 0; i < entries; i++) {