diff --git a/sys/dev/cardbus/cardbusvar.h b/sys/dev/cardbus/cardbusvar.h index 0a6f8351bd4c..f88702d51a6e 100644 --- a/sys/dev/cardbus/cardbusvar.h +++ b/sys/dev/cardbus/cardbusvar.h @@ -1,4 +1,4 @@ -/* $NetBSD: cardbusvar.h,v 1.20 2000/04/19 01:19:04 haya Exp $ */ +/* $NetBSD: cardbusvar.h,v 1.21 2001/05/31 08:33:40 haya Exp $ */ /* * Copyright (c) 1998, 1999 and 2000 @@ -191,24 +191,58 @@ typedef u_int16_t cardbus_product_id_t; /* XXX end */ #if rbus - +/* + * struct cardbus_functions contains the pointers for basic cardbus + * functions. Those functions must be provided by cardbus bridge. + * The child devices can use those functions. The contained functions + * are: cardbus_space_alloc, cardbus_space_free, + * cardbus_intr_establish, cardbus_intr_disestablish, cardbus_ctrl, + * cardbus_power, cardbus_make_tag, cardbus_free_tag and + * cardbus_conf_write. + * + * int (*cardbus_space_alloc)(cardbus_chipset_tag_t ct, rbus_tag_t rb, + * bus_addr_t addr, bus_size_t size, + * bus_addr_t mask, bus_size_t align, + * int flags, bus_addr_t *addrp, + * bus_space_handle_t *bshp); + * + * int (*cardbus_space_free)(cardbus_chipset_tag_t ct, rbus_tag_t rb, + * bus_space_handle_t, bus_size_t); + * + * cardbus_space_alloc and cardbus_space_free allocates and + * disallocate bus space for the requesters. + * + * void *(*cardbus_intr_establish)(cardbus_chipset_tag_t ct, int irq, + * int level, int (*ih)(void *), void *sc); + * + * void (*cardbus_intr_disestablish)(cardbus_chipset_tag_t ct, void *ih); + * int (*cardbus_ctrl)(cardbus_chipset_tag_t ct, int command); + * int (*cardbus_power)(cardbus_chipset_tag_t ct, int voltage); + * + * cardbustag_t (*cardbus_make_tag)(cardbus_chipset_tag_t ct, + * int busno, int devno, int functionno); + * void (*cardbus_free_tag)(cardbus_chipset_tag_t ct, cardbustag_t tag); + * cardbusreg_t (*cardbus_conf_read)(cardbus_chipset_tag_t ct, + * cardbustag_t tag, int offs); + * void (*cardbus_conf_write)(cardbus_chipset_tag_t ct, + * cardbustag_t tag, int offs, cardbusreg_t val); + */ typedef struct cardbus_functions { - int (*cardbus_space_alloc) __P((cardbus_chipset_tag_t, rbus_tag_t, - bus_addr_t addr, bus_size_t size, - bus_addr_t mask, bus_size_t align, - int flags, bus_addr_t *addrp, - bus_space_handle_t *bshp)); - int (*cardbus_space_free) __P((cardbus_chipset_tag_t, rbus_tag_t, - bus_space_handle_t, bus_size_t)); - void *(*cardbus_intr_establish) __P((cardbus_chipset_tag_t, int irq, int level, int (*ih)(void *), void *sc)); - void (*cardbus_intr_disestablish) __P((cardbus_chipset_tag_t ct, void *ih)); - int (*cardbus_ctrl) __P((cardbus_chipset_tag_t, int)); - int (*cardbus_power) __P((cardbus_chipset_tag_t, int)); + int (*cardbus_space_alloc) __P((cardbus_chipset_tag_t, rbus_tag_t, + bus_addr_t, bus_size_t, bus_addr_t, bus_size_t, + int, bus_addr_t *, bus_space_handle_t *)); + int (*cardbus_space_free) __P((cardbus_chipset_tag_t, rbus_tag_t, + bus_space_handle_t, bus_size_t)); + void *(*cardbus_intr_establish) __P((cardbus_chipset_tag_t, int, int, + int (*)(void *), void *)); + void (*cardbus_intr_disestablish) __P((cardbus_chipset_tag_t ct, void *)); + int (*cardbus_ctrl) __P((cardbus_chipset_tag_t, int)); + int (*cardbus_power) __P((cardbus_chipset_tag_t, int)); - cardbustag_t (*cardbus_make_tag) __P((cardbus_chipset_tag_t, int, int, int)); - void (*cardbus_free_tag) __P((cardbus_chipset_tag_t, cardbustag_t)); - cardbusreg_t (*cardbus_conf_read) __P((cardbus_chipset_tag_t, cardbustag_t, int)); - void (*cardbus_conf_write) __P((cardbus_chipset_tag_t, cardbustag_t, int, cardbusreg_t)); + cardbustag_t (*cardbus_make_tag) __P((cardbus_chipset_tag_t, int, int, int)); + void (*cardbus_free_tag) __P((cardbus_chipset_tag_t, cardbustag_t)); + cardbusreg_t (*cardbus_conf_read) __P((cardbus_chipset_tag_t, cardbustag_t, int)); + void (*cardbus_conf_write) __P((cardbus_chipset_tag_t, cardbustag_t, int, cardbusreg_t)); } cardbus_function_t, *cardbus_function_tag_t; #else @@ -232,24 +266,24 @@ typedef struct cardbus_functions { * struct cbslot_attach_args is the attach argument for cardbus card. */ struct cbslot_attach_args { - char *cba_busname; - bus_space_tag_t cba_iot; /* cardbus i/o space tag */ - bus_space_tag_t cba_memt; /* cardbus mem space tag */ - bus_dma_tag_t cba_dmat; /* DMA tag */ + char *cba_busname; + bus_space_tag_t cba_iot; /* cardbus i/o space tag */ + bus_space_tag_t cba_memt; /* cardbus mem space tag */ + bus_dma_tag_t cba_dmat; /* DMA tag */ - int cba_bus; /* cardbus bus number */ + int cba_bus; /* cardbus bus number */ - cardbus_chipset_tag_t cba_cc; /* cardbus chipset */ - cardbus_function_tag_t cba_cf; /* cardbus functions */ - int cba_intrline; /* interrupt line */ + cardbus_chipset_tag_t cba_cc; /* cardbus chipset */ + cardbus_function_tag_t cba_cf; /* cardbus functions */ + int cba_intrline; /* interrupt line */ #if rbus - rbus_tag_t cba_rbus_iot; /* CardBus i/o rbus tag */ - rbus_tag_t cba_rbus_memt; /* CardBus mem rbus tag */ + rbus_tag_t cba_rbus_iot; /* CardBus i/o rbus tag */ + rbus_tag_t cba_rbus_memt; /* CardBus mem rbus tag */ #endif - int cba_cacheline; /* cache line size */ - int cba_lattimer; /* latency timer */ + int cba_cacheline; /* cache line size */ + int cba_lattimer; /* latency timer */ }; @@ -265,31 +299,31 @@ struct cardbus_devfunc; * struct cardbus_softc is the softc for cardbus card. */ struct cardbus_softc { - struct device sc_dev; /* fundamental device structure */ + struct device sc_dev; /* fundamental device structure */ - int sc_bus; /* cardbus bus number */ - int sc_device; /* cardbus device number */ - int sc_intrline; /* CardBus intrline */ + int sc_bus; /* cardbus bus number */ + int sc_device; /* cardbus device number */ + int sc_intrline; /* CardBus intrline */ - bus_space_tag_t sc_iot; /* CardBus I/O space tag */ - bus_space_tag_t sc_memt; /* CardBus MEM space tag */ - bus_dma_tag_t sc_dmat; /* DMA tag */ + bus_space_tag_t sc_iot; /* CardBus I/O space tag */ + bus_space_tag_t sc_memt; /* CardBus MEM space tag */ + bus_dma_tag_t sc_dmat; /* DMA tag */ - cardbus_chipset_tag_t sc_cc; /* CardBus chipset */ - cardbus_function_tag_t sc_cf; /* CardBus function */ + cardbus_chipset_tag_t sc_cc; /* CardBus chipset */ + cardbus_function_tag_t sc_cf; /* CardBus function */ #if rbus - rbus_tag_t sc_rbus_iot; /* CardBus i/o rbus tag */ - rbus_tag_t sc_rbus_memt; /* CardBus mem rbus tag */ + rbus_tag_t sc_rbus_iot; /* CardBus i/o rbus tag */ + rbus_tag_t sc_rbus_memt; /* CardBus mem rbus tag */ #endif - int sc_cacheline; /* cache line size */ - int sc_lattimer; /* latency timer */ - int sc_volt; /* applied Vcc voltage */ + int sc_cacheline; /* cache line size */ + int sc_lattimer; /* latency timer */ + int sc_volt; /* applied Vcc voltage */ #define PCCARD_33V 0x02 #define PCCARD_XXV 0x04 #define PCCARD_YYV 0x08 - int sc_poweron_func; + int sc_poweron_func; struct cardbus_devfunc *sc_funcs; /* list of cardbus device functions */ }; @@ -302,77 +336,77 @@ struct cardbus_softc { * disallocation. */ typedef struct cardbus_devfunc { - cardbus_chipset_tag_t ct_cc; - cardbus_function_tag_t ct_cf; - struct cardbus_softc *ct_sc; /* pointer to the parent */ - int ct_bus; /* bus number */ - int ct_dev; /* device number */ - int ct_func; /* function number */ + cardbus_chipset_tag_t ct_cc; + cardbus_function_tag_t ct_cf; + struct cardbus_softc *ct_sc; /* pointer to the parent */ + int ct_bus; /* bus number */ + int ct_dev; /* device number */ + int ct_func; /* function number */ #if rbus - rbus_tag_t ct_rbus_iot; /* CardBus i/o rbus tag */ - rbus_tag_t ct_rbus_memt; /* CardBus mem rbus tag */ + rbus_tag_t ct_rbus_iot; /* CardBus i/o rbus tag */ + rbus_tag_t ct_rbus_memt; /* CardBus mem rbus tag */ #endif - u_int32_t ct_bar[6]; /* Base Address Regs 0 to 6 */ - u_int32_t ct_lc; /* Latency timer and cache line size */ - /* u_int32_t ct_cisreg; */ /* CIS reg: is it needed??? */ + u_int32_t ct_bar[6]; /* Base Address Regs 0 to 6 */ + u_int32_t ct_lc; /* Latency timer and cache line size */ + /* u_int32_t ct_cisreg; */ /* CIS reg: is it needed??? */ - struct device *ct_device; /* pointer to the device */ + struct device *ct_device; /* pointer to the device */ - struct cardbus_devfunc *ct_next; + struct cardbus_devfunc *ct_next; - /* some data structure needed for tuple??? */ + /* some data structure needed for tuple??? */ } *cardbus_devfunc_t; /* XXX various things extracted from CIS */ struct cardbus_cis_info { - int32_t manufacturer; - int32_t product; - char cis1_info_buf[256]; - char* cis1_info[4]; - struct cb_bar_info { - unsigned int flags; - unsigned int size; - } bar[7]; - unsigned int funcid; - union { - struct { - int uart_type; - int uart_present; - } serial; - struct { - char netid[6]; - char netid_present; - char __filler; - } network; - } funce; + int32_t manufacturer; + int32_t product; + char cis1_info_buf[256]; + char* cis1_info[4]; + struct cb_bar_info { + unsigned int flags; + unsigned int size; + } bar[7]; + unsigned int funcid; + union { + struct { + int uart_type; + int uart_present; + } serial; + struct { + char netid[6]; + char netid_present; + char __filler; + } network; + } funce; }; struct cardbus_attach_args { - int ca_unit; - cardbus_devfunc_t ca_ct; + int ca_unit; + cardbus_devfunc_t ca_ct; - bus_space_tag_t ca_iot; /* CardBus I/O space tag */ - bus_space_tag_t ca_memt; /* CardBus MEM space tag */ - bus_dma_tag_t ca_dmat; /* DMA tag */ + bus_space_tag_t ca_iot; /* CardBus I/O space tag */ + bus_space_tag_t ca_memt; /* CardBus MEM space tag */ + bus_dma_tag_t ca_dmat; /* DMA tag */ - u_int ca_device; - u_int ca_function; - cardbustag_t ca_tag; - cardbusreg_t ca_id; - cardbusreg_t ca_class; + u_int ca_device; + u_int ca_function; + cardbustag_t ca_tag; + cardbusreg_t ca_id; + cardbusreg_t ca_class; - /* interrupt information */ - cardbus_intr_line_t ca_intrline; + /* interrupt information */ + cardbus_intr_line_t ca_intrline; #if rbus - rbus_tag_t ca_rbus_iot; /* CardBus i/o rbus tag */ - rbus_tag_t ca_rbus_memt; /* CardBus mem rbus tag */ + rbus_tag_t ca_rbus_iot; /* CardBus i/o rbus tag */ + rbus_tag_t ca_rbus_memt; /* CardBus mem rbus tag */ #endif - struct cardbus_cis_info ca_cis; + struct cardbus_cis_info ca_cis; }; @@ -419,8 +453,10 @@ struct cardbus_attach_args { int cardbus_attach_card __P((struct cardbus_softc *)); void cardbus_detach_card __P((struct cardbus_softc *)); -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)); -void cardbus_intr_disestablish __P((cardbus_chipset_tag_t, cardbus_function_tag_t, void *handler)); +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)); +void cardbus_intr_disestablish __P((cardbus_chipset_tag_t, + cardbus_function_tag_t, void *handler)); int cardbus_mapreg_map __P((struct cardbus_softc *, int, int, cardbusreg_t, int, bus_space_tag_t *, bus_space_handle_t *, bus_addr_t *, bus_size_t *));