Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/pmax switch to common MIPS bus_space and bus_dma



details:   https://anonhg.NetBSD.org/src/rev/db6a7a1609a2
branches:  trunk
changeset: 819079:db6a7a1609a2
user:      macallan <macallan%NetBSD.org@localhost>
date:      Wed Nov 16 19:37:06 2016 +0000

description:
switch to common MIPS bus_space and bus_dma
tested by flxd@

diffstat:

 sys/arch/pmax/conf/files.pmax  |   12 +-
 sys/arch/pmax/ibus/ibus_3max.c |    5 +-
 sys/arch/pmax/ibus/ibus_pmax.c |    5 +-
 sys/arch/pmax/include/bus.h    |  629 +----------------------------------------
 sys/arch/pmax/pmax/bus.c       |  356 +++++++++++++++++++++++
 sys/arch/pmax/tc/tcbus.c       |    6 +-
 6 files changed, 381 insertions(+), 632 deletions(-)

diffs (truncated from 1122 to 300 lines):

diff -r 7369a0cd8352 -r db6a7a1609a2 sys/arch/pmax/conf/files.pmax
--- a/sys/arch/pmax/conf/files.pmax     Wed Nov 16 16:11:42 2016 +0000
+++ b/sys/arch/pmax/conf/files.pmax     Wed Nov 16 19:37:06 2016 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: files.pmax,v 1.117 2016/11/04 19:18:50 flxd Exp $
+#      $NetBSD: files.pmax,v 1.118 2016/11/16 19:37:06 macallan Exp $
 # DECstation-specific configuration info
 
 # maxpartitions must be first item in files.${ARCH}.
@@ -16,6 +16,12 @@
 attach cpu at mainbus
 file arch/pmax/pmax/cpu.c              cpu
 
+#
+# common mips stuff
+#
+file arch/mips/mips/bus_dma.c
+
+
 # Model support option headers
 defflag        DEC_3100        # DECstation 2100, 3100 (kn01)
 defflag        DEC_5100        # DECsystem 5100 (kn230)
@@ -122,8 +128,7 @@
 file   arch/pmax/ibus/if_le_ibus.c     le_pmax
 
 file   arch/pmax/pmax/autoconf.c
-file   arch/pmax/pmax/bus_dma.c
-file   arch/pmax/pmax/bus_space.c
+file   arch/pmax/pmax/bus.c
 file   arch/pmax/pmax/disksubr.c
 file   arch/pmax/pmax/machdep.c
 file   arch/pmax/pmax/mainbus.c
@@ -133,7 +138,6 @@
 file   arch/pmax/stand/common/callvec.c
 file   dev/cons.c
 
-file   dev/bus_dma/bus_dmamem_common.c
 
 #
 # Workstation console devices
diff -r 7369a0cd8352 -r db6a7a1609a2 sys/arch/pmax/ibus/ibus_3max.c
--- a/sys/arch/pmax/ibus/ibus_3max.c    Wed Nov 16 16:11:42 2016 +0000
+++ b/sys/arch/pmax/ibus/ibus_3max.c    Wed Nov 16 19:37:06 2016 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ibus_3max.c,v 1.15 2011/07/09 17:32:29 matt Exp $      */
+/*     $NetBSD: ibus_3max.c,v 1.16 2016/11/16 19:37:06 macallan Exp $  */
 
 /*-
  * Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ibus_3max.c,v 1.15 2011/07/09 17:32:29 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ibus_3max.c,v 1.16 2016/11/16 19:37:06 macallan Exp $");
 
 #include <sys/param.h>
 #include <sys/device.h>
@@ -68,6 +68,7 @@
        ida.ida_busname = "ibus";
        ida.ida_devs = kn02sys_devs;
        ida.ida_ndevs = __arraycount(kn02sys_devs);
+       ida.ida_memt = normal_memt;
 
        ibusattach(parent, self, &ida);
 }
diff -r 7369a0cd8352 -r db6a7a1609a2 sys/arch/pmax/ibus/ibus_pmax.c
--- a/sys/arch/pmax/ibus/ibus_pmax.c    Wed Nov 16 16:11:42 2016 +0000
+++ b/sys/arch/pmax/ibus/ibus_pmax.c    Wed Nov 16 19:37:06 2016 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ibus_pmax.c,v 1.23 2011/07/09 17:32:29 matt Exp $      */
+/*     $NetBSD: ibus_pmax.c,v 1.24 2016/11/16 19:37:06 macallan Exp $  */
 
 /*
  * Copyright (c) 1998 Jonathan Stone.  All rights reserved.
@@ -31,7 +31,7 @@
  */
 
 #include <sys/cdefs.h>                 /* RCS ID & Copyright macro defns */
-__KERNEL_RCSID(0, "$NetBSD: ibus_pmax.c,v 1.23 2011/07/09 17:32:29 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ibus_pmax.c,v 1.24 2016/11/16 19:37:06 macallan Exp $");
 
 #include "opt_dec_3100.h"
 #include "opt_dec_5100.h"
@@ -113,6 +113,7 @@
        ibus_attached = 1;
 
        ida.ida_busname = "ibus";
+       ida.ida_memt = normal_memt;
        switch (systype) {
 #ifdef DEC_3100
        case DS_PMAX:
diff -r 7369a0cd8352 -r db6a7a1609a2 sys/arch/pmax/include/bus.h
--- a/sys/arch/pmax/include/bus.h       Wed Nov 16 16:11:42 2016 +0000
+++ b/sys/arch/pmax/include/bus.h       Wed Nov 16 19:37:06 2016 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: bus.h,v 1.30 2011/02/20 07:50:25 matt Exp $    */
+/*     $NetBSD: bus.h,v 1.31 2016/11/16 19:37:06 macallan Exp $        */
 
 /*-
  * Copyright (c) 1996, 1997, 1998, 2001 The NetBSD Foundation, Inc.
@@ -41,626 +41,13 @@
 #define        __PB_TYPENAME_PREFIX(BITS)      ___CONCAT(u_int,BITS)
 #define        __PB_TYPENAME(BITS)             ___CONCAT(__PB_TYPENAME_PREFIX(BITS),_t)
 
-/*
- * Bus address and size types
- */
-typedef u_long bus_addr_t;
-typedef u_long bus_size_t;
-
-/*
- * Access methods for bus resources and address space.
- */
-typedef int    bus_space_tag_t;
-typedef u_long bus_space_handle_t;
-
-/*
- *     int bus_space_map(bus_space_tag_t t, bus_addr_t addr,
- *         bus_size_t size, int flags, bus_space_handle_t *bshp);
- *
- * Map a region of bus space.
- */
-
-#define        BUS_SPACE_MAP_CACHEABLE         0x01
-#define        BUS_SPACE_MAP_LINEAR            0x02
-#define        BUS_SPACE_MAP_PREFETCHABLE      0x04
-
-int    bus_space_map(bus_space_tag_t, bus_addr_t, bus_size_t,
-           int, bus_space_handle_t *);
-
-/*
- *     void bus_space_unmap(bus_space_tag_t t,
- *         bus_space_handle_t bsh, bus_size_t size);
- *
- * Unmap a region of bus space.
- */
-
-void   bus_space_unmap(bus_space_tag_t, bus_space_handle_t, bus_size_t);
-
-/*
- *     int bus_space_subregion(bus_space_tag_t t,
- *         bus_space_handle_t bsh, bus_size_t offset, bus_size_t size,
- *         bus_space_handle_t *nbshp);
- *
- * Get a new handle for a subregion of an already-mapped area of bus space.
- */
-
-int    bus_space_subregion(bus_space_tag_t t, bus_space_handle_t bsh,
-           bus_size_t offset, bus_size_t size, bus_space_handle_t *nbshp);
-
-/*
- *     int bus_space_alloc(bus_space_tag_t t, bus_addr_t, rstart,
- *         bus_addr_t rend, bus_size_t size, bus_size_t align,
- *         bus_size_t boundary, int flags, bus_addr_t *addrp,
- *         bus_space_handle_t *bshp);
- *
- * Allocate a region of bus space.
- */
-
-int    bus_space_alloc(bus_space_tag_t t, bus_addr_t rstart,
-           bus_addr_t rend, bus_size_t size, bus_size_t align,
-           bus_size_t boundary, int cacheable, bus_addr_t *addrp,
-           bus_space_handle_t *bshp);
-
-/*
- *     int bus_space_free(bus_space_tag_t t,
- *         bus_space_handle_t bsh, bus_size_t size);
- *
- * Free a region of bus space.
- */
-
-void   bus_space_free(bus_space_tag_t t, bus_space_handle_t bsh,
-           bus_size_t size);
-
-/*
- *     void *bus_space_vaddr(bus_space_tag_t, bus_space_handle_t);
- *
- * Get the kernel virtual address for the mapped bus space.
- * Only allowed for regions mapped with BUS_SPACE_MAP_LINEAR.
- *  (XXX not enforced)
- */
-#define bus_space_vaddr(t, h) \
-       ((void *)(h))
-
-/*
- *     u_intN_t bus_space_read_N(bus_space_tag_t tag,
- *         bus_space_handle_t bsh, bus_size_t offset);
- *
- * Read a 1, 2, 4, or 8 byte quantity from bus space
- * described by tag/handle/offset.
- */
-
-#define        bus_space_read_1(t, h, o)                                       \
-     ((void) t, (*(volatile u_int8_t *)((h) + (o))))
-
-#define        bus_space_read_2(t, h, o)                                       \
-     ((void) t, (*(volatile u_int16_t *)((h) + (o))))
-
-#define        bus_space_read_4(t, h, o)                                       \
-     ((void) t, (*(volatile uint32_t *)((h) + (o))))
-
-#if 0  /* Cause a link error for bus_space_read_8 */
-#define        bus_space_read_8(t, h, o)       !!! bus_space_read_8 unimplemented !!!
-#endif
-
-/*
- *     void bus_space_read_multi_N(bus_space_tag_t tag,
- *         bus_space_handle_t bsh, bus_size_t offset,
- *         u_intN_t *addr, size_t count);
- *
- * Read `count' 1, 2, 4, or 8 byte quantities from bus space
- * described by tag/handle/offset and copy into buffer provided.
- */
-
-#define __PMAX_bus_space_read_multi(BYTES,BITS)                                \
-static __inline void __CONCAT(bus_space_read_multi_,BYTES)             \
-       (bus_space_tag_t, bus_space_handle_t, bus_size_t,               \
-       __PB_TYPENAME(BITS) *, size_t);                                 \
-                                                                       \
-static __inline void                                                   \
-__CONCAT(bus_space_read_multi_,BYTES)(                                 \
-       bus_space_tag_t t,                                              \
-       bus_space_handle_t h,                                           \
-       bus_size_t o,                                                   \
-       __PB_TYPENAME(BITS) *a,                                         \
-       size_t c)                                                       \
-{                                                                      \
-                                                                       \
-       while (c--)                                                     \
-               *a++ = __CONCAT(bus_space_read_,BYTES)(t, h, o);        \
-}
-
-__PMAX_bus_space_read_multi(1,8)
-__PMAX_bus_space_read_multi(2,16)
-__PMAX_bus_space_read_multi(4,32)
-
-#if 0  /* Cause a link error for bus_space_read_multi_8 */
-#define        bus_space_read_multi_8  !!! bus_space_read_multi_8 unimplemented !!!
-#endif
-
-#undef __PMAX_bus_space_read_multi
-
-/*
- *     void bus_space_read_region_N(bus_space_tag_t tag,
- *         bus_space_handle_t bsh, bus_size_t offset,
- *         u_intN_t *addr, size_t count);
- *
- * Read `count' 1, 2, 4, or 8 byte quantities from bus space
- * described by tag/handle and starting at `offset' and copy into
- * buffer provided.
- */
-
-#define __PMAX_bus_space_read_region(BYTES,BITS)                       \
-static __inline void __CONCAT(bus_space_read_region_,BYTES)            \
-       (bus_space_tag_t, bus_space_handle_t, bus_size_t,               \
-       __PB_TYPENAME(BITS) *, size_t);                                 \
-                                                                       \
-static __inline void                                                   \
-__CONCAT(bus_space_read_region_,BYTES)(                                        \
-       bus_space_tag_t t,                                              \
-       bus_space_handle_t h,                                           \
-       bus_size_t o,                                                   \
-       __PB_TYPENAME(BITS) *a,                                         \
-       size_t c)                                                       \
-{                                                                      \
-                                                                       \
-       while (c--) {                                                   \
-               *a++ = __CONCAT(bus_space_read_,BYTES)(t, h, o);        \
-               o += BYTES;                                             \
-       }                                                               \
-}
-
-__PMAX_bus_space_read_region(1,8)
-__PMAX_bus_space_read_region(2,16)
-__PMAX_bus_space_read_region(4,32)
-
-#if 0  /* Cause a link error for bus_space_read_region_8 */
-#define        bus_space_read_region_8 !!! bus_space_read_region_8 unimplemented !!!
-#endif
-
-#undef __PMAX_bus_space_read_region
-
-/*
- *     void bus_space_write_N(bus_space_tag_t tag,
- *         bus_space_handle_t bsh, bus_size_t offset,
- *         u_intN_t value);
- *
- * Write the 1, 2, 4, or 8 byte value `value' to bus space
- * described by tag/handle/offset.
- */
-
-#define        bus_space_write_1(t, h, o, v)                                   \
-do {                                                                   \
-       (void) t;                                                       \
-       *(volatile uint8_t *)((h) + (o)) = (v);                         \
-       wbflush();                                      /* XXX */       \
-} while (0)
-
-#define        bus_space_write_2(t, h, o, v)                                   \



Home | Main Index | Thread Index | Old Index