Module Name:    src
Committed By:   matt
Date:           Wed Dec 16 08:26:14 UTC 2009

Modified Files:
        src/sys/arch/evbmips/alchemy: machdep.c obio.c
        src/sys/arch/mips/alchemy: au_himem_space.c aubus.c

Log Message:
Fix printf format problems and latent bugs made visible by new bus_*_t types.


To generate a diff of this commit:
cvs rdiff -u -r1.45 -r1.46 src/sys/arch/evbmips/alchemy/machdep.c
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/evbmips/alchemy/obio.c
cvs rdiff -u -r1.9 -r1.10 src/sys/arch/mips/alchemy/au_himem_space.c
cvs rdiff -u -r1.19 -r1.20 src/sys/arch/mips/alchemy/aubus.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/evbmips/alchemy/machdep.c
diff -u src/sys/arch/evbmips/alchemy/machdep.c:1.45 src/sys/arch/evbmips/alchemy/machdep.c:1.46
--- src/sys/arch/evbmips/alchemy/machdep.c:1.45	Mon Dec 14 00:46:01 2009
+++ src/sys/arch/evbmips/alchemy/machdep.c	Wed Dec 16 08:26:14 2009
@@ -1,4 +1,4 @@
-/* $NetBSD: machdep.c,v 1.45 2009/12/14 00:46:01 matt Exp $ */
+/* $NetBSD: machdep.c,v 1.46 2009/12/16 08:26:14 matt Exp $ */
 
 /*-
  * Copyright (c) 2006 Itronix Inc.
@@ -107,7 +107,7 @@
  */
 
 #include <sys/cdefs.h>			/* RCS ID & Copyright macro defns */
-__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.45 2009/12/14 00:46:01 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.46 2009/12/16 08:26:14 matt Exp $");
 
 #include "opt_ddb.h"
 #include "opt_kgdb.h"
@@ -186,8 +186,6 @@
 	void *kernend;
 	const char *cp;
 	u_long first, last;
-	struct pcb *pcb0;
-	vaddr_t v;
 	int freqok, howto, i;
 	const struct alchemy_board *board;
 

Index: src/sys/arch/evbmips/alchemy/obio.c
diff -u src/sys/arch/evbmips/alchemy/obio.c:1.1 src/sys/arch/evbmips/alchemy/obio.c:1.2
--- src/sys/arch/evbmips/alchemy/obio.c:1.1	Wed Feb  8 09:04:01 2006
+++ src/sys/arch/evbmips/alchemy/obio.c	Wed Dec 16 08:26:14 2009
@@ -1,4 +1,4 @@
-/* $NetBSD: obio.c,v 1.1 2006/02/08 09:04:01 gdamore Exp $ */
+/* $NetBSD: obio.c,v 1.2 2009/12/16 08:26:14 matt Exp $ */
 
 /*
  * Copyright 2002 Wasabi Systems, Inc.
@@ -36,7 +36,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: obio.c,v 1.1 2006/02/08 09:04:01 gdamore Exp $");
+__KERNEL_RCSID(0, "$NetBSD: obio.c,v 1.2 2009/12/16 08:26:14 matt Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -115,7 +115,7 @@
 	if (pnp)
 		aprint_normal("%s at %s", oa->oba_name, pnp);
 	if (oa->oba_addr != OBIOCF_ADDR_DEFAULT)
-		aprint_normal(" addr 0x%lx", oa->oba_addr);
+		aprint_normal(" addr 0x%" PRIxBUSADDR, oa->oba_addr);
 
 	return (UNCONF);
 }

Index: src/sys/arch/mips/alchemy/au_himem_space.c
diff -u src/sys/arch/mips/alchemy/au_himem_space.c:1.9 src/sys/arch/mips/alchemy/au_himem_space.c:1.10
--- src/sys/arch/mips/alchemy/au_himem_space.c:1.9	Sat Nov  7 07:27:45 2009
+++ src/sys/arch/mips/alchemy/au_himem_space.c	Wed Dec 16 08:26:14 2009
@@ -1,4 +1,4 @@
-/* $NetBSD: au_himem_space.c,v 1.9 2009/11/07 07:27:45 cegger Exp $ */
+/* $NetBSD: au_himem_space.c,v 1.10 2009/12/16 08:26:14 matt Exp $ */
 
 /*-
  * Copyright (c) 2006 Itronix Inc.
@@ -61,7 +61,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: au_himem_space.c,v 1.9 2009/11/07 07:27:45 cegger Exp $");
+__KERNEL_RCSID(0, "$NetBSD: au_himem_space.c,v 1.10 2009/12/16 08:26:14 matt Exp $");
 
 /*
  * This provides mappings for the upper I/O regions used on some
@@ -337,15 +337,17 @@
 {
 	au_himem_cookie_t	*c = (au_himem_cookie_t *)cookie;
 	int			err;
+	u_long			addr;
 
 	err = extent_alloc_subregion(c->c_extent, start, end, size,
-	    align, boundary, EX_FAST | EX_NOWAIT, addrp);
+	    align, boundary, EX_FAST | EX_NOWAIT, &addr);
 	if (err) {
 		return err;
 	}
-	err = au_himem_map(cookie, *addrp, size, flags, bshp, 0);
+	err = au_himem_map(cookie, addr, size, flags, bshp, 0);
 	if (err)
-		extent_free(c->c_extent, *addrp, size, EX_NOWAIT);
+		extent_free(c->c_extent, addr, size, EX_NOWAIT);
+	*addrp = addr;
 	return err;
 }
 
@@ -370,7 +372,7 @@
 au_himem_r_1(void *v, bus_space_handle_t h, bus_size_t o)
 {
 	wbflush();
-	return (*(volatile uint8_t *)(h + o));
+	return (*(volatile uint8_t *)(intptr_t)(h + o));
 }
 
 inline uint16_t
@@ -380,7 +382,7 @@
 	au_himem_cookie_t	*c = (au_himem_cookie_t *)v;
 
 	wbflush();
-	val = (*(volatile uint16_t *)(h + o));
+	val = (*(volatile uint16_t *)(intptr_t)(h + o));
 	return (c->c_swswap ? bswap16(val) : val);
 }
 
@@ -391,7 +393,7 @@
 	au_himem_cookie_t	*c = (au_himem_cookie_t *)v;
 
 	wbflush();
-	val = (*(volatile uint32_t *)(h + o));
+	val = (*(volatile uint32_t *)(intptr_t)(h + o));
 	return (c->c_swswap ? bswap32(val) : val);
 }
 
@@ -402,7 +404,7 @@
 	au_himem_cookie_t	*c = (au_himem_cookie_t *)v;
 
 	wbflush();
-	val = (*(volatile uint64_t *)(h + o));
+	val = (*(volatile uint64_t *)(intptr_t)(h + o));
 	return (c->c_swswap ? bswap64(val) : val);
 }
 
@@ -410,7 +412,7 @@
 au_himem_w_1(void *v, bus_space_handle_t h, bus_size_t o, uint8_t val)
 {
 
-	*(volatile uint8_t *)(h + o) = val;
+	*(volatile uint8_t *)(intptr_t)(h + o) = val;
 	wbflush();
 }
 
@@ -419,7 +421,7 @@
 {
 	au_himem_cookie_t	*c = (au_himem_cookie_t *)v;
 
-	*(volatile uint16_t *)(h + o) = c->c_swswap ? bswap16(val) : val;
+	*(volatile uint16_t *)(intptr_t)(h + o) = c->c_swswap ? bswap16(val) : val;
 	wbflush();
 }
 
@@ -428,7 +430,7 @@
 {
 	au_himem_cookie_t	*c = (au_himem_cookie_t *)v;
 
-	*(volatile uint32_t *)(h + o) = c->c_swswap ? bswap32(val) : val;
+	*(volatile uint32_t *)(intptr_t)(h + o) = c->c_swswap ? bswap32(val) : val;
 	wbflush();
 }
 
@@ -437,7 +439,7 @@
 {
 	au_himem_cookie_t	*c = (au_himem_cookie_t *)v;
 
-	*(volatile uint64_t *)(h + o) = c->c_swswap ? bswap64(val) : val;
+	*(volatile uint64_t *)(intptr_t)(h + o) = c->c_swswap ? bswap64(val) : val;
 	wbflush();
 }
 
@@ -448,7 +450,7 @@
 	au_himem_cookie_t	*c = (au_himem_cookie_t *)v;
 
 	wbflush();
-	val = (*(volatile uint16_t *)(h + o));
+	val = (*(volatile uint16_t *)(intptr_t)(h + o));
 	return (c->c_hwswap ? bswap16(val) : val);
 }
 
@@ -459,7 +461,7 @@
 	au_himem_cookie_t	*c = (au_himem_cookie_t *)v;
 
 	wbflush();
-	val = (*(volatile uint32_t *)(h + o));
+	val = (*(volatile uint32_t *)(intptr_t)(h + o));
 	return (c->c_hwswap ? bswap32(val) : val);
 }
 
@@ -470,7 +472,7 @@
 	au_himem_cookie_t	*c = (au_himem_cookie_t *)v;
 
 	wbflush();
-	val = (*(volatile uint64_t *)(h + o));
+	val = (*(volatile uint64_t *)(intptr_t)(h + o));
 	return (c->c_hwswap ? bswap64(val) : val);
 }
 
@@ -479,7 +481,7 @@
 {
 	au_himem_cookie_t	*c = (au_himem_cookie_t *)v;
 
-	*(volatile uint16_t *)(h + o) = c->c_hwswap ? bswap16(val) : val;
+	*(volatile uint16_t *)(intptr_t)(h + o) = c->c_hwswap ? bswap16(val) : val;
 	wbflush();
 }
 
@@ -488,7 +490,7 @@
 {
 	au_himem_cookie_t	*c = (au_himem_cookie_t *)v;
 
-	*(volatile uint32_t *)(h + o) = c->c_hwswap ? bswap32(val) : val;
+	*(volatile uint32_t *)(intptr_t)(h + o) = c->c_hwswap ? bswap32(val) : val;
 	wbflush();
 }
 
@@ -497,7 +499,7 @@
 {
 	au_himem_cookie_t	*c = (au_himem_cookie_t *)v;
 
-	*(volatile uint64_t *)(h + o) = c->c_hwswap ? bswap64(val) : val;
+	*(volatile uint64_t *)(intptr_t)(h + o) = c->c_hwswap ? bswap64(val) : val;
 	wbflush();
 }
 
@@ -662,11 +664,11 @@
 void									\
 __CONCAT(au_himem_c_,BYTES)(void *v,					\
     bus_space_handle_t h1, bus_size_t o1, bus_space_handle_t h2,	\
-    bus_space_handle_t o2, bus_size_t cnt)				\
+    bus_size_t o2, bus_size_t cnt)					\
 {									\
 	volatile TYPE *src, *dst;					\
-	src = (volatile TYPE *)(h1 + o1);				\
-	dst = (volatile TYPE *)(h2 + o2);				\
+	src = (volatile TYPE *)(intptr_t)(h1 + o1);			\
+	dst = (volatile TYPE *)(intptr_t)(h2 + o2);			\
 									\
 	if (src >= dst) {						\
 		while (cnt-- > 0)					\

Index: src/sys/arch/mips/alchemy/aubus.c
diff -u src/sys/arch/mips/alchemy/aubus.c:1.19 src/sys/arch/mips/alchemy/aubus.c:1.20
--- src/sys/arch/mips/alchemy/aubus.c:1.19	Sat Mar 14 15:36:09 2009
+++ src/sys/arch/mips/alchemy/aubus.c	Wed Dec 16 08:26:14 2009
@@ -1,4 +1,4 @@
-/* $NetBSD: aubus.c,v 1.19 2009/03/14 15:36:09 dsl Exp $ */
+/* $NetBSD: aubus.c,v 1.20 2009/12/16 08:26:14 matt Exp $ */
 
 /*-
  * Copyright (c) 2006 Itronix Inc.
@@ -97,7 +97,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: aubus.c,v 1.19 2009/03/14 15:36:09 dsl Exp $");
+__KERNEL_RCSID(0, "$NetBSD: aubus.c,v 1.20 2009/12/16 08:26:14 matt Exp $");
 
 #include "locators.h"
 
@@ -179,7 +179,7 @@
 		aprint_normal("%s at %s", aa->aa_name, pnp);
 
 	if (aa->aa_addr != AUBUSCF_ADDR_DEFAULT)
-		aprint_normal(" addr 0x%lx", aa->aa_addr);
+		aprint_normal(" addr 0x%" PRIxBUSADDR, aa->aa_addr);
 	if (aa->aa_irq[0] >= 0)
 		aprint_normal(" irq %d", aa->aa_irq[0]);
 	if (aa->aa_irq[1] >= 0)

Reply via email to