Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/arch Fix printf format problems and latent bugs made vis...



details:   https://anonhg.NetBSD.org/src/rev/7c16834173fb
branches:  trunk
changeset: 750093:7c16834173fb
user:      matt <matt%NetBSD.org@localhost>
date:      Wed Dec 16 08:26:14 2009 +0000

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

diffstat:

 sys/arch/evbmips/alchemy/machdep.c     |   6 +--
 sys/arch/evbmips/alchemy/obio.c        |   6 ++--
 sys/arch/mips/alchemy/au_himem_space.c |  46 +++++++++++++++++----------------
 sys/arch/mips/alchemy/aubus.c          |   6 ++--
 4 files changed, 32 insertions(+), 32 deletions(-)

diffs (261 lines):

diff -r f2e1da9a689f -r 7c16834173fb sys/arch/evbmips/alchemy/machdep.c
--- a/sys/arch/evbmips/alchemy/machdep.c        Wed Dec 16 04:50:35 2009 +0000
+++ b/sys/arch/evbmips/alchemy/machdep.c        Wed Dec 16 08:26:14 2009 +0000
@@ -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;
 
diff -r f2e1da9a689f -r 7c16834173fb sys/arch/evbmips/alchemy/obio.c
--- a/sys/arch/evbmips/alchemy/obio.c   Wed Dec 16 04:50:35 2009 +0000
+++ b/sys/arch/evbmips/alchemy/obio.c   Wed Dec 16 08:26:14 2009 +0000
@@ -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);
 }
diff -r f2e1da9a689f -r 7c16834173fb sys/arch/mips/alchemy/au_himem_space.c
--- a/sys/arch/mips/alchemy/au_himem_space.c    Wed Dec 16 04:50:35 2009 +0000
+++ b/sys/arch/mips/alchemy/au_himem_space.c    Wed Dec 16 08:26:14 2009 +0000
@@ -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)                                       \
diff -r f2e1da9a689f -r 7c16834173fb sys/arch/mips/alchemy/aubus.c
--- a/sys/arch/mips/alchemy/aubus.c     Wed Dec 16 04:50:35 2009 +0000
+++ b/sys/arch/mips/alchemy/aubus.c     Wed Dec 16 08:26:14 2009 +0000
@@ -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)



Home | Main Index | Thread Index | Old Index