summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Kettenis <kettenis@cvs.openbsd.org>2007-05-01 19:44:57 +0000
committerMark Kettenis <kettenis@cvs.openbsd.org>2007-05-01 19:44:57 +0000
commitd724568e4d8b294fda5d482bf9232e5b3b98b366 (patch)
treef239ab885d3ef0abd3a9f5d28f2c68c6a81e101d
parentb1dbee3dca382b1067613841d4a88779e2c2b4b6 (diff)
Don't rely on the PROM to have configured the interrupts. Make Simics boot
a but further and doesn't hurt a real E4500. tested by miod@
-rw-r--r--sys/arch/sparc64/dev/fhc.c43
-rw-r--r--sys/arch/sparc64/dev/fhcreg.h7
2 files changed, 20 insertions, 30 deletions
diff --git a/sys/arch/sparc64/dev/fhc.c b/sys/arch/sparc64/dev/fhc.c
index 970099f9ba6..064d3990818 100644
--- a/sys/arch/sparc64/dev/fhc.c
+++ b/sys/arch/sparc64/dev/fhc.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: fhc.c,v 1.12 2004/10/01 18:18:49 jason Exp $ */
+/* $OpenBSD: fhc.c,v 1.13 2007/05/01 19:44:56 kettenis Exp $ */
/*
* Copyright (c) 2004 Jason L. Wright (jason@thought.net)
@@ -55,8 +55,6 @@ int _fhc_bus_map(bus_space_tag_t, bus_space_tag_t, bus_addr_t, bus_size_t,
void *fhc_intr_establish(bus_space_tag_t, bus_space_tag_t, int, int, int,
int (*)(void *), void *, const char *);
bus_space_handle_t *fhc_find_intr_handle(struct fhc_softc *, int);
-bus_space_handle_t *fhc_try_intr_handle(struct fhc_softc *,
- bus_space_handle_t *, bus_size_t, int);
void fhc_led_blink(void *, int);
void
@@ -221,34 +219,21 @@ _fhc_bus_map(bus_space_tag_t t, bus_space_tag_t t0, bus_addr_t addr,
}
bus_space_handle_t *
-fhc_try_intr_handle(struct fhc_softc *sc, bus_space_handle_t *hp,
- bus_size_t off, int val)
+fhc_find_intr_handle(struct fhc_softc *sc, int ino)
{
- u_int64_t r;
-
- r = bus_space_read_8(sc->sc_bt, *hp, off);
- if (INTINO(r) == INTINO(val))
- return (hp);
- return (NULL);
-}
+ switch (FHC_INO(ino)) {
+ case FHC_F_INO:
+ return &sc->sc_freg;
+ case FHC_S_INO:
+ return &sc->sc_sreg;
+ case FHC_U_INO:
+ return &sc->sc_ureg;
+ case FHC_T_INO:
+ return &sc->sc_treg;
+ default:
+ break;
+ }
-bus_space_handle_t *
-fhc_find_intr_handle(struct fhc_softc *sc, int val)
-{
- bus_space_handle_t *hp;
-
- hp = fhc_try_intr_handle(sc, &sc->sc_freg, FHC_F_IMAP, val);
- if (hp != NULL)
- return (hp);
- hp = fhc_try_intr_handle(sc, &sc->sc_sreg, FHC_S_IMAP, val);
- if (hp != NULL)
- return (hp);
- hp = fhc_try_intr_handle(sc, &sc->sc_ureg, FHC_U_IMAP, val);
- if (hp != NULL)
- return (hp);
- hp = fhc_try_intr_handle(sc, &sc->sc_treg, FHC_T_IMAP, val);
- if (hp != NULL)
- return (hp);
return (NULL);
}
diff --git a/sys/arch/sparc64/dev/fhcreg.h b/sys/arch/sparc64/dev/fhcreg.h
index 6364b6abfad..325d07ba387 100644
--- a/sys/arch/sparc64/dev/fhcreg.h
+++ b/sys/arch/sparc64/dev/fhcreg.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: fhcreg.h,v 1.3 2004/09/28 16:26:03 jason Exp $ */
+/* $OpenBSD: fhcreg.h,v 1.4 2007/05/01 19:44:56 kettenis Exp $ */
/*
* Copyright (c) 2004 Jason L. Wright (jason@thought.net).
@@ -71,3 +71,8 @@ struct fhc_intr_reg {
u_int64_t unused_1;
};
+#define FHC_INO(ino) ((ino) & 0x7)
+#define FHC_S_INO 0
+#define FHC_U_INO 1
+#define FHC_T_INO 2
+#define FHC_F_INO 3