if the register space os the ISDN card can't be mapped, abort device

attachment instead of dereferencing NULL and so
(this needs a serious cleanup -- the framework was thought to be generally
usable for ~all PCI ISDN cards; this didn't work out, so we are left
with a lot of nonsense to support just 1 particular card type...)
This commit is contained in:
drochner 2004-07-22 19:14:39 +00:00
parent c8a35368a7
commit 87db87bf21
3 changed files with 14 additions and 12 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: isic_pci.c,v 1.20 2003/12/04 13:57:31 keihan Exp $ */
/* $NetBSD: isic_pci.c,v 1.21 2004/07/22 19:14:39 drochner Exp $ */
/*-
* Copyright (c) 2002 The NetBSD Foundation, Inc.
@ -37,7 +37,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: isic_pci.c,v 1.20 2003/12/04 13:57:31 keihan Exp $");
__KERNEL_RCSID(0, "$NetBSD: isic_pci.c,v 1.21 2004/07/22 19:14:39 drochner Exp $");
#include <sys/param.h>
#include <sys/errno.h>
@ -91,7 +91,7 @@ static const struct isic_pci_product {
pci_product_id_t npp_product;
int cardtype;
const char * name;
void (*attach)(struct pci_isic_softc *psc, struct pci_attach_args *pa);
int (*attach)(struct pci_isic_softc *psc, struct pci_attach_args *pa);
void (*pciattach)(struct pci_isic_softc *psc, struct pci_attach_args *pa, const char *cardname);
} isic_pci_products[] = {
{ PCI_VENDOR_ELSA, PCI_PRODUCT_ELSA_QS1PCI,
@ -156,7 +156,8 @@ isic_pci_attach(parent, self, aux)
callout_init(&sc->sc_T4_callout);
/* card initilization and sc setup */
prod->attach(psc, pa);
if (!prod->attach(psc, pa))
return;
/* generic setup, if needed for this card */
if (prod->pciattach) prod->pciattach(psc, pa, prod->name);

View File

@ -1,4 +1,4 @@
/* $NetBSD: isic_pci.h,v 1.7 2003/12/04 13:57:31 keihan Exp $ */
/* $NetBSD: isic_pci.h,v 1.8 2004/07/22 19:14:39 drochner Exp $ */
/*-
* Copyright (c) 2002 The NetBSD Foundation, Inc.
@ -53,6 +53,5 @@ struct pci_isic_softc {
int ledblinkfreq;
};
extern void isic_attach_Eqs1pp __P((struct pci_isic_softc *psc, struct pci_attach_args *pa));
extern void isic_attach_fritzPci __P((struct pci_isic_softc *psc, struct pci_attach_args *pa));
extern int isic_attach_Eqs1pp __P((struct pci_isic_softc *psc, struct pci_attach_args *pa));
extern int isic_intr_qs1p(void *);

View File

@ -1,4 +1,4 @@
/* $NetBSD: isic_pci_elsa_qs1p.c,v 1.11 2003/05/08 21:18:42 martin Exp $ */
/* $NetBSD: isic_pci_elsa_qs1p.c,v 1.12 2004/07/22 19:14:39 drochner Exp $ */
/*
* Copyright (c) 1997, 1999 Hellmuth Michaelis. All rights reserved.
@ -32,7 +32,7 @@
*---------------------------------------------------------------------------*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: isic_pci_elsa_qs1p.c,v 1.11 2003/05/08 21:18:42 martin Exp $");
__KERNEL_RCSID(0, "$NetBSD: isic_pci_elsa_qs1p.c,v 1.12 2004/07/22 19:14:39 drochner Exp $");
#include <sys/param.h>
#include <sys/kernel.h>
@ -205,7 +205,7 @@ eqs1pp_read_reg(struct isic_softc *sc, int what, bus_size_t offs)
* isic_attach_Eqs1pp - attach for ELSA QuickStep 1000pro/PCI
*---------------------------------------------------------------------------*/
void
int
isic_attach_Eqs1pp(psc, pa)
struct pci_isic_softc *psc;
struct pci_attach_args *pa;
@ -221,7 +221,7 @@ isic_attach_Eqs1pp(psc, pa)
&& pci_mapreg_map(pa, ELSA_PORT0_IO_MAPOFF, PCI_MAPREG_TYPE_IO, 0,
&sc->sc_maps[0].t, &sc->sc_maps[0].h, &psc->sc_base, &psc->sc_size) != 0) {
printf("%s: can't map card registers\n", sc->sc_dev.dv_xname);
return;
return (0);
}
/* PLX9050 Errata #1 */
@ -236,7 +236,7 @@ isic_attach_Eqs1pp(psc, pa)
if (pci_mapreg_map(pa, ELSA_PORT1_MAPOFF, PCI_MAPREG_TYPE_IO, 0,
&sc->sc_maps[1].t, &sc->sc_maps[1].h, NULL, NULL)) {
printf("%s: can't map i/o space\n", sc->sc_dev.dv_xname);
return;
return (0);
}
/* setup access routines */
@ -272,6 +272,8 @@ isic_attach_Eqs1pp(psc, pa)
/* disable any interrupts */
IPAC_WRITE(IPAC_MASK, 0xff);
bus_space_write_1(sc->sc_maps[0].t, sc->sc_maps[0].h, 0x4c, 0x01);
return (1);
}
int