Home | History | Annotate | Line # | Download | only in pcmcia
wdc_pcmcia.c revision 1.81
      1  1.81   mycroft /*	$NetBSD: wdc_pcmcia.c,v 1.81 2004/08/10 18:39:08 mycroft Exp $ */
      2   1.1      matt 
      3   1.8   mycroft /*-
      4  1.78   mycroft  * Copyright (c) 1998, 2003, 2004 The NetBSD Foundation, Inc.
      5   1.8   mycroft  * All rights reserved.
      6   1.1      matt  *
      7   1.8   mycroft  * This code is derived from software contributed to The NetBSD Foundation
      8   1.8   mycroft  * by Charles M. Hannum, by Onno van der Linden and by Manuel Bouyer.
      9   1.1      matt  *
     10   1.1      matt  * Redistribution and use in source and binary forms, with or without
     11   1.1      matt  * modification, are permitted provided that the following conditions
     12   1.1      matt  * are met:
     13   1.1      matt  * 1. Redistributions of source code must retain the above copyright
     14   1.1      matt  *    notice, this list of conditions and the following disclaimer.
     15   1.1      matt  * 2. Redistributions in binary form must reproduce the above copyright
     16   1.1      matt  *    notice, this list of conditions and the following disclaimer in the
     17   1.1      matt  *    documentation and/or other materials provided with the distribution.
     18   1.1      matt  * 3. All advertising materials mentioning features or use of this software
     19   1.1      matt  *    must display the following acknowledgement:
     20   1.8   mycroft  *        This product includes software developed by the NetBSD
     21   1.8   mycroft  *        Foundation, Inc. and its contributors.
     22   1.8   mycroft  * 4. Neither the name of The NetBSD Foundation nor the names of its
     23   1.8   mycroft  *    contributors may be used to endorse or promote products derived
     24   1.8   mycroft  *    from this software without specific prior written permission.
     25   1.1      matt  *
     26   1.8   mycroft  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
     27   1.8   mycroft  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
     28   1.8   mycroft  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
     29   1.8   mycroft  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
     30   1.8   mycroft  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
     31   1.8   mycroft  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
     32   1.8   mycroft  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
     33   1.8   mycroft  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
     34   1.8   mycroft  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
     35   1.8   mycroft  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
     36   1.8   mycroft  * POSSIBILITY OF SUCH DAMAGE.
     37   1.1      matt  */
     38  1.44     lukem 
     39  1.44     lukem #include <sys/cdefs.h>
     40  1.81   mycroft __KERNEL_RCSID(0, "$NetBSD: wdc_pcmcia.c,v 1.81 2004/08/10 18:39:08 mycroft Exp $");
     41   1.1      matt 
     42   1.1      matt #include <sys/param.h>
     43  1.30     enami #include <sys/device.h>
     44  1.30     enami #include <sys/malloc.h>
     45   1.1      matt #include <sys/systm.h>
     46   1.1      matt 
     47  1.30     enami #include <machine/bus.h>
     48   1.1      matt #include <machine/intr.h>
     49   1.1      matt 
     50  1.14     enami #include <dev/pcmcia/pcmciareg.h>
     51   1.1      matt #include <dev/pcmcia/pcmciavar.h>
     52   1.9      kenh #include <dev/pcmcia/pcmciadevs.h>
     53   1.9      kenh 
     54  1.64      fvdl #include <dev/ic/wdcreg.h>
     55  1.12    bouyer #include <dev/ata/atavar.h>
     56   1.1      matt #include <dev/ic/wdcvar.h>
     57   1.1      matt 
     58   1.1      matt #define WDC_PCMCIA_REG_NPORTS      8
     59   1.9      kenh #define WDC_PCMCIA_AUXREG_OFFSET   (WDC_PCMCIA_REG_NPORTS + 6)
     60   1.2   mycroft #define WDC_PCMCIA_AUXREG_NPORTS   2
     61   1.1      matt 
     62   1.1      matt struct wdc_pcmcia_softc {
     63   1.1      matt 	struct wdc_softc sc_wdcdev;
     64  1.66   thorpej 	struct wdc_channel *wdc_chanlist[1];
     65  1.66   thorpej 	struct wdc_channel wdc_channel;
     66  1.65   thorpej 	struct ata_queue wdc_chqueue;
     67   1.1      matt 	struct pcmcia_io_handle sc_pioh;
     68   1.1      matt 	struct pcmcia_io_handle sc_auxpioh;
     69  1.41       uch 	struct pcmcia_mem_handle sc_pmemh;
     70  1.41       uch 	struct pcmcia_mem_handle sc_auxpmemh;
     71   1.1      matt 	void *sc_ih;
     72  1.75   mycroft 
     73  1.15   thorpej 	struct pcmcia_function *sc_pf;
     74  1.75   mycroft 	int sc_state;
     75  1.75   mycroft #define WDC_PCMCIA_ATTACH1	1
     76  1.75   mycroft #define WDC_PCMCIA_ATTACH2	2
     77  1.75   mycroft #define WDC_PCMCIA_ATTACHED	3
     78   1.1      matt };
     79   1.1      matt 
     80   1.1      matt static int wdc_pcmcia_match	__P((struct device *, struct cfdata *, void *));
     81  1.72   mycroft static int wdc_pcmcia_validate_config __P((struct pcmcia_config_entry *));
     82   1.1      matt static void wdc_pcmcia_attach	__P((struct device *, struct device *, void *));
     83  1.21     enami static int wdc_pcmcia_detach	__P((struct device *, int));
     84   1.1      matt 
     85  1.51   thorpej CFATTACH_DECL(wdc_pcmcia, sizeof(struct wdc_pcmcia_softc),
     86  1.52   thorpej     wdc_pcmcia_match, wdc_pcmcia_attach, wdc_pcmcia_detach, wdcactivate);
     87   1.1      matt 
     88  1.81   mycroft const struct pcmcia_product wdc_pcmcia_products[] = {
     89  1.74   mycroft 	{ PCMCIA_VENDOR_DIGITAL,
     90   1.9      kenh 	  PCMCIA_PRODUCT_DIGITAL_MOBILE_MEDIA_CDROM,
     91  1.73   mycroft 	  {NULL, "Digital Mobile Media CD-ROM", NULL, NULL} },
     92  1.19       abs 
     93  1.19       abs 	{ PCMCIA_VENDOR_IBM,
     94  1.24     soren 	  PCMCIA_PRODUCT_IBM_PORTABLE_CDROM,
     95  1.73   mycroft 	  {NULL, "PCMCIA Portable CD-ROM Drive", NULL, NULL} },
     96   1.9      kenh 
     97   1.9      kenh 	/* The TEAC IDE/Card II is used on the Sony Vaio */
     98   1.9      kenh 	{ PCMCIA_VENDOR_TEAC,
     99   1.9      kenh 	  PCMCIA_PRODUCT_TEAC_IDECARDII,
    100  1.69   mycroft 	  PCMCIA_CIS_TEAC_IDECARDII },
    101  1.43  christos 
    102  1.43  christos 	/*
    103  1.43  christos 	 * A fujitsu rebranded panasonic drive that reports
    104  1.43  christos 	 * itself as function "scsi", disk interface 0
    105  1.43  christos 	 */
    106  1.43  christos 	{ PCMCIA_VENDOR_PANASONIC,
    107  1.43  christos 	  PCMCIA_PRODUCT_PANASONIC_KXLC005,
    108  1.69   mycroft 	  PCMCIA_CIS_PANASONIC_KXLC005 },
    109  1.26  augustss 
    110  1.27     enami 	/*
    111  1.27     enami 	 * EXP IDE/ATAPI DVD Card use with some DVD players.
    112  1.27     enami 	 * Does not have a vendor ID or product ID.
    113  1.27     enami 	 */
    114  1.81   mycroft 	{ PCMCIA_VENDOR_INVALID, PCMCIA_PRODUCT_INVALID,
    115  1.69   mycroft 	  PCMCIA_CIS_EXP_EXPMULTIMEDIA },
    116  1.23  takemura 
    117  1.36       abs 	/* Mobile Dock 2, neither vendor ID nor product ID */
    118  1.81   mycroft 	{ PCMCIA_VENDOR_INVALID, PCMCIA_PRODUCT_INVALID,
    119  1.69   mycroft 	  {"SHUTTLE TECHNOLOGY LTD.", "PCCARD-IDE/ATAPI Adapter", NULL, NULL} },
    120  1.34       abs 
    121  1.36       abs 	/* Toshiba Portege 3110 CD, neither vendor ID nor product ID */
    122  1.81   mycroft 	{ PCMCIA_VENDOR_INVALID, PCMCIA_PRODUCT_INVALID,
    123  1.69   mycroft 	  {"FREECOM", "PCCARD-IDE", NULL, NULL} },
    124  1.36       abs 
    125  1.36       abs 	/* Random CD-ROM, (badged AMACOM), neither vendor ID nor product ID */
    126  1.81   mycroft 	{ PCMCIA_VENDOR_INVALID, PCMCIA_PRODUCT_INVALID,
    127  1.69   mycroft 	  {"PCMCIA", "CD-ROM", NULL, NULL} },
    128  1.37      haya 
    129  1.37      haya 	/* IO DATA CBIDE2, with neither vendor ID nor product ID */
    130  1.81   mycroft 	{ PCMCIA_VENDOR_INVALID, PCMCIA_PRODUCT_INVALID,
    131  1.69   mycroft 	  PCMCIA_CIS_IODATA_CBIDE2 },
    132  1.54    ichiro 
    133  1.54    ichiro 	/* TOSHIBA PA2673U(IODATA_CBIDE2 OEM), */
    134  1.54    ichiro 	/*  with neither vendor ID nor product ID */
    135  1.81   mycroft 	{ PCMCIA_VENDOR_INVALID, PCMCIA_PRODUCT_INVALID,
    136  1.69   mycroft 	  PCMCIA_CIS_TOSHIBA_CBIDE2 },
    137  1.38      sato 
    138  1.38      sato 	/*
    139  1.38      sato 	 * Novac PCMCIA-IDE Card for HD530P IDE Box,
    140  1.38      sato 	 * with neither vendor ID nor product ID
    141  1.38      sato 	 */
    142  1.81   mycroft 	{ PCMCIA_VENDOR_INVALID, PCMCIA_PRODUCT_INVALID,
    143  1.69   mycroft 	  {"PCMCIA", "PnPIDE", NULL, NULL} },
    144   1.9      kenh };
    145  1.81   mycroft const size_t wdc_pcmcia_nproducts =
    146  1.81   mycroft     sizeof(wdc_pcmcia_products) / sizeof(wdc_pcmcia_products[0]);
    147   1.9      kenh 
    148  1.42    bouyer int	wdc_pcmcia_enable __P((struct device *, int));
    149  1.14     enami 
    150   1.1      matt static int
    151   1.2   mycroft wdc_pcmcia_match(parent, match, aux)
    152   1.2   mycroft 	struct device *parent;
    153   1.2   mycroft 	struct cfdata *match;
    154   1.2   mycroft 	void *aux;
    155   1.1      matt {
    156   1.1      matt 	struct pcmcia_attach_args *pa = aux;
    157  1.35      haya 
    158  1.35      haya 	if (pa->pf->function == PCMCIA_FUNCTION_DISK &&
    159  1.81   mycroft 	    pa->pf->pf_funce_disk_interface == PCMCIA_TPLFE_DDI_PCCARD_ATA)
    160   1.9      kenh 		return (1);
    161  1.81   mycroft 	if (pcmcia_product_lookup(pa, wdc_pcmcia_products, wdc_pcmcia_nproducts,
    162  1.81   mycroft 	    sizeof(wdc_pcmcia_products[0]), NULL))
    163  1.81   mycroft 		return (2);
    164   1.9      kenh 	return (0);
    165   1.1      matt }
    166   1.1      matt 
    167  1.72   mycroft static int
    168  1.72   mycroft wdc_pcmcia_validate_config(cfe)
    169  1.72   mycroft 	struct pcmcia_config_entry *cfe;
    170  1.72   mycroft {
    171  1.72   mycroft 	switch (cfe->iftype) {
    172  1.72   mycroft #if 0
    173  1.72   mycroft 	case PCMCIA_IFTYPE_MEMORY:
    174  1.72   mycroft 		if (cfe->num_iospace != 0 ||
    175  1.72   mycroft 		    cfe->num_memspace != 1)
    176  1.72   mycroft 			return (EINVAL);
    177  1.72   mycroft 		break;
    178  1.72   mycroft #endif
    179  1.72   mycroft 	case PCMCIA_IFTYPE_IO:
    180  1.72   mycroft 		if (cfe->num_iospace < 1 || cfe->num_iospace > 2)
    181  1.72   mycroft 			return (EINVAL);
    182  1.72   mycroft 		cfe->num_memspace = 0;
    183  1.72   mycroft 		break;
    184  1.72   mycroft 	default:
    185  1.72   mycroft 		return (EINVAL);
    186  1.72   mycroft 	}
    187  1.72   mycroft 	return (0);
    188  1.72   mycroft }
    189  1.72   mycroft 
    190   1.1      matt static void
    191   1.2   mycroft wdc_pcmcia_attach(parent, self, aux)
    192   1.2   mycroft 	struct device *parent;
    193   1.2   mycroft 	struct device *self;
    194   1.2   mycroft 	void *aux;
    195   1.1      matt {
    196   1.1      matt 	struct wdc_pcmcia_softc *sc = (void *)self;
    197   1.1      matt 	struct pcmcia_attach_args *pa = aux;
    198   1.5     enami 	struct pcmcia_config_entry *cfe;
    199  1.72   mycroft 	bus_size_t offset;
    200  1.73   mycroft 	int i;
    201  1.72   mycroft 	int error;
    202   1.1      matt 
    203  1.69   mycroft 	aprint_normal("\n");
    204  1.15   thorpej 	sc->sc_pf = pa->pf;
    205  1.15   thorpej 
    206  1.72   mycroft 	/*XXXmem16|common*/
    207  1.72   mycroft 	error = pcmcia_function_configure(pa->pf, wdc_pcmcia_validate_config);
    208  1.72   mycroft 	if (error) {
    209  1.72   mycroft 		aprint_error("%s: configure failed, error=%d\n", self->dv_xname,
    210  1.72   mycroft 		    error);
    211  1.72   mycroft 		return;
    212   1.1      matt 	}
    213   1.1      matt 
    214  1.72   mycroft 	cfe = pa->pf->cfe;
    215  1.72   mycroft 	sc->sc_wdcdev.cap |= WDC_CAPABILITY_DATA16;
    216  1.72   mycroft 	if (cfe->iftype == PCMCIA_IFTYPE_MEMORY) {
    217  1.72   mycroft 		sc->sc_pmemh.memt = cfe->memspace[0].handle.memt;
    218  1.72   mycroft 		sc->sc_pmemh.memh = cfe->memspace[0].handle.memh;
    219  1.72   mycroft 		offset = cfe->memspace[0].offset;
    220  1.41       uch 
    221  1.41       uch 		sc->sc_auxpmemh.memt = sc->sc_pmemh.memt;
    222  1.41       uch 		if (bus_space_subregion(sc->sc_pmemh.memt,
    223  1.72   mycroft 		    sc->sc_pmemh.memh, WDC_PCMCIA_AUXREG_OFFSET + offset,
    224  1.41       uch 		    WDC_PCMCIA_AUXREG_NPORTS, &sc->sc_auxpmemh.memh))
    225  1.72   mycroft 			goto fail;
    226  1.41       uch 
    227  1.69   mycroft 		aprint_normal("%s: memory mapped mode\n", self->dv_xname);
    228  1.72   mycroft 		sc->wdc_channel.cmd_iot = sc->sc_pmemh.memt;
    229  1.72   mycroft 		sc->wdc_channel.cmd_baseioh = sc->sc_pmemh.memh;
    230  1.72   mycroft 		sc->wdc_channel.ctl_iot = sc->sc_auxpmemh.memt;
    231  1.72   mycroft 		sc->wdc_channel.ctl_ioh = sc->sc_auxpmemh.memh;
    232  1.41       uch 	} else {
    233  1.72   mycroft 		sc->sc_pioh.iot = cfe->iospace[0].handle.iot;
    234  1.72   mycroft 		sc->sc_pioh.ioh = cfe->iospace[0].handle.ioh;
    235  1.72   mycroft 		offset = 0;
    236  1.72   mycroft 
    237  1.72   mycroft 		if (cfe->num_iospace == 1) {
    238  1.72   mycroft 			sc->sc_auxpioh.iot = sc->sc_pioh.iot;
    239  1.72   mycroft 			if (bus_space_subregion(sc->sc_pioh.iot,
    240  1.72   mycroft 			    sc->sc_pioh.ioh, WDC_PCMCIA_AUXREG_OFFSET,
    241  1.72   mycroft 			    WDC_PCMCIA_AUXREG_NPORTS, &sc->sc_auxpioh.ioh))
    242  1.72   mycroft 				goto fail;
    243  1.72   mycroft 		} else {
    244  1.72   mycroft 			sc->sc_auxpioh.iot = cfe->iospace[1].handle.iot;
    245  1.72   mycroft 			sc->sc_auxpioh.ioh = cfe->iospace[1].handle.ioh;
    246  1.72   mycroft 		}
    247  1.41       uch 
    248  1.72   mycroft 		aprint_normal("%s: i/o mapped mode\n", self->dv_xname);
    249  1.72   mycroft 		sc->wdc_channel.cmd_iot = sc->sc_pioh.iot;
    250  1.72   mycroft 		sc->wdc_channel.cmd_baseioh = sc->sc_pioh.ioh;
    251  1.72   mycroft 		sc->wdc_channel.ctl_iot = sc->sc_auxpioh.iot;
    252  1.72   mycroft 		sc->wdc_channel.ctl_ioh = sc->sc_auxpioh.ioh;
    253  1.72   mycroft 		sc->sc_wdcdev.cap |= WDC_CAPABILITY_DATA32;
    254  1.25  sommerfe 	}
    255   1.5     enami 
    256  1.76   mycroft 	error = wdc_pcmcia_enable(self, 1);
    257  1.79   mycroft 	if (error)
    258  1.72   mycroft 		goto fail;
    259  1.71   mycroft 
    260  1.64      fvdl 	for (i = 0; i < WDC_PCMCIA_REG_NPORTS; i++) {
    261  1.64      fvdl 		if (bus_space_subregion(sc->wdc_channel.cmd_iot,
    262  1.64      fvdl 		    sc->wdc_channel.cmd_baseioh,
    263  1.64      fvdl 		    offset + i, i == 0 ? 4 : 1,
    264  1.64      fvdl 		    &sc->wdc_channel.cmd_iohs[i]) != 0) {
    265  1.69   mycroft 			aprint_error("%s: can't subregion I/O space\n",
    266  1.69   mycroft 			    self->dv_xname);
    267  1.72   mycroft 			goto fail2;
    268  1.64      fvdl 		}
    269  1.64      fvdl 	}
    270  1.68   thorpej 	wdc_init_shadow_regs(&sc->wdc_channel);
    271  1.12    bouyer 	sc->wdc_channel.data32iot = sc->wdc_channel.cmd_iot;
    272  1.64      fvdl 	sc->wdc_channel.data32ioh = sc->wdc_channel.cmd_iohs[0];
    273  1.18    bouyer 	sc->sc_wdcdev.PIO_cap = 0;
    274  1.53      matt 	sc->wdc_chanlist[0] = &sc->wdc_channel;
    275  1.53      matt 	sc->sc_wdcdev.channels = sc->wdc_chanlist;
    276  1.12    bouyer 	sc->sc_wdcdev.nchannels = 1;
    277  1.67   thorpej 	sc->wdc_channel.ch_channel = 0;
    278  1.67   thorpej 	sc->wdc_channel.ch_wdc = &sc->sc_wdcdev;
    279  1.53      matt 	sc->wdc_channel.ch_queue = &sc->wdc_chqueue;
    280  1.15   thorpej 
    281  1.15   thorpej 	/* We can enable and disable the controller. */
    282  1.42    bouyer 	sc->sc_wdcdev.sc_atapi_adapter._generic.adapt_enable =
    283  1.32    bouyer 	    wdc_pcmcia_enable;
    284  1.15   thorpej 
    285  1.75   mycroft 	sc->sc_state = WDC_PCMCIA_ATTACH1;
    286  1.60    bouyer 	wdcattach(&sc->wdc_channel);
    287  1.75   mycroft 	if (sc->sc_state == WDC_PCMCIA_ATTACH1)
    288  1.75   mycroft 		wdc_pcmcia_enable(self, 0);
    289  1.75   mycroft 	sc->sc_state = WDC_PCMCIA_ATTACHED;
    290  1.29     enami 	return;
    291  1.29     enami 
    292  1.72   mycroft fail2:
    293  1.72   mycroft 	wdc_pcmcia_enable(self, 0);
    294  1.72   mycroft fail:
    295  1.72   mycroft 	pcmcia_function_unconfigure(pa->pf);
    296  1.21     enami }
    297  1.21     enami 
    298  1.21     enami int
    299  1.21     enami wdc_pcmcia_detach(self, flags)
    300  1.21     enami 	struct device *self;
    301  1.21     enami 	int flags;
    302  1.21     enami {
    303  1.21     enami 	struct wdc_pcmcia_softc *sc = (struct wdc_pcmcia_softc *)self;
    304  1.21     enami 	int error;
    305  1.29     enami 
    306  1.75   mycroft 	if (sc->sc_state != WDC_PCMCIA_ATTACHED)
    307  1.29     enami 		return (0);
    308  1.21     enami 
    309  1.21     enami 	if ((error = wdcdetach(self, flags)) != 0)
    310  1.21     enami 		return (error);
    311  1.21     enami 
    312  1.72   mycroft 	pcmcia_function_unconfigure(sc->sc_pf);
    313  1.61    briggs 
    314  1.21     enami 	return (0);
    315  1.15   thorpej }
    316  1.15   thorpej 
    317  1.15   thorpej int
    318  1.42    bouyer wdc_pcmcia_enable(self, onoff)
    319  1.42    bouyer 	struct device *self;
    320  1.15   thorpej 	int onoff;
    321  1.15   thorpej {
    322  1.42    bouyer 	struct wdc_pcmcia_softc *sc = (void *)self;
    323  1.79   mycroft 	int error;
    324  1.15   thorpej 
    325  1.15   thorpej 	if (onoff) {
    326  1.63    briggs 		/*
    327  1.63    briggs 		 * If the WDC_PCMCIA_ATTACH flag is set, we've already
    328  1.63    briggs 		 * enabled the card in the attach routine, so don't
    329  1.63    briggs 		 * re-enable it here (to save power cycle time).  Clear
    330  1.63    briggs 		 * the flag, though, so that the next disable/enable
    331  1.63    briggs 		 * will do the right thing.
    332  1.63    briggs 		 */
    333  1.75   mycroft 		if (sc->sc_state == WDC_PCMCIA_ATTACH1) {
    334  1.75   mycroft 			sc->sc_state = WDC_PCMCIA_ATTACH2;
    335  1.63    briggs 		} else {
    336  1.71   mycroft 			/* Establish the interrupt handler. */
    337  1.71   mycroft 			sc->sc_ih = pcmcia_intr_establish(sc->sc_pf, IPL_BIO,
    338  1.71   mycroft 			    wdcintr, &sc->wdc_channel);
    339  1.79   mycroft 			if (!sc->sc_ih)
    340  1.71   mycroft 				return (EIO);
    341  1.71   mycroft 
    342  1.79   mycroft 			error = pcmcia_function_enable(sc->sc_pf);
    343  1.79   mycroft 			if (error) {
    344  1.63    briggs 				pcmcia_intr_disestablish(sc->sc_pf, sc->sc_ih);
    345  1.80   mycroft 				sc->sc_ih = 0;
    346  1.79   mycroft 				return (error);
    347  1.63    briggs 			}
    348  1.15   thorpej 		}
    349  1.15   thorpej 	} else {
    350  1.15   thorpej 		pcmcia_function_disable(sc->sc_pf);
    351  1.56   mycroft 		pcmcia_intr_disestablish(sc->sc_pf, sc->sc_ih);
    352  1.72   mycroft 		sc->sc_ih = 0;
    353  1.15   thorpej 	}
    354  1.15   thorpej 
    355  1.15   thorpej 	return (0);
    356   1.1      matt }
    357