print chip revision on attach

This commit is contained in:
macallan 2014-04-15 10:24:54 +00:00
parent 8b6ddbe40e
commit a825263fc6
2 changed files with 15 additions and 3 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: sx.c,v 1.2 2013/02/06 04:06:29 macallan Exp $ */
/* $NetBSD: sx.c,v 1.3 2014/04/15 10:24:54 macallan Exp $ */
/*-
* Copyright (c) 2013 The NetBSD Foundation, Inc.
@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: sx.c,v 1.2 2013/02/06 04:06:29 macallan Exp $");
__KERNEL_RCSID(0, "$NetBSD: sx.c,v 1.3 2014/04/15 10:24:54 macallan Exp $");
#include "locators.h"
@ -70,6 +70,7 @@ sx_attach(device_t parent, device_t self, void *aux)
{
struct sx_softc *sc = device_private(self);
struct mainbus_attach_args *ma = aux;
uint32_t id;
int i;
#ifdef SX_DEBUG
int j;
@ -86,6 +87,11 @@ sx_attach(device_t parent, device_t self, void *aux)
return;
}
id = sx_read(sc, SX_ID);
aprint_normal_dev(self, "architecture rev. %d chip rev. %d\n",
(id & SX_ARCHITECTURE_MASK),
(id & SX_CHIP_REVISION) >> 8);
/* stop the processor */
sx_write(sc, SX_CONTROL_STATUS, 0);
/* initialize control registers, clear errors etc. */

View File

@ -1,4 +1,4 @@
/* $NetBSD: sxvar.h,v 1.1 2013/02/05 21:52:48 macallan Exp $ */
/* $NetBSD: sxvar.h,v 1.2 2014/04/15 10:24:54 macallan Exp $ */
/*-
* Copyright (c) 2013 The NetBSD Foundation, Inc.
@ -45,4 +45,10 @@ sx_write(struct sx_softc *sc, int addr, uint32_t val)
bus_space_write_4(sc->sc_tag, sc->sc_regh, addr, val);
}
static inline uint32_t
sx_read(struct sx_softc *sc, int addr)
{
return bus_space_read_4(sc->sc_tag, sc->sc_regh, addr);
}
#endif