Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch/cobalt Switch cobalt to common bus_space.
details: https://anonhg.NetBSD.org/src/rev/ee2aa6d12732
branches: trunk
changeset: 358862:ee2aa6d12732
user: skrll <skrll%NetBSD.org@localhost>
date: Sat Jan 20 13:56:08 2018 +0000
description:
Switch cobalt to common bus_space.
Tested on raq 2
diffstat:
sys/arch/cobalt/cobalt/bus.c | 381 ++---------------------------------
sys/arch/cobalt/cobalt/interrupt.c | 8 +-
sys/arch/cobalt/cobalt/machdep.c | 33 ++-
sys/arch/cobalt/cobalt/mainbus.c | 8 +-
sys/arch/cobalt/conf/GENERIC | 6 +-
sys/arch/cobalt/conf/files.cobalt | 4 +-
sys/arch/cobalt/dev/com_mainbus.c | 8 +-
sys/arch/cobalt/dev/gt.c | 14 +-
sys/arch/cobalt/dev/gt_io_space.c | 57 +++++
sys/arch/cobalt/dev/gt_mem_space.c | 55 +++++
sys/arch/cobalt/dev/gtvar.h | 14 +
sys/arch/cobalt/include/bus_defs.h | 20 +-
sys/arch/cobalt/include/bus_funcs.h | 137 +------------
13 files changed, 212 insertions(+), 533 deletions(-)
diffs (truncated from 1006 to 300 lines):
diff -r 364660de0e40 -r ee2aa6d12732 sys/arch/cobalt/cobalt/bus.c
--- a/sys/arch/cobalt/cobalt/bus.c Sat Jan 20 13:45:15 2018 +0000
+++ b/sys/arch/cobalt/cobalt/bus.c Sat Jan 20 13:56:08 2018 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: bus.c,v 1.45 2014/07/29 21:21:43 skrll Exp $ */
+/* $NetBSD: bus.c,v 1.46 2018/01/20 13:56:08 skrll Exp $ */
/*
* Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -30,370 +30,37 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: bus.c,v 1.45 2014/07/29 21:21:43 skrll Exp $");
-
-#include <sys/param.h>
-#include <sys/bus.h>
-#include <sys/systm.h>
-#include <sys/kernel.h>
-#include <sys/device.h>
-#include <sys/malloc.h>
-#include <sys/proc.h>
-#include <sys/mbuf.h>
-
-#include <dev/bus_dma/bus_dmamem_common.h>
-
-#include <uvm/uvm_extern.h>
-
-#include <mips/cache.h>
-
/*
- * Utility macros; do not use outside this file.
- */
-#define __PB_TYPENAME_PREFIX(BITS) ___CONCAT(uint,BITS)
-#define __PB_TYPENAME(BITS) ___CONCAT(__PB_TYPENAME_PREFIX(BITS),_t)
-
-/*
- * void bus_space_read_multi_N(bus_space_tag_t tag,
- * bus_space_handle_t bsh, bus_size_t offset,
- * uintN_t *addr, bus_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 __COBALT_bus_space_read_multi(BYTES,BITS) \
-void __CONCAT(bus_space_read_multi_,BYTES) \
- (bus_space_tag_t, bus_space_handle_t, bus_size_t, \
- __PB_TYPENAME(BITS) *, bus_size_t); \
- \
-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, \
- bus_size_t c) \
-{ \
- \
- while (c--) \
- *a++ = __CONCAT(bus_space_read_,BYTES)(t, h, o); \
-}
-
-__COBALT_bus_space_read_multi(1,8)
-__COBALT_bus_space_read_multi(2,16)
-__COBALT_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 __COBALT_bus_space_read_multi
-
-/*
- * void bus_space_read_region_N(bus_space_tag_t tag,
- * bus_space_handle_t bsh, bus_size_t offset,
- * uintN_t *addr, bus_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.
+ * Platform-specific I/O support for the cobalt machines
*/
-#define __COBALT_bus_space_read_region(BYTES,BITS) \
-void __CONCAT(bus_space_read_region_,BYTES) \
- (bus_space_tag_t, bus_space_handle_t, bus_size_t, \
- __PB_TYPENAME(BITS) *, bus_size_t); \
- \
-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, \
- bus_size_t c) \
-{ \
- \
- while (c--) { \
- *a++ = __CONCAT(bus_space_read_,BYTES)(t, h, o); \
- o += BYTES; \
- } \
-}
+#include <sys/cdefs.h>
+__KERNEL_RCSID(0, "$NetBSD: bus.c,v 1.46 2018/01/20 13:56:08 skrll Exp $");
-__COBALT_bus_space_read_region(1,8)
-__COBALT_bus_space_read_region(2,16)
-__COBALT_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 __COBALT_bus_space_read_region
-
-/*
- * void bus_space_write_multi_N(bus_space_tag_t tag,
- * bus_space_handle_t bsh, bus_size_t offset,
- * const uintN_t *addr, bus_size_t count);
- *
- * Write `count' 1, 2, 4, or 8 byte quantities from the buffer
- * provided to bus space described by tag/handle/offset.
- */
+#include <sys/types.h>
+#include <sys/param.h>
+#include <sys/bus.h>
-#define __COBALT_bus_space_write_multi(BYTES,BITS) \
-void __CONCAT(bus_space_write_multi_,BYTES) \
- (bus_space_tag_t, bus_space_handle_t, bus_size_t, \
- const __PB_TYPENAME(BITS) *, bus_size_t); \
- \
-void \
-__CONCAT(bus_space_write_multi_,BYTES)( \
- bus_space_tag_t t, \
- bus_space_handle_t h, \
- bus_size_t o, \
- const __PB_TYPENAME(BITS) *a, \
- bus_size_t c) \
-{ \
- \
- while (c--) \
- __CONCAT(bus_space_write_,BYTES)(t, h, o, *a++); \
-}
-
-__COBALT_bus_space_write_multi(1,8)
-__COBALT_bus_space_write_multi(2,16)
-__COBALT_bus_space_write_multi(4,32)
-
-#if 0 /* Cause a link error for bus_space_write_8 */
-#define bus_space_write_multi_8(t, h, o, a, c) \
- !!! bus_space_write_multi_8 unimplimented !!!
-#endif
-
-#undef __COBALT_bus_space_write_multi
+#define CHIP mainbus
+#define CHIP_MEM /* defined */
-/*
- * void bus_space_write_region_N(bus_space_tag_t tag,
- * bus_space_handle_t bsh, bus_size_t offset,
- * const uintN_t *addr, bus_size_t count);
- *
- * Write `count' 1, 2, 4, or 8 byte quantities from the buffer provided
- * to bus space described by tag/handle starting at `offset'.
- */
-
-#define __COBALT_bus_space_write_region(BYTES,BITS) \
-void __CONCAT(bus_space_write_region_,BYTES) \
- (bus_space_tag_t, bus_space_handle_t, bus_size_t, \
- const __PB_TYPENAME(BITS) *, bus_size_t); \
- \
-void \
-__CONCAT(bus_space_write_region_,BYTES)( \
- bus_space_tag_t t, \
- bus_space_handle_t h, \
- bus_size_t o, \
- const __PB_TYPENAME(BITS) *a, \
- bus_size_t c) \
-{ \
- \
- while (c--) { \
- __CONCAT(bus_space_write_,BYTES)(t, h, o, *a++); \
- o += BYTES; \
- } \
-}
-
-__COBALT_bus_space_write_region(1,8)
-__COBALT_bus_space_write_region(2,16)
-__COBALT_bus_space_write_region(4,32)
-
-#if 0 /* Cause a link error for bus_space_write_region_8 */
-#define bus_space_write_region_8 \
- !!! bus_space_write_region_8 unimplemented !!!
+#if 0
+#define CHIP_EX_MALLOC_SAFE(v) (((struct p4032_config *)(v))->ac_mallocsafe)
+#define CHIP_EXTENT(v) (((struct p4032_config *)(v))->ac_io_ex)
#endif
-#undef __COBALT_bus_space_write_region
-
-/*
- * void bus_space_set_multi_N(bus_space_tag_t tag,
- * bus_space_handle_t bsh, bus_size_t offset, uintN_t val,
- * bus_size_t count);
- *
- * Write the 1, 2, 4, or 8 byte value `val' to bus space described
- * by tag/handle/offset `count' times.
- */
-
-#define __COBALT_bus_space_set_multi(BYTES,BITS) \
-void __CONCAT(bus_space_set_multi_,BYTES) \
- (bus_space_tag_t, bus_space_handle_t, bus_size_t, \
- __PB_TYPENAME(BITS), bus_size_t); \
- \
-void \
-__CONCAT(bus_space_set_multi_,BYTES)( \
- bus_space_tag_t t, \
- bus_space_handle_t h, \
- bus_size_t o, \
- __PB_TYPENAME(BITS) v, \
- bus_size_t c) \
-{ \
- \
- while (c--) \
- __CONCAT(bus_space_write_,BYTES)(t, h, o, v); \
-}
-
-__COBALT_bus_space_set_multi(1,8)
-__COBALT_bus_space_set_multi(2,16)
-__COBALT_bus_space_set_multi(4,32)
-
-#if 0 /* Cause a link error for bus_space_set_multi_8 */
-#define bus_space_set_multi_8 \
- !!! bus_space_set_multi_8 unimplemented !!!
-#endif
-
-#undef __COBALT_bus_space_set_multi
-
-/*
- * void bus_space_set_region_N(bus_space_tag_t tag,
- * bus_space_handle_t bsh, bus_size_t offset, uintN_t val,
- * bus_size_t count);
- *
- * Write `count' 1, 2, 4, or 8 byte value `val' to bus space described
- * by tag/handle starting at `offset'.
- */
-
-#define __COBALT_bus_space_set_region(BYTES,BITS) \
-void __CONCAT(bus_space_set_region_,BYTES) \
- (bus_space_tag_t, bus_space_handle_t, bus_size_t, \
- __PB_TYPENAME(BITS), bus_size_t); \
- \
-void \
-__CONCAT(bus_space_set_region_,BYTES)( \
- bus_space_tag_t t, \
- bus_space_handle_t h, \
- bus_size_t o, \
- __PB_TYPENAME(BITS) v, \
- bus_size_t c) \
-{ \
- \
- while (c--) { \
- __CONCAT(bus_space_write_,BYTES)(t, h, o, v); \
- o += BYTES; \
- } \
-}
-
-__COBALT_bus_space_set_region(1,8)
-__COBALT_bus_space_set_region(2,16)
-__COBALT_bus_space_set_region(4,32)
-
-#if 0 /* Cause a link error for bus_space_set_region_8 */
-#define bus_space_set_region_8 \
- !!! bus_space_set_region_8 unimplemented !!!
-#endif
-
-#undef __COBALT_bus_space_set_region
-
-/*
- * void bus_space_copy_region_N(bus_space_tag_t tag,
- * bus_space_handle_t bsh1, bus_size_t off1,
- * bus_space_handle_t bsh2, bus_size_t off2,
- * bus_size_t count);
- *
- * Copy `count' 1, 2, 4, or 8 byte values from bus space starting
- * at tag/bsh1/off1 to bus space starting at tag/bsh2/off2.
- */
+/* IO region 1 */
+#define CHIP_W1_BUS_START(v) 0x10000000UL
+#define CHIP_W1_BUS_END(v) 0x10000fffUL
+#define CHIP_W1_SYS_START(v) 0x10000000UL
+#define CHIP_W1_SYS_END(v) 0x10000fffUL
-#define __COBALT_copy_region(BYTES) \
-void __CONCAT(bus_space_copy_region_,BYTES) \
- (bus_space_tag_t, \
- bus_space_handle_t bsh1, bus_size_t off1, \
Home |
Main Index |
Thread Index |
Old Index