Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch/mips/mips Make this play nicely with GCC 4.5. Whil...
details: https://anonhg.NetBSD.org/src/rev/2e7a98ea849c
branches: trunk
changeset: 766994:2e7a98ea849c
user: matt <matt%NetBSD.org@localhost>
date: Wed Jul 06 10:01:02 2011 +0000
description:
Make this play nicely with GCC 4.5. While there, make everything static,
get rid of global inlines, and move the init function to the end.
diffstat:
sys/arch/mips/mips/bus_space_alignstride_chipdep.c | 1893 +++++++++----------
1 files changed, 864 insertions(+), 1029 deletions(-)
diffs (truncated from 1925 to 300 lines):
diff -r 07bb0f0c0f39 -r 2e7a98ea849c sys/arch/mips/mips/bus_space_alignstride_chipdep.c
--- a/sys/arch/mips/mips/bus_space_alignstride_chipdep.c Wed Jul 06 09:27:35 2011 +0000
+++ b/sys/arch/mips/mips/bus_space_alignstride_chipdep.c Wed Jul 06 10:01:02 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: bus_space_alignstride_chipdep.c,v 1.13 2011/02/20 07:45:47 matt Exp $ */
+/* $NetBSD: bus_space_alignstride_chipdep.c,v 1.14 2011/07/06 10:01:02 matt Exp $ */
/*-
* Copyright (c) 1998, 2000, 2001 The NetBSD Foundation, Inc.
@@ -81,7 +81,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: bus_space_alignstride_chipdep.c,v 1.13 2011/02/20 07:45:47 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: bus_space_alignstride_chipdep.c,v 1.14 2011/07/06 10:01:02 matt Exp $");
#ifdef CHIP_EXTENT
#include <sys/extent.h>
@@ -181,172 +181,6 @@
#error "Invalid chip access size!"
#endif
-/* mapping/unmapping */
-int __BS(map)(void *, bus_addr_t, bus_size_t, int,
- bus_space_handle_t *, int);
-void __BS(unmap)(void *, bus_space_handle_t, bus_size_t, int);
-int __BS(subregion)(void *, bus_space_handle_t, bus_size_t,
- bus_size_t, bus_space_handle_t *);
-
-int __BS(translate)(void *, bus_addr_t, bus_size_t, int,
- struct mips_bus_space_translation *);
-int __BS(get_window)(void *, int,
- struct mips_bus_space_translation *);
-
-/* allocation/deallocation */
-int __BS(alloc)(void *, bus_addr_t, bus_addr_t, bus_size_t,
- bus_size_t, bus_addr_t, int, bus_addr_t *,
- bus_space_handle_t *);
-void __BS(free)(void *, bus_space_handle_t, bus_size_t);
-
-/* get kernel virtual address */
-void * __BS(vaddr)(void *, bus_space_handle_t);
-
-/* mmap for user */
-paddr_t __BS(mmap)(void *, bus_addr_t, off_t, int, int);
-
-/* barrier */
-inline void __BS(barrier)(void *, bus_space_handle_t, bus_size_t,
- bus_size_t, int);
-
-/* read (single) */
-inline uint8_t __BS(read_1)(void *, bus_space_handle_t, bus_size_t);
-inline uint16_t __BS(read_2)(void *, bus_space_handle_t, bus_size_t);
-inline uint32_t __BS(read_4)(void *, bus_space_handle_t, bus_size_t);
-inline uint64_t __BS(read_8)(void *, bus_space_handle_t, bus_size_t);
-
-/* read multiple */
-void __BS(read_multi_1)(void *, bus_space_handle_t, bus_size_t,
- uint8_t *, bus_size_t);
-void __BS(read_multi_2)(void *, bus_space_handle_t, bus_size_t,
- uint16_t *, bus_size_t);
-void __BS(read_multi_4)(void *, bus_space_handle_t, bus_size_t,
- uint32_t *, bus_size_t);
-void __BS(read_multi_8)(void *, bus_space_handle_t, bus_size_t,
- uint64_t *, bus_size_t);
-
-/* read region */
-void __BS(read_region_1)(void *, bus_space_handle_t, bus_size_t,
- uint8_t *, bus_size_t);
-void __BS(read_region_2)(void *, bus_space_handle_t, bus_size_t,
- uint16_t *, bus_size_t);
-void __BS(read_region_4)(void *, bus_space_handle_t, bus_size_t,
- uint32_t *, bus_size_t);
-void __BS(read_region_8)(void *, bus_space_handle_t, bus_size_t,
- uint64_t *, bus_size_t);
-
-/* write (single) */
-inline void __BS(write_1)(void *, bus_space_handle_t, bus_size_t, uint8_t);
-inline void __BS(write_2)(void *, bus_space_handle_t, bus_size_t, uint16_t);
-inline void __BS(write_4)(void *, bus_space_handle_t, bus_size_t, uint32_t);
-inline void __BS(write_8)(void *, bus_space_handle_t, bus_size_t, uint64_t);
-
-/* write multiple */
-void __BS(write_multi_1)(void *, bus_space_handle_t, bus_size_t,
- const uint8_t *, bus_size_t);
-void __BS(write_multi_2)(void *, bus_space_handle_t, bus_size_t,
- const uint16_t *, bus_size_t);
-void __BS(write_multi_4)(void *, bus_space_handle_t, bus_size_t,
- const uint32_t *, bus_size_t);
-void __BS(write_multi_8)(void *, bus_space_handle_t, bus_size_t,
- const uint64_t *, bus_size_t);
-
-/* write region */
-void __BS(write_region_1)(void *, bus_space_handle_t, bus_size_t,
- const uint8_t *, bus_size_t);
-void __BS(write_region_2)(void *, bus_space_handle_t, bus_size_t,
- const uint16_t *, bus_size_t);
-void __BS(write_region_4)(void *, bus_space_handle_t, bus_size_t,
- const uint32_t *, bus_size_t);
-void __BS(write_region_8)(void *, bus_space_handle_t, bus_size_t,
- const uint64_t *, bus_size_t);
-
-/* set multiple */
-void __BS(set_multi_1)(void *, bus_space_handle_t, bus_size_t,
- uint8_t, bus_size_t);
-void __BS(set_multi_2)(void *, bus_space_handle_t, bus_size_t,
- uint16_t, bus_size_t);
-void __BS(set_multi_4)(void *, bus_space_handle_t, bus_size_t,
- uint32_t, bus_size_t);
-void __BS(set_multi_8)(void *, bus_space_handle_t, bus_size_t,
- uint64_t, bus_size_t);
-
-/* set region */
-void __BS(set_region_1)(void *, bus_space_handle_t, bus_size_t,
- uint8_t, bus_size_t);
-void __BS(set_region_2)(void *, bus_space_handle_t, bus_size_t,
- uint16_t, bus_size_t);
-void __BS(set_region_4)(void *, bus_space_handle_t, bus_size_t,
- uint32_t, bus_size_t);
-void __BS(set_region_8)(void *, bus_space_handle_t, bus_size_t,
- uint64_t, bus_size_t);
-
-/* copy */
-void __BS(copy_region_1)(void *, bus_space_handle_t, bus_size_t,
- bus_space_handle_t, bus_size_t, bus_size_t);
-void __BS(copy_region_2)(void *, bus_space_handle_t, bus_size_t,
- bus_space_handle_t, bus_size_t, bus_size_t);
-void __BS(copy_region_4)(void *, bus_space_handle_t, bus_size_t,
- bus_space_handle_t, bus_size_t, bus_size_t);
-void __BS(copy_region_8)(void *, bus_space_handle_t, bus_size_t,
- bus_space_handle_t, bus_size_t, bus_size_t);
-
-#ifdef CHIP_NEED_STREAM
-
-/* read (single), stream */
-inline uint8_t __BS(read_stream_1)(void *, bus_space_handle_t, bus_size_t);
-inline uint16_t __BS(read_stream_2)(void *, bus_space_handle_t, bus_size_t);
-inline uint32_t __BS(read_stream_4)(void *, bus_space_handle_t, bus_size_t);
-inline uint64_t __BS(read_stream_8)(void *, bus_space_handle_t, bus_size_t);
-
-/* read multiple, stream */
-void __BS(read_multi_stream_1)(void *, bus_space_handle_t, bus_size_t,
- uint8_t *, bus_size_t);
-void __BS(read_multi_stream_2)(void *, bus_space_handle_t, bus_size_t,
- uint16_t *, bus_size_t);
-void __BS(read_multi_stream_4)(void *, bus_space_handle_t, bus_size_t,
- uint32_t *, bus_size_t);
-void __BS(read_multi_stream_8)(void *, bus_space_handle_t, bus_size_t,
- uint64_t *, bus_size_t);
-
-/* read region, stream */
-void __BS(read_region_stream_1)(void *, bus_space_handle_t, bus_size_t,
- uint8_t *, bus_size_t);
-void __BS(read_region_stream_2)(void *, bus_space_handle_t, bus_size_t,
- uint16_t *, bus_size_t);
-void __BS(read_region_stream_4)(void *, bus_space_handle_t, bus_size_t,
- uint32_t *, bus_size_t);
-void __BS(read_region_stream_8)(void *, bus_space_handle_t, bus_size_t,
- uint64_t *, bus_size_t);
-
-/* write (single), stream */
-inline void __BS(write_stream_1)(void *, bus_space_handle_t, bus_size_t, uint8_t);
-inline void __BS(write_stream_2)(void *, bus_space_handle_t, bus_size_t, uint16_t);
-inline void __BS(write_stream_4)(void *, bus_space_handle_t, bus_size_t, uint32_t);
-inline void __BS(write_stream_8)(void *, bus_space_handle_t, bus_size_t, uint64_t);
-
-/* write multiple, stream */
-void __BS(write_multi_stream_1)(void *, bus_space_handle_t, bus_size_t,
- const uint8_t *, bus_size_t);
-void __BS(write_multi_stream_2)(void *, bus_space_handle_t, bus_size_t,
- const uint16_t *, bus_size_t);
-void __BS(write_multi_stream_4)(void *, bus_space_handle_t, bus_size_t,
- const uint32_t *, bus_size_t);
-void __BS(write_multi_stream_8)(void *, bus_space_handle_t, bus_size_t,
- const uint64_t *, bus_size_t);
-
-/* write region, stream */
-void __BS(write_region_stream_1)(void *, bus_space_handle_t, bus_size_t,
- const uint8_t *, bus_size_t);
-void __BS(write_region_stream_2)(void *, bus_space_handle_t, bus_size_t,
- const uint16_t *, bus_size_t);
-void __BS(write_region_stream_4)(void *, bus_space_handle_t, bus_size_t,
- const uint32_t *, bus_size_t);
-void __BS(write_region_stream_8)(void *, bus_space_handle_t, bus_size_t,
- const uint64_t *, bus_size_t);
-
-#endif /* CHIP_NEED_STREAM */
-
#ifdef CHIP_EXTENT
#ifndef CHIP_EX_STORE
static long
@@ -385,6 +219,868 @@
#endif
+static int
+__BS(get_window)(void *v, int window, struct mips_bus_space_translation *mbst)
+{
+
+ switch (window) {
+#ifdef CHIP_W1_BUS_START
+ case 0:
+ mbst->mbst_bus_start = CHIP_W1_BUS_START(v);
+ mbst->mbst_bus_end = CHIP_W1_BUS_END(v);
+ mbst->mbst_sys_start = CHIP_W1_SYS_START(v);
+ mbst->mbst_sys_end = CHIP_W1_SYS_END(v);
+ mbst->mbst_align_stride = CHIP_ALIGN_STRIDE;
+ mbst->mbst_flags = 0;
+ break;
+#endif
+
+#ifdef CHIP_W2_BUS_START
+ case 1:
+ mbst->mbst_bus_start = CHIP_W2_BUS_START(v);
+ mbst->mbst_bus_end = CHIP_W2_BUS_END(v);
+ mbst->mbst_sys_start = CHIP_W2_SYS_START(v);
+ mbst->mbst_sys_end = CHIP_W2_SYS_END(v);
+ mbst->mbst_align_stride = CHIP_ALIGN_STRIDE;
+ mbst->mbst_flags = 0;
+ break;
+#endif
+
+#ifdef CHIP_W3_BUS_START
+ case 2:
+ mbst->mbst_bus_start = CHIP_W3_BUS_START(v);
+ mbst->mbst_bus_end = CHIP_W3_BUS_END(v);
+ mbst->mbst_sys_start = CHIP_W3_SYS_START(v);
+ mbst->mbst_sys_end = CHIP_W3_SYS_END(v);
+ mbst->mbst_align_stride = CHIP_ALIGN_STRIDE;
+ mbst->mbst_flags = 0;
+ break;
+#endif
+
+ default:
+ panic(__S(__BS(get_window)) ": invalid window %d",
+ window);
+ }
+
+ return (0);
+}
+
+static int
+__BS(translate)(void *v, bus_addr_t addr, bus_size_t len, int flags,
+ struct mips_bus_space_translation *mbst)
+{
+ bus_addr_t end = addr + (len - 1);
+#if CHIP_ALIGN_STRIDE != 0
+ int linear = flags & BUS_SPACE_MAP_LINEAR;
+
+ /*
+ * Can't map xxx space linearly.
+ */
+ if (linear)
+ return (EOPNOTSUPP);
+#endif
+
+#ifdef CHIP_W1_BUS_START
+ if (addr >= CHIP_W1_BUS_START(v) && end <= CHIP_W1_BUS_END(v))
+ return (__BS(get_window)(v, 0, mbst));
+#endif
+
+#ifdef CHIP_W2_BUS_START
+ if (addr >= CHIP_W2_BUS_START(v) && end <= CHIP_W2_BUS_END(v))
+ return (__BS(get_window)(v, 1, mbst));
+#endif
+
+#ifdef CHIP_W3_BUS_START
+ if (addr >= CHIP_W3_BUS_START(v) && end <= CHIP_W3_BUS_END(v))
+ return (__BS(get_window)(v, 2, mbst));
+#endif
+
+#ifdef EXTENT_DEBUG
+ printf("\n");
+#ifdef CHIP_W1_BUS_START
+ printf("%s: window[1]=0x%lx-0x%lx\n", __S(__BS(map)),
+ (u_long)CHIP_W1_BUS_START(v), (u_long)CHIP_W1_BUS_END(v));
+#endif
+#ifdef CHIP_W2_BUS_START
+ printf("%s: window[2]=0x%lx-0x%lx\n", __S(__BS(map)),
+ (u_long)CHIP_W2_BUS_START(v), (u_long)CHIP_W2_BUS_END(v));
+#endif
+#ifdef CHIP_W3_BUS_START
+ printf("%s: window[3]=0x%lx-0x%lx\n", __S(__BS(map)),
+ (u_long)CHIP_W3_BUS_START(v), (u_long)CHIP_W3_BUS_END(v));
+#endif
+#endif /* EXTENT_DEBUG */
+ /* No translation. */
+ return (EINVAL);
+}
+
+static int
+__BS(map)(void *v, bus_addr_t addr, bus_size_t size, int flags,
+ bus_space_handle_t *hp, int acct)
+{
+ struct mips_bus_space_translation mbst;
+ int error;
+
+ /*
+ * Get the translation for this address.
+ */
Home |
Main Index |
Thread Index |
Old Index