Allow l2cc base to gotten from device properties.

This commit is contained in:
matt 2014-04-16 22:40:00 +00:00
parent ad5b64f98f
commit de53240564
1 changed files with 10 additions and 3 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: pl310.c,v 1.14 2014/03/20 22:28:37 matt Exp $ */
/* $NetBSD: pl310.c,v 1.15 2014/04/16 22:40:00 matt Exp $ */
/*-
* Copyright (c) 2012 The NetBSD Foundation, Inc.
@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: pl310.c,v 1.14 2014/03/20 22:28:37 matt Exp $");
__KERNEL_RCSID(0, "$NetBSD: pl310.c,v 1.15 2014/04/16 22:40:00 matt Exp $");
#include <sys/param.h>
#include <sys/bus.h>
@ -124,6 +124,7 @@ static const struct {
{ 4, " r2p0" },
{ 5, " r3p0" },
{ 6, " r3p1" },
{ 7, " r3p1a" },
{ 8, " r3p2" },
{ 9, " r3p3" },
};
@ -134,6 +135,12 @@ arml2cc_attach(device_t parent, device_t self, void *aux)
struct arml2cc_softc * const sc = device_private(self);
struct mpcore_attach_args * const mpcaa = aux;
const char * const xname = device_xname(self);
prop_dictionary_t dict = device_properties(self);
uint32_t off;
if (!prop_dictionary_get_uint32(dict, "offset", &off)) {
off = L2CC_BASE;
}
arml2cc_sc = sc;
sc->sc_dev = self;
@ -150,7 +157,7 @@ arml2cc_attach(device_t parent, device_t self, void *aux)
mutex_init(&sc->sc_lock, MUTEX_DEFAULT, IPL_HIGH);
bus_space_subregion(sc->sc_memt, mpcaa->mpcaa_memh,
L2CC_BASE, L2CC_SIZE, &sc->sc_memh);
off, L2CC_SIZE, &sc->sc_memh);
uint32_t id = arml2cc_read_4(sc, L2C_CACHE_ID);
u_int rev = __SHIFTOUT(id, CACHE_ID_REV);