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 use mips3_ld() and mips3_sd() for all acc...
details: https://anonhg.NetBSD.org/src/rev/1a7d7fd8d864
branches: trunk
changeset: 341152:1a7d7fd8d864
user: macallan <macallan%NetBSD.org@localhost>
date: Wed Oct 21 15:47:19 2015 +0000
description:
use mips3_ld() and mips3_sd() for all accesses if CHIP_ACCESS_SIZE == 8 and
we're on o32
Now serial console works on O2 with o32 kernels again
diffstat:
sys/arch/mips/mips/bus_space_alignstride_chipdep.c | 57 +++++++++++++++++++--
1 files changed, 51 insertions(+), 6 deletions(-)
diffs (166 lines):
diff -r ca0a563436f6 -r 1a7d7fd8d864 sys/arch/mips/mips/bus_space_alignstride_chipdep.c
--- a/sys/arch/mips/mips/bus_space_alignstride_chipdep.c Wed Oct 21 15:37:35 2015 +0000
+++ b/sys/arch/mips/mips/bus_space_alignstride_chipdep.c Wed Oct 21 15:47:19 2015 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: bus_space_alignstride_chipdep.c,v 1.23 2015/02/27 14:44:16 macallan Exp $ */
+/* $NetBSD: bus_space_alignstride_chipdep.c,v 1.24 2015/10/21 15:47:19 macallan Exp $ */
/*-
* Copyright (c) 1998, 2000, 2001 The NetBSD Foundation, Inc.
@@ -86,7 +86,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: bus_space_alignstride_chipdep.c,v 1.23 2015/02/27 14:44:16 macallan Exp $");
+__KERNEL_RCSID(0, "$NetBSD: bus_space_alignstride_chipdep.c,v 1.24 2015/10/21 15:47:19 macallan Exp $");
#ifdef CHIP_EXTENT
#include <sys/extent.h>
@@ -685,8 +685,11 @@
shift = (h & (CHIP_ACCESS_SIZE - 1)) * 8;
ptr = (void *)(h & ~((bus_space_handle_t)(CHIP_ACCESS_SIZE - 1)));
- r = (uint8_t)(CHIP_SWAP_ACCESS(*ptr) >> shift);
-
+#if defined(NEED_64BIT_ASM) && (CHIP_ACCESS_SIZE == 8)
+ r = (uint8_t)(CHIP_SWAP_ACCESS(mips3_ld(ptr)) >> shift);
+#else
+ r = (uint8_t)(CHIP_SWAP_ACCESS(*ptr) >> shift);
+#endif
return r;
}
@@ -705,8 +708,11 @@
h += CHIP_OFF16(off);
shift = (h & (CHIP_ACCESS_SIZE - 1)) * 8;
ptr = (void *)(h & ~((bus_space_handle_t)(CHIP_ACCESS_SIZE - 1)));
+#if defined(NEED_64BIT_ASM) && (CHIP_ACCESS_SIZE == 8)
+ r = (uint16_t)CHIP_SWAP16(mips3_ld(ptr) >> shift);
+#else
r = (uint16_t)CHIP_SWAP16(*ptr >> shift);
-
+#endif
return r;
}
@@ -725,8 +731,11 @@
h += CHIP_OFF32(off);
shift = (h & (CHIP_ACCESS_SIZE - 1)) * 8;
ptr = (void *)(h & ~((bus_space_handle_t)(CHIP_ACCESS_SIZE - 1)));
+#if defined(NEED_64BIT_ASM) && (CHIP_ACCESS_SIZE == 8)
+ r = (uint32_t)CHIP_SWAP32(mips3_ld(ptr) >> shift);
+#else
r = (uint32_t)CHIP_SWAP32(*ptr >> shift);
-
+#endif
return r;
}
@@ -798,7 +807,11 @@
h += CHIP_OFF8(off);
shift = (h & (CHIP_ACCESS_SIZE - 1)) * 8;
ptr = (void *)(h & ~((bus_space_handle_t)(CHIP_ACCESS_SIZE - 1)));
+#if defined(NEED_64BIT_ASM) && (CHIP_ACCESS_SIZE == 8)
+ mips3_sd(ptr, CHIP_SWAP_ACCESS(((CHIP_TYPE)val) << shift));
+#else
*ptr = CHIP_SWAP_ACCESS(((CHIP_TYPE)val) << shift);
+#endif
}
static void
@@ -816,7 +829,11 @@
shift = (h & (CHIP_ACCESS_SIZE - 1)) * 8;
ptr = (void *)(h & ~((bus_space_handle_t)(CHIP_ACCESS_SIZE - 1)));
if (CHIP_ACCESS_SIZE > 2)
+#if defined(NEED_64BIT_ASM) && (CHIP_ACCESS_SIZE == 8)
+ mips3_sd(ptr, (CHIP_TYPE)(CHIP_SWAP16(val)) << shift);
+#else
*ptr = (CHIP_TYPE)(CHIP_SWAP16(val)) << shift;
+#endif
else
*ptr = CHIP_SWAP16(val);
}
@@ -836,7 +853,11 @@
shift = (h & (CHIP_ACCESS_SIZE - 1)) * 8;
ptr = (void *)(h & ~((bus_space_handle_t)(CHIP_ACCESS_SIZE - 1)));
if (CHIP_ACCESS_SIZE > 4)
+#if defined(NEED_64BIT_ASM) && (CHIP_ACCESS_SIZE == 8)
+ mips3_sd(ptr, (CHIP_TYPE)(CHIP_SWAP32(val)) << shift);
+#else
*ptr = (CHIP_TYPE)(CHIP_SWAP32(val)) << shift;
+#endif
else
*ptr = CHIP_SWAP32(val);
}
@@ -960,7 +981,11 @@
#endif /* CHIP_ACCESS_SIZE > 1 */
ptr = (void *)(intptr_t)(h + CHIP_OFF8(off));
+#if defined(NEED_64BIT_ASM) && (CHIP_ACCESS_SIZE == 8)
+ return mips3_ld(ptr) & 0xff;
+#else
return *ptr & 0xff;
+#endif
}
static uint16_t
@@ -973,7 +998,11 @@
#endif /* CHIP_ACCESS_SIZE > 2 */
ptr = (void *)(intptr_t)(h + CHIP_OFF16(off));
+#if defined(NEED_64BIT_ASM) && (CHIP_ACCESS_SIZE == 8)
+ return mips3_ld(ptr) & 0xffff;
+#else
return *ptr & 0xffff;
+#endif
}
static uint32_t
@@ -986,7 +1015,11 @@
#endif
ptr = (void *)(intptr_t)(h + CHIP_OFF32(off));
+#if defined(NEED_64BIT_ASM) && (CHIP_ACCESS_SIZE == 8)
+ return mips3_ld(ptr) & 0xffffffff;
+#else
return *ptr & 0xffffffff;
+#endif
}
static uint64_t
@@ -1046,7 +1079,11 @@
#endif /* CHIP_ACCESS_SIZE > 1 */
ptr = (void *)(intptr_t)(h + CHIP_OFF8(off));
+#if defined(NEED_64BIT_ASM) && (CHIP_ACCESS_SIZE == 8)
+ mips3_sd(ptr, val);
+#else
*ptr = val;
+#endif
}
static void
@@ -1060,7 +1097,11 @@
#endif /* CHIP_ACCESS_SIZE > 2 */
ptr = (void *)(intptr_t)(h + CHIP_OFF16(off));
+#if defined(NEED_64BIT_ASM) && (CHIP_ACCESS_SIZE == 8)
+ mips3_sd(ptr, val);
+#else
*ptr = val;
+#endif
}
static void
@@ -1074,7 +1115,11 @@
#endif /* CHIP_ACCESS_SIZE > 4 */
ptr = (void *)(intptr_t)(h + CHIP_OFF32(off));
+#if defined(NEED_64BIT_ASM) && (CHIP_ACCESS_SIZE == 8)
+ mips3_sd(ptr, val);
+#else
*ptr = val;
+#endif
}
static void
Home |
Main Index |
Thread Index |
Old Index