diff options
Diffstat (limited to 'sys/dev/isa')
-rw-r--r-- | sys/dev/isa/gscsio.c | 47 | ||||
-rw-r--r-- | sys/dev/isa/gscsioreg.h | 5 | ||||
-rw-r--r-- | sys/dev/isa/nsclpcsio_isa.c | 52 |
3 files changed, 38 insertions, 66 deletions
diff --git a/sys/dev/isa/gscsio.c b/sys/dev/isa/gscsio.c index d54f0131b4a..7ce7a91b1bb 100644 --- a/sys/dev/isa/gscsio.c +++ b/sys/dev/isa/gscsio.c @@ -1,4 +1,4 @@ -/* $OpenBSD: gscsio.c,v 1.2 2004/06/05 18:34:04 grange Exp $ */ +/* $OpenBSD: gscsio.c,v 1.3 2004/11/17 16:53:05 mickey Exp $ */ /* * Copyright (c) 2004 Alexander Yurchenko <grange@openbsd.org> * @@ -112,45 +112,32 @@ idxwrite(bus_space_tag_t iot, bus_space_handle_t ioh, int idx, u_int8_t data) bus_space_write_1(iot, ioh, GSCSIO_DAT, data); } -static int -ioprobe(bus_space_tag_t iot, int base) +int +gscsio_probe(struct device *parent, void *match, void *aux) { + struct isa_attach_args *ia = aux; + bus_space_tag_t iot; bus_space_handle_t ioh; + int iobase; int rv = 0; - if (bus_space_map(iot, base, GSCSIO_IOSIZE, 0, &ioh)) + iot = ia->ia_iot; + iobase = ia->ipa_io[0].base; + if (bus_space_map(iot, iobase, GSCSIO_IOSIZE, 0, &ioh)) return (0); if (idxread(iot, ioh, GSCSIO_ID) == GSCSIO_ID_SC1100) rv = 1; bus_space_unmap(iot, ioh, GSCSIO_IOSIZE); - return (rv); -} - -int -gscsio_probe(struct device *parent, void *match, void *aux) -{ - struct isa_attach_args *ia = aux; - int iobase; - - iobase = GSCSIO_IOBASE1; - if (ioprobe(ia->ia_iot, iobase)) - goto found; - iobase = GSCSIO_IOBASE2; - if (ioprobe(ia->ia_iot, iobase)) - goto found; - - return (0); - -found: - ia->ipa_nio = 1; - ia->ipa_io[0].base = iobase; - ia->ipa_io[0].length = GSCSIO_IOSIZE; - ia->ipa_nmem = 0; - ia->ipa_nirq = 0; - ia->ipa_ndrq = 0; + if (rv) { + ia->ipa_nio = 1; + ia->ipa_io[0].length = GSCSIO_IOSIZE; + ia->ipa_nmem = 0; + ia->ipa_nirq = 0; + ia->ipa_ndrq = 0; + } - return (1); + return (rv); } void diff --git a/sys/dev/isa/gscsioreg.h b/sys/dev/isa/gscsioreg.h index dc8793b0bc4..134e27a2714 100644 --- a/sys/dev/isa/gscsioreg.h +++ b/sys/dev/isa/gscsioreg.h @@ -1,4 +1,4 @@ -/* $OpenBSD: gscsioreg.h,v 1.1 2004/05/23 17:41:09 grange Exp $ */ +/* $OpenBSD: gscsioreg.h,v 1.2 2004/11/17 16:53:05 mickey Exp $ */ /* * Copyright (c) 2004 Alexander Yurchenko <grange@openbsd.org> * @@ -19,9 +19,6 @@ * National Semiconductor Geode SC1100 Super I/O register definitions. */ -/* Possible index-data register pair base addresses */ -#define GSCSIO_IOBASE1 0x2e -#define GSCSIO_IOBASE2 0x15c #define GSCSIO_IOSIZE 2 /* I/O space size */ /* Index-data register pair */ diff --git a/sys/dev/isa/nsclpcsio_isa.c b/sys/dev/isa/nsclpcsio_isa.c index f4b457b01e4..4fcf0519223 100644 --- a/sys/dev/isa/nsclpcsio_isa.c +++ b/sys/dev/isa/nsclpcsio_isa.c @@ -1,4 +1,4 @@ -/* $OpenBSD: nsclpcsio_isa.c,v 1.4 2004/06/05 14:47:59 grange Exp $ */ +/* $OpenBSD: nsclpcsio_isa.c,v 1.5 2004/11/17 16:53:05 mickey Exp $ */ /* $NetBSD: nsclpcsio_isa.c,v 1.5 2002/10/22 16:18:26 drochner Exp $ */ /* @@ -54,9 +54,6 @@ #define DPRINTF(x) #endif -#define SIO_BADDR0 0x2e -#define SIO_BADDR1 0x4e - #define SIO_REG_SID 0x20 /* Super I/O ID */ #define SIO_SID_PC87366 0xE9 /* PC87366 is identified by 0xE9.*/ @@ -218,7 +215,6 @@ struct timeout nsclpcsio_timeout; static u_int8_t nsread(bus_space_tag_t, bus_space_handle_t, int); static void nswrite(bus_space_tag_t, bus_space_handle_t, int, u_int8_t); -static int nscheck(bus_space_tag_t, int); void nsclpcsio_gpio_init(struct nsclpcsio_softc *); int nsclpcsio_gpio_pin_read(void *, int); @@ -245,43 +241,35 @@ nswrite(bus_space_tag_t iot, bus_space_handle_t ioh, int idx, u_int8_t data) bus_space_write_1(iot, ioh, 1, data); } -static int -nscheck(bus_space_tag_t iot, int base) +int +nsclpcsio_isa_match(struct device *parent, void *match, void *aux) { + struct isa_attach_args *ia = aux; + bus_space_tag_t iot; bus_space_handle_t ioh; + int iobase; int rv = 0; - if (bus_space_map(iot, base, 2, 0, &ioh)) + iot = ia->ia_iot; + iobase = ia->ipa_io[0].base; + if (bus_space_map(iot, iobase, 2, 0, &ioh)) return (0); + if (nsread(iot, ioh, SIO_REG_SID) == SIO_SID_PC87366) rv = 1; + bus_space_unmap(iot, ioh, 2); - return (rv); -} -int -nsclpcsio_isa_match(struct device *parent, void *match, void *aux) -{ - struct isa_attach_args *ia = aux; - int iobase; + if (rv) { + ia->ipa_nio = 1; + ia->ipa_io[0].length = 2; + + ia->ipa_nmem = 0; + ia->ipa_nirq = 0; + ia->ipa_ndrq = 0; + } - /* PC87366 has two possible locations depending on wiring */ - iobase = SIO_BADDR0; - if (nscheck(ia->ia_iot, iobase)) - goto found; - iobase = SIO_BADDR1; - if (nscheck(ia->ia_iot, iobase)) - goto found; - return (0); - -found: - ia->ipa_nio = 1; - ia->ipa_io[0].base = iobase; - ia->ipa_io[0].length = 2; - ia->ipa_nmem = 0; - ia->ipa_nirq = 0; - ia->ipa_ndrq = 0; - return (1); + return (rv); } void |