Home | History | Annotate | Line # | Download | only in pcmcia
pcmcia_cis_quirks.c revision 1.13
      1  1.13     lukem /*	$NetBSD: pcmcia_cis_quirks.c,v 1.13 2001/11/13 07:26:34 lukem Exp $	*/
      2   1.1      marc 
      3   1.1      marc /*
      4   1.1      marc  * Copyright (c) 1998 Marc Horowitz.  All rights reserved.
      5   1.1      marc  *
      6   1.1      marc  * Redistribution and use in source and binary forms, with or without
      7   1.1      marc  * modification, are permitted provided that the following conditions
      8   1.1      marc  * are met:
      9   1.1      marc  * 1. Redistributions of source code must retain the above copyright
     10   1.1      marc  *    notice, this list of conditions and the following disclaimer.
     11   1.1      marc  * 2. Redistributions in binary form must reproduce the above copyright
     12   1.1      marc  *    notice, this list of conditions and the following disclaimer in the
     13   1.1      marc  *    documentation and/or other materials provided with the distribution.
     14   1.1      marc  * 3. All advertising materials mentioning features or use of this software
     15   1.1      marc  *    must display the following acknowledgement:
     16   1.1      marc  *	This product includes software developed by Marc Horowitz.
     17   1.1      marc  * 4. The name of the author may not be used to endorse or promote products
     18   1.1      marc  *    derived from this software without specific prior written permission.
     19   1.1      marc  *
     20   1.1      marc  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
     21   1.1      marc  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
     22   1.1      marc  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
     23   1.1      marc  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
     24   1.1      marc  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
     25   1.1      marc  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
     26   1.1      marc  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
     27   1.1      marc  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
     28   1.1      marc  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
     29   1.1      marc  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
     30   1.1      marc  */
     31  1.13     lukem 
     32  1.13     lukem #include <sys/cdefs.h>
     33  1.13     lukem __KERNEL_RCSID(0, "$NetBSD: pcmcia_cis_quirks.c,v 1.13 2001/11/13 07:26:34 lukem Exp $");
     34   1.1      marc 
     35   1.1      marc #include <sys/types.h>
     36   1.1      marc #include <sys/param.h>
     37   1.1      marc #include <sys/systm.h>
     38   1.1      marc #include <sys/device.h>
     39   1.1      marc #include <sys/mbuf.h>
     40   1.1      marc 
     41   1.1      marc #include <dev/pcmcia/pcmciadevs.h>
     42   1.1      marc #include <dev/pcmcia/pcmciareg.h>
     43   1.1      marc #include <dev/pcmcia/pcmciachip.h>
     44   1.1      marc #include <dev/pcmcia/pcmciavar.h>
     45   1.1      marc 
     46   1.1      marc /* There are cards out there whose CIS flat-out lies.  This file
     47   1.1      marc    contains struct pcmcia_function chains for those devices. */
     48   1.1      marc 
     49   1.1      marc /* these structures are just static templates which are then copied
     50   1.1      marc    into "live" allocated structures */
     51   1.1      marc 
     52   1.8  jdolecek static const struct pcmcia_function pcmcia_dlink_de650_func0 = {
     53   1.7   aymeric 	0,
     54   1.7   aymeric 	PCMCIA_FUNCTION_NETWORK,
     55   1.7   aymeric 	0x23,
     56   1.7   aymeric 	0x400,
     57   1.7   aymeric 	0x0b,
     58   1.7   aymeric };
     59   1.7   aymeric 
     60   1.8  jdolecek static const struct pcmcia_config_entry pcmcia_dlink_de650_func0_cfe0 = {
     61   1.7   aymeric 	0x20,
     62   1.7   aymeric 	PCMCIA_CFE_IO16 | PCMCIA_CFE_IRQLEVEL,
     63   1.7   aymeric 	PCMCIA_IFTYPE_IO,
     64   1.7   aymeric 	1,
     65   1.7   aymeric 	5,
     66   1.7   aymeric 	{ { 0x20, 0x360 } },
     67   1.7   aymeric 	0xbe7c,
     68   1.7   aymeric 	0,
     69  1.11     lukem 	{ { 0 } },
     70   1.7   aymeric 	0,
     71   1.7   aymeric };
     72   1.7   aymeric 
     73   1.8  jdolecek static const struct pcmcia_config_entry pcmcia_dlink_de650_func0_cfe1 = {
     74   1.7   aymeric 	0x21,
     75   1.7   aymeric 	PCMCIA_CFE_IO16 | PCMCIA_CFE_IRQLEVEL,
     76   1.7   aymeric 	PCMCIA_IFTYPE_IO,
     77   1.7   aymeric 	1,
     78   1.7   aymeric 	5,
     79   1.7   aymeric 	{ { 0x20, 0x340 } },
     80   1.7   aymeric 	0xbe7c,
     81   1.7   aymeric 	0,
     82  1.11     lukem 	{ { 0 } },
     83   1.7   aymeric 	0,
     84   1.7   aymeric };
     85   1.7   aymeric 
     86   1.8  jdolecek static const struct pcmcia_config_entry pcmcia_dlink_de650_func0_cfe2 = {
     87   1.7   aymeric 	0x22,
     88   1.7   aymeric 	PCMCIA_CFE_IO16 | PCMCIA_CFE_IRQLEVEL,
     89   1.7   aymeric 	PCMCIA_IFTYPE_IO,
     90   1.7   aymeric 	1,
     91   1.7   aymeric 	5,
     92   1.7   aymeric 	{ { 0x20, 0x320 } },
     93   1.7   aymeric 	0xbe7c,
     94   1.7   aymeric 	0,
     95  1.11     lukem 	{ { 0 } },
     96   1.7   aymeric 	0,
     97   1.7   aymeric };
     98   1.7   aymeric 
     99   1.8  jdolecek static const struct pcmcia_config_entry pcmcia_dlink_de650_func0_cfe3 = {
    100   1.7   aymeric 	0x23,
    101   1.7   aymeric 	PCMCIA_CFE_IO16 | PCMCIA_CFE_IRQLEVEL,
    102   1.7   aymeric 	PCMCIA_IFTYPE_IO,
    103   1.7   aymeric 	1,
    104   1.7   aymeric 	5,
    105   1.7   aymeric 	{ { 0x20, 0x300 } },
    106   1.7   aymeric 	0xbe7c,
    107   1.7   aymeric 	0,
    108  1.11     lukem 	{ { 0 } },
    109   1.7   aymeric 	0,
    110   1.7   aymeric };
    111   1.7   aymeric 
    112   1.8  jdolecek static const struct pcmcia_function pcmcia_3cxem556_func0 = {
    113   1.1      marc 	0,			/* function number */
    114   1.1      marc 	PCMCIA_FUNCTION_NETWORK,
    115   1.1      marc 	0x07,			/* last cfe number */
    116   1.1      marc 	0x800,			/* ccr_base */
    117   1.1      marc 	0x63,			/* ccr_mask */
    118   1.1      marc };
    119   1.1      marc 
    120   1.8  jdolecek static const struct pcmcia_config_entry pcmcia_3cxem556_func0_cfe0 = {
    121   1.1      marc 	0x07,			/* cfe number */
    122   1.1      marc 	PCMCIA_CFE_IO8 | PCMCIA_CFE_IO16 | PCMCIA_CFE_IRQLEVEL,
    123   1.1      marc 	PCMCIA_IFTYPE_IO,
    124   1.1      marc 	1,			/* num_iospace */
    125   1.1      marc 	4,			/* iomask */
    126   1.1      marc 	{ { 0x0010, 0 } },	/* iospace */
    127   1.1      marc 	0xffff,			/* irqmask */
    128   1.1      marc 	0,			/* num_memspace */
    129  1.11     lukem 	{ { 0 } },		/* memspace */
    130   1.1      marc 	0,			/* maxtwins */
    131   1.1      marc };
    132   1.1      marc 
    133   1.8  jdolecek static const struct pcmcia_function pcmcia_3cxem556_func1 = {
    134   1.1      marc 	1,			/* function number */
    135   1.1      marc 	PCMCIA_FUNCTION_SERIAL,
    136   1.1      marc 	0x27,			/* last cfe number */
    137   1.1      marc 	0x900,			/* ccr_base */
    138   1.1      marc 	0x63,			/* ccr_mask */
    139   1.1      marc };
    140   1.1      marc 
    141   1.8  jdolecek static const struct pcmcia_config_entry pcmcia_3cxem556_func1_cfe0 = {
    142   1.1      marc 	0x27,			/* cfe number */
    143   1.1      marc 	PCMCIA_CFE_IO8 | PCMCIA_CFE_IRQLEVEL,
    144   1.1      marc 	PCMCIA_IFTYPE_IO,
    145   1.1      marc 	1,			/* num_iospace */
    146   1.1      marc 	3,			/* iomask */
    147   1.1      marc 	{ { 0x0008, 0 } },	/* iospace */
    148   1.1      marc 	0xffff,			/* irqmask */
    149   1.1      marc 	0,			/* num_memspace */
    150  1.11     lukem 	{ { 0 } },		/* memspace */
    151   1.1      marc 	0,			/* maxtwins */
    152   1.1      marc };
    153   1.1      marc 
    154   1.8  jdolecek static const struct pcmcia_function pcmcia_3ccfem556bi_func0 = {
    155   1.5   thorpej 	0,			/* function number */
    156   1.5   thorpej 	PCMCIA_FUNCTION_NETWORK,
    157   1.5   thorpej 	0x07,			/* last cfe number */
    158   1.5   thorpej 	0x1000,			/* ccr_base */
    159   1.5   thorpej 	0x267,			/* ccr_mask */
    160   1.5   thorpej };
    161   1.5   thorpej 
    162   1.8  jdolecek static const struct pcmcia_config_entry pcmcia_3ccfem556bi_func0_cfe0 = {
    163   1.5   thorpej 	0x07,			/* cfe number */
    164   1.5   thorpej 	PCMCIA_CFE_IO8 | PCMCIA_CFE_IO16 | PCMCIA_CFE_IRQLEVEL,
    165   1.5   thorpej 	PCMCIA_IFTYPE_IO,
    166   1.5   thorpej 	1,			/* num_iospace */
    167   1.5   thorpej 	5,			/* iomask */
    168   1.5   thorpej 	{ { 0x0020, 0 } },	/* iospace */
    169   1.5   thorpej 	0xffff,			/* irqmask */
    170   1.5   thorpej 	0,			/* num_memspace */
    171  1.11     lukem 	{ { 0 } },		/* memspace */
    172   1.5   thorpej 	0,			/* maxtwins */
    173   1.5   thorpej };
    174   1.5   thorpej 
    175   1.8  jdolecek static const struct pcmcia_function pcmcia_3ccfem556bi_func1 = {
    176   1.5   thorpej 	1,			/* function number */
    177   1.5   thorpej 	PCMCIA_FUNCTION_SERIAL,
    178   1.5   thorpej 	0x27,			/* last cfe number */
    179   1.5   thorpej 	0x1100,			/* ccr_base */
    180   1.5   thorpej 	0x277,			/* ccr_mask */
    181   1.5   thorpej };
    182   1.5   thorpej 
    183   1.8  jdolecek static const struct pcmcia_config_entry pcmcia_3ccfem556bi_func1_cfe0 = {
    184   1.5   thorpej 	0x27,			/* cfe number */
    185   1.5   thorpej 	PCMCIA_CFE_IO8 | PCMCIA_CFE_IRQLEVEL,
    186   1.5   thorpej 	PCMCIA_IFTYPE_IO,
    187   1.5   thorpej 	1,			/* num_iospace */
    188   1.5   thorpej 	3,			/* iomask */
    189   1.5   thorpej 	{ { 0x0008, 0 } },	/* iospace */
    190   1.5   thorpej 	0xffff,			/* irqmask */
    191   1.5   thorpej 	0,			/* num_memspace */
    192  1.11     lukem 	{ { 0 } },		/* memspace */
    193   1.5   thorpej 	0,			/* maxtwins */
    194   1.5   thorpej };
    195   1.5   thorpej 
    196   1.8  jdolecek static const struct pcmcia_function pcmcia_sveclancard_func0 = {
    197   1.3      marc 	0,			/* function number */
    198   1.3      marc 	PCMCIA_FUNCTION_NETWORK,
    199   1.3      marc 	0x1,			/* last cfe number */
    200   1.3      marc 	0x100,			/* ccr_base */
    201   1.3      marc 	0x1,			/* ccr_mask */
    202   1.3      marc };
    203   1.3      marc 
    204   1.8  jdolecek static const struct pcmcia_config_entry pcmcia_sveclancard_func0_cfe0 = {
    205   1.3      marc 	0x1,			/* cfe number */
    206   1.3      marc 	PCMCIA_CFE_MWAIT_REQUIRED | PCMCIA_CFE_RDYBSY_ACTIVE |
    207   1.3      marc 	PCMCIA_CFE_WP_ACTIVE | PCMCIA_CFE_BVD_ACTIVE | PCMCIA_CFE_IO16,
    208   1.3      marc 	PCMCIA_IFTYPE_IO,
    209   1.3      marc 	1,			/* num_iospace */
    210   1.3      marc 	5,			/* iomask */
    211   1.3      marc 	{ { 0x20, 0x300 } },	/* iospace */
    212   1.3      marc 	0xdeb8,			/* irqmask */
    213   1.3      marc 	0,			/* num_memspace */
    214  1.11     lukem 	{ { 0 } },		/* memspace */
    215   1.3      marc 	0,			/* maxtwins */
    216   1.3      marc };
    217   1.3      marc 
    218   1.8  jdolecek static const struct pcmcia_function pcmcia_ndc_nd5100_func0 = {
    219   1.6       scw 	0,			/* function number */
    220   1.6       scw 	PCMCIA_FUNCTION_NETWORK,
    221   1.6       scw 	0x23,			/* last cfe number */
    222   1.6       scw 	0x3f8,			/* ccr_base */
    223   1.6       scw 	0x3,			/* ccr_mask */
    224   1.6       scw };
    225   1.6       scw 
    226   1.8  jdolecek static const struct pcmcia_config_entry pcmcia_ndc_nd5100_func0_cfe0 = {
    227   1.6       scw 	0x20,			/* cfe number */
    228   1.6       scw 	PCMCIA_CFE_MWAIT_REQUIRED | PCMCIA_CFE_IO16 | PCMCIA_CFE_IRQLEVEL,
    229   1.6       scw 	PCMCIA_IFTYPE_IO,
    230   1.6       scw 	1,			/* num_iospace */
    231   1.6       scw 	5,			/* iomask */
    232   1.6       scw 	{ { 0x20, 0x300 } },	/* iospace */
    233   1.6       scw 	0xdeb8,			/* irqmask */
    234   1.6       scw 	0,			/* num_memspace */
    235  1.11     lukem 	{ { 0 } },		/* memspace */
    236   1.6       scw 	0,			/* maxtwins */
    237   1.6       scw };
    238   1.6       scw 
    239  1.12    ichiro static const struct pcmcia_function pcmcia_emtac_a2424i_func0 = {
    240  1.12    ichiro 	0,			/* function number */
    241  1.12    ichiro 	PCMCIA_FUNCTION_NETWORK,
    242  1.12    ichiro 	0x21,			/* last cfe number */
    243  1.12    ichiro 	0x3e0,			/* ccr_base */
    244  1.12    ichiro 	0x1,			/* ccr_mask */
    245  1.12    ichiro };
    246  1.12    ichiro 
    247  1.12    ichiro static const struct pcmcia_config_entry pcmcia_emtac_a2424i_func0_cfe0 = {
    248  1.12    ichiro 	0x21,			/* cfe number */
    249  1.12    ichiro 	PCMCIA_CFE_IO16 | PCMCIA_CFE_IRQLEVEL |
    250  1.12    ichiro 	PCMCIA_CFE_IRQPULSE,
    251  1.12    ichiro 	PCMCIA_IFTYPE_IO,
    252  1.12    ichiro 	1,			/* num_iospace */
    253  1.12    ichiro 	6,			/* iomask */
    254  1.12    ichiro 	{ { 0x40, 0x100 } },	/* iospace */
    255  1.12    ichiro 	0xffff,			/* irqmask */
    256  1.12    ichiro 	0,			/* num_memspace */
    257  1.12    ichiro 	{ { 0 } },		/* memspace */
    258  1.12    ichiro 	0,			/* maxtwins */
    259  1.12    ichiro };
    260  1.12    ichiro 
    261   1.8  jdolecek static const struct pcmcia_cis_quirk pcmcia_cis_quirks[] = {
    262   1.7   aymeric 	{ PCMCIA_VENDOR_LINKSYS, PCMCIA_PRODUCT_LINKSYS_ECARD_1,
    263   1.7   aymeric 	  PCMCIA_CIS_INVALID,
    264   1.7   aymeric 	  &pcmcia_dlink_de650_func0, &pcmcia_dlink_de650_func0_cfe0 },
    265   1.7   aymeric 	{ PCMCIA_VENDOR_LINKSYS, PCMCIA_PRODUCT_LINKSYS_ECARD_1,
    266   1.7   aymeric 	  PCMCIA_CIS_INVALID,
    267   1.7   aymeric 	  &pcmcia_dlink_de650_func0, &pcmcia_dlink_de650_func0_cfe1 },
    268   1.7   aymeric 	{ PCMCIA_VENDOR_LINKSYS, PCMCIA_PRODUCT_LINKSYS_ECARD_1,
    269   1.7   aymeric 	  PCMCIA_CIS_INVALID,
    270   1.7   aymeric 	  &pcmcia_dlink_de650_func0, &pcmcia_dlink_de650_func0_cfe2 },
    271   1.7   aymeric 	{ PCMCIA_VENDOR_LINKSYS, PCMCIA_PRODUCT_LINKSYS_ECARD_1,
    272   1.7   aymeric 	  PCMCIA_CIS_INVALID,
    273   1.7   aymeric 	  &pcmcia_dlink_de650_func0, &pcmcia_dlink_de650_func0_cfe3 },
    274   1.3      marc 	{ PCMCIA_VENDOR_3COM, PCMCIA_PRODUCT_3COM_3CXEM556, PCMCIA_CIS_INVALID,
    275   1.1      marc 	  &pcmcia_3cxem556_func0, &pcmcia_3cxem556_func0_cfe0 },
    276   1.3      marc 	{ PCMCIA_VENDOR_3COM, PCMCIA_PRODUCT_3COM_3CXEM556, PCMCIA_CIS_INVALID,
    277   1.4      tron 	  &pcmcia_3cxem556_func1, &pcmcia_3cxem556_func1_cfe0 },
    278   1.4      tron 	{ PCMCIA_VENDOR_3COM, PCMCIA_PRODUCT_3COM_3CXEM556INT, PCMCIA_CIS_INVALID,
    279   1.4      tron 	  &pcmcia_3cxem556_func0, &pcmcia_3cxem556_func0_cfe0 },
    280   1.4      tron 	{ PCMCIA_VENDOR_3COM, PCMCIA_PRODUCT_3COM_3CXEM556INT, PCMCIA_CIS_INVALID,
    281   1.1      marc 	  &pcmcia_3cxem556_func1, &pcmcia_3cxem556_func1_cfe0 },
    282   1.5   thorpej 	{ PCMCIA_VENDOR_3COM, PCMCIA_PRODUCT_3COM_3CCFEM556BI,
    283   1.5   thorpej 	  PCMCIA_CIS_INVALID,
    284   1.5   thorpej 	  &pcmcia_3ccfem556bi_func0, &pcmcia_3ccfem556bi_func0_cfe0 },
    285   1.5   thorpej 	{ PCMCIA_VENDOR_3COM, PCMCIA_PRODUCT_3COM_3CCFEM556BI,
    286   1.5   thorpej 	  PCMCIA_CIS_INVALID,
    287   1.5   thorpej 	  &pcmcia_3ccfem556bi_func1, &pcmcia_3ccfem556bi_func1_cfe0 },
    288   1.3      marc 	{ PCMCIA_VENDOR_INVALID, PCMCIA_PRODUCT_INVALID, PCMCIA_CIS_SVEC_LANCARD,
    289   1.3      marc 	  &pcmcia_sveclancard_func0, &pcmcia_sveclancard_func0_cfe0 },
    290   1.6       scw 	{ PCMCIA_VENDOR_INVALID, PCMCIA_PRODUCT_INVALID, PCMCIA_CIS_NDC_ND5100_E,
    291   1.6       scw 	  &pcmcia_ndc_nd5100_func0, &pcmcia_ndc_nd5100_func0_cfe0 },
    292  1.12    ichiro 	{ PCMCIA_VENDOR_EMTAC, PCMCIA_PRODUCT_EMTAC_WLAN, PCMCIA_CIS_INVALID,
    293  1.12    ichiro 	  &pcmcia_emtac_a2424i_func0, &pcmcia_emtac_a2424i_func0_cfe0 },
    294   1.1      marc };
    295   1.1      marc 
    296   1.1      marc static int n_pcmcia_cis_quirks =
    297   1.1      marc 	sizeof(pcmcia_cis_quirks)/sizeof(pcmcia_cis_quirks[0]);
    298   1.1      marc 
    299   1.1      marc void pcmcia_check_cis_quirks(sc)
    300   1.1      marc 	struct pcmcia_softc *sc;
    301   1.1      marc {
    302   1.1      marc 	int wiped = 0;
    303   1.1      marc 	int i, j;
    304   1.8  jdolecek 	struct pcmcia_function *pf, *pf_next;
    305   1.8  jdolecek 	const struct pcmcia_function *pf_last;
    306   1.1      marc 	struct pcmcia_config_entry *cfe, *cfe_next;
    307   1.1      marc 
    308   1.2      marc 	pf = NULL;
    309   1.1      marc 	pf_last = NULL;
    310   1.1      marc 
    311   1.1      marc 	for (i=0; i<n_pcmcia_cis_quirks; i++) {
    312   1.3      marc 		if ((sc->card.manufacturer == pcmcia_cis_quirks[i].manufacturer) &&
    313   1.3      marc 			(sc->card.product == pcmcia_cis_quirks[i].product) &&
    314   1.3      marc 			(((sc->card.manufacturer != PCMCIA_VENDOR_INVALID) &&
    315   1.3      marc 			  (sc->card.product != PCMCIA_PRODUCT_INVALID)) ||
    316   1.3      marc 			 ((sc->card.manufacturer == PCMCIA_VENDOR_INVALID) &&
    317   1.3      marc 			  (sc->card.product == PCMCIA_PRODUCT_INVALID) &&
    318   1.3      marc 			  sc->card.cis1_info[0] &&
    319   1.3      marc 			  (strcmp(sc->card.cis1_info[0],
    320   1.3      marc 					  pcmcia_cis_quirks[i].cis1_info[0]) == 0) &&
    321   1.3      marc 			  sc->card.cis1_info[1] &&
    322   1.3      marc 			  (strcmp(sc->card.cis1_info[1],
    323   1.3      marc 					  pcmcia_cis_quirks[i].cis1_info[1]) == 0)))) {
    324   1.1      marc 			if (!wiped) {
    325   1.1      marc 				if (pcmcia_verbose) {
    326   1.1      marc 					printf("%s: using CIS quirks for ", sc->dev.dv_xname);
    327   1.1      marc 					for (j = 0; j < 4; j++) {
    328   1.1      marc 						if (sc->card.cis1_info[j] == NULL)
    329   1.1      marc 							break;
    330   1.1      marc 						if (j)
    331   1.1      marc 							printf(", ");
    332   1.1      marc 						printf("%s", sc->card.cis1_info[j]);
    333   1.1      marc 					}
    334   1.1      marc 					printf("\n");
    335   1.1      marc 				}
    336   1.1      marc 
    337   1.1      marc 				for (pf = SIMPLEQ_FIRST(&sc->card.pf_head); pf != NULL;
    338   1.1      marc 				     pf = pf_next) {
    339   1.1      marc 					for (cfe = SIMPLEQ_FIRST(&pf->cfe_head); cfe != NULL;
    340   1.1      marc 					     cfe = cfe_next) {
    341   1.1      marc 						cfe_next = SIMPLEQ_NEXT(cfe, cfe_list);
    342   1.1      marc 						free(cfe, M_DEVBUF);
    343   1.1      marc 					}
    344   1.1      marc 					pf_next = SIMPLEQ_NEXT(pf, pf_list);
    345   1.1      marc 					free(pf, M_DEVBUF);
    346   1.1      marc 				}
    347   1.1      marc 
    348   1.1      marc 				SIMPLEQ_INIT(&sc->card.pf_head);
    349   1.1      marc 				wiped = 1;
    350   1.1      marc 			}
    351   1.1      marc 
    352   1.1      marc 			if (pf_last == pcmcia_cis_quirks[i].pf) {
    353   1.1      marc 				cfe = malloc(sizeof(*cfe), M_DEVBUF, M_NOWAIT);
    354   1.1      marc 				*cfe = *pcmcia_cis_quirks[i].cfe;
    355   1.1      marc 
    356   1.1      marc 				SIMPLEQ_INSERT_TAIL(&pf->cfe_head, cfe, cfe_list);
    357   1.1      marc 			} else {
    358   1.1      marc 				pf = malloc(sizeof(*pf), M_DEVBUF, M_NOWAIT);
    359   1.1      marc 				*pf = *pcmcia_cis_quirks[i].pf;
    360   1.1      marc 				SIMPLEQ_INIT(&pf->cfe_head);
    361   1.1      marc 
    362   1.1      marc 				cfe = malloc(sizeof(*cfe), M_DEVBUF, M_NOWAIT);
    363   1.1      marc 				*cfe = *pcmcia_cis_quirks[i].cfe;
    364   1.1      marc 
    365   1.1      marc 				SIMPLEQ_INSERT_TAIL(&pf->cfe_head, cfe, cfe_list);
    366   1.1      marc 				SIMPLEQ_INSERT_TAIL(&sc->card.pf_head, pf, pf_list);
    367   1.1      marc 
    368   1.1      marc 				pf_last = pcmcia_cis_quirks[i].pf;
    369   1.1      marc 			}
    370   1.1      marc 		}
    371   1.1      marc 	}
    372   1.1      marc }
    373