summaryrefslogtreecommitdiff
path: root/sys/arch
diff options
context:
space:
mode:
authorPatrick Wildt <patrick@cvs.openbsd.org>2016-10-05 07:44:25 +0000
committerPatrick Wildt <patrick@cvs.openbsd.org>2016-10-05 07:44:25 +0000
commit513ee62128d212b0fe5d59f65d6eb121e9736702 (patch)
treec79175ad897919873d5420c0ca3e449b58c3c662 /sys/arch
parentfc3f943158b70e208265cb5b52b20953505e3865 (diff)
Some device trees use 64-bit intermediate virtual addresses. This
means that even though the hardware in the end never leaves the 32-bit address space, some addresses used solely in the device tree can be bigger than 32-bit. As bus_space_map(9) takes addresses of size bus_addr_t, which is 32-bit on ARMv7, we cannot pass those virtual addresses to the parent bus, even though it will be mapped back into a 32-bit address in the end. To work around this, make bus_space_map(9) take a 64-bit address. Since this is implemented as a macro and function pointer we can safely do that without harming any other architecture. ok kettenis@ deraadt@
Diffstat (limited to 'sys/arch')
-rw-r--r--sys/arch/arm/armv7/armv7_space.c4
-rw-r--r--sys/arch/arm/include/bus.h6
-rw-r--r--sys/arch/arm/simplebus/simplebus.c6
-rw-r--r--sys/arch/armv7/armv7/armv7_machdep.c8
4 files changed, 12 insertions, 12 deletions
diff --git a/sys/arch/arm/armv7/armv7_space.c b/sys/arch/arm/armv7/armv7_space.c
index 4f6c1e04e73..c7e9b686b8f 100644
--- a/sys/arch/arm/armv7/armv7_space.c
+++ b/sys/arch/arm/armv7/armv7_space.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: armv7_space.c,v 1.8 2016/08/08 14:47:52 kettenis Exp $ */
+/* $OpenBSD: armv7_space.c,v 1.9 2016/10/05 07:44:24 patrick Exp $ */
/*
* Copyright (c) 2001, 2002 Wasabi Systems, Inc.
@@ -165,7 +165,7 @@ struct bus_space armv7_bs_tag = {
};
int
-armv7_bs_map(void *t, bus_addr_t bpa, bus_size_t size,
+armv7_bs_map(void *t, uint64_t bpa, bus_size_t size,
int flags, bus_space_handle_t *bshp)
{
u_long startpa, endpa, pa;
diff --git a/sys/arch/arm/include/bus.h b/sys/arch/arm/include/bus.h
index f00c897d4be..10b214a7579 100644
--- a/sys/arch/arm/include/bus.h
+++ b/sys/arch/arm/include/bus.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: bus.h,v 1.15 2016/08/26 21:50:43 patrick Exp $ */
+/* $OpenBSD: bus.h,v 1.16 2016/10/05 07:44:24 patrick Exp $ */
/* $NetBSD: bus.h,v 1.12 2003/10/23 15:03:24 scw Exp $ */
/*-
@@ -93,7 +93,7 @@ struct bus_space {
void *bs_cookie;
/* mapping/unmapping */
- int (*bs_map) (void *, bus_addr_t, bus_size_t,
+ int (*bs_map) (void *, uint64_t, bus_size_t,
int, bus_space_handle_t *);
void (*bs_unmap) (void *, bus_space_handle_t,
bus_size_t);
@@ -373,7 +373,7 @@ struct bus_space {
*/
#define bs_map_proto(f) \
-int __bs_c(f,_bs_map) (void *t, bus_addr_t addr, \
+int __bs_c(f,_bs_map) (void *t, uint64_t addr, \
bus_size_t size, int flags, bus_space_handle_t *bshp);
#define bs_unmap_proto(f) \
diff --git a/sys/arch/arm/simplebus/simplebus.c b/sys/arch/arm/simplebus/simplebus.c
index d2f5bfe8b8d..71ffe0dc080 100644
--- a/sys/arch/arm/simplebus/simplebus.c
+++ b/sys/arch/arm/simplebus/simplebus.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: simplebus.c,v 1.9 2016/09/18 17:50:26 kettenis Exp $ */
+/* $OpenBSD: simplebus.c,v 1.10 2016/10/05 07:44:24 patrick Exp $ */
/*
* Copyright (c) 2016 Patrick Wildt <patrick@blueri.se>
*
@@ -30,7 +30,7 @@ int simplebus_match(struct device *, void *, void *);
void simplebus_attach(struct device *, struct device *, void *);
void simplebus_attach_node(struct device *, int);
-int simplebus_bs_map(void *, bus_addr_t, bus_size_t, int, bus_space_handle_t *);
+int simplebus_bs_map(void *, uint64_t, bus_size_t, int, bus_space_handle_t *);
struct simplebus_softc {
struct device sc_dev;
@@ -205,7 +205,7 @@ simplebus_attach_node(struct device *self, int node)
* Translate memory address if needed.
*/
int
-simplebus_bs_map(void *t, bus_addr_t bpa, bus_size_t size,
+simplebus_bs_map(void *t, uint64_t bpa, bus_size_t size,
int flag, bus_space_handle_t *bshp)
{
struct simplebus_softc *sc = (struct simplebus_softc *)t;
diff --git a/sys/arch/armv7/armv7/armv7_machdep.c b/sys/arch/armv7/armv7/armv7_machdep.c
index bd5ea253766..419c8050569 100644
--- a/sys/arch/armv7/armv7/armv7_machdep.c
+++ b/sys/arch/armv7/armv7/armv7_machdep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: armv7_machdep.c,v 1.41 2016/10/05 07:29:59 patrick Exp $ */
+/* $OpenBSD: armv7_machdep.c,v 1.42 2016/10/05 07:44:24 patrick Exp $ */
/* $NetBSD: lubbock_machdep.c,v 1.2 2003/07/15 00:25:06 lukem Exp $ */
/*
@@ -199,7 +199,7 @@ int safepri = 0;
/* Prototypes */
char bootargs[MAX_BOOT_STRING];
-int bootstrap_bs_map(void *, bus_addr_t, bus_size_t, int,
+int bootstrap_bs_map(void *, uint64_t, bus_size_t, int,
bus_space_handle_t *);
void process_kernel_args(char *);
void consinit(void);
@@ -322,7 +322,7 @@ read_ttb(void)
static vaddr_t section_free = 0xfd000000; /* XXX - huh */
int
-bootstrap_bs_map(void *t, bus_addr_t bpa, bus_size_t size,
+bootstrap_bs_map(void *t, uint64_t bpa, bus_size_t size,
int flags, bus_space_handle_t *bshp)
{
u_long startpa, pa, endpa;
@@ -397,7 +397,7 @@ initarm(void *arg0, void *arg1, void *arg2, paddr_t loadaddr)
/* early bus_space_map support */
struct bus_space tmp_bs_tag;
- int (*map_func_save)(void *, bus_addr_t, bus_size_t, int,
+ int (*map_func_save)(void *, uint64_t, bus_size_t, int,
bus_space_handle_t *);
if (arg0)