Module Name: src Committed By: skrll Date: Sat Dec 11 19:32:06 UTC 2010
Modified Files: src/sys/arch/hp700/dev: asp.c astro.c lasi.c src/sys/arch/hp700/gsc: fdc_gsc.c oosiop_gsc.c osiop_gsc.c Log Message: Don't panic if something bad happens in attachment. Just print and error and return. To generate a diff of this commit: cvs rdiff -u -r1.16 -r1.17 src/sys/arch/hp700/dev/asp.c \ src/sys/arch/hp700/dev/lasi.c cvs rdiff -u -r1.10 -r1.11 src/sys/arch/hp700/dev/astro.c cvs rdiff -u -r1.8 -r1.9 src/sys/arch/hp700/gsc/fdc_gsc.c cvs rdiff -u -r1.9 -r1.10 src/sys/arch/hp700/gsc/oosiop_gsc.c cvs rdiff -u -r1.16 -r1.17 src/sys/arch/hp700/gsc/osiop_gsc.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sys/arch/hp700/dev/asp.c diff -u src/sys/arch/hp700/dev/asp.c:1.16 src/sys/arch/hp700/dev/asp.c:1.17 --- src/sys/arch/hp700/dev/asp.c:1.16 Sun Dec 5 12:19:09 2010 +++ src/sys/arch/hp700/dev/asp.c Sat Dec 11 19:32:05 2010 @@ -1,4 +1,4 @@ -/* $NetBSD: asp.c,v 1.16 2010/12/05 12:19:09 skrll Exp $ */ +/* $NetBSD: asp.c,v 1.17 2010/12/11 19:32:05 skrll Exp $ */ /* $OpenBSD: asp.c,v 1.5 2000/02/09 05:04:22 mickey Exp $ */ @@ -37,7 +37,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: asp.c,v 1.16 2010/12/05 12:19:09 skrll Exp $"); +__KERNEL_RCSID(0, "$NetBSD: asp.c,v 1.17 2010/12/11 19:32:05 skrll Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -201,24 +201,30 @@ * Map the ASP interrupt registers. */ if (bus_space_map(ca->ca_iot, ca->ca_hpa + ASP_REG_INT, - sizeof(struct asp_trs), 0, &ioh)) - panic("aspattach: can't map interrupt registers."); + sizeof(struct asp_trs), 0, &ioh)) { + aprint_error(": can't map interrupt registers.\n"); + return; + } sc->sc_trs = (struct asp_trs *)ioh; /* * Map the ASP miscellaneous registers. */ if (bus_space_map(ca->ca_iot, ca->ca_hpa + ASP_REG_MISC, - sizeof(struct asp_hwr), 0, &ioh)) - panic("aspattach: can't map miscellaneous registers."); + sizeof(struct asp_hwr), 0, &ioh)) { + aprint_error(": can't map miscellaneous registers.\n"); + return; + } sc->sc_hw = (struct asp_hwr *)ioh; /* * Map the Ethernet address and read it out. */ if (bus_space_map(ca->ca_iot, ca->ca_hpa + ASP_ETHER_ADDR, - sizeof(ga.ga_ether_address), 0, &ioh)) - panic("aspattach: can't map EEPROM."); + sizeof(ga.ga_ether_address), 0, &ioh)) { + aprint_error(": can't map EEPROM.\n"); + return; + } bus_space_read_region_1(ca->ca_iot, ioh, 0, ga.ga_ether_address, sizeof(ga.ga_ether_address)); bus_space_unmap(ca->ca_iot, ioh, sizeof(ga.ga_ether_address)); Index: src/sys/arch/hp700/dev/lasi.c diff -u src/sys/arch/hp700/dev/lasi.c:1.16 src/sys/arch/hp700/dev/lasi.c:1.17 --- src/sys/arch/hp700/dev/lasi.c:1.16 Sun Dec 5 12:19:09 2010 +++ src/sys/arch/hp700/dev/lasi.c Sat Dec 11 19:32:05 2010 @@ -1,4 +1,4 @@ -/* $NetBSD: lasi.c,v 1.16 2010/12/05 12:19:09 skrll Exp $ */ +/* $NetBSD: lasi.c,v 1.17 2010/12/11 19:32:05 skrll Exp $ */ /* $OpenBSD: lasi.c,v 1.4 2001/06/09 03:57:19 mickey Exp $ */ @@ -29,7 +29,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: lasi.c,v 1.16 2010/12/05 12:19:09 skrll Exp $"); +__KERNEL_RCSID(0, "$NetBSD: lasi.c,v 1.17 2010/12/11 19:32:05 skrll Exp $"); #undef LASIDEBUG @@ -162,16 +162,20 @@ * Map the LASI interrupt registers. */ if (bus_space_map(ca->ca_iot, ca->ca_hpa + LASI_REG_INT, - sizeof(struct lasi_trs), 0, &ioh)) - panic("lasiattach: can't map interrupt registers"); + sizeof(struct lasi_trs), 0, &ioh)) { + aprint_error(": can't map interrupt registers\n"); + return; + } sc->sc_trs = (struct lasi_trs *)ioh; /* * Map the LASI miscellaneous registers. */ if (bus_space_map(ca->ca_iot, ca->ca_hpa + LASI_REG_MISC, - sizeof(struct lasi_hwr), 0, &ioh)) - panic("lasiattach: can't map misc registers"); + sizeof(struct lasi_hwr), 0, &ioh)) { + aprint_error(": can't map misc registers\n"); + return; + } sc->sc_hw = (struct lasi_hwr *)ioh; /* XXX should we reset the chip here? */ Index: src/sys/arch/hp700/dev/astro.c diff -u src/sys/arch/hp700/dev/astro.c:1.10 src/sys/arch/hp700/dev/astro.c:1.11 --- src/sys/arch/hp700/dev/astro.c:1.10 Fri Nov 12 13:18:57 2010 +++ src/sys/arch/hp700/dev/astro.c Sat Dec 11 19:32:05 2010 @@ -1,4 +1,4 @@ -/* $NetBSD: astro.c,v 1.10 2010/11/12 13:18:57 uebayasi Exp $ */ +/* $NetBSD: astro.c,v 1.11 2010/12/11 19:32:05 skrll Exp $ */ /* $OpenBSD: astro.c,v 1.8 2007/10/06 23:50:54 krw Exp $ */ @@ -278,13 +278,17 @@ size = (1 << (iova_bits - PAGE_SHIFT)) * sizeof(uint64_t); TAILQ_INIT(&mlist); - if (uvm_pglistalloc(size, 0, -1, PAGE_SIZE, 0, &mlist, 1, 0) != 0) - panic("astrottach: no memory"); + if (uvm_pglistalloc(size, 0, -1, PAGE_SIZE, 0, &mlist, 1, 0) != 0) { + aprint_error(": can't allocate PDIR\n"); + return; + } va = uvm_km_alloc(kernel_map, size, 0, UVM_KMF_VAONLY | UVM_KMF_NOWAIT); - if (va == 0) - panic("astroattach: no memory"); + if (va == 0) { + aprint_error(": can't map PDIR\n"); + return; + } sc->sc_pdir = (uint64_t *)va; m = TAILQ_FIRST(&mlist); Index: src/sys/arch/hp700/gsc/fdc_gsc.c diff -u src/sys/arch/hp700/gsc/fdc_gsc.c:1.8 src/sys/arch/hp700/gsc/fdc_gsc.c:1.9 --- src/sys/arch/hp700/gsc/fdc_gsc.c:1.8 Tue Nov 3 05:07:25 2009 +++ src/sys/arch/hp700/gsc/fdc_gsc.c Sat Dec 11 19:32:06 2010 @@ -1,4 +1,4 @@ -/* $NetBSD: fdc_gsc.c,v 1.8 2009/11/03 05:07:25 snj Exp $ */ +/* $NetBSD: fdc_gsc.c,v 1.9 2010/12/11 19:32:06 skrll Exp $ */ /* $OpenBSD: fdc_gsc.c,v 1.1 1998/09/30 04:45:46 mickey Exp $ */ @@ -29,7 +29,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: fdc_gsc.c,v 1.8 2009/11/03 05:07:25 snj Exp $"); +__KERNEL_RCSID(0, "$NetBSD: fdc_gsc.c,v 1.9 2010/12/11 19:32:06 skrll Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -82,8 +82,10 @@ sc->sc_dev = self; /* Re-map the I/O space. */ - if (bus_space_map(ca->ca_iot, ca->ca_hpa, IOMOD_HPASIZE, 0, &ioh)) - panic("fdcattach: couldn't map I/O ports"); + if (bus_space_map(ca->ca_iot, ca->ca_hpa, IOMOD_HPASIZE, 0, &ioh)) { + aprint_error(": can't map I/O ports\n"); + return; + } ioh |= IOMOD_DEVOFFSET; sc->sc_iot = ca->ca_iot; Index: src/sys/arch/hp700/gsc/oosiop_gsc.c diff -u src/sys/arch/hp700/gsc/oosiop_gsc.c:1.9 src/sys/arch/hp700/gsc/oosiop_gsc.c:1.10 --- src/sys/arch/hp700/gsc/oosiop_gsc.c:1.9 Sun Dec 5 12:19:09 2010 +++ src/sys/arch/hp700/gsc/oosiop_gsc.c Sat Dec 11 19:32:06 2010 @@ -1,4 +1,4 @@ -/* $NetBSD: oosiop_gsc.c,v 1.9 2010/12/05 12:19:09 skrll Exp $ */ +/* $NetBSD: oosiop_gsc.c,v 1.10 2010/12/11 19:32:06 skrll Exp $ */ /* * Copyright (c) 2001 Matt Fredette. All rights reserved. @@ -80,7 +80,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: oosiop_gsc.c,v 1.9 2010/12/05 12:19:09 skrll Exp $"); +__KERNEL_RCSID(0, "$NetBSD: oosiop_gsc.c,v 1.10 2010/12/11 19:32:06 skrll Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -146,11 +146,15 @@ sc->sc_bst = ga->ga_iot; sc->sc_dmat = ga->ga_dmatag; if (bus_space_map(sc->sc_bst, ga->ga_hpa, - OOSIOP_GSC_OFFSET + OOSIOP_NREGS, 0, &ioh)) - panic("%s: couldn't map I/O ports", __func__); + OOSIOP_GSC_OFFSET + OOSIOP_NREGS, 0, &ioh)) { + aprint_error(": couldn't map I/O ports\n"); + return; + } if (bus_space_subregion(sc->sc_bst, ioh, - OOSIOP_GSC_OFFSET, OOSIOP_NREGS, &sc->sc_bsh)) - panic("%s: couldn't get chip ports", __func__); + OOSIOP_GSC_OFFSET, OOSIOP_NREGS, &sc->sc_bsh)) { + aprint_error(": couldn't get chip ports\n"); + return; + } sc->sc_freq = ga->ga_ca.ca_pdc_iodc_read->filler2[14]; if (sc->sc_freq == 0) Index: src/sys/arch/hp700/gsc/osiop_gsc.c diff -u src/sys/arch/hp700/gsc/osiop_gsc.c:1.16 src/sys/arch/hp700/gsc/osiop_gsc.c:1.17 --- src/sys/arch/hp700/gsc/osiop_gsc.c:1.16 Sun Dec 5 12:19:09 2010 +++ src/sys/arch/hp700/gsc/osiop_gsc.c Sat Dec 11 19:32:06 2010 @@ -1,4 +1,4 @@ -/* $NetBSD: osiop_gsc.c,v 1.16 2010/12/05 12:19:09 skrll Exp $ */ +/* $NetBSD: osiop_gsc.c,v 1.17 2010/12/11 19:32:06 skrll Exp $ */ /* * Copyright (c) 2001 Matt Fredette. All rights reserved. @@ -80,7 +80,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: osiop_gsc.c,v 1.16 2010/12/05 12:19:09 skrll Exp $"); +__KERNEL_RCSID(0, "$NetBSD: osiop_gsc.c,v 1.17 2010/12/11 19:32:06 skrll Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -146,11 +146,15 @@ sc->sc_bst = ga->ga_iot; sc->sc_dmat = ga->ga_dmatag; if (bus_space_map(sc->sc_bst, ga->ga_hpa, - OSIOP_GSC_OFFSET + OSIOP_NREGS, 0, &ioh)) - panic("%s: couldn't map I/O ports", __func__); + OSIOP_GSC_OFFSET + OSIOP_NREGS, 0, &ioh)) { + aprint_error(": couldn't map I/O ports\n"); + return; + } if (bus_space_subregion(sc->sc_bst, ioh, - OSIOP_GSC_OFFSET, OSIOP_NREGS, &sc->sc_reg)) - panic("%s: couldn't get chip ports", __func__); + OSIOP_GSC_OFFSET, OSIOP_NREGS, &sc->sc_reg)) { + aprint_error(": couldn't get chip ports\n"); + return; + } sc->sc_clock_freq = ga->ga_ca.ca_pdc_iodc_read->filler2[14] / 1000000; if (!sc->sc_clock_freq)