Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch/arm/cortex Pass the offset from CBAR/PERIPHBASE in ...
details: https://anonhg.NetBSD.org/src/rev/1d98a2ca400f
branches: trunk
changeset: 787476:1d98a2ca400f
user: matt <matt%NetBSD.org@localhost>
date: Thu Jun 20 05:30:21 2013 +0000
description:
Pass the offset from CBAR/PERIPHBASE in mpcore_attach_args.
Modify the list of devices to include the offset(s) from PERIPHBASE.
diffstat:
sys/arch/arm/cortex/a9tmr.c | 8 ++----
sys/arch/arm/cortex/a9tmr_var.h | 4 +-
sys/arch/arm/cortex/armperiph.c | 48 ++++++++++++++++++++++++++++-----------
sys/arch/arm/cortex/gic.c | 24 ++++++++++---------
sys/arch/arm/cortex/gtmr.c | 11 +++++----
sys/arch/arm/cortex/gtmr_var.h | 4 +-
sys/arch/arm/cortex/mpcore_var.h | 4 ++-
7 files changed, 63 insertions(+), 40 deletions(-)
diffs (truncated from 310 to 300 lines):
diff -r 07c16683318d -r 1d98a2ca400f sys/arch/arm/cortex/a9tmr.c
--- a/sys/arch/arm/cortex/a9tmr.c Thu Jun 20 05:29:01 2013 +0000
+++ b/sys/arch/arm/cortex/a9tmr.c Thu Jun 20 05:30:21 2013 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: a9tmr.c,v 1.5 2013/06/12 00:59:50 matt Exp $ */
+/* $NetBSD: a9tmr.c,v 1.6 2013/06/20 05:30:21 matt Exp $ */
/*-
* Copyright (c) 2012 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: a9tmr.c,v 1.5 2013/06/12 00:59:50 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: a9tmr.c,v 1.6 2013/06/20 05:30:21 matt Exp $");
#include <sys/param.h>
#include <sys/bus.h>
@@ -123,9 +123,7 @@
* This runs at the ARM PERIPHCLOCK which should be 1/2 of the CPU clock.
* The MD code should have setup our frequency for us.
*/
- prop_number_t pn = prop_dictionary_get(dict, "frequency");
- KASSERT(pn != NULL);
- sc->sc_freq = prop_number_unsigned_integer_value(pn);
+ prop_dictionary_get_uint32(dict, "frequency", &sc->sc_freq);
humanize_number(freqbuf, sizeof(freqbuf), sc->sc_freq, "Hz", 1000);
diff -r 07c16683318d -r 1d98a2ca400f sys/arch/arm/cortex/a9tmr_var.h
--- a/sys/arch/arm/cortex/a9tmr_var.h Thu Jun 20 05:29:01 2013 +0000
+++ b/sys/arch/arm/cortex/a9tmr_var.h Thu Jun 20 05:30:21 2013 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: a9tmr_var.h,v 1.2 2012/09/27 00:23:27 matt Exp $ */
+/* $NetBSD: a9tmr_var.h,v 1.3 2013/06/20 05:30:21 matt Exp $ */
/*-
* Copyright (c) 2012 The NetBSD Foundation, Inc.
* All rights reserved.
@@ -39,7 +39,7 @@
bus_space_handle_t sc_private_memh;
bus_space_handle_t sc_wdog_memh;
struct evcnt sc_ev_missing_ticks;
- u_long sc_freq;
+ uint32_t sc_freq;
u_long sc_autoinc;
void *sc_global_ih;
};
diff -r 07c16683318d -r 1d98a2ca400f sys/arch/arm/cortex/armperiph.c
--- a/sys/arch/arm/cortex/armperiph.c Thu Jun 20 05:29:01 2013 +0000
+++ b/sys/arch/arm/cortex/armperiph.c Thu Jun 20 05:30:21 2013 +0000
@@ -31,7 +31,7 @@
#include <sys/cdefs.h>
-__KERNEL_RCSID(1, "$NetBSD: armperiph.c,v 1.3 2013/06/16 16:44:39 matt Exp $");
+__KERNEL_RCSID(1, "$NetBSD: armperiph.c,v 1.4 2013/06/20 05:30:21 matt Exp $");
#include <sys/param.h>
#include <sys/device.h>
@@ -52,41 +52,59 @@
bus_space_handle_t sc_memh;
};
+struct armperiph_info {
+ const char pi_name[12];
+ bus_size_t pi_off1;
+ bus_size_t pi_off2;
+};
+
#ifdef CPU_CORTEXA5
-static const char * const a5_devices[] = {
- "armscu", "armgic", NULL
+static const struct armperiph_info a5_devices[] = {
+ { "armscu", 0x0000, 0 },
+ { "armgic", 0x1000, 0x0100 },
+ { "a9tmr", 0x0200, 0 },
+ { "", 0, 0 },
};
#endif
#ifdef CPU_CORTEXA7
-static const char * const a7_devices[] = {
- "armgic", "armtmr", NULL
+static const struct armperiph_info a7_devices[] = {
+ { "armgic", 0x1000, 0x2000 },
+ { "armgtmr", 0, 0 },
+ { "", 0, 0 },
};
#endif
#ifdef CPU_CORTEXA9
-static const char * const a9_devices[] = {
- "armscu", "arml2cc", "armgic", "a9tmr", "a9wdt", NULL
+static const struct armperiph_info a9_devices[] = {
+ { "armscu", 0x0000, 0 },
+ { "arml2cc", 0x2000, 0 },
+ { "armgic", 0x1000, 0x0100 },
+ { "a9tmr", 0x0200, 0 },
+ { "a9wdt", 0x0600, 0 },
+ { "", 0, 0 },
};
#endif
#ifdef CPU_CORTEXA15
-static const char * const a15_devices[] = {
- "armgic", "armtmr", NULL
+static const struct armperiph_info a15_devices[] = {
+ { "armgic", 0x1000, 0x2000 },
+ { "armgtmr", 0, 0 },
+ { "", 0, 0 },
};
#endif
static const struct mpcore_config {
- const char * const *cfg_devices;
+ const struct armperiph_info *cfg_devices;
uint32_t cfg_cpuid;
uint32_t cfg_cbar_size;
} configs[] = {
#ifdef CPU_CORTEXA5
- { a5_devices, 0x410fc050, 8192 },
+ { a5_devices, 0x410fc050, 2*4096 },
#endif
#ifdef CPU_CORTEXA7
- { a7_devices, 0x410fc070, 32768 },
+ { a7_devices, 0x410fc070, 8*4096 },
#endif
#ifdef CPU_CORTEXA9
{ a9_devices, 0x410fc090, 3*4096 },
@@ -172,11 +190,13 @@
/*
* Let's try to attach any children we may have.
*/
- for (size_t i = 0; cfg->cfg_devices[i] != NULL; i++) {
+ for (size_t i = 0; cfg->cfg_devices[i].pi_name[0] != 0; i++) {
struct mpcore_attach_args mpcaa = {
- .mpcaa_name = cfg->cfg_devices[i],
+ .mpcaa_name = cfg->cfg_devices[i].pi_name,
.mpcaa_memt = sc->sc_memt,
.mpcaa_memh = sc->sc_memh,
+ .mpcaa_off1 = cfg->cfg_devices[i].pi_off1,
+ .mpcaa_off2 = cfg->cfg_devices[i].pi_off2,
};
config_found(self, &mpcaa, NULL);
diff -r 07c16683318d -r 1d98a2ca400f sys/arch/arm/cortex/gic.c
--- a/sys/arch/arm/cortex/gic.c Thu Jun 20 05:29:01 2013 +0000
+++ b/sys/arch/arm/cortex/gic.c Thu Jun 20 05:30:21 2013 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: gic.c,v 1.3 2012/09/16 22:09:34 rmind Exp $ */
+/* $NetBSD: gic.c,v 1.4 2013/06/20 05:30:21 matt Exp $ */
/*-
* Copyright (c) 2012 The NetBSD Foundation, Inc.
* All rights reserved.
@@ -31,7 +31,7 @@
#define _INTR_PRIVATE
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: gic.c,v 1.3 2012/09/16 22:09:34 rmind Exp $");
+__KERNEL_RCSID(0, "$NetBSD: gic.c,v 1.4 2013/06/20 05:30:21 matt Exp $");
#include <sys/param.h>
#include <sys/bus.h>
@@ -86,7 +86,8 @@
struct pic_softc sc_pic;
device_t sc_dev;
bus_space_tag_t sc_memt;
- bus_space_handle_t sc_memh;
+ bus_space_handle_t sc_gicch;
+ bus_space_handle_t sc_gicdh;
size_t sc_gic_lines;
uint32_t sc_gic_type;
uint32_t sc_gic_valid_lines[1024/32];
@@ -108,7 +109,7 @@
static inline uint32_t
gicc_read(struct armgic_softc *sc, bus_size_t o)
{
- uint32_t v = bus_space_read_4(sc->sc_memt, sc->sc_memh, GICC_BASE + o);
+ uint32_t v = bus_space_read_4(sc->sc_memt, sc->sc_gicch, o);
return le32toh(v);
}
@@ -116,13 +117,13 @@
gicc_write(struct armgic_softc *sc, bus_size_t o, uint32_t v)
{
v = htole32(v);
- bus_space_write_4(sc->sc_memt, sc->sc_memh, GICC_BASE + o, v);
+ bus_space_write_4(sc->sc_memt, sc->sc_gicch, o, v);
}
static inline uint32_t
gicd_read(struct armgic_softc *sc, bus_size_t o)
{
- uint32_t v = bus_space_read_4(sc->sc_memt, sc->sc_memh, GICD_BASE + o);
+ uint32_t v = bus_space_read_4(sc->sc_memt, sc->sc_gicdh, o);
return le32toh(v);
}
@@ -130,7 +131,7 @@
gicd_write(struct armgic_softc *sc, bus_size_t o, uint32_t v)
{
v = htole32(v);
- bus_space_write_4(sc->sc_memt, sc->sc_memh, GICD_BASE + o, v);
+ bus_space_write_4(sc->sc_memt, sc->sc_gicdh, o, v);
}
/*
@@ -454,9 +455,7 @@
if (strcmp(cf->cf_name, mpcaa->mpcaa_name) != 0)
return 0;
- if (!CPU_ID_CORTEX_P(cputype))
- return 0;
- if (CPU_ID_CORTEX_A8_P(cputype))
+ if (!CPU_ID_CORTEX_P(cputype) || CPU_ID_CORTEX_A8_P(cputype))
return 0;
return 1;
@@ -472,7 +471,10 @@
self->dv_private = sc;
sc->sc_memt = mpcaa->mpcaa_memt; /* provided for us */
- sc->sc_memh = mpcaa->mpcaa_memh; /* provided for us */
+ bus_space_subregion(sc->sc_memt, mpcaa->mpcaa_memh, mpcaa->mpcaa_off1,
+ 4096, &sc->sc_gicdh);
+ bus_space_subregion(sc->sc_memt, mpcaa->mpcaa_memh, mpcaa->mpcaa_off2,
+ 4096, &sc->sc_gicch);
sc->sc_gic_type = gicd_read(sc, GICD_TYPER);
sc->sc_pic.pic_maxsources = GICD_TYPER_LINES(sc->sc_gic_type);
diff -r 07c16683318d -r 1d98a2ca400f sys/arch/arm/cortex/gtmr.c
--- a/sys/arch/arm/cortex/gtmr.c Thu Jun 20 05:29:01 2013 +0000
+++ b/sys/arch/arm/cortex/gtmr.c Thu Jun 20 05:30:21 2013 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: gtmr.c,v 1.1 2013/06/16 16:44:39 matt Exp $ */
+/* $NetBSD: gtmr.c,v 1.2 2013/06/20 05:30:21 matt Exp $ */
/*-
* Copyright (c) 2012 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: gtmr.c,v 1.1 2013/06/16 16:44:39 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: gtmr.c,v 1.2 2013/06/20 05:30:21 matt Exp $");
#include <sys/param.h>
#include <sys/bus.h>
@@ -91,12 +91,13 @@
gtmr_attach(device_t parent, device_t self, void *aux)
{
struct gtmr_softc *sc = >mr_sc;
- char freqbuf[sizeof("XXX SHz")];
+ prop_dictionary_t dict = device_properties(self);
+ char freqbuf[sizeof("X.XXX SHz")];
/*
* This runs at a fixed frequency of 1 to 50MHz.
*/
- sc->sc_freq = armreg_cnt_frq_read();
+ prop_dictionary_get_uint32(dict, "frequency", &sc->sc_freq);
humanize_number(freqbuf, sizeof(freqbuf), sc->sc_freq, "Hz", 1000);
@@ -145,7 +146,7 @@
armreg_cntv_ctl_write(ARM_CNTCTL_ENABLE);
#if 0
printf("%s: %s: ctl %#x cmp %#"PRIx64" now %#"PRIx64"\n",
- __func__, ci->ci_data.cpu_name, armreg_cntvctl_read(),
+ __func__, ci->ci_data.cpu_name, armreg_cntv_ctl_read(),
armreg_cntv_cval_read(), armreg_cntv_ct_read());
int s = splsched();
diff -r 07c16683318d -r 1d98a2ca400f sys/arch/arm/cortex/gtmr_var.h
--- a/sys/arch/arm/cortex/gtmr_var.h Thu Jun 20 05:29:01 2013 +0000
+++ b/sys/arch/arm/cortex/gtmr_var.h Thu Jun 20 05:30:21 2013 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: gtmr_var.h,v 1.1 2013/06/16 16:44:39 matt Exp $ */
+/* $NetBSD: gtmr_var.h,v 1.2 2013/06/20 05:30:21 matt Exp $ */
/*-
* Copyright (c) 2013 The NetBSD Foundation, Inc.
* All rights reserved.
@@ -34,7 +34,7 @@
struct gtmr_softc {
device_t sc_dev;
struct evcnt sc_ev_missing_ticks;
- u_long sc_freq;
+ uint32_t sc_freq;
u_long sc_autoinc;
void *sc_global_ih;
};
diff -r 07c16683318d -r 1d98a2ca400f sys/arch/arm/cortex/mpcore_var.h
--- a/sys/arch/arm/cortex/mpcore_var.h Thu Jun 20 05:29:01 2013 +0000
+++ b/sys/arch/arm/cortex/mpcore_var.h Thu Jun 20 05:30:21 2013 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: mpcore_var.h,v 1.1 2012/09/01 00:03:14 matt Exp $ */
+/* $NetBSD: mpcore_var.h,v 1.2 2013/06/20 05:30:21 matt Exp $ */
/*-
* Copyright (c) 2012 The NetBSD Foundation, Inc.
Home |
Main Index |
Thread Index |
Old Index