Home | History | Annotate | Line # | Download | only in cardbus
cardbusvar.h revision 1.3.4.1
      1  1.3.4.1      fvdl /*	$NetBSD: cardbusvar.h,v 1.3.4.1 1999/11/15 00:40:19 fvdl Exp $	*/
      2      1.1      haya 
      3      1.1      haya /*
      4      1.1      haya  * Copyright (c) 1998 and 1999
      5      1.1      haya  *       HAYAKAWA Koichi.  All rights reserved.
      6      1.1      haya  *
      7      1.1      haya  * Redistribution and use in source and binary forms, with or without
      8      1.1      haya  * modification, are permitted provided that the following conditions
      9      1.1      haya  * are met:
     10      1.1      haya  * 1. Redistributions of source code must retain the above copyright
     11      1.1      haya  *    notice, this list of conditions and the following disclaimer.
     12      1.1      haya  * 2. Redistributions in binary form must reproduce the above copyright
     13      1.1      haya  *    notice, this list of conditions and the following disclaimer in the
     14      1.1      haya  *    documentation and/or other materials provided with the distribution.
     15      1.1      haya  * 3. All advertising materials mentioning features or use of this software
     16      1.1      haya  *    must display the following acknowledgement:
     17      1.1      haya  *	This product includes software developed by the author.
     18      1.1      haya  * 4. The name of the author may not be used to endorse or promote products
     19      1.1      haya  *    derived from this software without specific prior written permission.
     20      1.1      haya  *
     21      1.1      haya  *
     22      1.1      haya  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
     23      1.1      haya  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
     24      1.1      haya  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
     25      1.1      haya  * DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
     26      1.1      haya  * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
     27      1.1      haya  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
     28      1.1      haya  * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
     29      1.1      haya  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
     30      1.1      haya  * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
     31      1.1      haya  * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
     32      1.1      haya  * POSSIBILITY OF SUCH DAMAGE.
     33      1.1      haya  */
     34      1.1      haya 
     35      1.1      haya #if !defined SYS_DEV_CARDBUS_CARDBUSVAR_H
     36      1.1      haya #define SYS_DEV_CARDBUS_CARDBUSVAR_H
     37      1.1      haya 
     38      1.1      haya #include <dev/pci/pcivar.h>	/* for pcitag_t */
     39      1.1      haya 
     40      1.1      haya #if 1
     41      1.1      haya #include <dev/cardbus/rbus.h>
     42      1.1      haya #endif
     43      1.1      haya 
     44      1.1      haya 
     45      1.1      haya 
     46      1.1      haya typedef void *cardbus_chipset_tag_t;
     47      1.1      haya typedef int cardbus_intr_handle_t;
     48      1.1      haya 
     49      1.1      haya 
     50      1.1      haya /* XXX they must be in cardbusreg.h */
     51      1.1      haya typedef u_int32_t cardbusreg_t;
     52      1.1      haya typedef pcitag_t cardbustag_t;
     53      1.1      haya typedef int cardbus_intr_line_t;
     54      1.1      haya 
     55      1.1      haya #define CARDBUS_ID_REG          0x00
     56      1.1      haya 
     57      1.1      haya typedef u_int16_t cardbus_vendor_id_t;
     58      1.1      haya typedef u_int16_t cardbus_product_id_t;
     59      1.1      haya 
     60      1.1      haya #  define CARDBUS_VENDOR_SHIFT  0
     61      1.1      haya #  define CARDBUS_VENDOR_MASK   0xffff
     62      1.1      haya #  define CARDBUS_VENDOR(id) \
     63      1.1      haya 	    (((id) >> CARDBUS_VENDOR_SHIFT) & CARDBUS_VENDOR_MASK)
     64      1.1      haya 
     65      1.1      haya #  define CARDBUS_PRODUCT_SHIFT  16
     66      1.1      haya #  define CARDBUS_PRODUCT_MASK   0xffff
     67      1.1      haya #  define CARDBUS_PRODUCT(id) \
     68      1.1      haya 	    (((id) >> CARDBUS_PRODUCT_SHIFT) & CARDBUS_PRODUCT_MASK)
     69      1.1      haya 
     70      1.1      haya 
     71      1.1      haya #define	CARDBUS_COMMAND_STATUS_REG  0x04
     72      1.1      haya 
     73      1.1      haya #  define CARDBUS_COMMAND_IO_ENABLE     0x00000001
     74      1.1      haya #  define CARDBUS_COMMAND_MEM_ENABLE    0x00000002
     75      1.1      haya #  define CARDBUS_COMMAND_MASTER_ENABLE 0x00000004
     76      1.1      haya 
     77      1.1      haya 
     78      1.1      haya #define CARDBUS_CLASS_REG       0x08
     79      1.3  augustss 
     80      1.3  augustss #define	CARDBUS_CLASS_SHIFT				24
     81      1.3  augustss #define	CARDBUS_CLASS_MASK				0xff
     82      1.3  augustss #define	CARDBUS_CLASS(cr) \
     83      1.3  augustss 	    (((cr) >> CARDBUS_CLASS_SHIFT) & CARDBUS_CLASS_MASK)
     84      1.3  augustss 
     85      1.3  augustss #define	CARDBUS_SUBCLASS_SHIFT			16
     86      1.3  augustss #define	CARDBUS_SUBCLASS_MASK			0xff
     87      1.3  augustss #define	CARDBUS_SUBCLASS(cr) \
     88      1.3  augustss 	    (((cr) >> CARDBUS_SUBCLASS_SHIFT) & CARDBUS_SUBCLASS_MASK)
     89      1.3  augustss 
     90      1.3  augustss #define	CARDBUS_INTERFACE_SHIFT			8
     91      1.3  augustss #define	CARDBUS_INTERFACE_MASK			0xff
     92      1.3  augustss #define	CARDBUS_INTERFACE(cr) \
     93      1.3  augustss 	    (((cr) >> CARDBUS_INTERFACE_SHIFT) & CARDBUS_INTERFACE_MASK)
     94      1.3  augustss 
     95      1.3  augustss #define	CARDBUS_REVISION_SHIFT			0
     96      1.3  augustss #define	CARDBUS_REVISION_MASK			0xff
     97      1.3  augustss #define	CARDBUS_REVISION(cr) \
     98      1.3  augustss 	    (((cr) >> CARDBUS_REVISION_SHIFT) & CARDBUS_REVISION_MASK)
     99      1.3  augustss 
    100      1.3  augustss /* base classes */
    101      1.3  augustss #define	CARDBUS_CLASS_PREHISTORIC		0x00
    102      1.3  augustss #define	CARDBUS_CLASS_MASS_STORAGE		0x01
    103      1.3  augustss #define	CARDBUS_CLASS_NETWORK			0x02
    104      1.3  augustss #define	CARDBUS_CLASS_DISPLAY			0x03
    105      1.3  augustss #define	CARDBUS_CLASS_MULTIMEDIA		0x04
    106      1.3  augustss #define	CARDBUS_CLASS_MEMORY			0x05
    107      1.3  augustss #define	CARDBUS_CLASS_BRIDGE			0x06
    108      1.3  augustss #define	CARDBUS_CLASS_COMMUNICATIONS		0x07
    109      1.3  augustss #define	CARDBUS_CLASS_SYSTEM			0x08
    110      1.3  augustss #define	CARDBUS_CLASS_INPUT			0x09
    111      1.3  augustss #define	CARDBUS_CLASS_DOCK			0x0a
    112      1.3  augustss #define	CARDBUS_CLASS_PROCESSOR			0x0b
    113      1.3  augustss #define	CARDBUS_CLASS_SERIALBUS			0x0c
    114      1.3  augustss #define	CARDBUS_CLASS_UNDEFINED			0xff
    115      1.3  augustss 
    116      1.3  augustss /* 0x0c serial bus subclasses */
    117      1.3  augustss #define	CARDBUS_SUBCLASS_SERIALBUS_FIREWIRE	0x00
    118      1.3  augustss #define	CARDBUS_SUBCLASS_SERIALBUS_ACCESS	0x01
    119      1.3  augustss #define	CARDBUS_SUBCLASS_SERIALBUS_SSA		0x02
    120      1.3  augustss #define	CARDBUS_SUBCLASS_SERIALBUS_USB		0x03
    121      1.3  augustss #define	CARDBUS_SUBCLASS_SERIALBUS_FIBER	0x04
    122      1.1      haya 
    123      1.1      haya /* BIST, Header Type, Latency Timer, Cache Line Size */
    124      1.1      haya #define CARDBUS_BHLC_REG        0x0c
    125      1.1      haya 
    126      1.1      haya #define	CARDBUS_BIST_SHIFT        24
    127      1.1      haya #define	CARDBUS_BIST_MASK       0xff
    128      1.1      haya #define	CARDBUS_BIST(bhlcr) \
    129      1.1      haya 	    (((bhlcr) >> CARDBUS_BIST_SHIFT) & CARDBUS_BIST_MASK)
    130      1.1      haya 
    131      1.1      haya #define	CARDBUS_HDRTYPE_SHIFT     16
    132      1.1      haya #define	CARDBUS_HDRTYPE_MASK    0xff
    133      1.1      haya #define	CARDBUS_HDRTYPE(bhlcr) \
    134      1.1      haya 	    (((bhlcr) >> CARDBUS_HDRTYPE_SHIFT) & CARDBUS_HDRTYPE_MASK)
    135      1.1      haya 
    136      1.1      haya #define	CARDBUS_HDRTYPE_TYPE(bhlcr) \
    137      1.1      haya 	    (CARDBUS_HDRTYPE(bhlcr) & 0x7f)
    138      1.1      haya #define	CARDBUS_HDRTYPE_MULTIFN(bhlcr) \
    139      1.1      haya 	    ((CARDBUS_HDRTYPE(bhlcr) & 0x80) != 0)
    140      1.1      haya 
    141      1.1      haya #define	CARDBUS_LATTIMER_SHIFT      8
    142      1.1      haya #define	CARDBUS_LATTIMER_MASK    0xff
    143      1.1      haya #define	CARDBUS_LATTIMER(bhlcr) \
    144      1.1      haya 	    (((bhlcr) >> CARDBUS_LATTIMER_SHIFT) & CARDBUS_LATTIMER_MASK)
    145      1.1      haya 
    146      1.1      haya #define	CARDBUS_CACHELINE_SHIFT     0
    147      1.1      haya #define	CARDBUS_CACHELINE_MASK   0xff
    148      1.1      haya #define	CARDBUS_CACHELINE(bhlcr) \
    149      1.1      haya 	    (((bhlcr) >> CARDBUS_CACHELINE_SHIFT) & CARDBUS_CACHELINE_MASK)
    150      1.1      haya 
    151      1.1      haya 
    152      1.1      haya /* Base Resisters */
    153      1.1      haya #define CARDBUS_BASE0_REG  0x10
    154      1.1      haya #define CARDBUS_BASE1_REG  0x14
    155      1.1      haya #define CARDBUS_BASE2_REG  0x18
    156      1.1      haya #define CARDBUS_BASE3_REG  0x1C
    157      1.1      haya #define CARDBUS_BASE4_REG  0x20
    158      1.1      haya #define CARDBUS_BASE5_REG  0x24
    159      1.1      haya #define CARDBUS_CIS_REG    0x28
    160  1.3.4.1      fvdl #define CARDBUS_ROM_REG	   0x30
    161      1.1      haya #  define CARDBUS_CIS_ASIMASK 0x07
    162      1.1      haya #    define CARDBUS_CIS_ASI(x) (CARDBUS_CIS_ASIMASK & (x))
    163      1.1      haya #  define CARDBUS_CIS_ASI_TUPLE 0x00
    164      1.1      haya #  define CARDBUS_CIS_ASI_BAR0  0x01
    165      1.1      haya #  define CARDBUS_CIS_ASI_BAR1  0x02
    166      1.1      haya #  define CARDBUS_CIS_ASI_BAR2  0x03
    167      1.1      haya #  define CARDBUS_CIS_ASI_BAR3  0x04
    168      1.1      haya #  define CARDBUS_CIS_ASI_BAR4  0x05
    169      1.1      haya #  define CARDBUS_CIS_ASI_BAR5  0x06
    170      1.1      haya #  define CARDBUS_CIS_ASI_ROM   0x07
    171      1.1      haya #  define CARDBUS_CIS_ADDRMASK 0x0ffffff8
    172      1.1      haya #    define CARDBUS_CIS_ADDR(x) (CARDBUS_CIS_ADDRMASK & (x))
    173      1.1      haya #    define CARDBUS_CIS_ASI_BAR(x) (((CARDBUS_CIS_ASIMASK & (x))-1)*4+0x10)
    174  1.3.4.1      fvdl #    define CARDBUS_CIS_ASI_ROM_IMAGE(x) (((x) >> 28) & 0xf)
    175      1.1      haya 
    176      1.1      haya #define	CARDBUS_INTERRUPT_REG   0x3c
    177      1.1      haya 
    178      1.1      haya #define CARDBUS_MAPREG_TYPE_MEM		0x00000000
    179      1.1      haya #define CARDBUS_MAPREG_TYPE_IO		0x00000001
    180      1.1      haya 
    181      1.1      haya /* XXX end */
    182      1.1      haya 
    183      1.1      haya #if rbus
    184      1.1      haya 
    185      1.1      haya typedef struct cardbus_functions {
    186      1.1      haya   int (*cardbus_space_alloc) __P((cardbus_chipset_tag_t, rbus_tag_t,
    187      1.1      haya 				  bus_addr_t addr, bus_size_t size,
    188      1.1      haya 				  bus_addr_t mask, bus_size_t align,
    189      1.1      haya 				  int flags, bus_addr_t *addrp,
    190      1.1      haya 				  bus_space_handle_t *bshp));
    191      1.1      haya   int (*cardbus_space_free) __P((cardbus_chipset_tag_t, rbus_tag_t,
    192      1.1      haya 				 bus_space_handle_t, bus_size_t));
    193      1.1      haya   void *(*cardbus_intr_establish) __P((cardbus_chipset_tag_t, int irq, int level, int (*ih)(void *), void *sc));
    194      1.1      haya   void (*cardbus_intr_disestablish) __P((cardbus_chipset_tag_t ct, void *ih));
    195      1.1      haya   int (*cardbus_ctrl) __P((cardbus_chipset_tag_t, int));
    196      1.1      haya   int (*cardbus_power) __P((cardbus_chipset_tag_t, int));
    197      1.1      haya 
    198      1.1      haya   cardbustag_t (*cardbus_make_tag) __P((cardbus_chipset_tag_t, int, int, int));
    199      1.1      haya   void (*cardbus_free_tag) __P((cardbus_chipset_tag_t, cardbustag_t));
    200      1.1      haya   cardbusreg_t (*cardbus_conf_read) __P((cardbus_chipset_tag_t, cardbustag_t, int));
    201      1.1      haya   void (*cardbus_conf_write) __P((cardbus_chipset_tag_t, cardbustag_t, int, cardbusreg_t));
    202      1.1      haya } cardbus_function_t, *cardbus_function_tag_t;
    203      1.1      haya 
    204      1.1      haya #else
    205      1.1      haya 
    206      1.1      haya typedef struct cardbus_functions {
    207      1.1      haya   int (*cardbus_ctrl) __P((cardbus_chipset_tag_t, int));
    208      1.1      haya   int (*cardbus_power) __P((cardbus_chipset_tag_t, int));
    209      1.1      haya   int (*cardbus_mem_open) __P((cardbus_chipset_tag_t, int, u_int32_t, u_int32_t));
    210      1.1      haya   int (*cardbus_mem_close) __P((cardbus_chipset_tag_t, int));
    211      1.1      haya   int (*cardbus_io_open) __P((cardbus_chipset_tag_t, int, u_int32_t, u_int32_t));
    212      1.1      haya   int (*cardbus_io_close) __P((cardbus_chipset_tag_t, int));
    213      1.1      haya   void *(*cardbus_intr_establish) __P((cardbus_chipset_tag_t, int irq, int level, int (*ih)(void *), void *sc));
    214      1.1      haya   void (*cardbus_intr_disestablish) __P((cardbus_chipset_tag_t ct, void *ih));
    215      1.1      haya 
    216      1.1      haya   cardbustag_t (*cardbus_make_tag) __P((cardbus_chipset_tag_t, int, int, int));  cardbusreg_t (*cardbus_conf_read) __P((cardbus_chipset_tag_t, cardbustag_t, int));
    217      1.1      haya   void (*cardbus_conf_write) __P((cardbus_chipset_tag_t, cardbustag_t, int, cardbusreg_t));
    218      1.1      haya } cardbus_function_t, *cardbus_function_tag_t;
    219      1.1      haya #endif /* rbus */
    220      1.1      haya 
    221  1.3.4.1      fvdl /*
    222  1.3.4.1      fvdl  * struct cbslot_attach_args is the attach argument for cardbus card.
    223  1.3.4.1      fvdl  */
    224      1.1      haya struct cbslot_attach_args {
    225      1.1      haya   char *cba_busname;
    226      1.1      haya   bus_space_tag_t cba_iot;	/* cardbus i/o space tag */
    227      1.1      haya   bus_space_tag_t cba_memt;	/* cardbus mem space tag */
    228      1.1      haya   bus_dma_tag_t cba_dmat;	/* DMA tag */
    229      1.1      haya 
    230      1.1      haya   int cba_bus;			/* cardbus bus number */
    231      1.1      haya   int cba_function;		/* slot number on this Host Bus Adaptor */
    232      1.1      haya 
    233      1.1      haya   cardbus_chipset_tag_t cba_cc;	/* cardbus chipset */
    234      1.1      haya   cardbus_function_tag_t cba_cf; /* cardbus functions */
    235      1.1      haya   int cba_intrline;		/* interrupt line */
    236      1.1      haya 
    237      1.1      haya #if rbus
    238      1.1      haya   rbus_tag_t cba_rbus_iot;	/* CardBus i/o rbus tag */
    239      1.1      haya   rbus_tag_t cba_rbus_memt;	/* CardBus mem rbus tag */
    240      1.1      haya #endif
    241      1.1      haya 
    242      1.1      haya   int cba_cacheline;		/* cache line size */
    243      1.1      haya   int cba_lattimer;		/* latency timer */
    244      1.1      haya };
    245      1.1      haya 
    246      1.1      haya 
    247      1.1      haya #define cbslotcf_dev  cf_loc[0]
    248      1.1      haya #define cbslotcf_func cf_loc[1]
    249      1.1      haya #define CBSLOT_UNK_DEV -1
    250      1.1      haya #define CBSLOT_UNK_FUNC -1
    251      1.1      haya 
    252      1.1      haya 
    253      1.1      haya struct cardbus_devfunc;
    254      1.1      haya 
    255  1.3.4.1      fvdl /*
    256  1.3.4.1      fvdl  * struct cardbus_softc is the softc for cardbus card.
    257  1.3.4.1      fvdl  */
    258      1.1      haya struct cardbus_softc {
    259      1.1      haya   struct device sc_dev;		/* fundamental device structure */
    260      1.1      haya 
    261      1.1      haya   int sc_bus;			/* cardbus bus number */
    262      1.1      haya   int sc_device;		/* cardbus device number */
    263      1.1      haya   int sc_intrline;		/* CardBus intrline */
    264      1.1      haya 
    265      1.1      haya   bus_space_tag_t sc_iot;	/* CardBus I/O space tag */
    266      1.1      haya   bus_space_tag_t sc_memt;	/* CardBus MEM space tag */
    267      1.1      haya   bus_dma_tag_t sc_dmat;	/* DMA tag */
    268      1.1      haya 
    269      1.1      haya   cardbus_chipset_tag_t sc_cc;	/* CardBus chipset */
    270      1.1      haya   cardbus_function_tag_t sc_cf;	/* CardBus function */
    271      1.1      haya 
    272      1.1      haya #if rbus
    273      1.1      haya   rbus_tag_t sc_rbus_iot;	/* CardBus i/o rbus tag */
    274      1.1      haya   rbus_tag_t sc_rbus_memt;	/* CardBus mem rbus tag */
    275      1.1      haya #endif
    276      1.1      haya 
    277      1.1      haya   int sc_cacheline;		/* cache line size */
    278      1.1      haya   int sc_lattimer;		/* latency timer */
    279      1.1      haya   int sc_volt;			/* applied Vcc voltage */
    280      1.1      haya #define PCCARD_33V  0x02
    281      1.1      haya #define PCCARD_XXV  0x04
    282      1.1      haya #define PCCARD_YYV  0x08
    283      1.1      haya   int sc_poweron_func;
    284      1.1      haya   struct cardbus_devfunc *sc_funcs;	/* list of cardbus device functions */
    285      1.1      haya };
    286      1.1      haya 
    287      1.1      haya 
    288  1.3.4.1      fvdl /*
    289      1.1      haya  * struct cardbus_devfunc:
    290      1.1      haya  *
    291      1.1      haya  *   This is the data deposit for each function of a CardBus device.
    292      1.1      haya  *   This structure is used for memory or i/o space allocation and
    293      1.1      haya  *   disallocation.
    294  1.3.4.1      fvdl  */
    295      1.1      haya typedef struct cardbus_devfunc {
    296      1.1      haya   cardbus_chipset_tag_t ct_cc;
    297      1.1      haya   cardbus_function_tag_t ct_cf;
    298      1.1      haya   struct cardbus_softc *ct_sc;	/* pointer to the parent */
    299      1.1      haya   int ct_bus;			/* bus number */
    300      1.1      haya   int ct_dev;			/* device number */
    301      1.1      haya   int ct_func;			/* function number */
    302      1.1      haya 
    303      1.1      haya #if rbus
    304      1.1      haya   rbus_tag_t ct_rbus_iot;	/* CardBus i/o rbus tag */
    305      1.1      haya   rbus_tag_t ct_rbus_memt;	/* CardBus mem rbus tag */
    306      1.1      haya #endif
    307      1.1      haya 
    308      1.1      haya   u_int32_t ct_bar[6];		/* Base Address Regs 0 to 6 */
    309      1.1      haya   u_int32_t ct_lc;		/* Latency timer and cache line size */
    310      1.1      haya   /* u_int32_t ct_cisreg; */    /* CIS reg: is it needed??? */
    311      1.1      haya 
    312      1.1      haya   struct device *ct_device;	/* pointer to the device */
    313      1.1      haya 
    314      1.1      haya   struct cardbus_devfunc *ct_next;
    315      1.1      haya 
    316      1.1      haya   /* some data structure needed for tuple??? */
    317      1.1      haya } *cardbus_devfunc_t;
    318      1.1      haya 
    319      1.1      haya 
    320  1.3.4.1      fvdl /* XXX various things extracted from CIS */
    321  1.3.4.1      fvdl struct cardbus_cis_info {
    322  1.3.4.1      fvdl     int32_t		manufacturer;
    323  1.3.4.1      fvdl     int32_t		product;
    324  1.3.4.1      fvdl     char		cis1_info_buf[256];
    325  1.3.4.1      fvdl     char*		cis1_info[4];
    326  1.3.4.1      fvdl     struct cb_bar_info {
    327  1.3.4.1      fvdl 	unsigned int flags;
    328  1.3.4.1      fvdl 	unsigned int size;
    329  1.3.4.1      fvdl     } bar[7];
    330  1.3.4.1      fvdl     unsigned int	funcid;
    331  1.3.4.1      fvdl     union {
    332  1.3.4.1      fvdl 	struct {
    333  1.3.4.1      fvdl 	    char netid[6];
    334  1.3.4.1      fvdl 	} network;
    335  1.3.4.1      fvdl     } funce;
    336  1.3.4.1      fvdl };
    337  1.3.4.1      fvdl 
    338      1.1      haya struct cardbus_attach_args {
    339      1.1      haya   int ca_unit;
    340      1.1      haya   cardbus_devfunc_t ca_ct;
    341      1.1      haya 
    342      1.1      haya   bus_space_tag_t ca_iot;	/* CardBus I/O space tag */
    343      1.1      haya   bus_space_tag_t ca_memt;	/* CardBus MEM space tag */
    344      1.1      haya   bus_dma_tag_t ca_dmat;	/* DMA tag */
    345      1.1      haya 
    346      1.1      haya   u_int ca_device;
    347      1.1      haya   u_int ca_function;
    348      1.1      haya   cardbustag_t ca_tag;
    349      1.1      haya   cardbusreg_t ca_id;
    350      1.1      haya   cardbusreg_t ca_class;
    351      1.1      haya 
    352      1.1      haya   /* interrupt information */
    353      1.1      haya   cardbus_intr_line_t ca_intrline;
    354      1.1      haya 
    355      1.1      haya #if rbus
    356      1.1      haya   rbus_tag_t ca_rbus_iot;	/* CardBus i/o rbus tag */
    357      1.1      haya   rbus_tag_t ca_rbus_memt;	/* CardBus mem rbus tag */
    358      1.1      haya #endif
    359  1.3.4.1      fvdl 
    360  1.3.4.1      fvdl   struct cardbus_cis_info ca_cis;
    361      1.1      haya };
    362      1.1      haya 
    363      1.1      haya 
    364      1.1      haya #define CARDBUS_ENABLE  1	/* enable the channel */
    365      1.1      haya #define CARDBUS_DISABLE 2	/* disable the channel */
    366      1.1      haya #define CARDBUS_RESET   4
    367      1.1      haya #define CARDBUS_CD      7
    368      1.1      haya #  define CARDBUS_NOCARD 0
    369      1.1      haya #  define CARDBUS_5V_CARD 0x01	/* XXX: It must not exist */
    370      1.1      haya #  define CARDBUS_3V_CARD 0x02
    371      1.1      haya #  define CARDBUS_XV_CARD 0x04
    372      1.1      haya #  define CARDBUS_YV_CARD 0x08
    373      1.1      haya #define CARDBUS_IO_ENABLE    100
    374      1.1      haya #define CARDBUS_IO_DISABLE   101
    375      1.1      haya #define CARDBUS_MEM_ENABLE   102
    376      1.1      haya #define CARDBUS_MEM_DISABLE  103
    377      1.1      haya #define CARDBUS_BM_ENABLE    104 /* bus master */
    378      1.1      haya #define CARDBUS_BM_DISABLE   105
    379      1.1      haya 
    380      1.1      haya #define CARDBUS_VCC_UC  0x0000
    381      1.1      haya #define CARDBUS_VCC_3V  0x0001
    382      1.1      haya #define CARDBUS_VCC_XV  0x0002
    383      1.1      haya #define CARDBUS_VCC_YV  0x0003
    384      1.1      haya #define CARDBUS_VCC_0V  0x0004
    385      1.1      haya #define CARDBUS_VCC_5V  0x0005	/* ??? */
    386      1.1      haya #define CARDBUS_VCCMASK 0x000f
    387      1.1      haya #define CARDBUS_VPP_UC  0x0000
    388      1.1      haya #define CARDBUS_VPP_VCC 0x0010
    389      1.1      haya #define CARDBUS_VPP_12V 0x0030
    390      1.1      haya #define CARDBUS_VPP_0V  0x0040
    391      1.1      haya #define CARDBUS_VPPMASK 0x00f0
    392      1.1      haya 
    393      1.1      haya 
    394      1.1      haya #include "locators.h"
    395      1.1      haya 
    396      1.1      haya /*
    397      1.1      haya  * Locators devies that attach to 'cardbus', as specified to config.
    398      1.1      haya  */
    399      1.1      haya #define cardbuscf_dev cf_loc[CARDBUSCF_DEV]
    400      1.1      haya #define CARDBUS_UNK_DEV CARDBUSCF_DEV_DEFAULT
    401      1.1      haya 
    402      1.1      haya #define cardbuscf_function cf_loc[CARDBUSCF_FUNCTION]
    403      1.1      haya #define CARDBUS_UNK_FUNCTION CARDBUSCF_FUNCTION_DEFAULT
    404      1.1      haya 
    405      1.1      haya int cardbus_attach_card __P((struct cardbus_softc *));
    406      1.1      haya void *cardbus_intr_establish __P((cardbus_chipset_tag_t, cardbus_function_tag_t, cardbus_intr_handle_t irq, int level, int (*func) (void *), void *arg));
    407      1.1      haya void cardbus_intr_disestablish __P((cardbus_chipset_tag_t, cardbus_function_tag_t, void *handler));
    408      1.1      haya 
    409  1.3.4.1      fvdl int cardbus_mapreg_map __P((struct cardbus_softc *, int, int, cardbusreg_t,
    410      1.1      haya 			    int, bus_space_tag_t *, bus_space_handle_t *,
    411      1.1      haya 			    bus_addr_t *, bus_size_t *));
    412      1.1      haya 
    413      1.1      haya int cardbus_save_bar __P((cardbus_devfunc_t));
    414      1.1      haya int cardbus_restore_bar __P((cardbus_devfunc_t));
    415      1.1      haya 
    416  1.3.4.1      fvdl int cardbus_function_enable __P((struct cardbus_softc *, int function));
    417  1.3.4.1      fvdl int cardbus_function_disable __P((struct cardbus_softc *, int function));
    418  1.3.4.1      fvdl 
    419  1.3.4.1      fvdl #define Cardbus_function_enable(ct) cardbus_function_enable((ct)->ct_sc, (ct)->ct_func)
    420  1.3.4.1      fvdl #define Cardbus_function_disable(ct) cardbus_function_disable((ct)->ct_sc, (ct)->ct_func)
    421  1.3.4.1      fvdl 
    422  1.3.4.1      fvdl 
    423  1.3.4.1      fvdl 
    424  1.3.4.1      fvdl #define Cardbus_mapreg_map(ct, reg, type, busflags, tagp, handlep, basep, sizep) \
    425  1.3.4.1      fvdl 	cardbus_mapreg_map((ct)->ct_sc, (ct->ct_func), (reg), (type),\
    426  1.3.4.1      fvdl 			   (busflags), (tagp), (handlep), (basep), (sizep))
    427      1.1      haya 
    428      1.1      haya #define Cardbus_make_tag(ct) (*(ct)->ct_cf->cardbus_make_tag)((ct)->ct_cc, (ct)->ct_bus, (ct)->ct_dev, (ct)->ct_func)
    429      1.1      haya #define cardbus_make_tag(cc, cf, bus, device, function) ((cf)->cardbus_make_tag)((cc), (bus), (device), (function))
    430      1.1      haya 
    431      1.1      haya #define Cardbus_free_tag(ct, tag) (*(ct)->ct_cf->cardbus_free_tag)((ct)->ct_cc, (tag))
    432  1.3.4.1      fvdl #define cardbus_free_tag(cc, cf, tag) (*(cf)->cardbus_free_tag)(cc, (tag))
    433      1.1      haya 
    434      1.1      haya #define Cardbus_conf_read(ct, tag, offs) (*(ct)->ct_cf->cardbus_conf_read)((ct)->ct_cf, (tag), (offs))
    435      1.1      haya #define cardbus_conf_read(cc, cf, tag, offs) ((cf)->cardbus_conf_read)((cc), (tag), (offs))
    436  1.3.4.1      fvdl #define Cardbus_conf_write(ct, tag, offs, val) (*(ct)->ct_cf->cardbus_conf_write)((ct)->ct_cf, (tag), (offs), (val))
    437      1.1      haya #define cardbus_conf_write(cc, cf, tag, offs, val) ((cf)->cardbus_conf_write)((cc), (tag), (offs), (val))
    438      1.1      haya 
    439      1.1      haya #endif /* SYS_DEV_CARDBUS_CARDBUSVAR_H */
    440      1.1      haya 
    441