Home | History | Annotate | Line # | Download | only in pci
pccbbvar.h revision 1.6
      1  1.6  chopps /*	$NetBSD: pccbbvar.h,v 1.6 2000/02/05 18:42:37 chopps Exp $	*/
      2  1.1    haya /*
      3  1.1    haya  * Copyright (c) 1999 HAYAKAWA Koichi.  All rights reserved.
      4  1.1    haya  *
      5  1.1    haya  * Redistribution and use in source and binary forms, with or without
      6  1.1    haya  * modification, are permitted provided that the following conditions
      7  1.1    haya  * are met:
      8  1.1    haya  * 1. Redistributions of source code must retain the above copyright
      9  1.1    haya  *    notice, this list of conditions and the following disclaimer.
     10  1.1    haya  * 2. Redistributions in binary form must reproduce the above copyright
     11  1.1    haya  *    notice, this list of conditions and the following disclaimer in the
     12  1.1    haya  *    documentation and/or other materials provided with the distribution.
     13  1.1    haya  * 3. All advertising materials mentioning features or use of this software
     14  1.1    haya  *    must display the following acknowledgement:
     15  1.1    haya  *	This product includes software developed by HAYAKAWA Koichi.
     16  1.1    haya  * 4. The name of the author may not be used to endorse or promote products
     17  1.1    haya  *    derived from this software without specific prior written permission.
     18  1.1    haya  *
     19  1.1    haya  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
     20  1.1    haya  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
     21  1.1    haya  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
     22  1.1    haya  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
     23  1.1    haya  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
     24  1.1    haya  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
     25  1.1    haya  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
     26  1.1    haya  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
     27  1.1    haya  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
     28  1.1    haya  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
     29  1.1    haya  */
     30  1.1    haya 
     31  1.1    haya /* require sys/device.h */
     32  1.1    haya /* require sys/queue.h */
     33  1.1    haya /* require dev/ic/i82365reg.h */
     34  1.1    haya /* require dev/ic/i82365var.h */
     35  1.1    haya 
     36  1.1    haya #ifndef _DEV_PCI_PCCBBVAR_H_
     37  1.1    haya #define	_DEV_PCI_PCCBBVAR_H_
     38  1.1    haya 
     39  1.1    haya #define	PCIC_FLAG_SOCKETP	0x0001
     40  1.1    haya #define	PCIC_FLAG_CARDP		0x0002
     41  1.1    haya 
     42  1.1    haya /* Chipset ID */
     43  1.6  chopps #define	CB_UNKNOWN	0	/* NOT Cardbus-PCI bridge */
     44  1.6  chopps #define	CB_TI113X	1	/* TI PCI1130/1131 */
     45  1.6  chopps #define	CB_TI12XX	2	/* TI PCI1250/1220 */
     46  1.6  chopps #define	CB_RX5C47X	3	/* RICOH RX5C475/476/477 */
     47  1.6  chopps #define	CB_RX5C46X	4	/* RICOH RX5C465/466/467 */
     48  1.6  chopps #define	CB_TOPIC95	5	/* Toshiba ToPIC95 */
     49  1.6  chopps #define	CB_TOPIC95B	6	/* Toshiba ToPIC95B */
     50  1.6  chopps #define	CB_TOPIC97	7	/* Toshiba ToPIC97 */
     51  1.6  chopps #define	CB_CIRRUS	8	/* Cirrus Logic CL-PD683X */
     52  1.6  chopps #define	CB_CHIPS_LAST	9	/* Sentinel */
     53  1.1    haya 
     54  1.1    haya #if 0
     55  1.1    haya static char *cb_chipset_name[CB_CHIPS_LAST] = {
     56  1.6  chopps 	"unknown", "TI 113X", "TI 12XX", "RF5C47X", "RF5C46X", "ToPIC95",
     57  1.6  chopps 	"ToPIC95B", "ToPIC97", "CL-PD 683X",
     58  1.1    haya };
     59  1.1    haya #endif
     60  1.1    haya 
     61  1.1    haya struct pccbb_softc;
     62  1.5    haya struct pccbb_intrhand_list;
     63  1.1    haya 
     64  1.1    haya #if pccard
     65  1.1    haya struct cbb_pcmcia_softc {
     66  1.6  chopps 	pccard_chipset_t cpc_ct;
     67  1.6  chopps 	struct pccard_softc *cpc_csc;
     68  1.6  chopps 	struct pccbb_softc *cpc_parent;
     69  1.6  chopps 	u_int8_t cpc_statreg;		/* status register */
     70  1.6  chopps 	u_int32_t cpc_regbase;		/* base index of the slot */
     71  1.6  chopps 	u_int16_t cpc_flags;
     72  1.6  chopps 	bus_space_tag_t cpc_iot;
     73  1.6  chopps 	bus_space_handle_t cpc_ioh;
     74  1.1    haya };
     75  1.1    haya #endif /* pccard */
     76  1.1    haya 
     77  1.1    haya struct cbb_pcic_handle {
     78  1.6  chopps 	struct device *ph_parent;
     79  1.6  chopps 	bus_space_tag_t ph_base_t;
     80  1.6  chopps 	bus_space_handle_t ph_base_h;
     81  1.6  chopps 	u_int8_t (*ph_read) __P((struct cbb_pcic_handle *, int));
     82  1.6  chopps 	void (*ph_write) __P((struct cbb_pcic_handle *, int, u_int8_t));
     83  1.6  chopps 	int sock;
     84  1.6  chopps 
     85  1.6  chopps 	int vendor;
     86  1.6  chopps 	int flags;
     87  1.6  chopps 	int memalloc;
     88  1.6  chopps 	struct {
     89  1.6  chopps 		bus_addr_t addr;
     90  1.6  chopps 		bus_size_t size;
     91  1.6  chopps 		long offset;
     92  1.6  chopps 		int kind;
     93  1.6  chopps 	} mem[PCIC_MEM_WINS];
     94  1.6  chopps 	int ioalloc;
     95  1.6  chopps 	struct {
     96  1.6  chopps 		bus_addr_t addr;
     97  1.6  chopps 		bus_size_t size;
     98  1.6  chopps 		int width;
     99  1.6  chopps 	} io[PCIC_IO_WINS];
    100  1.6  chopps 	int ih_irq;
    101  1.6  chopps 	struct device *pcmcia;
    102  1.1    haya 
    103  1.6  chopps 	int shutdown;
    104  1.1    haya };
    105  1.1    haya 
    106  1.1    haya struct pccbb_win_chain {
    107  1.6  chopps 	bus_addr_t wc_start;		/* Caution: region [start, end], */
    108  1.6  chopps 	bus_addr_t wc_end;		/* instead of [start, end). */
    109  1.6  chopps 	int wc_flags;
    110  1.6  chopps 	bus_space_handle_t wc_handle;
    111  1.6  chopps 	struct pccbb_win_chain *wc_next;
    112  1.1    haya };
    113  1.6  chopps #define	PCCBB_MEM_CACHABLE	1
    114  1.1    haya 
    115  1.1    haya struct pccbb_softc {
    116  1.6  chopps 	struct device sc_dev;
    117  1.6  chopps 	bus_space_tag_t sc_iot;
    118  1.6  chopps 	bus_space_tag_t sc_memt;
    119  1.6  chopps 	bus_dma_tag_t sc_dmat;
    120  1.1    haya 
    121  1.1    haya #if rbus
    122  1.6  chopps 	rbus_tag_t sc_rbus_iot;		/* rbus for i/o donated from parent */
    123  1.6  chopps 	rbus_tag_t sc_rbus_memt;	/* rbus for mem donated from parent */
    124  1.1    haya #endif
    125  1.1    haya 
    126  1.6  chopps 	bus_space_tag_t sc_base_memt;
    127  1.6  chopps 	bus_space_handle_t sc_base_memh;
    128  1.1    haya 
    129  1.6  chopps 	void *sc_ih;			/* interrupt handler */
    130  1.6  chopps 	int sc_intrline;		/* interrupt line */
    131  1.6  chopps 	pcitag_t sc_intrtag;		/* copy of pa->pa_intrtag */
    132  1.6  chopps 	pci_intr_pin_t sc_intrpin;	/* copy of pa->pa_intrpin */
    133  1.6  chopps 	int sc_function;
    134  1.6  chopps 	u_int32_t sc_flags;
    135  1.6  chopps #define	CBB_CARDEXIST	0x01
    136  1.6  chopps #define	CBB_INSERTING	0x01000000
    137  1.6  chopps #define	CBB_16BITCARD	0x04
    138  1.6  chopps #define	CBB_32BITCARD	0x08
    139  1.1    haya 
    140  1.1    haya #if pccard
    141  1.6  chopps 	struct cbb_pcmcia_softc sc_pcmcia;
    142  1.6  chopps #endif					/* pccard */
    143  1.6  chopps 	pci_chipset_tag_t sc_pc;
    144  1.6  chopps 	pcitag_t sc_tag;
    145  1.6  chopps 	int sc_chipset;			/* chipset id */
    146  1.6  chopps 
    147  1.6  chopps 	bus_addr_t sc_mem_start;	/* CardBus/PCMCIA memory start */
    148  1.6  chopps 	bus_addr_t sc_mem_end;		/* CardBus/PCMCIA memory end */
    149  1.6  chopps 	bus_addr_t sc_io_start;		/* CardBus/PCMCIA io start */
    150  1.6  chopps 	bus_addr_t sc_io_end;		/* CardBus/PCMCIA io end */
    151  1.6  chopps 
    152  1.6  chopps 	/* CardBus stuff */
    153  1.6  chopps 	struct cardslot_softc *sc_csc;
    154  1.6  chopps 
    155  1.6  chopps 	struct pccbb_win_chain *sc_memwindow;
    156  1.6  chopps 	struct pccbb_win_chain *sc_iowindow;
    157  1.6  chopps 
    158  1.6  chopps 	/* pcmcia stuff */
    159  1.6  chopps 	struct pcic_handle sc_pcmcia_h;
    160  1.6  chopps 	pcmcia_chipset_tag_t sc_pct;
    161  1.6  chopps 	int sc_pcmcia_flags;
    162  1.6  chopps #define	PCCBB_PCMCIA_IO_RELOC	0x01	/* IO addr relocatable stuff exists */
    163  1.6  chopps #define	PCCBB_PCMCIA_MEM_32	0x02	/* 32-bit memory address ready */
    164  1.6  chopps #define	PCCBB_PCMCIA_16BITONLY	0x04	/* 32-bit mode disable */
    165  1.1    haya 
    166  1.6  chopps 	struct proc *sc_event_thread;
    167  1.6  chopps 	 SIMPLEQ_HEAD(, pcic_event) sc_events;
    168  1.5    haya 
    169  1.6  chopps 	/* interrupt handler list on the bridge */
    170  1.6  chopps 	struct pccbb_intrhand_list *sc_pil;
    171  1.5    haya };
    172  1.5    haya 
    173  1.5    haya /*
    174  1.5    haya  * struct pccbb_intrhand_list holds interrupt handler and argument for
    175  1.5    haya  * child devices.
    176  1.5    haya  */
    177  1.5    haya 
    178  1.5    haya struct pccbb_intrhand_list {
    179  1.6  chopps 	int (*pil_func) __P((void *));
    180  1.6  chopps 	void *pil_arg;
    181  1.6  chopps 	struct pccbb_intrhand_list *pil_next;
    182  1.1    haya };
    183  1.1    haya 
    184  1.1    haya #endif /* _DEV_PCI_PCCBBREG_H_ */
    185