Make pcmcia_function_disable() primarily responsible for disabling the CCR
bits. pcmcia_intr_disestablish() continues to do this as a stopgap.
This commit is contained in:
parent
2ae40d3e4f
commit
9092e2c97e
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: com_pcmcia.c,v 1.42 2004/08/09 17:00:53 mycroft Exp $ */
|
||||
/* $NetBSD: com_pcmcia.c,v 1.43 2004/08/09 18:30:51 mycroft Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1998 The NetBSD Foundation, Inc.
|
||||
@ -68,7 +68,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: com_pcmcia.c,v 1.42 2004/08/09 17:00:53 mycroft Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: com_pcmcia.c,v 1.43 2004/08/09 18:30:51 mycroft Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
@ -116,8 +116,6 @@ void com_pcmcia_cleanup __P((void *));
|
||||
|
||||
int com_pcmcia_enable __P((struct com_softc *));
|
||||
void com_pcmcia_disable __P((struct com_softc *));
|
||||
int com_pcmcia_enable1 __P((struct com_softc *));
|
||||
void com_pcmcia_disable1 __P((struct com_softc *));
|
||||
|
||||
struct com_pcmcia_softc {
|
||||
struct com_softc sc_com; /* real "com" softc */
|
||||
@ -340,42 +338,28 @@ com_pcmcia_enable(sc)
|
||||
if (psc->sc_ih == NULL) {
|
||||
printf("%s: couldn't establish interrupt\n",
|
||||
sc->sc_dev.dv_xname);
|
||||
return 1;
|
||||
return (1);
|
||||
}
|
||||
|
||||
if ((error = com_pcmcia_enable1(sc)) != 0) {
|
||||
if ((error = pcmcia_function_enable(pf)) != 0) {
|
||||
pcmcia_intr_disestablish(pf, psc->sc_ih);
|
||||
return error;
|
||||
return (error);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
com_pcmcia_enable1(sc)
|
||||
struct com_softc *sc;
|
||||
{
|
||||
struct com_pcmcia_softc *psc = (struct com_pcmcia_softc *) sc;
|
||||
struct pcmcia_function *pf = psc->sc_pf;
|
||||
int ret;
|
||||
|
||||
if ((ret = pcmcia_function_enable(pf)) != 0)
|
||||
return ret;
|
||||
|
||||
if ((psc->sc_pf->sc->card.product == PCMCIA_PRODUCT_3COM_3C562) ||
|
||||
(psc->sc_pf->sc->card.product == PCMCIA_PRODUCT_3COM_3CXEM556) ||
|
||||
(psc->sc_pf->sc->card.product == PCMCIA_PRODUCT_3COM_3CXEM556INT)) {
|
||||
int reg;
|
||||
|
||||
/* turn off the ethernet-disable bit */
|
||||
|
||||
reg = pcmcia_ccr_read(pf, PCMCIA_CCR_OPTION);
|
||||
if (reg & 0x08) {
|
||||
reg &= ~0x08;
|
||||
pcmcia_ccr_write(pf, PCMCIA_CCR_OPTION, reg);
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
||||
void
|
||||
@ -384,15 +368,6 @@ com_pcmcia_disable(sc)
|
||||
{
|
||||
struct com_pcmcia_softc *psc = (struct com_pcmcia_softc *) sc;
|
||||
|
||||
pcmcia_intr_disestablish(psc->sc_pf, psc->sc_ih);
|
||||
com_pcmcia_disable1(sc);
|
||||
}
|
||||
|
||||
void
|
||||
com_pcmcia_disable1(sc)
|
||||
struct com_softc *sc;
|
||||
{
|
||||
struct com_pcmcia_softc *psc = (struct com_pcmcia_softc *) sc;
|
||||
|
||||
pcmcia_function_disable(psc->sc_pf);
|
||||
pcmcia_intr_disestablish(psc->sc_pf, psc->sc_ih);
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: if_ep_pcmcia.c,v 1.45 2004/08/09 18:11:01 mycroft Exp $ */
|
||||
/* $NetBSD: if_ep_pcmcia.c,v 1.46 2004/08/09 18:30:51 mycroft Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1998, 2000 The NetBSD Foundation, Inc.
|
||||
@ -67,7 +67,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: if_ep_pcmcia.c,v 1.45 2004/08/09 18:11:01 mycroft Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: if_ep_pcmcia.c,v 1.46 2004/08/09 18:30:51 mycroft Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
@ -105,7 +105,6 @@ int ep_pcmcia_get_enaddr __P((struct pcmcia_tuple *, void *));
|
||||
int ep_pcmcia_enable __P((struct ep_softc *));
|
||||
void ep_pcmcia_disable __P((struct ep_softc *));
|
||||
|
||||
int ep_pcmcia_enable1 __P((struct ep_softc *));
|
||||
void ep_pcmcia_disable1 __P((struct ep_softc *));
|
||||
|
||||
struct ep_pcmcia_softc {
|
||||
@ -188,25 +187,11 @@ ep_pcmcia_enable(sc)
|
||||
return (1);
|
||||
}
|
||||
|
||||
if ((error = ep_pcmcia_enable1(sc)) != 0) {
|
||||
if ((error = pcmcia_function_enable(pf))) {
|
||||
pcmcia_intr_disestablish(pf, sc->sc_ih);
|
||||
return error;
|
||||
return (error);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
ep_pcmcia_enable1(sc)
|
||||
struct ep_softc *sc;
|
||||
{
|
||||
struct ep_pcmcia_softc *psc = (struct ep_pcmcia_softc *) sc;
|
||||
struct pcmcia_function *pf = psc->sc_pf;
|
||||
int ret;
|
||||
|
||||
if ((ret = pcmcia_function_enable(pf)))
|
||||
return (ret);
|
||||
|
||||
if ((psc->sc_pf->sc->card.product == PCMCIA_PRODUCT_3COM_3C562) ||
|
||||
(psc->sc_pf->sc->card.product == PCMCIA_PRODUCT_3COM_3CXEM556) ||
|
||||
(psc->sc_pf->sc->card.product == PCMCIA_PRODUCT_3COM_3CXEM556INT)) {
|
||||
@ -222,7 +207,7 @@ ep_pcmcia_enable1(sc)
|
||||
|
||||
}
|
||||
|
||||
return (ret);
|
||||
return (0);
|
||||
}
|
||||
|
||||
void
|
||||
@ -231,22 +216,8 @@ ep_pcmcia_disable(sc)
|
||||
{
|
||||
struct ep_pcmcia_softc *psc = (struct ep_pcmcia_softc *) sc;
|
||||
|
||||
/*
|
||||
* We must disestablish the interrupt before disabling the function,
|
||||
* because on a multifunction card the interrupt disestablishment
|
||||
* accesses CCR registers.
|
||||
*/
|
||||
pcmcia_intr_disestablish(psc->sc_pf, sc->sc_ih);
|
||||
ep_pcmcia_disable1(sc);
|
||||
}
|
||||
|
||||
void
|
||||
ep_pcmcia_disable1(sc)
|
||||
struct ep_softc *sc;
|
||||
{
|
||||
struct ep_pcmcia_softc *psc = (struct ep_pcmcia_softc *) sc;
|
||||
|
||||
pcmcia_function_disable(psc->sc_pf);
|
||||
pcmcia_intr_disestablish(psc->sc_pf, sc->sc_ih);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: if_sm_pcmcia.c,v 1.36 2004/08/08 23:17:13 mycroft Exp $ */
|
||||
/* $NetBSD: if_sm_pcmcia.c,v 1.37 2004/08/09 18:30:51 mycroft Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1997, 1998, 2000 The NetBSD Foundation, Inc.
|
||||
@ -38,7 +38,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: if_sm_pcmcia.c,v 1.36 2004/08/08 23:17:13 mycroft Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: if_sm_pcmcia.c,v 1.37 2004/08/09 18:30:51 mycroft Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
@ -285,10 +285,6 @@ sm_pcmcia_enable(sc)
|
||||
struct sm_pcmcia_softc *psc = (struct sm_pcmcia_softc *)sc;
|
||||
int rv;
|
||||
|
||||
rv = pcmcia_function_enable(psc->sc_pf);
|
||||
if (rv != 0)
|
||||
return (rv);
|
||||
|
||||
/* Establish the interrupt handler. */
|
||||
psc->sc_ih = pcmcia_intr_establish(psc->sc_pf, IPL_NET, smc91cxx_intr,
|
||||
sc);
|
||||
@ -297,6 +293,13 @@ sm_pcmcia_enable(sc)
|
||||
sc->sc_dev.dv_xname);
|
||||
return (1);
|
||||
}
|
||||
|
||||
rv = pcmcia_function_enable(psc->sc_pf);
|
||||
if (rv != 0) {
|
||||
pcmcia_intr_disestablish(psc->sc_pf, psc->sc_ih);
|
||||
return (rv);
|
||||
}
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
||||
@ -306,6 +309,6 @@ sm_pcmcia_disable(sc)
|
||||
{
|
||||
struct sm_pcmcia_softc *psc = (struct sm_pcmcia_softc *)sc;
|
||||
|
||||
pcmcia_intr_disestablish(psc->sc_pf, psc->sc_ih);
|
||||
pcmcia_function_disable(psc->sc_pf);
|
||||
pcmcia_intr_disestablish(psc->sc_pf, psc->sc_ih);
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: if_wi_pcmcia.c,v 1.50 2004/08/09 18:11:01 mycroft Exp $ */
|
||||
/* $NetBSD: if_wi_pcmcia.c,v 1.51 2004/08/09 18:30:51 mycroft Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2001 The NetBSD Foundation, Inc.
|
||||
@ -41,7 +41,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: if_wi_pcmcia.c,v 1.50 2004/08/09 18:11:01 mycroft Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: if_wi_pcmcia.c,v 1.51 2004/08/09 18:30:51 mycroft Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
@ -314,8 +314,8 @@ wi_pcmcia_disable(sc)
|
||||
{
|
||||
struct wi_pcmcia_softc *psc = (struct wi_pcmcia_softc *)sc;
|
||||
|
||||
pcmcia_intr_disestablish(psc->sc_pf, sc->sc_ih);
|
||||
pcmcia_function_disable(psc->sc_pf);
|
||||
pcmcia_intr_disestablish(psc->sc_pf, sc->sc_ih);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: mhzc.c,v 1.21 2004/08/09 18:11:01 mycroft Exp $ */
|
||||
/* $NetBSD: mhzc.c,v 1.22 2004/08/09 18:30:51 mycroft Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1999, 2000 The NetBSD Foundation, Inc.
|
||||
@ -46,7 +46,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: mhzc.c,v 1.21 2004/08/09 18:11:01 mycroft Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: mhzc.c,v 1.22 2004/08/09 18:30:51 mycroft Exp $");
|
||||
|
||||
#include "opt_inet.h"
|
||||
#include "opt_ns.h"
|
||||
@ -504,8 +504,8 @@ mhzc_disable(sc, flag)
|
||||
if ((sc->sc_flags & (MHZC_MODEM_ENABLED|MHZC_ETHERNET_ENABLED)) != 0)
|
||||
return;
|
||||
|
||||
pcmcia_intr_disestablish(sc->sc_pf, sc->sc_ih);
|
||||
pcmcia_function_disable(sc->sc_pf);
|
||||
pcmcia_intr_disestablish(sc->sc_pf, sc->sc_ih);
|
||||
}
|
||||
|
||||
/*****************************************************************************
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: pcmcia.c,v 1.47 2004/08/09 16:59:10 mycroft Exp $ */
|
||||
/* $NetBSD: pcmcia.c,v 1.48 2004/08/09 18:30:51 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.47 2004/08/09 16:59:10 mycroft Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: pcmcia.c,v 1.48 2004/08/09 18:30:51 mycroft Exp $");
|
||||
|
||||
#include "opt_pcmciaverbose.h"
|
||||
|
||||
@ -584,6 +584,7 @@ pcmcia_function_disable(pf)
|
||||
struct pcmcia_function *pf;
|
||||
{
|
||||
struct pcmcia_function *tmp;
|
||||
int reg;
|
||||
|
||||
if (pf->cfe == NULL)
|
||||
panic("pcmcia_function_enable: function not initialized");
|
||||
@ -595,6 +596,14 @@ pcmcia_function_disable(pf)
|
||||
goto out;
|
||||
}
|
||||
|
||||
if (pcmcia_mfc(pf->sc)) {
|
||||
reg = pcmcia_ccr_read(pf, PCMCIA_CCR_OPTION);
|
||||
reg &= ~(PCMCIA_CCR_OPTION_FUNC_ENABLE|
|
||||
PCMCIA_CCR_OPTION_ADDR_DECODE|
|
||||
PCMCIA_CCR_OPTION_IREQ_ENABLE);
|
||||
pcmcia_ccr_write(pf, PCMCIA_CCR_OPTION, reg);
|
||||
}
|
||||
|
||||
/*
|
||||
* it's possible for different functions' CCRs to be in the same
|
||||
* underlying page. Check for that. Note we mark us as disabled
|
||||
@ -864,9 +873,11 @@ pcmcia_intr_disestablish(pf, ih)
|
||||
pcmcia_chip_intr_disestablish(pf->sc->pct, pf->sc->pch,
|
||||
pf->sc->ih);
|
||||
|
||||
reg = pcmcia_ccr_read(pf, PCMCIA_CCR_OPTION);
|
||||
reg &= ~PCMCIA_CCR_OPTION_IREQ_ENABLE;
|
||||
pcmcia_ccr_write(pf, PCMCIA_CCR_OPTION, reg);
|
||||
if (pf->pf_flags & PFF_ENABLED) {
|
||||
reg = pcmcia_ccr_read(pf, PCMCIA_CCR_OPTION);
|
||||
reg &= ~PCMCIA_CCR_OPTION_IREQ_ENABLE;
|
||||
pcmcia_ccr_write(pf, PCMCIA_CCR_OPTION, reg);
|
||||
}
|
||||
|
||||
pf->ih_fct = NULL;
|
||||
pf->ih_arg = NULL;
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: xirc.c,v 1.5 2004/08/09 18:11:01 mycroft Exp $ */
|
||||
/* $NetBSD: xirc.c,v 1.6 2004/08/09 18:30:51 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.5 2004/08/09 18:11:01 mycroft Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: xirc.c,v 1.6 2004/08/09 18:30:51 mycroft Exp $");
|
||||
|
||||
#include "opt_inet.h"
|
||||
#include "opt_ns.h"
|
||||
@ -553,8 +553,8 @@ xirc_disable(sc, flag, media)
|
||||
if ((sc->sc_flags & (XIRC_MODEM_ENABLED|XIRC_ETHERNET_ENABLED)) != 0)
|
||||
return;
|
||||
|
||||
pcmcia_intr_disestablish(sc->sc_pf, sc->sc_ih);
|
||||
pcmcia_function_disable(sc->sc_pf);
|
||||
pcmcia_intr_disestablish(sc->sc_pf, sc->sc_ih);
|
||||
}
|
||||
|
||||
/****** Here begins the com attachment code. ******/
|
||||
|
Loading…
Reference in New Issue
Block a user