From 02454f88b0b85996acba961741273c33823922e4 Mon Sep 17 00:00:00 2001 From: Jason Wright Date: Mon, 27 Sep 2004 18:32:36 +0000 Subject: compute the board number of each fhc --- sys/arch/sparc64/dev/fhc.c | 5 +++-- sys/arch/sparc64/dev/fhc_central.c | 6 +++++- sys/arch/sparc64/dev/fhc_mainbus.c | 4 +++- sys/arch/sparc64/dev/fhcvar.h | 3 ++- 4 files changed, 13 insertions(+), 5 deletions(-) (limited to 'sys/arch/sparc64/dev') diff --git a/sys/arch/sparc64/dev/fhc.c b/sys/arch/sparc64/dev/fhc.c index 0df9cfade7e..c83a7eccc50 100644 --- a/sys/arch/sparc64/dev/fhc.c +++ b/sys/arch/sparc64/dev/fhc.c @@ -1,4 +1,4 @@ -/* $OpenBSD: fhc.c,v 1.6 2004/09/27 18:15:32 jason Exp $ */ +/* $OpenBSD: fhc.c,v 1.7 2004/09/27 18:32:35 jason Exp $ */ /* * Copyright (c) 2004 Jason L. Wright (jason@thought.net) @@ -64,7 +64,8 @@ fhc_attach(struct fhc_softc *sc) int node0, node; u_int32_t ctrl; - printf(": %s\n", getpropstring(sc->sc_node, "board-model")); + printf(" board %d: %s\n", sc->sc_board, + getpropstring(sc->sc_node, "board-model")); sc->sc_cbt = fhc_alloc_bus_tag(sc); diff --git a/sys/arch/sparc64/dev/fhc_central.c b/sys/arch/sparc64/dev/fhc_central.c index 8b3dc347dbf..95d5f78fe50 100644 --- a/sys/arch/sparc64/dev/fhc_central.c +++ b/sys/arch/sparc64/dev/fhc_central.c @@ -1,4 +1,4 @@ -/* $OpenBSD: fhc_central.c,v 1.4 2004/09/27 18:15:32 jason Exp $ */ +/* $OpenBSD: fhc_central.c,v 1.5 2004/09/27 18:32:35 jason Exp $ */ /* * Copyright (c) 2004 Jason L. Wright (jason@thought.net). @@ -68,6 +68,7 @@ fhc_central_attach(parent, self, aux) { struct fhc_softc *sc = (struct fhc_softc *)self; struct central_attach_args *ca = aux; + u_int32_t board; sc->sc_node = ca->ca_node; sc->sc_bt = ca->ca_bustag; @@ -115,6 +116,9 @@ fhc_central_attach(parent, self, aux) return; } + board = bus_space_read_4(sc->sc_bt, sc->sc_preg, FHC_P_BSR); + sc->sc_board = ((board >> 16) & 0x1) | ((board >> 12) & 0xe); + fhc_attach(sc); return; } diff --git a/sys/arch/sparc64/dev/fhc_mainbus.c b/sys/arch/sparc64/dev/fhc_mainbus.c index dcc01f599cd..1d5b55ea0ea 100644 --- a/sys/arch/sparc64/dev/fhc_mainbus.c +++ b/sys/arch/sparc64/dev/fhc_mainbus.c @@ -1,4 +1,4 @@ -/* $OpenBSD: fhc_mainbus.c,v 1.3 2004/09/27 18:15:32 jason Exp $ */ +/* $OpenBSD: fhc_mainbus.c,v 1.4 2004/09/27 18:32:35 jason Exp $ */ /* * Copyright (c) 2004 Jason L. Wright (jason@thought.net). @@ -107,6 +107,8 @@ fhc_mainbus_attach(parent, self, aux) return; } + sc->sc_board = getpropint(sc->sc_node, "board#", -1); + fhc_attach(sc); return; diff --git a/sys/arch/sparc64/dev/fhcvar.h b/sys/arch/sparc64/dev/fhcvar.h index 91298db9558..015ac3270f7 100644 --- a/sys/arch/sparc64/dev/fhcvar.h +++ b/sys/arch/sparc64/dev/fhcvar.h @@ -1,4 +1,4 @@ -/* $OpenBSD: fhcvar.h,v 1.3 2004/09/27 18:15:32 jason Exp $ */ +/* $OpenBSD: fhcvar.h,v 1.4 2004/09/27 18:32:35 jason Exp $ */ /* * Copyright (c) 2004 Jason L. Wright (jason@thought.net). @@ -44,6 +44,7 @@ struct fhc_softc { struct device sc_dv; int sc_node; int sc_is_central; /* parent is central */ + int sc_board; bus_space_tag_t sc_bt; bus_space_tag_t sc_cbt; int sc_nrange; -- cgit v1.2.3