summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorkettenis <kettenis@openbsd.org>2017-04-27 10:57:05 +0000
committerkettenis <kettenis@openbsd.org>2017-04-27 10:57:05 +0000
commitfd8946ec40e1169d58d25d8a45148d461c9f037a (patch)
tree9123ee1f1655bf14e669f2656a4d685fb2787b96
parentAdd code to identify the CPUs on arm64 systems. The primary CPU is attached (diff)
downloadwireguard-openbsd-fd8946ec40e1169d58d25d8a45148d461c9f037a.tar.xz
wireguard-openbsd-fd8946ec40e1169d58d25d8a45148d461c9f037a.zip
Use (32-bit) word-sized access in the a4x bus space routine even if only
a byte or a half-word is needed. Certain implementations of the Synopsis Designware copy-and-paste logic blocks don't respond to transactions that are smaller than a word. Fixes the serial console on boards with a Rockchip RK3288.
-rw-r--r--sys/arch/arm/armv7/armv7_a4x_io.S12
-rw-r--r--sys/arch/arm64/dev/arm64_bus_space.c10
2 files changed, 10 insertions, 12 deletions
diff --git a/sys/arch/arm/armv7/armv7_a4x_io.S b/sys/arch/arm/armv7/armv7_a4x_io.S
index 7efc5cbaeb1..3fa09faa4c2 100644
--- a/sys/arch/arm/armv7/armv7_a4x_io.S
+++ b/sys/arch/arm/armv7/armv7_a4x_io.S
@@ -1,4 +1,4 @@
-/* $OpenBSD: armv7_a4x_io.S,v 1.1 2009/05/08 02:57:32 drahn Exp $ */
+/* $OpenBSD: armv7_a4x_io.S,v 1.2 2017/04/27 10:57:05 kettenis Exp $ */
/* $NetBSD: pxa2x0_a4x_io.S,v 1.1 2002/10/19 19:31:39 bsh Exp $ */
/*
@@ -50,12 +50,11 @@
*/
ENTRY(a4x_bs_r_1)
- ldrb r0, [r1, r2, LSL #2]
+ ldr r0, [r1, r2, LSL #2]
mov pc, lr
ENTRY(a4x_bs_r_2)
- mov r2, r2, LSL #2
- ldrh r0, [r1, r2]
+ ldr r0, [r1, r2, LSL #2]
mov pc, lr
ENTRY(a4x_bs_r_4)
@@ -67,12 +66,11 @@ ENTRY(a4x_bs_r_4)
*/
ENTRY(a4x_bs_w_1)
- strb r3, [r1, r2, LSL #2]
+ str r3, [r1, r2, LSL #2]
mov pc, lr
ENTRY(a4x_bs_w_2)
- mov r2, r2, LSL #2
- strh r3, [r1, r2]
+ str r3, [r1, r2, LSL #2]
mov pc, lr
ENTRY(a4x_bs_w_4)
diff --git a/sys/arch/arm64/dev/arm64_bus_space.c b/sys/arch/arm64/dev/arm64_bus_space.c
index 5f46a218bd2..f9247a19af1 100644
--- a/sys/arch/arm64/dev/arm64_bus_space.c
+++ b/sys/arch/arm64/dev/arm64_bus_space.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: arm64_bus_space.c,v 1.3 2017/02/17 19:20:22 patrick Exp $ */
+/* $OpenBSD: arm64_bus_space.c,v 1.4 2017/04/27 10:57:05 kettenis Exp $ */
/*
* Copyright (c) 2001-2003 Opsycon AB (www.opsycon.se / www.opsycon.com)
@@ -262,13 +262,13 @@ generic_space_vaddr(bus_space_tag_t t, bus_space_handle_t h)
uint8_t
a4x_space_read_1(bus_space_tag_t t, bus_space_handle_t h, bus_size_t o)
{
- return *(volatile uint8_t *)(h + (o*4));
+ return *(volatile uint32_t *)(h + (o*4));
}
uint16_t
a4x_space_read_2(bus_space_tag_t t, bus_space_handle_t h, bus_size_t o)
{
- return *(volatile uint16_t *)(h + (o*4));
+ return *(volatile uint32_t *)(h + (o*4));
}
uint32_t
@@ -287,14 +287,14 @@ void
a4x_space_write_1(bus_space_tag_t t, bus_space_handle_t h, bus_size_t o,
uint8_t v)
{
- *(volatile uint8_t *)(h + (o*4)) = v;
+ *(volatile uint32_t *)(h + (o*4)) = v;
}
void
a4x_space_write_2(bus_space_tag_t t, bus_space_handle_t h, bus_size_t o,
uint16_t v)
{
- *(volatile uint16_t *)(h + (o*4)) = v;
+ *(volatile uint32_t *)(h + (o*4)) = v;
}
void