Source-Changes-HG archive

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

[src/trunk]: src/sys Use the structures defined in bsd_openprom.h for "reg", ...



details:   https://anonhg.NetBSD.org/src/rev/900045d92997
branches:  trunk
changeset: 535588:900045d92997
user:      thorpej <thorpej%NetBSD.org@localhost>
date:      Fri Aug 23 02:53:10 2002 +0000

description:
Use the structures defined in bsd_openprom.h for "reg", "range",
and "intr" properties, rather than having identical-except-for-names
sbus_* and iommu_* versions.

diffstat:

 sys/arch/sparc/dev/cgfourteen.c    |   8 ++--
 sys/arch/sparc/dev/cgfourteenvar.h |   4 +-
 sys/arch/sparc/dev/sbus.c          |  64 +++++++++++++++++++------------------
 sys/arch/sparc/dev/sbusvar.h       |   4 +-
 sys/arch/sparc/dev/vme_machdep.c   |  22 ++++++------
 sys/arch/sparc/sparc/autoconf.c    |   6 +-
 sys/arch/sparc/sparc/iommu.c       |   6 +-
 sys/arch/sparc/sparc/iommuvar.h    |  10 +----
 sys/arch/sparc/sparc/timer.c       |  10 ++--
 sys/arch/sparc64/dev/sbus.c        |  48 ++++++++++++++-------------
 sys/arch/sparc64/dev/sbusvar.h     |   4 +-
 sys/dev/sbus/be.c                  |  22 ++++++------
 sys/dev/sbus/esp_sbus.c            |  16 ++++----
 sys/dev/sbus/if_hme_sbus.c         |  34 ++++++++++----------
 sys/dev/sbus/p9100.c               |  28 ++++++++--------
 sys/dev/sbus/qe.c                  |  16 ++++----
 sys/dev/sbus/qec.c                 |  32 +++++++++---------
 sys/dev/sbus/qecvar.h              |   6 +-
 sys/dev/sbus/sbusvar.h             |  40 +++++-----------------
 sys/dev/sbus/tcx.c                 |  30 ++++++++--------
 20 files changed, 195 insertions(+), 215 deletions(-)

diffs (truncated from 1138 to 300 lines):

diff -r fb186909f2a3 -r 900045d92997 sys/arch/sparc/dev/cgfourteen.c
--- a/sys/arch/sparc/dev/cgfourteen.c   Fri Aug 23 02:46:37 2002 +0000
+++ b/sys/arch/sparc/dev/cgfourteen.c   Fri Aug 23 02:53:10 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: cgfourteen.c,v 1.24 2002/08/03 00:12:59 itojun Exp $ */
+/*     $NetBSD: cgfourteen.c,v 1.25 2002/08/23 02:53:11 thorpej Exp $ */
 
 /*
  * Copyright (c) 1996
@@ -231,7 +231,7 @@
                return;
        }
        bcopy(sa->sa_reg, sc->sc_physadr,
-             sa->sa_nreg * sizeof(struct sbus_reg));
+             sa->sa_nreg * sizeof(struct openprom_addr));
 
        /*
         * Now map in the 8 useful pages of registers
@@ -608,8 +608,8 @@
        }
 
        return (bus_space_mmap(sc->sc_bustag,
-               BUS_ADDR(sc->sc_physadr[CG14_PXL_IDX].sbr_slot,
-                       sc->sc_physadr[CG14_PXL_IDX].sbr_offset),
+               BUS_ADDR(sc->sc_physadr[CG14_PXL_IDX].oa_space,
+                       sc->sc_physadr[CG14_PXL_IDX].oa_base),
                off, prot, BUS_SPACE_MAP_LINEAR));
 }
 
diff -r fb186909f2a3 -r 900045d92997 sys/arch/sparc/dev/cgfourteenvar.h
--- a/sys/arch/sparc/dev/cgfourteenvar.h        Fri Aug 23 02:46:37 2002 +0000
+++ b/sys/arch/sparc/dev/cgfourteenvar.h        Fri Aug 23 02:53:10 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: cgfourteenvar.h,v 1.3 1998/07/29 18:36:08 pk Exp $ */
+/*     $NetBSD: cgfourteenvar.h,v 1.4 2002/08/23 02:53:11 thorpej Exp $ */
 
 /*
  * Copyright (c) 1996 
@@ -69,7 +69,7 @@
        struct device   sc_dev;         /* base device */
        struct fbdevice sc_fb;          /* frame buffer device */
        bus_space_tag_t sc_bustag;
-       struct sbus_reg sc_physadr[2];  /* phys addrs of h/w */
+       struct openprom_addr sc_physadr[2]; /* phys addrs of h/w */
 #define CG14_CTL_IDX   0
 #define CG14_PXL_IDX   1
 
diff -r fb186909f2a3 -r 900045d92997 sys/arch/sparc/dev/sbus.c
--- a/sys/arch/sparc/dev/sbus.c Fri Aug 23 02:46:37 2002 +0000
+++ b/sys/arch/sparc/dev/sbus.c Fri Aug 23 02:53:10 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: sbus.c,v 1.45 2002/03/11 16:27:02 pk Exp $ */
+/*     $NetBSD: sbus.c,v 1.46 2002/08/23 02:53:11 thorpej Exp $ */
 
 /*-
  * Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -105,7 +105,7 @@
 
 static bus_space_tag_t sbus_alloc_bustag __P((struct sbus_softc *));
 static int sbus_get_intr __P((struct sbus_softc *, int,
-                             struct sbus_intr **, int *));
+                             struct openprom_intr **, int *));
 static paddr_t sbus_bus_mmap __P((bus_space_tag_t, bus_addr_t, off_t,
                                  int, int));
 static int _sbus_bus_map __P((
@@ -151,7 +151,7 @@
 struct sbus_softc *sbus_sc;
 
 /* If the PROM does not provide the `ranges' property, we make up our own */
-struct sbus_range sbus_translations[] = {
+struct openprom_range sbus_translations[] = {
        /* Assume a maximum of 4 Sbus slots, all mapped to on-board io space */
        { 0, 0, PMAP_OBIO, SBUS_ADDR(0,0), 1 << 25 },
        { 1, 0, PMAP_OBIO, SBUS_ADDR(1,0), 1 << 25 },
@@ -204,7 +204,7 @@
                printf("%s at %s", sa->sa_name, busname);
        printf(" slot %d offset 0x%x", sa->sa_slot, sa->sa_offset);
        for (i = 0; i < sa->sa_nintr; i++) {
-               u_int32_t level = sa->sa_intr[i].sbi_pri;
+               u_int32_t level = sa->sa_intr[i].oi_pri;
                struct sbus_softc *sc =
                        (struct sbus_softc *) sa->sa_bustag->cookie;
 
@@ -332,9 +332,9 @@
                panic("%s: no Sbus registers", self->dv_xname);
 
        if (bus_space_map(ia->iom_bustag,
-                         BUS_ADDR(ia->iom_reg[0].ior_iospace,
-                                  ia->iom_reg[0].ior_pa),
-                         (bus_size_t)ia->iom_reg[0].ior_size,
+                         BUS_ADDR(ia->iom_reg[0].oa_space,
+                                  ia->iom_reg[0].oa_base),
+                         (bus_size_t)ia->iom_reg[0].oa_size,
                          BUS_SPACE_MAP_LINEAR,
                          &sc->sc_bh) != 0) {
                panic("%s: can't map sbusbusreg", self->dv_xname);
@@ -494,7 +494,7 @@
        sa->sa_node = node;
        sa->sa_frequency = sc->sc_clockfreq;
 
-       error = PROM_getprop(node, "reg", sizeof(struct sbus_reg),
+       error = PROM_getprop(node, "reg", sizeof(struct openprom_addr),
                        &sa->sa_nreg, (void **)&sa->sa_reg);
        if (error != 0) {
                char buf[32];
@@ -506,10 +506,10 @@
        }
        for (n = 0; n < sa->sa_nreg; n++) {
                /* Convert to relative addressing, if necessary */
-               u_int32_t base = sa->sa_reg[n].sbr_offset;
+               u_int32_t base = sa->sa_reg[n].oa_base;
                if (SBUS_ABS(base)) {
-                       sa->sa_reg[n].sbr_slot = SBUS_ABS_TO_SLOT(base);
-                       sa->sa_reg[n].sbr_offset = SBUS_ABS_TO_OFFSET(base);
+                       sa->sa_reg[n].oa_space = SBUS_ABS_TO_SLOT(base);
+                       sa->sa_reg[n].oa_base = SBUS_ABS_TO_OFFSET(base);
                }
        }
 
@@ -558,16 +558,16 @@
        int i;
 
        for (i = 0; i < sc->sc_nrange; i++) {
-               struct sbus_range *rp = &sc->sc_range[i];
+               struct openprom_range *rp = &sc->sc_range[i];
 
-               if (rp->cspace != slot)
+               if (rp->or_child_space != slot)
                        continue;
 
                /* We've found the connection to the parent bus */
                return (bus_space_map2(sc->sc_bustag,
-                               BUS_ADDR(rp->pspace,
-                                        rp->poffset + BUS_ADDR_PADDR(ba)),
-                               size, flags, va, hp));
+                   BUS_ADDR(rp->or_parent_space,
+                            rp->or_parent_base + BUS_ADDR_PADDR(ba)),
+                   size, flags, va, hp));
        }
 
        return (EINVAL);
@@ -586,15 +586,15 @@
        int i;
 
        for (i = 0; i < sc->sc_nrange; i++) {
-               struct sbus_range *rp = &sc->sc_range[i];
+               struct openprom_range *rp = &sc->sc_range[i];
 
-               if (rp->cspace != slot)
+               if (rp->or_child_space != slot)
                        continue;
 
                return (bus_space_mmap(sc->sc_bustag,
-                               BUS_ADDR(rp->pspace,
-                                        rp->poffset + BUS_ADDR_PADDR(ba)),
-                               off, prot, flags));
+                   BUS_ADDR(rp->or_parent_space,
+                            rp->or_parent_base + BUS_ADDR_PADDR(ba)),
+                   off, prot, flags));
        }
 
        return (-1);
@@ -676,7 +676,7 @@
 sbus_get_intr(sc, node, ipp, np)
        struct sbus_softc *sc;
        int node;
-       struct sbus_intr **ipp;
+       struct openprom_intr **ipp;
        int *np;
 {
        int error, n;
@@ -685,17 +685,19 @@
        /*
         * The `interrupts' property contains the Sbus interrupt level.
         */
-       if (PROM_getprop(node, "interrupts", sizeof(int), np, (void **)&ipl) == 0) {
-               /* Change format to an `struct sbus_intr' array */
-               struct sbus_intr *ip;
-               ip = malloc(*np * sizeof(struct sbus_intr), M_DEVBUF, M_NOWAIT);
+       if (PROM_getprop(node, "interrupts", sizeof(int), np,
+                        (void **)&ipl) == 0) {
+               /* Change format to an `struct openprom_intr' array */
+               struct openprom_intr *ip;
+               ip = malloc(*np * sizeof(struct openprom_intr), M_DEVBUF,
+                   M_NOWAIT);
                if (ip == NULL) {
                        free(ipl, M_DEVBUF);
                        return (ENOMEM);
                }
                for (n = 0; n < *np; n++) {
-                       ip[n].sbi_pri = ipl[n];
-                       ip[n].sbi_vec = 0;
+                       ip[n].oi_pri = ipl[n];
+                       ip[n].oi_vec = 0;
                }
                free(ipl, M_DEVBUF);
                *ipp = ip;
@@ -706,13 +708,13 @@
         * Fall back on `intr' property.
         */
        *ipp = NULL;
-       error = PROM_getprop(node, "intr", sizeof(struct sbus_intr),
+       error = PROM_getprop(node, "intr", sizeof(struct openprom_intr),
                        np, (void **)ipp);
        switch (error) {
        case 0:
                for (n = *np; n-- > 0;) {
-                       (*ipp)[n].sbi_pri &= 0xf;
-                       (*ipp)[n].sbi_pri |= SBUS_INTR_COMPAT;
+                       (*ipp)[n].oi_pri &= 0xf;
+                       (*ipp)[n].oi_pri |= SBUS_INTR_COMPAT;
                }
                break;
        case ENOENT:
diff -r fb186909f2a3 -r 900045d92997 sys/arch/sparc/dev/sbusvar.h
--- a/sys/arch/sparc/dev/sbusvar.h      Fri Aug 23 02:46:37 2002 +0000
+++ b/sys/arch/sparc/dev/sbusvar.h      Fri Aug 23 02:53:10 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: sbusvar.h,v 1.11 2002/03/21 04:32:25 uwe Exp $ */
+/*     $NetBSD: sbusvar.h,v 1.12 2002/08/23 02:53:11 thorpej Exp $ */
 
 /*-
  * Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -92,7 +92,7 @@
        bus_space_handle_t sc_bh;       /* SBus control registers */
        int     sc_clockfreq;           /* clock frequency (in Hz) */
        struct  sbusdev *sc_sbdev;      /* list of all children */
-       struct  sbus_range *sc_range;   /* Address space translations */
+       struct  openprom_range *sc_range;/* Address space translations */
        int     sc_nrange;
        int     sc_burst;               /* burst transfer sizes supported */
 
diff -r fb186909f2a3 -r 900045d92997 sys/arch/sparc/dev/vme_machdep.c
--- a/sys/arch/sparc/dev/vme_machdep.c  Fri Aug 23 02:46:37 2002 +0000
+++ b/sys/arch/sparc/dev/vme_machdep.c  Fri Aug 23 02:53:10 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: vme_machdep.c,v 1.35 2002/03/11 16:27:02 pk Exp $      */
+/*     $NetBSD: vme_machdep.c,v 1.36 2002/08/23 02:53:11 thorpej Exp $ */
 
 /*-
  * Copyright (c) 1997, 1998 The NetBSD Foundation, Inc.
@@ -394,9 +394,9 @@
        }
 
        if (bus_space_map(ia->iom_bustag,
-                         (bus_addr_t) BUS_ADDR(ia->iom_reg[0].ior_iospace,
-                                               ia->iom_reg[0].ior_pa),
-                         (bus_size_t)ia->iom_reg[0].ior_size,
+                         (bus_addr_t) BUS_ADDR(ia->iom_reg[0].oa_space,
+                                               ia->iom_reg[0].oa_base),
+                         (bus_size_t)ia->iom_reg[0].oa_size,
                          BUS_SPACE_MAP_LINEAR,
                          &bh) != 0) {
                panic("%s: can't map vmebusreg", self->dv_xname);
@@ -404,9 +404,9 @@
        sc->sc_reg = (struct vmebusreg *)bh;
 
        if (bus_space_map(ia->iom_bustag,
-                         (bus_addr_t) BUS_ADDR(ia->iom_reg[1].ior_iospace,
-                                               ia->iom_reg[1].ior_pa),
-                         (bus_size_t)ia->iom_reg[1].ior_size,
+                         (bus_addr_t) BUS_ADDR(ia->iom_reg[1].oa_space,
+                                               ia->iom_reg[1].oa_base),
+                         (bus_size_t)ia->iom_reg[1].oa_size,
                          BUS_SPACE_MAP_LINEAR,
                          &bh) != 0) {
                panic("%s: can't map vmebusvec", self->dv_xname);
@@ -418,8 +418,8 @@
         */
        if (bus_space_map(ia->iom_bustag,
                          (bus_addr_t) BUS_ADDR(
-                               ia->iom_reg[1].ior_iospace,
-                               ia->iom_reg[1].ior_pa + VME_IOC_TAGOFFSET),
+                               ia->iom_reg[1].oa_space,
+                               ia->iom_reg[1].oa_base + VME_IOC_TAGOFFSET),
                          VME_IOC_SIZE,
                          BUS_SPACE_MAP_LINEAR,
                          &bh) != 0) {
@@ -429,8 +429,8 @@
 
        if (bus_space_map(ia->iom_bustag,
                          (bus_addr_t) BUS_ADDR(
-                               ia->iom_reg[1].ior_iospace,
-                               ia->iom_reg[1].ior_pa + VME_IOC_FLUSHOFFSET),
+                               ia->iom_reg[1].oa_space,
+                               ia->iom_reg[1].oa_base + VME_IOC_FLUSHOFFSET),
                          VME_IOC_SIZE,
                          BUS_SPACE_MAP_LINEAR,
                          &bh) != 0) {
diff -r fb186909f2a3 -r 900045d92997 sys/arch/sparc/sparc/autoconf.c
--- a/sys/arch/sparc/sparc/autoconf.c   Fri Aug 23 02:46:37 2002 +0000
+++ b/sys/arch/sparc/sparc/autoconf.c   Fri Aug 23 02:53:10 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: autoconf.c,v 1.171 2002/07/18 03:22:00 thorpej Exp $ */
+/*     $NetBSD: autoconf.c,v 1.172 2002/08/23 02:53:11 thorpej Exp $ */
 
 /*
  * Copyright (c) 1996
@@ -1771,8 +1771,8 @@
                    "want space %#x pa %#x have space %#x pa %#x\n",



Home | Main Index | Thread Index | Old Index