Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch/epoc32/epoc32 Fix bus_space_{read, write}_region_2.
details: https://anonhg.NetBSD.org/src/rev/42b553944a49
branches: trunk
changeset: 787537:42b553944a49
user: kiyohara <kiyohara%NetBSD.org@localhost>
date: Sat Jun 22 13:32:54 2013 +0000
description:
Fix bus_space_{read,write}_region_2.
Remove bus_space_{read,write}_2. ARM7 can't read/write half word access.
diffstat:
sys/arch/epoc32/epoc32/external_io.c | 40 +++++++++++++++++++++++--------
sys/arch/epoc32/epoc32/external_io_asm.S | 16 +------------
2 files changed, 30 insertions(+), 26 deletions(-)
diffs (132 lines):
diff -r b936af8591cc -r 42b553944a49 sys/arch/epoc32/epoc32/external_io.c
--- a/sys/arch/epoc32/epoc32/external_io.c Sat Jun 22 13:09:07 2013 +0000
+++ b/sys/arch/epoc32/epoc32/external_io.c Sat Jun 22 13:32:54 2013 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: external_io.c,v 1.1 2013/04/28 12:11:26 kiyohara Exp $ */
+/* $NetBSD: external_io.c,v 1.2 2013/06/22 13:32:54 kiyohara Exp $ */
/*
* Copyright (c) 1997 Mark Brinicombe.
@@ -37,7 +37,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: external_io.c,v 1.1 2013/04/28 12:11:26 kiyohara Exp $");
+__KERNEL_RCSID(0, "$NetBSD: external_io.c,v 1.2 2013/06/22 13:32:54 kiyohara Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -74,7 +74,7 @@
/* read (single) */
external_bs_r_1,
- external_bs_r_2,
+ bs_notimpl_bs_r_2,
external_bs_r_4,
bs_notimpl_bs_r_8,
@@ -92,7 +92,7 @@
/* write (single) */
external_bs_w_1,
- external_bs_w_2,
+ bs_notimpl_bs_w_2,
external_bs_w_4,
bs_notimpl_bs_w_8,
@@ -130,7 +130,8 @@
/* bus space functions */
int
-external_bs_subregion(void *t, bus_space_handle_t bsh, bus_size_t offset, bus_size_t size, bus_space_handle_t *nbshp)
+external_bs_subregion(void *t, bus_space_handle_t bsh, bus_size_t offset,
+ bus_size_t size, bus_space_handle_t *nbshp)
{
*nbshp = bsh + offset;
@@ -154,8 +155,13 @@
{
int i;
- for (i = 0; i < count; i++)
- datap[i] = external_bs_r_2(cookie, bsh, offset + i);
+ for (i = 0; count - i > 1 && i < count; i += 2)
+ *(uint32_t *)(&datap[i]) =
+ external_bs_r_4(cookie, bsh, offset + (i << 1));
+ for (; i < count; i++)
+ datap[i] =
+ external_bs_r_1(cookie, bsh, offset + (i << 1)) |
+ external_bs_r_1(cookie, bsh, offset + (i << 1) + 1);
}
void
@@ -173,9 +179,16 @@
bus_size_t offset, uint16_t const *datap, bus_size_t count)
{
int i;
+ uint16_t v;
- for (i = 0; i < count; i++)
- external_bs_w_2(cookie, bsh, offset + i, datap[i]);
+ for (i = 0; count - i > 1 && i < count; i += 2)
+ external_bs_w_4(cookie, bsh, offset + (i << 1),
+ *(const uint32_t *)(&datap[i]));
+ for (; i < count; i++) {
+ v = datap[i];
+ external_bs_w_1(cookie, bsh, offset + (i << 1), v & 0xff);
+ external_bs_w_1(cookie, bsh, offset + (i << 1) + 1, v >> 8);
+ }
}
void
@@ -194,6 +207,11 @@
{
int i;
- for (i = 0; i < count; i++)
- external_bs_w_2(cookie, bsh, offset + i, value);
+ for (i = 0; count - i > 1 && i < count; i += 2)
+ external_bs_w_4(cookie, bsh, offset + (i << 1),
+ value | (value << 16));
+ for (; i < count; i++) {
+ external_bs_w_1(cookie, bsh, offset + (i << 1), value & 0xff);
+ external_bs_w_1(cookie, bsh, offset + (i << 1) + 1, value >> 8);
+ }
}
diff -r b936af8591cc -r 42b553944a49 sys/arch/epoc32/epoc32/external_io_asm.S
--- a/sys/arch/epoc32/epoc32/external_io_asm.S Sat Jun 22 13:09:07 2013 +0000
+++ b/sys/arch/epoc32/epoc32/external_io_asm.S Sat Jun 22 13:32:54 2013 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: external_io_asm.S,v 1.1 2013/04/28 12:11:26 kiyohara Exp $ */
+/* $NetBSD: external_io_asm.S,v 1.2 2013/06/22 13:32:54 kiyohara Exp $ */
/*
* Copyright (c) 1997 Mark Brinicombe.
@@ -47,13 +47,6 @@
ldrb r0, [r1, r2]
mov pc, lr
-ENTRY(external_bs_r_2)
- mov r2, r2, lsl r0
- ldr r0, [r1, r2]
- bic r0, r0, #0xff000000
- bic r0, r0, #0x00ff0000
- mov pc, lr
-
ENTRY(external_bs_r_4)
mov r2, r2, lsl r0
ldr r0, [r1, r2]
@@ -68,13 +61,6 @@
strb r3, [r1, r2]
mov pc, lr
-ENTRY(external_bs_w_2)
- mov r3, r3, lsl #16
- orr r3, r3, r3, lsr #16
- mov r2, r2, lsl r0
- str r3, [r1, r2]
- mov pc, lr
-
ENTRY(external_bs_w_4)
mov r2, r2, lsl r0
str r3, [r1, r2]
Home |
Main Index |
Thread Index |
Old Index