Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch/hp700 Don't panic if something bad happens in attac...
details: https://anonhg.NetBSD.org/src/rev/13cb6cde3cc9
branches: trunk
changeset: 759502:13cb6cde3cc9
user: skrll <skrll%NetBSD.org@localhost>
date: Sat Dec 11 19:32:05 2010 +0000
description:
Don't panic if something bad happens in attachment. Just print and error
and return.
diffstat:
sys/arch/hp700/dev/asp.c | 22 ++++++++++++++--------
sys/arch/hp700/dev/astro.c | 14 +++++++++-----
sys/arch/hp700/dev/lasi.c | 16 ++++++++++------
sys/arch/hp700/gsc/fdc_gsc.c | 10 ++++++----
sys/arch/hp700/gsc/oosiop_gsc.c | 16 ++++++++++------
sys/arch/hp700/gsc/osiop_gsc.c | 16 ++++++++++------
6 files changed, 59 insertions(+), 35 deletions(-)
diffs (236 lines):
diff -r 87499c8d061f -r 13cb6cde3cc9 sys/arch/hp700/dev/asp.c
--- a/sys/arch/hp700/dev/asp.c Sat Dec 11 18:42:33 2010 +0000
+++ b/sys/arch/hp700/dev/asp.c Sat Dec 11 19:32:05 2010 +0000
@@ -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));
diff -r 87499c8d061f -r 13cb6cde3cc9 sys/arch/hp700/dev/astro.c
--- a/sys/arch/hp700/dev/astro.c Sat Dec 11 18:42:33 2010 +0000
+++ b/sys/arch/hp700/dev/astro.c Sat Dec 11 19:32:05 2010 +0000
@@ -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);
diff -r 87499c8d061f -r 13cb6cde3cc9 sys/arch/hp700/dev/lasi.c
--- a/sys/arch/hp700/dev/lasi.c Sat Dec 11 18:42:33 2010 +0000
+++ b/sys/arch/hp700/dev/lasi.c Sat Dec 11 19:32:05 2010 +0000
@@ -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? */
diff -r 87499c8d061f -r 13cb6cde3cc9 sys/arch/hp700/gsc/fdc_gsc.c
--- a/sys/arch/hp700/gsc/fdc_gsc.c Sat Dec 11 18:42:33 2010 +0000
+++ b/sys/arch/hp700/gsc/fdc_gsc.c Sat Dec 11 19:32:05 2010 +0000
@@ -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;
diff -r 87499c8d061f -r 13cb6cde3cc9 sys/arch/hp700/gsc/oosiop_gsc.c
--- a/sys/arch/hp700/gsc/oosiop_gsc.c Sat Dec 11 18:42:33 2010 +0000
+++ b/sys/arch/hp700/gsc/oosiop_gsc.c Sat Dec 11 19:32:05 2010 +0000
@@ -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)
diff -r 87499c8d061f -r 13cb6cde3cc9 sys/arch/hp700/gsc/osiop_gsc.c
--- a/sys/arch/hp700/gsc/osiop_gsc.c Sat Dec 11 18:42:33 2010 +0000
+++ b/sys/arch/hp700/gsc/osiop_gsc.c Sat Dec 11 19:32:05 2010 +0000
@@ -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)
Home |
Main Index |
Thread Index |
Old Index