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