diff options
author | 2015-07-15 21:09:40 +0000 | |
---|---|---|
committer | 2015-07-15 21:09:40 +0000 | |
commit | a6e676003cecf4cc181955448fa6a67ff0b0e433 (patch) | |
tree | 366736f3c3ae93fa628ffc938f6334cbc9529199 | |
parent | Drop comments; we already have a fully documented file under (diff) | |
download | wireguard-openbsd-a6e676003cecf4cc181955448fa6a67ff0b0e433.tar.xz wireguard-openbsd-a6e676003cecf4cc181955448fa6a67ff0b0e433.zip |
The exynos gic is not at a fixed offset from periphbase unlike
the other socs. Handle this by setting variables in exynos{4,5}_init
functions and calling the board_init callback earlier.
tested by and ok bmercer@
-rw-r--r-- | sys/arch/arm/cortex/ampintc.c | 14 | ||||
-rw-r--r-- | sys/arch/armv7/armv7/armv7.c | 3 | ||||
-rw-r--r-- | sys/arch/armv7/armv7/armv7_machdep.h | 4 | ||||
-rw-r--r-- | sys/arch/armv7/armv7/platform.c | 9 | ||||
-rw-r--r-- | sys/arch/armv7/exynos/exynos4.c | 14 | ||||
-rw-r--r-- | sys/arch/armv7/exynos/exynos5.c | 14 |
6 files changed, 43 insertions, 15 deletions
diff --git a/sys/arch/arm/cortex/ampintc.c b/sys/arch/arm/cortex/ampintc.c index 93451727680..64c53cb419d 100644 --- a/sys/arch/arm/cortex/ampintc.c +++ b/sys/arch/arm/cortex/ampintc.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ampintc.c,v 1.6 2015/05/29 05:48:07 jsg Exp $ */ +/* $OpenBSD: ampintc.c,v 1.7 2015/07/15 21:09:40 jsg Exp $ */ /* * Copyright (c) 2007,2009,2011 Dale Rahn <drahn@openbsd.org> * @@ -200,6 +200,8 @@ ampintc_match(struct device *parent, void *cfdata, void *aux) return (1); } +paddr_t gic_dist_base, gic_cpu_base, gic_dist_size, gic_cpu_size; + void ampintc_attach(struct device *parent, struct device *self, void *args) { @@ -229,6 +231,16 @@ ampintc_attach(struct device *parent, struct device *self, void *args) icdsize = ICD_A7_A15_SIZE; } + /* exynos gic isn't at the expected offsets from periphbase */ + if (gic_cpu_base) + icp = gic_cpu_base; + if (gic_cpu_size) + icpsize = gic_cpu_size; + if (gic_dist_base) + icd = gic_dist_base; + if (gic_dist_size) + icdsize = gic_dist_size; + if (bus_space_map(iot, icp, icpsize, 0, &p_ioh)) panic("ampintc_attach: ICP bus_space_map failed!"); diff --git a/sys/arch/armv7/armv7/armv7.c b/sys/arch/armv7/armv7/armv7.c index e1385155ec4..53927a47ae5 100644 --- a/sys/arch/armv7/armv7/armv7.c +++ b/sys/arch/armv7/armv7/armv7.c @@ -1,4 +1,4 @@ -/* $OpenBSD: armv7.c,v 1.10 2015/05/19 03:30:54 jsg Exp $ */ +/* $OpenBSD: armv7.c,v 1.11 2015/07/15 21:09:40 jsg Exp $ */ /* * Copyright (c) 2005,2008 Dale Rahn <drahn@openbsd.com> * Copyright (c) 2012-2013 Patrick Wildt <patrick@blueri.se> @@ -101,7 +101,6 @@ armv7_attach(struct device *parent, struct device *self, void *aux) struct armv7_softc *sc = (struct armv7_softc *)self; struct board_dev *bd; - platform_board_init(); sc->sc_board_devs = platform_board_devs(); if (hw_prod) diff --git a/sys/arch/armv7/armv7/armv7_machdep.h b/sys/arch/armv7/armv7/armv7_machdep.h index 6ac995ebd1b..5b4d16773b1 100644 --- a/sys/arch/armv7/armv7/armv7_machdep.h +++ b/sys/arch/armv7/armv7/armv7_machdep.h @@ -1,4 +1,4 @@ -/* $OpenBSD: armv7_machdep.h,v 1.4 2015/05/19 03:30:54 jsg Exp $ */ +/* $OpenBSD: armv7_machdep.h,v 1.5 2015/07/15 21:09:40 jsg Exp $ */ /* * Copyright (c) 2013 Sylvestre Gallon <ccna.syl@gmail.com> * @@ -19,12 +19,10 @@ #define __PLATFORMVAR_H__ void platform_init(void); -void platform_board_init(); void platform_powerdown(void); void platform_watchdog_reset(void); void platform_init_cons(void); void platform_disable_l2_if_needed(void); -void platform_board_init(void); const char *platform_boot_name(void); const char *platform_board_name(void); struct board_dev *platform_board_devs(); diff --git a/sys/arch/armv7/armv7/platform.c b/sys/arch/armv7/armv7/platform.c index 4c384ce665f..ffe5b99a1f2 100644 --- a/sys/arch/armv7/armv7/platform.c +++ b/sys/arch/armv7/armv7/platform.c @@ -1,4 +1,4 @@ -/* $OpenBSD: platform.c,v 1.3 2015/06/08 06:33:16 jsg Exp $ */ +/* $OpenBSD: platform.c,v 1.4 2015/07/15 21:09:40 jsg Exp $ */ /* * Copyright (c) 2014 Patrick Wildt <patrick@blueri.se> * @@ -69,6 +69,7 @@ platform_init(void) } if (platform == NULL) panic("no matching armv7 platform"); + platform->board_init(); } const char * @@ -119,9 +120,3 @@ platform_board_devs() { return (platform->devs); } - -void -platform_board_init() -{ - platform->board_init(); -} diff --git a/sys/arch/armv7/exynos/exynos4.c b/sys/arch/armv7/exynos/exynos4.c index 9ca18d2fb26..986257e8673 100644 --- a/sys/arch/armv7/exynos/exynos4.c +++ b/sys/arch/armv7/exynos/exynos4.c @@ -1,4 +1,4 @@ -/* $OpenBSD: exynos4.c,v 1.1 2015/06/07 16:54:16 jsg Exp $ */ +/* $OpenBSD: exynos4.c,v 1.2 2015/07/15 21:09:40 jsg Exp $ */ /* * Copyright (c) 2011 Uwe Stuehler <uwe@openbsd.org> * Copyright (c) 2012 Patrick Wildt <patrick@blueri.se> @@ -42,6 +42,11 @@ #define SYSREG_ADDR 0x10010000 #define SYSREG_SIZE 0x400 +#define GIC_CPU_ADDR 0x10480000 +#define GIC_CPU_SIZE 0x10000 +#define GIC_DIST_ADDR 0x10490000 +#define GIC_DIST_SIZE 0x10000 + #define UARTx_SIZE 0x100 #define UART1_ADDR 0x13800000 #define UART2_ADDR 0x13810000 @@ -316,8 +321,15 @@ struct armv7_dev exynos4_devs[] = { } }; +extern paddr_t gic_dist_base, gic_cpu_base, gic_dist_size, gic_cpu_size; + void exynos4_init(void) { armv7_set_devs(exynos4_devs); + + gic_dist_base = GIC_DIST_ADDR; + gic_dist_size = GIC_DIST_SIZE; + gic_cpu_base = GIC_CPU_ADDR; + gic_cpu_size = GIC_CPU_SIZE; } diff --git a/sys/arch/armv7/exynos/exynos5.c b/sys/arch/armv7/exynos/exynos5.c index 235804b27a4..f0d39ea71ad 100644 --- a/sys/arch/armv7/exynos/exynos5.c +++ b/sys/arch/armv7/exynos/exynos5.c @@ -1,4 +1,4 @@ -/* $OpenBSD: exynos5.c,v 1.2 2015/06/14 07:34:57 jsg Exp $ */ +/* $OpenBSD: exynos5.c,v 1.3 2015/07/15 21:09:40 jsg Exp $ */ /* * Copyright (c) 2011 Uwe Stuehler <uwe@openbsd.org> * Copyright (c) 2012 Patrick Wildt <patrick@blueri.se> @@ -42,6 +42,11 @@ #define SYSREG_ADDR 0x10050000 #define SYSREG_SIZE 0x1000 +#define GIC_DIST_ADDR 0x10481000 +#define GIC_DIST_SIZE 0x1000 +#define GIC_CPU_ADDR 0x10482000 +#define GIC_CPU_SIZE 0x1000 + #define UARTx_SIZE 0x100 #define UART1_ADDR 0x12c00000 #define UART2_ADDR 0x12c10000 @@ -317,8 +322,15 @@ struct armv7_dev exynos5_devs[] = { } }; +extern paddr_t gic_dist_base, gic_cpu_base, gic_dist_size, gic_cpu_size; + void exynos5_init(void) { armv7_set_devs(exynos5_devs); + + gic_dist_base = GIC_DIST_ADDR; + gic_dist_size = GIC_DIST_SIZE; + gic_cpu_base = GIC_CPU_ADDR; + gic_cpu_size = GIC_CPU_SIZE; } |