Print diagnostics in only one place if intr_establish() or function_enable()
fails. Also, be a little more careful about passing up error values, and consistently clear our interrupt handler pointer.
This commit is contained in:
parent
90f47f6065
commit
70ca4b2fa7
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: aic_pcmcia.c,v 1.26 2004/08/10 06:23:50 mycroft Exp $ */
|
||||
/* $NetBSD: aic_pcmcia.c,v 1.27 2004/08/10 15:29:56 mycroft Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1997 Marc Horowitz. All rights reserved.
|
||||
@ -30,7 +30,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: aic_pcmcia.c,v 1.26 2004/08/10 06:23:50 mycroft Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: aic_pcmcia.c,v 1.27 2004/08/10 15:29:56 mycroft Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
@ -138,11 +138,8 @@ aic_pcmcia_attach(parent, self, aux)
|
||||
sc->sc_ioh = cfe->iospace[0].handle.ioh;
|
||||
|
||||
error = aic_pcmcia_enable(self, 1);
|
||||
if (error) {
|
||||
aprint_error("%s: enable failed, error=%d\n", self->dv_xname,
|
||||
error);
|
||||
if (error)
|
||||
goto fail;
|
||||
}
|
||||
|
||||
if (!aic_find(sc->sc_iot, sc->sc_ioh)) {
|
||||
aprint_error("%s: unable to detect chip!\n", self->dv_xname);
|
||||
@ -191,6 +188,7 @@ aic_pcmcia_enable(self, onoff)
|
||||
int onoff;
|
||||
{
|
||||
struct aic_pcmcia_softc *sc = (void *)self;
|
||||
int error;
|
||||
|
||||
if (onoff) {
|
||||
/*
|
||||
@ -203,17 +201,13 @@ aic_pcmcia_enable(self, onoff)
|
||||
/* Establish the interrupt handler. */
|
||||
sc->sc_ih = pcmcia_intr_establish(sc->sc_pf, IPL_BIO,
|
||||
aicintr, &sc->sc_aic);
|
||||
if (sc->sc_ih == NULL) {
|
||||
printf("%s: couldn't establish interrupt handler\n",
|
||||
sc->sc_aic.sc_dev.dv_xname);
|
||||
if (!sc->sc_ih)
|
||||
return (EIO);
|
||||
}
|
||||
|
||||
if (pcmcia_function_enable(sc->sc_pf)) {
|
||||
printf("%s: couldn't enable PCMCIA function\n",
|
||||
sc->sc_aic.sc_dev.dv_xname);
|
||||
error = pcmcia_function_enable(sc->sc_pf);
|
||||
if (error) {
|
||||
pcmcia_intr_disestablish(sc->sc_pf, sc->sc_ih);
|
||||
return (EIO);
|
||||
return (error);
|
||||
}
|
||||
|
||||
/* Initialize only chip. */
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: esp_pcmcia.c,v 1.18 2004/08/10 07:04:19 mycroft Exp $ */
|
||||
/* $NetBSD: esp_pcmcia.c,v 1.19 2004/08/10 15:29:56 mycroft Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2000, 2004 The NetBSD Foundation, Inc.
|
||||
@ -37,7 +37,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: esp_pcmcia.c,v 1.18 2004/08/10 07:04:19 mycroft Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: esp_pcmcia.c,v 1.19 2004/08/10 15:29:56 mycroft Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
@ -221,11 +221,8 @@ esp_pcmcia_attach(parent, self, aux)
|
||||
esp_pcmcia_init(esc);
|
||||
|
||||
error = esp_pcmcia_enable(self, 1);
|
||||
if (error) {
|
||||
aprint_error("%s: enable failed, error=%d\n", self->dv_xname,
|
||||
error);
|
||||
if (error)
|
||||
goto fail;
|
||||
}
|
||||
|
||||
sc->sc_adapter.adapt_minphys = minphys;
|
||||
sc->sc_adapter.adapt_request = ncr53c9x_scsipi_request;
|
||||
@ -299,6 +296,7 @@ esp_pcmcia_enable(arg, onoff)
|
||||
int onoff;
|
||||
{
|
||||
struct esp_pcmcia_softc *sc = (void *)arg;
|
||||
int error;
|
||||
|
||||
if (onoff) {
|
||||
/*
|
||||
@ -314,19 +312,14 @@ esp_pcmcia_enable(arg, onoff)
|
||||
/* Establish the interrupt handler. */
|
||||
sc->sc_ih = pcmcia_intr_establish(sc->sc_pf, IPL_BIO,
|
||||
ncr53c9x_intr, &sc->sc_ncr53c9x);
|
||||
if (sc->sc_ih == NULL) {
|
||||
printf("%s: couldn't establish interrupt handler\n",
|
||||
sc->sc_ncr53c9x.sc_dev.dv_xname);
|
||||
if (!sc->sc_ih)
|
||||
return (EIO);
|
||||
}
|
||||
#endif
|
||||
|
||||
if (pcmcia_function_enable(sc->sc_pf)) {
|
||||
printf("%s: couldn't enable PCMCIA function\n",
|
||||
sc->sc_ncr53c9x.sc_dev.dv_xname);
|
||||
pcmcia_intr_disestablish(sc->sc_pf,
|
||||
sc->sc_ih);
|
||||
return (EIO);
|
||||
error = pcmcia_function_enable(sc->sc_pf);
|
||||
if (error) {
|
||||
pcmcia_intr_disestablish(sc->sc_pf, sc->sc_ih);
|
||||
return (error);
|
||||
}
|
||||
|
||||
/* Initialize only chip. */
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: if_ep_pcmcia.c,v 1.48 2004/08/10 08:56:08 mycroft Exp $ */
|
||||
/* $NetBSD: if_ep_pcmcia.c,v 1.49 2004/08/10 15:29:56 mycroft Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1998, 2000, 2004 The NetBSD Foundation, Inc.
|
||||
@ -67,7 +67,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: if_ep_pcmcia.c,v 1.48 2004/08/10 08:56:08 mycroft Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: if_ep_pcmcia.c,v 1.49 2004/08/10 15:29:56 mycroft Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
@ -181,13 +181,11 @@ ep_pcmcia_enable(sc)
|
||||
|
||||
/* establish the interrupt. */
|
||||
sc->sc_ih = pcmcia_intr_establish(pf, IPL_NET, epintr, sc);
|
||||
if (sc->sc_ih == NULL) {
|
||||
printf("%s: couldn't establish interrupt\n",
|
||||
sc->sc_dev.dv_xname);
|
||||
return (1);
|
||||
}
|
||||
if (!sc->sc_ih)
|
||||
return (EIO);
|
||||
|
||||
if ((error = pcmcia_function_enable(pf))) {
|
||||
error = pcmcia_function_enable(pf);
|
||||
if (error) {
|
||||
pcmcia_intr_disestablish(pf, sc->sc_ih);
|
||||
return (error);
|
||||
}
|
||||
@ -218,6 +216,7 @@ ep_pcmcia_disable(sc)
|
||||
|
||||
pcmcia_function_disable(psc->sc_pf);
|
||||
pcmcia_intr_disestablish(psc->sc_pf, sc->sc_ih);
|
||||
sc->sc_ih = 0;
|
||||
}
|
||||
|
||||
void
|
||||
@ -233,6 +232,7 @@ ep_pcmcia_attach(parent, self, aux)
|
||||
u_int8_t myla[ETHER_ADDR_LEN];
|
||||
u_int8_t *enaddr = NULL;
|
||||
int i;
|
||||
int error;
|
||||
|
||||
aprint_normal("\n");
|
||||
psc->sc_pf = pa->pf;
|
||||
@ -297,10 +297,9 @@ ep_pcmcia_attach(parent, self, aux)
|
||||
goto iomap_failed;
|
||||
}
|
||||
|
||||
if (ep_pcmcia_enable(sc)) {
|
||||
aprint_error("%s: function enable failed\n", self->dv_xname);
|
||||
error = ep_pcmcia_enable(sc);
|
||||
if (error)
|
||||
goto enable_failed;
|
||||
}
|
||||
sc->enabled = 1;
|
||||
|
||||
switch (pa->product) {
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: if_ne_pcmcia.c,v 1.129 2004/08/10 05:24:56 mycroft Exp $ */
|
||||
/* $NetBSD: if_ne_pcmcia.c,v 1.130 2004/08/10 15:29:56 mycroft Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1997 Marc Horowitz. All rights reserved.
|
||||
@ -30,7 +30,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: if_ne_pcmcia.c,v 1.129 2004/08/10 05:24:56 mycroft Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: if_ne_pcmcia.c,v 1.130 2004/08/10 15:29:56 mycroft Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
@ -586,11 +586,8 @@ ne_pcmcia_attach(parent, self, aux)
|
||||
}
|
||||
|
||||
error = ne_pcmcia_enable(dsc);
|
||||
if (error) {
|
||||
aprint_error("%s: enable failed, error=%d\n", self->dv_xname,
|
||||
error);
|
||||
if (error)
|
||||
goto fail;
|
||||
}
|
||||
|
||||
/* Set up power management hooks. */
|
||||
dsc->sc_enable = ne_pcmcia_enable;
|
||||
@ -749,11 +746,8 @@ ne_pcmcia_enable(dsc)
|
||||
/* set up the interrupt */
|
||||
psc->sc_ih = pcmcia_intr_establish(psc->sc_pf, IPL_NET, dp8390_intr,
|
||||
dsc);
|
||||
if (psc->sc_ih == NULL) {
|
||||
printf("%s: couldn't establish interrupt\n",
|
||||
dsc->sc_dev.dv_xname);
|
||||
if (!psc->sc_ih)
|
||||
goto fail_1;
|
||||
}
|
||||
|
||||
if (pcmcia_function_enable(psc->sc_pf))
|
||||
goto fail_2;
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: if_ray.c,v 1.51 2004/08/10 08:57:50 mycroft Exp $ */
|
||||
/* $NetBSD: if_ray.c,v 1.52 2004/08/10 15:29:56 mycroft Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2000 Christian E. Hopps
|
||||
@ -57,7 +57,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: if_ray.c,v 1.51 2004/08/10 08:57:50 mycroft Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: if_ray.c,v 1.52 2004/08/10 15:29:56 mycroft Exp $");
|
||||
|
||||
#include "opt_inet.h"
|
||||
#include "bpfilter.h"
|
||||
@ -538,11 +538,8 @@ ray_attach(parent, self, aux)
|
||||
callout_init(&sc->sc_start_join_timo_ch);
|
||||
|
||||
error = ray_enable(sc);
|
||||
if (error) {
|
||||
aprint_error("%s: enable failed, error=%d\n", self->dv_xname,
|
||||
error);
|
||||
if (error)
|
||||
goto fail;
|
||||
}
|
||||
|
||||
/* get startup results */
|
||||
ep = &sc->sc_ecf_startup;
|
||||
@ -702,7 +699,7 @@ ray_enable(sc)
|
||||
|
||||
sc->sc_ih = pcmcia_intr_establish(sc->sc_pf, IPL_NET,
|
||||
ray_intr, sc);
|
||||
if (sc->sc_ih == NULL)
|
||||
if (!sc->sc_ih)
|
||||
return (EIO);
|
||||
|
||||
error = ray_init(sc);
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: if_sm_pcmcia.c,v 1.40 2004/08/10 06:10:38 mycroft Exp $ */
|
||||
/* $NetBSD: if_sm_pcmcia.c,v 1.41 2004/08/10 15:29:56 mycroft Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1997, 1998, 2000, 2004 The NetBSD Foundation, Inc.
|
||||
@ -38,7 +38,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: if_sm_pcmcia.c,v 1.40 2004/08/10 06:10:38 mycroft Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: if_sm_pcmcia.c,v 1.41 2004/08/10 15:29:56 mycroft Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
@ -170,11 +170,8 @@ sm_pcmcia_attach(parent, self, aux)
|
||||
sc->sc_bsh = cfe->iospace[0].handle.ioh;
|
||||
|
||||
error = sm_pcmcia_enable(sc);
|
||||
if (error) {
|
||||
aprint_error("%s: enable failed, error=%d\n", self->dv_xname,
|
||||
error);
|
||||
if (error)
|
||||
goto fail;
|
||||
}
|
||||
|
||||
sc->sc_enable = sm_pcmcia_enable;
|
||||
sc->sc_disable = sm_pcmcia_disable;
|
||||
@ -270,11 +267,8 @@ sm_pcmcia_enable(sc)
|
||||
/* Establish the interrupt handler. */
|
||||
psc->sc_ih = pcmcia_intr_establish(psc->sc_pf, IPL_NET, smc91cxx_intr,
|
||||
sc);
|
||||
if (psc->sc_ih == NULL) {
|
||||
printf("%s: couldn't establish interrupt handler\n",
|
||||
sc->sc_dev.dv_xname);
|
||||
return (1);
|
||||
}
|
||||
if (!psc->sc_ih)
|
||||
return (EIO);
|
||||
|
||||
error = pcmcia_function_enable(psc->sc_pf);
|
||||
if (error)
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: if_wi_pcmcia.c,v 1.53 2004/08/10 06:10:38 mycroft Exp $ */
|
||||
/* $NetBSD: if_wi_pcmcia.c,v 1.54 2004/08/10 15:29:56 mycroft Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2001, 2004 The NetBSD Foundation, Inc.
|
||||
@ -41,7 +41,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: if_wi_pcmcia.c,v 1.53 2004/08/10 06:10:38 mycroft Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: if_wi_pcmcia.c,v 1.54 2004/08/10 15:29:56 mycroft Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
@ -284,6 +284,7 @@ wi_pcmcia_enable(sc)
|
||||
{
|
||||
struct wi_pcmcia_softc *psc = (struct wi_pcmcia_softc *)sc;
|
||||
struct pcmcia_function *pf = psc->sc_pf;
|
||||
int error;
|
||||
|
||||
if (psc->sc_state == WI_PCMCIA_ATTACH1) {
|
||||
psc->sc_state = WI_PCMCIA_ATTACH2;
|
||||
@ -292,16 +293,15 @@ wi_pcmcia_enable(sc)
|
||||
|
||||
/* establish the interrupt. */
|
||||
sc->sc_ih = pcmcia_intr_establish(pf, IPL_NET, wi_intr, sc);
|
||||
if (sc->sc_ih == NULL) {
|
||||
printf("%s: couldn't establish interrupt\n",
|
||||
sc->sc_dev.dv_xname);
|
||||
if (!sc->sc_ih)
|
||||
return (EIO);
|
||||
}
|
||||
if (pcmcia_function_enable(pf) != 0) {
|
||||
printf("%s: couldn't enable card\n", sc->sc_dev.dv_xname);
|
||||
|
||||
error = pcmcia_function_enable(pf);
|
||||
if (error) {
|
||||
pcmcia_intr_disestablish(pf, sc->sc_ih);
|
||||
return (EIO);
|
||||
}
|
||||
|
||||
DELAY(1000);
|
||||
if (psc->sc_symbol_cf) {
|
||||
if (wi_pcmcia_load_firm(sc,
|
||||
@ -324,6 +324,7 @@ wi_pcmcia_disable(sc)
|
||||
|
||||
pcmcia_function_disable(psc->sc_pf);
|
||||
pcmcia_intr_disestablish(psc->sc_pf, sc->sc_ih);
|
||||
sc->sc_ih = 0;
|
||||
}
|
||||
|
||||
static int
|
||||
@ -382,11 +383,9 @@ wi_pcmcia_attach(parent, self, aux)
|
||||
CSR_READ_2(sc, WI_COR) == WI_COR_IOMODE)
|
||||
psc->sc_symbol_cf = 1;
|
||||
|
||||
if (wi_pcmcia_enable(sc)) {
|
||||
aprint_error("%s: enable failed, error=%d\n", self->dv_xname,
|
||||
error);
|
||||
error = wi_pcmcia_enable(sc);
|
||||
if (error)
|
||||
goto fail;
|
||||
}
|
||||
|
||||
sc->sc_pci = 0;
|
||||
sc->sc_enable = wi_pcmcia_enable;
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: mhzc.c,v 1.24 2004/08/10 08:56:08 mycroft Exp $ */
|
||||
/* $NetBSD: mhzc.c,v 1.25 2004/08/10 15:29:56 mycroft Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1999, 2000, 2004 The NetBSD Foundation, Inc.
|
||||
@ -46,7 +46,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: mhzc.c,v 1.24 2004/08/10 08:56:08 mycroft Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: mhzc.c,v 1.25 2004/08/10 15:29:56 mycroft Exp $");
|
||||
|
||||
#include "opt_inet.h"
|
||||
#include "opt_ns.h"
|
||||
@ -204,6 +204,7 @@ mhzc_attach(parent, self, aux)
|
||||
struct mhzc_softc *sc = (void *)self;
|
||||
struct pcmcia_attach_args *pa = aux;
|
||||
struct pcmcia_config_entry *cfe;
|
||||
int error;
|
||||
|
||||
aprint_normal("\n");
|
||||
sc->sc_pf = pa->pf;
|
||||
@ -272,10 +273,9 @@ mhzc_attach(parent, self, aux)
|
||||
}
|
||||
sc->sc_flags |= MHZC_ETHERNET_MAPPED;
|
||||
|
||||
if (mhzc_enable(sc, MHZC_MODEM_ENABLED|MHZC_ETHERNET_ENABLED)) {
|
||||
aprint_error("%s: enable failed\n", self->dv_xname);
|
||||
error = mhzc_enable(sc, MHZC_MODEM_ENABLED|MHZC_ETHERNET_ENABLED);
|
||||
if (error)
|
||||
goto fail;
|
||||
}
|
||||
|
||||
sc->sc_modem = config_found(self, "com", mhzc_print);
|
||||
sc->sc_ethernet = config_found(self, "sm", mhzc_print);
|
||||
@ -454,6 +454,7 @@ mhzc_enable(sc, flag)
|
||||
struct mhzc_softc *sc;
|
||||
int flag;
|
||||
{
|
||||
int error;
|
||||
|
||||
if ((sc->sc_flags & flag) == flag) {
|
||||
printf("%s: already enabled\n", sc->sc_dev.dv_xname);
|
||||
@ -477,15 +478,13 @@ mhzc_enable(sc, flag)
|
||||
*/
|
||||
sc->sc_ih = pcmcia_intr_establish(sc->sc_pf, IPL_NET,
|
||||
mhzc_intr, sc);
|
||||
if (sc->sc_ih == NULL) {
|
||||
printf("%s: unable to establish interrupt\n",
|
||||
sc->sc_dev.dv_xname);
|
||||
return (1);
|
||||
}
|
||||
if (!sc->sc_ih)
|
||||
return (EIO);
|
||||
|
||||
if (pcmcia_function_enable(sc->sc_pf)) {
|
||||
error = pcmcia_function_enable(sc->sc_pf);
|
||||
if (error) {
|
||||
pcmcia_intr_disestablish(sc->sc_pf, sc->sc_ih);
|
||||
return (1);
|
||||
return (error);
|
||||
}
|
||||
|
||||
/*
|
||||
@ -519,6 +518,7 @@ mhzc_disable(sc, flag)
|
||||
|
||||
pcmcia_function_disable(sc->sc_pf);
|
||||
pcmcia_intr_disestablish(sc->sc_pf, sc->sc_ih);
|
||||
sc->sc_ih = 0;
|
||||
}
|
||||
|
||||
/*****************************************************************************
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: nca_pcmcia.c,v 1.11 2004/08/10 07:03:14 mycroft Exp $ */
|
||||
/* $NetBSD: nca_pcmcia.c,v 1.12 2004/08/10 15:29:56 mycroft Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2000, 2004 The NetBSD Foundation, Inc.
|
||||
@ -37,7 +37,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: nca_pcmcia.c,v 1.11 2004/08/10 07:03:14 mycroft Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: nca_pcmcia.c,v 1.12 2004/08/10 15:29:56 mycroft Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
@ -187,11 +187,8 @@ nca_pcmcia_attach(parent, self, aux)
|
||||
sc->sc_min_dma_len = MIN_DMA_LEN;
|
||||
|
||||
error = nca_pcmcia_enable(self, 1);
|
||||
if (error) {
|
||||
aprint_error("%s: enable failed, error=%d\n", self->dv_xname,
|
||||
error);
|
||||
if (error)
|
||||
goto fail;
|
||||
}
|
||||
|
||||
sc->sc_adapter.adapt_enable = nca_pcmcia_enable;
|
||||
|
||||
@ -232,6 +229,7 @@ nca_pcmcia_enable(arg, onoff)
|
||||
int onoff;
|
||||
{
|
||||
struct nca_pcmcia_softc *sc = (struct nca_pcmcia_softc*)arg;
|
||||
int error;
|
||||
|
||||
if (onoff) {
|
||||
/*
|
||||
@ -244,18 +242,13 @@ nca_pcmcia_enable(arg, onoff)
|
||||
/* Establish the interrupt handler. */
|
||||
sc->sc_ih = pcmcia_intr_establish(sc->sc_pf, IPL_BIO,
|
||||
ncr5380_intr, &sc->sc_ncr5380);
|
||||
if (sc->sc_ih == NULL) {
|
||||
printf("%s: couldn't establish interrupt handler\n",
|
||||
sc->sc_ncr5380.sc_dev.dv_xname);
|
||||
if (!sc->sc_ih)
|
||||
return (EIO);
|
||||
}
|
||||
|
||||
if (pcmcia_function_enable(sc->sc_pf)) {
|
||||
printf("%s: couldn't enable PCMCIA function\n",
|
||||
sc->sc_ncr5380.sc_dev.dv_xname);
|
||||
pcmcia_intr_disestablish(sc->sc_pf,
|
||||
sc->sc_ih);
|
||||
return (EIO);
|
||||
error = pcmcia_function_enable(sc->sc_pf);
|
||||
if (error) {
|
||||
pcmcia_intr_disestablish(sc->sc_pf, sc->sc_ih);
|
||||
return (error);
|
||||
}
|
||||
|
||||
/* Initialize only chip. */
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: pcmcia.c,v 1.54 2004/08/10 05:21:59 mycroft Exp $ */
|
||||
/* $NetBSD: pcmcia.c,v 1.55 2004/08/10 15:29:56 mycroft Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2004 Charles M. Hannum. All rights reserved.
|
||||
@ -48,7 +48,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: pcmcia.c,v 1.54 2004/08/10 05:21:59 mycroft Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: pcmcia.c,v 1.55 2004/08/10 15:29:56 mycroft Exp $");
|
||||
|
||||
#include "opt_pcmciaverbose.h"
|
||||
|
||||
@ -441,6 +441,7 @@ pcmcia_function_enable(pf)
|
||||
struct pcmcia_softc *sc = pf->sc;
|
||||
struct pcmcia_function *tmp;
|
||||
int reg;
|
||||
int error;
|
||||
|
||||
if (pf->cfe == NULL)
|
||||
panic("pcmcia_function_enable: function not initialized");
|
||||
@ -489,12 +490,14 @@ pcmcia_function_enable(pf)
|
||||
}
|
||||
|
||||
if (tmp == NULL) {
|
||||
if (pcmcia_mem_alloc(pf, PCMCIA_CCR_SIZE, &pf->pf_pcmh))
|
||||
error = pcmcia_mem_alloc(pf, PCMCIA_CCR_SIZE, &pf->pf_pcmh);
|
||||
if (error)
|
||||
goto bad;
|
||||
|
||||
if (pcmcia_mem_map(pf, PCMCIA_MEM_ATTR, pf->ccr_base,
|
||||
error = pcmcia_mem_map(pf, PCMCIA_MEM_ATTR, pf->ccr_base,
|
||||
PCMCIA_CCR_SIZE, &pf->pf_pcmh, &pf->pf_ccr_offset,
|
||||
&pf->pf_ccr_window)) {
|
||||
&pf->pf_ccr_window);
|
||||
if (error) {
|
||||
pcmcia_mem_free(pf, &pf->pf_pcmh);
|
||||
goto bad;
|
||||
}
|
||||
@ -563,7 +566,7 @@ pcmcia_function_enable(pf)
|
||||
#endif
|
||||
return (0);
|
||||
|
||||
bad:
|
||||
bad:
|
||||
/*
|
||||
* Decrement the reference count, and power down the socket, if
|
||||
* necessary.
|
||||
@ -572,8 +575,9 @@ pcmcia_function_enable(pf)
|
||||
pcmcia_chip_socket_disable(sc->pct, sc->pch);
|
||||
DPRINTF(("%s: --enabled_count = %d\n", sc->dev.dv_xname,
|
||||
sc->sc_enabled_count));
|
||||
printf("%s: couldn't map the CCR\n", pf->child->dv_xname);
|
||||
|
||||
return (1);
|
||||
return (error);
|
||||
}
|
||||
|
||||
/* Disable PCMCIA function. */
|
||||
@ -712,6 +716,8 @@ pcmcia_intr_establish(pf, ipl, ih_fct, ih_arg)
|
||||
|
||||
pf->pf_ih = pcmcia_chip_intr_establish(pf->sc->pct, pf->sc->pch,
|
||||
pf, ipl, ih_fct, ih_arg);
|
||||
if (!pf->pf_ih)
|
||||
printf("%s: interrupt establish failed\n", pf->child->dv_xname);
|
||||
return (pf->pf_ih);
|
||||
}
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: spc_pcmcia.c,v 1.7 2004/08/10 06:05:40 mycroft Exp $ */
|
||||
/* $NetBSD: spc_pcmcia.c,v 1.8 2004/08/10 15:29:56 mycroft Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2000, 2004 The NetBSD Foundation, Inc.
|
||||
@ -37,7 +37,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: spc_pcmcia.c,v 1.7 2004/08/10 06:05:40 mycroft Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: spc_pcmcia.c,v 1.8 2004/08/10 15:29:56 mycroft Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
@ -171,11 +171,9 @@ spc_pcmcia_attach(parent, self, aux)
|
||||
spc->sc_iot = cfe->iospace[0].handle.iot;
|
||||
spc->sc_ioh = cfe->iospace[0].handle.ioh;
|
||||
|
||||
if (spc_pcmcia_enable(self, 1)) {
|
||||
aprint_error("%s: enable failed, error=%d\n", self->dv_xname,
|
||||
error);
|
||||
error = spc_pcmcia_enable(self, 1);
|
||||
if (error)
|
||||
goto fail;
|
||||
}
|
||||
|
||||
spc->sc_initiator = 7; /* XXX */
|
||||
spc->sc_adapter.adapt_enable = spc_pcmcia_enable;
|
||||
@ -220,6 +218,7 @@ spc_pcmcia_enable(arg, onoff)
|
||||
int onoff;
|
||||
{
|
||||
struct spc_pcmcia_softc *sc = (void *)arg;
|
||||
int error;
|
||||
|
||||
if (onoff) {
|
||||
/*
|
||||
@ -232,17 +231,13 @@ spc_pcmcia_enable(arg, onoff)
|
||||
/* Establish the interrupt handler. */
|
||||
sc->sc_ih = pcmcia_intr_establish(sc->sc_pf, IPL_BIO,
|
||||
spc_intr, &sc->sc_spc);
|
||||
if (sc->sc_ih == NULL) {
|
||||
printf("%s: couldn't establish interrupt handler\n",
|
||||
sc->sc_spc.sc_dev.dv_xname);
|
||||
if (!sc->sc_ih)
|
||||
return (EIO);
|
||||
}
|
||||
|
||||
if (pcmcia_function_enable(sc->sc_pf)) {
|
||||
printf("%s: couldn't enable PCMCIA function\n",
|
||||
sc->sc_spc.sc_dev.dv_xname);
|
||||
error = pcmcia_function_enable(sc->sc_pf);
|
||||
if (error) {
|
||||
pcmcia_intr_disestablish(sc->sc_pf, sc->sc_ih);
|
||||
return (EIO);
|
||||
return (error);
|
||||
}
|
||||
|
||||
/* Initialize only chip. */
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: wdc_pcmcia.c,v 1.78 2004/08/10 06:10:38 mycroft Exp $ */
|
||||
/* $NetBSD: wdc_pcmcia.c,v 1.79 2004/08/10 15:29:56 mycroft Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1998, 2003, 2004 The NetBSD Foundation, Inc.
|
||||
@ -37,7 +37,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: wdc_pcmcia.c,v 1.78 2004/08/10 06:10:38 mycroft Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: wdc_pcmcia.c,v 1.79 2004/08/10 15:29:56 mycroft Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/device.h>
|
||||
@ -293,11 +293,8 @@ wdc_pcmcia_attach(parent, self, aux)
|
||||
}
|
||||
|
||||
error = wdc_pcmcia_enable(self, 1);
|
||||
if (error) {
|
||||
aprint_error("%s: enable failed, error=%d\n", self->dv_xname,
|
||||
error);
|
||||
if (error)
|
||||
goto fail;
|
||||
}
|
||||
|
||||
for (i = 0; i < WDC_PCMCIA_REG_NPORTS; i++) {
|
||||
if (bus_space_subregion(sc->wdc_channel.cmd_iot,
|
||||
@ -362,6 +359,7 @@ wdc_pcmcia_enable(self, onoff)
|
||||
int onoff;
|
||||
{
|
||||
struct wdc_pcmcia_softc *sc = (void *)self;
|
||||
int error;
|
||||
|
||||
if (onoff) {
|
||||
/*
|
||||
@ -377,17 +375,13 @@ wdc_pcmcia_enable(self, onoff)
|
||||
/* Establish the interrupt handler. */
|
||||
sc->sc_ih = pcmcia_intr_establish(sc->sc_pf, IPL_BIO,
|
||||
wdcintr, &sc->wdc_channel);
|
||||
if (sc->sc_ih == NULL) {
|
||||
printf("%s: couldn't establish interrupt handler\n",
|
||||
sc->sc_wdcdev.sc_dev.dv_xname);
|
||||
if (!sc->sc_ih)
|
||||
return (EIO);
|
||||
}
|
||||
|
||||
if (pcmcia_function_enable(sc->sc_pf)) {
|
||||
printf("%s: couldn't enable PCMCIA function\n",
|
||||
sc->sc_wdcdev.sc_dev.dv_xname);
|
||||
error = pcmcia_function_enable(sc->sc_pf);
|
||||
if (error) {
|
||||
pcmcia_intr_disestablish(sc->sc_pf, sc->sc_ih);
|
||||
return (EIO);
|
||||
return (error);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: xirc.c,v 1.8 2004/08/09 22:24:37 mycroft Exp $ */
|
||||
/* $NetBSD: xirc.c,v 1.9 2004/08/10 15:29:56 mycroft Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1999, 2000, 2004 The NetBSD Foundation, Inc.
|
||||
@ -38,7 +38,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: xirc.c,v 1.8 2004/08/09 22:24:37 mycroft Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: xirc.c,v 1.9 2004/08/10 15:29:56 mycroft Exp $");
|
||||
|
||||
#include "opt_inet.h"
|
||||
#include "opt_ns.h"
|
||||
@ -190,6 +190,7 @@ xirc_attach(parent, self, aux)
|
||||
struct pcmcia_attach_args *pa = aux;
|
||||
struct pcmcia_config_entry *cfe;
|
||||
int rv;
|
||||
int error;
|
||||
|
||||
aprint_normal("\n");
|
||||
sc->sc_pf = pa->pf;
|
||||
@ -274,11 +275,10 @@ xirc_attach(parent, self, aux)
|
||||
sc->sc_flags |= XIRC_ETHERNET_MAPPED;
|
||||
}
|
||||
|
||||
if (xirc_enable(sc, XIRC_MODEM_ENABLED|XIRC_ETHERNET_ENABLED,
|
||||
sc->sc_id & (XIMEDIA_MODEM|XIMEDIA_ETHER))) {
|
||||
aprint_error("%s: enable failed\n", self->dv_xname);
|
||||
error = xirc_enable(sc, XIRC_MODEM_ENABLED|XIRC_ETHERNET_ENABLED,
|
||||
sc->sc_id & (XIMEDIA_MODEM|XIMEDIA_ETHER));
|
||||
if (error)
|
||||
goto fail;
|
||||
}
|
||||
|
||||
sc->sc_mako_intmask = 0xee;
|
||||
|
||||
@ -505,6 +505,7 @@ xirc_enable(sc, flag, media)
|
||||
struct xirc_softc *sc;
|
||||
int flag, media;
|
||||
{
|
||||
int error;
|
||||
|
||||
if ((sc->sc_flags & flag) == flag) {
|
||||
printf("%s: already enabled\n", sc->sc_dev.dv_xname);
|
||||
@ -526,17 +527,14 @@ xirc_enable(sc, flag, media)
|
||||
* XXX Eventually we should use the `enabled' bits in the
|
||||
* XXX flags word to determine which level we should be at.
|
||||
*/
|
||||
sc->sc_ih = pcmcia_intr_establish(sc->sc_pf, IPL_NET,
|
||||
xirc_intr, sc);
|
||||
if (sc->sc_ih == NULL) {
|
||||
printf("%s: unable to establish interrupt\n",
|
||||
sc->sc_dev.dv_xname);
|
||||
sc->sc_ih = pcmcia_intr_establish(sc->sc_pf, IPL_NET, xirc_intr, sc);
|
||||
if (!sc->sc_ih)
|
||||
return (EIO);
|
||||
}
|
||||
|
||||
if (pcmcia_function_enable(sc->sc_pf)) {
|
||||
error = pcmcia_function_enable(sc->sc_pf);
|
||||
if (error) {
|
||||
pcmcia_intr_disestablish(sc->sc_pf, sc->sc_ih);
|
||||
return (EIO);
|
||||
return (error);
|
||||
}
|
||||
|
||||
sc->sc_flags |= flag;
|
||||
@ -575,6 +573,7 @@ xirc_disable(sc, flag, media)
|
||||
|
||||
pcmcia_function_disable(sc->sc_pf);
|
||||
pcmcia_intr_disestablish(sc->sc_pf, sc->sc_ih);
|
||||
sc->sc_ih = 0;
|
||||
}
|
||||
|
||||
/****** Here begins the com attachment code. ******/
|
||||
|
Loading…
Reference in New Issue
Block a user