diff options
author | Miod Vallat <miod@cvs.openbsd.org> | 2007-01-14 17:54:46 +0000 |
---|---|---|
committer | Miod Vallat <miod@cvs.openbsd.org> | 2007-01-14 17:54:46 +0000 |
commit | 70019943cfab56d99e5c2a63dba14ca74ab2497d (patch) | |
tree | d3442d01373a1f1dfa712d2de40473bb5d987ba6 | |
parent | 31213fb9fdd775828166d875950d404df3d3ef2d (diff) |
Move the isa bridge probe from isabr to frodo, so that frodo only attempts
to attach isabr if it really exists. This gets rid of ``isabr0 not configured''
messages on 425e.
-rw-r--r-- | sys/arch/hp300/dev/frodo.c | 66 | ||||
-rw-r--r-- | sys/arch/hp300/dev/isabr.c | 29 |
2 files changed, 63 insertions, 32 deletions
diff --git a/sys/arch/hp300/dev/frodo.c b/sys/arch/hp300/dev/frodo.c index e2ee8bfbb9c..2bf757e3938 100644 --- a/sys/arch/hp300/dev/frodo.c +++ b/sys/arch/hp300/dev/frodo.c @@ -1,4 +1,4 @@ -/* $OpenBSD: frodo.c,v 1.10 2007/01/06 20:17:43 miod Exp $ */ +/* $OpenBSD: frodo.c,v 1.11 2007/01/14 17:54:45 miod Exp $ */ /* $NetBSD: frodo.c,v 1.5 1999/07/31 21:15:20 thorpej Exp $ */ /*- @@ -85,6 +85,13 @@ #include "isabr.h" +#if NISABR > 0 +#include <uvm/uvm_extern.h> + +#include <dev/isa/isareg.h> +#include <hp300/dev/isabrreg.h> +#endif + struct frodo_softc { struct device sc_dev; /* generic device glue */ volatile u_int8_t *sc_regs; /* register base */ @@ -100,9 +107,9 @@ int frodoprint(void *, const char *); int frodosubmatch(struct device *, void *, void *); int frodointr(void *); -void frodo_state(struct frodo_softc *); - void frodo_imask(struct frodo_softc *, u_int16_t, u_int16_t); +int frodo_isa_exists(void); +void frodo_state(struct frodo_softc *); struct cfattach frodo_ca = { sizeof(struct frodo_softc), frodomatch, frodoattach @@ -117,7 +124,6 @@ struct frodo_attach_args frodo_subdevs[] = { { "apci", NULL, FRODO_APCI_OFFSET(1), FRODO_INTR_APCI1 }, { "apci", NULL, FRODO_APCI_OFFSET(2), FRODO_INTR_APCI2 }, { "apci", NULL, FRODO_APCI_OFFSET(3), FRODO_INTR_APCI3 }, - { "isabr", NULL, 0, 0 }, { NULL, NULL, 0, 0 }, }; @@ -220,6 +226,21 @@ frodoattach(parent, self, aux) config_found_sm(self, &frodo_subdevs[i], frodoprint, frodosubmatch); } + +#if NISABR > 0 + /* + * Only attempt to attach the isa bridge if it exists on this + * machine. + */ + if (frodo_isa_exists()) { + struct frodo_attach_args fa; + + fa.fa_name = "isabr"; + fa.fa_tag = ia->ia_tag; + fa.fa_offset = fa.fa_line = 0; + config_found_sm(self, &fa, frodoprint, frodosubmatch); + } +#endif } int @@ -327,7 +348,7 @@ frodo_intr_disestablish(frdev, line) if (FRODO_INTR_ISA(line)) { if (sc->sc_intr[FRODO_INTR_ILOW] == NULL && sc->sc_intr[FRODO_INTR_IMID] == NULL && - sc->sc_intr[FRODO_INTR_IHIGH] == NULL) + sc->sc_intr[FRODO_INTR_IHI] == NULL) FRODO_WRITE(sc, FRODO_PIO_ISA_CONTROL, 0x80); } #endif @@ -434,3 +455,38 @@ frodo_state(struct frodo_softc *sc) printf("\n"); } #endif + +#if NISABR > 0 +int +frodo_isa_exists() +{ + vaddr_t va; + int rv; + + va = uvm_km_valloc(kernel_map, PAGE_SIZE); + if (va == NULL) + return (0); + + /* + * Check that the iomem space answers probes + */ + pmap_kenter_cache(va, ISABR_IOMEM_BASE, PG_RW | PG_CI); + pmap_update(pmap_kernel()); + rv = badbaddr((caddr_t)va); + pmap_kremove(va, PAGE_SIZE); + pmap_update(pmap_kernel()); + + /* + * Check that the ioport space answers probes + */ + pmap_kenter_cache(va, ISABR_IOPORT_BASE, PG_RW | PG_CI); + pmap_update(pmap_kernel()); + rv |= badbaddr((caddr_t)va); + pmap_kremove(va, PAGE_SIZE); + pmap_update(pmap_kernel()); + + uvm_km_free(kernel_map, va, PAGE_SIZE); + + return (!rv); +} +#endif diff --git a/sys/arch/hp300/dev/isabr.c b/sys/arch/hp300/dev/isabr.c index bd87f71378b..10459182fb3 100644 --- a/sys/arch/hp300/dev/isabr.c +++ b/sys/arch/hp300/dev/isabr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: isabr.c,v 1.1 2007/01/06 20:17:43 miod Exp $ */ +/* $OpenBSD: isabr.c,v 1.2 2007/01/14 17:54:45 miod Exp $ */ /* * Copyright (c) 2007 Miodrag Vallat. @@ -68,8 +68,6 @@ int isabr_match(struct device *parent, void *match, void *aux) { struct frodo_attach_args *fa = aux; - vaddr_t va; - int rv; static int isa_matched = 0; if (isa_matched != 0) @@ -78,32 +76,9 @@ isabr_match(struct device *parent, void *match, void *aux) if (strcmp(fa->fa_name, isabr_cd.cd_name) != 0) return (0); - va = uvm_km_valloc(kernel_map, PAGE_SIZE); - if (va == NULL) - return (0); - /* - * Check that the iomem space answers probes + * We assume parent has checked our physical existence for us. */ - pmap_kenter_cache(va, ISABR_IOMEM_BASE, PG_RW | PG_CI); - pmap_update(pmap_kernel()); - rv = badbaddr((caddr_t)va); - pmap_kremove(va, PAGE_SIZE); - pmap_update(pmap_kernel()); - - /* - * Check that the ioport space answers probes - */ - pmap_kenter_cache(va, ISABR_IOPORT_BASE, PG_RW | PG_CI); - pmap_update(pmap_kernel()); - rv |= badbaddr((caddr_t)va); - pmap_kremove(va, PAGE_SIZE); - pmap_update(pmap_kernel()); - - uvm_km_free(kernel_map, va, PAGE_SIZE); - - if (rv != 0) - return (0); return (isa_matched = 1); } |