Update cardbus/pccard support.
authorSepherosa Ziehau <sephe@dragonflybsd.org>
Thu, 5 Jul 2007 12:08:54 +0000 (12:08 +0000)
committerSepherosa Ziehau <sephe@dragonflybsd.org>
Thu, 5 Jul 2007 12:08:54 +0000 (12:08 +0000)
The original patch was done by joerg@; I seemed to "maintain"
it for quite a long time :P

Obtained-from: FreeBSD
Tested-by: many (intermittently tho)
44 files changed:
sys/bus/pccard/Makefile
sys/bus/pccard/card_if.m
sys/bus/pccard/cardinfo.h [deleted file]
sys/bus/pccard/cis.h [deleted file]
sys/bus/pccard/driver.h [deleted file]
sys/bus/pccard/pccard.c
sys/bus/pccard/pccard_beep.c [deleted file]
sys/bus/pccard/pccard_cis.c
sys/bus/pccard/pccard_cis.h [copied from sys/bus/pccard/pccardreg.h with 57% similarity]
sys/bus/pccard/pccard_cis_quirks.c
sys/bus/pccard/pccarddevs
sys/bus/pccard/pccarddevs.h
sys/bus/pccard/pccardreg.h
sys/bus/pccard/pccardvar.h
sys/bus/pccard/power_if.m
sys/bus/pccard/slot.h [deleted file]
sys/bus/pci/pci.c
sys/conf/files
sys/dev/disk/ata/ata-card.c
sys/dev/disk/nata/ata-card.c
sys/dev/disk/ncv/ncr53c500_pccard.c
sys/dev/disk/nsp/nsp_pccard.c
sys/dev/disk/stg/tmc18c30_pccard.c
sys/dev/netif/cs/if_cs_isa.c
sys/dev/netif/ed/if_ed_pccard.c
sys/dev/netif/fe/if_fe_pccard.c
sys/dev/netif/wi/if_wi_pccard.c
sys/dev/netif/xe/if_xe_pccard.c
sys/dev/pccard/cardbus/cardbus.c
sys/dev/pccard/cardbus/cardbus_cis.c
sys/dev/pccard/cardbus/cardbus_cis.h
sys/dev/pccard/cardbus/cardbusreg.h
sys/dev/pccard/cardbus/cardbusvar.h
sys/dev/pccard/exca/exca.c
sys/dev/pccard/exca/excareg.h
sys/dev/pccard/exca/excavar.h
sys/dev/pccard/pccbb/Makefile
sys/dev/pccard/pccbb/pccbb.c
sys/dev/pccard/pccbb/pccbb_isa.c [new file with mode: 0644]
sys/dev/pccard/pccbb/pccbb_pci.c [new file with mode: 0644]
sys/dev/pccard/pccbb/pccbbdevid.h
sys/dev/pccard/pccbb/pccbbreg.h
sys/dev/pccard/pccbb/pccbbvar.h
sys/dev/serial/sio/sio_pccard.c

index f69cbde..e57b6e9 100644 (file)
@@ -1,13 +1,12 @@
-# $DragonFly: src/sys/bus/pccard/Makefile,v 1.2 2006/03/30 11:09:08 swildner Exp $
+# $DragonFly: src/sys/bus/pccard/Makefile,v 1.3 2007/07/05 12:08:53 sephe Exp $
 #
 # Makefile for the PCCARD subsystem
 
 KMOD= pccard
 SRCS=  bus_if.h device_if.h pci_if.h \
        pccard.c card_if.h power_if.h\
-       pccard_beep.c pccard_cis.c pccard_cis_quirks.c pccarddevs.h \
-       pccardreg.h pccardvar.h \
-       cis.h cardinfo.h driver.h slot.h
+       pccard_cis.c pccard_cis_quirks.c pccarddevs.h \
+       pccardreg.h pccardvar.h
 
 .include <bsd.kmod.mk>
 
index c63b405..81c9951 100644 (file)
@@ -1,4 +1,4 @@
-#
+#-
 # Copyright (c) 1999 M. Warner Losh.
 # All rights reserved.
 #
@@ -23,8 +23,8 @@
 # OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 # SUCH DAMAGE.
 #
-# $FreeBSD: src/sys/dev/pccard/card_if.m,v 1.21 2002/11/02 23:00:28 imp Exp $
-# $DragonFly: src/sys/bus/pccard/card_if.m,v 1.1 2004/02/10 07:55:45 joerg Exp $
+# $FreeBSD: src/sys/dev/pccard/card_if.m,v 1.29 2005/07/01 03:40:28 imp Exp $
+# $DragonFly: src/sys/bus/pccard/card_if.m,v 1.2 2007/07/05 12:08:53 sephe Exp $
 #
 
 #include <sys/bus.h>
@@ -68,15 +68,15 @@ METHOD int set_memory_offset {
        device_t  dev;
        device_t  child;
        int       rid;
-       u_int32_t cardaddr;
-       u_int32_t *deltap;
+       uint32_t cardaddr;
+       uint32_t *deltap;
 }
 
 METHOD int get_memory_offset {
        device_t  dev;
        device_t  child;
        int       rid;
-       u_int32_t *offset;
+       uint32_t *offset;
 }
 
 #
@@ -93,38 +93,6 @@ METHOD int detach_card {
        device_t  dev;
 }
 
-#
-# Returns the type of card this is.  Maybe we don't need this.
-#
-METHOD int get_type {
-       device_t  dev;
-       int       *type;
-}
-
-#
-# Returns the function number for this device.
-#
-METHOD int get_function {
-       device_t  dev;
-       device_t  child;
-       int       *func;
-}
-
-#
-# Activates (and powers up if necessary) the card's nth function
-# since each function gets its own device, there is no need to
-# to specify a function number
-#
-METHOD int activate_function {
-       device_t  dev;
-       device_t  child;
-}
-
-METHOD int deactivate_function {
-       device_t  dev;
-       device_t  child;
-}
-
 #
 # Compatibility methods for OLDCARD drivers.  We use these routines to make
 # it possible to call the OLDCARD driver's probe routine in the context that
@@ -203,50 +171,10 @@ METHOD int compat_match {
 }
 
 #
-# Method for devices to ask its CIS-enabled parent bus for CIS info.
-# Device driver requests all tuples if type 'id', the routine places
-# 'nret' number of tuples in 'buff'.  Returns 0 if all tuples processed,
-# or an error code if processing was aborted.
-# Users of this method will be responsible for freeing the memory allocated
-# by calling the cis_free method.
+# Scanning function for accessing the CIS of a card in its driver.
 #
-
-HEADER {
-       struct cis_tupleinfo {
-               u_int8_t id;
-               int len;
-               char *data;
-       };
-};
-
-CODE  {
-       static int
-       null_cis_read(device_t dev, device_t child, u_int8_t id,
-           struct cis_tupleinfo **buff, int *nret)
-       {
-               *nret = 0;
-               *buff = NULL;
-               return ENXIO;
-       }
-
-       static void
-       null_cis_free(device_t dev, struct cis_tupleinfo *buff, int *nret)
-       {
-               return;
-       }
+METHOD int cis_scan {
+       device_t bus;
+        pccard_scan_t fnp;
+       void *argp;
 };
-
-METHOD int cis_read {
-       device_t dev;
-       device_t child;
-       u_int8_t id;
-       struct   cis_tupleinfo **buff;
-       int      *nret;
-} DEFAULT null_cis_read;
-
-METHOD int cis_free {
-       device_t dev;
-       struct   cis_tupleinfo *buff;
-       int      nret;
-} DEFAULT null_cis_free;
-
diff --git a/sys/bus/pccard/cardinfo.h b/sys/bus/pccard/cardinfo.h
deleted file mode 100644 (file)
index 7904da6..0000000
+++ /dev/null
@@ -1,203 +0,0 @@
-/*
- *     Include file for PCMCIA user process interface
- *
- *-------------------------------------------------------------------------
- *
- * Copyright (c) 1995 Andrew McRae.  All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- * 3. The name of the author may not be used to endorse or promote products
- *    derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/* $FreeBSD: src/sys/pccard/cardinfo.h,v 1.16.2.6 2002/09/22 20:26:58 imp Exp $ */
-/* $DragonFly: src/sys/bus/pccard/Attic/cardinfo.h,v 1.2 2003/06/17 04:28:55 dillon Exp $ */
-
-#ifndef        _PCCARD_CARDINFO_H_
-#define        _PCCARD_CARDINFO_H_
-
-#ifndef _KERNEL
-#include <sys/types.h>
-#endif
-#include <sys/ioccom.h>
-
-#define        PIOCGSTATE      _IOR('P', 1, struct slotstate)  /* Get slot state */
-#define        PIOCGMEM        _IOWR('P', 2, struct mem_desc)  /* Get memory map */
-#define        PIOCSMEM        _IOW('P', 3, struct mem_desc)   /* Set memory map */
-#define        PIOCGIO         _IOWR('P', 4, struct io_desc)   /* Get I/O map */
-#define        PIOCSIO         _IOW('P', 5, struct io_desc)    /* Set I/O map */
-#define PIOCSDRV       _IOWR('P', 6, struct dev_desc)  /* Set driver */
-#define PIOCRWFLAG     _IOW('P', 7, int)       /* Set flags for drv use */
-#define PIOCRWMEM      _IOWR('P', 8, unsigned long) /* Set mem for drv use */
-#define PIOCSPOW       _IOW('P', 9, struct power) /* Set power structure */
-#define PIOCSVIR       _IOW('P', 10, int)      /* Virtual insert/remove */
-#define PIOCSBEEP      _IOW('P', 11, int)              /* Select Beep */
-#define PIOCSRESOURCE  _IOWR('P', 12, struct pccard_resource)  /* get resource info */
-/*
- *     Debug codes.
- */
-#define PIOCGREG       _IOWR('P',100, struct pcic_reg) /* get reg */
-#define PIOCSREG       _IOW('P', 101, struct pcic_reg) /* Set reg */
-
-/*
- *     Slot states for PIOCGSTATE
- *
- *     Here's a state diagram of all the possible states:
- *
- *                             power x 1
- *                       -------------------
- *                      /                   \
- *                     /                     v
- *    resume    +----------+   power x 0   +----------+
- *      ------->| inactive |<--------------| filled   |
- *     /        +----------+               +----------+
- *    /           /     \                   ^   |
- *  nil <---------       \        insert or |   | suspend or
- *        suspend         \       power x 1 |   | eject
- *                         \                |   v
- *                          \            +----------+
- *                           ----------->|  empty   |
- *                             eject     +----------+
- *
- *     Note, the above diagram is for the state.  On suspend, the laststate
- * gets set to suspend to tell pccardd what happened.  Also the nil state
- * means that when the no state change has happened.  Note: if you eject
- * while suspended in the inactive state, you will return to the
- * empty state if you do not insert a new card and to the inactive state
- * if you do insert a new card.
- *
- * Some might argue that inactive should be sticky forever and
- * eject/insert shouldn't take it out of that state.  They might be
- * right.  On the other hand, some would argue that eject resets all
- * state.  They might be right.  They both can't be right.  The above
- * represents a reasonable compromise between the two.
- *
- * Some bridges allow one to query to see if the card was changed while
- * we were suspended.  Others do not.  We make no use of this functionality
- * at this time.
- */
-enum cardstate { noslot, empty, suspend, filled, inactive };
-
-/*
- *     Descriptor structure for memory map.
- */
-struct mem_desc {
-       int     window;         /* Memory map window number (0-4) */
-       int     flags;          /* Flags - see below */
-       caddr_t start;          /* System memory start */
-       int     size;           /* Size of memory area */
-       unsigned long card;     /* Card memory address */
-};
-
-#define        MDF_16BITS      0x01    /* Memory is 16 bits wide */
-#define        MDF_ZEROWS      0x02    /* Set no wait states for memory */
-#define        MDF_WS0         0x04    /* Wait state flags */
-#define        MDF_WS1         0x08
-#define        MDF_ATTR        0x10    /* Memory is attribute memory */
-#define        MDF_WP          0x20    /* Write protect memory */
-#define        MDF_ACTIVE      0x40    /* Context active (read-only) */
-
-/*
- *     Descriptor structure for I/O map
- */
-struct io_desc {
-       int     window;         /* I/O map number (0-1) */
-       int     flags;          /* Flags - see below */
-       int     start;          /* I/O port start */
-       int     size;           /* Number of port addresses */
-};
-
-#define        IODF_WS         0x01    /* Set wait states for 16 bit I/O access */
-#define        IODF_16BIT      0x02    /* I/O access are 16 bit */
-#define        IODF_CS16       0x04    /* Allow card selection of 16 bit access */
-#define        IODF_ZEROWS     0x08    /* No wait states for 8 bit I/O */
-#define        IODF_ACTIVE     0x10    /* Context active (read-only) */
-
-/*
- *     Device descriptor for allocation of driver.
- */
-#define DEV_MISC_LEN   36
-#define DEV_MAX_CIS_LEN        40
-struct dev_desc {
-       char            name[16];       /* Driver name */
-       int             unit;           /* Driver unit number */
-       unsigned long   mem;            /* Memory address of driver */
-       int             memsize;        /* Memory size (if used) */
-       int             iobase;         /* base of I/O ports */
-       int             iosize;         /* Length of I/O ports */
-       int             irqmask;        /* Interrupt number(s) to allocate */
-       int             flags;          /* Device flags */
-       uint8_t         misc[DEV_MISC_LEN]; /* For any random info */
-       uint8_t         manufstr[DEV_MAX_CIS_LEN];
-       uint8_t         versstr[DEV_MAX_CIS_LEN];
-       uint32_t        manufacturer;   /* Manufacturer ID */
-       uint32_t        product;        /* Product ID */
-       uint32_t        prodext;        /* Product ID (extended) */
-};
-#define DEV_DESC_HAS_SIZE 1
-
-struct pcic_reg {
-       unsigned char reg;
-       unsigned char value;
-};
-
-/*
- *     Slot information. Used to read current status of slot.
- */
-struct slotstate {
-       enum cardstate  state;          /* Current state of slot */
-       enum cardstate  laststate;      /* Previous state of slot */
-       int             maxmem;         /* Max allowed memory windows */
-       int             maxio;          /* Max allowed I/O windows */
-       int             irqs;           /* Bitmap of IRQs allowed */
-       int             flags;          /* Capability flags */
-};
-
-/*
- *     The power values are in volts * 10, e.g. 5V is 50, 3.3V is 33.
- */
-struct power {
-       int             vcc;
-       int             vpp;
-};
-
-/*
- *     The PC-Card resource IOC_GET_RESOURCE_RANGE
- */
-struct pccard_resource {
-       int             type;
-       u_long          size;
-       u_long          min;
-       u_long          max;
-       u_long          resource_addr;
-};
-
-
-/*
- *     Other system limits
- */
-#define MAXSLOT 16
-#define        NUM_MEM_WINDOWS 10
-#define        NUM_IO_WINDOWS  6
-#define        CARD_DEVICE     "/dev/card%d"           /* String for snprintf */
-#define        PCCARD_MEMSIZE  (4*1024)
-
-#endif /* !_PCCARD_CARDINFO_H_ */
diff --git a/sys/bus/pccard/cis.h b/sys/bus/pccard/cis.h
deleted file mode 100644 (file)
index c5f8d36..0000000
+++ /dev/null
@@ -1,279 +0,0 @@
-/*
- *     PCMCIA card structures and defines.
- *     These defines relate to the user level
- *     structures and card information, not
- *     driver/process communication.
- *-------------------------------------------------------------------------
- *
- * Copyright (c) 1995 Andrew McRae.  All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- * 3. The name of the author may not be used to endorse or promote products
- *    derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- * $FreeBSD: src/sys/pccard/cis.h,v 1.3.10.1 2000/05/23 03:56:58 imp Exp $
- * $DragonFly: src/sys/bus/pccard/Attic/cis.h,v 1.2 2003/06/17 04:28:55 dillon Exp $
- *
- */
-
-/*
- *     Card Information Structure tuples definitions
- *     The structure of a tuple is basically:
- *
- *             Tuple_code
- *             Tuple_data_length
- *             Tuple_data ...
- *
- *     Tuples are contiguous in attribute memory, and
- *     are terminated with a 0xFF for the tuple code or
- *     the tuple length.
- */
-#ifndef        _PCCARD_CIS_H
-#define        _PCCARD_CIS_H
-
-#define        CIS_NULL        0       /* Empty tuple */
-#define        CIS_MEM_COMMON  0x01    /* Device descriptor, common memory */
-#define        CIS_LONGLINK_CB 0x02    /* Long link to next chain for CardBus */
-#define        CIS_INDIRECT    0x03    /* Indirect access */
-#define        CIS_CONF_MAP_CB 0x04    /* Card Configuration map for CardBus */
-#define        CIS_CONFIG_CB   0x05    /* Card Configuration entry for CardBus */
-#define        CIS_LONGLINK_MFC        0x06    /* Long link to next chain for Multi function card */
-#define        CIS_BAR         0x07    /* Base address register for CardBus */
-#define        CIS_CHECKSUM    0x10    /* Checksum */
-#define        CIS_LONGLINK_A  0x11    /* Link to Attribute memory */
-#define        CIS_LONGLINK_C  0x12    /* Link to Common memory */
-#define        CIS_LINKTARGET  0x13    /* Linked tuple must start with this. */
-#define        CIS_NOLINK      0x14    /* Assume no common memory link tuple. */
-#define        CIS_INFO_V1     0x15    /* Card info data, version 1 */
-#define        CIS_ALTSTR      0x16    /* Alternate language string tuple. */
-#define        CIS_MEM_ATTR    0x17    /* Device descriptor, Attribute memory */
-#define        CIS_JEDEC_C     0x18    /* JEDEC descr for common memory */
-#define        CIS_JEDEC_A     0x19    /* JEDEC descr for Attribute memory */
-#define        CIS_CONF_MAP    0x1A    /* Card Configuration map */
-#define        CIS_CONFIG      0x1B    /* Card Configuration entry */
-#define        CIS_DEVICE_OC   0x1C    /* Other conditions info - common memory */
-#define        CIS_DEVICE_OA   0x1D    /* Other conditions info - attribute memory */
-#define        CIS_DEVICEGEO   0x1E    /* Geometry info for common memory */
-#define        CIS_DEVICEGEO_A 0x1F    /* Geometry info for attribute memory */
-#define        CIS_MANUF_ID    0x20    /* Card manufacturer's ID */
-#define        CIS_FUNC_ID     0x21    /* Function of card */
-#define        CIS_FUNC_EXT    0x22    /* Functional extension */
-/*
- *     Data recording format tuples.
- */
-#define        CIS_SW_INTERLV  0x23    /* Software interleave */
-#define        CIS_VERS_2      0x40    /* Card info data, version 2 */
-#define        CIS_FORMAT      0x41    /* Memory card format */
-#define        CIS_GEOMETRY    0x42    /* Disk sector layout */
-#define        CIS_BYTEORDER   0x43    /* Byte order of memory data */
-#define        CIS_DATE        0x44    /* Format data/time */
-#define        CIS_BATTERY     0x45    /* Battery replacement date */
-#define        CIS_ORG         0x46    /* Organization of data on card */
-#define        CIS_END         0xFF    /* Termination code */
-
-/*
- *     Internal tuple definitions.
- *
- *     Device descriptor for memory (CIS_MEM_ATTR, CIS_MEM_COMMON)
- *
- *     Byte 1:
- *             0xF0 - Device type
- *             0x08 - Write protect switch
- *             0x07 - Speed index (7 = extended speed)
- *     Byte 2: Extended speed (bit 7 = another follows)
- *     Byte 3: (ignored if 0xFF)
- *             0xF8 - Addressable units (0's numbered)
- *             0x07 - Unit size
- *     The three byte sequence is repeated until byte 1 == 0xFF
- */
-
-/*
- *     CIS_INFO_V1 - Version one card information.
- *
- *     Byte 1:   Major version number (should be 4)
- *     Byte 2:   Minor version number (should be 1)
- *     Byte 3-x: Null terminated Manufacturer name
- *     Byte x-x: Null terminated product name
- *     Byte x-x: Null terminated additional info 1
- *     Byte x-x: Null terminated additional info 2
- *     Byte x:   final byte must be 0xFF
- */
-#define        CIS_MAJOR_VERSION       4
-#define        CIS_MINOR_VERSION       1
-
-/*
- *     CIS_CONF_MAP - Provides an address map for the card
- *                     configuration register(s), and a max value
- *                     identifying the last configuration tuple.
- *
- *     Byte 1:
- *             0x3C - Register mask size (0's numbered)
- *             0x03 - Register address size (0's numbered)
- *     Byte 2:
- *             0x3F - ID of last configuration.
- *     Byte 3-n: Card register address (size is determined by
- *                     the value in byte 1).
- *     Byte x-x: Card register masks (size determined by the
- *                     value in byte 1)
- */
-
-/*
- *     CIS_CONFIG - Card configuration entry. Multiple tuples may
- *             exist of this type, each one describing a different
- *             memory/I-O map that can be used to address this card.
- *             The first one usually has extra config data about the
- *             card features. The final configuration tuple number
- *             is stored in the CIS_CONF_MAP tuple so that the complete
- *             list can be scanned.
- *
- *     Byte 1:
- *             0x3F - Configuration ID number.
- *             0x40 - Indicates this is the default configuration
- *             0x80 - Interface byte exists
- *     Byte 2: (exists only if bit 0x80 set in byte 1)
- *             0x0F - Interface type value
- *             0x10 - Battery voltage detect
- *             0x20 - Write protect active
- *             0x40 - RdyBsy active bit
- *             0x80 - Wait signal required
- *     Byte 3: (features byte)
- *             0x03 - Power sub-tuple(s) exists
- *             0x04 - Timing sub-tuple exists
- *             0x08 - I/O space sub-tuple exists
- *             0x10 - IRQ sub-tuple exists
- *             0x60 - Memory space sub-tuple(s) exists
- *             0x80 - Miscellaneous sub-tuple exists
- */
-#define        CIS_FEAT_POWER(x)       ((x) & 0x3)
-#define        CIS_FEAT_TIMING         0x4
-#define        CIS_FEAT_I_O            0x8
-#define        CIS_FEAT_IRQ            0x10
-#define        CIS_FEAT_MEMORY(x)      (((x) >> 5) & 0x3)
-#define        CIS_FEAT_MISC           0x80
-/*
- *     Depending on whether the "features" byte has the corresponding
- *     bit set, a number of sub-tuples follow. Some features have
- *     more than one sub-tuple, depending on the count within the
- *     features byte (e.g power feature bits allows up to 3 sub-tuples).
- *
- *     Power structure sub-tuple:
- *     Byte 1: parameter exists - Each bit (starting from 0x01) indicates
- *             that a parameter block exists - up to 8 parameter blocks
- *             are therefore allowed).
- *     Byte 2:
- *             0x7F - Parameter data
- *             0x80 - More bytes follow (0 = last byte)
- *
- *     Timing sub-tuple
- *     Byte 1:
- *             0x03 - Wait scale
- *             0x1C - Ready scale
- *             0xE0 - Reserved scale
- *     Byte 2: extended wait scale if wait scale != 3
- *     Byte 3: extended ready scale if ready scale != 7
- *     Byte 4: extended reserved scale if reserved scale != 7
- */
-#define        CIS_WAIT_SCALE(x)       ((x) & 0x3)
-#define        CIS_READY_SCALE(x)      (((x)>>2) & 0x7)
-#define        CIS_RESERVED_SCALE(x)   (((x)>>5) & 0x7)
-/*
- *     I/O mapping sub-tuple:
- *     Byte 1:
- *             0x1F - I/O address lines
- *             0x20 - 8 bit I/O
- *             0x40 - 16 bit I/O
- *             0x80 - I/O range??
- *     Byte 2:
- *             0x0F - 0's numbered count of I/O block subtuples following.
- *             0x30 - Size of I/O address value within subtuple. Values
- *                     can be 1 (8 bits), 2 (16 bits) or 3 (32 bits).
- *             0xC0 - Size of I/O port block size value within subtuple.
- *     I/O block sub-tuples, count from previous block:
- *             Byte 1-n: I/O start address
- *             Byte x-x: Size of I/O port block.
- */
-#define        CIS_IO_ADDR(x)  ((x) & 0x1F)
-#define        CIS_IO_8BIT     0x20
-#define        CIS_IO_16BIT    0x40
-#define        CIS_IO_RANGE    0x80
-#define        CIS_IO_BLKS(x)  ((x) & 0xF)
-#define        CIS_IO_ADSZ(x)  (((x)>>4) & 3)
-#define        CIS_IO_BLKSZ(x) (((x)>>6) & 3)
-/*
- *     IRQ sub-tuple.
- *     Byte 1:
- *             0x0F - Irq number or mask bits
- *             0x10 - IRQ mask values exist
- *             0x20 - Level triggered interrupts
- *             0x40 - Pulse triggered requests
- *             0x80 - Interrupt sharing.
- *     Byte 2-3: Interrupt req mask (if 0x10 of byte 1 set).
- */
-#define        CIS_IRQ_IRQN(x)         ((x) & 0xF)
-#define        CIS_IRQ_MASK            0x10
-#define        CIS_IRQ_LEVEL           0x20
-#define        CIS_IRQ_PULSE           0x40
-#define        CIS_IRQ_SHARING         0x80
-/*
- *     Memory block subtuple. Depending on the features bits, the
- *     following subtuples are used:
- *     mem features == 1
- *             Byte 1-2: upper 16 bits of 24 bit memory length.
- *     mem features == 2
- *             Byte 1-2: upper 16 bits of 24 bit memory length.
- *             Byte 3-4: upper 16 bits of 24 bit memory address.
- *     mem_features == 3
- *             Byte 1:
- *                     0x07 - 0's numbered count of memory sub-tuples
- *                     0x18 - Memory length size (1's numbered)
- *                     0x60 - Memory address size (1's numbered)
- *                     0x80 - Host address value exists
- *             Memory sub-tuples follow:
- *                     Byte 1-n: Memory length value (<< 8)
- *                     Byte n-n: Memory card address value (<< 8)
- *                     Byte n-n: Memory host address value (<< 8)
- */
-#define        CIS_FEAT_MEM_NONE       0       /* No memory config */
-#define        CIS_FEAT_MEM_LEN        1       /* Just length */
-#define        CIS_FEAT_MEM_ADDR       2       /* Card address & length */
-#define        CIS_FEAT_MEM_WIN        3       /* Multiple windows */
-
-#define        CIS_MEM_WINS(x)         (((x) & 0x7)+1)
-#define        CIS_MEM_LENSZ(x)        (((x) >> 3) & 0x3)
-#define        CIS_MEM_ADDRSZ(x)       (((x) >> 5) & 0x3)
-#define        CIS_MEM_HOST            0x80
-/*
- *     Misc sub-tuple.
- *     Byte 1:
- *     Byte 2:
- *             0x0c - DMA Request Signal
- *                      00 - not support DMA
- *                      01 - use SPKR# line
- *                      10 - use IOIS16# line
- *                      11 - use INPACK# line
- *             0x10 - DMA Width
- *                      0 - 8 bit DMA
- *                      1 - 16 bit DMA
- */
-#define        CIS_MISC_DMA_WIDTH(x)   (((x) & 0x10) >> 4)
-#define        CIS_MISC_DMA_REQ(x)     (((x) >> 2) & 0x3)
-
-#endif /* _PCCARD_CIS_H */
diff --git a/sys/bus/pccard/driver.h b/sys/bus/pccard/driver.h
deleted file mode 100644 (file)
index e34c781..0000000
+++ /dev/null
@@ -1,25 +0,0 @@
-/*-
- * pccard driver interface.
- * Bruce Evans, November 1995.
- * This file is in the public domain.
- *
- * $FreeBSD: src/sys/pccard/driver.h,v 1.12.2.2 2001/04/21 05:52:30 imp Exp $
- * $DragonFly: src/sys/bus/pccard/Attic/driver.h,v 1.2 2003/06/17 04:28:55 dillon Exp $
- */
-
-#ifndef _PCCARD_DRIVER_H_
-#define        _PCCARD_DRIVER_H_
-
-struct pccard_device;
-
-void   pccard_add_driver(struct pccard_device *);
-
-enum beepstate { BEEP_OFF, BEEP_ON };
-
-void   pccard_insert_beep(void);
-void   pccard_remove_beep(void);
-void   pccard_success_beep(void);
-void   pccard_failure_beep(void);
-int    pccard_beep_select(int);
-
-#endif /* !_PCCARD_DRIVER_H_ */
index ca4fde8..8edd276 100644 (file)
@@ -1,8 +1,6 @@
 /*     $NetBSD: pcmcia.c,v 1.23 2000/07/28 19:17:02 drochner Exp $     */
-/* $FreeBSD: src/sys/dev/pccard/pccard.c,v 1.70 2002/11/14 14:02:32 mux Exp $ */
-/* $DragonFly: src/sys/bus/pccard/pccard.c,v 1.19 2006/12/22 23:12:16 swildner Exp $ */
 
-/*
+/*-
  * Copyright (c) 1997 Marc Horowitz.  All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -29,6 +27,9 @@
  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * $FreeBSD: src/sys/dev/pccard/pccard.c,v 1.108 2005/07/15 01:43:08 imp Exp $
+ * $DragonFly: src/sys/bus/pccard/pccard.c,v 1.20 2007/07/05 12:08:53 sephe Exp $
  */
 
 #include <sys/param.h>
@@ -47,6 +48,7 @@
 
 #include <bus/pccard/pccardreg.h>
 #include <bus/pccard/pccardvar.h>
+#include <bus/pccard/pccard_cis.h>
 
 #include "power_if.h"
 #include "card_if.h"
@@ -83,7 +85,6 @@ static int    pccard_ccr_read(struct pccard_function *pf, int ccr);
 static void    pccard_ccr_write(struct pccard_function *pf, int ccr, int val);
 static int     pccard_attach_card(device_t dev);
 static int     pccard_detach_card(device_t dev);
-static int     pccard_card_gettype(device_t dev, int *type);
 static void    pccard_function_init(struct pccard_function *pf);
 static void    pccard_function_free(struct pccard_function *pf);
 static int     pccard_function_enable(struct pccard_function *pf);
@@ -104,12 +105,12 @@ static int        pccard_get_resource(device_t dev, device_t child, int type,
 static void    pccard_delete_resource(device_t dev, device_t child, int type,
                    int rid);
 static int     pccard_set_res_flags(device_t dev, device_t child, int type,
-                   int rid, u_int32_t flags);
+                   int rid, uint32_t flags);
 static int     pccard_set_memory_offset(device_t dev, device_t child, int rid,
-                   u_int32_t offset, u_int32_t *deltap);
+                   uint32_t offset, uint32_t *deltap);
 static void    pccard_probe_nomatch(device_t cbdev, device_t child);
 static int     pccard_read_ivar(device_t bus, device_t child, int which,
-                                uintptr_t *result);
+                   u_char *result);
 static void    pccard_driver_added(device_t dev, driver_t *driver);
 static struct resource *pccard_alloc_resource(device_t dev,
                    device_t child, int type, int *rid, u_long start,
@@ -146,6 +147,33 @@ pccard_ccr_write(struct pccard_function *pf, int ccr, int val)
        }
 }
 
+static int
+pccard_set_default_descr(device_t dev)
+{
+       const char *vendorstr, *prodstr;
+       uint32_t vendor, prod;
+       char *str;
+
+       vendorstr = pccard_get_vendor_str(dev);
+       prodstr = pccard_get_product_str(dev);
+       if (vendorstr != NULL && prodstr != NULL) {
+               str = kmalloc(strlen(vendorstr) + strlen(prodstr) + 2, M_DEVBUF,
+                   M_WAITOK);
+               ksprintf(str, "%s %s", vendorstr, prodstr);
+               device_set_desc_copy(dev, str);
+               kfree(str, M_DEVBUF);
+       } else {
+               vendor = pccard_get_vendor(dev);
+               prod = pccard_get_product(dev);
+
+               str = kmalloc(100, M_DEVBUF, M_WAITOK);
+               ksnprintf(str, 100, "vendor=0x%x product=0x%x", vendor, prod);
+               device_set_desc_copy(dev, str);
+               kfree(str, M_DEVBUF);
+       }
+       return (0);
+}
+
 static int
 pccard_attach_card(device_t dev)
 {
@@ -223,13 +251,14 @@ pccard_attach_card(device_t dev)
                 * can be on at a time.
                 */
                ivar = kmalloc(sizeof(struct pccard_ivar), M_DEVBUF,
-                   M_INTWAIT | M_ZERO);
+                   M_WAITOK | M_ZERO);
+               resource_list_init(&ivar->resources);
                child = device_add_child(dev, NULL, -1);
                device_set_ivars(child, ivar);
-               ivar->fcn = pf;
+               ivar->pf = pf;
                pf->dev = child;
                /*
-                * XXX We might want to move the next two lines into
+                * XXX We might want to move the next three lines into
                 * XXX the pccard interface layer.  For the moment, this
                 * XXX is OK, but some drivers want to pick the config
                 * XXX entry to use as well as some address tweaks (mostly
@@ -240,11 +269,13 @@ pccard_attach_card(device_t dev)
                if (sc->sc_enabled_count == 0)
                        POWER_ENABLE_SOCKET(device_get_parent(dev), dev);
                if (pccard_function_enable(pf) == 0 &&
+                   pccard_set_default_descr(child) == 0 &&
                    device_probe_and_attach(child) == 0) {
                        DEVPRINTF((sc->dev, "function %d CCR at %d "
-                           "offset %x: %x %x %x %x, %x %x %x %x, %x\n",
+                           "offset %x mask %x: "
+                           "%x %x %x %x, %x %x %x %x, %x\n",
                            pf->number, pf->pf_ccr_window, pf->pf_ccr_offset,
-                           pccard_ccr_read(pf, 0x00),
+                           pf->ccr_mask, pccard_ccr_read(pf, 0x00),
                        pccard_ccr_read(pf, 0x02), pccard_ccr_read(pf, 0x04),
                        pccard_ccr_read(pf, 0x06), pccard_ccr_read(pf, 0x0A),
                        pccard_ccr_read(pf, 0x0C), pccard_ccr_read(pf, 0x0E),
@@ -263,14 +294,16 @@ pccard_detach_card(device_t dev)
        struct pccard_softc *sc = PCCARD_SOFTC(dev);
        struct pccard_function *pf;
        struct pccard_config_entry *cfe;
+       int state;
 
        /*
         * We are running on either the PCCARD socket's event thread
         * or in user context detaching a device by user request.
         */
        STAILQ_FOREACH(pf, &sc->card.pf_head, pf_list) {
-               int state = device_get_state(pf->dev);
-
+               if (pf->dev == NULL)
+                       continue;
+               state = device_get_state(pf->dev);
                if (state == DS_ATTACHED || state == DS_BUSY)
                        device_detach(pf->dev);
                if (pf->cfe != NULL)
@@ -294,37 +327,41 @@ pccard_detach_card(device_t dev)
 
 static const struct pccard_product *
 pccard_do_product_lookup(device_t bus, device_t dev,
-                        const struct pccard_product *tab, size_t ent_size,
-                        pccard_product_match_fn matchfn)
+    const struct pccard_product *tab, size_t ent_size,
+    pccard_product_match_fn matchfn)
 {
        const struct pccard_product *ent;
        int matches;
-       u_int32_t fcn;
-       u_int32_t vendor;
-       u_int32_t prod;
+       uint32_t vendor;
+       uint32_t prod;
        const char *vendorstr;
        const char *prodstr;
+       const char *cis3str;
+       const char *cis4str;
 
 #ifdef DIAGNOSTIC
        if (sizeof *ent > ent_size)
-               panic("pccard_product_lookup: bogus ent_size %ld",
-                   (long) ent_size);
+               panic("pccard_product_lookup: bogus ent_size %jd",
+                   (intmax_t) ent_size);
 #endif
        vendor = pccard_get_vendor(dev);
        prod = pccard_get_product(dev);
-       fcn = pccard_get_function_number(dev);
        vendorstr = pccard_get_vendor_str(dev);
        prodstr = pccard_get_product_str(dev);
-       for (ent = tab; ent->pp_name != NULL; ent =
+       cis3str = pccard_get_cis3_str(dev);
+       cis4str = pccard_get_cis4_str(dev);
+
+       for (ent = tab; ent->pp_vendor != 0; ent =
            (const struct pccard_product *) ((const char *) ent + ent_size)) {
                matches = 1;
                if (ent->pp_vendor == PCCARD_VENDOR_ANY &&
-                   ent->pp_product == PCCARD_VENDOR_ANY &&
+                   ent->pp_product == PCCARD_PRODUCT_ANY &&
                    ent->pp_cis[0] == NULL &&
                    ent->pp_cis[1] == NULL) {
-                       device_printf(dev,
-                           "Total wildcard entry ignored for %s\n",
-                           ent->pp_name);
+                       if (ent->pp_name)
+                               device_printf(dev,
+                                   "Total wildcard entry ignored for %s\n",
+                                   ent->pp_name);
                        continue;
                }
                if (matches && ent->pp_vendor != PCCARD_VENDOR_ANY &&
@@ -333,15 +370,22 @@ pccard_do_product_lookup(device_t bus, device_t dev,
                if (matches && ent->pp_product != PCCARD_PRODUCT_ANY &&
                    prod != ent->pp_product)
                        matches = 0;
-               if (matches && fcn != ent->pp_expfunc)
-                       matches = 0;
                if (matches && ent->pp_cis[0] &&
-                   strcmp(ent->pp_cis[0], vendorstr) != 0)
+                   (vendorstr == NULL ||
+                   strcmp(ent->pp_cis[0], vendorstr) != 0))
                        matches = 0;
                if (matches && ent->pp_cis[1] &&
-                   strcmp(ent->pp_cis[1], prodstr) != 0)
+                   (prodstr == NULL ||
+                   strcmp(ent->pp_cis[1], prodstr) != 0))
+                       matches = 0;
+               if (matches && ent->pp_cis[2] &&
+                   (cis3str == NULL ||
+                   strcmp(ent->pp_cis[2], cis3str) != 0))
+                       matches = 0;
+               if (matches && ent->pp_cis[3] &&
+                   (cis4str == NULL ||
+                   strcmp(ent->pp_cis[3], cis4str) != 0))
                        matches = 0;
-               /* XXX need to match cis[2] and cis[3] also XXX */
                if (matchfn != NULL)
                        matches = (*matchfn)(dev, ent, matches);
                if (matches)
@@ -350,27 +394,6 @@ pccard_do_product_lookup(device_t bus, device_t dev,
        return (NULL);
 }
 
-static int
-pccard_card_gettype(device_t dev, int *type)
-{
-       struct pccard_softc *sc = PCCARD_SOFTC(dev);
-       struct pccard_function *pf;
-
-       /*
-        * set the iftype to memory if this card has no functions (not yet
-        * probed), or only one function, and that is not initialized yet or
-        * that is memory.
-        */
-       pf = STAILQ_FIRST(&sc->card.pf_head);
-       if (pf == NULL ||
-           (STAILQ_NEXT(pf, pf_list) == NULL &&
-           (pf->cfe == NULL || pf->cfe->iftype == PCCARD_IFTYPE_MEMORY)))
-               *type = PCCARD_IFTYPE_MEMORY;
-       else
-               *type = PCCARD_IFTYPE_IO;
-       return (0);
-}
-
 /*
  * Initialize a PCCARD function.  May be called as long as the function is
  * disabled.
@@ -385,15 +408,13 @@ static void
 pccard_function_init(struct pccard_function *pf)
 {
        struct pccard_config_entry *cfe;
-       int i;
        struct pccard_ivar *devi = PCCARD_IVAR(pf->dev);
        struct resource_list *rl = &devi->resources;
        struct resource_list_entry *rle;
        struct resource *r = 0;
        device_t bus;
-       int start;
-       int end;
-       int spaces;
+       u_long start, end, len;
+       int i, rid, spaces;
 
        if (pf->pf_flags & PFF_ENABLED) {
                kprintf("pccard_function_init: function is enabled");
@@ -402,53 +423,70 @@ pccard_function_init(struct pccard_function *pf)
        bus = device_get_parent(pf->dev);
        /* Remember which configuration entry we are using. */
        STAILQ_FOREACH(cfe, &pf->cfe_head, cfe_list) {
-               for (i = 0; i < cfe->num_iospace; i++)
-                       cfe->iores[i] = NULL;
-               cfe->irqres = NULL;
+               if (cfe->iftype != PCCARD_IFTYPE_IO)
+                       continue;
                spaces = 0;
                for (i = 0; i < cfe->num_iospace; i++) {
                        start = cfe->iospace[i].start;
                        if (start)
                                end = start + cfe->iospace[i].length - 1;
                        else
-                               end = ~0;
-                       cfe->iorid[i] = i;
-                       DEVPRINTF((bus, "I/O rid %d start %x end %x\n",
+                               end = ~0UL;
+                       DEVPRINTF((bus, "I/O rid %d start %lx end %lx\n",
                            i, start, end));
-                       r = cfe->iores[i] = bus_alloc_resource(bus,
-                           SYS_RES_IOPORT, &cfe->iorid[i], start, end,
-                           cfe->iospace[i].length,
-                           rman_make_alignment_flags(cfe->iospace[i].length));
-                       if (cfe->iores[i] == NULL)
+                       rid = i;
+                       len = cfe->iospace[i].length;
+                       r = bus_alloc_resource(bus, SYS_RES_IOPORT, &rid,
+                           start, end, len, rman_make_alignment_flags(len));
+                       if (r == NULL)
                                goto not_this_one;
-                       resource_list_add(rl, SYS_RES_IOPORT, cfe->iorid[i],
-                           rman_get_start(r), rman_get_end(r),
+                       resource_list_add(rl, SYS_RES_IOPORT,
+                           rid, rman_get_start(r), rman_get_end(r),
                            cfe->iospace[i].length);
-                       rle = resource_list_find(rl, SYS_RES_IOPORT,
-                           cfe->iorid[i]);
+                       rle = resource_list_find(rl, SYS_RES_IOPORT, rid);
+                       if (rle == NULL)
+                               panic("Cannot add resource rid %d IOPORT", rid);
                        rle->res = r;
                        spaces++;
                }
-               if (cfe->num_memspace > 0) {
-                       /*
-                        * Not implement yet, Fix me.
-                        */
-                       DEVPRINTF((bus, "Memory space not yet implemented.\n"));
+               for (i = 0; i < cfe->num_memspace; i++) {
+                       start = cfe->memspace[i].hostaddr;
+                       if (start)
+                               end = start + cfe->memspace[i].length - 1;
+                       else
+                               end = ~0UL;
+                       DEVPRINTF((bus, "Memory rid %d start %lx end %lx\n",
+                           i, start, end));
+                       rid = i;
+                       len = cfe->memspace[i].length;
+                       r = bus_alloc_resource(bus, SYS_RES_MEMORY, &rid,
+                           start, end, len, rman_make_alignment_flags(len));
+                       if (r == NULL)
+                               goto not_this_one;
+                       resource_list_add(rl, SYS_RES_MEMORY,
+                           rid, rman_get_start(r), rman_get_end(r),
+                           cfe->memspace[i].length);
+                       rle = resource_list_find(rl, SYS_RES_MEMORY, rid);
+                       if (rle == NULL)
+                               panic("Cannot add resource rid %d MEM", rid);
+                       rle->res = r;
+                       spaces++;
                }
                if (spaces == 0) {
-                       DEVPRINTF((bus, "Neither memory nor I/O mampped\n"));
+                       DEVPRINTF((bus, "Neither memory nor I/O mapped\n"));
                        goto not_this_one;
                }
                if (cfe->irqmask) {
-                       cfe->irqrid = 0;
-                       r = cfe->irqres = bus_alloc_resource(bus, SYS_RES_IRQ,
-                           &cfe->irqrid, 0, ~0, 1, 0);
-                       if (cfe->irqres == NULL)
+                       rid = 0;
+                       r = bus_alloc_resource_any(bus, SYS_RES_IRQ, &rid,
+                           RF_SHAREABLE);
+                       if (r == NULL)
                                goto not_this_one;
-                       resource_list_add(rl, SYS_RES_IRQ, cfe->irqrid,
+                       resource_list_add(rl, SYS_RES_IRQ, rid,
                            rman_get_start(r), rman_get_end(r), 1);
-                       rle = resource_list_find(rl, SYS_RES_IRQ,
-                           cfe->irqrid);
+                       rle = resource_list_find(rl, SYS_RES_IRQ, rid);
+                       if (rle == NULL)
+                               panic("Cannot add resource rid %d IRQ", rid);
                        rle->res = r;
                }
                /* If we get to here, we've allocated all we need */
@@ -457,31 +495,9 @@ pccard_function_init(struct pccard_function *pf)
            not_this_one:;
                DEVPRVERBOSE((bus, "Allocation failed for cfe %d\n",
                    cfe->number));
-               /*
-                * Release resources that we partially allocated
-                * from this config entry.
-                */
-               for (i = 0; i < cfe->num_iospace; i++) {
-                       if (cfe->iores[i] != NULL) {
-                               bus_release_resource(bus, SYS_RES_IOPORT,
-                                   cfe->iorid[i], cfe->iores[i]);
-                               rle = resource_list_find(rl, SYS_RES_IOPORT,
-                                   cfe->iorid[i]);
-                               rle->res = NULL;
-                               resource_list_delete(rl, SYS_RES_IOPORT,
-                                   cfe->iorid[i]);
-                       }
-                       cfe->iores[i] = NULL;
-               }
-               if (cfe->irqmask && cfe->irqres != NULL) {
-                       bus_release_resource(bus, SYS_RES_IRQ,
-                           cfe->irqrid, cfe->irqres);
-                       rle = resource_list_find(rl, SYS_RES_IRQ,
-                           cfe->irqrid);
-                       rle->res = NULL;
-                       resource_list_delete(rl, SYS_RES_IRQ, cfe->irqrid);
-                       cfe->irqres = NULL;
-               }
+#if 0 /* YYY */
+               resource_list_purge(rl);
+#endif
        }
 }
 
@@ -505,7 +521,7 @@ pccard_function_free(struct pccard_function *pf)
 
        SLIST_FOREACH(rle, &devi->resources, link) {
                if (rle->res) {
-                       if (rle->res->r_dev != pf->sc->dev)
+                       if (rman_get_device(rle->res) != pf->sc->dev)
                                device_printf(pf->sc->dev,
                                    "function_free: Resource still owned by "
                                    "child, oops. "
@@ -513,7 +529,7 @@ pccard_function_free(struct pccard_function *pf)
                                    rle->type, rle->rid,
                                    rman_get_start(rle->res));
                        BUS_RELEASE_RESOURCE(device_get_parent(pf->sc->dev),
-                           rle->res->r_dev, rle->type, rle->rid, rle->res);
+                           pf->sc->dev, rle->type, rle->rid, rle->res);
                        rle->res = NULL;
                }
        }
@@ -522,33 +538,37 @@ pccard_function_free(struct pccard_function *pf)
 
 static void
 pccard_mfc_adjust_iobase(struct pccard_function *pf, bus_addr_t addr,
-                       bus_addr_t offset, bus_size_t size)
+    bus_addr_t offset, bus_size_t size)
 {
        bus_size_t iosize, tmp;
-       
+
        if (addr != 0) {
                if (pf->pf_mfc_iomax == 0) {
                        pf->pf_mfc_iobase = addr + offset;
-                       pf->pf_mfc_iomax = pf->pf_mfc_iobase  + size;
+                       pf->pf_mfc_iomax = pf->pf_mfc_iobase + size;
                } else {
-                       if (pf->pf_mfc_iobase > addr  + offset)
+                       /* this makes the assumption that nothing overlaps */
+                       if (pf->pf_mfc_iobase > addr + offset)
                                pf->pf_mfc_iobase = addr + offset;
-                       if (pf->pf_mfc_iomax < addr + offset  + size)
+                       if (pf->pf_mfc_iomax < addr + offset + size)
                                pf->pf_mfc_iomax = addr + offset + size;
                }
-       }       
+       }
+
        tmp = pf->pf_mfc_iomax - pf->pf_mfc_iobase;
+       /* round up to nearest (2^n)-1 */
        for (iosize = 1; iosize < tmp; iosize <<= 1)
                ;
        iosize--;
 
+       DEVPRINTF((pf->dev, "MFC: I/O base %#jx IOSIZE %#jx\n",
+           (uintmax_t)pf->pf_mfc_iobase, (uintmax_t)(iosize + 1)));
        pccard_ccr_write(pf, PCCARD_CCR_IOBASE0,
-                        pf->pf_mfc_iobase & 0xff);
+           pf->pf_mfc_iobase & 0xff);
        pccard_ccr_write(pf, PCCARD_CCR_IOBASE1,
-                                (pf->pf_mfc_iobase >> 8) & 0xff);
+           (pf->pf_mfc_iobase >> 8) & 0xff);
        pccard_ccr_write(pf, PCCARD_CCR_IOBASE2, 0);
        pccard_ccr_write(pf, PCCARD_CCR_IOBASE3, 0);
-
        pccard_ccr_write(pf, PCCARD_CCR_IOSIZE, iosize);
 }
 
@@ -639,7 +659,7 @@ pccard_function_enable(struct pccard_function *pf)
 
        pccard_ccr_write(pf, PCCARD_CCR_SOCKETCOPY, 0);
 
-       if (pccard_mfc(pf->sc)) 
+       if (pccard_mfc(pf->sc))
                pccard_mfc_adjust_iobase(pf, 0, 0, 0);
 
 #ifdef PCCARDDEBUG
@@ -697,6 +717,8 @@ pccard_function_disable(struct pccard_function *pf)
                struct pccard_ivar *devi = PCCARD_IVAR(pf->dev);
                struct resource_list_entry *rle =
                    resource_list_find(&devi->resources, SYS_RES_IRQ, 0);
+               if (rle == NULL)
+                       panic("Can't disable an interrupt with no IRQ res\n");
                BUS_TEARDOWN_INTR(dev, pf->dev, rle->res,
                    pf->intr_handler_cookie);
        }
@@ -748,7 +770,7 @@ pccard_compat_do_attach(device_t bus, device_t dev)
        int err;
 
        err = CARD_COMPAT_PROBE(dev);
-       if (err == 0)
+       if (err <= 0)
                err = CARD_COMPAT_ATTACH(dev);
        return (err);
 }
@@ -796,15 +818,8 @@ pccard_suspend(device_t self)
        return (0);
 }
 
-static int
-pccard_shutdown(device_t self)
-{
-       pccard_detach_card(self);
-       bus_generic_shutdown(self);
-       return (0);
-}
-
-static int
+static
+int
 pccard_resume(device_t self)
 {
        return (0);
@@ -858,8 +873,8 @@ pccard_print_child(device_t dev, device_t child)
                    "%ld");
                pccard_print_resources(rl, "drq", SYS_RES_DRQ, PCCARD_NDRQ,
                    "%ld");
-               retval += kprintf(" function %d config %d", devi->fcn->number,
-                   devi->fcn->cfe->number);
+               retval += kprintf(" function %d config %d", devi->pf->number,
+                   devi->pf->cfe->number);
        }
 
        retval += bus_print_child_footer(dev, child);
@@ -869,7 +884,7 @@ pccard_print_child(device_t dev, device_t child)
 
 static int
 pccard_set_resource(device_t dev, device_t child, int type, int rid,
-                u_long start, u_long count)
+    u_long start, u_long count)
 {
        struct pccard_ivar *devi = PCCARD_IVAR(child);
        struct resource_list *rl = &devi->resources;
@@ -926,7 +941,7 @@ pccard_delete_resource(device_t dev, device_t child, int type, int rid)
 
 static int
 pccard_set_res_flags(device_t dev, device_t child, int type, int rid,
-    u_int32_t flags)
+    uint32_t flags)
 {
        return (CARD_SET_RES_FLAGS(device_get_parent(dev), child, type,
            rid, flags));
@@ -934,7 +949,7 @@ pccard_set_res_flags(device_t dev, device_t child, int type, int rid,
 
 static int
 pccard_set_memory_offset(device_t dev, device_t child, int rid,
-    u_int32_t offset, u_int32_t *deltap)
+    uint32_t offset, uint32_t *deltap)
 
 {
        return (CARD_SET_MEMORY_OFFSET(device_get_parent(dev), child, rid,
@@ -945,14 +960,18 @@ static void
 pccard_probe_nomatch(device_t bus, device_t child)
 {
        struct pccard_ivar *devi = PCCARD_IVAR(child);
-       struct pccard_function *func = devi->fcn;
+       struct pccard_function *pf = devi->pf;
        struct pccard_softc *sc = PCCARD_SOFTC(bus);
+       int i;
 
        device_printf(bus, "<unknown card>");
-       kprintf(" (manufacturer=0x%04x, product=0x%04x) at function %d\n",
-         sc->card.manufacturer, sc->card.product, func->number);
-       device_printf(bus, "   CIS info: %s, %s, %s\n", sc->card.cis1_info[0],
-         sc->card.cis1_info[1], sc->card.cis1_info[2]);
+       kprintf(" (manufacturer=0x%04x, product=0x%04x, function_type=%d) "
+           "at function %d\n", sc->card.manufacturer, sc->card.product,
+           pf->function, pf->number);
+       device_printf(bus, "   CIS info: ");
+       for (i = 0; sc->card.cis1_info[i] != NULL && i < 4; i++)
+               kprintf("%s%s", i > 0 ? ", " : "", sc->card.cis1_info[i]);
+       kprintf("\n");
        return;
 }
 
@@ -961,69 +980,90 @@ pccard_child_location_str(device_t bus, device_t child, char *buf,
     size_t buflen)
 {
        struct pccard_ivar *devi = PCCARD_IVAR(child);
-       struct pccard_function *func = devi->fcn;
+       struct pccard_function *pf = devi->pf;
 
-       ksnprintf(buf, buflen, "function=%d", func->number);
+       ksnprintf(buf, buflen, "function=%d", pf->number);
        return (0);
 }
 
+/* XXX Maybe this should be in subr_bus? */
+static void
+pccard_safe_quote(char *dst, const char *src, size_t len)
+{
+       char *walker = dst, *ep = dst + len - 1;
+
+       if (len == 0)
+               return;
+       while (walker < ep)
+       {
+               if (*src == '"') {
+                       if (ep - walker < 2)
+                               break;
+                       *walker++ = '\\';
+               }
+               *walker++ = *src++;
+       }
+       *walker = '\0';
+}
+
 static int
 pccard_child_pnpinfo_str(device_t bus, device_t child, char *buf,
     size_t buflen)
 {
        struct pccard_ivar *devi = PCCARD_IVAR(child);
-       struct pccard_function *func = devi->fcn;
+       struct pccard_function *pf = devi->pf;
        struct pccard_softc *sc = PCCARD_SOFTC(bus);
+       char cis0[128], cis1[128];
 
+       pccard_safe_quote(cis0, sc->card.cis1_info[0], sizeof(cis0));
+       pccard_safe_quote(cis1, sc->card.cis1_info[1], sizeof(cis1));
        ksnprintf(buf, buflen, "manufacturer=0x%04x product=0x%04x "
            "cisvendor=\"%s\" cisproduct=\"%s\" function_type=%d",
-           sc->card.manufacturer, sc->card.product, sc->card.cis1_info[0],
-           sc->card.cis1_info[1], func->function);
+           sc->card.manufacturer, sc->card.product, cis0, cis1, pf->function);
        return (0);
 }
 
 static int
-pccard_read_ivar(device_t bus, device_t child, int which, uintptr_t *result)
+pccard_read_ivar(device_t bus, device_t child, int which, u_char *result)
 {
        struct pccard_ivar *devi = PCCARD_IVAR(child);
-       struct pccard_function *func = devi->fcn;
+       struct pccard_function *pf = devi->pf;
        struct pccard_softc *sc = PCCARD_SOFTC(bus);
 
+       if (!pf)
+               panic("No pccard function pointer");
        switch (which) {
        default:
+               return (EINVAL);
        case PCCARD_IVAR_ETHADDR:
-               *result = (uintptr_t)func->pf_funce_lan_nid;
+               bcopy(pf->pf_funce_lan_nid, result, ETHER_ADDR_LEN);
                break;
        case PCCARD_IVAR_VENDOR:
-               *result = sc->card.manufacturer;
+               *(uint32_t *)result = sc->card.manufacturer;
                break;
        case PCCARD_IVAR_PRODUCT:
-               *result = sc->card.product;
+               *(uint32_t *)result = sc->card.product;
                break;
        case PCCARD_IVAR_PRODEXT:
-               *result = sc->card.prodext;
+               *(uint16_t *)result = sc->card.prodext;
                break;
        case PCCARD_IVAR_FUNCTION:
-               *result = func->function;
+               *(uint32_t *)result = pf->function;
                break;
        case PCCARD_IVAR_FUNCTION_NUMBER:
-               if (!func) {
-                       device_printf(bus, "No function number, bug!\n");
-                       return (ENOENT);
-               }
-               *result = func->number;
+               *(uint32_t *)result = pf->number;
                break;
        case PCCARD_IVAR_VENDOR_STR:
-               *result = (uintptr_t)sc->card.cis1_info[0];
+               *(const char **)result = sc->card.cis1_info[0];
                break;
        case PCCARD_IVAR_PRODUCT_STR:
-               *result = (uintptr_t)sc->card.cis1_info[1];
+               *(const char **)result = sc->card.cis1_info[1];
                break;
        case PCCARD_IVAR_CIS3_STR:
-               *result = (uintptr_t)sc->card.cis1_info[2];
+               *(const char **)result = sc->card.cis1_info[2];
                break;
        case PCCARD_IVAR_CIS4_STR:
-               *result = (uintptr_t)sc->card.cis1_info[3];
+               *(const char **)result = sc->card.cis1_info[3];
                break;
        }
        return (0);
@@ -1070,7 +1110,7 @@ pccard_alloc_resource(device_t dev, device_t child, int type, int *rid,
        int isdefault = (start == 0 && end == ~0UL && count == 1);
        struct resource *r = NULL;
 
-
+       /* XXX I'm no longer sure this is right */
        if (passthrough) {
                return (BUS_ALLOC_RESOURCE(device_get_parent(dev), child,
                    type, rid, start, end, count, flags));
@@ -1080,37 +1120,29 @@ pccard_alloc_resource(device_t dev, device_t child, int type, int *rid,
        rle = resource_list_find(&dinfo->resources, type, *rid);
 
        if (rle == NULL && isdefault)
-               return (NULL);          /* no resource of that type/rid */
-
-       if ((rle == NULL) || (rle->res == NULL)) {
-               
+               return (NULL);  /* no resource of that type/rid */
+       if (rle == NULL || rle->res == NULL) {
+               /* XXX Need to adjust flags */
                r = bus_alloc_resource(dev, type, rid, start, end,
-                           count, rman_make_alignment_flags(count));
+                 count, flags);
                if (r == NULL)
-                       goto bad;
+                   goto bad;
                resource_list_add(&dinfo->resources, type, *rid,
-                           rman_get_start(r), rman_get_end(r), count);
+                 rman_get_start(r), rman_get_end(r), count);
                rle = resource_list_find(&dinfo->resources, type, *rid);
                if (!rle)
-                       goto bad;
+                   goto bad;
                rle->res = r;
        }
-       if (rle->res->r_dev != dev)
+       /*
+        * If dev doesn't own the device, then we can't give this device
+        * out.
+        */
+       if (rman_get_device(rle->res) != dev)
                return (NULL);
-       bus_release_resource(dev, type, *rid, rle->res);
-       rle->res = NULL;
-       switch(type) {
-       case SYS_RES_IOPORT:
-       case SYS_RES_MEMORY:
-               if (!(flags & RF_ALIGNMENT_MASK))
-                       flags |= rman_make_alignment_flags(rle->count);
-               break;
-       case SYS_RES_IRQ:
-               flags |= RF_SHAREABLE;
-               break;
-       }
-       rle->res = resource_list_alloc(&dinfo->resources, dev, child,
-           type, rid, rle->start, rle->end, rle->count, flags);
+       rman_set_device(rle->res, child);
+       if (flags & RF_ACTIVE)
+               BUS_ACTIVATE_RESOURCE(dev, child, type, *rid, rle->res);
        return (rle->res);
 bad:;
        device_printf(dev, "WARNING: Resource not reserved by pccard\n");
@@ -1124,8 +1156,6 @@ pccard_release_resource(device_t dev, device_t child, int type, int rid,
        struct pccard_ivar *dinfo;
        int passthrough = (device_get_parent(child) != dev);
        struct resource_list_entry *rle = 0;
-       int ret;
-       int flags;
 
        if (passthrough)
                return BUS_RELEASE_RESOURCE(device_get_parent(dev), child,
@@ -1145,33 +1175,20 @@ pccard_release_resource(device_t dev, device_t child, int type, int rid,
                device_printf(dev, "Allocated resource not recorded\n");
                return ENOENT;
        }
-
-       ret = BUS_RELEASE_RESOURCE(device_get_parent(dev), child,
-           type, rid, r);
-       switch(type) {
-       case SYS_RES_IOPORT:
-       case SYS_RES_MEMORY:
-               flags = rman_make_alignment_flags(rle->count);
-               break;
-       case SYS_RES_IRQ:
-               flags = RF_SHAREABLE;
-               break;
-       default:
-               flags = 0;
-       }
-       rle->res = bus_alloc_resource(dev, type, &rid,
-           rle->start, rle->end, rle->count, flags);
-       if (rle->res == NULL)
-               device_printf(dev, "release_resource: "
-                   "unable to reaquire resource\n");
-       return ret;
+       /*
+        * Deactivate the resource (since it is being released), and
+        * assign it to the bus.
+        */
+       BUS_DEACTIVATE_RESOURCE(dev, child, type, rid, rle->res);
+       rman_set_device(rle->res, dev);
+       return (0);
 }
 
 static void
 pccard_child_detached(device_t parent, device_t dev)
 {
        struct pccard_ivar *ivar = PCCARD_IVAR(dev);
-       struct pccard_function *pf = ivar->fcn;
+       struct pccard_function *pf = ivar->pf;
 
        pccard_function_disable(pf);
 }
@@ -1194,6 +1211,10 @@ pccard_intr(void *arg)
         * the interrupt will pacify the card enough to keep an
         * interrupt storm from happening.  Of course this won't
         * help in the non-MFC case.
+        *
+        * This has no impact for MPSAFEness of the client drivers.
+        * We register this with whatever flags the intr_handler
+        * was registered with.  All these functions are MPSAFE.
         */
        if (pccard_mfc(pf->sc)) {
                reg = pccard_ccr_read(pf, PCCARD_CCR_STATUS);
@@ -1214,21 +1235,21 @@ pccard_setup_intr(device_t dev, device_t child, struct resource *irq,
 {
        struct pccard_softc *sc = PCCARD_SOFTC(dev);
        struct pccard_ivar *ivar = PCCARD_IVAR(child);
-       struct pccard_function *func = ivar->fcn;
+       struct pccard_function *pf = ivar->pf;
        int err;
 
-       if (func->intr_handler != NULL)
+       if (pf->intr_handler != NULL)
                panic("Only one interrupt handler per function allowed");
        err = bus_generic_setup_intr(dev, child, irq, flags, pccard_intr,
-                                    func, cookiep, serializer);
+                                    pf, cookiep, serializer);
        if (err != 0)
                return (err);
-       func->intr_handler = intr;
-       func->intr_handler_arg = arg;
-       func->intr_handler_cookie = *cookiep;
+       pf->intr_handler = intr;
+       pf->intr_handler_arg = arg;
+       pf->intr_handler_cookie = *cookiep;
        if (pccard_mfc(sc)) {
-               pccard_ccr_write(func, PCCARD_CCR_OPTION,
-                   pccard_ccr_read(func, PCCARD_CCR_OPTION) |
+               pccard_ccr_write(pf, PCCARD_CCR_OPTION,
+                   pccard_ccr_read(pf, PCCARD_CCR_OPTION) |
                    PCCARD_CCR_OPTION_IREQ_ENABLE);
        }
        return (0);
@@ -1240,36 +1261,40 @@ pccard_teardown_intr(device_t dev, device_t child, struct resource *r,
 {
        struct pccard_softc *sc = PCCARD_SOFTC(dev);
        struct pccard_ivar *ivar = PCCARD_IVAR(child);
-       struct pccard_function *func = ivar->fcn;
+       struct pccard_function *pf = ivar->pf;
        int ret;
 
        if (pccard_mfc(sc)) {
-               pccard_ccr_write(func, PCCARD_CCR_OPTION,
-                   pccard_ccr_read(func, PCCARD_CCR_OPTION) &
+               pccard_ccr_write(pf, PCCARD_CCR_OPTION,
+                   pccard_ccr_read(pf, PCCARD_CCR_OPTION) &
                    ~PCCARD_CCR_OPTION_IREQ_ENABLE);
        }
        ret = bus_generic_teardown_intr(dev, child, r, cookie);
        if (ret == 0) {
-               func->intr_handler = NULL;
-               func->intr_handler_arg = NULL;
-               func->intr_handler_cookie = NULL;
+               pf->intr_handler = NULL;
+               pf->intr_handler_arg = NULL;
+               pf->intr_handler_cookie = NULL;
        }
 
        return (ret);
 }
 
 static int
-pccard_activate_resource(device_t brdev, device_t child, int type,
-                       int rid, struct resource *r)
+pccard_activate_resource(device_t brdev, device_t child, int type, int rid,
+    struct resource *r)
 {
        struct pccard_ivar *ivar = PCCARD_IVAR(child);
-       struct pccard_function *pf = ivar->fcn;
-       
+       struct pccard_function *pf = ivar->pf;
+
        switch(type) {
        case SYS_RES_IOPORT:
+               /*
+                * We need to adjust IOBASE[01] and IOSIZE if we're an MFC
+                * card.
+                */
                if (pccard_mfc(pf->sc))
                        pccard_mfc_adjust_iobase(pf, rman_get_start(r), 0,
-                                       rman_get_size(r));
+                           rman_get_size(r));
                break;
        default:
                break;
@@ -1277,13 +1302,20 @@ pccard_activate_resource(device_t brdev, device_t child, int type,
        return (bus_generic_activate_resource(brdev, child, type, rid, r));
 }
 
+static int
+pccard_deactivate_resource(device_t brdev, device_t child, int type,
+    int rid, struct resource *r)
+{
+       /* XXX undo pccard_activate_resource? XXX */
+       return (bus_generic_deactivate_resource(brdev, child, type, rid, r));
+}
 
 static device_method_t pccard_methods[] = {
        /* Device interface */
        DEVMETHOD(device_probe,         pccard_probe),
        DEVMETHOD(device_attach,        pccard_attach),
        DEVMETHOD(device_detach,        pccard_detach),
-       DEVMETHOD(device_shutdown,      pccard_shutdown),
+       DEVMETHOD(device_shutdown,      bus_generic_shutdown),
        DEVMETHOD(device_suspend,       pccard_suspend),
        DEVMETHOD(device_resume,        pccard_resume),
 
@@ -1294,7 +1326,7 @@ static device_method_t pccard_methods[] = {
        DEVMETHOD(bus_alloc_resource,   pccard_alloc_resource),
        DEVMETHOD(bus_release_resource, pccard_release_resource),
        DEVMETHOD(bus_activate_resource, pccard_activate_resource),
-       DEVMETHOD(bus_deactivate_resource, bus_generic_deactivate_resource),
+       DEVMETHOD(bus_deactivate_resource, pccard_deactivate_resource),
        DEVMETHOD(bus_setup_intr,       pccard_setup_intr),
        DEVMETHOD(bus_teardown_intr,    pccard_teardown_intr),
        DEVMETHOD(bus_set_resource,     pccard_set_resource),
@@ -1308,12 +1340,12 @@ static device_method_t pccard_methods[] = {
        /* Card Interface */
        DEVMETHOD(card_set_res_flags,   pccard_set_res_flags),
        DEVMETHOD(card_set_memory_offset, pccard_set_memory_offset),
-       DEVMETHOD(card_get_type,        pccard_card_gettype),
        DEVMETHOD(card_attach_card,     pccard_attach_card),
        DEVMETHOD(card_detach_card,     pccard_detach_card),
        DEVMETHOD(card_compat_do_probe, pccard_compat_do_probe),
        DEVMETHOD(card_compat_do_attach, pccard_compat_do_attach),
        DEVMETHOD(card_do_product_lookup, pccard_do_product_lookup),
+       DEVMETHOD(card_cis_scan,        pccard_scan_cis),
 
        { 0, 0 }
 };
@@ -1329,6 +1361,4 @@ devclass_t        pccard_devclass;
 /* Maybe we need to have a slot device? */
 DRIVER_MODULE(pccard, pcic, pccard_driver, pccard_devclass, 0, 0);
 DRIVER_MODULE(pccard, cbb, pccard_driver, pccard_devclass, 0, 0);
-DRIVER_MODULE(pccard, tcic, pccard_driver, pccard_devclass, 0, 0);
 MODULE_VERSION(pccard, 1);
-/*MODULE_DEPEND(pccard, pcic, 1, 1, 1);*/
diff --git a/sys/bus/pccard/pccard_beep.c b/sys/bus/pccard/pccard_beep.c
deleted file mode 100644 (file)
index ab4a9e4..0000000
+++ /dev/null
@@ -1,140 +0,0 @@
-/*-
- * pccard noise interface.
- * Nate Williams, October 1997.
- * This file is in the public domain.
- */
-/* $FreeBSD: src/sys/pccard/pccard_beep.c,v 1.3.2.3 2001/06/05 19:11:34 imp Exp $ */
-/* $DragonFly: src/sys/bus/pccard/Attic/pccard_beep.c,v 1.4 2004/09/18 21:05:07 joerg Exp $ */
-
-#include <sys/param.h>
-#include <sys/kernel.h>
-#include <sys/systm.h>
-
-#include <machine/clock.h>
-
-#include "driver.h"
-
-static enum beepstate allow_beep = BEEP_OFF;
-static struct callout beep_timer;
-static int melody_type = 0;
-
-SYSINIT(pccard_beep, SI_SUB_DRIVERS, SI_ORDER_FIRST, callout_init, &beep_timer);
-
-#define MAX_TONE_MODE  3
-#define MAX_STATE      4 
-
-struct tone {
-        int pitch;
-        int duration;
-};
-
-static struct tone silent_beep[] = {
-       {0, 0}
-};
-
-static struct tone success_beep[] = {
-       {1200,   40}, {0, 0}
-};
-static struct tone failure_beep[] = {
-       {3200,   40}, {0, 0}
-};
-static struct tone insert_remove_beep[] = {
-       {1600,   20}, {0, 0}
-};
-
-static struct tone success_melody_beep[] = {
-       {1200,    7}, {1000,    7}, { 800,   15}, {0, 0}
-};
-static struct tone failure_melody_beep[] = {
-       {2000,    7}, {2400,    7}, {2800,   15}, {0, 0}
-};
-static struct tone insert_melody_beep[] = {
-       {1600,   10}, {1200,    5}, {0, 0}
-};
-static struct tone remove_melody_beep[] = {
-       {1200,   10}, {1600,    5}, {0, 0}
-};
-
-static struct tone *melody_table[MAX_TONE_MODE][MAX_STATE] = {
-       { /* silent mode */
-               silent_beep, silent_beep, silent_beep, silent_beep,
-       },
-       { /* simple beep mode */
-               success_beep, failure_beep,
-               insert_remove_beep, insert_remove_beep,
-       },
-       { /* melody beep mode */
-               success_melody_beep, failure_melody_beep,
-               insert_melody_beep, remove_melody_beep,
-       },
-};
-
-
-static void
-pccard_beep_sub(void *arg)
-{
-       struct tone *melody;
-       melody = (struct tone *)arg;
-
-       if (melody->pitch != 0) {
-               sysbeep(melody->pitch, melody->duration);
-               callout_reset(&beep_timer, melody->duration,
-                             pccard_beep_sub, melody + 1);
-       } else 
-               allow_beep = BEEP_ON;
-}
-
-static void
-pccard_beep_start(void *arg)
-{
-       struct tone *melody;
-       melody = (struct tone *)arg;
-
-       if (allow_beep == BEEP_ON && melody->pitch != 0) {
-               allow_beep = BEEP_OFF;
-               sysbeep(melody->pitch, melody->duration);
-               callout_reset(&beep_timer, melody->duration,
-                             pccard_beep_sub, melody + 1);
-       }
-}
-
-void
-pccard_success_beep(void)
-{
-       pccard_beep_start(melody_table[melody_type][0]);
-}
-
-void
-pccard_failure_beep(void)
-{
-       pccard_beep_start(melody_table[melody_type][1]);
-}
-
-void
-pccard_insert_beep(void)
-{
-       pccard_beep_start(melody_table[melody_type][2]);
-}
-
-void
-pccard_remove_beep(void)
-{
-       pccard_beep_start(melody_table[melody_type][3]);
-}
-
-int
-pccard_beep_select(int type)
-{
-       int errcode = 0;
-
-       if (type == 0)  {
-               allow_beep = BEEP_OFF;
-               melody_type = 0;
-       } else if (type < 0 || MAX_TONE_MODE - 1 < type) {
-               errcode = 1;
-       } else {
-               allow_beep = BEEP_ON;
-               melody_type = type;
-       }
-       return (errcode);
-}
index 2fdb283..12046fd 100644 (file)
@@ -1,8 +1,8 @@
 /* $NetBSD: pcmcia_cis.c,v 1.17 2000/02/10 09:01:52 chopps Exp $ */
-/* $FreeBSD: src/sys/dev/pccard/pccard_cis.c,v 1.23 2002/11/14 14:02:32 mux Exp $ */
-/* $DragonFly: src/sys/bus/pccard/pccard_cis.c,v 1.7 2006/12/22 23:12:16 swildner Exp $ */
+/* $FreeBSD: src/sys/dev/pccard/pccard_cis.c,v 1.36 2005/07/17 20:16:22 imp Exp $ */
+/* $DragonFly: src/sys/bus/pccard/pccard_cis.c,v 1.8 2007/07/05 12:08:53 sephe Exp $ */
 
-/*
+/*-
  * Copyright (c) 1997 Marc Horowitz.  All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -44,6 +44,7 @@
 
 #include <bus/pccard/pccardreg.h>
 #include <bus/pccard/pccardvar.h>
+#include <bus/pccard/pccard_cis.h>
 
 #include "card_if.h"
 
@@ -51,8 +52,8 @@ extern int    pccard_cis_debug;
 
 #define PCCARDCISDEBUG
 #ifdef PCCARDCISDEBUG
-#define        DPRINTF(arg) if (pccard_cis_debug) kprintf arg
-#define        DEVPRINTF(arg) if (pccard_cis_debug) device_printf arg
+#define        DPRINTF(arg) do { if (pccard_cis_debug) kprintf arg; } while (0)
+#define        DEVPRINTF(arg) do { if (pccard_cis_debug) device_printf arg; } while (0)
 #else
 #define        DPRINTF(arg)
 #define        DEVPRINTF(arg)
@@ -69,8 +70,8 @@ struct cis_state {
        struct pccard_function *pf;
 };
 
-int    pccard_parse_cis_tuple(struct pccard_tuple *, void *);
-static int decode_funce(struct pccard_tuple *, struct pccard_function *);
+static int pccard_parse_cis_tuple(const struct pccard_tuple *, void *);
+static int decode_funce(const struct pccard_tuple *, struct pccard_function *);
 
 void
 pccard_read_cis(struct pccard_softc *sc)
@@ -78,9 +79,7 @@ pccard_read_cis(struct pccard_softc *sc)
        struct cis_state state;
 
        bzero(&state, sizeof state);
-
        state.card = &sc->card;
-
        state.card->error = 0;
        state.card->cis1_major = -1;
        state.card->cis1_minor = -1;
@@ -91,29 +90,26 @@ pccard_read_cis(struct pccard_softc *sc)
        state.card->manufacturer = PCMCIA_VENDOR_INVALID;
        state.card->product = PCMCIA_PRODUCT_INVALID;
        STAILQ_INIT(&state.card->pf_head);
-
        state.pf = NULL;
 
-       if (pccard_scan_cis(sc->dev, pccard_parse_cis_tuple,
-           &state) == -1)
+       if (pccard_scan_cis(sc->dev, pccard_parse_cis_tuple, &state) == -1)
                state.card->error++;
 }
 
-#define EARLY_TERM     "pccard_scan_cis: early termination, " \
-                       "array exceeds allocation\n"
-
 int
-pccard_scan_cis(device_t dev, int (*fct)(struct pccard_tuple *, void *),
-       void *arg)
+pccard_scan_cis(device_t dev, pccard_scan_t fct, void *arg)
 {
        struct resource *res;
        int rid;
        struct pccard_tuple tuple;
        int longlink_present;
        int longlink_common;
-       u_long longlink_addr;
+       u_long longlink_addr;           /* Type suspect */
        int mfc_count;
        int mfc_index;
+#ifdef PCCARDCISDEBUG
+       int cis_none_cnt = 10;  /* Only report 10 CIS_NONEs */
+#endif
        struct {
                int     common;
                u_long  addr;
@@ -124,9 +120,15 @@ pccard_scan_cis(device_t dev, int (*fct)(struct pccard_tuple *, void *),
 
        /* allocate some memory */
 
+       /*
+        * Some reports from the field suggest that a 64k memory boundary
+        * helps card CIS being able to be read.  Try it here and see what
+        * the results actually are.  I'm not sure I understand why this
+        * would make cards work better, but it is easy enough to test.
+        */
        rid = 0;
-       res = bus_alloc_resource(dev, SYS_RES_MEMORY, &rid, 0, ~0, 
-           PCCARD_CIS_SIZE, RF_ACTIVE);
+       res = bus_alloc_resource(dev, SYS_RES_MEMORY, &rid, 0, ~0,
+           PCCARD_CIS_SIZE, RF_ACTIVE | rman_make_alignment_flags(64*1024));
        if (res == NULL) {
                device_printf(dev, "can't alloc memory to read attributes\n");
                return -1;
@@ -137,7 +139,8 @@ pccard_scan_cis(device_t dev, int (*fct)(struct pccard_tuple *, void *),
        tuple.memh = rman_get_bushandle(res);
        tuple.ptr = 0;
 
-       DPRINTF(("cis mem map %x\n", (unsigned int) tuple.memh));
+       DPRINTF(("cis mem map 0x%x (resource: 0x%lx)\n",
+           (unsigned int) tuple.memh, rman_get_start(res)));
 
        tuple.mult = 2;
 
@@ -152,26 +155,38 @@ pccard_scan_cis(device_t dev, int (*fct)(struct pccard_tuple *, void *),
 
        while (1) {
                while (1) {
-                       /* get the tuple code */
-
-                       if (tuple.ptr * tuple.mult >= PCCARD_CIS_SIZE) {
-                               device_printf(dev, EARLY_TERM);
-                               break;
+                       /*
+                        * Perform boundary check for insane cards.
+                        * If CIS is too long, simulate CIS end.
+                        * (This check may not be sufficient for
+                        * malicious cards.)
+                        */
+                       if (tuple.mult * tuple.ptr >= PCCARD_CIS_SIZE - 1
+                           - 32 /* ad hoc value */ ) {
+                               kprintf("CIS is too long -- truncating\n");
+                               tuple.code = CISTPL_END;
+                       } else {
+                               /* get the tuple code */
+                               tuple.code = pccard_cis_read_1(&tuple, tuple.ptr);
                        }
 
-                       tuple.code = pccard_cis_read_1(&tuple, tuple.ptr);
-
                        /* two special-case tuples */
 
-                       if (tuple.code == PCCARD_CISTPL_NULL) {
-                               DPRINTF(("CISTPL_NONE\n 00\n"));
+                       if (tuple.code == CISTPL_NULL) {
+#ifdef PCCARDCISDEBUG
+                               if (cis_none_cnt > 0)
+                                       DPRINTF(("CISTPL_NONE\n 00\n"));
+                               else if (cis_none_cnt == 0)
+                                       DPRINTF(("TOO MANY CIS_NONE\n"));
+                               cis_none_cnt--;
+#endif
                                tuple.ptr++;
                                continue;
-                       } else if (tuple.code == PCCARD_CISTPL_END) {
+                       } else if (tuple.code == CISTPL_END) {
                                DPRINTF(("CISTPL_END\n ff\n"));
                                /* Call the function for the END tuple, since
                                   the CIS semantics depend on it */
-                               if ((*fct) (&tuple, arg)) {
+                               if ((*fct)(&tuple, arg)) {
                                        ret = 1;
                                        goto done;
                                }
@@ -180,24 +195,10 @@ pccard_scan_cis(device_t dev, int (*fct)(struct pccard_tuple *, void *),
                        }
                        /* now all the normal tuples */
 
-                       if ((tuple.ptr + 1) * tuple.mult >= PCCARD_CIS_SIZE) {
-                               device_printf(dev, EARLY_TERM);
-                               break;
-                       }
                        tuple.length = pccard_cis_read_1(&tuple, tuple.ptr + 1);
-
-                       /*
-                        * sloppy check
-                        */
-                       if ((tuple.ptr + 1 + tuple.length) * tuple.mult >= 
-                           PCCARD_CIS_SIZE) {
-                               device_printf(dev, EARLY_TERM);
-                               break;
-                       }
-
                        switch (tuple.code) {
-                       case PCCARD_CISTPL_LONGLINK_A:
-                       case PCCARD_CISTPL_LONGLINK_C:
+                       case CISTPL_LONGLINK_A:
+                       case CISTPL_LONGLINK_C:
                                if (tuple.length < 4) {
                                        DPRINTF(("CISTPL_LONGLINK_%s too "
                                            "short %d\n",
@@ -207,17 +208,17 @@ pccard_scan_cis(device_t dev, int (*fct)(struct pccard_tuple *, void *),
                                }
                                longlink_present = 1;
                                longlink_common = (tuple.code ==
-                                   PCCARD_CISTPL_LONGLINK_C) ? 1 : 0;
+                                   CISTPL_LONGLINK_C) ? 1 : 0;
                                longlink_addr = pccard_tuple_read_4(&tuple, 0);
                                DPRINTF(("CISTPL_LONGLINK_%s %lx\n",
                                    longlink_common ? "C" : "A",
                                    longlink_addr));
                                break;
-                       case PCCARD_CISTPL_NO_LINK:
+                       case CISTPL_NO_LINK:
                                longlink_present = 0;
                                DPRINTF(("CISTPL_NO_LINK\n"));
                                break;
-                       case PCCARD_CISTPL_CHECKSUM:
+                       case CISTPL_CHECKSUM:
                                if (tuple.length < 5) {
                                        DPRINTF(("CISTPL_CHECKSUM too "
                                            "short %d\n", tuple.length));
@@ -244,19 +245,18 @@ pccard_scan_cis(device_t dev, int (*fct)(struct pccard_tuple *, void *),
                                         * distant regions
                                         */
                                        if ((addr >= PCCARD_CIS_SIZE) ||
-                                           ((addr + length * tuple.mult) >
+                                           ((addr + length) >=
                                            PCCARD_CIS_SIZE)) {
                                                DPRINTF((" skipped, "
                                                    "too distant\n"));
                                                break;
                                        }
                                        sum = 0;
-                                       for (i = 0; i < length; i++) {
+                                       for (i = 0; i < length; i++)
                                                sum +=
                                                    bus_space_read_1(tuple.memt,
                                                    tuple.memh,
                                                    addr + tuple.mult * i);
-                                       }
                                        if (cksum != (sum & 0xff)) {
                                                DPRINTF((" failed sum=%x\n",
                                                    sum));
@@ -274,7 +274,7 @@ pccard_scan_cis(device_t dev, int (*fct)(struct pccard_tuple *, void *),
                                        }
                                }
                                break;
-                       case PCCARD_CISTPL_LONGLINK_MFC:
+                       case CISTPL_LONGLINK_MFC:
                                if (tuple.length < 1) {
                                        DPRINTF(("CISTPL_LONGLINK_MFC too "
                                            "short %d\n", tuple.length));
@@ -346,7 +346,7 @@ pccard_scan_cis(device_t dev, int (*fct)(struct pccard_tuple *, void *),
                                 */
                        default:
                                {
-                                       if ((*fct) (&tuple, arg)) {
+                                       if ((*fct)(&tuple, arg)) {
                                                ret = 1;
                                                goto done;
                                        }
@@ -383,7 +383,6 @@ pccard_scan_cis(device_t dev, int (*fct)(struct pccard_tuple *, void *),
                 * In general, this means that if one pointer fails, it will
                 * try the next one, instead of just bailing.
                 */
-
                while (1) {
                        if (longlink_present) {
                                CARD_SET_RES_FLAGS(device_get_parent(dev), dev,
@@ -412,7 +411,7 @@ pccard_scan_cis(device_t dev, int (*fct)(struct pccard_tuple *, void *),
 
                        /* make sure that the link is valid */
                        tuple.code = pccard_cis_read_1(&tuple, tuple.ptr);
-                       if (tuple.code != PCCARD_CISTPL_LINKTARGET) {
+                       if (tuple.code != CISTPL_LINKTARGET) {
                                DPRINTF(("CISTPL_LINKTARGET expected, "
                                    "code %02x observed\n", tuple.code));
                                continue;
@@ -610,8 +609,8 @@ pccard_print_cis(device_t dev)
                    card->error);
 }
 
-int
-pccard_parse_cis_tuple(struct pccard_tuple *tuple, void *arg)
+static int
+pccard_parse_cis_tuple(const struct pccard_tuple *tuple, void *arg)
 {
        /* most of these are educated guesses */
        static struct pccard_config_entry init_cfe = {
@@ -622,7 +621,7 @@ pccard_parse_cis_tuple(struct pccard_tuple *tuple, void *arg)
        struct cis_state *state = arg;
 
        switch (tuple->code) {
-       case PCCARD_CISTPL_END:
+       case CISTPL_END:
                /* if we've seen a LONGLINK_MFC, and this is the first
                 * END after it, reset the function list.  
                 *
@@ -649,7 +648,7 @@ pccard_parse_cis_tuple(struct pccard_tuple *tuple, void *arg)
                        state->pf = NULL;
                }
                break;
-       case PCCARD_CISTPL_LONGLINK_MFC:
+       case CISTPL_LONGLINK_MFC:
                /*
                 * this tuple's structure was dealt with in scan_cis.  here,
                 * record the fact that the MFC tuple was seen, so that
@@ -659,8 +658,8 @@ pccard_parse_cis_tuple(struct pccard_tuple *tuple, void *arg)
                state->gotmfc = 1;
                break;
 #ifdef PCCARDCISDEBUG
-       case PCCARD_CISTPL_DEVICE:
-       case PCCARD_CISTPL_DEVICE_A:
+       case CISTPL_DEVICE:
+       case CISTPL_DEVICE_A:
                {
                        u_int reg, dtype, dspeed;
 
@@ -669,7 +668,7 @@ pccard_parse_cis_tuple(struct pccard_tuple *tuple, void *arg)
                        dspeed = reg & PCCARD_DSPEED_MASK;
 
                        DPRINTF(("CISTPL_DEVICE%s type=",
-                       (tuple->code == PCCARD_CISTPL_DEVICE) ? "" : "_A"));
+                       (tuple->code == CISTPL_DEVICE) ? "" : "_A"));
                        switch (dtype) {
                        case PCCARD_DTYPE_NULL:
                                DPRINTF(("null"));
@@ -733,7 +732,7 @@ pccard_parse_cis_tuple(struct pccard_tuple *tuple, void *arg)
                DPRINTF(("\n"));
                break;
 #endif
-       case PCCARD_CISTPL_VERS_1:
+       case CISTPL_VERS_1:
                if (tuple->length < 6) {
                        DPRINTF(("CISTPL_VERS_1 too short %d\n",
                            tuple->length));
@@ -760,7 +759,7 @@ pccard_parse_cis_tuple(struct pccard_tuple *tuple, void *arg)
                        DPRINTF(("CISTPL_VERS_1\n"));
                }
                break;
-       case PCCARD_CISTPL_MANFID:
+       case CISTPL_MANFID:
                if (tuple->length < 4) {
                        DPRINTF(("CISTPL_MANFID too short %d\n",
                            tuple->length));
@@ -777,12 +776,11 @@ pccard_parse_cis_tuple(struct pccard_tuple *tuple, void *arg)
                 * also handle the '6' case.  So far no cards have surfaced
                 * with a length of '6'.
                 */
-               if (tuple->length == 5 ) {
+               if (tuple->length == 5 )
                        state->card->prodext = pccard_tuple_read_1(tuple, 4);
-               }
                DPRINTF(("CISTPL_MANFID\n"));
                break;
-       case PCCARD_CISTPL_FUNCID:
+       case CISTPL_FUNCID:
                if (tuple->length < 1) {
                        DPRINTF(("CISTPL_FUNCID too short %d\n",
                            tuple->length));
@@ -790,7 +788,7 @@ pccard_parse_cis_tuple(struct pccard_tuple *tuple, void *arg)
                }
                if ((state->pf == NULL) || (state->gotmfc == 2)) {
                        state->pf = kmalloc(sizeof(*state->pf), M_DEVBUF,
-                                           M_INTWAIT | M_ZERO);
+                           M_NOWAIT | M_ZERO);
                        state->pf->number = state->count++;
                        state->pf->last_config_index = -1;
                        STAILQ_INIT(&state->pf->cfe_head);
@@ -802,18 +800,17 @@ pccard_parse_cis_tuple(struct pccard_tuple *tuple, void *arg)
 
                DPRINTF(("CISTPL_FUNCID\n"));
                break;
-        case PCCARD_CISTPL_FUNCE:
+        case CISTPL_FUNCE:
                 if (state->pf == NULL || state->pf->function <= 0) {
                         DPRINTF(("CISTPL_FUNCE is not followed by "
                                 "valid CISTPL_FUNCID\n"));
                         break;
                 }
-                if (tuple->length >= 2) {
+                if (tuple->length >= 2)
                         decode_funce(tuple, state->pf);
-                }
                 DPRINTF(("CISTPL_FUNCE\n"));
                 break;
-       case PCCARD_CISTPL_CONFIG:
+       case CISTPL_CONFIG:
                if (tuple->length < 3) {
                        DPRINTF(("CISTPL_CONFIG too short %d\n",
                            tuple->length));
@@ -838,7 +835,7 @@ pccard_parse_cis_tuple(struct pccard_tuple *tuple, void *arg)
                        }
                        if (state->pf == NULL) {
                                state->pf = kmalloc(sizeof(*state->pf),
-                                               M_DEVBUF, M_INTWAIT | M_ZERO);
+                                   M_DEVBUF, M_NOWAIT | M_ZERO);
                                state->pf->number = state->count++;
                                state->pf->last_config_index = -1;
                                STAILQ_INIT(&state->pf->cfe_head);
@@ -871,7 +868,7 @@ pccard_parse_cis_tuple(struct pccard_tuple *tuple, void *arg)
                }
                DPRINTF(("CISTPL_CONFIG\n"));
                break;
-       case PCCARD_CISTPL_CFTABLE_ENTRY:
+       case CISTPL_CFTABLE_ENTRY:
                {
                        int idx, i, j;
                        u_int reg, reg2;
@@ -908,8 +905,12 @@ pccard_parse_cis_tuple(struct pccard_tuple *tuple, void *arg)
                         * with the current default
                         */
                        if (num != state->default_cfe->number) {
-                               cfe = kmalloc(sizeof(*cfe), M_DEVBUF, M_INTWAIT);
-
+                               cfe = (struct pccard_config_entry *)
+                                   kmalloc(sizeof(*cfe), M_DEVBUF, M_NOWAIT);
+                               if (cfe == NULL) {
+                                       DPRINTF(("no memory for config entry\n"));
+                                       goto abort_cfe;
+                               }
                                *cfe = *state->default_cfe;
 
                                STAILQ_INSERT_TAIL(&state->pf->cfe_head,
@@ -1135,9 +1136,7 @@ pccard_parse_cis_tuple(struct pccard_tuple *tuple, void *arg)
                                        goto abort_cfe;
                                }
 
-                               if (memspace == PCCARD_TPCE_FS_MEMSPACE_NONE) {
-                                       cfe->num_memspace = 0;
-                               } else if (memspace == PCCARD_TPCE_FS_MEMSPACE_LENGTH) {
+                               if (memspace == PCCARD_TPCE_FS_MEMSPACE_LENGTH) {
                                        cfe->num_memspace = 1;
                                        cfe->memspace[0].length = 256 *
                                            pccard_tuple_read_2(tuple, idx);
@@ -1220,7 +1219,8 @@ pccard_parse_cis_tuple(struct pccard_tuple *tuple, void *arg)
                                                }
                                        }
                                }
-                       }
+                       } else
+                               cfe->num_memspace = 0;
                        if (misc) {
                                if (tuple->length <= idx) {
                                        DPRINTF(("ran out of space before TCPE_MI\n"));
@@ -1260,8 +1260,10 @@ pccard_parse_cis_tuple(struct pccard_tuple *tuple, void *arg)
 }
 
 static int
-decode_funce(struct pccard_tuple *tuple, struct pccard_function *pf)
+decode_funce(const struct pccard_tuple *tuple, struct pccard_function *pf)
 {
+       int i;
+       int len;
        int type = pccard_tuple_read_1(tuple, 0);
 
        switch (pf->function) {
@@ -1273,8 +1275,7 @@ decode_funce(struct pccard_tuple *tuple, struct pccard_function *pf)
                break;
        case PCCARD_FUNCTION_NETWORK:
                if (type == PCCARD_TPLFE_TYPE_LAN_NID) {
-                       int i;
-                       int len = pccard_tuple_read_1(tuple, 1);
+                       len = pccard_tuple_read_1(tuple, 1);
                        if (tuple->length < 2 + len || len > 8) {
                                /* tuple length not enough or nid too long */
                                break;
similarity index 57%
copy from sys/bus/pccard/pccardreg.h
copy to sys/bus/pccard/pccard_cis.h
index f50352e..c58a542 100644 (file)
@@ -1,8 +1,7 @@
-/*     $NetBSD: pcmciareg.h,v 1.7 1998/10/29 09:45:52 enami Exp $      */
-/* $FreeBSD: src/sys/dev/pccard/pccardreg.h,v 1.1 1999/10/26 06:52:31 imp Exp $ */
-/* $DragonFly: src/sys/bus/pccard/pccardreg.h,v 1.3 2004/02/10 07:55:45 joerg Exp $ */
+/* $FreeBSD: src/sys/dev/pccard/pccard_cis.h,v 1.4 2005/07/13 14:59:06 imp Exp $ */
+/* $DragonFly: src/sys/bus/pccard/pccard_cis.h,v 1.1 2007/07/05 12:08:53 sephe Exp $ */
 
-/*
+/*-
  * Copyright (c) 1997 Marc Horowitz.  All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-/* most of this is from the PCCARD PC Card Standard, Release 2.1 */
-
-/* Note: the weird indenting here is to make the constants more
-   readable.  Please don't normalize it.  --marc */
-
 /*
  * CIS Tuples */
 
 /* Layer 1 Basic Compatibility Tuples */
-#define        PCCARD_CISTPL_NULL                      0x00
-#define        PCCARD_CISTPL_DEVICE                    0x01
-#define        PCCARD_DTYPE_MASK                               0xF0
-#define        PCCARD_DTYPE_NULL                                       0x00
-#define        PCCARD_DTYPE_ROM                                        0x10
-#define        PCCARD_DTYPE_OTPROM                                     0x20
-#define        PCCARD_DTYPE_EPROM                                      0x30
-#define        PCCARD_DTYPE_EEPROM                                     0x40
-#define        PCCARD_DTYPE_FLASH                                      0x50
-#define        PCCARD_DTYPE_SRAM                                       0x60
-#define        PCCARD_DTYPE_DRAM                                       0x70
-#define        PCCARD_DTYPE_FUNCSPEC                                   0xD0
-#define        PCCARD_DTYPE_EXTEND                                     0xE0
-#define        PCCARD_DSPEED_MASK                              0x07
-#define        PCCARD_DSPEED_NULL                                      0x00
-#define        PCCARD_DSPEED_250NS                                     0x01
-#define        PCCARD_DSPEED_200NS                                     0x02
-#define        PCCARD_DSPEED_150NS                                     0x03
-#define        PCCARD_DSPEED_100NS                                     0x04
-#define        PCCARD_DSPEED_EXT                                       0x07
+#define        CISTPL_NULL                     0x00
+#define        CISTPL_DEVICE                   0x01
+#define        PCCARD_DTYPE_MASK                       0xF0
+#define        PCCARD_DTYPE_NULL                               0x00
+#define        PCCARD_DTYPE_ROM                                0x10
+#define        PCCARD_DTYPE_OTPROM                             0x20
+#define        PCCARD_DTYPE_EPROM                              0x30
+#define        PCCARD_DTYPE_EEPROM                             0x40
+#define        PCCARD_DTYPE_FLASH                              0x50
+#define        PCCARD_DTYPE_SRAM                               0x60
+#define        PCCARD_DTYPE_DRAM                               0x70
+#define        PCCARD_DTYPE_FUNCSPEC                           0xD0
+#define        PCCARD_DTYPE_EXTEND                             0xE0
+#define        PCCARD_DSPEED_MASK                      0x07
+#define        PCCARD_DSPEED_NULL                              0x00
+#define        PCCARD_DSPEED_250NS                             0x01
+#define        PCCARD_DSPEED_200NS                             0x02
+#define        PCCARD_DSPEED_150NS                             0x03
+#define        PCCARD_DSPEED_100NS                             0x04
+#define        PCCARD_DSPEED_EXT                               0x07
 
 /*
  * the 2.1 docs have 0x02-0x07 as reserved, but the linux drivers list the
  * are for real
  */
 
-#define        PCCARD_CISTPL_LONGLINK_CB               0x02
-#define        PCCARD_CISTPL_INDIRECT          0x03
-#define        PCCARD_CISTPL_CONFIG_CB                 0x04
-#define        PCCARD_CISTPL_CFTABLE_ENTRY_CB          0x05
-#define        PCCARD_CISTPL_LONGLINK_MFC              0x06
+#define        CISTPL_LONGLINK_CB              0x02
+#define        CISTPL_INDIRECT                 0x03
+#define        CISTPL_CONFIG_CB                0x04
+#define        CISTPL_CFTABLE_ENTRY_CB         0x05
+#define        CISTPL_LONGLINK_MFC             0x06
 #define        PCCARD_MFC_MEM_ATTR                             0x00
 #define        PCCARD_MFC_MEM_COMMON                           0x01
-#define        PCCARD_CISTPL_BAR                       0x07
-#define        PCCARD_CISTPL_PWR_MGMNT                 0x08
-
-#define        PCCARD_CISTPL_CHECKSUM                  0x10
-#define        PCCARD_CISTPL_LONGLINK_A                0x11
-#define        PCCARD_CISTPL_LONGLINK_C                0x12
-#define        PCCARD_CISTPL_LINKTARGET                0x13
-#define        PCCARD_CISTPL_NO_LINK                   0x14
-#define        PCCARD_CISTPL_VERS_1                    0x15
-#define        PCCARD_CISTPL_ALTSTR                    0x16
-#define        PCCARD_CISTPL_DEVICE_A                  0x17
-#define        PCCARD_CISTPL_JEDEC_C                   0x18
-#define        PCCARD_CISTPL_JEDEC_A                   0x19
-#define        PCCARD_CISTPL_CONFIG                    0x1A
+#define        CISTPL_BAR                      0x07
+#define        CISTPL_PWR_MGMNT                0x08
+#define CISTPL_EXTDEVICE               0x09
+
+#define        CISTPL_CHECKSUM                 0x10
+#define        CISTPL_LONGLINK_A               0x11
+#define        CISTPL_LONGLINK_C               0x12
+#define        CISTPL_LINKTARGET               0x13
+#define        CISTPL_NO_LINK                  0x14
+#define        CISTPL_VERS_1                   0x15
+#define        CISTPL_ALTSTR                   0x16
+#define        CISTPL_DEVICE_A                 0x17
+#define        CISTPL_JEDEC_C                  0x18
+#define        CISTPL_JEDEC_A                  0x19
+#define        CISTPL_CONFIG                   0x1A
 #define        PCCARD_TPCC_RASZ_MASK                           0x03
 #define        PCCARD_TPCC_RASZ_SHIFT                          0
 #define        PCCARD_TPCC_RMSZ_MASK                           0x3C
 #define        PCCARD_TPCC_RMSZ_SHIFT                          2
 #define        PCCARD_TPCC_RFSZ_MASK                           0xC0
 #define        PCCARD_TPCC_RFSZ_SHIFT                          6
-#define        PCCARD_CISTPL_CFTABLE_ENTRY             0x1B
+#define        CISTPL_CFTABLE_ENTRY            0x1B
 #define        PCCARD_TPCE_INDX_INTFACE                        0x80
 #define        PCCARD_TPCE_INDX_DEFAULT                        0x40
 #define        PCCARD_TPCE_INDX_NUM_MASK                       0x3F
 #define        PCCARD_TPCE_MI_READONLY                         0x10
 #define        PCCARD_TPCE_MI_AUDIO                            0x08
 #define        PCCARD_TPCE_MI_MAXTWINS                         0x07
-#define        PCCARD_CISTPL_DEVICE_OC                 0x1C
-#define        PCCARD_CISTPL_DEVICE_OA                 0x1D
-#define        PCCARD_CISTPL_DEVICE_GEO                0x1E
-#define        PCCARD_CISTPL_DEVICE_GEO_A              0x1F
-#define        PCCARD_CISTPL_MANFID                    0x20
-#define        PCCARD_CISTPL_FUNCID                    0x21
+#define        CISTPL_DEVICE_OC                        0x1C
+#define        CISTPL_DEVICE_OA                        0x1D
+#define        CISTPL_DEVICE_GEO                       0x1E
+#define        CISTPL_DEVICE_GEO_A                     0x1F
+#define        CISTPL_MANFID                           0x20
+#define        CISTPL_FUNCID                           0x21
 #define        PCCARD_FUNCTION_UNSPEC          -1
 #define        PCCARD_FUNCTION_MULTIFUNCTION   0
 #define        PCCARD_FUNCTION_MEMORY          1
 #define        PCCARD_FUNCTION_SCSI            8
 #define        PCCARD_FUNCTION_SECURITY        9
 #define        PCCARD_FUNCTION_INSTRUMENT      10
-#define        PCCARD_CISTPL_FUNCE                     0x22
+#define CISTPL_FUNCE                           0x22
 #define        PCCARD_TPLFE_TYPE_LAN_TECH                      0x01
 #define        PCCARD_TPLFE_TYPE_LAN_SPEED                     0x02
 #define        PCCARD_TPLFE_TYPE_LAN_MEDIA                     0x03
 #define        PCCARD_TPLFE_TYPE_LAN_CONN                      0x05
 #define        PCCARD_TPLFE_TYPE_DISK_DEVICE_INTERFACE         0x01
 #define        PCCARD_TPLFE_DDI_PCCARD_ATA                             0x01
-#define        PCCARD_CISTPL_END                       0xFF
+#define        CISTPL_END                              0xFF
 
 /* Layer 2 Data Recording Format Tuples */
 
-#define        PCCARD_CISTPL_SWIL                      0x23
-/* #define     PCCARD_CISTPL_RESERVED          0x24-0x3F */
-#define        PCCARD_CISTPL_VERS_2                    0x40
-#define        PCCARD_CISTPL_FORMAT                    0x41
-#define        PCCARD_CISTPL_GEOMETRY                  0x42
-#define        PCCARD_CISTPL_BYTEORDER                 0x43
-#define        PCCARD_CISTPL_DATE                      0x44
-#define        PCCARD_CISTPL_BATTERY                   0x45
-#define        PCCARD_CISTPL_FORAMT_A                  0x47
+#define        CISTPL_SWIL                             0x23
+/* #define     CISTPL_RESERVED         0x24-0x3F */
+#define        CISTPL_VERS_2                           0x40
+#define        CISTPL_FORMAT                           0x41
+#define        CISTPL_GEOMETRY                         0x42
+#define        CISTPL_BYTEORDER                        0x43
+#define        CISTPL_DATE                             0x44
+#define        CISTPL_BATTERY                          0x45
+#define        CISTPL_FORAMT_A                         0x47
 
 /* Layer 3 Data Organization Tuples */
 
-#define        PCCARD_CISTPL_ORG                       0x46
-/* #define     PCCARD_CISTPL_RESERVED          0x47-0x7F */
+#define        CISTPL_ORG                              0x46
+/* #define     CISTPL_RESERVED         0x47-0x7F */
 
 /* Layer 4 System-Specific Standard Tuples */
 
-/* #define     PCCARD_CISTPL_RESERVED          0x80-0x8F */
-#define        PCCARD_CISTPL_SPCL                      0x90
-/* #define     PCCARD_CISTPL_RESERVED          0x90-0xFE */
-
-/*
- * Card Configuration Registers
- */
-
-#define        PCCARD_CCR_OPTION                       0x00
-#define        PCCARD_CCR_OPTION_SRESET                        0x80
-#define        PCCARD_CCR_OPTION_LEVIREQ                       0x40
-#define        PCCARD_CCR_OPTION_CFINDEX                       0x3F
-#define        PCCARD_CCR_OPTION_IREQ_ENABLE                   0x04
-#define        PCCARD_CCR_OPTION_ADDR_DECODE                   0x02
-#define        PCCARD_CCR_OPTION_FUNC_ENABLE                   0x01
-#define        PCCARD_CCR_STATUS                       0x02
-#define        PCCARD_CCR_STATUS_PINCHANGED                    0x80
-#define        PCCARD_CCR_STATUS_SIGCHG                        0x40
-#define        PCCARD_CCR_STATUS_IOIS8                         0x20
-#define        PCCARD_CCR_STATUS_RESERVED1                     0x10
-#define        PCCARD_CCR_STATUS_AUDIO                         0x08
-#define        PCCARD_CCR_STATUS_PWRDWN                        0x04
-#define        PCCARD_CCR_STATUS_INTR                          0x02
-#define        PCCARD_CCR_STATUS_INTRACK                       0x01
-#define        PCCARD_CCR_PIN                          0x04
-#define        PCCARD_CCR_PIN_CBVD1                            0x80
-#define        PCCARD_CCR_PIN_CBVD2                            0x40
-#define        PCCARD_CCR_PIN_CRDYBSY                          0x20
-#define        PCCARD_CCR_PIN_CWPROT                           0x10
-#define        PCCARD_CCR_PIN_RBVD1                            0x08
-#define        PCCARD_CCR_PIN_RBVD2                            0x04
-#define        PCCARD_CCR_PIN_RRDYBSY                          0x02
-#define        PCCARD_CCR_PIN_RWPROT                           0x01
-#define        PCCARD_CCR_SOCKETCOPY                   0x06
-#define        PCCARD_CCR_SOCKETCOPY_RESERVED                  0x80
-#define        PCCARD_CCR_SOCKETCOPY_COPY_MASK                 0x70
-#define        PCCARD_CCR_SOCKETCOPY_COPY_SHIFT                4
-#define        PCCARD_CCR_SOCKETCOPY_SOCKET_MASK               0x0F
-#define PCCARD_CCR_EXTSTATUS                   0x08
-#define        PCCARD_CCR_IOBASE0                      0x0A
-#define        PCCARD_CCR_IOBASE1                      0x0C
-#define        PCCARD_CCR_IOBASE2                      0x0E
-#define        PCCARD_CCR_IOBASE3                      0x10
-#define        PCCARD_CCR_IOSIZE                       0x12
+/* #define     CISTPL_RESERVED         0x80-0x8F */
+#define        CISTPL_SPCL                             0x90
+/* #define     CISTPL_RESERVED         0x90-0xFE */
 
-#define        PCCARD_CCR_SIZE                         0x14
+#define CISTPL_GENERIC         -1
index cd0537a..5b327ce 100644 (file)
@@ -1,10 +1,10 @@
 /*     $NetBSD: pcmcia_cis_quirks.c,v 1.6 2000/04/12 21:07:55 scw Exp $ */
-/* $FreeBSD: src/sys/dev/pccard/pccard_cis_quirks.c,v 1.7 2002/02/09 21:34:06 imp Exp $ */
-/* $DragonFly: src/sys/bus/pccard/pccard_cis_quirks.c,v 1.6 2006/12/22 23:12:16 swildner Exp $ */
+/*     $FreeBSD: src/sys/dev/pccard/pccard_cis_quirks.c,v 1.15 2005/03/26 21:30:49 sam Exp $ */
+/* $DragonFly: src/sys/bus/pccard/pccard_cis_quirks.c,v 1.7 2007/07/05 12:08:53 sephe Exp $ */
 
 #define        PCCARDDEBUG
 
-/*
+/*-
  * Copyright (c) 1998 Marc Horowitz.  All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  */
 
 #include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/malloc.h>
-#include <sys/module.h>
-#include <sys/kernel.h>
-#include <sys/queue.h>
-#include <sys/types.h>
-
 #include <sys/bus.h>
-#include <sys/rman.h>
+#include <sys/malloc.h>
+#include <sys/systm.h>
 
-#include <bus/pccard/pccarddevs.h>
-#include <bus/pccard/pccardreg.h>
+#include <bus/pccard/pccard_cis.h>
 #include <bus/pccard/pccardvar.h>
+#include <bus/pccard/pccarddevs.h>
 
 /* There are cards out there whose CIS flat-out lies.  This file
    contains struct pccard_function chains for those devices. */
@@ -205,6 +199,23 @@ static struct pccard_cis_quirk pccard_cis_quirks[] = {
 static int n_pccard_cis_quirks =
        sizeof(pccard_cis_quirks)/sizeof(pccard_cis_quirks[0]);
 
+static int
+pccard_cis_quirk_match(struct pccard_softc *sc, struct pccard_cis_quirk *q)
+{
+       if ((sc->card.manufacturer == q->manufacturer) &&
+               (sc->card.product == q->product) &&
+               (((sc->card.manufacturer != PCMCIA_VENDOR_INVALID) &&
+                 (sc->card.product != PCMCIA_PRODUCT_INVALID)) ||
+                ((sc->card.manufacturer == PCMCIA_VENDOR_INVALID) &&
+                 (sc->card.product == PCMCIA_PRODUCT_INVALID) &&
+                 sc->card.cis1_info[0] &&
+                 (strcmp(sc->card.cis1_info[0], q->cis1_info[0]) == 0) &&
+                 sc->card.cis1_info[1] &&
+                 (strcmp(sc->card.cis1_info[1], q->cis1_info[1]) == 0))))
+               return (1);
+       return (0);
+}
+
 void
 pccard_check_cis_quirks(device_t dev)
 {
@@ -213,69 +224,70 @@ pccard_check_cis_quirks(device_t dev)
        int i, j;
        struct pccard_function *pf, *pf_next, *pf_last;
        struct pccard_config_entry *cfe, *cfe_next;
+       struct pccard_cis_quirk *q;
 
        pf = NULL;
        pf_last = NULL;
 
        for (i=0; i<n_pccard_cis_quirks; i++) {
-               if ((sc->card.manufacturer == pccard_cis_quirks[i].manufacturer) &&
-                       (sc->card.product == pccard_cis_quirks[i].product) &&
-                       (((sc->card.manufacturer != PCMCIA_VENDOR_INVALID) &&
-                         (sc->card.product != PCMCIA_PRODUCT_INVALID)) ||
-                        ((sc->card.manufacturer == PCMCIA_VENDOR_INVALID) &&
-                         (sc->card.product == PCMCIA_PRODUCT_INVALID) &&
-                         sc->card.cis1_info[0] &&
-                         (strcmp(sc->card.cis1_info[0],
-                                         pccard_cis_quirks[i].cis1_info[0]) == 0) &&
-                         sc->card.cis1_info[1] &&
-                         (strcmp(sc->card.cis1_info[1],
-                                         pccard_cis_quirks[i].cis1_info[1]) == 0)))) {
-                       if (!wiped) {
-                               if (bootverbose) {
-                                       device_printf(dev, "using CIS quirks for ");
-                                       for (j = 0; j < 4; j++) {
-                                               if (sc->card.cis1_info[j] == NULL)
-                                                       break;
-                                               if (j)
-                                                       kprintf(", ");
-                                               kprintf("%s", sc->card.cis1_info[j]);
-                                       }
-                                       kprintf("\n");
+               q = &pccard_cis_quirks[i];
+               if (!pccard_cis_quirk_match(sc, q))
+                       continue;
+               if (!wiped) {
+                       if (bootverbose) {
+                               device_printf(dev, "using CIS quirks for ");
+                               for (j = 0; j < 4; j++) {
+                                       if (sc->card.cis1_info[j] == NULL)
+                                               break;
+                                       if (j)
+                                               kprintf(", ");
+                                       kprintf("%s", sc->card.cis1_info[j]);
                                }
+                               kprintf("\n");
+                       }
 
-                               for (pf = STAILQ_FIRST(&sc->card.pf_head); pf != NULL;
-                                    pf = pf_next) {
-                                       for (cfe = STAILQ_FIRST(&pf->cfe_head); cfe != NULL;
-                                            cfe = cfe_next) {
-                                               cfe_next = STAILQ_NEXT(cfe, cfe_list);
-                                               kfree(cfe, M_DEVBUF);
-                                       }
-                                       pf_next = STAILQ_NEXT(pf, pf_list);
-                                       kfree(pf, M_DEVBUF);
+                       for (pf = STAILQ_FIRST(&sc->card.pf_head); pf != NULL;
+                            pf = pf_next) {
+                               for (cfe = STAILQ_FIRST(&pf->cfe_head); cfe != NULL;
+                                    cfe = cfe_next) {
+                                       cfe_next = STAILQ_NEXT(cfe, cfe_list);
+                                       kfree(cfe, M_DEVBUF);
                                }
-
-                               STAILQ_INIT(&sc->card.pf_head);
-                               wiped = 1;
+                               pf_next = STAILQ_NEXT(pf, pf_list);
+                               kfree(pf, M_DEVBUF);
                        }
 
-                       if (pf_last == pccard_cis_quirks[i].pf) {
-                               cfe = kmalloc(sizeof(*cfe), M_DEVBUF, M_INTWAIT);
-                               *cfe = *pccard_cis_quirks[i].cfe;
-
-                               STAILQ_INSERT_TAIL(&pf->cfe_head, cfe, cfe_list);
-                       } else {
-                               pf = kmalloc(sizeof(*pf), M_DEVBUF, M_INTWAIT);
-                               *pf = *pccard_cis_quirks[i].pf;
-                               STAILQ_INIT(&pf->cfe_head);
-
-                               cfe = kmalloc(sizeof(*cfe), M_DEVBUF, M_INTWAIT);
-                               *cfe = *pccard_cis_quirks[i].cfe;
-
-                               STAILQ_INSERT_TAIL(&pf->cfe_head, cfe, cfe_list);
-                               STAILQ_INSERT_TAIL(&sc->card.pf_head, pf, pf_list);
+                       STAILQ_INIT(&sc->card.pf_head);
+                       wiped = 1;
+               }
 
-                               pf_last = pccard_cis_quirks[i].pf;
+               if (pf_last == q->pf) {
+                       cfe = kmalloc(sizeof(*cfe), M_DEVBUF, M_NOWAIT);
+                       if (cfe == NULL) {
+                               device_printf(dev, "no memory for quirk (1)\n");
+                               continue;
+                       }
+                       *cfe = *q->cfe;
+                       STAILQ_INSERT_TAIL(&pf->cfe_head, cfe, cfe_list);
+               } else {
+                       pf = kmalloc(sizeof(*pf), M_DEVBUF, M_NOWAIT);
+                       if (pf == NULL) {
+                               device_printf(dev,
+                                       "no memory for pccard function\n");
+                               continue;
+                       }
+                       *pf = *q->pf;
+                       STAILQ_INIT(&pf->cfe_head);
+                       cfe = kmalloc(sizeof(*cfe), M_DEVBUF, M_NOWAIT);
+                       if (cfe == NULL) {
+                               kfree(pf, M_DEVBUF);
+                               device_printf(dev, "no memory for quirk (2)\n");
+                               continue;
                        }
+                       *cfe = *q->cfe;
+                       STAILQ_INSERT_TAIL(&pf->cfe_head, cfe, cfe_list);
+                       STAILQ_INSERT_TAIL(&sc->card.pf_head, pf, pf_list);
+                       pf_last = q->pf;
                }
        }
 }
index a7b4d90..8a2d606 100644 (file)
@@ -1,10 +1,10 @@
-$DragonFly: src/sys/bus/pccard/pccarddevs,v 1.3 2004/07/23 11:46:09 joerg Exp $
+$DragonFly: src/sys/bus/pccard/pccarddevs,v 1.4 2007/07/05 12:08:53 sephe Exp $
+/* $FreeBSD: src/sys/dev/pccard/pccarddevs,v 1.112 2005/07/18 21:47:38 imp Exp $ */
 /* $NetBSD: pcmciadevs,v 1.186 2003/09/16 08:26:37 onoe Exp $ */
 /* $OpenBSD: pcmciadevs,v 1.93 2002/06/21 08:31:10 henning Exp $ */
-/* $FreeBSD: src/sys/dev/pccard/pccarddevs,v 1.85 2004/05/13 01:24:26 imp Exp $ */
 
 /*-
- * Copyright (c) 1998 The NetBSD Foundation, Inc.
+ * Copyright (c) 1998-2004 The NetBSD Foundation, Inc.
  * All rights reserved.
  *
  * This code is derived from software contributed to The NetBSD Foundation
@@ -39,18 +39,52 @@ $DragonFly: src/sys/bus/pccard/pccarddevs,v 1.3 2004/07/23 11:46:09 joerg Exp $
  * POSSIBILITY OF SUCH DAMAGE.
  */
 
+/*-
+ * Copyright (c) 1999-2004 The FreeBSD Project.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ */
+
+/*
+ * Tuple registration list can be found at:
+ *     http://www.pcmcia.org/tupleidlist.htm
+ */
+
 /*
  * List of known PCMCIA vendors, sorted by numeric ID.
  */
 
-vendor FUJITSU                 0x0004  Fujitsu Corporation
-vendor INTERSIL                        0x000b  Intersil
+vendor FUJITSU                 0x0004  Fujitsu Corporation
+vendor INTERSIL                        0x000b  Intersil
 vendor PANASONIC               0x0032  Matsushita Electric Industrial Co.
 vendor SANDISK                 0x0045  Sandisk Corporation
 vendor NEWMEDIA                        0x0057  New Media Corporation
 vendor INTEL                   0x0089  Intel
 vendor IBM                     0x00a4  IBM Corporation
-vendor SHARP                   0x00b0  Sharp Corporation
+vendor SHARP                   0x00b0  Sharp Corporation
+vendor TOSHIBA2                        0x0098  Toshiba
+vendor DIGITAL                 0x0100  Digital Equipment Corporation
 vendor 3COM                    0x0101  3Com Corporation
 vendor MEGAHERTZ               0x0102  Megahertz Corporation
 vendor SOCKET                  0x0104  Socket Communications
@@ -65,40 +99,45 @@ vendor OLICOM                       0x0121  Olicom
 vendor PROXIM                  0x0126  Proxim
 vendor DSPSI                   0x0128  DSP Solutions, Inc
 vendor ADAPTEC                 0x012f  Adaptec Corporation
+vendor MAGICRAM                        0x0135  Magic Ram, Inc
 vendor QUATECH                 0x0137  Quatech
 vendor COMPAQ                  0x0138  Compaq
 vendor OSITECH                 0x0140  Ositech
-vendor DLINK_2                 0x0143  D-Link
-vendor DLINK_3                 0x0149  D-Link
+vendor GREY_CELL               0x0143  Grey Cell Systems, Ltd
 vendor LINKSYS                 0x0149  Linksys Corporation
 vendor NETGEAR                 0x0149  Netgear
 vendor SIMPLETECH              0x014d  Simple Technology
 vendor SYMBOL2                 0x014d  Symbol
 vendor LUCENT                  0x0156  Lucent Technologies
+vendor AGERE                   0x0156  Agere Systems
 vendor GEMPLUS                 0x0157  Gemplus
 vendor AIRONET                 0x015f  Aironet Wireless Communications
 vendor ERICSSON                        0x016b  Ericsson
 vendor PSION                   0x016c  Psion
+vendor PMC                     0x0175  Premax Microelectronics Corp
 vendor COMPAQ2                 0x0183  Compaq
 vendor PARALON                 0x0183  Paralon Technologies Inc
 vendor KINGSTON                        0x0186  Kingston
 vendor MELCO                   0x018a  Melco Corporation
 vendor DAYNA                   0x0194  Dayna Corporation
 vendor RAYTHEON                        0x01a6  Raytheon
-vendor IODATA                  0x01bf  I-O DATA
-vendor BAY                     0x01eb  Bay Networks
-vendor FARALLON                        0x0200  Farallon Communications
-vendor TELECOMDEVICE           0x021b  Telecom Device
+vendor RACORE                  0x01bf  Racore Computer Products
+vendor BAY                     0x01eb  Bay Networks
+vendor FARALLON                        0x0200  Farallon Communications
+vendor RELIA                   0x0215  RELIA Technologies Corporation
+vendor TELECOMDEVICE           0x021b  Telecom Device
 vendor NOKIA                   0x023d  Nokia Communications
 vendor SAMSUNG                 0x0250  Samsung
 vendor HWN                     0x0261  Home Wireless Networks
+vendor ANYCOM                  0x0264  Anycom
 vendor ARTEM                   0x0268  ARtem
 vendor SYMBOL                  0x026c  Symbol
 vendor BUFFALO                 0x026f  BUFFALO (Melco Corporation)
-vendor BROMAX                  0x0274  Bromax communications, Inc
+vendor BROMAX                  0x0274  Bromax communications, Inc
 vendor IODATA2                 0x028a  I-O DATA
 vendor ASUS                    0x02aa  ASUS
 vendor SIEMENS                 0x02ac  Siemens
+vendor UNGERMANN               0x02c0  Ungermann Bass
 vendor MICROSOFT               0x02d2  Microsoft Corporation
 
 /*
@@ -111,18 +150,26 @@ vendor BONDWELL                   0x3b01  Bondwell
 vendor LEXARMEDIA              0x4e01  Lexar Media
 vendor COMPEX                  0x8a01  Compex Corporation
 vendor ZONET                   0x8a01  Zonet Technology Inc.
-vendor ELSA                    0xd601  Elsa 
+vendor ADAPTEC2                        0x9005  Adaptec
+vendor ELSA                    0xd601  Elsa 
 
-/*
- * The following vendor IDs are not, as far as I can tell, actually
- * assigned to these people.  However, all the ones starting with '0xc'
- * look coherent enough that maybe somebody other than PCMCIA is
- * assigning numbers in that range.
+/* 
+ * The following vendor IDs are the vendor's PCI ID, not their PCMCIA
+ * IDs.  NEWMEDIA2 should likely be 'Advansys' since that's who owns
+ * the PCI ID.
  */
 vendor NEWMEDIA2               0x10cd  NewMedia
-vendor PLANEX_2                        0x14ea  PLANEX
+vendor PLANEX                  0x14ea  PLANEX
 vendor ACTIONTEC               0x1668  ACTIONTEC
-vendor AIRVAST                  0x50c2  AirVast Technology
+vendor RALINK                  0x1814  Ralink Technology
+
+/*
+ * The following vendor IDs are not, as far as I can tell, actually
+ * assigned to these people by the pcmcia.  However, all the ones starting
+ * with '0xc' look coherent enough that maybe somebody other than PCMCIA is
+ * assigning numbers in that range.  Maybe JEITA?
+ */
+vendor AIRVAST                 0x50c2  AirVast Technology
 vendor ARCHOS                  0x5241  Archos
 vendor DUAL                    0x890f  Dual
 vendor EDIMAX                  0x890f  Edimax Technology Inc.
@@ -132,7 +179,8 @@ vendor ROLAND                       0xc00c  Roland
 vendor COREGA2                 0xc00f  Corega K.K.
 vendor ALLIEDTELESIS           0xc00f  Allied Telesis K.K.
 vendor HAGIWARASYSCOM          0xc012  Hagiwara SYS-COM
-vendor RATOC                   0xc015  RATOC System Inc.
+vendor RATOC                   0xc015  RATOC System Inc.
+vendor NEXTCOM                 0xc020  NextCom K.K.
 vendor WORKBIT                 0xc024  WORKBIT
 vendor EMTAC                   0xc250  EMTAC Technology Corporation
 
@@ -146,7 +194,7 @@ product 3COM 3CRWE737A              0x0001 3Com AirConnect Wireless LAN
 product 3COM 3CXM056BNW                0x002f 3Com/NoteWorthy 3CXM056-BNW 56K Modem
 product 3COM 3CXEM556          0x0035 3Com/Megahertz 3CXEM556 Ethernet/Modem
 product 3COM 3CXEM556INT       0x003d 3Com/Megahertz 3CXEM556-INT Ethernet/Modem
-product 3COM 3CRWB609          0x0400 3Com Bluetooth PC Card 3CRWB60-A
+product 3COM 3CRWB609          0x0040 3Com Bluetooth PC Card 3CRWB60-A
 product 3COM 3CCFEM556BI       0x0556 3Com/Megahertz 3CCFEM556BI Ethernet/Modem
 product 3COM 3C562             0x0562 3Com 3c562 33.6 Modem/10Mbps Ethernet
 product 3COM 3C589             0x0589 3Com 3c589 10Mbps Ethernet
@@ -161,6 +209,7 @@ product     ACTIONTEC PRISM         0x0101 PRISM Wireless LAN PC Card
 /* Adaptec Products */
 product ADAPTEC APA1460                0x0001 Adaptec APA-1460 SlimSCSI
 product ADAPTEC APA1460A       0x0002 Adaptec APA-1460A SlimSCSI
+product ADAPTEC2 ANW8030       0x0021 Adaptec ANW-8030
 
 /* Aironet */
 product AIRONET PC4500         0x0005 Aironet PC4500 Wireless LAN Adapter
@@ -173,6 +222,10 @@ product AIRVAST WN_100          0x7300 AirVast WN-100
 /* Allied Telesis K.K. */
 product ALLIEDTELESIS LA_PCM   0x0002 Allied Telesis LA-PCM
 
+/* Anycom */
+product ANYCOM LSE041          0x0004 AnyCom BlueCard LSE041 R1B
+product ANYCOM LSE039          0x0008 Anycom Bluetooth CF Card LSE039
+
 /* Archos */
 product        ARCHOS ARC_ATAPI        0x0043 MiniCD
 
@@ -195,12 +248,16 @@ product   BONDWELL B236           0x0000 Game Card Joystick
 product BREEZECOM BREEZENET    0x0102 BreezeCOM BreezeNET
 
 /* Bromax Communications, Inc (Linksys OEM) */
+product BROMAX IPORT           0x1103 iPort 10/100 Ethernet
+product BROMAX IPORT2          0x1121 iPort 10Mbps Ethernet
 product BROMAX IWN             0x1612 Instant Wireless Network PC Card
-product BROMAX IWN3            0x1613 Instant Wireless Network PC Card, Versin 3
+product BROMAX IWN3            0x1613 Instant Wireless Network PC Card, V3
 product BROMAX WCF11           0x3301 Instant Wireless Network CF Card
 
 /* BUFFALO */
+product BUFFALO LPC2_CLT       0x0300  BUFFALO LPC2-CLT Ethernet
 product        BUFFALO LPC3_CLX        0x0301  BUFFALO LPC3-CLX Ethernet Adapter
+product BUFFALO LPC4_TX                0x0303  BUFFALO LPC4-TX Fast Ethernet
 product BUFFALO WLI_PCM_S11    0x0305  BUFFALO AirStation 11Mbps WLAN
 product BUFFALO LPC_CF_CLT     0x0307  BUFFALO LPC-CF-CLT
 product        BUFFALO LPC3_CLT        0x030a  BUFFALO LPC3-CLT Ethernet Adapter
@@ -208,11 +265,14 @@ product BUFFALO WLI_CF_S11G       0x030b  BUFFALO AirStation 11Mbps CF WLAN
 
 /* Compaq Products */
 product COMPAQ NC5004          0x0002 Compaq Agency NC5004 Wireless Card
+product COMPAQ CPQ550          0x110a Compaq Microcom CPQ550 Ethernet/Modem
 product COMPAQ2 CPQ_10_100     0x010a Compaq Netelligent 10/100 Ethernet
 
 /* Compex Products */
 product COMPEX AMP_WIRELESS    0x0066 AMP
 product COMPEX LINKPORT_ENET_B 0x0100 Compex Linkport ENET-B Ethernet
+product COMPEX LANMODEM                0xc0ab New Media LANSurfer 10+56 Ethernet/Modem
+product COMPEX AX88190         0xc1ab AX88190 Fast Ethernet
 
 /* Contec C-NET(PC) */
 product CONTEC CNETPC          0x0000 Contec C-NET(PC)C
@@ -225,9 +285,6 @@ product DAYNA COMMUNICARD_E_2       0x002f Dayna CommuniCard E
 /* DIGITAL Products */
 product DIGITAL MOBILE_MEDIA_CDROM 0x0d00 Digital Mobile Media CD-ROM
 
-/* D-Link Products */
-product DLINK_2 DMF560TX       0xc0ab D-Link DMF-650TX
-
 /* DSP Solutions, Inc. (Megahertz OEM) */
 product DSPSI XJEM1144         0x0101 Megahertz X-JACK
 product DSPSI XJACK            0x0103 Megahertz X-JACK Ethernet
@@ -243,6 +300,7 @@ product ELSA MC2_IEEE               0x0001 AirLancer MC-2 IEEE
 product ELSA XI300_IEEE                0x0002 XI300 Wireless LAN
 product ELSA XI800_IEEE                0x0004 XI800 CF Wireless LAN
 product ELSA XI325_IEEE                0x0005 XI325 Wireless LAN
+product ELSA WIFI_FLASH                0x0101 802.11b plus 128MB Flash
 
 /* EMTAC */
 product EMTAC WLAN             0x0002  EMTAC A2424i 11Mbps WLAN Card
@@ -254,6 +312,7 @@ product ERICSSON WIRELESSLAN        0x0001  DSSS Wireless LAN PC Card
 product FARALLON SKYLINE       0x0a01 SkyLINE Wireless
 
 /* Fujutsu Products */
+product FUJITSU NE200T         0x0004 Eagle Tech NE200T
 product FUJITSU SCSI600                0x0401 Fujitsu SCSI 600 Interface
 product FUJITSU LA10S          0x1003 Fujitsu Compact Flash Ethernet
 product FUJITSU LA501          0x2000 Fujitsu Towa LA501 Ethernet
@@ -262,6 +321,10 @@ product FUJITSU WL110              0x2003 PEGA-WL110 Wireless LAN
 /* Gemplus */
 product GEMPLUS GPR400         0x3004 GPR400 Smartcard Reader
 
+/* Grey Cell Systems, Ltd */
+product GREY_CELL TDK3000      0x3341 TDK 3000/3400/5670 Fast Ethernet/Modem
+product GREY_CELL DMF650TX     0xc0ab D-Link DMF-650TX
+
 /* Home Wireless Networks */
 product HWN AIRWAY80211                0x0002 HWN Airway Wireless PCMCIA Card
 
@@ -286,16 +349,17 @@ product INTEL PRO100LAN56 0x110a Intel EtherExpress PRO/100 LAN Modem
 
 /* Intersil */
 /* OEMs sell these things under different marketing names */
-product INTERSIL MA401RA       0x7300 Netgear MA401RA
-product INTERSIL DWL650                0x7110 Dlink DWL650
+product INTERSIL ISL37100P     0x7100 ISL37100P
+product INTERSIL ISL37110P     0x7110 ISL37110P
+product INTERSIL ISL37300P     0x7300 ISL37300P
 
 /* I-O DATA */
-product IODATA PCLATE          0x2216 I-O DATA PCLA/TE
 product IODATA2 WNB11PCM       0x0002 I-O DATA WN-B11/PCM
 product IODATA2 WCF12          0x0673 Wireless CF Card
 
 /* Kingston Products */
 product KINGSTON KNE2          0x0100 Kingston KNE-PC2 Ethernet
+product KINGSTON CIO10T                0x0110 Kingston CIO10T Ethernet
 
 /* Lasat Products */
 product LASAT CREDIT_288       0x2811 Lasat Credit 288 Modem
@@ -311,20 +375,26 @@ product LINKSYS COMBO_ECARD       0xc1ab Linksys Combo EthernetCard
 
 /* Lucent WaveLAN/IEEE */
 product LUCENT WAVELAN_IEEE    0x0002 WaveLAN/IEEE
+product AGERE HERMES_II                0x0003 Agere Systems Hermes-II Wireless
+product AGERE HERMES_II_5      0x0004 Agere Systems Hermes-II.5 Wireless
 
 /* MACNICA */
 product MACNICA ME1_JEIDA      0x3300  MACNICA ME1 for JEIDA
 product MACNICA MPS110         0xa041  MACNICA Miracle SCSI-II mPS110
 
+/* MagicRam, Inc */
+product MAGICRAM ETHER         0x0000  MagicRAM Ethernet PC Card 933926
+
 /* Megahertz Products */
+product MEGAHERTZ VARIOUS      0x0000 Megahertz X-jack Ethernet
 product MEGAHERTZ XJEM3336     0x0006 Megahertz X-JACK Ethernet Modem
 product MEGAHERTZ XJ4288       0x0023 Megahertz XJ4288 Modem
 product MEGAHERTZ XJ4336       0x0027 Megahertz XJ4336 Modem
 product MEGAHERTZ XJ5560       0x0034 Megahertz X-JACK 56kbps Modem
 
 /* Melco Products */
-product MELCO LPC3_TX          0xc1ab Melco LPC3-TX
 product MELCO LPC3_CLX         0x0301 Melco LPC3-CLX Ethernet Adapter
+product MELCO LPC3_TX          0xc1ab Melco LPC3-TX
 
 /* Microsoft Products */
 product MICROSOFT MN_520       0x0001 Microsoft MN-520 WLAN Card
@@ -332,26 +402,34 @@ product MICROSOFT MN_520  0x0001 Microsoft MN-520 WLAN Card
 /* Motorola Products */
 product MOTOROLA POWER144      0x0105 Motorola Power 14.4 Modem
 product MOTOROLA PM100C                0x0302 Motorola Personal Messenger 100C CDPD Modem
+product MOTOROLA MARINER       0x0501 Motorola Mariner Ethernet/Modem
 product MOTOROLA MONTANA_336   0x0505 Motorola Montana 33.6
 
 /* New Media Products */
 product NEWMEDIA BASICS                0x0019 New Media BASICS Ethernet
-product NEWMEDIA LANSURFER     0x0021 NewMedia LANSurfer
-product NEWMEDIA LIVEWIRE      0x1004 NewMedia LiveWire Ethernet LAN Adapter
-product NEWMEDIA MULTIMEDIA    0x100b NewMedia Multimedia
+product NEWMEDIA LANSURFER     0x0021 New Media LANSurfer
+product NEWMEDIA LIVEWIRE      0x1004 New Media LiveWire Ethernet LAN Adapter
+product NEWMEDIA MULTIMEDIA    0x100b New Media Multimedia
 product NEWMEDIA BUSTOASTER2   0xa002 New Media SCSI Bus Toaster
 product NEWMEDIA BUSTOASTER    0xc102 New Media SCSI Bus Toaster
 product NEWMEDIA BUSTOASTER3   0xd302 New Media SCSI Bus Toaster
-product NEWMEDIA WAVJAMMER     0xe005 NewMedia .WAVjammer
-product NEWMEDIA2 BUSTOASTER   0x0001 NewMedia BusToaster
+product NEWMEDIA WAVJAMMER     0xe005 New Media .WAVjammer
+product NEWMEDIA2 BUSTOASTER   0x0001 New Media BusToaster
 
 /* Netgear */
-product NETGEAR FA410TX                0x0230 Netgear FA410TX
 product NETGEAR FA410TXC       0x4530 Netgear FA410TXC
 product NETGEAR FA411          0x0411 Netgear FA411
 
 /* National Instruments */
+product NI PCMCIA_232          0x0d50 National Instruments PCMCIA-232
+product NI PCMCIA_232_2                0x0d51 National Instruments PCMCIA-232/2
+product NI PCMCIA_485          0x0d51 National Instruments PCMCIA-485
+product NI PCMCIA_485_2                0x0d52 National Instruments PCMCIA-485/2
 product NI PCMCIA_GPIB         0x4882 National Instruments PCMCIA-GPIB
+product NI PCMCIA_232_4                0xd180 National Instruments PCMCIA-232/4
+
+/* NextCom K.K. */
+product NEXTCOM NEXTHAWK       0x0001 Next Hawk Ethernet
 
 /* Nokia Products */
 product NOKIA C110_WLAN                0x1110 Nokia C110/C111
@@ -362,24 +440,32 @@ product NWN WLAN_550              0x0002 NWN 550 WLAN
 product NWN WLAN_1148          0x0003 NWN 1148 WLAN
 
 /* Olicom Products */
+product OLICOM OC2220          0x0101 GoCard Ethernet
 product OLICOM TR              0x2132 GoCard Token Ring 16/4
-product OLICOM OC2220          0x2022 GoCard Ethernet
 product OLICOM OC2231          0x3122 GoCard Combo Eth/Modem 288
 product OLICOM OC2232          0x3222 GoCard Combo Eth/Modem 336
 
 /* Ositech Products */
-product OSITECH TRUMPCARD_SOD  0x0008 Ositech Seven of Diamonds Ethernet Card
+product OSITECH JACK_144       0x0001 Ositech Jack of ??? 14.4
+product OSITECH JACK_288       0x0002 Ositech Jack of ??? 28.8
+product OSITECH JACK_336       0x0007 Ositech Jack of ??? 33.6
+product OSITECH TRUMP_SOD      0x0008 Ositech Seven of Diamonds Ethernet Card
+product OSITECH TRUMP_JOH      0x000a Ositech Jack of Hearts
 
 /* Panasonic Products */
 product PANASONIC KXLC002      0x0304 Panasonic 4X CD-ROM Interface Card
 product PANASONIC KXLC003      0x0504 Panasonic 8X CD-ROM Interface Card
 product PANASONIC KXLC004      0x0604 Panasonic KXL-810AN Interface Card
+product PANASONIC KXLC005_2    0x0704 Panasonic 16X CD-ROM Interface Card
+product PANASONIC KME          0x2604 Panasonic CD-R/RW Interface
 product PANASONIC KXLC005      0x2704 Panasonic 16X CD-ROM Interface Card
 product PANASONIC KXLC005_1    0x2904 Panasonic 16X CD-ROM Interface Card
-product PANASONIC KME          0x2604 Panasonic CD-R/RW Interface
 
 /* Planex */
-product PLANEX_2 GWNS11H       0xb001 Planex GW-NS11H
+product PLANEX GWNS11H         0xb001 Planex GW-NS11H
+
+/* Premax Microelectronics Corp. */
+product PMC LANMODEM           0x0000 LAN 33.6 Modem card
 
 /* Proxim */
 product PROXIM HARMONY         0x0002 Proxim HARMONY 80211B
@@ -389,6 +475,9 @@ product PROXIM RANGELANDS_8430      0x8000 Proxim RangeLAN-DS 8430
 
 /* Psion */
 product PSION GOLDCARD         0x0020 Psion Gold Card
+product PSION NETGLOBAL                0x0023 Psion Gold Card NetGlobal 10/100
+product PSION NETGLOBAL2       0x0026 Psion Gold Card NetGlobal 10/100
+product PSION LANGLOBAL                0x0081 Psion LANGLOBAL
 
 /* QLogic */
 product QLOGIC PC05            0x0104 Qlogic Fast SCSI
@@ -396,14 +485,31 @@ product QLOGIC PC05               0x0104 Qlogic Fast SCSI
 /* Quatech */
 product QUATECH SPP_100                0x0003 Quatech Enhanced Parallel Port
 product QUATECH DSP_225                0x0008 Quatech Dual Serial Port
+product QUATECH DUAL           0x000e Quatech Dual Serial Port
+product QUATECH QUAD_RS232     0x001b Quatech Quad RS-232
+product QUATECH QSP_100                0x0025 Quatech Quad serial Port
+product QUATECH QUAD_422       0x0045 Quatech Quad serial Port
+product QUATECH DUAL_RS232     0x0052 Quatech Dual RS-232
 
 /* RATOC System Inc. Products */
 /* Don't use because both cards have same product id */
-product RATOC REX_R280_9530    0x0001  RATOC REX-R280/REX-9530
+product RATOC REX_R280_9530    0x0001  RATOC REX-R280/REX-9530/CFU01
+
+/* Racore Computer Products */
+product RACORE ACCTON_EN2226   0x010a Accton Fast EtherCard
+product RACORE ETHERNET                0x2216 Racore PC Card Ethernet
+product RACORE FASTENET                0x2328 Racore PC Card Fast Ethernet
+product RACORE 8041TX          0x8041 SMC8041-TX
+
+/* Ralink Technology products */
+product RALINK RT2560          0x0201 RT2500 wireless adapter
 
 /* Raylink/WebGear */
 product RAYTHEON WLAN          0x0000 WLAN Adapter
 
+/* RELIA Technologies Corporation */
+product RELIA COMBO            0x2452 Reliable Combo-L/M-56K
+
 /* Roland */
 product ROLAND SCP55           0x0001 Roland SCP-55
 
@@ -425,6 +531,7 @@ product SIMPLETECH COMMUNICATOR288 0x0100 Simple Technology 28.8 Communicator
 product SIMPLETECH SPECTRUM24 0x801 Symbol Spectrum24 WLAN Adapter
 
 /* Standard Microsystems Corporation Products */
+product SMC SMC91C96           0x0001 SMC 91C96 Farallon EtherMac
 product SMC 8016               0x0105 SMC 8016 EtherCard
 product SMC EZCARD             0x8022 SMC EZCard 10 PCMCIA
 
@@ -433,7 +540,9 @@ product SOCKET EA_ETHER             0x0000 Socket Communications EA
 product SOCKET LP_WLAN_CF      0x0001 Socket Communications Low Power WLAN Card
 product SOCKET PAGECARD                0x0003 Socket Communications PageCard
 product SOCKET DUAL_RS232      0x0006 Socket Communications Dual RS232
+product SOCKET ES_1000         0x000a Socket Communications Ethernet/RS-232
 product SOCKET LP_ETHER                0x000d Socket Communications LP-E
+product SOCKET DUAL_IO         0x0070 Socket Communications DUAL IO
 product SOCKET LP_ETHER_CF     0x0075 Socket Communications LP-E CF
 product SOCKET LP_ETH_10_100_CF 0x0145 Socket Communications 10/100 Ethernet
 
@@ -446,9 +555,12 @@ product TDK LAK_CD021BX            0x0200 TDK LAK-CD021BX Ethernet
 product TDK LAK_CF010          0x0900 TDK LAC-CF010
 product TDK DFL9610            0x0d0a TDK DFL9610 Ethernet & Digital Cellular
 product        TDK C6500012            0x410a TDK ELSA MicroLink MC all
+product TDK GN3410             0x4815 TDK GlobalNetworker 3410
 product TDK LAK_CD031          0xc1ab TDK LAK-CD031 Ethernet
+product TDK DFL5610WS          0xea15 TDK DFL5610WS Ethernet/Modem
 
 /* Telecom Device */
+product TELECOMDEVICE LM5LT    0x0101 Billionton LM5LT-10B Ethernet/Modem
 product TELECOMDEVICE TCD_HPC100       0x0202 Telecom Device TCD-HPC100
 
 /* US Robotics Products */
@@ -492,7 +604,6 @@ vendor AMD                  -1      AMD
 vendor BILLIONTON              -1      Billionton Systems Inc.
 vendor CNET                    -1      CNet
 vendor COREGA                  -1      Corega K.K.
-vendor DIGITAL                 -1      Digital Equipment Corporation
 vendor DLINK                   -1      D-Link
 vendor DYNALINK                        -1      DynaLink
 vendor EIGERLABS               -1      Eiger labs,Inc.
@@ -507,16 +618,14 @@ vendor INTERSIL2          -1      Intersil
 vendor IODATA3                 -1      I-O DATA
 vendor LANTECH                 -1      Lantech Computer Company
 vendor MELCO2                  -1      Melco Corporation
-vendor NAKAGAWAMETAL           -1      NAKAGAWA METAL
 vendor NDC                     -1      NDC
 vendor NEC                     -1      NEC
 vendor OEM2                    -1      Generic OEM
 vendor PLANET                  -1      Planet
-vendor PLANEX                  -1      Planex Communications Inc
 vendor PREMAX                  -1      Premax
 vendor RPTI                    -1      RPTI
 vendor SVEC                    -1      SVEC/Hawking Technology
-vendor SYNERGY21               -1      Synergy 21
+vendor TAMARACK                        -1      Tamarack
 vendor TEAC                    -1      TEAC
 vendor TOSHIBA                 -1      TOSHIBA
 vendor WORKBIT2                        -1      WORKBIT
@@ -526,7 +635,6 @@ vendor ZOOM                 -1      ZOOM
 
 product ACCTON EN2212          { "ACCTON", "EN2212", NULL, NULL } Accton EN2212
 product ACCTON EN2216          { "ACCTON", "EN2216-PCMCIA-ETHERNET", "EN2216R01", NULL } Accton EN2216
-product ACCTON EN2226          { "Accton", "Fast&spEtherCard-16", "EN2226", "1.00" } Accton EN2226
 product ADDTRON AWP100         { "Addtron", "AWP-100&spWireless&spPCMCIA", "Version&sp01.02", NULL }
 product ALLIEDTELESIS WR211PCM { "Allied&spTelesis&spK.K.", "WR211PCM", NULL, NULL } Allied Telesis WR211PCM
 product AMBICOM AMB8002T       { "AmbiCom&spInc", "AMB8002T", NULL, NULL } AmbiCom AMB8002T
@@ -547,7 +655,6 @@ product COREGA WIRELESS_LAN_PCCA_11 { "corega&spK.K.", "Wireless&spLAN&spPCCA-11
 product COREGA WIRELESS_LAN_PCCB_11    { "corega_K.K.", "Wireless_LAN_PCCB-11", NULL, NULL } Corega Wireless LAN PCCB-11
 product COREGA WIRELESS_LAN_PCCL_11    { "corega", "WL&spPCCL-11", NULL, NULL } Corega Wireless LAN PCCL-11
 
-product DIGITAL DEPCMXX                { "DIGITAL", "DEPCM-XX", NULL, NULL } DEC DEPCM-BA
 product DLINK DE650            { "D-Link", "DE-650", NULL, NULL } D-Link DE-650
 product DLINK DE660            { "D-Link", "DE-660", NULL, NULL } D-Link DE-660
 product DLINK DE660PLUS                { "D-Link", "DE-660+", NULL, NULL } D-Link DE-660+
@@ -573,16 +680,14 @@ product GEMTEK WLAN               { "Intersil", "PRISM&sp2_5&spPCMCIA&spADAPTER", "ISL37300P"
 product IBM SCSICARD           { "IBM&spCorp.", "SCSI&spPCMCIA&spCard", NULL, NULL } IBM SCSI PCMCIA Card
 product ICOM SL200             { "Icom", "SL-200", NULL, NULL } Icom SL-200
 product INTERSIL2 PRISM2       { "INTERSIL", "HFA384x/IEEE", "Version&sp01.02", NULL } Intersil Prism II
-product IODATA CBIDE2          { "IO&spDATA", "CBIDE2&sp&sp&sp&sp&sp&sp", NULL, NULL } IO-DATA CBIDE2/16-bit mode
+product IODATA3 CBIDE2         { "IO&spDATA", "CBIDE2&sp&sp&sp&sp&sp&sp", NULL, NULL } IO-DATA CBIDE2/16-bit mode
 product IODATA3 CBSC16         { "IO&spDATA", "CBSC16&sp&sp&sp&sp&sp&sp&sp", NULL, NULL } IO-DATA CBSC16
-product IODATA PCLAT           { "I-O&spDATA", "PCLA", "ETHERNET", NULL } IO-DATA PCLA/T
+product IODATA3 PCLAT          { "I-O&spDATA", "PCLA", "ETHERNET", NULL } IO-DATA PCLA/T
 product LANTECH FASTNETTX      { "ASIX", "AX88190", NULL, NULL } Lantech Fastnet/TX
 product LINKSYS ECARD_2                { "LINKSYS", "E-CARD", NULL, NULL } Linksys E-Card
-product LINKSYS PCM100         { "Linksys", "EtherFast&sp10/100&spIntegrated&spPC&spCard&sp(PCM100)", "Ver&sp1.0", NULL }
 product MACNICA MPS100         { "MACNICA", "MIRACLE&spSCSI", "mPS100", "D.0" } Macnica Miracle SCSI mPS100
 product MEGAHERTZ XJ2288       { "MEGAHERTZ", "MODEM&spXJ2288", NULL, NULL } Megahertz XJ2288 Modem
 product MELCO2 LPC2_TX         { "MELCO", "LPC2-TX", NULL, NULL } Melco LPC2-TX
-product NAKAGAWAMETAL LNT10TN  { "PCMCIA", "LNT-10TN", NULL, NULL } NAKAGAWA METAL LNT-10TN NE2000 Compatible Card 
 product NANOSPEED PRISM2       { "NANOSPEED", "HFA384x/IEEE", "Version&sp01.02", NULL } NANOSPEED ROOT-RZ2000 WLAN Card
 product NDC ND5100_E           { "NDC", "Ethernet", "A", NULL } Sohoware ND5100E NE2000 Compatible Card
 product NEC CMZ_RT_WP          { "NEC", "Wireless&spCard&spCMZ-RT-WP", "Version&sp01.01", NULL } NEC Wireless Card CMZ-RT-WP
@@ -591,13 +696,8 @@ product NEWMEDIA BASICS_SCSI       { "BASICS&spby&spNew&spMedia&spCorporation" "SCSI&s
 product NTT_ME WLAN            { "NTT-ME", "11Mbps&spWireless&spLAN&spPC&spCard", NULL, NULL } NTT-ME 11Mbps Wireless LAN PC Card
 product OEM2 CDROM1    { "PCMCIA", "CD-ROM", NULL, NULL } Generic PCMCIA CD-ROM
 product OEM2 IDE       { "PCMCIA", "IDE&spCARD", NULL, NULL } Generic PCMCIA IDE CARD
+product OEM2 ETHERNET          { "PCMCIA", "Ethernet", NULL, NULL } NE2000 PC Card
 product PLANET SMARTCOM2000    { "PCMCIA", "UE2212", NULL, NULL } Planet SmartCOM 2000
-/*
- * vendor ID of both FNW-3600-T and FNW-3700-T is LINKSYS (0x0149) and
- * product ID is 0xc1ab, but it conflicts with LINKSYS Combo EthernetCard.
- */
-product PLANEX FNW3600T                -1 Planex FNW-3600-T
-product PLANEX FNW3700T                -1 Planex FNW-3700-T
 product RPTI EP400             { "RPTI&spLTD.", "EP400", "CISV100", NULL } RPTI EP400
 product RPTI EP401             { "RPTI", "EP401&spEthernet&spNE2000&spCompatible", NULL, NULL } RPTI EP401
 product PREMAX PE200           { "PMX&sp&sp&sp", "PE-200", NULL, NULL } PreMax PE-200
@@ -607,12 +707,15 @@ product RATOC REX5536AM           { "PCMCIA&spSCSI&spMBH10404", "01", NULL, NULL } RATOC
 product RATOC REX5536M         { "PCMCIA&spSCSI2&spCARD", "01", NULL, NULL } RATOC REX-5536M
 product RATOC REX5572          { "RATOC&spSystem&spInc.", "SOUND/SCSI2&spCARD", NULL, NULL } RATOC REX-5572
 product RATOC REX9530          { "RATOC&spSystem&spInc.", "SCSI2&spCARD&sp37", NULL, NULL } RATOC REX-9530
+product RATOC REX_CFU1         { "RATOC", "USB&spHOST&spCF+&spCard", NULL, NULL } RATOC REX-CFU1
 product SIMPLETECH SPECTRUM24_ALT      { "Symbol&spTechnologies", "LA4111&spSpectrum24&spWireless&spLAN&spPC&spCard", NULL, NULL } LA4111 Spectrum24 Wireless LAN PC Card
 product SMC 2632W              { "SMC", "SMC2632W", "Version&sp01.02", NULL } SMC 2632 EZ Connect Wireless PC Card
-product SMC 8041               { "SMC", "8041TX-10/100-PC-Card-V2", NULL, NULL } SMC 8041TX 10/100 PC Card
+product SMC 8000               { "SMC8000", "DEV1", NULL, NULL }
+product SMC 8020BT             { "SMC" "EtherEZ&spEthernet&sp8020", NULL, NULL }
+product SMC 8020BTM            { "SMC", "EtherEZ&spEthernet/Modem", "8020", NULL }
 product SVEC COMBOCARD         { "Ethernet", "Adapter", NULL, NULL } SVEC/Hawking Tech. Combo Card
 product SVEC LANCARD           { "SVEC", "FD605&spPCMCIA&spEtherNet&spCard", "V1-1", NULL } SVEC PCMCIA Lan Card
-product SYNERGY21 S21810       { "PCMCIA", "Ethernet", "A", "004743118001" } Synergy 21 S21810+ NE2000 Compatible Card
+product TAMARACK ETHERNET      { "TAMARACK", "Ethernet", NULL, NULL } TAMARACK NE2000 PC Card
 product TEAC IDECARDII         { NULL, "NinjaATA-", NULL, NULL } TEAC IDE Card/II
 product TOSHIBA CBIDE2         { "LOOKMEET", "CBIDE2&sp&sp&sp&sp&sp&sp", NULL, NULL } TOSHIBA PA2673U CBIDE2/16-bit mode (IO-DATA OEM)
 product WORKBIT2 NINJA_SCSI3   { "WBT", "NinjaSCSI-3", NULL, NULL } WORKBIT Ninja SCSI series
index b56c3c2..d2daa95 100644 (file)
@@ -1,17 +1,17 @@
-/*     $DragonFly: src/sys/bus/pccard/pccarddevs.h,v 1.3 2004/07/23 11:46:50 joerg Exp $       */
+/*     $DragonFly: src/sys/bus/pccard/pccarddevs.h,v 1.4 2007/07/05 12:08:53 sephe Exp $       */
 
 /*
  * THIS FILE AUTOMATICALLY GENERATED.  DO NOT EDIT.
  *
  * generated from:
- *     DragonFly: src/sys/bus/pccard/pccarddevs,v 1.3 2004/07/23 11:46:09 joerg Exp 
+ *     DragonFly
  */
+/* $FreeBSD: src/sys/dev/pccard/pccarddevs,v 1.112 2005/07/18 21:47:38 imp Exp $ */
 /* $NetBSD: pcmciadevs,v 1.186 2003/09/16 08:26:37 onoe Exp $ */
 /* $OpenBSD: pcmciadevs,v 1.93 2002/06/21 08:31:10 henning Exp $ */
-/* $FreeBSD: src/sys/dev/pccard/pccarddevs,v 1.85 2004/05/13 01:24:26 imp Exp $ */
 
 /*-
- * Copyright (c) 1998 The NetBSD Foundation, Inc.
+ * Copyright (c) 1998-2004 The NetBSD Foundation, Inc.
  * All rights reserved.
  *
  * This code is derived from software contributed to The NetBSD Foundation
  * POSSIBILITY OF SUCH DAMAGE.
  */
 
+/*-
+ * Copyright (c) 1999-2004 The FreeBSD Project.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ */
+
+/*
+ * Tuple registration list can be found at:
+ *     http://www.pcmcia.org/tupleidlist.htm
+ */
+
 /*
  * List of known PCMCIA vendors, sorted by numeric ID.
  */
@@ -58,6 +90,8 @@
 #define        PCMCIA_VENDOR_INTEL     0x0089  /* Intel */
 #define        PCMCIA_VENDOR_IBM       0x00a4  /* IBM Corporation */
 #define        PCMCIA_VENDOR_SHARP     0x00b0  /* Sharp Corporation */
+#define        PCMCIA_VENDOR_TOSHIBA2  0x0098  /* Toshiba */
+#define        PCMCIA_VENDOR_DIGITAL   0x0100  /* Digital Equipment Corporation */
 #define        PCMCIA_VENDOR_3COM      0x0101  /* 3Com Corporation */
 #define        PCMCIA_VENDOR_MEGAHERTZ 0x0102  /* Megahertz Corporation */
 #define        PCMCIA_VENDOR_SOCKET    0x0104  /* Socket Communications */
 #define        PCMCIA_VENDOR_PROXIM    0x0126  /* Proxim */
 #define        PCMCIA_VENDOR_DSPSI     0x0128  /* DSP Solutions, Inc */
 #define        PCMCIA_VENDOR_ADAPTEC   0x012f  /* Adaptec Corporation */
+#define        PCMCIA_VENDOR_MAGICRAM  0x0135  /* Magic Ram, Inc */
 #define        PCMCIA_VENDOR_QUATECH   0x0137  /* Quatech */
 #define        PCMCIA_VENDOR_COMPAQ    0x0138  /* Compaq */
 #define        PCMCIA_VENDOR_OSITECH   0x0140  /* Ositech */
-#define        PCMCIA_VENDOR_DLINK_2   0x0143  /* D-Link */
-#define        PCMCIA_VENDOR_DLINK_3   0x0149  /* D-Link */
+#define        PCMCIA_VENDOR_GREY_CELL 0x0143  /* Grey Cell Systems, Ltd */
 #define        PCMCIA_VENDOR_LINKSYS   0x0149  /* Linksys Corporation */
 #define        PCMCIA_VENDOR_NETGEAR   0x0149  /* Netgear */
 #define        PCMCIA_VENDOR_SIMPLETECH        0x014d  /* Simple Technology */
 #define        PCMCIA_VENDOR_SYMBOL2   0x014d  /* Symbol */
 #define        PCMCIA_VENDOR_LUCENT    0x0156  /* Lucent Technologies */
+#define        PCMCIA_VENDOR_AGERE     0x0156  /* Agere Systems */
 #define        PCMCIA_VENDOR_GEMPLUS   0x0157  /* Gemplus */
 #define        PCMCIA_VENDOR_AIRONET   0x015f  /* Aironet Wireless Communications */
 #define        PCMCIA_VENDOR_ERICSSON  0x016b  /* Ericsson */
 #define        PCMCIA_VENDOR_PSION     0x016c  /* Psion */
+#define        PCMCIA_VENDOR_PMC       0x0175  /* Premax Microelectronics Corp */
 #define        PCMCIA_VENDOR_COMPAQ2   0x0183  /* Compaq */
 #define        PCMCIA_VENDOR_PARALON   0x0183  /* Paralon Technologies Inc */
 #define        PCMCIA_VENDOR_KINGSTON  0x0186  /* Kingston */
 #define        PCMCIA_VENDOR_MELCO     0x018a  /* Melco Corporation */
 #define        PCMCIA_VENDOR_DAYNA     0x0194  /* Dayna Corporation */
 #define        PCMCIA_VENDOR_RAYTHEON  0x01a6  /* Raytheon */
-#define        PCMCIA_VENDOR_IODATA    0x01bf  /* I-O DATA */
+#define        PCMCIA_VENDOR_RACORE    0x01bf  /* Racore Computer Products */
 #define        PCMCIA_VENDOR_BAY       0x01eb  /* Bay Networks */
 #define        PCMCIA_VENDOR_FARALLON  0x0200  /* Farallon Communications */
+#define        PCMCIA_VENDOR_RELIA     0x0215  /* RELIA Technologies Corporation */
 #define        PCMCIA_VENDOR_TELECOMDEVICE     0x021b  /* Telecom Device */
 #define        PCMCIA_VENDOR_NOKIA     0x023d  /* Nokia Communications */
 #define        PCMCIA_VENDOR_SAMSUNG   0x0250  /* Samsung */
 #define        PCMCIA_VENDOR_HWN       0x0261  /* Home Wireless Networks */
+#define        PCMCIA_VENDOR_ANYCOM    0x0264  /* Anycom */
 #define        PCMCIA_VENDOR_ARTEM     0x0268  /* ARtem */
 #define        PCMCIA_VENDOR_SYMBOL    0x026c  /* Symbol */
 #define        PCMCIA_VENDOR_BUFFALO   0x026f  /* BUFFALO (Melco Corporation) */
 #define        PCMCIA_VENDOR_IODATA2   0x028a  /* I-O DATA */
 #define        PCMCIA_VENDOR_ASUS      0x02aa  /* ASUS */
 #define        PCMCIA_VENDOR_SIEMENS   0x02ac  /* Siemens */
+#define        PCMCIA_VENDOR_UNGERMANN 0x02c0  /* Ungermann Bass */
 #define        PCMCIA_VENDOR_MICROSOFT 0x02d2  /* Microsoft Corporation */
 
 /*
 #define        PCMCIA_VENDOR_LEXARMEDIA        0x4e01  /* Lexar Media */
 #define        PCMCIA_VENDOR_COMPEX    0x8a01  /* Compex Corporation */
 #define        PCMCIA_VENDOR_ZONET     0x8a01  /* Zonet Technology Inc. */
+#define        PCMCIA_VENDOR_ADAPTEC2  0x9005  /* Adaptec */
 #define        PCMCIA_VENDOR_ELSA      0xd601  /* Elsa */
 
-/*
- * The following vendor IDs are not, as far as I can tell, actually
- * assigned to these people.  However, all the ones starting with '0xc'
- * look coherent enough that maybe somebody other than PCMCIA is
- * assigning numbers in that range.
+/* 
+ * The following vendor IDs are the vendor's PCI ID, not their PCMCIA
+ * IDs.  NEWMEDIA2 should likely be 'Advansys' since that's who owns
+ * the PCI ID.
  */
 #define        PCMCIA_VENDOR_NEWMEDIA2 0x10cd  /* NewMedia */
-#define        PCMCIA_VENDOR_PLANEX_2  0x14ea  /* PLANEX */
+#define        PCMCIA_VENDOR_PLANEX    0x14ea  /* PLANEX */
 #define        PCMCIA_VENDOR_ACTIONTEC 0x1668  /* ACTIONTEC */
+#define        PCMCIA_VENDOR_RALINK    0x1814  /* Ralink Technology */
+
+/*
+ * The following vendor IDs are not, as far as I can tell, actually
+ * assigned to these people by the pcmcia.  However, all the ones starting
+ * with '0xc' look coherent enough that maybe somebody other than PCMCIA is
+ * assigning numbers in that range.  Maybe JEITA?
+ */
 #define        PCMCIA_VENDOR_AIRVAST   0x50c2  /* AirVast Technology */
 #define        PCMCIA_VENDOR_ARCHOS    0x5241  /* Archos */
 #define        PCMCIA_VENDOR_DUAL      0x890f  /* Dual */
 #define        PCMCIA_VENDOR_ALLIEDTELESIS     0xc00f  /* Allied Telesis K.K. */
 #define        PCMCIA_VENDOR_HAGIWARASYSCOM    0xc012  /* Hagiwara SYS-COM */
 #define        PCMCIA_VENDOR_RATOC     0xc015  /* RATOC System Inc. */
+#define        PCMCIA_VENDOR_NEXTCOM   0xc020  /* NextCom K.K. */
 #define        PCMCIA_VENDOR_WORKBIT   0xc024  /* WORKBIT */
 #define        PCMCIA_VENDOR_EMTAC     0xc250  /* EMTAC Technology Corporation */
 
 #define        PCMCIA_PRODUCT_3COM_3CXEM556INT 0x003d
 #define        PCMCIA_STR_3COM_3CXEM556INT     "3Com/Megahertz 3CXEM556-INT Ethernet/Modem"
 #define        PCMCIA_CIS_3COM_3CRWB609        { NULL, NULL, NULL, NULL }
-#define        PCMCIA_PRODUCT_3COM_3CRWB609    0x0400
+#define        PCMCIA_PRODUCT_3COM_3CRWB609    0x0040
 #define        PCMCIA_STR_3COM_3CRWB609        "3Com Bluetooth PC Card 3CRWB60-A"
 #define        PCMCIA_CIS_3COM_3CCFEM556BI     { NULL, NULL, NULL, NULL }
 #define        PCMCIA_PRODUCT_3COM_3CCFEM556BI 0x0556
 #define        PCMCIA_CIS_ADAPTEC_APA1460A     { NULL, NULL, NULL, NULL }
 #define        PCMCIA_PRODUCT_ADAPTEC_APA1460A 0x0002
 #define        PCMCIA_STR_ADAPTEC_APA1460A     "Adaptec APA-1460A SlimSCSI"
+#define        PCMCIA_CIS_ADAPTEC2_ANW8030     { NULL, NULL, NULL, NULL }
+#define        PCMCIA_PRODUCT_ADAPTEC2_ANW8030 0x0021
+#define        PCMCIA_STR_ADAPTEC2_ANW8030     "Adaptec ANW-8030"
 
 /* Aironet */
 #define        PCMCIA_CIS_AIRONET_PC4500       { NULL, NULL, NULL, NULL }
 #define        PCMCIA_PRODUCT_ALLIEDTELESIS_LA_PCM     0x0002
 #define        PCMCIA_STR_ALLIEDTELESIS_LA_PCM "Allied Telesis LA-PCM"
 
+/* Anycom */
+#define        PCMCIA_CIS_ANYCOM_LSE041        { NULL, NULL, NULL, NULL }
+#define        PCMCIA_PRODUCT_ANYCOM_LSE041    0x0004
+#define        PCMCIA_STR_ANYCOM_LSE041        "AnyCom BlueCard LSE041 R1B"
+#define        PCMCIA_CIS_ANYCOM_LSE039        { NULL, NULL, NULL, NULL }
+#define        PCMCIA_PRODUCT_ANYCOM_LSE039    0x0008
+#define        PCMCIA_STR_ANYCOM_LSE039        "Anycom Bluetooth CF Card LSE039"
+
 /* Archos */
 #define        PCMCIA_CIS_ARCHOS_ARC_ATAPI     { NULL, NULL, NULL, NULL }
 #define        PCMCIA_PRODUCT_ARCHOS_ARC_ATAPI 0x0043
 #define        PCMCIA_STR_BREEZECOM_BREEZENET  "BreezeCOM BreezeNET"
 
 /* Bromax Communications, Inc (Linksys OEM) */
+#define        PCMCIA_CIS_BROMAX_IPORT { NULL, NULL, NULL, NULL }
+#define        PCMCIA_PRODUCT_BROMAX_IPORT     0x1103
+#define        PCMCIA_STR_BROMAX_IPORT "iPort 10/100 Ethernet"
+#define        PCMCIA_CIS_BROMAX_IPORT2        { NULL, NULL, NULL, NULL }
+#define        PCMCIA_PRODUCT_BROMAX_IPORT2    0x1121
+#define        PCMCIA_STR_BROMAX_IPORT2        "iPort 10Mbps Ethernet"
 #define        PCMCIA_CIS_BROMAX_IWN   { NULL, NULL, NULL, NULL }
 #define        PCMCIA_PRODUCT_BROMAX_IWN       0x1612
 #define        PCMCIA_STR_BROMAX_IWN   "Instant Wireless Network PC Card"
 #define        PCMCIA_CIS_BROMAX_IWN3  { NULL, NULL, NULL, NULL }
 #define        PCMCIA_PRODUCT_BROMAX_IWN3      0x1613
-#define        PCMCIA_STR_BROMAX_IWN3  "Instant Wireless Network PC Card, Versin 3"
+#define        PCMCIA_STR_BROMAX_IWN3  "Instant Wireless Network PC Card, V3"
 #define        PCMCIA_CIS_BROMAX_WCF11 { NULL, NULL, NULL, NULL }
 #define        PCMCIA_PRODUCT_BROMAX_WCF11     0x3301
 #define        PCMCIA_STR_BROMAX_WCF11 "Instant Wireless Network CF Card"
 
 /* BUFFALO */
+#define        PCMCIA_CIS_BUFFALO_LPC2_CLT     { NULL, NULL, NULL, NULL }
+#define        PCMCIA_PRODUCT_BUFFALO_LPC2_CLT 0x0300
+#define        PCMCIA_STR_BUFFALO_LPC2_CLT     "BUFFALO LPC2-CLT Ethernet"
 #define        PCMCIA_CIS_BUFFALO_LPC3_CLX     { NULL, NULL, NULL, NULL }
 #define        PCMCIA_PRODUCT_BUFFALO_LPC3_CLX 0x0301
 #define        PCMCIA_STR_BUFFALO_LPC3_CLX     "BUFFALO LPC3-CLX Ethernet Adapter"
+#define        PCMCIA_CIS_BUFFALO_LPC4_TX      { NULL, NULL, NULL, NULL }
+#define        PCMCIA_PRODUCT_BUFFALO_LPC4_TX  0x0303
+#define        PCMCIA_STR_BUFFALO_LPC4_TX      "BUFFALO LPC4-TX Fast Ethernet"
 #define        PCMCIA_CIS_BUFFALO_WLI_PCM_S11  { NULL, NULL, NULL, NULL }
 #define        PCMCIA_PRODUCT_BUFFALO_WLI_PCM_S11      0x0305
 #define        PCMCIA_STR_BUFFALO_WLI_PCM_S11  "BUFFALO AirStation 11Mbps WLAN"
 #define        PCMCIA_CIS_COMPAQ_NC5004        { NULL, NULL, NULL, NULL }
 #define        PCMCIA_PRODUCT_COMPAQ_NC5004    0x0002
 #define        PCMCIA_STR_COMPAQ_NC5004        "Compaq Agency NC5004 Wireless Card"
+#define        PCMCIA_CIS_COMPAQ_CPQ550        { NULL, NULL, NULL, NULL }
+#define        PCMCIA_PRODUCT_COMPAQ_CPQ550    0x110a
+#define        PCMCIA_STR_COMPAQ_CPQ550        "Compaq Microcom CPQ550 Ethernet/Modem"
 #define        PCMCIA_CIS_COMPAQ2_CPQ_10_100   { NULL, NULL, NULL, NULL }
 #define        PCMCIA_PRODUCT_COMPAQ2_CPQ_10_100       0x010a
 #define        PCMCIA_STR_COMPAQ2_CPQ_10_100   "Compaq Netelligent 10/100 Ethernet"
 #define        PCMCIA_CIS_COMPEX_LINKPORT_ENET_B       { NULL, NULL, NULL, NULL }
 #define        PCMCIA_PRODUCT_COMPEX_LINKPORT_ENET_B   0x0100
 #define        PCMCIA_STR_COMPEX_LINKPORT_ENET_B       "Compex Linkport ENET-B Ethernet"
+#define        PCMCIA_CIS_COMPEX_LANMODEM      { NULL, NULL, NULL, NULL }
+#define        PCMCIA_PRODUCT_COMPEX_LANMODEM  0xc0ab
+#define        PCMCIA_STR_COMPEX_LANMODEM      "New Media LANSurfer 10+56 Ethernet/Modem"
+#define        PCMCIA_CIS_COMPEX_AX88190       { NULL, NULL, NULL, NULL }
+#define        PCMCIA_PRODUCT_COMPEX_AX88190   0xc1ab
+#define        PCMCIA_STR_COMPEX_AX88190       "AX88190 Fast Ethernet"
 
 /* Contec C-NET(PC) */
 #define        PCMCIA_CIS_CONTEC_CNETPC        { NULL, NULL, NULL, NULL }
 #define        PCMCIA_PRODUCT_DIGITAL_MOBILE_MEDIA_CDROM       0x0d00
 #define        PCMCIA_STR_DIGITAL_MOBILE_MEDIA_CDROM   "Digital Mobile Media CD-ROM"
 
-/* D-Link Products */
-#define        PCMCIA_CIS_DLINK_2_DMF560TX     { NULL, NULL, NULL, NULL }
-#define        PCMCIA_PRODUCT_DLINK_2_DMF560TX 0xc0ab
-#define        PCMCIA_STR_DLINK_2_DMF560TX     "D-Link DMF-650TX"
-
 /* DSP Solutions, Inc. (Megahertz OEM) */
 #define        PCMCIA_CIS_DSPSI_XJEM1144       { NULL, NULL, NULL, NULL }
 #define        PCMCIA_PRODUCT_DSPSI_XJEM1144   0x0101
 #define        PCMCIA_CIS_ELSA_XI325_IEEE      { NULL, NULL, NULL, NULL }
 #define        PCMCIA_PRODUCT_ELSA_XI325_IEEE  0x0005
 #define        PCMCIA_STR_ELSA_XI325_IEEE      "XI325 Wireless LAN"
+#define        PCMCIA_CIS_ELSA_WIFI_FLASH      { NULL, NULL, NULL, NULL }
+#define        PCMCIA_PRODUCT_ELSA_WIFI_FLASH  0x0101
+#define        PCMCIA_STR_ELSA_WIFI_FLASH      "802.11b plus 128MB Flash"
 
 /* EMTAC */
 #define        PCMCIA_CIS_EMTAC_WLAN   { NULL, NULL, NULL, NULL }
 #define        PCMCIA_STR_FARALLON_SKYLINE     "SkyLINE Wireless"
 
 /* Fujutsu Products */
+#define        PCMCIA_CIS_FUJITSU_NE200T       { NULL, NULL, NULL, NULL }
+#define        PCMCIA_PRODUCT_FUJITSU_NE200T   0x0004
+#define        PCMCIA_STR_FUJITSU_NE200T       "Eagle Tech NE200T"
 #define        PCMCIA_CIS_FUJITSU_SCSI600      { NULL, NULL, NULL, NULL }
 #define        PCMCIA_PRODUCT_FUJITSU_SCSI600  0x0401
 #define        PCMCIA_STR_FUJITSU_SCSI600      "Fujitsu SCSI 600 Interface"
 #define        PCMCIA_PRODUCT_GEMPLUS_GPR400   0x3004
 #define        PCMCIA_STR_GEMPLUS_GPR400       "GPR400 Smartcard Reader"
 
+/* Grey Cell Systems, Ltd */
+#define        PCMCIA_CIS_GREY_CELL_TDK3000    { NULL, NULL, NULL, NULL }
+#define        PCMCIA_PRODUCT_GREY_CELL_TDK3000        0x3341
+#define        PCMCIA_STR_GREY_CELL_TDK3000    "TDK 3000/3400/5670 Fast Ethernet/Modem"
+#define        PCMCIA_CIS_GREY_CELL_DMF650TX   { NULL, NULL, NULL, NULL }
+#define        PCMCIA_PRODUCT_GREY_CELL_DMF650TX       0xc0ab
+#define        PCMCIA_STR_GREY_CELL_DMF650TX   "D-Link DMF-650TX"
+
 /* Home Wireless Networks */
 #define        PCMCIA_CIS_HWN_AIRWAY80211      { NULL, NULL, NULL, NULL }
 #define        PCMCIA_PRODUCT_HWN_AIRWAY80211  0x0002
 
 /* Intersil */
 /* OEMs sell these things under different marketing names */
-#define        PCMCIA_CIS_INTERSIL_MA401RA     { NULL, NULL, NULL, NULL }
-#define        PCMCIA_PRODUCT_INTERSIL_MA401RA 0x7300
-#define        PCMCIA_STR_INTERSIL_MA401RA     "Netgear MA401RA"
-#define        PCMCIA_CIS_INTERSIL_DWL650      { NULL, NULL, NULL, NULL }
-#define        PCMCIA_PRODUCT_INTERSIL_DWL650  0x7110
-#define        PCMCIA_STR_INTERSIL_DWL650      "Dlink DWL650"
+#define        PCMCIA_CIS_INTERSIL_ISL37100P   { NULL, NULL, NULL, NULL }
+#define        PCMCIA_PRODUCT_INTERSIL_ISL37100P       0x7100
+#define        PCMCIA_STR_INTERSIL_ISL37100P   "ISL37100P"
+#define        PCMCIA_CIS_INTERSIL_ISL37110P   { NULL, NULL, NULL, NULL }
+#define        PCMCIA_PRODUCT_INTERSIL_ISL37110P       0x7110
+#define        PCMCIA_STR_INTERSIL_ISL37110P   "ISL37110P"
+#define        PCMCIA_CIS_INTERSIL_ISL37300P   { NULL, NULL, NULL, NULL }
+#define        PCMCIA_PRODUCT_INTERSIL_ISL37300P       0x7300
+#define        PCMCIA_STR_INTERSIL_ISL37300P   "ISL37300P"
 
 /* I-O DATA */
-#define        PCMCIA_CIS_IODATA_PCLATE        { NULL, NULL, NULL, NULL }
-#define        PCMCIA_PRODUCT_IODATA_PCLATE    0x2216
-#define        PCMCIA_STR_IODATA_PCLATE        "I-O DATA PCLA/TE"
 #define        PCMCIA_CIS_IODATA2_WNB11PCM     { NULL, NULL, NULL, NULL }
 #define        PCMCIA_PRODUCT_IODATA2_WNB11PCM 0x0002
 #define        PCMCIA_STR_IODATA2_WNB11PCM     "I-O DATA WN-B11/PCM"
 #define        PCMCIA_CIS_KINGSTON_KNE2        { NULL, NULL, NULL, NULL }
 #define        PCMCIA_PRODUCT_KINGSTON_KNE2    0x0100
 #define        PCMCIA_STR_KINGSTON_KNE2        "Kingston KNE-PC2 Ethernet"
+#define        PCMCIA_CIS_KINGSTON_CIO10T      { NULL, NULL, NULL, NULL }
+#define        PCMCIA_PRODUCT_KINGSTON_CIO10T  0x0110
+#define        PCMCIA_STR_KINGSTON_CIO10T      "Kingston CIO10T Ethernet"
 
 /* Lasat Products */
 #define        PCMCIA_CIS_LASAT_CREDIT_288     { NULL, NULL, NULL, NULL }
 #define        PCMCIA_CIS_LUCENT_WAVELAN_IEEE  { NULL, NULL, NULL, NULL }
 #define        PCMCIA_PRODUCT_LUCENT_WAVELAN_IEEE      0x0002
 #define        PCMCIA_STR_LUCENT_WAVELAN_IEEE  "WaveLAN/IEEE"
+#define        PCMCIA_CIS_AGERE_HERMES_II      { NULL, NULL, NULL, NULL }
+#define        PCMCIA_PRODUCT_AGERE_HERMES_II  0x0003
+#define        PCMCIA_STR_AGERE_HERMES_II      "Agere Systems Hermes-II Wireless"
+#define        PCMCIA_CIS_AGERE_HERMES_II_5    { NULL, NULL, NULL, NULL }
+#define        PCMCIA_PRODUCT_AGERE_HERMES_II_5        0x0004
+#define        PCMCIA_STR_AGERE_HERMES_II_5    "Agere Systems Hermes-II.5 Wireless"
 
 /* MACNICA */
 #define        PCMCIA_CIS_MACNICA_ME1_JEIDA    { NULL, NULL, NULL, NULL }
 #define        PCMCIA_PRODUCT_MACNICA_MPS110   0xa041
 #define        PCMCIA_STR_MACNICA_MPS110       "MACNICA Miracle SCSI-II mPS110"
 
+/* MagicRam, Inc */
+#define        PCMCIA_CIS_MAGICRAM_ETHER       { NULL, NULL, NULL, NULL }
+#define        PCMCIA_PRODUCT_MAGICRAM_ETHER   0x0000
+#define        PCMCIA_STR_MAGICRAM_ETHER       "MagicRAM Ethernet PC Card 933926"
+
 /* Megahertz Products */
+#define        PCMCIA_CIS_MEGAHERTZ_VARIOUS    { NULL, NULL, NULL, NULL }
+#define        PCMCIA_PRODUCT_MEGAHERTZ_VARIOUS        0x0000
+#define        PCMCIA_STR_MEGAHERTZ_VARIOUS    "Megahertz X-jack Ethernet"
 #define        PCMCIA_CIS_MEGAHERTZ_XJEM3336   { NULL, NULL, NULL, NULL }
 #define        PCMCIA_PRODUCT_MEGAHERTZ_XJEM3336       0x0006
 #define        PCMCIA_STR_MEGAHERTZ_XJEM3336   "Megahertz X-JACK Ethernet Modem"
 #define        PCMCIA_STR_MEGAHERTZ_XJ5560     "Megahertz X-JACK 56kbps Modem"
 
 /* Melco Products */
-#define        PCMCIA_CIS_MELCO_LPC3_TX        { NULL, NULL, NULL, NULL }
-#define        PCMCIA_PRODUCT_MELCO_LPC3_TX    0xc1ab
-#define        PCMCIA_STR_MELCO_LPC3_TX        "Melco LPC3-TX"
 #define        PCMCIA_CIS_MELCO_LPC3_CLX       { NULL, NULL, NULL, NULL }
 #define        PCMCIA_PRODUCT_MELCO_LPC3_CLX   0x0301
 #define        PCMCIA_STR_MELCO_LPC3_CLX       "Melco LPC3-CLX Ethernet Adapter"
+#define        PCMCIA_CIS_MELCO_LPC3_TX        { NULL, NULL, NULL, NULL }
+#define        PCMCIA_PRODUCT_MELCO_LPC3_TX    0xc1ab
+#define        PCMCIA_STR_MELCO_LPC3_TX        "Melco LPC3-TX"
 
 /* Microsoft Products */
 #define        PCMCIA_CIS_MICROSOFT_MN_520     { NULL, NULL, NULL, NULL }
 #define        PCMCIA_CIS_MOTOROLA_PM100C      { NULL, NULL, NULL, NULL }
 #define        PCMCIA_PRODUCT_MOTOROLA_PM100C  0x0302
 #define        PCMCIA_STR_MOTOROLA_PM100C      "Motorola Personal Messenger 100C CDPD Modem"
+#define        PCMCIA_CIS_MOTOROLA_MARINER     { NULL, NULL, NULL, NULL }
+#define        PCMCIA_PRODUCT_MOTOROLA_MARINER 0x0501
+#define        PCMCIA_STR_MOTOROLA_MARINER     "Motorola Mariner Ethernet/Modem"
 #define        PCMCIA_CIS_MOTOROLA_MONTANA_336 { NULL, NULL, NULL, NULL }
 #define        PCMCIA_PRODUCT_MOTOROLA_MONTANA_336     0x0505
 #define        PCMCIA_STR_MOTOROLA_MONTANA_336 "Motorola Montana 33.6"
 #define        PCMCIA_STR_NEWMEDIA_BASICS      "New Media BASICS Ethernet"
 #define        PCMCIA_CIS_NEWMEDIA_LANSURFER   { NULL, NULL, NULL, NULL }
 #define        PCMCIA_PRODUCT_NEWMEDIA_LANSURFER       0x0021
-#define        PCMCIA_STR_NEWMEDIA_LANSURFER   "NewMedia LANSurfer"
+#define        PCMCIA_STR_NEWMEDIA_LANSURFER   "New Media LANSurfer"
 #define        PCMCIA_CIS_NEWMEDIA_LIVEWIRE    { NULL, NULL, NULL, NULL }
 #define        PCMCIA_PRODUCT_NEWMEDIA_LIVEWIRE        0x1004
-#define        PCMCIA_STR_NEWMEDIA_LIVEWIRE    "NewMedia LiveWire Ethernet LAN Adapter"
+#define        PCMCIA_STR_NEWMEDIA_LIVEWIRE    "New Media LiveWire Ethernet LAN Adapter"
 #define        PCMCIA_CIS_NEWMEDIA_MULTIMEDIA  { NULL, NULL, NULL, NULL }
 #define        PCMCIA_PRODUCT_NEWMEDIA_MULTIMEDIA      0x100b
-#define        PCMCIA_STR_NEWMEDIA_MULTIMEDIA  "NewMedia Multimedia"
+#define        PCMCIA_STR_NEWMEDIA_MULTIMEDIA  "New Media Multimedia"
 #define        PCMCIA_CIS_NEWMEDIA_BUSTOASTER2 { NULL, NULL, NULL, NULL }
 #define        PCMCIA_PRODUCT_NEWMEDIA_BUSTOASTER2     0xa002
 #define        PCMCIA_STR_NEWMEDIA_BUSTOASTER2 "New Media SCSI Bus Toaster"
 #define        PCMCIA_STR_NEWMEDIA_BUSTOASTER3 "New Media SCSI Bus Toaster"
 #define        PCMCIA_CIS_NEWMEDIA_WAVJAMMER   { NULL, NULL, NULL, NULL }
 #define        PCMCIA_PRODUCT_NEWMEDIA_WAVJAMMER       0xe005
-#define        PCMCIA_STR_NEWMEDIA_WAVJAMMER   "NewMedia .WAVjammer"
+#define        PCMCIA_STR_NEWMEDIA_WAVJAMMER   "New Media .WAVjammer"
 #define        PCMCIA_CIS_NEWMEDIA2_BUSTOASTER { NULL, NULL, NULL, NULL }
 #define        PCMCIA_PRODUCT_NEWMEDIA2_BUSTOASTER     0x0001
-#define        PCMCIA_STR_NEWMEDIA2_BUSTOASTER "NewMedia BusToaster"
+#define        PCMCIA_STR_NEWMEDIA2_BUSTOASTER "New Media BusToaster"
 
 /* Netgear */
-#define        PCMCIA_CIS_NETGEAR_FA410TX      { NULL, NULL, NULL, NULL }
-#define        PCMCIA_PRODUCT_NETGEAR_FA410TX  0x0230
-#define        PCMCIA_STR_NETGEAR_FA410TX      "Netgear FA410TX"
 #define        PCMCIA_CIS_NETGEAR_FA410TXC     { NULL, NULL, NULL, NULL }
 #define        PCMCIA_PRODUCT_NETGEAR_FA410TXC 0x4530
 #define        PCMCIA_STR_NETGEAR_FA410TXC     "Netgear FA410TXC"
 #define        PCMCIA_STR_NETGEAR_FA411        "Netgear FA411"
 
 /* National Instruments */
+#define        PCMCIA_CIS_NI_PCMCIA_232        { NULL, NULL, NULL, NULL }
+#define        PCMCIA_PRODUCT_NI_PCMCIA_232    0x0d50
+#define        PCMCIA_STR_NI_PCMCIA_232        "National Instruments PCMCIA-232"
+#define        PCMCIA_CIS_NI_PCMCIA_232_2      { NULL, NULL, NULL, NULL }
+#define        PCMCIA_PRODUCT_NI_PCMCIA_232_2  0x0d51
+#define        PCMCIA_STR_NI_PCMCIA_232_2      "National Instruments PCMCIA-232/2"
+#define        PCMCIA_CIS_NI_PCMCIA_485        { NULL, NULL, NULL, NULL }
+#define        PCMCIA_PRODUCT_NI_PCMCIA_485    0x0d51
+#define        PCMCIA_STR_NI_PCMCIA_485        "National Instruments PCMCIA-485"
+#define        PCMCIA_CIS_NI_PCMCIA_485_2      { NULL, NULL, NULL, NULL }
+#define        PCMCIA_PRODUCT_NI_PCMCIA_485_2  0x0d52
+#define        PCMCIA_STR_NI_PCMCIA_485_2      "National Instruments PCMCIA-485/2"
 #define        PCMCIA_CIS_NI_PCMCIA_GPIB       { NULL, NULL, NULL, NULL }
 #define        PCMCIA_PRODUCT_NI_PCMCIA_GPIB   0x4882
 #define        PCMCIA_STR_NI_PCMCIA_GPIB       "National Instruments PCMCIA-GPIB"
+#define        PCMCIA_CIS_NI_PCMCIA_232_4      { NULL, NULL, NULL, NULL }
+#define        PCMCIA_PRODUCT_NI_PCMCIA_232_4  0xd180
+#define        PCMCIA_STR_NI_PCMCIA_232_4      "National Instruments PCMCIA-232/4"
+
+/* NextCom K.K. */
+#define        PCMCIA_CIS_NEXTCOM_NEXTHAWK     { NULL, NULL, NULL, NULL }
+#define        PCMCIA_PRODUCT_NEXTCOM_NEXTHAWK 0x0001
+#define        PCMCIA_STR_NEXTCOM_NEXTHAWK     "Next Hawk Ethernet"
 
 /* Nokia Products */
 #define        PCMCIA_CIS_NOKIA_C110_WLAN      { NULL, NULL, NULL, NULL }
 #define        PCMCIA_STR_NWN_WLAN_1148        "NWN 1148 WLAN"
 
 /* Olicom Products */
+#define        PCMCIA_CIS_OLICOM_OC2220        { NULL, NULL, NULL, NULL }
+#define        PCMCIA_PRODUCT_OLICOM_OC2220    0x0101
+#define        PCMCIA_STR_OLICOM_OC2220        "GoCard Ethernet"
 #define        PCMCIA_CIS_OLICOM_TR    { NULL, NULL, NULL, NULL }
 #define        PCMCIA_PRODUCT_OLICOM_TR        0x2132
 #define        PCMCIA_STR_OLICOM_TR    "GoCard Token Ring 16/4"
-#define        PCMCIA_CIS_OLICOM_OC2220        { NULL, NULL, NULL, NULL }
-#define        PCMCIA_PRODUCT_OLICOM_OC2220    0x2022
-#define        PCMCIA_STR_OLICOM_OC2220        "GoCard Ethernet"
 #define        PCMCIA_CIS_OLICOM_OC2231        { NULL, NULL, NULL, NULL }
 #define        PCMCIA_PRODUCT_OLICOM_OC2231    0x3122
 #define        PCMCIA_STR_OLICOM_OC2231        "GoCard Combo Eth/Modem 288"
 #define        PCMCIA_STR_OLICOM_OC2232        "GoCard Combo Eth/Modem 336"
 
 /* Ositech Products */
-#define        PCMCIA_CIS_OSITECH_TRUMPCARD_SOD        { NULL, NULL, NULL, NULL }
-#define        PCMCIA_PRODUCT_OSITECH_TRUMPCARD_SOD    0x0008
-#define        PCMCIA_STR_OSITECH_TRUMPCARD_SOD        "Ositech Seven of Diamonds Ethernet Card"
+#define        PCMCIA_CIS_OSITECH_JACK_144     { NULL, NULL, NULL, NULL }
+#define        PCMCIA_PRODUCT_OSITECH_JACK_144 0x0001
+#define        PCMCIA_STR_OSITECH_JACK_144     "Ositech Jack of ??? 14.4"
+#define        PCMCIA_CIS_OSITECH_JACK_288     { NULL, NULL, NULL, NULL }
+#define        PCMCIA_PRODUCT_OSITECH_JACK_288 0x0002
+#define        PCMCIA_STR_OSITECH_JACK_288     "Ositech Jack of ??? 28.8"
+#define        PCMCIA_CIS_OSITECH_JACK_336     { NULL, NULL, NULL, NULL }
+#define        PCMCIA_PRODUCT_OSITECH_JACK_336 0x0007
+#define        PCMCIA_STR_OSITECH_JACK_336     "Ositech Jack of ??? 33.6"
+#define        PCMCIA_CIS_OSITECH_TRUMP_SOD    { NULL, NULL, NULL, NULL }
+#define        PCMCIA_PRODUCT_OSITECH_TRUMP_SOD        0x0008
+#define        PCMCIA_STR_OSITECH_TRUMP_SOD    "Ositech Seven of Diamonds Ethernet Card"
+#define        PCMCIA_CIS_OSITECH_TRUMP_JOH    { NULL, NULL, NULL, NULL }
+#define        PCMCIA_PRODUCT_OSITECH_TRUMP_JOH        0x000a
+#define        PCMCIA_STR_OSITECH_TRUMP_JOH    "Ositech Jack of Hearts"
 
 /* Panasonic Products */
 #define        PCMCIA_CIS_PANASONIC_KXLC002    { NULL, NULL, NULL, NULL }
 #define        PCMCIA_CIS_PANASONIC_KXLC004    { NULL, NULL, NULL, NULL }
 #define        PCMCIA_PRODUCT_PANASONIC_KXLC004        0x0604
 #define        PCMCIA_STR_PANASONIC_KXLC004    "Panasonic KXL-810AN Interface Card"
+#define        PCMCIA_CIS_PANASONIC_KXLC005_2  { NULL, NULL, NULL, NULL }
+#define        PCMCIA_PRODUCT_PANASONIC_KXLC005_2      0x0704
+#define        PCMCIA_STR_PANASONIC_KXLC005_2  "Panasonic 16X CD-ROM Interface Card"
+#define        PCMCIA_CIS_PANASONIC_KME        { NULL, NULL, NULL, NULL }
+#define        PCMCIA_PRODUCT_PANASONIC_KME    0x2604
+#define        PCMCIA_STR_PANASONIC_KME        "Panasonic CD-R/RW Interface"
 #define        PCMCIA_CIS_PANASONIC_KXLC005    { NULL, NULL, NULL, NULL }
 #define        PCMCIA_PRODUCT_PANASONIC_KXLC005        0x2704
 #define        PCMCIA_STR_PANASONIC_KXLC005    "Panasonic 16X CD-ROM Interface Card"
 #define        PCMCIA_CIS_PANASONIC_KXLC005_1  { NULL, NULL, NULL, NULL }
 #define        PCMCIA_PRODUCT_PANASONIC_KXLC005_1      0x2904
 #define        PCMCIA_STR_PANASONIC_KXLC005_1  "Panasonic 16X CD-ROM Interface Card"
-#define        PCMCIA_CIS_PANASONIC_KME        { NULL, NULL, NULL, NULL }
-#define        PCMCIA_PRODUCT_PANASONIC_KME    0x2604
-#define        PCMCIA_STR_PANASONIC_KME        "Panasonic CD-R/RW Interface"
 
 /* Planex */
-#define        PCMCIA_CIS_PLANEX_2_GWNS11H     { NULL, NULL, NULL, NULL }
-#define        PCMCIA_PRODUCT_PLANEX_2_GWNS11H 0xb001
-#define        PCMCIA_STR_PLANEX_2_GWNS11H     "Planex GW-NS11H"
+#define        PCMCIA_CIS_PLANEX_GWNS11H       { NULL, NULL, NULL, NULL }
+#define        PCMCIA_PRODUCT_PLANEX_GWNS11H   0xb001
+#define        PCMCIA_STR_PLANEX_GWNS11H       "Planex GW-NS11H"
+
+/* Premax Microelectronics Corp. */
+#define        PCMCIA_CIS_PMC_LANMODEM { NULL, NULL, NULL, NULL }
+#define        PCMCIA_PRODUCT_PMC_LANMODEM     0x0000
+#define        PCMCIA_STR_PMC_LANMODEM "LAN 33.6 Modem card"
 
 /* Proxim */
 #define        PCMCIA_CIS_PROXIM_HARMONY       { NULL, NULL, NULL, NULL }
 #define        PCMCIA_CIS_PSION_GOLDCARD       { NULL, NULL, NULL, NULL }
 #define        PCMCIA_PRODUCT_PSION_GOLDCARD   0x0020
 #define        PCMCIA_STR_PSION_GOLDCARD       "Psion Gold Card"
+#define        PCMCIA_CIS_PSION_NETGLOBAL      { NULL, NULL, NULL, NULL }
+#define        PCMCIA_PRODUCT_PSION_NETGLOBAL  0x0023
+#define        PCMCIA_STR_PSION_NETGLOBAL      "Psion Gold Card NetGlobal 10/100"
+#define        PCMCIA_CIS_PSION_NETGLOBAL2     { NULL, NULL, NULL, NULL }
+#define        PCMCIA_PRODUCT_PSION_NETGLOBAL2 0x0026
+#define        PCMCIA_STR_PSION_NETGLOBAL2     "Psion Gold Card NetGlobal 10/100"
+#define        PCMCIA_CIS_PSION_LANGLOBAL      { NULL, NULL, NULL, NULL }
+#define        PCMCIA_PRODUCT_PSION_LANGLOBAL  0x0081
+#define        PCMCIA_STR_PSION_LANGLOBAL      "Psion LANGLOBAL"
 
 /* QLogic */
 #define        PCMCIA_CIS_QLOGIC_PC05  { NULL, NULL, NULL, NULL }
 #define        PCMCIA_CIS_QUATECH_DSP_225      { NULL, NULL, NULL, NULL }
 #define        PCMCIA_PRODUCT_QUATECH_DSP_225  0x0008
 #define        PCMCIA_STR_QUATECH_DSP_225      "Quatech Dual Serial Port"
+#define        PCMCIA_CIS_QUATECH_DUAL { NULL, NULL, NULL, NULL }
+#define        PCMCIA_PRODUCT_QUATECH_DUAL     0x000e
+#define        PCMCIA_STR_QUATECH_DUAL "Quatech Dual Serial Port"
+#define        PCMCIA_CIS_QUATECH_QUAD_RS232   { NULL, NULL, NULL, NULL }
+#define        PCMCIA_PRODUCT_QUATECH_QUAD_RS232       0x001b
+#define        PCMCIA_STR_QUATECH_QUAD_RS232   "Quatech Quad RS-232"
+#define        PCMCIA_CIS_QUATECH_QSP_100      { NULL, NULL, NULL, NULL }
+#define        PCMCIA_PRODUCT_QUATECH_QSP_100  0x0025
+#define        PCMCIA_STR_QUATECH_QSP_100      "Quatech Quad serial Port"
+#define        PCMCIA_CIS_QUATECH_QUAD_422     { NULL, NULL, NULL, NULL }
+#define        PCMCIA_PRODUCT_QUATECH_QUAD_422 0x0045
+#define        PCMCIA_STR_QUATECH_QUAD_422     "Quatech Quad serial Port"
+#define        PCMCIA_CIS_QUATECH_DUAL_RS232   { NULL, NULL, NULL, NULL }
+#define        PCMCIA_PRODUCT_QUATECH_DUAL_RS232       0x0052
+#define        PCMCIA_STR_QUATECH_DUAL_RS232   "Quatech Dual RS-232"
 
 /* RATOC System Inc. Products */
 /* Don't use because both cards have same product id */
 #define        PCMCIA_CIS_RATOC_REX_R280_9530  { NULL, NULL, NULL, NULL }
 #define        PCMCIA_PRODUCT_RATOC_REX_R280_9530      0x0001
-#define        PCMCIA_STR_RATOC_REX_R280_9530  "RATOC REX-R280/REX-9530"
+#define        PCMCIA_STR_RATOC_REX_R280_9530  "RATOC REX-R280/REX-9530/CFU01"
+
+/* Racore Computer Products */
+#define        PCMCIA_CIS_RACORE_ACCTON_EN2226 { NULL, NULL, NULL, NULL }
+#define        PCMCIA_PRODUCT_RACORE_ACCTON_EN2226     0x010a
+#define        PCMCIA_STR_RACORE_ACCTON_EN2226 "Accton Fast EtherCard"
+#define        PCMCIA_CIS_RACORE_ETHERNET      { NULL, NULL, NULL, NULL }
+#define        PCMCIA_PRODUCT_RACORE_ETHERNET  0x2216
+#define        PCMCIA_STR_RACORE_ETHERNET      "Racore PC Card Ethernet"
+#define        PCMCIA_CIS_RACORE_FASTENET      { NULL, NULL, NULL, NULL }
+#define        PCMCIA_PRODUCT_RACORE_FASTENET  0x2328
+#define        PCMCIA_STR_RACORE_FASTENET      "Racore PC Card Fast Ethernet"
+#define        PCMCIA_CIS_RACORE_8041TX        { NULL, NULL, NULL, NULL }
+#define        PCMCIA_PRODUCT_RACORE_8041TX    0x8041
+#define        PCMCIA_STR_RACORE_8041TX        "SMC8041-TX"
+
+/* Ralink Technology products */
+#define        PCMCIA_CIS_RALINK_RT2560        { NULL, NULL, NULL, NULL }
+#define        PCMCIA_PRODUCT_RALINK_RT2560    0x0201
+#define        PCMCIA_STR_RALINK_RT2560        "RT2500 wireless adapter"
 
 /* Raylink/WebGear */
 #define        PCMCIA_CIS_RAYTHEON_WLAN        { NULL, NULL, NULL, NULL }
 #define        PCMCIA_PRODUCT_RAYTHEON_WLAN    0x0000
 #define        PCMCIA_STR_RAYTHEON_WLAN        "WLAN Adapter"
 
+/* RELIA Technologies Corporation */
+#define        PCMCIA_CIS_RELIA_COMBO  { NULL, NULL, NULL, NULL }
+#define        PCMCIA_PRODUCT_RELIA_COMBO      0x2452
+#define        PCMCIA_STR_RELIA_COMBO  "Reliable Combo-L/M-56K"
+
 /* Roland */
 #define        PCMCIA_CIS_ROLAND_SCP55 { NULL, NULL, NULL, NULL }
 #define        PCMCIA_PRODUCT_ROLAND_SCP55     0x0001
 #define        PCMCIA_STR_SIMPLETECH_SPECTRUM24        "Symbol Spectrum24 WLAN Adapter"
 
 /* Standard Microsystems Corporation Products */
+#define        PCMCIA_CIS_SMC_SMC91C96 { NULL, NULL, NULL, NULL }
+#define        PCMCIA_PRODUCT_SMC_SMC91C96     0x0001
+#define        PCMCIA_STR_SMC_SMC91C96 "SMC 91C96 Farallon EtherMac"
 #define        PCMCIA_CIS_SMC_8016     { NULL, NULL, NULL, NULL }
 #define        PCMCIA_PRODUCT_SMC_8016 0x0105
 #define        PCMCIA_STR_SMC_8016     "SMC 8016 EtherCard"
 #define        PCMCIA_CIS_SOCKET_DUAL_RS232    { NULL, NULL, NULL, NULL }
 #define        PCMCIA_PRODUCT_SOCKET_DUAL_RS232        0x0006
 #define        PCMCIA_STR_SOCKET_DUAL_RS232    "Socket Communications Dual RS232"
+#define        PCMCIA_CIS_SOCKET_ES_1000       { NULL, NULL, NULL, NULL }
+#define        PCMCIA_PRODUCT_SOCKET_ES_1000   0x000a
+#define        PCMCIA_STR_SOCKET_ES_1000       "Socket Communications Ethernet/RS-232"
 #define        PCMCIA_CIS_SOCKET_LP_ETHER      { NULL, NULL, NULL, NULL }
 #define        PCMCIA_PRODUCT_SOCKET_LP_ETHER  0x000d
 #define        PCMCIA_STR_SOCKET_LP_ETHER      "Socket Communications LP-E"
+#define        PCMCIA_CIS_SOCKET_DUAL_IO       { NULL, NULL, NULL, NULL }
+#define        PCMCIA_PRODUCT_SOCKET_DUAL_IO   0x0070
+#define        PCMCIA_STR_SOCKET_DUAL_IO       "Socket Communications DUAL IO"
 #define        PCMCIA_CIS_SOCKET_LP_ETHER_CF   { NULL, NULL, NULL, NULL }
 #define        PCMCIA_PRODUCT_SOCKET_LP_ETHER_CF       0x0075
 #define        PCMCIA_STR_SOCKET_LP_ETHER_CF   "Socket Communications LP-E CF"
 #define        PCMCIA_CIS_TDK_C6500012 { NULL, NULL, NULL, NULL }
 #define        PCMCIA_PRODUCT_TDK_C6500012     0x410a
 #define        PCMCIA_STR_TDK_C6500012 "TDK ELSA MicroLink MC all"
+#define        PCMCIA_CIS_TDK_GN3410   { NULL, NULL, NULL, NULL }
+#define        PCMCIA_PRODUCT_TDK_GN3410       0x4815
+#define        PCMCIA_STR_TDK_GN3410   "TDK GlobalNetworker 3410"
 #define        PCMCIA_CIS_TDK_LAK_CD031        { NULL, NULL, NULL, NULL }
 #define        PCMCIA_PRODUCT_TDK_LAK_CD031    0xc1ab
 #define        PCMCIA_STR_TDK_LAK_CD031        "TDK LAK-CD031 Ethernet"
+#define        PCMCIA_CIS_TDK_DFL5610WS        { NULL, NULL, NULL, NULL }
+#define        PCMCIA_PRODUCT_TDK_DFL5610WS    0xea15
+#define        PCMCIA_STR_TDK_DFL5610WS        "TDK DFL5610WS Ethernet/Modem"
 
 /* Telecom Device */
+#define        PCMCIA_CIS_TELECOMDEVICE_LM5LT  { NULL, NULL, NULL, NULL }
+#define        PCMCIA_PRODUCT_TELECOMDEVICE_LM5LT      0x0101
+#define        PCMCIA_STR_TELECOMDEVICE_LM5LT  "Billionton LM5LT-10B Ethernet/Modem"
 #define        PCMCIA_CIS_TELECOMDEVICE_TCD_HPC100     { NULL, NULL, NULL, NULL }
 #define        PCMCIA_PRODUCT_TELECOMDEVICE_TCD_HPC100 0x0202
 #define        PCMCIA_STR_TELECOMDEVICE_TCD_HPC100     "Telecom Device TCD-HPC100"
 #define        PCMCIA_VENDOR_BILLIONTON        0xffffffff      /* Billionton Systems Inc. */
 #define        PCMCIA_VENDOR_CNET      0xffffffff      /* CNet */
 #define        PCMCIA_VENDOR_COREGA    0xffffffff      /* Corega K.K. */
-#define        PCMCIA_VENDOR_DIGITAL   0xffffffff      /* Digital Equipment Corporation */
 #define        PCMCIA_VENDOR_DLINK     0xffffffff      /* D-Link */
 #define        PCMCIA_VENDOR_DYNALINK  0xffffffff      /* DynaLink */
 #define        PCMCIA_VENDOR_EIGERLABS 0xffffffff      /* Eiger labs,Inc. */
 #define        PCMCIA_VENDOR_IODATA3   0xffffffff      /* I-O DATA */
 #define        PCMCIA_VENDOR_LANTECH   0xffffffff      /* Lantech Computer Company */
 #define        PCMCIA_VENDOR_MELCO2    0xffffffff      /* Melco Corporation */
-#define        PCMCIA_VENDOR_NAKAGAWAMETAL     0xffffffff      /* NAKAGAWA METAL */
 #define        PCMCIA_VENDOR_NDC       0xffffffff      /* NDC */
 #define        PCMCIA_VENDOR_NEC       0xffffffff      /* NEC */
 #define        PCMCIA_VENDOR_OEM2      0xffffffff      /* Generic OEM */
 #define        PCMCIA_VENDOR_PLANET    0xffffffff      /* Planet */
-#define        PCMCIA_VENDOR_PLANEX    0xffffffff      /* Planex Communications Inc */
 #define        PCMCIA_VENDOR_PREMAX    0xffffffff      /* Premax */
 #define        PCMCIA_VENDOR_RPTI      0xffffffff      /* RPTI */
 #define        PCMCIA_VENDOR_SVEC      0xffffffff      /* SVEC/Hawking Technology */
-#define        PCMCIA_VENDOR_SYNERGY21 0xffffffff      /* Synergy 21 */
+#define        PCMCIA_VENDOR_TAMARACK  0xffffffff      /* Tamarack */
 #define        PCMCIA_VENDOR_TEAC      0xffffffff      /* TEAC */
 #define        PCMCIA_VENDOR_TOSHIBA   0xffffffff      /* TOSHIBA */
 #define        PCMCIA_VENDOR_WORKBIT2  0xffffffff      /* WORKBIT */
 #define        PCMCIA_CIS_ACCTON_EN2216        { "ACCTON", "EN2216-PCMCIA-ETHERNET", "EN2216R01", NULL }
 #define        PCMCIA_PRODUCT_ACCTON_EN2216    0xffffffff
 #define        PCMCIA_STR_ACCTON_EN2216        "Accton EN2216"
-#define        PCMCIA_CIS_ACCTON_EN2226        { "Accton", "Fast EtherCard-16", "EN2226", "1.00" }
-#define        PCMCIA_PRODUCT_ACCTON_EN2226    0xffffffff
-#define        PCMCIA_STR_ACCTON_EN2226        "Accton EN2226"
 #define        PCMCIA_CIS_ADDTRON_AWP100       { "Addtron", "AWP-100 Wireless PCMCIA", "Version 01.02", NULL }
 #define        PCMCIA_PRODUCT_ADDTRON_AWP100   0xffffffff
 #define        PCMCIA_STR_ADDTRON_AWP100       ""
 #define        PCMCIA_PRODUCT_COREGA_WIRELESS_LAN_PCCL_11      0xffffffff
 #define        PCMCIA_STR_COREGA_WIRELESS_LAN_PCCL_11  "Corega Wireless LAN PCCL-11"
 
-#define        PCMCIA_CIS_DIGITAL_DEPCMXX      { "DIGITAL", "DEPCM-XX", NULL, NULL }
-#define        PCMCIA_PRODUCT_DIGITAL_DEPCMXX  0xffffffff
-#define        PCMCIA_STR_DIGITAL_DEPCMXX      "DEC DEPCM-BA"
 #define        PCMCIA_CIS_DLINK_DE650  { "D-Link", "DE-650", NULL, NULL }
 #define        PCMCIA_PRODUCT_DLINK_DE650      0xffffffff
 #define        PCMCIA_STR_DLINK_DE650  "D-Link DE-650"
 #define        PCMCIA_CIS_INTERSIL2_PRISM2     { "INTERSIL", "HFA384x/IEEE", "Version 01.02", NULL }
 #define        PCMCIA_PRODUCT_INTERSIL2_PRISM2 0xffffffff
 #define        PCMCIA_STR_INTERSIL2_PRISM2     "Intersil Prism II"
-#define        PCMCIA_CIS_IODATA_CBIDE2        { "IO DATA", "CBIDE2      ", NULL, NULL }
-#define        PCMCIA_PRODUCT_IODATA_CBIDE2    0xffffffff
-#define        PCMCIA_STR_IODATA_CBIDE2        "IO-DATA CBIDE2/16-bit mode"
+#define        PCMCIA_CIS_IODATA3_CBIDE2       { "IO DATA", "CBIDE2      ", NULL, NULL }
+#define        PCMCIA_PRODUCT_IODATA3_CBIDE2   0xffffffff
+#define        PCMCIA_STR_IODATA3_CBIDE2       "IO-DATA CBIDE2/16-bit mode"
 #define        PCMCIA_CIS_IODATA3_CBSC16       { "IO DATA", "CBSC16       ", NULL, NULL }
 #define        PCMCIA_PRODUCT_IODATA3_CBSC16   0xffffffff
 #define        PCMCIA_STR_IODATA3_CBSC16       "IO-DATA CBSC16"
-#define        PCMCIA_CIS_IODATA_PCLAT { "I-O DATA", "PCLA", "ETHERNET", NULL }
-#define        PCMCIA_PRODUCT_IODATA_PCLAT     0xffffffff
-#define        PCMCIA_STR_IODATA_PCLAT "IO-DATA PCLA/T"
+#define        PCMCIA_CIS_IODATA3_PCLAT        { "I-O DATA", "PCLA", "ETHERNET", NULL }
+#define        PCMCIA_PRODUCT_IODATA3_PCLAT    0xffffffff
+#define        PCMCIA_STR_IODATA3_PCLAT        "IO-DATA PCLA/T"
 #define        PCMCIA_CIS_LANTECH_FASTNETTX    { "ASIX", "AX88190", NULL, NULL }
 #define        PCMCIA_PRODUCT_LANTECH_FASTNETTX        0xffffffff
 #define        PCMCIA_STR_LANTECH_FASTNETTX    "Lantech Fastnet/TX"
 #define        PCMCIA_CIS_LINKSYS_ECARD_2      { "LINKSYS", "E-CARD", NULL, NULL }
 #define        PCMCIA_PRODUCT_LINKSYS_ECARD_2  0xffffffff
 #define        PCMCIA_STR_LINKSYS_ECARD_2      "Linksys E-Card"
-#define        PCMCIA_CIS_LINKSYS_PCM100       { "Linksys", "EtherFast 10/100 Integrated PC Card (PCM100)", "Ver 1.0", NULL }
-#define        PCMCIA_PRODUCT_LINKSYS_PCM100   0xffffffff
-#define        PCMCIA_STR_LINKSYS_PCM100       ""
 #define        PCMCIA_CIS_MACNICA_MPS100       { "MACNICA", "MIRACLE SCSI", "mPS100", "D.0" }
 #define        PCMCIA_PRODUCT_MACNICA_MPS100   0xffffffff
 #define        PCMCIA_STR_MACNICA_MPS100       "Macnica Miracle SCSI mPS100"
 #define        PCMCIA_CIS_MELCO2_LPC2_TX       { "MELCO", "LPC2-TX", NULL, NULL }
 #define        PCMCIA_PRODUCT_MELCO2_LPC2_TX   0xffffffff
 #define        PCMCIA_STR_MELCO2_LPC2_TX       "Melco LPC2-TX"
-#define        PCMCIA_CIS_NAKAGAWAMETAL_LNT10TN        { "PCMCIA", "LNT-10TN", NULL, NULL }
-#define        PCMCIA_PRODUCT_NAKAGAWAMETAL_LNT10TN    0xffffffff
-#define        PCMCIA_STR_NAKAGAWAMETAL_LNT10TN        "NAKAGAWA METAL LNT-10TN NE2000 Compatible Card"
 #define        PCMCIA_CIS_NANOSPEED_PRISM2     { "NANOSPEED", "HFA384x/IEEE", "Version 01.02", NULL }
 #define        PCMCIA_PRODUCT_NANOSPEED_PRISM2 0xffffffff
 #define        PCMCIA_STR_NANOSPEED_PRISM2     "NANOSPEED ROOT-RZ2000 WLAN Card"
 #define        PCMCIA_CIS_OEM2_IDE     { "PCMCIA", "IDE CARD", NULL, NULL }
 #define        PCMCIA_PRODUCT_OEM2_IDE 0xffffffff
 #define        PCMCIA_STR_OEM2_IDE     "Generic PCMCIA IDE CARD"
+#define        PCMCIA_CIS_OEM2_ETHERNET        { "PCMCIA", "Ethernet", NULL, NULL }
+#define        PCMCIA_PRODUCT_OEM2_ETHERNET    0xffffffff
+#define        PCMCIA_STR_OEM2_ETHERNET        "NE2000 PC Card"
 #define        PCMCIA_CIS_PLANET_SMARTCOM2000  { "PCMCIA", "UE2212", NULL, NULL }
 #define        PCMCIA_PRODUCT_PLANET_SMARTCOM2000      0xffffffff
 #define        PCMCIA_STR_PLANET_SMARTCOM2000  "Planet SmartCOM 2000"
-/*
- * vendor ID of both FNW-3600-T and FNW-3700-T is LINKSYS (0x0149) and
- * product ID is 0xc1ab, but it conflicts with LINKSYS Combo EthernetCard.
- */
-#define        PCMCIA_CIS_PLANEX_FNW3600T      { NULL, NULL, NULL, NULL }
-#define        PCMCIA_PRODUCT_PLANEX_FNW3600T  -1
-#define        PCMCIA_STR_PLANEX_FNW3600T      "Planex FNW-3600-T"
-#define        PCMCIA_CIS_PLANEX_FNW3700T      { NULL, NULL, NULL, NULL }
-#define        PCMCIA_PRODUCT_PLANEX_FNW3700T  -1
-#define        PCMCIA_STR_PLANEX_FNW3700T      "Planex FNW-3700-T"
 #define        PCMCIA_CIS_RPTI_EP400   { "RPTI LTD.", "EP400", "CISV100", NULL }
 #define        PCMCIA_PRODUCT_RPTI_EP400       0xffffffff
 #define        PCMCIA_STR_RPTI_EP400   "RPTI EP400"
 #define        PCMCIA_CIS_RATOC_REX9530        { "RATOC System Inc.", "SCSI2 CARD 37", NULL, NULL }
 #define        PCMCIA_PRODUCT_RATOC_REX9530    0xffffffff
 #define        PCMCIA_STR_RATOC_REX9530        "RATOC REX-9530"
+#define        PCMCIA_CIS_RATOC_REX_CFU1       { "RATOC", "USB HOST CF+ Card", NULL, NULL }
+#define        PCMCIA_PRODUCT_RATOC_REX_CFU1   0xffffffff
+#define        PCMCIA_STR_RATOC_REX_CFU1       "RATOC REX-CFU1"
 #define        PCMCIA_CIS_SIMPLETECH_SPECTRUM24_ALT    { "Symbol Technologies", "LA4111 Spectrum24 Wireless LAN PC Card", NULL, NULL }
 #define        PCMCIA_PRODUCT_SIMPLETECH_SPECTRUM24_ALT        0xffffffff
 #define        PCMCIA_STR_SIMPLETECH_SPECTRUM24_ALT    "LA4111 Spectrum24 Wireless LAN PC Card"
 #define        PCMCIA_CIS_SMC_2632W    { "SMC", "SMC2632W", "Version 01.02", NULL }
 #define        PCMCIA_PRODUCT_SMC_2632W        0xffffffff
 #define        PCMCIA_STR_SMC_2632W    "SMC 2632 EZ Connect Wireless PC Card"
-#define        PCMCIA_CIS_SMC_8041     { "SMC", "8041TX-10/100-PC-Card-V2", NULL, NULL }
-#define        PCMCIA_PRODUCT_SMC_8041 0xffffffff
-#define        PCMCIA_STR_SMC_8041     "SMC 8041TX 10/100 PC Card"
+#define        PCMCIA_CIS_SMC_8000     { "SMC8000", "DEV1", NULL, NULL }
+#define        PCMCIA_PRODUCT_SMC_8000 0xffffffff
+#define        PCMCIA_STR_SMC_8000     ""
+#define        PCMCIA_CIS_SMC_8020BT   { "SMC" "EtherEZ Ethernet 8020", NULL, NULL }
+#define        PCMCIA_PRODUCT_SMC_8020BT       0xffffffff
+#define        PCMCIA_STR_SMC_8020BT   ""
+#define        PCMCIA_CIS_SMC_8020BTM  { "SMC", "EtherEZ Ethernet/Modem", "8020", NULL }
+#define        PCMCIA_PRODUCT_SMC_8020BTM      0xffffffff
+#define        PCMCIA_STR_SMC_8020BTM  ""
 #define        PCMCIA_CIS_SVEC_COMBOCARD       { "Ethernet", "Adapter", NULL, NULL }
 #define        PCMCIA_PRODUCT_SVEC_COMBOCARD   0xffffffff
 #define        PCMCIA_STR_SVEC_COMBOCARD       "SVEC/Hawking Tech. Combo Card"
 #define        PCMCIA_CIS_SVEC_LANCARD { "SVEC", "FD605 PCMCIA EtherNet Card", "V1-1", NULL }
 #define        PCMCIA_PRODUCT_SVEC_LANCARD     0xffffffff
 #define        PCMCIA_STR_SVEC_LANCARD "SVEC PCMCIA Lan Card"
-#define        PCMCIA_CIS_SYNERGY21_S21810     { "PCMCIA", "Ethernet", "A", "004743118001" }
-#define        PCMCIA_PRODUCT_SYNERGY21_S21810 0xffffffff
-#define        PCMCIA_STR_SYNERGY21_S21810     "Synergy 21 S21810+ NE2000 Compatible Card"
+#define        PCMCIA_CIS_TAMARACK_ETHERNET    { "TAMARACK", "Ethernet", NULL, NULL }
+#define        PCMCIA_PRODUCT_TAMARACK_ETHERNET        0xffffffff
+#define        PCMCIA_STR_TAMARACK_ETHERNET    "TAMARACK NE2000 PC Card"
 #define        PCMCIA_CIS_TEAC_IDECARDII       { NULL, "NinjaATA-", NULL, NULL }
 #define        PCMCIA_PRODUCT_TEAC_IDECARDII   0xffffffff
 #define        PCMCIA_STR_TEAC_IDECARDII       "TEAC IDE Card/II"
index f50352e..962104b 100644 (file)
@@ -1,8 +1,8 @@
 /*     $NetBSD: pcmciareg.h,v 1.7 1998/10/29 09:45:52 enami Exp $      */
-/* $FreeBSD: src/sys/dev/pccard/pccardreg.h,v 1.1 1999/10/26 06:52:31 imp Exp $ */
-/* $DragonFly: src/sys/bus/pccard/pccardreg.h,v 1.3 2004/02/10 07:55:45 joerg Exp $ */
+/* $FreeBSD: src/sys/dev/pccard/pccardreg.h,v 1.3 2005/01/06 01:43:03 imp Exp $ */
+/* $DragonFly: src/sys/bus/pccard/pccardreg.h,v 1.4 2007/07/05 12:08:53 sephe Exp $ */
 
-/*
+/*-
  * Copyright (c) 1997 Marc Horowitz.  All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-/* most of this is from the PCCARD PC Card Standard, Release 2.1 */
-
-/* Note: the weird indenting here is to make the constants more
-   readable.  Please don't normalize it.  --marc */
-
-/*
- * CIS Tuples */
-
-/* Layer 1 Basic Compatibility Tuples */
-#define        PCCARD_CISTPL_NULL                      0x00
-#define        PCCARD_CISTPL_DEVICE                    0x01
-#define        PCCARD_DTYPE_MASK                               0xF0
-#define        PCCARD_DTYPE_NULL                                       0x00
-#define        PCCARD_DTYPE_ROM                                        0x10
-#define        PCCARD_DTYPE_OTPROM                                     0x20
-#define        PCCARD_DTYPE_EPROM                                      0x30
-#define        PCCARD_DTYPE_EEPROM                                     0x40
-#define        PCCARD_DTYPE_FLASH                                      0x50
-#define        PCCARD_DTYPE_SRAM                                       0x60
-#define        PCCARD_DTYPE_DRAM                                       0x70
-#define        PCCARD_DTYPE_FUNCSPEC                                   0xD0
-#define        PCCARD_DTYPE_EXTEND                                     0xE0
-#define        PCCARD_DSPEED_MASK                              0x07
-#define        PCCARD_DSPEED_NULL                                      0x00
-#define        PCCARD_DSPEED_250NS                                     0x01
-#define        PCCARD_DSPEED_200NS                                     0x02
-#define        PCCARD_DSPEED_150NS                                     0x03
-#define        PCCARD_DSPEED_100NS                                     0x04
-#define        PCCARD_DSPEED_EXT                                       0x07
-
-/*
- * the 2.1 docs have 0x02-0x07 as reserved, but the linux drivers list the
- * follwing tuple code values.  I have at least one card (3com 3c562
- * lan+modem) which has a code 0x06 tuple, so I'm going to assume that these
- * are for real
- */
-
-#define        PCCARD_CISTPL_LONGLINK_CB               0x02
-#define        PCCARD_CISTPL_INDIRECT          0x03
-#define        PCCARD_CISTPL_CONFIG_CB                 0x04
-#define        PCCARD_CISTPL_CFTABLE_ENTRY_CB          0x05
-#define        PCCARD_CISTPL_LONGLINK_MFC              0x06
-#define        PCCARD_MFC_MEM_ATTR                             0x00
-#define        PCCARD_MFC_MEM_COMMON                           0x01
-#define        PCCARD_CISTPL_BAR                       0x07
-#define        PCCARD_CISTPL_PWR_MGMNT                 0x08
-
-#define        PCCARD_CISTPL_CHECKSUM                  0x10
-#define        PCCARD_CISTPL_LONGLINK_A                0x11
-#define        PCCARD_CISTPL_LONGLINK_C                0x12
-#define        PCCARD_CISTPL_LINKTARGET                0x13
-#define        PCCARD_CISTPL_NO_LINK                   0x14
-#define        PCCARD_CISTPL_VERS_1                    0x15
-#define        PCCARD_CISTPL_ALTSTR                    0x16
-#define        PCCARD_CISTPL_DEVICE_A                  0x17
-#define        PCCARD_CISTPL_JEDEC_C                   0x18
-#define        PCCARD_CISTPL_JEDEC_A                   0x19
-#define        PCCARD_CISTPL_CONFIG                    0x1A
-#define        PCCARD_TPCC_RASZ_MASK                           0x03
-#define        PCCARD_TPCC_RASZ_SHIFT                          0
-#define        PCCARD_TPCC_RMSZ_MASK                           0x3C
-#define        PCCARD_TPCC_RMSZ_SHIFT                          2
-#define        PCCARD_TPCC_RFSZ_MASK                           0xC0
-#define        PCCARD_TPCC_RFSZ_SHIFT                          6
-#define        PCCARD_CISTPL_CFTABLE_ENTRY             0x1B
-#define        PCCARD_TPCE_INDX_INTFACE                        0x80
-#define        PCCARD_TPCE_INDX_DEFAULT                        0x40
-#define        PCCARD_TPCE_INDX_NUM_MASK                       0x3F
-#define        PCCARD_TPCE_IF_MWAIT                            0x80
-#define        PCCARD_TPCE_IF_RDYBSY                           0x40
-#define        PCCARD_TPCE_IF_WP                               0x20
-#define        PCCARD_TPCE_IF_BVD                              0x10
-#define        PCCARD_TPCE_IF_IFTYPE                           0x0F
-#define        PCCARD_IFTYPE_MEMORY                                    0
-#define        PCCARD_IFTYPE_IO                                        1
-#define        PCCARD_TPCE_FS_MISC                             0x80
-#define        PCCARD_TPCE_FS_MEMSPACE_MASK                    0x60
-#define        PCCARD_TPCE_FS_MEMSPACE_NONE                            0x00
-#define        PCCARD_TPCE_FS_MEMSPACE_LENGTH                          0x20
-#define        PCCARD_TPCE_FS_MEMSPACE_LENGTHADDR                      0x40
-#define        PCCARD_TPCE_FS_MEMSPACE_TABLE                           0x60
-#define        PCCARD_TPCE_FS_IRQ                              0x10
-#define        PCCARD_TPCE_FS_IOSPACE                          0x08
-#define        PCCARD_TPCE_FS_TIMING                           0x04
-#define        PCCARD_TPCE_FS_POWER_MASK                       0x03
-#define        PCCARD_TPCE_FS_POWER_NONE                               0x00
-#define        PCCARD_TPCE_FS_POWER_VCC                                0x01
-#define        PCCARD_TPCE_FS_POWER_VCCVPP1                            0x02
-#define        PCCARD_TPCE_FS_POWER_VCCVPP1VPP2                        0x03
-#define        PCCARD_TPCE_TD_RESERVED_MASK                    0xE0
-#define        PCCARD_TPCE_TD_RDYBSY_MASK                      0x1C
-#define        PCCARD_TPCE_TD_WAIT_MASK                        0x03
-#define        PCCARD_TPCE_IO_HASRANGE                         0x80
-#define        PCCARD_TPCE_IO_BUSWIDTH_16BIT                   0x40
-#define        PCCARD_TPCE_IO_BUSWIDTH_8BIT                    0x20
-#define        PCCARD_TPCE_IO_IOADDRLINES_MASK                 0x1F
-#define        PCCARD_TPCE_IO_RANGE_LENGTHSIZE_MASK            0xC0
-#define        PCCARD_TPCE_IO_RANGE_LENGTHSIZE_NONE                    0x00
-#define        PCCARD_TPCE_IO_RANGE_LENGTHSIZE_ONE                     0x40
-#define        PCCARD_TPCE_IO_RANGE_LENGTHSIZE_TWO                     0x80
-#define        PCCARD_TPCE_IO_RANGE_LENGTHSIZE_FOUR                    0xC0
-#define        PCCARD_TPCE_IO_RANGE_ADDRSIZE_MASK              0x30
-#define        PCCARD_TPCE_IO_RANGE_ADDRSIZE_NONE                      0x00
-#define        PCCARD_TPCE_IO_RANGE_ADDRSIZE_ONE                       0x10
-#define        PCCARD_TPCE_IO_RANGE_ADDRSIZE_TWO                       0x20
-#define        PCCARD_TPCE_IO_RANGE_ADDRSIZE_FOUR                      0x30
-#define        PCCARD_TPCE_IO_RANGE_COUNT                      0x0F
-#define        PCCARD_TPCE_IR_SHARE                            0x80
-#define        PCCARD_TPCE_IR_PULSE                            0x40
-#define        PCCARD_TPCE_IR_LEVEL                            0x20
-#define        PCCARD_TPCE_IR_HASMASK                          0x10
-#define        PCCARD_TPCE_IR_IRQ                              0x0F
-#define        PCCARD_TPCE_MS_HOSTADDR                         0x80
-#define        PCCARD_TPCE_MS_CARDADDR_SIZE_MASK               0x60
-#define        PCCARD_TPCE_MS_CARDADDR_SIZE_SHIFT              5
-#define        PCCARD_TPCE_MS_LENGTH_SIZE_MASK                 0x18
-#define        PCCARD_TPCE_MS_LENGTH_SIZE_SHIFT                3
-#define        PCCARD_TPCE_MS_COUNT                            0x07
-#define        PCCARD_TPCE_MI_EXT                              0x80
-#define        PCCARD_TPCE_MI_RESERVED                         0x40
-#define        PCCARD_TPCE_MI_PWRDOWN                          0x20
-#define        PCCARD_TPCE_MI_READONLY                         0x10
-#define        PCCARD_TPCE_MI_AUDIO                            0x08
-#define        PCCARD_TPCE_MI_MAXTWINS                         0x07
-#define        PCCARD_CISTPL_DEVICE_OC                 0x1C
-#define        PCCARD_CISTPL_DEVICE_OA                 0x1D
-#define        PCCARD_CISTPL_DEVICE_GEO                0x1E
-#define        PCCARD_CISTPL_DEVICE_GEO_A              0x1F
-#define        PCCARD_CISTPL_MANFID                    0x20
-#define        PCCARD_CISTPL_FUNCID                    0x21
-#define        PCCARD_FUNCTION_UNSPEC          -1
-#define        PCCARD_FUNCTION_MULTIFUNCTION   0
-#define        PCCARD_FUNCTION_MEMORY          1
-#define        PCCARD_FUNCTION_SERIAL          2
-#define        PCCARD_FUNCTION_PARALLEL        3
-#define        PCCARD_FUNCTION_DISK            4
-#define        PCCARD_FUNCTION_VIDEO           5
-#define        PCCARD_FUNCTION_NETWORK         6
-#define        PCCARD_FUNCTION_AIMS            7
-#define        PCCARD_FUNCTION_SCSI            8
-#define        PCCARD_FUNCTION_SECURITY        9
-#define        PCCARD_FUNCTION_INSTRUMENT      10
-#define        PCCARD_CISTPL_FUNCE                     0x22
-#define        PCCARD_TPLFE_TYPE_LAN_TECH                      0x01
-#define        PCCARD_TPLFE_TYPE_LAN_SPEED                     0x02
-#define        PCCARD_TPLFE_TYPE_LAN_MEDIA                     0x03
-#define        PCCARD_TPLFE_TYPE_LAN_NID                       0x04
-#define        PCCARD_TPLFE_TYPE_LAN_CONN                      0x05
-#define        PCCARD_TPLFE_TYPE_DISK_DEVICE_INTERFACE         0x01
-#define        PCCARD_TPLFE_DDI_PCCARD_ATA                             0x01
-#define        PCCARD_CISTPL_END                       0xFF
-
-/* Layer 2 Data Recording Format Tuples */
-
-#define        PCCARD_CISTPL_SWIL                      0x23
-/* #define     PCCARD_CISTPL_RESERVED          0x24-0x3F */
-#define        PCCARD_CISTPL_VERS_2                    0x40
-#define        PCCARD_CISTPL_FORMAT                    0x41
-#define        PCCARD_CISTPL_GEOMETRY                  0x42
-#define        PCCARD_CISTPL_BYTEORDER                 0x43
-#define        PCCARD_CISTPL_DATE                      0x44
-#define        PCCARD_CISTPL_BATTERY                   0x45
-#define        PCCARD_CISTPL_FORAMT_A                  0x47
-
-/* Layer 3 Data Organization Tuples */
-
-#define        PCCARD_CISTPL_ORG                       0x46
-/* #define     PCCARD_CISTPL_RESERVED          0x47-0x7F */
-
-/* Layer 4 System-Specific Standard Tuples */
-
-/* #define     PCCARD_CISTPL_RESERVED          0x80-0x8F */
-#define        PCCARD_CISTPL_SPCL                      0x90
-/* #define     PCCARD_CISTPL_RESERVED          0x90-0xFE */
-
 /*
  * Card Configuration Registers
  */
index 8abd494..cb8dbc0 100644 (file)
@@ -1,8 +1,8 @@
 /*     $NetBSD: pcmciavar.h,v 1.12 2000/02/08 12:51:31 enami Exp $     */
-/* $FreeBSD: src/sys/dev/pccard/pccardvar.h,v 1.34 2002/11/14 05:15:50 imp Exp $ */
-/* $DragonFly: src/sys/bus/pccard/pccardvar.h,v 1.6 2006/10/25 20:55:51 dillon Exp $ */
+/* $FreeBSD: src/sys/dev/pccard/pccardvar.h,v 1.54 2005/07/13 15:00:59 imp Exp $ */
+/* $DragonFly: src/sys/bus/pccard/pccardvar.h,v 1.7 2007/07/05 12:08:53 sephe Exp $ */
 
-/*
+/*-
  * Copyright (c) 1997 Marc Horowitz.  All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-#include <sys/types.h>
-#include <sys/queue.h>
-#include <sys/bus_dma.h>
-
 extern int     pccard_verbose;
 
+/*
+ * PCCARD_API_LEVEL.  When set to 5, we provide a 5.x compatable API
+ * for driver writers that have to share their code between 5.x and 6.x.
+ * The 5.x compatibility interfaces will be unsupported in 7.0, at which
+ * point we'll only support 6 and newer, etc.
+ */
+#ifndef PCCARD_API_LEVEL
+#define PCCARD_API_LEVEL 5
+#elif PCCARD_API_LEVEL < 5
+#error "pccard API less than 5 unsupported"
+#endif
+
 /*
  * Contains information about mapped/allocated i/o spaces.
  */
@@ -60,7 +68,6 @@ struct pccard_mem_handle {
        bus_addr_t      addr;           /* resulting address in bus space */
        bus_size_t      size;           /* size of mem space */
        bus_size_t      realsize;       /* how much we really allocated */
-       long            offset;         /* mapped Offset on card */
        bus_addr_t      cardaddr;       /* Absolute address on card */
        int             kind;
 };
@@ -82,7 +89,7 @@ struct pccard_mem_handle {
 
 struct pccard_config_entry {
        int             number;
-       u_int32_t       flags;
+       uint32_t        flags;
        int             iftype;
        int             num_iospace;
 
@@ -96,7 +103,7 @@ struct pccard_config_entry {
                u_long  length;
                u_long  start;
        } iospace[4];           /* XXX this could be as high as 16 */
-       u_int16_t       irqmask;
+       uint16_t        irqmask;
        int             num_memspace;
        struct {
                u_long  length;
@@ -104,12 +111,6 @@ struct pccard_config_entry {
                u_long  hostaddr;
        } memspace[2];          /* XXX this could be as high as 8 */
        int             maxtwins;
-       struct resource *iores[4];
-       int             iorid[4];
-       struct resource *irqres;
-       int             irqrid;
-       struct resource *memres[2];
-       int             memrid[2];
        STAILQ_ENTRY(pccard_config_entry) cfe_list;
 };
 
@@ -119,7 +120,7 @@ struct pccard_funce_disk {
 
 struct pccard_funce_lan {
        int pfl_nidlen;
-       u_int8_t pfl_nid[8];
+       uint8_t pfl_nid[8];
 };
 
 union pccard_funce {
@@ -148,8 +149,8 @@ struct pccard_function {
 #define        pf_ccr_realsize pf_pcmh.realsize
        uint32_t        pf_ccr_offset;  /* Offset from ccr_base of CIS */
        int             pf_ccr_window;
-       long            pf_mfc_iobase;  /* Right type? */
-       long            pf_mfc_iomax;
+       bus_addr_t      pf_mfc_iobase;
+       bus_addr_t      pf_mfc_iomax;
        int             pf_flags;
        driver_intr_t   *intr_handler;
        void            *intr_handler_arg;
@@ -180,14 +181,11 @@ struct pccard_card {
        int32_t         product;
 #define        PCMCIA_PRODUCT_INVALID          -1
        int16_t         prodext;
-       u_int16_t       error;
+       uint16_t        error;
 #define        PCMCIA_CIS_INVALID              { NULL, NULL, NULL, NULL }
        STAILQ_HEAD(, pccard_function) pf_head;
 };
 
-#define        PCCARD_MEM_ATTR         1
-#define        PCCARD_MEM_COMMON       2
-
 #define        PCCARD_WIDTH_AUTO       0
 #define        PCCARD_WIDTH_IO8        1
 #define        PCCARD_WIDTH_IO16       2
@@ -195,7 +193,7 @@ struct pccard_card {
 /* More later? */
 struct pccard_ivar {
        struct resource_list resources;
-       struct pccard_function *fcn;
+       struct pccard_function *pf;
 };
 
 struct pccard_softc {
@@ -207,9 +205,6 @@ struct pccard_softc {
        int             sc_enabled_count;       /* num functions enabled */
 };
 
-void
-pccardbus_if_setup(struct pccard_softc*);
-
 struct pccard_cis_quirk {
        int32_t manufacturer;
        int32_t product;
@@ -227,13 +222,14 @@ struct pccard_tuple {
        bus_space_handle_t memh;
 };
 
+typedef int (*pccard_scan_t)(const struct pccard_tuple *, void *);
+
 struct pccard_product {
        const char      *pp_name;               /* NULL if end of table */
-#define PCCARD_VENDOR_ANY ((u_int32_t) -1)
-       u_int32_t       pp_vendor;
-#define PCCARD_PRODUCT_ANY ((u_int32_t) -1)
-       u_int32_t       pp_product;
-       int             pp_expfunc;
+#define PCCARD_VENDOR_ANY (0xffffffff)
+       uint32_t        pp_vendor;
+#define PCCARD_PRODUCT_ANY (0xffffffff)
+       uint32_t        pp_product;
        const char      *pp_cis[4];
 };
 
@@ -257,8 +253,7 @@ pccard_product_lookup(device_t dev, const struct pccard_product *tab,
 void   pccard_read_cis(struct pccard_softc *);
 void   pccard_check_cis_quirks(device_t);
 void   pccard_print_cis(device_t);
-int    pccard_scan_cis(device_t, 
-               int (*) (struct pccard_tuple *, void *), void *);
+int    pccard_scan_cis(device_t, pccard_scan_t, void *);
 
 #define        pccard_cis_read_1(tuple, idx0)                                  \
        (bus_space_read_1((tuple)->memt, (tuple)->memh, (tuple)->mult*(idx0)))
@@ -290,7 +285,8 @@ int pccard_scan_cis(device_t,
 #define        PCCARD_SPACE_MEMORY     1
 #define        PCCARD_SPACE_IO         2
 
-#define        pccard_mfc(sc)  (STAILQ_FIRST(&(sc)->card.pf_head) &&           \
+#define        pccard_mfc(sc)                                                  \
+               (STAILQ_FIRST(&(sc)->card.pf_head) &&                   \
                 STAILQ_NEXT(STAILQ_FIRST(&(sc)->card.pf_head),pf_list))
 
 #define        pccard_io_alloc(pf, start, size, align, pciop)                  \
@@ -347,15 +343,15 @@ pccard_get_ ## A(device_t dev)                                            \
 {                                                                      \
        uintptr_t v;                                                    \
        BUS_READ_IVAR(device_get_parent(dev), dev, PCCARD_IVAR_ ## B, &v); \
-       return (T) v;                                                   \
+       return (T)v;                                                    \
 }
 
-PCCARD_ACCESSOR(ether,         ETHADDR,                u_int8_t *)
-PCCARD_ACCESSOR(vendor,                VENDOR,                 u_int32_t)
-PCCARD_ACCESSOR(product,       PRODUCT,                u_int32_t)
-PCCARD_ACCESSOR(prodext,       PRODEXT,                u_int16_t)
-PCCARD_ACCESSOR(function_number,FUNCTION_NUMBER,       u_int32_t)
-PCCARD_ACCESSOR(function,      FUNCTION,               u_int32_t)
+PCCARD_ACCESSOR(ether,         ETHADDR,                uint8_t *)
+PCCARD_ACCESSOR(vendor,                VENDOR,                 uint32_t)
+PCCARD_ACCESSOR(product,       PRODUCT,                uint32_t)
+PCCARD_ACCESSOR(prodext,       PRODEXT,                uint16_t)
+PCCARD_ACCESSOR(function_number,FUNCTION_NUMBER,       uint32_t)
+PCCARD_ACCESSOR(function,      FUNCTION,               uint32_t)
 PCCARD_ACCESSOR(vendor_str,    VENDOR_STR,             const char *)
 PCCARD_ACCESSOR(product_str,   PRODUCT_STR,            const char *)
 PCCARD_ACCESSOR(cis3_str,      CIS3_STR,               const char *)
@@ -375,9 +371,26 @@ enum {
 #define PCCARD_S(a, b) PCMCIA_STR_ ## a ## _ ## b
 #define PCCARD_P(a, b) PCMCIA_PRODUCT_ ## a ## _ ## b
 #define PCCARD_C(a, b) PCMCIA_CIS_ ## a ## _ ## b
-#define PCMCIA_CARD(v, p, f) { PCCARD_S(v, p), PCMCIA_VENDOR_ ## v, \
-               PCCARD_P(v, p), f, PCCARD_C(v, p) }
-#define PCMCIA_CARD2(v1, p1, p2, f) \
+#if PCCARD_API_LEVEL >= 6
+#define PCMCIA_CARD_D(v, p) { PCCARD_S(v, p), PCMCIA_VENDOR_ ## v, \
+               PCCARD_P(v, p), PCCARD_C(v, p) }
+#define PCMCIA_CARD2_D(v1, p1, p2) \
                { PCMCIA_STR_ ## p2, PCMCIA_VENDOR_ ## v1, PCCARD_P(v1, p1), \
-                 f, PCMCIA_CIS_ ## p2}
-
+                 PCMCIA_CIS_ ## p2}
+#define PCMCIA_CARD(v, p) { NULL, PCMCIA_VENDOR_ ## v, \
+               PCCARD_P(v, p), PCCARD_C(v, p) }
+#define PCMCIA_CARD2(v1, p1, p2) \
+               { NULL, PCMCIA_VENDOR_ ## v1, PCCARD_P(v1, p1), \
+                 PCMCIA_CIS_ ## p2}
+#else
+#define PCMCIA_CARD_D(v, p, f) { PCCARD_S(v, p), PCMCIA_VENDOR_ ## v, \
+               PCCARD_P(v, p), PCCARD_C(v, p) }
+#define PCMCIA_CARD2_D(v1, p1, p2, f) \
+               { PCMCIA_STR_ ## p2, PCMCIA_VENDOR_ ## v1, PCCARD_P(v1, p1), \
+                 PCMCIA_CIS_ ## p2}
+#define PCMCIA_CARD(v, p, f) { NULL, PCMCIA_VENDOR_ ## v, \
+               PCCARD_P(v, p), PCCARD_C(v, p) }
+#define PCMCIA_CARD2(v1, p1, p2, f) \
+               { NULL, PCMCIA_VENDOR_ ## v1, PCCARD_P(v1, p1), \
+                 PCMCIA_CIS_ ## p2}
+#endif
index 4eef372..6ea6bf9 100644 (file)
@@ -1,4 +1,4 @@
-#
+#-
 # Copyright (c) 1999 M. Warner Losh.
 # All rights reserved.
 #
@@ -23,8 +23,8 @@
 # OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 # SUCH DAMAGE.
 #
-# $FreeBSD: src/sys/dev/pccard/power_if.m,v 1.3 2000/04/16 06:04:13 imp Exp $
-# $DragonFly: src/sys/bus/pccard/power_if.m,v 1.1 2004/02/10 07:55:45 joerg Exp $
+# $FreeBSD: src/sys/dev/pccard/power_if.m,v 1.4 2005/01/06 01:43:03 imp Exp $
+# $DragonFly: src/sys/bus/pccard/power_if.m,v 1.2 2007/07/05 12:08:53 sephe Exp $
 #
 
 #include <sys/bus.h>
diff --git a/sys/bus/pccard/slot.h b/sys/bus/pccard/slot.h
deleted file mode 100644 (file)
index 3d2ee49..0000000
+++ /dev/null
@@ -1,136 +0,0 @@
-/*
- *     Slot structures for PC-CARD interface.
- *     Each slot has a controller specific structure
- *     attached to it. A slot number allows
- *     mapping from the character device to the
- *     slot structure. This is separate to the
- *     controller slot number to allow multiple controllers
- *     to be accessed.
- *-------------------------------------------------------------------------
- *
- * Copyright (c) 1995 Andrew McRae.  All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- * 3. The name of the author may not be used to endorse or promote products
- *    derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- * $FreeBSD: src/sys/pccard/slot.h,v 1.25.2.5 2002/09/22 20:26:58 imp Exp $
- * $DragonFly: src/sys/bus/pccard/Attic/slot.h,v 1.7 2006/10/25 20:55:51 dillon Exp $
- */
-
-#ifndef _PCCARD_SLOT_H
-#define _PCCARD_SLOT_H
-
-/*
- * Normally we shouldn't include stuff here, but we're trying to be
- * compatible with the long, dark hand of the past.
- */
-#include <sys/param.h>
-#include <sys/bus.h>
-#include <sys/rman.h>
-#include <sys/selinfo.h>
-
-/*
- *     Controller data - Specific to each slot controller.
- */
-struct slot;
-struct slot_ctrl {
-       void    (*mapirq)(struct slot *, int);
-                               /* Map irq */
-       int     (*mapmem)(struct slot *, int);
-                               /* Map memory */
-       int     (*mapio)(struct slot *, int);
-                               /* Map io */
-       void    (*reset)(void *);
-                               /* init */
-       void    (*disable)(struct slot *);
-                               /* Disable slot */
-       int     (*power)(struct slot *);
-                               /* Set power values */
-       int     (*ioctl)(struct slot *, int, caddr_t);
-                               /* ioctl to lower level */
-       void    (*resume)(struct slot *);
-                               /* suspend/resume support */
-       int     maxmem;         /* Number of allowed memory windows */
-       int     maxio;          /* Number of allowed I/O windows */
-};
-
-/*
- *     Device structure for cards. Each card may have one
- *     or more pccard drivers attached to it; each driver is assumed
- *     to require at most one interrupt handler, one I/O block
- *     and one memory block. This structure is used to link the different
- *     devices together.
- */
-struct pccard_devinfo {
-       uint8_t         name[128];
-       int             running;        /* Current state of driver */
-       uint8_t         misc[DEV_MISC_LEN]; /* For any random info */
-       uint8_t         manufstr[DEV_MAX_CIS_LEN];
-       uint8_t         versstr[DEV_MAX_CIS_LEN];
-       uint32_t        manufacturer;   /* Manufacturer ID */
-       uint32_t        product;        /* Product ID */
-       uint32_t        prodext;        /* Product ID (extended) */
-       struct slot     *slt;           /* Back pointer to slot */
-       struct resource_list resources;
-};
-
-/*
- *     Per-slot structure.
- */
-struct slot {
-       int slotnum;                    /* Slot number */
-       int flags;                      /* Slot flags (see below) */
-       int rwmem;                      /* Read/write flags */
-       int irq;                        /* IRQ allocated (0 = none) */
-
-       /*
-        *      flags.
-        */
-       unsigned int    insert_seq;     /* Firing up under the card */
-#if 0
-       struct callout  insert_ch;      /* Insert event timeout handle */
-       struct callout  poff_ch;        /* Power Off timeout handle */
-#endif
-
-       enum cardstate  state, laststate; /* Current/last card states */
-       struct selinfo  selp;           /* Info for select */
-       struct mem_desc mem[NUM_MEM_WINDOWS];   /* Memory windows */
-       struct io_desc  io[NUM_IO_WINDOWS];     /* I/O windows */
-       struct power    pwr;            /* Power values */
-       struct slot_ctrl *ctrl;         /* Per-controller data */
-       void            *cdata;         /* Controller specific data */
-       int             pwr_off_pending;/* Power status of slot */
-       device_t        dev;            /* Config system device. */
-       cdev_t          d;              /* fs device */
-};
-
-#define PCCARD_DEVICE2SOFTC(d) ((struct slot *) device_get_softc(d))
-#define PCCARD_DEV2SOFTC(d)    ((struct slot *) (d)->si_drv1)
-
-enum card_event { card_removed, card_inserted, card_deactivated };
-
-struct slot    *pccard_init_slot(device_t, struct slot_ctrl *);
-void            pccard_event(struct slot *, enum card_event);
-int             pccard_suspend(device_t);
-int             pccard_resume(device_t);
-
-#endif /* !_PCCARD_SLOT_H */
index 2ba5d64..ca7f1c0 100644 (file)
@@ -24,7 +24,7 @@
  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  *
  * $FreeBSD: src/sys/pci/pci.c,v 1.141.2.15 2002/04/30 17:48:18 tmm Exp $
- * $DragonFly: src/sys/bus/pci/pci.c,v 1.39 2007/06/02 18:48:40 dillon Exp $
+ * $DragonFly: src/sys/bus/pci/pci.c,v 1.40 2007/07/05 12:08:53 sephe Exp $
  *
  */
 
@@ -2127,7 +2127,7 @@ static device_method_t pci_methods[] = {
        { 0, 0 }
 };
 
-static driver_t pci_driver = {
+driver_t pci_driver = {
        "pci",
        pci_methods,
        1,                      /* no softc */
index 7d18a63..5ab5e7a 100644 (file)
@@ -1,5 +1,5 @@
 # $FreeBSD: src/sys/conf/files,v 1.340.2.137 2003/06/04 17:10:30 sam Exp $
-# $DragonFly: src/sys/conf/files,v 1.165 2007/06/26 19:30:46 dillon Exp $
+# $DragonFly: src/sys/conf/files,v 1.166 2007/07/05 12:08:53 sephe Exp $
 #
 # The long compile-with and dependency lines are required because of
 # limitations in config: backslash-newline doesn't work in strings, and
@@ -107,6 +107,8 @@ dev/raid/aac/aac_cam.c                      optional aacp aac
 
 
 dev/pccard/pccbb/pccbb.c               optional cbb
+dev/pccard/pccbb/pccbb_isa.c           optional cbb isa
+dev/pccard/pccbb/pccbb_pci.c           optional cbb pci
 dev/pccard/cardbus/cardbus.c           optional cardbus
 dev/pccard/cardbus/cardbus_cis.c       optional cardbus
 dev/pccard/exca/exca.c                 optional cbb
@@ -1043,7 +1045,6 @@ bus/pccard/card_if.m              standard
 bus/pccard/pccard.c            optional pccard
 bus/pccard/pccard_cis.c                optional pccard
 bus/pccard/pccard_cis_quirks.c optional pccard
-bus/pccard/pccard_beep.c       optional pccard
 bus/pccard/power_if.m          standard
 dev/agp/agp.c                  optional agp
 dev/agp/agp_intel.c            optional agp
index 6d8263d..ef912af 100644 (file)
@@ -26,7 +26,7 @@
  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  *
  * $FreeBSD: src/sys/dev/ata/ata-card.c,v 1.4.2.1 2002/03/18 08:37:33 sos Exp $
- * $DragonFly: src/sys/dev/disk/ata/ata-card.c,v 1.6 2006/10/25 20:55:53 dillon Exp $
+ * $DragonFly: src/sys/dev/disk/ata/ata-card.c,v 1.7 2007/07/05 12:08:53 sephe Exp $
  */
 
 #include <sys/param.h>
@@ -40,6 +40,7 @@
 #include <machine/stdarg.h>
 #include "ata-all.h"
 
+#include <bus/pccard/pccard_cis.h>
 #include <bus/pccard/pccardreg.h>
 #include <bus/pccard/pccardvar.h>
 #include <bus/pccard/pccarddevs.h>
@@ -47,7 +48,7 @@
 static const struct pccard_product ata_pccard_products[] = {
        PCMCIA_CARD(FREECOM, PCCARDIDE, 0),
        PCMCIA_CARD(EXP, EXPMULTIMEDIA, 0),
-       PCMCIA_CARD(IODATA, CBIDE2, 0),
+       PCMCIA_CARD(IODATA3, CBIDE2, 0),
        PCMCIA_CARD(OEM2, CDROM1, 0),
        PCMCIA_CARD(OEM2, IDE, 0),
        PCMCIA_CARD(PANASONIC, KXLC005, 0),
index 27baf79..9199b6a 100644 (file)
@@ -24,7 +24,7 @@
  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  *
  * $FreeBSD: src/sys/dev/ata/ata-card.c,v 1.39 2006/01/05 21:27:19 sos Exp $
- * $DragonFly: src/sys/dev/disk/nata/ata-card.c,v 1.2 2006/12/05 19:28:14 tgen Exp $
+ * $DragonFly: src/sys/dev/disk/nata/ata-card.c,v 1.3 2007/07/05 12:08:53 sephe Exp $
  */
 
 #include "opt_ata.h"
@@ -35,6 +35,7 @@
 #include <sys/nata.h>
 #include <sys/rman.h>
 
+#include <bus/pccard/pccard_cis.h>
 #include <bus/pccard/pccardreg.h>
 #include <bus/pccard/pccardvar.h>
 #include <bus/pccard/pccarddevs.h>
@@ -45,7 +46,7 @@
 static const struct pccard_product ata_pccard_products[] = {
        PCMCIA_CARD(FREECOM, PCCARDIDE, 0),
        PCMCIA_CARD(EXP, EXPMULTIMEDIA, 0),
-       PCMCIA_CARD(IODATA, CBIDE2, 0),
+       PCMCIA_CARD(IODATA3, CBIDE2, 0),
        PCMCIA_CARD(OEM2, CDROM1, 0),
        PCMCIA_CARD(OEM2, IDE, 0),
        PCMCIA_CARD(PANASONIC, KXLC005, 0),
index 48a9d5b..63c6c6b 100644 (file)
@@ -1,5 +1,5 @@
 /*     $FreeBSD: src/sys/dev/ncv/ncr53c500_pccard.c,v 1.2.2.5 2001/12/17 13:30:18 non Exp $    */
-/*     $DragonFly: src/sys/dev/disk/ncv/ncr53c500_pccard.c,v 1.14 2007/05/17 21:08:47 dillon Exp $     */
+/*     $DragonFly: src/sys/dev/disk/ncv/ncr53c500_pccard.c,v 1.15 2007/07/05 12:08:53 sephe Exp $      */
 /*     $NecBSD: ncr53c500_pisa.c,v 1.28 1998/11/26 01:59:11 honda Exp $        */
 /*     $NetBSD$        */
 
@@ -51,6 +51,7 @@
 
 #include "dvcfg.h"
 
+#include <sys/rman.h>
 #include <sys/device_port.h>
 
 #include <bus/pccard/pccarddevs.h>
@@ -68,8 +69,6 @@
 
 #include       <sys/kernel.h>
 #include       <sys/module.h>
-#include       <bus/pccard/cardinfo.h>
-#include       <bus/pccard/slot.h>
 
 static int ncvprobe(DEVPORT_PDEVICE devi);
 static int ncvattach(DEVPORT_PDEVICE devi);
index dc5482d..1809b93 100644 (file)
@@ -1,5 +1,5 @@
 /*     $FreeBSD: src/sys/dev/nsp/nsp_pccard.c,v 1.2.2.6 2001/12/17 13:30:19 non Exp $  */
-/*     $DragonFly: src/sys/dev/disk/nsp/nsp_pccard.c,v 1.12 2007/05/17 21:08:48 dillon Exp $   */
+/*     $DragonFly: src/sys/dev/disk/nsp/nsp_pccard.c,v 1.13 2007/07/05 12:08:53 sephe Exp $    */
 /*     $NecBSD: nsp_pisa.c,v 1.4 1999/04/15 01:35:54 kmatsuda Exp $    */
 /*     $NetBSD$        */
 
@@ -47,6 +47,7 @@
 
 #include <vm/vm.h>
 
+#include <sys/rman.h>
 #include <sys/device_port.h>
 
 #include <bus/pccard/pccarddevs.h>
@@ -65,8 +66,6 @@
 #if !defined(__FreeBSD__) || __FreeBSD_version < 500014
 #include       <sys/select.h>
 #endif
-#include       <bus/pccard/cardinfo.h>
-#include       <bus/pccard/slot.h>
 
 #define        PIO_MODE 0x100          /* pd_flags */
 
index 22482db..080167b 100644 (file)
@@ -1,5 +1,5 @@
 /*     $FreeBSD: src/sys/dev/stg/tmc18c30_pccard.c,v 1.2.2.6 2001/12/17 13:30:19 non Exp $     */
-/*     $DragonFly: src/sys/dev/disk/stg/tmc18c30_pccard.c,v 1.13 2007/05/17 21:08:49 dillon Exp $      */
+/*     $DragonFly: src/sys/dev/disk/stg/tmc18c30_pccard.c,v 1.14 2007/07/05 12:08:53 sephe Exp $       */
 /*     $NecBSD: tmc18c30_pisa.c,v 1.22 1998/11/26 01:59:21 honda Exp $ */
 /*     $NetBSD$        */
 
@@ -51,6 +51,7 @@
 
 #include <vm/vm.h>
 
+#include <sys/rman.h>
 #include <sys/device_port.h>
 
 #include <bus/pccard/pccarddevs.h>
@@ -66,8 +67,6 @@
 
 #include       <sys/kernel.h>
 #include       <sys/module.h>
-#include       <bus/pccard/cardinfo.h>
-#include       <bus/pccard/slot.h>
 
 static const struct pccard_product stg_products[] = {
        PCMCIA_CARD(FUTUREDOMAIN, SCSI2GO, 0),
index bb06055..86faeb4 100644 (file)
@@ -25,7 +25,7 @@
  * SUCH DAMAGE.
  *
  * $FreeBSD: src/sys/dev/cs/if_cs_isa.c,v 1.1.2.1 2001/01/25 20:13:48 imp Exp $
- * $DragonFly: src/sys/dev/netif/cs/if_cs_isa.c,v 1.8 2006/10/25 20:55:56 dillon Exp $
+ * $DragonFly: src/sys/dev/netif/cs/if_cs_isa.c,v 1.9 2007/07/05 12:08:53 sephe Exp $
  */
 
 #include <sys/param.h>
@@ -91,3 +91,4 @@ static driver_t cs_isa_driver = {
 extern devclass_t cs_devclass;
 
 DRIVER_MODULE(if_cs, isa, cs_isa_driver, cs_devclass, 0, 0);
+MODULE_DEPEND(if_cs, isa, 1, 1, 1);
index f04d3ae..8cb0921 100644 (file)
@@ -25,7 +25,7 @@
  * SUCH DAMAGE.
  *
  * $FreeBSD: src/sys/dev/ed/if_ed_pccard.c,v 1.55 2003/12/31 04:25:00 kato Exp $
- * $DragonFly: src/sys/dev/netif/ed/if_ed_pccard.c,v 1.18 2006/12/22 23:26:19 swildner Exp $
+ * $DragonFly: src/sys/dev/netif/ed/if_ed_pccard.c,v 1.19 2007/07/05 12:08:53 sephe Exp $
  */
 
 #include "opt_ed.h"
@@ -48,6 +48,7 @@
 
 #include "if_edreg.h"
 #include "if_edvar.h"
+#include <bus/pccard/pccard_cis.h>
 #include <bus/pccard/pccardvar.h>
 #include <bus/pccard/pccarddevs.h>
 #ifndef ED_NO_MIIBUS
@@ -143,7 +144,6 @@ static const struct ed_product {
        { PCMCIA_CARD(COREGA, FETHER_PCC_TXF, 0), NE2000DVF_DL10019 },
        { PCMCIA_CARD(DAYNA, COMMUNICARD_E_1, 0), 0},
        { PCMCIA_CARD(DAYNA, COMMUNICARD_E_2, 0), 0},
-       { PCMCIA_CARD(DIGITAL, DEPCMXX, 0), 0 },
        { PCMCIA_CARD(DLINK, DE650, 0), 0},
        { PCMCIA_CARD(DLINK, DE660, 0), 0 },
        { PCMCIA_CARD(DLINK, DE660PLUS, 0), 0},
@@ -153,25 +153,25 @@ static const struct ed_product {
        { PCMCIA_CARD(EPSON, EEN10B, 0), 0},
        { PCMCIA_CARD(EXP, THINLANCOMBO, 0), 0},
        { PCMCIA_CARD(IBM, INFOMOVER, 0), 0},
-       { PCMCIA_CARD(IODATA, PCLAT, 0), 0},
-       { PCMCIA_CARD(IODATA, PCLATE, 0), 0},
+       { PCMCIA_CARD(IODATA3, PCLAT, 0), 0},
        { PCMCIA_CARD(KINGSTON, KNE2, 0), 0},
        { PCMCIA_CARD(LANTECH, FASTNETTX, 0),NE2000DVF_AX88190 },
        { PCMCIA_CARD(LINKSYS, COMBO_ECARD, 0), NE2000DVF_DL10019 },
        { PCMCIA_CARD(LINKSYS, ECARD_1, 0), 0},
        { PCMCIA_CARD(LINKSYS, ECARD_2, 0), 0},
        { PCMCIA_CARD(LINKSYS, ETHERFAST, 0), NE2000DVF_DL10019 },
-       { PCMCIA_CARD(LINKSYS, PCM100, 0), 0},
        { PCMCIA_CARD(LINKSYS, TRUST_COMBO_ECARD, 0), 0},
-       { PCMCIA_CARD(LINKSYS, ETHERFAST, 0), NE2000DVF_DL10019 },
        { PCMCIA_CARD(MACNICA, ME1_JEIDA, 0), 0},
        { PCMCIA_CARD(MELCO, LPC3_CLX,  0), NE2000DVF_AX88190},
        { PCMCIA_CARD(MELCO, LPC3_TX, 0), NE2000DVF_AX88190 },
        { PCMCIA_CARD(NDC, ND5100_E, 0), 0},
        { PCMCIA_CARD(NETGEAR, FA410TXC, 0), NE2000DVF_DL10019},
        { PCMCIA_CARD(NETGEAR, FA411, 0), NE2000DVF_AX88190},
+       { PCMCIA_CARD(NEXTCOM, NEXTHAWK, 0), 0},
+       { PCMCIA_CARD(OEM2, ETHERNET, 0), 0},
        { PCMCIA_CARD(PLANET, SMARTCOM2000, 0), 0 },
        { PCMCIA_CARD(PREMAX, PE200, 0), 0},
+       { PCMCIA_CARD(RACORE, ETHERNET, 0), 0},
        { PCMCIA_CARD(RPTI, EP400, 0), 0},
        { PCMCIA_CARD(RPTI, EP401, 0), 0},
        { PCMCIA_CARD(SMC, EZCARD, 0), 0},
@@ -181,7 +181,7 @@ static const struct ed_product {
        { PCMCIA_CARD(SOCKET, LP_ETH_10_100_CF, 0), NE2000DVF_DL10019},
        { PCMCIA_CARD(SVEC, COMBOCARD, 0), 0},
        { PCMCIA_CARD(SVEC, LANCARD, 0), 0},
-       { PCMCIA_CARD(SYNERGY21, S21810, 0), 0},
+       { PCMCIA_CARD(TAMARACK, ETHERNET, 0), 0},
        { PCMCIA_CARD(TDK, LAK_CD031, 0), 0},
        { PCMCIA_CARD(TELECOMDEVICE, TCD_HPC100, 0), NE2000DVF_AX88190 },
        { PCMCIA_CARD(XIRCOM, CFE_10, 0), 0},
index cfeb722..a5d7731 100644 (file)
@@ -20,7 +20,7 @@
  * SUCH DAMAGE.
  *
  * $FreeBSD: src/sys/dev/fe/if_fe_pccard.c,v 1.2.2.1 2000/09/22 10:01:47 nyan Exp $
- * $DragonFly: src/sys/dev/netif/fe/if_fe_pccard.c,v 1.12 2006/11/07 06:43:23 dillon Exp $
+ * $DragonFly: src/sys/dev/netif/fe/if_fe_pccard.c,v 1.13 2007/07/05 12:08:53 sephe Exp $
  */
 
 #include "opt_fe.h"
@@ -48,7 +48,6 @@
 
 #include <bus/pccard/pccardvar.h>
 #include <bus/pccard/pccarddevs.h>
-#include <bus/pccard/cardinfo.h>
 
 #include "card_if.h"
 
index 012ef55..e902d86 100644 (file)
@@ -30,7 +30,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  *
  * $FreeBSD: src/sys/dev/wi/if_wi_pccard.c,v 1.47 2004/06/09 06:31:40 imp Exp $
- * $DragonFly: src/sys/dev/netif/wi/if_wi_pccard.c,v 1.10 2006/10/25 20:55:59 dillon Exp $
+ * $DragonFly: src/sys/dev/netif/wi/if_wi_pccard.c,v 1.11 2007/07/05 12:08:53 sephe Exp $
  */
 
 /*
@@ -63,6 +63,7 @@
 #include <netproto/802_11/ieee80211_radiotap.h>
 #include <netproto/802_11/if_wavelan_ieee.h>
 
+#include <bus/pccard/pccard_cis.h>
 #include <bus/pccard/pccardreg.h>
 #include <bus/pccard/pccardvar.h>
 #include <bus/pccard/pccarddevs.h>
@@ -134,8 +135,9 @@ static const struct pccard_product wi_pccard_products[] = {
        PCMCIA_CARD(GEMTEK, WLAN, 0),
        PCMCIA_CARD(HWN, AIRWAY80211, 0), 
        PCMCIA_CARD(INTEL, PRO_WLAN_2011, 0),
-       PCMCIA_CARD(INTERSIL, MA401RA, 0),
-       PCMCIA_CARD(INTERSIL, DWL650, 0),
+       PCMCIA_CARD(INTERSIL, ISL37100P, 0),
+       PCMCIA_CARD(INTERSIL, ISL37110P, 0),
+       PCMCIA_CARD(INTERSIL, ISL37300P, 0),
        PCMCIA_CARD(INTERSIL2, PRISM2, 0),
        PCMCIA_CARD(IODATA2, WCF12, 0),
        PCMCIA_CARD(IODATA2, WNB11PCM, 0),
@@ -144,7 +146,7 @@ static const struct pccard_product wi_pccard_products[] = {
        PCMCIA_CARD(MICROSOFT, MN_520, 0),
        PCMCIA_CARD(NOKIA, C020_WLAN, 0),
        PCMCIA_CARD(NOKIA, C110_WLAN, 0),
-       PCMCIA_CARD(PLANEX_2, GWNS11H, 0),
+       PCMCIA_CARD(PLANEX, GWNS11H, 0),
        PCMCIA_CARD(PROXIM, HARMONY, 0),
        PCMCIA_CARD(PROXIM, RANGELANDS_8430, 0),
        PCMCIA_CARD(SAMSUNG, SWL_2000N, 0),
index 13d9460..5c6c41f 100644 (file)
@@ -26,7 +26,7 @@
  * xe pccard interface driver
  *
  * $FreeBSD: src/sys/dev/xe/if_xe_pccard.c,v 1.11 2003/10/14 22:51:35 rsm Exp $
- * $DragonFly: src/sys/dev/netif/xe/if_xe_pccard.c,v 1.3 2006/10/25 20:56:00 dillon Exp $
+ * $DragonFly: src/sys/dev/netif/xe/if_xe_pccard.c,v 1.4 2007/07/05 12:08:53 sephe Exp $
  */
 
 #include <sys/param.h>
 #endif
 
 static const struct pccard_product xe_pccard_products[] = {
-       PCMCIA_CARD(ACCTON, EN2226, 0),
+       PCMCIA_CARD(COMPAQ, CPQ550, 0),
        PCMCIA_CARD(COMPAQ2, CPQ_10_100, 0),
        PCMCIA_CARD(INTEL, EEPRO100, 0),
+       PCMCIA_CARD(RACORE, ACCTON_EN2226, 0),
        PCMCIA_CARD(XIRCOM, CE, 0),
        PCMCIA_CARD(XIRCOM, CE2, 0),
        PCMCIA_CARD(XIRCOM, CE3, 0),
index 03e087b..ce16c28 100644 (file)
@@ -1,23 +1,21 @@
-/*
- * Copyright (c) 2000,2001 Jonathan Chen.
- * All rights reserved.
+/*-
+ * Copyright (c) 2003 M. Warner Losh.  All Rights Reserved.
+ * Copyright (c) 2000,2001 Jonathan Chen.  All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
  * are met:
  * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions, and the following disclaimer,
- *    without modification, immediately at the beginning of the file.
+ *    notice, this list of conditions and the following disclaimer.
  * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in
- *    the documentation and/or other materials provided with the
- *    distribution.
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
  *
  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR
- * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
@@ -26,7 +24,7 @@
  * SUCH DAMAGE.
  *
  * $FreeBSD: src/sys/dev/cardbus/cardbus.c,v 1.28 2002/11/27 17:30:41 imp Exp $
- * $DragonFly: src/sys/dev/pccard/cardbus/cardbus.c,v 1.10 2006/12/22 23:26:22 swildner Exp $
+ * $DragonFly: src/sys/dev/pccard/cardbus/cardbus.c,v 1.11 2007/07/05 12:08:54 sephe Exp $
  */
 
 /*
 #include <sys/param.h>
 #include <sys/systm.h>
 #include <sys/malloc.h>
+#include <sys/module.h>
 #include <sys/kernel.h>
 #include <sys/sysctl.h>
+
 #include <sys/bus.h>
 #include <sys/rman.h>
 
@@ -54,6 +54,7 @@
 #include <dev/pccard/cardbus/cardbusreg.h>
 #include <dev/pccard/cardbus/cardbusvar.h>
 #include <dev/pccard/cardbus/cardbus_cis.h>
+#include <bus/pccard/pccard_cis.h>
 #include <bus/pccard/pccardvar.h>
 
 #include "power_if.h"
@@ -78,75 +79,301 @@ SYSCTL_INT(_hw_cardbus, OID_AUTO, cis_debug, CTLFLAG_RW,
 #define        DEVPRINTF(x) if (cardbus_debug) device_printf x
 
 
-static struct resource *cardbus_alloc_resource(device_t cbdev, device_t child,
-                   int type, int *rid, u_long start, u_long end, u_long count,
-                   u_int flags);
+static void    cardbus_add_map(device_t cbdev, device_t child, int reg);
+static int     cardbus_alloc_resources(device_t cbdev, device_t child);
 static int     cardbus_attach(device_t cbdev);
 static int     cardbus_attach_card(device_t cbdev);
-static int     cardbus_child_location_str(device_t cbdev, device_t child,
-                   char *, size_t len);
-static int     cardbus_child_pnpinfo_str(device_t cbdev, device_t child,
-                   char *, size_t len);
-static __inline void cardbus_clear_command_bit(device_t cbdev, device_t child,
-                   u_int16_t bit);
-static void    cardbus_delete_resource(device_t cbdev, device_t child,
-                   int type, int rid);
-static void    cardbus_delete_resource_method(device_t cbdev, device_t child,
-                   int type, int rid);
+static int     cardbus_barsort(const void *a, const void *b);
 static int     cardbus_detach(device_t cbdev);
 static int     cardbus_detach_card(device_t cbdev);
 static void    cardbus_device_setup_regs(device_t brdev, int b, int s, int f,
                    pcicfgregs *cfg);
-static void    cardbus_disable_busmaster_method(device_t cbdev, device_t child);
-static void    cardbus_disable_io_method(device_t cbdev, device_t child,
-                   int space);
 static void    cardbus_driver_added(device_t cbdev, driver_t *driver);
-static void    cardbus_enable_busmaster_method(device_t cbdev, device_t child);
-static void    cardbus_enable_io_method(device_t cbdev, device_t child,
-                   int space);
-static int     cardbus_freecfg(struct cardbus_devinfo *dinfo);
-static int     cardbus_get_powerstate_method(device_t cbdev, device_t child);
-static int     cardbus_get_resource(device_t cbdev, device_t child, int type,
-                   int rid, u_long *startp, u_long *countp);
-static int     cardbus_get_resource_method(device_t cbdev, device_t child,
-                   int type, int rid, u_long *startp, u_long *countp);
-static void    cardbus_hdrtypedata(device_t brdev, int b, int s, int f,
-                   pcicfgregs *cfg);
-static int     cardbus_print_child(device_t cbdev, device_t child);
-static int     cardbus_print_resources(struct resource_list *rl,
-                   const char *name, int type, const char *format);
-static void    cardbus_print_verbose(struct cardbus_devinfo *dinfo);
+static void    cardbus_pickup_maps(device_t cbdev, device_t child);
 static int     cardbus_probe(device_t cbdev);
-static void    cardbus_probe_nomatch(device_t cbdev, device_t child);
-static struct cardbus_devinfo  *cardbus_read_device(device_t brdev, int b,
-                   int s, int f);
-static void    cardbus_read_extcap(device_t cbdev, pcicfgregs *cfg);
-static u_int32_t cardbus_read_config_method(device_t cbdev,
-                   device_t child, int reg, int width);
 static int     cardbus_read_ivar(device_t cbdev, device_t child, int which,
-                   u_long *result);
+                   uintptr_t *result);
 static void    cardbus_release_all_resources(device_t cbdev,
                    struct cardbus_devinfo *dinfo);
-static int     cardbus_release_resource(device_t cbdev, device_t child,
-                   int type, int rid, struct resource *r);
-static __inline void cardbus_set_command_bit(device_t cbdev, device_t child,
-                   u_int16_t bit);
-static int     cardbus_set_powerstate_method(device_t cbdev, device_t child,
-                   int state);
-static int     cardbus_set_resource(device_t cbdev, device_t child, int type,
-                   int rid, u_long start, u_long count, struct resource *res);
-static int     cardbus_set_resource_method(device_t cbdev, device_t child,
-                   int type, int rid, u_long start, u_long count);
-static int     cardbus_setup_intr(device_t cbdev, device_t child,
-                   struct resource *irq, int flags, driver_intr_t *intr,
-                   void *arg, void **cookiep, lwkt_serialize_t);
-static int     cardbus_teardown_intr(device_t cbdev, device_t child,
-                   struct resource *irq, void *cookie);
-static void    cardbus_write_config_method(device_t cbdev, device_t child,
-                   int reg, u_int32_t val, int width);
 static int     cardbus_write_ivar(device_t cbdev, device_t child, int which,
                    uintptr_t value);
 
+/*
+ * Resource allocation
+ */
+/*
+ * Adding a memory/io resource (sans CIS)
+ */
+
+static void
+cardbus_add_map(device_t cbdev, device_t child, int reg)
+{
+       struct cardbus_devinfo *dinfo = device_get_ivars(child);
+       struct resource_list_entry *rle;
+       uint32_t size;
+       uint32_t testval;
+       int type;
+
+       SLIST_FOREACH(rle, &dinfo->pci.resources, link) {
+               if (rle->rid == reg)
+                       return;
+       }
+
+       if (reg == CARDBUS_ROM_REG)
+               testval = CARDBUS_ROM_ADDRMASK;
+       else
+               testval = ~0;
+
+       pci_write_config(child, reg, testval, 4);
+       testval = pci_read_config(child, reg, 4);
+
+       if (testval == ~0 || testval == 0)
+               return;
+
+       if ((testval & 1) == 0)
+               type = SYS_RES_MEMORY;
+       else
+               type = SYS_RES_IOPORT;
+
+       size = CARDBUS_MAPREG_MEM_SIZE(testval);
+       device_printf(cbdev, "Resource not specified in CIS: id=%x, size=%x\n",
+           reg, size);
+       resource_list_add(&dinfo->pci.resources, type, reg, 0UL, ~0UL, size);
+}
+
+static void
+cardbus_pickup_maps(device_t cbdev, device_t child)
+{
+       struct cardbus_devinfo *dinfo = device_get_ivars(child);
+       int reg;
+
+       /*
+        * Try to pick up any resources that was not specified in CIS.
+        * Maybe this isn't any longer necessary now that we have fixed
+        * CIS parsing and we should filter things here?  XXX
+        */
+       for (reg = 0; reg < dinfo->pci.cfg.nummaps; reg++)
+               cardbus_add_map(cbdev, child, PCIR_BAR(reg));
+}
+
+static void
+cardbus_do_res(struct resource_list_entry *rle, device_t child, uint32_t start)
+{
+       rle->start = start;
+       rle->end = start + rle->count - 1;
+       pci_write_config(child, rle->rid, rle->start, 4);
+}
+
+static int
+cardbus_barsort(const void *a, const void *b)
+{
+       return ((*(const struct resource_list_entry * const *)b)->count -
+           (*(const struct resource_list_entry * const *)a)->count);
+}
+
+/* XXX this function is too long */
+static int
+cardbus_alloc_resources(device_t cbdev, device_t child)
+{
+       struct cardbus_devinfo *dinfo = device_get_ivars(child);
+       int count;
+       struct resource_list_entry *rle;
+       struct resource_list_entry **barlist;
+       int tmp;
+       uint32_t mem_psize = 0, mem_nsize = 0, io_size = 0;
+       struct resource *res;
+       uint32_t start,end;
+       int rid, flags;
+
+       count = 0;
+       SLIST_FOREACH(rle, &dinfo->pci.resources, link) {
+               count++;
+       }
+       if (count == 0)
+               return (0);
+       barlist = kmalloc(sizeof(struct resource_list_entry*) * count, M_DEVBUF,
+           M_WAITOK);
+       count = 0;
+       SLIST_FOREACH(rle, &dinfo->pci.resources, link) {
+               barlist[count] = rle;
+               if (rle->type == SYS_RES_IOPORT) {
+                       io_size += rle->count;
+               } else if (rle->type == SYS_RES_MEMORY) {
+                       if (dinfo->mprefetchable & BARBIT(rle->rid))
+                               mem_psize += rle->count;
+                       else
+                               mem_nsize += rle->count;
+               }
+               count++;
+       }
+
+       /*
+        * We want to allocate the largest resource first, so that our
+        * allocated memory is packed.
+        */
+       kqsort(barlist, count, sizeof(struct resource_list_entry *),
+           cardbus_barsort);
+
+       /* Allocate prefetchable memory */
+       flags = 0;
+       for (tmp = 0; tmp < count; tmp++) {
+               rle = barlist[tmp];
+               if (rle->res == NULL &&
+                   rle->type == SYS_RES_MEMORY &&
+                   dinfo->mprefetchable & BARBIT(rle->rid)) {
+                       flags = rman_make_alignment_flags(rle->count);
+                       break;
+               }
+       }
+       if (flags > 0) { /* If any prefetchable memory is requested... */
+               /*
+                * First we allocate one big space for all resources of this
+                * type.  We do this because our parent, pccbb, needs to open
+                * a window to forward all addresses within the window, and
+                * it would be best if nobody else has resources allocated
+                * within the window.
+                * (XXX: Perhaps there might be a better way to do this?)
+                */
+               rid = 0;
+               res = bus_alloc_resource(cbdev, SYS_RES_MEMORY, &rid, 0,
+                   (dinfo->mprefetchable & dinfo->mbelow1mb)?0xFFFFF:~0UL,
+                   mem_psize, flags);
+               if (res == NULL) {
+                       device_printf(cbdev,
+                           "Can't get memory for prefetch mem\n");
+                       kfree(barlist, M_DEVBUF);
+                       return (EIO);
+               }
+               start = rman_get_start(res);
+               end = rman_get_end(res);
+               DEVPRINTF((cbdev, "Prefetchable memory at %x-%x\n", start, end));
+               /*
+                * Now that we know the region is free, release it and hand it
+                * out piece by piece.
+                */
+               bus_release_resource(cbdev, SYS_RES_MEMORY, rid, res);
+               for (tmp = 0; tmp < count; tmp++) {
+                       rle = barlist[tmp];
+                       if (rle->type == SYS_RES_MEMORY &&
+                           dinfo->mprefetchable & BARBIT(rle->rid)) {
+                               cardbus_do_res(rle, child, start);
+                               start += rle->count;
+                       }
+               }
+       }
+
+       /* Allocate non-prefetchable memory */
+       flags = 0;
+       for (tmp = 0; tmp < count; tmp++) {
+               rle = barlist[tmp];
+               if (rle->type == SYS_RES_MEMORY &&
+                   (dinfo->mprefetchable & BARBIT(rle->rid)) == 0) {
+                       flags = rman_make_alignment_flags(rle->count);
+                       break;
+               }
+       }
+       if (flags > 0) { /* If any non-prefetchable memory is requested... */
+               /*
+                * First we allocate one big space for all resources of this
+                * type.  We do this because our parent, pccbb, needs to open
+                * a window to forward all addresses within the window, and
+                * it would be best if nobody else has resources allocated
+                * within the window.
+                * (XXX: Perhaps there might be a better way to do this?)
+                */
+               rid = 0;
+               res = bus_alloc_resource(cbdev, SYS_RES_MEMORY, &rid, 0,
+                   ((~dinfo->mprefetchable) & dinfo->mbelow1mb)?0xFFFFF:~0UL,
+                   mem_nsize, flags);
+               if (res == NULL) {
+                       device_printf(cbdev,
+                           "Can't get memory for non-prefetch mem\n");
+                       kfree(barlist, M_DEVBUF);
+                       return (EIO);
+               }
+               start = rman_get_start(res);
+               end = rman_get_end(res);
+               DEVPRINTF((cbdev, "Non-prefetchable memory at %x-%x\n",
+                   start, end));
+               /*
+                * Now that we know the region is free, release it and hand it
+                * out piece by piece.
+                */
+               bus_release_resource(cbdev, SYS_RES_MEMORY, rid, res);
+               for (tmp = 0; tmp < count; tmp++) {
+                       rle = barlist[tmp];
+                       if (rle->type == SYS_RES_MEMORY &&
+                           (dinfo->mprefetchable & BARBIT(rle->rid)) == 0) {
+                               cardbus_do_res(rle, child, start);
+                               start += rle->count;
+                       }
+               }
+       }
+
+       /* Allocate IO ports */
+       flags = 0;
+       for (tmp = 0; tmp < count; tmp++) {
+               rle = barlist[tmp];
+               if (rle->type == SYS_RES_IOPORT) {
+                       flags = rman_make_alignment_flags(rle->count);
+                       break;
+               }
+       }
+       if (flags > 0) { /* If any IO port is requested... */
+               /*
+                * First we allocate one big space for all resources of this
+                * type.  We do this because our parent, pccbb, needs to open
+                * a window to forward all addresses within the window, and
+                * it would be best if nobody else has resources allocated
+                * within the window.
+                * (XXX: Perhaps there might be a better way to do this?)
+                */
+               rid = 0;
+               res = bus_alloc_resource(cbdev, SYS_RES_IOPORT, &rid, 0,
+                   (dinfo->ibelow1mb)?0xFFFFF:~0UL, io_size, flags);
+               if (res == NULL) {
+                       device_printf(cbdev,
+                           "Can't get memory for IO ports\n");
+                       kfree(barlist, M_DEVBUF);
+                       return (EIO);
+               }
+               start = rman_get_start(res);
+               end = rman_get_end(res);
+               DEVPRINTF((cbdev, "IO port at %x-%x\n", start, end));
+               /*
+                * Now that we know the region is free, release it and hand it
+                * out piece by piece.
+                */
+               bus_release_resource(cbdev, SYS_RES_IOPORT, rid, res);
+               for (tmp = 0; tmp < count; tmp++) {
+                       rle = barlist[tmp];
+                       if (rle->type == SYS_RES_IOPORT) {
+                               cardbus_do_res(rle, child, start);
+                               start += rle->count;
+                       }
+               }
+       }
+
+       /* Allocate IRQ */
+       rid = 0;
+       res = bus_alloc_resource_any(cbdev, SYS_RES_IRQ, &rid, RF_SHAREABLE);
+       if (res == NULL) {
+               device_printf(cbdev, "Can't get memory for irq\n");
+               kfree(barlist, M_DEVBUF);
+               return (EIO);
+       }
+       start = rman_get_start(res);
+       end = rman_get_end(res);
+       bus_release_resource(cbdev, SYS_RES_IRQ, rid, res);
+       resource_list_add(&dinfo->pci.resources, SYS_RES_IRQ, rid, start, end,
+           1);
+       dinfo->pci.cfg.intline = rman_get_start(res);
+       pci_write_config(child, PCIR_INTLINE, rman_get_start(res), 1);
+
+       kfree(barlist, M_DEVBUF);
+       return (0);
+}
+
 /************************************************************************/
 /* Probe/Attach                                                                */
 /************************************************************************/
@@ -212,33 +439,22 @@ static int
 cardbus_attach_card(device_t cbdev)
 {
        device_t brdev = device_get_parent(cbdev);
+       device_t child;
        int cardattached = 0;
-       static int curr_bus_number = 2; /* XXX EVILE BAD (see below) */
        int bus, slot, func;
 
        cardbus_detach_card(cbdev); /* detach existing cards */
-
        POWER_ENABLE_SOCKET(brdev, cbdev);
        bus = pcib_get_bus(brdev);
-       if (bus == 0) {
-               /*
-                * XXX EVILE BAD XXX
-                * Not all BIOSes initialize the secondary bus number properly,
-                * so if the default is bad, we just put one in and hope it
-                * works.
-                */
-               bus = curr_bus_number;
-               pci_write_config(brdev, PCIR_SECBUS_2, curr_bus_number, 1);
-               pci_write_config(brdev, PCIR_SUBBUS_2, curr_bus_number + 2, 1);
-               curr_bus_number += 3;
-       }
        /* For each function, set it up and try to attach a driver to it */
        for (slot = 0; slot <= CARDBUS_SLOTMAX; slot++) {
                int cardbusfunchigh = 0;
                for (func = 0; func <= cardbusfunchigh; func++) {
-                       struct cardbus_devinfo *dinfo =
-                           cardbus_read_device(brdev, bus, slot, func);
+                       struct cardbus_devinfo *dinfo;
 
+                       dinfo = (struct cardbus_devinfo *)
+                           pci_read_device(brdev, bus, slot, func,
+                               sizeof(struct cardbus_devinfo));
                        if (dinfo == NULL)
                                continue;
                        if (dinfo->pci.cfg.mfdev)
@@ -246,17 +462,24 @@ cardbus_attach_card(device_t cbdev)
 
                        cardbus_device_setup_regs(brdev, bus, slot, func,
                            &dinfo->pci.cfg);
-                       cardbus_print_verbose(dinfo);
-                       dinfo->pci.cfg.dev = device_add_child(cbdev, NULL, -1);
-                       if (!dinfo->pci.cfg.dev) {
+                       child = device_add_child(cbdev, NULL, -1);
+                       if (child == NULL) {
                                DEVPRINTF((cbdev, "Cannot add child!\n"));
-                               cardbus_freecfg(dinfo);
+                               pci_freecfg((struct pci_devinfo *)dinfo);
                                continue;
                        }
+                       dinfo->pci.cfg.dev = child;
                        resource_list_init(&dinfo->pci.resources);
-                       device_set_ivars(dinfo->pci.cfg.dev, dinfo);
-                       cardbus_do_cis(cbdev, dinfo->pci.cfg.dev);
-                       if (device_probe_and_attach(dinfo->pci.cfg.dev) != 0)
+                       device_set_ivars(child, dinfo);
+                       if (cardbus_do_cis(cbdev, child) != 0) {
+                               DEVPRINTF((cbdev, "Can't parse cis\n"));
+                               pci_freecfg((struct pci_devinfo *)dinfo);
+                               continue;
+                       }
+                       cardbus_pickup_maps(cbdev, child);
+                       cardbus_alloc_resources(cbdev, child);
+                       pci_print_verbose(&dinfo->pci);
+                       if (device_probe_and_attach(child) != 0)
                                cardbus_release_all_resources(cbdev, dinfo);
                        else
                                cardattached++;
@@ -294,7 +517,7 @@ cardbus_detach_card(device_t cbdev)
                        device_detach(devlist[tmp]);
                cardbus_release_all_resources(cbdev, dinfo);
                device_delete_child(cbdev, devlist[tmp]);
-               cardbus_freecfg(dinfo);
+               pci_freecfg((struct pci_devinfo *)dinfo);
        }
        POWER_DISABLE_SOCKET(device_get_parent(cbdev), cbdev);
        kfree(devlist, M_TEMP);
@@ -306,348 +529,37 @@ cardbus_driver_added(device_t cbdev, driver_t *driver)
 {
        int numdevs;
        device_t *devlist;
-       int tmp;
+       device_t dev;
+       int i;
        struct cardbus_devinfo *dinfo;
 
-       device_get_children(cbdev, &devlist, &numdevs);
-
        DEVICE_IDENTIFY(driver, cbdev);
-       POWER_ENABLE_SOCKET(device_get_parent(cbdev), cbdev);
-       for (tmp = 0; tmp < numdevs; tmp++) {
-               if (device_get_state(devlist[tmp]) == DS_NOTPRESENT) {
-                       dinfo = device_get_ivars(devlist[tmp]);
-#ifdef notyet
-                       cardbus_device_setup_regs(brdev, bus, slot, func,
-                           &dinfo->pci.cfg);
-#endif
-                       cardbus_print_verbose(dinfo);
-                       resource_list_init(&dinfo->pci.resources);
-                       cardbus_do_cis(cbdev, dinfo->pci.cfg.dev);
-                       if (device_probe_and_attach(dinfo->pci.cfg.dev) != 0) {
-                               cardbus_release_all_resources(cbdev, dinfo);
-                       }
-               }
-       }
-
-       kfree(devlist, M_TEMP);
-}
-
-/************************************************************************/
-/* PCI-Like config reading (copied from pci.c                          */
-/************************************************************************/
-
-/* read configuration header into pcicfgrect structure */
-
-static void
-cardbus_read_extcap(device_t cbdev, pcicfgregs *cfg)
-{
-#define        REG(n, w) PCIB_READ_CONFIG(cbdev, cfg->bus, cfg->slot, cfg->func, n, w)
-       int ptr, nextptr, ptrptr;
-
-       switch (cfg->hdrtype) {
-       case 0:
-               ptrptr = 0x34;
-               break;
-       case 2:
-               ptrptr = 0x14;
-               break;
-       default:
-               return;         /* no extended capabilities support */
-       }
-       nextptr = REG(ptrptr, 1);       /* sanity check? */
-
+       device_get_children(cbdev, &devlist, &numdevs);
        /*
-        * Read capability entries.
+        * If there are no drivers attached, but there are children,
+        * then power the card up.
         */
-       while (nextptr != 0) {
-               /* Sanity check */
-               if (nextptr > 255) {
-                       kprintf("illegal PCI extended capability offset %d\n",
-                           nextptr);
-                       return;
-               }
-               /* Find the next entry */
-               ptr = nextptr;
-               nextptr = REG(ptr + 1, 1);
-
-               /* Process this entry */
-               switch (REG(ptr, 1)) {
-               case 0x01:              /* PCI power management */
-                       if (cfg->pp_cap == 0) {
-                               cfg->pp_cap = REG(ptr + PCIR_POWER_CAP, 2);
-                               cfg->pp_status = ptr + PCIR_POWER_STATUS;
-                               cfg->pp_pmcsr = ptr + PCIR_POWER_PMCSR;
-                               if ((nextptr - ptr) > PCIR_POWER_DATA)
-                                       cfg->pp_data = ptr + PCIR_POWER_DATA;
-                       }
-                       break;
-               default:
-                       break;
-               }
+       for (i = 0; i < numdevs; i++) {
+               dev = devlist[i];
+               if (device_get_state(dev) != DS_NOTPRESENT)
+                   break;
        }
-#undef REG
-}
-
-/* extract header type specific config data */
-
-static void
-cardbus_hdrtypedata(device_t brdev, int b, int s, int f, pcicfgregs *cfg)
-{
-#define        REG(n, w)       PCIB_READ_CONFIG(brdev, b, s, f, n, w)
-       switch (cfg->hdrtype) {
-       case 0:
-               cfg->subvendor  = REG(PCIR_SUBVEND_0, 2);
-               cfg->subdevice  = REG(PCIR_SUBDEV_0, 2);
-               cfg->nummaps    = PCI_MAXMAPS_0;
-               break;
-       case 1:
-               cfg->subvendor  = REG(PCIR_SUBVEND_1, 2);
-               cfg->subdevice  = REG(PCIR_SUBDEV_1, 2);
-               cfg->nummaps    = PCI_MAXMAPS_1;
-               break;
-       case 2:
-               cfg->subvendor  = REG(PCIR_SUBVEND_2, 2);
-               cfg->subdevice  = REG(PCIR_SUBDEV_2, 2);
-               cfg->nummaps    = PCI_MAXMAPS_2;
-               break;
-       }
-#undef REG
-}
-
-static struct cardbus_devinfo *
-cardbus_read_device(device_t brdev, int b, int s, int f)
-{
-#define        REG(n, w)       PCIB_READ_CONFIG(brdev, b, s, f, n, w)
-       pcicfgregs *cfg = NULL;
-       struct cardbus_devinfo *devlist_entry = NULL;
-
-       if (REG(PCIR_DEVVENDOR, 4) != 0xffffffff) {
-               devlist_entry = kmalloc(sizeof(struct cardbus_devinfo),
-                   M_DEVBUF, M_WAITOK | M_ZERO);
-               if (devlist_entry == NULL)
-                       return (NULL);
-
-               cfg = &devlist_entry->pci.cfg;
-
-               cfg->bus                = b;
-               cfg->slot               = s;
-               cfg->func               = f;
-               cfg->vendor             = REG(PCIR_VENDOR, 2);
-               cfg->device             = REG(PCIR_DEVICE, 2);
-               cfg->cmdreg             = REG(PCIR_COMMAND, 2);
-               cfg->statreg            = REG(PCIR_STATUS, 2);
-               cfg->baseclass          = REG(PCIR_CLASS, 1);
-               cfg->subclass           = REG(PCIR_SUBCLASS, 1);
-               cfg->progif             = REG(PCIR_PROGIF, 1);
-               cfg->revid              = REG(PCIR_REVID, 1);
-               cfg->hdrtype            = REG(PCIR_HDRTYPE, 1);
-               cfg->cachelnsz          = REG(PCIR_CACHELNSZ, 1);
-               cfg->lattimer           = REG(PCIR_LATTIMER, 1);
-               cfg->intpin             = REG(PCIR_INTPIN, 1);
-               cfg->intline            = REG(PCIR_INTLINE, 1);
-
-               cfg->mingnt             = REG(PCIR_MINGNT, 1);
-               cfg->maxlat             = REG(PCIR_MAXLAT, 1);
-
-               cfg->mfdev              = (cfg->hdrtype & PCIM_MFDEV) != 0;
-               cfg->hdrtype            &= ~PCIM_MFDEV;
-
-               cardbus_hdrtypedata(brdev, b, s, f, cfg);
-
-               if (REG(PCIR_STATUS, 2) & PCIM_STATUS_CAPPRESENT)
-                       cardbus_read_extcap(brdev, cfg);
-
-               devlist_entry->pci.conf.pc_sel.pc_bus = cfg->bus;
-               devlist_entry->pci.conf.pc_sel.pc_dev = cfg->slot;
-               devlist_entry->pci.conf.pc_sel.pc_func = cfg->func;
-               devlist_entry->pci.conf.pc_hdr = cfg->hdrtype;
-
-               devlist_entry->pci.conf.pc_subvendor = cfg->subvendor;
-               devlist_entry->pci.conf.pc_subdevice = cfg->subdevice;
-               devlist_entry->pci.conf.pc_vendor = cfg->vendor;
-               devlist_entry->pci.conf.pc_device = cfg->device;
-
-               devlist_entry->pci.conf.pc_class = cfg->baseclass;
-               devlist_entry->pci.conf.pc_subclass = cfg->subclass;
-               devlist_entry->pci.conf.pc_progif = cfg->progif;
-               devlist_entry->pci.conf.pc_revid = cfg->revid;
-       }
-       return (devlist_entry);
-#undef REG
-}
-
-/* free pcicfgregs structure and all depending data structures */
-
-static int
-cardbus_freecfg(struct cardbus_devinfo *dinfo)
-{
-       kfree(dinfo, M_DEVBUF);
-
-       return (0);
-}
-
-static void
-cardbus_print_verbose(struct cardbus_devinfo *dinfo)
-{
-       if (bootverbose || cardbus_debug > 0)
-       {
-               pcicfgregs *cfg = &dinfo->pci.cfg;
-
-               kprintf("found->\tvendor=0x%04x, dev=0x%04x, revid=0x%02x\n",
-                   cfg->vendor, cfg->device, cfg->revid);
-               kprintf("\tclass=[%s]%02x-%02x-%02x, hdrtype=0x%02x, mfdev=%d\n",
-                   pci_class_to_string(cfg->baseclass),
-                   cfg->baseclass, cfg->subclass, cfg->progif,
-                   cfg->hdrtype, cfg->mfdev);
-               kprintf("\tcmdreg=0x%04x, statreg=0x%04x, "
-                   "cachelnsz=%d (dwords)\n",
-                   cfg->cmdreg, cfg->statreg, cfg->cachelnsz);
-               kprintf("\tlattimer=0x%02x (%d ns), mingnt=0x%02x (%d ns), "
-                   "maxlat=0x%02x (%d ns)\n",
-                   cfg->lattimer, cfg->lattimer * 30,
-                   cfg->mingnt, cfg->mingnt * 250, cfg->maxlat,
-                   cfg->maxlat * 250);
-               if (cfg->intpin > 0)
-                       kprintf("\tintpin=%c, irq=%d\n",
-                           cfg->intpin + 'a' - 1, cfg->intline);
-       }
-}
-
-/************************************************************************/
-/* Resources                                                           */
-/************************************************************************/
-
-static int
-cardbus_set_resource(device_t cbdev, device_t child, int type, int rid,
-    u_long start, u_long count, struct resource *res)
-{
-       struct cardbus_devinfo *dinfo;
-       struct resource_list *rl;
-       struct resource_list_entry *rle;
-
-       if (device_get_parent(child) != cbdev)
-               return ENOENT;
-
-       dinfo = device_get_ivars(child);
-       rl = &dinfo->pci.resources;
-       rle = resource_list_find(rl, type, rid);
-       if (rle == NULL) {
-               resource_list_add(rl, type, rid, start, start + count - 1,
-                   count);
-               if (res != NULL) {
-                       rle = resource_list_find(rl, type, rid);
-                       rle->res = res;
-               }
-       } else {
-               if (rle->res == NULL) {
-               } else if (rle->res->r_dev == cbdev &&
-                   (!(rman_get_flags(rle->res) & RF_ACTIVE))) {
-                       int f;
-                       f = rman_get_flags(rle->res);
-                       bus_release_resource(cbdev, type, rid, res);
-                       rle->res = bus_alloc_resource(cbdev, type, &rid,
-                           start, start + count - 1,
-                           count, f);
-               } else {
-                       device_printf(cbdev, "set_resource: resource busy\n");
-                       return EBUSY;
-               }
-               rle->start = start;
-               rle->end = start + count - 1;
-               rle->count = count;
-               if (res != NULL)
-                       rle->res = res;
-       }
-       if (device_get_parent(child) == cbdev)
-               pci_write_config(child, rid, start, 4);
-       return 0;
-}
-
-static int
-cardbus_get_resource(device_t cbdev, device_t child, int type, int rid,
-    u_long *startp, u_long *countp)
-{
-       struct cardbus_devinfo *dinfo;
-       struct resource_list *rl;
-       struct resource_list_entry *rle;
-
-       if (device_get_parent(child) != cbdev)
-               return ENOENT;
-
-       dinfo = device_get_ivars(child);
-       rl = &dinfo->pci.resources;
-       rle = resource_list_find(rl, type, rid);
-       if (!rle)
-               return ENOENT;
-       if (startp)
-               *startp = rle->start;
-       if (countp)
-               *countp = rle->count;
-       return 0;
-}
-
-static void
-cardbus_delete_resource(device_t cbdev, device_t child, int type, int rid)
-{
-       struct cardbus_devinfo *dinfo;
-       struct resource_list *rl;
-       struct resource_list_entry *rle;
-
-       if (device_get_parent(child) != cbdev)
-               return;
-
-       dinfo = device_get_ivars(child);
-       rl = &dinfo->pci.resources;
-       rle = resource_list_find(rl, type, rid);
-       if (rle) {
-               if (rle->res) {
-                       if (rle->res->r_dev != cbdev ||
-                           rman_get_flags(rle->res) & RF_ACTIVE) {
-                               device_printf(cbdev, "delete_resource: "
-                                   "Resource still owned by child, oops. "
-                                   "(type=%d, rid=%d, addr=%lx)\n",
-                                   rle->type, rle->rid,
-                                   rman_get_start(rle->res));
-                               return;
-                       }
-                       bus_release_resource(cbdev, type, rid, rle->res);
-               }
-               resource_list_delete(rl, type, rid);
+       if (i > 0 && i == numdevs)
+               POWER_ENABLE_SOCKET(device_get_parent(cbdev), cbdev);
+       for (i = 0; i < numdevs; i++) {
+               dev = devlist[i];
+               if (device_get_state(dev) != DS_NOTPRESENT)
+                       continue;
+               dinfo = device_get_ivars(dev);
+               pci_print_verbose(&dinfo->pci);
+               resource_list_init(&dinfo->pci.resources);
+               cardbus_do_cis(cbdev, dev);
+               cardbus_pickup_maps(cbdev, dev);
+               cardbus_alloc_resources(cbdev, dev);
+               if (device_probe_and_attach(dev) != 0)
+                       cardbus_release_all_resources(cbdev, dinfo);
        }
-       if (device_get_parent(child) == cbdev)
-               pci_write_config(child, rid, 0, 4);
-}
-
-static int
-cardbus_set_resource_method(device_t cbdev, device_t child, int type, int rid,
-    u_long start, u_long count)
-{
-       int ret;
-       ret = cardbus_set_resource(cbdev, child, type, rid, start, count, NULL);
-       if (ret != 0)
-               return ret;
-       return BUS_SET_RESOURCE(device_get_parent(cbdev), child, type, rid,
-           start, count);
-}
-
-static int
-cardbus_get_resource_method(device_t cbdev, device_t child, int type, int rid,
-    u_long *startp, u_long *countp)
-{
-       int ret;
-       ret = cardbus_get_resource(cbdev, child, type, rid, startp, countp);
-       if (ret != 0)
-               return ret;
-       return BUS_GET_RESOURCE(device_get_parent(cbdev), child, type, rid,
-           startp, countp);
-}
-
-static void
-cardbus_delete_resource_method(device_t cbdev, device_t child,
-    int type, int rid)
-{
-       cardbus_delete_resource(cbdev, child, type, rid);
-       BUS_DELETE_RESOURCE(device_get_parent(cbdev), child, type, rid);
+       kfree(devlist, M_TEMP);
 }
 
 static void
@@ -658,16 +570,14 @@ cardbus_release_all_resources(device_t cbdev, struct cardbus_devinfo *dinfo)
        /* Free all allocated resources */
        SLIST_FOREACH(rle, &dinfo->pci.resources, link) {
                if (rle->res) {
-                       if (rle->res->r_dev != cbdev)
+                       if (rman_get_device(rle->res) != cbdev)
                                device_printf(cbdev, "release_all_resource: "
                                    "Resource still owned by child, oops. "
                                    "(type=%d, rid=%d, addr=%lx)\n",
                                    rle->type, rle->rid,
                                    rman_get_start(rle->res));
                        BUS_RELEASE_RESOURCE(device_get_parent(cbdev),
-                           rle->res->r_dev,
-                           rle->type, rle->rid,
-                           rle->res);
+                           cbdev, rle->type, rle->rid, rle->res);
                        rle->res = NULL;
                        /*
                         * zero out config so the card won't acknowledge
@@ -679,266 +589,12 @@ cardbus_release_all_resources(device_t cbdev, struct cardbus_devinfo *dinfo)
        resource_list_free(&dinfo->pci.resources);
 }
 
-static struct resource *
-cardbus_alloc_resource(device_t cbdev, device_t child, int type,
-    int *rid, u_long start, u_long end, u_long count, u_int flags)
-{
-       struct cardbus_devinfo *dinfo;
-       struct resource_list_entry *rle = 0;
-       int passthrough = (device_get_parent(child) != cbdev);
-
-       if (passthrough) {
-               return (BUS_ALLOC_RESOURCE(device_get_parent(cbdev), child,
-                   type, rid, start, end, count, flags));
-       }
-
-       dinfo = device_get_ivars(child);
-       rle = resource_list_find(&dinfo->pci.resources, type, *rid);
-
-       if (!rle)
-               return NULL;            /* no resource of that type/rid */
-
-       if (!rle->res) {
-               device_printf(cbdev, "WARNING: Resource not reserved by bus\n");
-               return NULL;
-       } else {
-               /* Release the cardbus hold on the resource */
-               if (rle->res->r_dev != cbdev)
-                       return NULL;
-               bus_release_resource(cbdev, type, *rid, rle->res);
-               rle->res = NULL;
-               switch (type) {
-               case SYS_RES_IOPORT:
-               case SYS_RES_MEMORY:
-                       if (!(flags & RF_ALIGNMENT_MASK))
-                               flags |= rman_make_alignment_flags(rle->count);
-                       break;
-               case SYS_RES_IRQ:
-                       flags |= RF_SHAREABLE;
-                       break;
-               }
-               /* Allocate the resource to the child */
-               return resource_list_alloc(&dinfo->pci.resources, cbdev, child,
-                   type, rid, rle->start, rle->end, rle->count, flags);
-       }
-}
-
-static int
-cardbus_release_resource(device_t cbdev, device_t child, int type, int rid,
-    struct resource *r)
-{
-       struct cardbus_devinfo *dinfo;
-       int passthrough = (device_get_parent(child) != cbdev);
-       struct resource_list_entry *rle = 0;
-       int flags;
-       int ret;
-
-       if (passthrough) {
-               return BUS_RELEASE_RESOURCE(device_get_parent(cbdev), child,
-                   type, rid, r);
-       }
-
-       dinfo = device_get_ivars(child);
-       /*
-        * According to the PCI 2.2 spec, devices may share an address
-        * decoder between memory mapped ROM access and memory
-        * mapped register access.  To be safe, disable ROM access
-        * whenever it is released.
-        */
-       if (rid == CARDBUS_ROM_REG) {
-               uint32_t rom_reg;
-
-               rom_reg = pci_read_config(child, rid, 4);
-               rom_reg &= ~CARDBUS_ROM_ENABLE;
-               pci_write_config(child, rid, rom_reg, 4);
-       }
-
-       rle = resource_list_find(&dinfo->pci.resources, type, rid);
-
-       if (!rle) {
-               device_printf(cbdev, "Allocated resource not found\n");
-               return ENOENT;
-       }
-       if (!rle->res) {
-               device_printf(cbdev, "Allocated resource not recorded\n");
-               return ENOENT;
-       }
-
-       ret = BUS_RELEASE_RESOURCE(device_get_parent(cbdev), child,
-           type, rid, r);
-       switch (type) {
-       case SYS_RES_IOPORT:
-       case SYS_RES_MEMORY:
-               flags = rman_make_alignment_flags(rle->count);
-               break;
-       case SYS_RES_IRQ:
-               flags = RF_SHAREABLE;
-               break;
-       default:
-               flags = 0;
-       }
-       /* Restore cardbus hold on the resource */
-       rle->res = bus_alloc_resource(cbdev, type, &rid,
-           rle->start, rle->end, rle->count, flags);
-       if (rle->res == NULL)
-               device_printf(cbdev, "release_resource: "
-                   "unable to reacquire resource\n");
-       return ret;
-}
-
-static int
-cardbus_setup_intr(device_t cbdev, device_t child, struct resource *irq,
-    int flags, driver_intr_t *intr, void *arg, 
-    void **cookiep, lwkt_serialize_t serializer)
-{
-       int ret;
-       device_t cdev;
-       struct cardbus_devinfo *dinfo;
-
-       ret = bus_generic_setup_intr(cbdev, child, irq, flags, intr, arg,
-                                    cookiep, serializer);
-       if (ret != 0)
-               return ret;
-
-       for (cdev = child; cbdev != device_get_parent(cdev);
-           cdev = device_get_parent(cdev))
-               /* NOTHING */;
-       dinfo = device_get_ivars(cdev);
-
-       return 0;
-}
-
-static int
-cardbus_teardown_intr(device_t cbdev, device_t child, struct resource *irq,
-    void *cookie)
-{
-       int ret;
-       device_t cdev;
-       struct cardbus_devinfo *dinfo;
-
-       ret = bus_generic_teardown_intr(cbdev, child, irq, cookie);
-       if (ret != 0)
-               return ret;
-
-       for (cdev = child; cbdev != device_get_parent(cdev);
-           cdev = device_get_parent(cdev))
-               /* NOTHING */;
-       dinfo = device_get_ivars(cdev);
-
-       return (0);
-}
-
-
 /************************************************************************/
 /* Other Bus Methods                                                   */
 /************************************************************************/
 
 static int
-cardbus_print_resources(struct resource_list *rl, const char *name,
-    int type, const char *format)
-{
-       struct resource_list_entry *rle;
-       int printed, retval;
-
-       printed = 0;
-       retval = 0;
-       /* Yes, this is kinda cheating */
-       SLIST_FOREACH(rle, rl, link) {
-               if (rle->type == type) {
-                       if (printed == 0)
-                               retval += kprintf(" %s ", name);
-                       else if (printed > 0)
-                               retval += kprintf(",");
-                       printed++;
-                       retval += kprintf(format, rle->start);
-                       if (rle->count > 1) {
-                               retval += kprintf("-");
-                               retval += kprintf(format, rle->start +
-                                   rle->count - 1);
-                       }
-               }
-       }
-       return retval;
-}
-
-static int
-cardbus_print_child(device_t cbdev, device_t child)
-{
-       struct cardbus_devinfo *dinfo;
-       struct resource_list *rl;
-       pcicfgregs *cfg;
-       int retval = 0;
-
-       dinfo = device_get_ivars(child);
-       cfg = &dinfo->pci.cfg;
-       rl = &dinfo->pci.resources;
-
-       retval += bus_print_child_header(cbdev, child);
-
-       retval += cardbus_print_resources(rl, "port", SYS_RES_IOPORT, "%#lx");
-       retval += cardbus_print_resources(rl, "mem", SYS_RES_MEMORY, "%#lx");
-       retval += cardbus_print_resources(rl, "irq", SYS_RES_IRQ, "%ld");
-       if (device_get_flags(cbdev))
-               retval += kprintf(" flags %#x", device_get_flags(cbdev));
-
-       retval += kprintf(" at device %d.%d", pci_get_slot(child),
-           pci_get_function(child));
-
-       retval += bus_print_child_footer(cbdev, child);
-
-       return (retval);
-}
-
-static void
-cardbus_probe_nomatch(device_t cbdev, device_t child)
-{
-       struct cardbus_devinfo *dinfo;
-       pcicfgregs *cfg;
-
-       dinfo = device_get_ivars(child);
-       cfg = &dinfo->pci.cfg;
-       device_printf(cbdev, "<unknown card>");
-       kprintf(" (vendor=0x%04x, dev=0x%04x)", cfg->vendor, cfg->device);
-       kprintf(" at %d.%d", pci_get_slot(child), pci_get_function(child));
-       if (cfg->intpin > 0 && cfg->intline != 255) {
-               kprintf(" irq %d", cfg->intline);
-       }
-       kprintf("\n");
-
-       return;
-}
-
-static int
-cardbus_child_location_str(device_t cbdev, device_t child, char *buf,
-    size_t buflen)
-{
-       struct cardbus_devinfo *dinfo;
-       pcicfgregs *cfg;
-
-       dinfo = device_get_ivars(child);
-       cfg = &dinfo->pci.cfg;
-       ksnprintf(buf, buflen, "slot=%d function=%d", pci_get_slot(child),
-           pci_get_function(child));
-       return (0);
-}
-
-static int
-cardbus_child_pnpinfo_str(device_t cbdev, device_t child, char *buf,
-    size_t buflen)
-{
-       struct cardbus_devinfo *dinfo;
-       pcicfgregs *cfg;
-
-       dinfo = device_get_ivars(child);
-       cfg = &dinfo->pci.cfg;
-       ksnprintf(buf, buflen, "vendor=0x%04x device=0x%04x subvendor=0x%04x "
-           "subdevice=0x%04x", cfg->vendor, cfg->device, cfg->subvendor,
-           cfg->subdevice);
-       return (0);
-}
-
-static int
-cardbus_read_ivar(device_t cbdev, device_t child, int which, u_long *result)
+cardbus_read_ivar(device_t cbdev, device_t child, int which, uintptr_t *result)
 {
        struct cardbus_devinfo *dinfo;
        pcicfgregs *cfg;
@@ -952,56 +608,14 @@ cardbus_read_ivar(device_t cbdev, device_t child, int which, u_long *result)
                 * The generic accessor doesn't deal with failure, so
                 * we set the return value, then return an error.
                 */
-               if ((dinfo->fepresent & (1 << TPL_FUNCE_LAN_NID)) == 0) {
-                       *((u_int8_t **) result) = NULL;
-                       return (EINVAL);
+               if (dinfo->fepresent & (1 << PCCARD_TPLFE_TYPE_LAN_NID)) {
+                       *((uint8_t **) result) = dinfo->funce.lan.nid;
+                       break;
                }
-               *((u_int8_t **) result) = dinfo->funce.lan.nid;
-               break;
-       case PCI_IVAR_SUBVENDOR:
-               *result = cfg->subvendor;
-               break;
-       case PCI_IVAR_SUBDEVICE:
-               *result = cfg->subdevice;
-               break;
-       case PCI_IVAR_VENDOR:
-               *result = cfg->vendor;
-               break;
-       case PCI_IVAR_DEVICE:
-               *result = cfg->device;
-               break;
-       case PCI_IVAR_DEVID:
-               *result = (cfg->device << 16) | cfg->vendor;
-               break;
-       case PCI_IVAR_CLASS:
-               *result = cfg->baseclass;
-               break;
-       case PCI_IVAR_SUBCLASS:
-               *result = cfg->subclass;
-               break;
-       case PCI_IVAR_PROGIF:
-               *result = cfg->progif;
-               break;
-       case PCI_IVAR_REVID:
-               *result = cfg->revid;
-               break;
-       case PCI_IVAR_INTPIN:
-               *result = cfg->intpin;
-               break;
-       case PCI_IVAR_IRQ:
-               *result = cfg->intline;
-               break;
-       case PCI_IVAR_BUS:
-               *result = cfg->bus;
-               break;
-       case PCI_IVAR_SLOT:
-               *result = cfg->slot;
-               break;
-       case PCI_IVAR_FUNCTION:
-               *result = cfg->func;
-               break;
+               *((uint8_t **) result) = NULL;
+               return (EINVAL);
        default:
-               return ENOENT;
+               return (pci_read_ivar(cbdev, child, which, result));
        }
        return 0;
 }
@@ -1009,198 +623,7 @@ cardbus_read_ivar(device_t cbdev, device_t child, int which, u_long *result)
 static int
 cardbus_write_ivar(device_t cbdev, device_t child, int which, uintptr_t value)
 {
-       struct cardbus_devinfo *dinfo;
-       pcicfgregs *cfg;
-
-       dinfo = device_get_ivars(child);
-       cfg = &dinfo->pci.cfg;
-
-       switch (which) {
-       case PCI_IVAR_ETHADDR:
-       case PCI_IVAR_SUBVENDOR:
-       case PCI_IVAR_SUBDEVICE:
-       case PCI_IVAR_VENDOR:
-       case PCI_IVAR_DEVICE:
-       case PCI_IVAR_DEVID:
-       case PCI_IVAR_CLASS:
-       case PCI_IVAR_SUBCLASS:
-       case PCI_IVAR_PROGIF:
-       case PCI_IVAR_REVID:
-       case PCI_IVAR_INTPIN:
-       case PCI_IVAR_IRQ:
-       case PCI_IVAR_BUS:
-       case PCI_IVAR_SLOT:
-       case PCI_IVAR_FUNCTION:
-               return EINVAL;  /* disallow for now */
-       default:
-               return ENOENT;
-       }
-       return 0;
-}
-
-/************************************************************************/
-/* Compatibility with PCI bus (XXX: Do we need this?)                  */
-/************************************************************************/
-
-/*
- * PCI power manangement
- */
-static int
-cardbus_set_powerstate_method(device_t cbdev, device_t child, int state)
-{
-       struct cardbus_devinfo *dinfo = device_get_ivars(child);
-       pcicfgregs *cfg = &dinfo->pci.cfg;
-       u_int16_t status;
-       int result;
-
-       if (cfg->pp_cap != 0) {
-               status = PCI_READ_CONFIG(cbdev, child, cfg->pp_status, 2)
-                   & ~PCIM_PSTAT_DMASK;
-               result = 0;
-               switch (state) {
-               case PCI_POWERSTATE_D0:
-                       status |= PCIM_PSTAT_D0;
-                       break;
-               case PCI_POWERSTATE_D1:
-                       if (cfg->pp_cap & PCIM_PCAP_D1SUPP) {
-                               status |= PCIM_PSTAT_D1;
-                       } else {
-                               result = EOPNOTSUPP;
-                       }
-                       break;
-               case PCI_POWERSTATE_D2:
-                       if (cfg->pp_cap & PCIM_PCAP_D2SUPP) {
-                               status |= PCIM_PSTAT_D2;
-                       } else {
-                               result = EOPNOTSUPP;
-                       }
-                       break;
-               case PCI_POWERSTATE_D3:
-                       status |= PCIM_PSTAT_D3;
-                       break;
-               default:
-           &n