Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/netbsd-8]: src/sys/arch/pmax Apply patch (requested by flxd in ticket #1...
details: https://anonhg.NetBSD.org/src/rev/175a6acfb913
branches: netbsd-8
changeset: 434155:175a6acfb913
user: snj <snj%NetBSD.org@localhost>
date: Tue Jul 25 02:15:19 2017 +0000
description:
Apply patch (requested by flxd in ticket #154):
Revert pmax switch to common MIPS bus_space and bus_dma.
diffstat:
sys/arch/pmax/conf/files.pmax | 12 +-
sys/arch/pmax/include/bus.h | 632 +++++++++++++++++++++++++++++++++++++++++-
2 files changed, 628 insertions(+), 16 deletions(-)
diffs (truncated from 686 to 300 lines):
diff -r 93d984113ead -r 175a6acfb913 sys/arch/pmax/conf/files.pmax
--- a/sys/arch/pmax/conf/files.pmax Tue Jul 25 02:12:35 2017 +0000
+++ b/sys/arch/pmax/conf/files.pmax Tue Jul 25 02:15:19 2017 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: files.pmax,v 1.118 2016/11/16 19:37:06 macallan Exp $
+# $NetBSD: files.pmax,v 1.118.8.1 2017/07/25 02:15:19 snj Exp $
# DECstation-specific configuration info
# maxpartitions must be first item in files.${ARCH}.
@@ -16,12 +16,6 @@
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)
@@ -128,7 +122,8 @@
file arch/pmax/ibus/if_le_ibus.c le_pmax
file arch/pmax/pmax/autoconf.c
-file arch/pmax/pmax/bus.c
+file arch/pmax/pmax/bus_dma.c
+file arch/pmax/pmax/bus_space.c
file arch/pmax/pmax/disksubr.c
file arch/pmax/pmax/machdep.c
file arch/pmax/pmax/mainbus.c
@@ -138,6 +133,7 @@
file arch/pmax/stand/common/callvec.c
file dev/cons.c
+file dev/bus_dma/bus_dmamem_common.c
#
# Workstation console devices
diff -r 93d984113ead -r 175a6acfb913 sys/arch/pmax/include/bus.h
--- a/sys/arch/pmax/include/bus.h Tue Jul 25 02:12:35 2017 +0000
+++ b/sys/arch/pmax/include/bus.h Tue Jul 25 02:15:19 2017 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: bus.h,v 1.31 2016/11/16 19:37:06 macallan Exp $ */
+/* $NetBSD: bus.h,v 1.31.8.1 2017/07/25 02:15:20 snj Exp $ */
/*-
* Copyright (c) 1996, 1997, 1998, 2001 The NetBSD Foundation, Inc.
@@ -41,13 +41,629 @@
#define __PB_TYPENAME_PREFIX(BITS) ___CONCAT(u_int,BITS)
#define __PB_TYPENAME(BITS) ___CONCAT(__PB_TYPENAME_PREFIX(BITS),_t)
-#include <mips/bus_space_defs.h>
-#include <mips/bus_space_funcs.h>
-#include <mips/bus_dma_defs.h>
-#include <mips/bus_dma_funcs.h>
+/*
+ * 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) \
+do { \
+ (void) t; \
+ *(volatile uint16_t *)((h) + (o)) = (v); \
+ wbflush(); /* XXX */ \
+} while (0)
+
+#define bus_space_write_4(t, h, o, v) \
+do { \
+ (void) t; \
+ *(volatile uint32_t *)((h) + (o)) = (v); \
+ wbflush(); /* XXX */ \
+} while (0)
+
+#if 0 /* Cause a link error for bus_space_write_8 */
+#define bus_space_write_8 !!! bus_space_write_8 not implemented !!!
+#endif
+
+/*
+ * void bus_space_write_multi_N(bus_space_tag_t tag,
+ * bus_space_handle_t bsh, bus_size_t offset,
+ * const u_intN_t *addr, size_t count);
+ *
+ * Write `count' 1, 2, 4, or 8 byte quantities from the buffer
+ * provided to bus space described by tag/handle/offset.
+ */
+
+#define __PMAX_bus_space_write_multi(BYTES,BITS) \
+static __inline void __CONCAT(bus_space_write_multi_,BYTES) \
+ (bus_space_tag_t, bus_space_handle_t, bus_size_t, \
+ __PB_TYPENAME(BITS) *, size_t); \
+ \
+static __inline void \
+__CONCAT(bus_space_write_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--) \
+ __CONCAT(bus_space_write_,BYTES)(t, h, o, *a++); \
+}
+
+__PMAX_bus_space_write_multi(1,8)
+__PMAX_bus_space_write_multi(2,16)
+__PMAX_bus_space_write_multi(4,32)
+
Home |
Main Index |
Thread Index |
Old Index