Remove some warnings, mainly from format strings which didn't match the
arguments.

Signed-off-by: Myles Watson <mylesgw@gmail.com>
Acked-by: Peter Stuge <peter@stuge.se>


git-svn-id: svn://svn.coreboot.org/coreboot/trunk@3931 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1
diff --git a/src/arch/i386/boot/coreboot_table.c b/src/arch/i386/boot/coreboot_table.c
index e74e3e9..55a1697 100644
--- a/src/arch/i386/boot/coreboot_table.c
+++ b/src/arch/i386/boot/coreboot_table.c
@@ -251,7 +251,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_debug("Wrote coreboot table at: %p - %p  checksum %lx\n",
+	printk_debug("Wrote coreboot table at: %p - %p  checksum %x\n",
 		head, rec, head->table_checksum);
 	return (unsigned long)rec;
 }
@@ -415,16 +415,16 @@
 		low_table_end = (unsigned long)head;
 	}
  
-	printk_debug("Adjust low_table_end from 0x%08x to ", low_table_end);
+	printk_debug("Adjust low_table_end from 0x%08lx to ", low_table_end);
 	low_table_end += 0xfff; // 4K aligned
 	low_table_end &= ~0xfff;
-	printk_debug("0x%08x \n", low_table_end);
+	printk_debug("0x%08lx \n", low_table_end);
 
 	/* The Linux kernel assumes this region is reserved */
-	printk_debug("Adjust rom_table_end from 0x%08x to ", rom_table_end);
+	printk_debug("Adjust rom_table_end from 0x%08lx to ", rom_table_end);
 	rom_table_end += 0xffff; // 64K align
 	rom_table_end &= ~0xffff;
-	printk_debug("0x%08x \n", rom_table_end);
+	printk_debug("0x%08lx \n", rom_table_end);
 
 #if (HAVE_OPTION_TABLE == 1) 
 	{
diff --git a/src/arch/i386/boot/pirq_routing.c b/src/arch/i386/boot/pirq_routing.c
index ca90a14..6b4e75f 100644
--- a/src/arch/i386/boot/pirq_routing.c
+++ b/src/arch/i386/boot/pirq_routing.c
@@ -91,7 +91,7 @@
 	addr &= ~15;
 
 	/* This table must be betweeen 0xf0000 & 0x100000 */
-	printk_info("Copying Interrupt Routing Table to 0x%08x... ", addr);
+	printk_info("Copying Interrupt Routing Table to 0x%08lx... ", addr);
 	memcpy((void *)addr, &intel_irq_routing_table, intel_irq_routing_table.size);
 	printk_info("done.\n");
 	verify_copy_pirq_routing_table(addr);
diff --git a/src/arch/i386/boot/tables.c b/src/arch/i386/boot/tables.c
index 5201010..efe6dee 100644
--- a/src/arch/i386/boot/tables.c
+++ b/src/arch/i386/boot/tables.c
@@ -92,7 +92,7 @@
 			mpc_start &= ~1023;
 			rom_table_start = mpc_start;
 		}
-		printk_debug("move mptable from 0x%0x to 0x%0x, size 0x%0x\n", low_table_end, mpc_start, mptable_size);
+		printk_debug("move mptable from 0x%0lx to 0x%0x, size 0x%0x\n", low_table_end, mpc_start, mptable_size);
 		memcpy((unsigned char *)mpc_start, (unsigned char *)low_table_end, mptable_size);
 		smp_write_floating_table_physaddr(low_table_end - SMP_FLOATING_TABLE_LEN, mpc_start);
 		memset((unsigned char *)low_table_end, '\0', mptable_size);
diff --git a/src/arch/i386/lib/cpu.c b/src/arch/i386/lib/cpu.c
index 3f7361f..f461bbe 100644
--- a/src/arch/i386/lib/cpu.c
+++ b/src/arch/i386/lib/cpu.c
@@ -225,7 +225,7 @@
 	
 	info = cpu_info();
 
-	printk_notice("Initializing CPU #%d\n", info->index);
+	printk_notice("Initializing CPU #%ld\n", info->index);
 
 	cpu = info->cpu;
 	if (!cpu) {
@@ -261,7 +261,7 @@
 		cpu->ops->init(cpu);
 	}
 
-	printk_info("CPU #%d initialized\n", info->index);
+	printk_info("CPU #%ld initialized\n", info->index);
 
 	return;
 }
diff --git a/src/arch/i386/lib/exception.c b/src/arch/i386/lib/exception.c
index 2d68b91..a330652 100644
--- a/src/arch/i386/lib/exception.c
+++ b/src/arch/i386/lib/exception.c
@@ -481,10 +481,10 @@
 	}
 #else /* !CONFIG_GDB_STUB */
 	printk_emerg(
-		"Unexpected Exception: %d @ %02x:%08lx - Halting\n"
-		"Code: %d eflags: %08lx\n"
-		"eax: %08lx ebx: %08lx ecx: %08lx edx: %08lx\n"
-		"edi: %08lx esi: %08lx ebp: %08lx esp: %08lx\n",
+		"Unexpected Exception: %d @ %02x:%08x - Halting\n"
+		"Code: %d eflags: %08x\n"
+		"eax: %08x ebx: %08x ecx: %08x edx: %08x\n"
+		"edi: %08x esi: %08x ebp: %08x esp: %08x\n",
 		info->vector, info->cs, info->eip,
 		info->error_code, info->eflags,
 		info->eax, info->ebx, info->ecx, info->edx,
diff --git a/src/arch/i386/smp/mpspec.c b/src/arch/i386/smp/mpspec.c
index c22a3ec..ce76fb8 100644
--- a/src/arch/i386/smp/mpspec.c
+++ b/src/arch/i386/smp/mpspec.c
@@ -236,7 +236,7 @@
 
 			if ((child->class >> 16) != PCI_BASE_CLASS_BRIDGE) {
 				/* pci device */
-				printk_debug("route irq: %s %04x\n", dev_path(child));
+				printk_debug("route irq: %s\n", dev_path(child));
 				for (i = 0; i < 4; i++)
 					smp_write_intsrc(mc, irqtype, irqflag, srcbus, (slot<<2)|i, dstapic, dstirq_x[i]);
 				goto next;
@@ -246,7 +246,7 @@
 			case PCI_CLASS_BRIDGE_PCI:
 			case PCI_CLASS_BRIDGE_PCMCIA:
 			case PCI_CLASS_BRIDGE_CARDBUS:
-				printk_debug("route irq bridge: %s %04x\n", dev_path(child));
+				printk_debug("route irq bridge: %s\n", dev_path(child));
 				smp_write_intsrc_pci_bridge(mc, irqtype, irqflag, child, dstapic, dstirq_x);
 			}
 
diff --git a/src/boot/elfboot.c b/src/boot/elfboot.c
index 71ecddf..7caa467 100644
--- a/src/boot/elfboot.c
+++ b/src/boot/elfboot.c
@@ -76,7 +76,7 @@
 		memcpy(n_desc, buff, 2);
 	}
 	if (checksum != cb->ip_checksum) {
-		printk_err("Image checksum: %04x != computed checksum: %04x\n",
+		printk_err("Image checksum: %04x != computed checksum: %04lx\n",
 			cb->ip_checksum, checksum);
 	}
 	return checksum == cb->ip_checksum;
@@ -500,7 +500,7 @@
 		/* Zero the extra bytes between middle & end */
 		if (middle < end) {
 			printk_debug("Clearing Segment: addr: 0x%016lx memsz: 0x%016lx\n",
-				(unsigned long)middle, end - middle);
+				(unsigned long)middle, (unsigned long)(end - middle));
 			
 			/* Zero the extra bytes */
 			memset(middle, 0, end - middle);
@@ -590,7 +590,7 @@
 	/* Reset to booting from this image as late as possible */
 	boot_successful();
 
-	printk_debug("Jumping to boot code at 0x%x\n", entry);
+	printk_debug("Jumping to boot code at 0x%p\n", entry);
 	post_code(0xfe);
 
 	/* Jump to kernel */
diff --git a/src/cpu/amd/model_fxx/model_fxx_init.c b/src/cpu/amd/model_fxx/model_fxx_init.c
index 7c13d7f..3bccfe0 100644
--- a/src/cpu/amd/model_fxx/model_fxx_init.c
+++ b/src/cpu/amd/model_fxx/model_fxx_init.c
@@ -231,7 +231,7 @@
                 size = (limitk - basek) << 10;
                 addr = map_2M_page(basek >> 11);
                 if (addr == MAPPING_ERROR) {
-                        printk_err("Cannot map page: %x\n", basek >> 11);
+                        printk_err("Cannot map page: %lx\n", basek >> 11);
                         return;
                 }
 
@@ -312,7 +312,7 @@
 		begink = CONFIG_LB_MEM_TOPK;
 	}
 
-	printk_debug("Clearing memory %uK - %uK: ", begink, endk);
+	printk_debug("Clearing memory %luK - %luK: ", begink, endk);
 
 	/* Save the normal state */
 	save_mtrr_state(&mtrr_state);
@@ -465,7 +465,9 @@
 extern void model_fxx_update_microcode(unsigned cpu_deviceid);
 int init_processor_name(void);
 
+#if CONFIG_USBDEBUG_DIRECT
 static unsigned ehci_debug_addr;
+#endif
 
 void model_fxx_init(device_t dev)
 {
diff --git a/src/cpu/x86/lapic/lapic.c b/src/cpu/x86/lapic/lapic.c
index 8c111e8..fc736c9 100644
--- a/src/cpu/x86/lapic/lapic.c
+++ b/src/cpu/x86/lapic/lapic.c
@@ -55,7 +55,7 @@
 			LAPIC_DELIVERY_MODE_NMI)
 		);
 
-	printk_debug(" apic_id: 0x%02x ", lapicid());
+	printk_debug(" apic_id: 0x%02lx ", lapicid());
 
 #else /* !NEED_LLAPIC */
 	/* Only Pentium Pro and later have those MSR stuff */
diff --git a/src/cpu/x86/lapic/lapic_cpu_init.c b/src/cpu/x86/lapic/lapic_cpu_init.c
index 0fd31d0..4a879c5 100644
--- a/src/cpu/x86/lapic/lapic_cpu_init.c
+++ b/src/cpu/x86/lapic/lapic_cpu_init.c
@@ -85,14 +85,14 @@
 		send_status = lapic_read(LAPIC_ICR) & LAPIC_ICR_BUSY;
 	} while (send_status && (timeout++ < 1000));
 	if (timeout >= 1000) {
-		printk_err("CPU %d: First apic write timed out. Disabling\n",
+		printk_err("CPU %ld: First apic write timed out. Disabling\n",
 			 apicid);
 		// too bad. 
-		printk_err("ESR is 0x%x\n", lapic_read(LAPIC_ESR));
+		printk_err("ESR is 0x%lx\n", lapic_read(LAPIC_ESR));
 		if (lapic_read(LAPIC_ESR)) {
 			printk_err("Try to reset ESR\n");
 			lapic_write_around(LAPIC_ESR, 0);
-			printk_err("ESR is 0x%x\n", lapic_read(LAPIC_ESR));
+			printk_err("ESR is 0x%lx\n", lapic_read(LAPIC_ESR));
 		}
 		return 0;
 	}
@@ -114,7 +114,7 @@
 		send_status = lapic_read(LAPIC_ICR) & LAPIC_ICR_BUSY;
 	} while (send_status && (timeout++ < 1000));
 	if (timeout >= 1000) {
-		printk_err("CPU %d: Second apic write timed out. Disabling\n",
+		printk_err("CPU %ld: Second apic write timed out. Disabling\n",
 			 apicid);
 		// too bad. 
 		return 0;
@@ -345,8 +345,6 @@
 /* C entry point of secondary cpus */
 void secondary_cpu_init(void)
 {
-	unsigned long cpunum;
-
 	atomic_inc(&active_cpus);
 #if SERIAL_CPU_INIT == 1
   #if CONFIG_MAX_CPUS>2
diff --git a/src/cpu/x86/mtrr/mtrr.c b/src/cpu/x86/mtrr/mtrr.c
index 71bbee8..840f9d3 100644
--- a/src/cpu/x86/mtrr/mtrr.c
+++ b/src/cpu/x86/mtrr/mtrr.c
@@ -241,7 +241,7 @@
 			align = max_align;
 		}
 		sizek = 1 << align;
-		printk_debug("Setting variable MTRR %d, base: %4dMB, range: %4dMB, type %s\n",
+		printk_debug("Setting variable MTRR %d, base: %4ldMB, range: %4ldMB, type %s\n",
 			reg, range_startk >>10, sizek >> 10,
 			(type==MTRR_TYPE_UNCACHEABLE)?"UC":
 			    ((type==MTRR_TYPE_WRBACK)?"WB":"Other")
diff --git a/src/devices/device_util.c b/src/devices/device_util.c
index 5a1b8b5..c183850 100644
--- a/src/devices/device_util.c
+++ b/src/devices/device_util.c
@@ -467,7 +467,7 @@
 #endif
 		}
 		printk_debug(
-			"%s %02x <- [0x%010Lx - 0x%010Lx] size 0x%08Lx gran 0x%02x %s%s%s\n",
+			"%s %02lx <- [0x%010Lx - 0x%010Lx] size 0x%08Lx gran 0x%02x %s%s%s\n",
 			dev_path(dev),
 			resource->index,
 			base, end,
diff --git a/src/devices/pci_device.c b/src/devices/pci_device.c
index fcf9730..396d4f3 100644
--- a/src/devices/pci_device.c
+++ b/src/devices/pci_device.c
@@ -207,7 +207,7 @@
 	if (moving == 0) {
 		if (value != 0) {
 			printk_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;
@@ -311,7 +311,7 @@
 
 	if (moving == 0) {
 		if (value != 0) {
-			printk_debug("%s register %02x(%08x), read-only ignoring it\n",
+			printk_debug("%s register %02lx(%08lx), read-only ignoring it\n",
 				     dev_path(dev), index, value);
 		}
 		resource->flags = 0;
@@ -459,7 +459,7 @@
 
 	/* Make certain the resource has actually been set */
 	if (!(resource->flags & IORESOURCE_ASSIGNED)) {
-		printk_err("ERROR: %s %02x %s size: 0x%010Lx not assigned\n",
+		printk_err("ERROR: %s %02lx %s size: 0x%010Lx not assigned\n",
 			dev_path(dev), resource->index,
 			resource_type(resource),
 			resource->size);
@@ -546,7 +546,7 @@
 	else {
 		/* Don't let me think I stored the resource */
 		resource->flags &= ~IORESOURCE_STORED;
-		printk_err("ERROR: invalid resource->index %x\n",
+		printk_err("ERROR: invalid resource->index %lx\n",
 			resource->index);
 	}
 	report_resource_stored(dev, resource, "");
diff --git a/src/devices/pci_rom.c b/src/devices/pci_rom.c
index 1b7e4bf..1d1024c 100644
--- a/src/devices/pci_rom.c
+++ b/src/devices/pci_rom.c
@@ -45,7 +45,7 @@
 		return NULL;
 	}
 
-	printk_debug("rom address for %s = %x\n", dev_path(dev), rom_address);
+	printk_debug("rom address for %s = %lx\n", dev_path(dev), rom_address);
 	
 	if(!dev->on_mainboard) {
 		/* enable expansion ROM address decoding */
@@ -110,12 +110,12 @@
 		extern device_t vga_pri;	// the primary vga device, defined in device.c
 		if (dev != vga_pri) return NULL; // only one VGA supported
 #endif
-		printk_debug("copying VGA ROM Image from 0x%x to 0x%x, 0x%x bytes\n",
+		printk_debug("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);
 		return (struct rom_header *) (PCI_VGA_RAM_IMAGE_START);
 	} else {
-		printk_debug("copying non-VGA ROM Image from 0x%x to 0x%x, 0x%x bytes\n",
+		printk_debug("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;
diff --git a/src/devices/pnp_device.c b/src/devices/pnp_device.c
index 5740a80..8b5acec 100644
--- a/src/devices/pnp_device.c
+++ b/src/devices/pnp_device.c
@@ -103,7 +103,7 @@
 static void pnp_set_resource(device_t dev, struct resource *resource)
 {
 	if (!(resource->flags & IORESOURCE_ASSIGNED)) {
-		printk_err("ERROR: %s %02x %s size: 0x%010Lx not assigned\n",
+		printk_err("ERROR: %s %02lx %s size: 0x%010Lx not assigned\n",
 			dev_path(dev), resource->index,
 			resource_type(resource),
 			resource->size);
@@ -121,7 +121,7 @@
 		pnp_set_irq(dev, resource->index, resource->base);
 	}
 	else {
-		printk_err("ERROR: %s %02x unknown resource type\n",
+		printk_err("ERROR: %s %02lx unknown resource type\n",
 			dev_path(dev), resource->index);
 		return;
 	}
diff --git a/src/mainboard/tyan/s2895/irq_tables.c b/src/mainboard/tyan/s2895/irq_tables.c
index cc18119..efde485 100644
--- a/src/mainboard/tyan/s2895/irq_tables.c
+++ b/src/mainboard/tyan/s2895/irq_tables.c
@@ -72,7 +72,7 @@
 	addr &= ~15;
 
 	/* This table must be betweeen 0xf0000 & 0x100000 */
-	printk_info("Writing IRQ routing tables to 0x%x...", addr);
+	printk_info("Writing IRQ routing tables to 0x%lx...", addr);
 
 	pirq = (void *)(addr);
 	v = (uint8_t *)(addr);
diff --git a/src/southbridge/nvidia/ck804/ck804_lpc.c b/src/southbridge/nvidia/ck804/ck804_lpc.c
index 577d9f7..89b6f8c 100644
--- a/src/southbridge/nvidia/ck804/ck804_lpc.c
+++ b/src/southbridge/nvidia/ck804/ck804_lpc.c
@@ -314,7 +314,7 @@
 						continue;
 					base = res->base;
 					end = resource_end(res);
-					printk_debug("ck804 lpc decode:%s, base=0x%08x, end=0x%08x\r\n", dev_path(child), base, end);
+					printk_debug("ck804 lpc decode:%s, base=0x%08lx, end=0x%08lx\r\n", dev_path(child), base, end);
 					switch (base) {
 					case 0x3f8:	// COM1
 						reg |= (1 << 0);
diff --git a/src/southbridge/nvidia/ck804/ck804_sata.c b/src/southbridge/nvidia/ck804/ck804_sata.c
index 9dabd66..7bbf900 100644
--- a/src/southbridge/nvidia/ck804/ck804_sata.c
+++ b/src/southbridge/nvidia/ck804/ck804_sata.c
@@ -11,6 +11,7 @@
 #include <device/pci_ops.h>
 #include "ck804.h"
 
+#if CK804_SATA_RESET_FOR_ATAPI
 static void sata_com_reset(struct device *dev, unsigned reset)
 // reset = 1 : reset
 // reset = 0 : clear
@@ -21,7 +22,7 @@
 
 	base = (uint32_t *) pci_read_config32(dev, 0x24);
 
-	printk_debug("base = %08x\r\n", base);
+	printk_debug("base = %08lx\n", base);
 
 	if (reset) {
 		*(base + 4) = 0xffffffff;
@@ -71,6 +72,7 @@
 		printk_debug("loop=%d, *(base+0x44)=%08x\r\n", loop, dword);
 	}
 }
+#endif
 
 static void sata_init(struct device *dev)
 {
@@ -132,7 +134,7 @@
 	dword |= 2;
 	pci_write_config32(dev, 0xf8, dword);
 
-#if 0
+#if CK804_SATA_RESET_FOR_ATAPI
 	dword = pci_read_config32(dev, 0xac);
 	dword &= ~((1 << 13) | (1 << 14));
 	dword |= (1 << 13) | (0 << 14);