Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. =================================================================== RCS file: /ftp/cvs/cvsroot/src/sys/dev/isa/if_lc_isa.c,v rcsdiff: /ftp/cvs/cvsroot/src/sys/dev/isa/if_lc_isa.c,v: warning: Unknown phrases like `commitid ...;' are present. retrieving revision 1.16 retrieving revision 1.16.6.4 diff -u -p -r1.16 -r1.16.6.4 --- src/sys/dev/isa/if_lc_isa.c 2002/10/02 03:10:48 1.16 +++ src/sys/dev/isa/if_lc_isa.c 2005/02/04 11:46:08 1.16.6.4 @@ -1,4 +1,4 @@ -/* $NetBSD: if_lc_isa.c,v 1.16 2002/10/02 03:10:48 thorpej Exp $ */ +/* $NetBSD: if_lc_isa.c,v 1.16.6.4 2005/02/04 11:46:08 skrll Exp $ */ /*- * Copyright (c) 1994, 1995, 1997 Matt Thomas @@ -33,7 +33,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: if_lc_isa.c,v 1.16 2002/10/02 03:10:48 thorpej Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_lc_isa.c,v 1.16.6.4 2005/02/04 11:46:08 skrll Exp $"); #include #include @@ -62,10 +62,9 @@ __KERNEL_RCSID(0, "$NetBSD: if_lc_isa.c, extern struct cfdriver lc_cd; -static int lemac_isa_find __P((lemac_softc_t *, struct isa_attach_args *, - int)); -static int lemac_isa_probe __P((struct device *, struct cfdata *, void *)); -static void lemac_isa_attach __P((struct device *, struct device *, void *)); +static int lemac_isa_find(lemac_softc_t *, struct isa_attach_args *, int); +static int lemac_isa_probe(struct device *, struct cfdata *, void *); +static void lemac_isa_attach(struct device *, struct device *, void *); CFATTACH_DECL(lc_isa, sizeof(lemac_softc_t), lemac_isa_probe, lemac_isa_attach, NULL, NULL); @@ -93,7 +92,7 @@ lemac_isa_find(sc, ia, attach) /* * Disallow wildcarded i/o addresses. */ - if (ia->ia_io[0].ir_addr == ISACF_PORT_DEFAULT) + if (ia->ia_io[0].ir_addr == ISA_UNKNOWN_PORT) return 0; /* @@ -124,22 +123,27 @@ lemac_isa_find(sc, ia, attach) */ lemac_info_get(sc->sc_iot, sc->sc_ioh, &maddr, &msize, &irq); - if (ia->ia_iomem[0].ir_addr != ISACF_IOMEM_DEFAULT && + if (ia->ia_iomem[0].ir_addr != ISA_UNKNOWN_IOMEM && ia->ia_iomem[0].ir_addr != maddr) goto outio; - sc->sc_memt = ia->ia_memt; - if (bus_space_map(ia->ia_memt, maddr, msize, 0, &sc->sc_memh)) { - if (attach) + if (attach) { + if (msize == 0) { + printf(": memory configuration is invalid\n"); + goto outio; + } + + sc->sc_memt = ia->ia_memt; + if (bus_space_map(ia->ia_memt, maddr, msize, 0, &sc->sc_memh)) { printf(": can't map mem space\n"); - goto outio; + goto outio; + } } - /* * Double-check IRQ configuration. */ - if (ia->ia_irq[0].ir_irq != ISACF_IRQ_DEFAULT && + if (ia->ia_irq[0].ir_irq != ISA_UNKNOWN_IRQ && ia->ia_irq[0].ir_irq != irq) printf("%s: overriding IRQ %d to %d\n", sc->sc_dv.dv_xname, ia->ia_irq[0].ir_irq, irq); @@ -173,7 +177,7 @@ lemac_isa_find(sc, ia, attach) ia->ia_ndrq = 0; - if (rv == 0 || !attach) + if (rv == 0 && attach) bus_space_unmap(sc->sc_memt, sc->sc_memh, msize); outio: if (rv == 0 || !attach) @@ -190,7 +194,8 @@ lemac_isa_probe(parent, match, aux) struct isa_attach_args *ia = aux; struct cfdata *cf = match; lemac_softc_t sc; - (void)sprintf(sc.sc_dv.dv_xname, "%s%d", lc_cd.cd_name, cf->cf_unit); + snprintf(sc.sc_dv.dv_xname, sizeof(sc.sc_dv.dv_xname), "%s%d", + lc_cd.cd_name, cf->cf_unit); return lemac_isa_find(&sc, ia, 0); }