Home | History | Annotate | Line # | Download | only in pci
pccbbvar.h revision 1.29
      1  1.29    dyoung /*	$NetBSD: pccbbvar.h,v 1.29 2007/08/10 22:57:54 dyoung 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.12   thorpej /* require sys/callout.h */
     34   1.1      haya /* require dev/ic/i82365reg.h */
     35   1.1      haya /* require dev/ic/i82365var.h */
     36   1.1      haya 
     37   1.1      haya #ifndef _DEV_PCI_PCCBBVAR_H_
     38   1.1      haya #define	_DEV_PCI_PCCBBVAR_H_
     39   1.1      haya 
     40   1.1      haya #define	PCIC_FLAG_SOCKETP	0x0001
     41   1.1      haya #define	PCIC_FLAG_CARDP		0x0002
     42   1.1      haya 
     43   1.1      haya /* Chipset ID */
     44   1.6    chopps #define	CB_UNKNOWN	0	/* NOT Cardbus-PCI bridge */
     45   1.6    chopps #define	CB_TI113X	1	/* TI PCI1130/1131 */
     46  1.20    briggs #define	CB_TI12XX	2	/* TI PCI12xx/14xx/44xx/15xx/45xx */
     47   1.6    chopps #define	CB_RX5C47X	3	/* RICOH RX5C475/476/477 */
     48   1.6    chopps #define	CB_RX5C46X	4	/* RICOH RX5C465/466/467 */
     49   1.6    chopps #define	CB_TOPIC95	5	/* Toshiba ToPIC95 */
     50   1.6    chopps #define	CB_TOPIC95B	6	/* Toshiba ToPIC95B */
     51   1.6    chopps #define	CB_TOPIC97	7	/* Toshiba ToPIC97 */
     52   1.6    chopps #define	CB_CIRRUS	8	/* Cirrus Logic CL-PD683X */
     53  1.20    briggs #define	CB_TI125X	9	/* TI PCI1250/1251(B)/1450 */
     54  1.29    dyoung #define	CB_TI1420	10	/* TI PCI1420 */
     55   1.1      haya 
     56   1.1      haya struct pccbb_softc;
     57   1.5      haya struct pccbb_intrhand_list;
     58   1.1      haya 
     59   1.1      haya 
     60   1.1      haya struct cbb_pcic_handle {
     61   1.6    chopps 	struct device *ph_parent;
     62   1.6    chopps 	bus_space_tag_t ph_base_t;
     63   1.6    chopps 	bus_space_handle_t ph_base_h;
     64  1.24     perry 	u_int8_t (*ph_read)(struct cbb_pcic_handle *, int);
     65  1.24     perry 	void (*ph_write)(struct cbb_pcic_handle *, int, u_int8_t);
     66   1.6    chopps 	int sock;
     67   1.6    chopps 
     68   1.6    chopps 	int vendor;
     69   1.6    chopps 	int flags;
     70   1.6    chopps 	int memalloc;
     71   1.6    chopps 	struct {
     72   1.6    chopps 		bus_addr_t addr;
     73   1.6    chopps 		bus_size_t size;
     74   1.6    chopps 		long offset;
     75   1.6    chopps 		int kind;
     76   1.6    chopps 	} mem[PCIC_MEM_WINS];
     77   1.6    chopps 	int ioalloc;
     78   1.6    chopps 	struct {
     79   1.6    chopps 		bus_addr_t addr;
     80   1.6    chopps 		bus_size_t size;
     81   1.6    chopps 		int width;
     82   1.6    chopps 	} io[PCIC_IO_WINS];
     83   1.6    chopps 	int ih_irq;
     84   1.6    chopps 	struct device *pcmcia;
     85   1.1      haya 
     86   1.6    chopps 	int shutdown;
     87   1.1      haya };
     88   1.1      haya 
     89   1.1      haya struct pccbb_win_chain {
     90   1.6    chopps 	bus_addr_t wc_start;		/* Caution: region [start, end], */
     91   1.6    chopps 	bus_addr_t wc_end;		/* instead of [start, end). */
     92   1.6    chopps 	int wc_flags;
     93   1.6    chopps 	bus_space_handle_t wc_handle;
     94   1.7   thorpej 	TAILQ_ENTRY(pccbb_win_chain) wc_list;
     95   1.1      haya };
     96   1.6    chopps #define	PCCBB_MEM_CACHABLE	1
     97   1.1      haya 
     98   1.7   thorpej TAILQ_HEAD(pccbb_win_chain_head, pccbb_win_chain);
     99   1.7   thorpej 
    100   1.1      haya struct pccbb_softc {
    101   1.6    chopps 	struct device sc_dev;
    102   1.6    chopps 	bus_space_tag_t sc_iot;
    103   1.6    chopps 	bus_space_tag_t sc_memt;
    104   1.6    chopps 	bus_dma_tag_t sc_dmat;
    105   1.1      haya 
    106   1.1      haya #if rbus
    107   1.6    chopps 	rbus_tag_t sc_rbus_iot;		/* rbus for i/o donated from parent */
    108   1.6    chopps 	rbus_tag_t sc_rbus_memt;	/* rbus for mem donated from parent */
    109   1.1      haya #endif
    110   1.1      haya 
    111   1.6    chopps 	bus_space_tag_t sc_base_memt;
    112   1.6    chopps 	bus_space_handle_t sc_base_memh;
    113  1.12   thorpej 
    114  1.12   thorpej 	struct callout sc_insert_ch;
    115   1.1      haya 
    116   1.6    chopps 	void *sc_ih;			/* interrupt handler */
    117  1.14  sommerfe 	struct pci_attach_args sc_pa;	/* copy of our attach args */
    118   1.6    chopps 	int sc_function;
    119   1.6    chopps 	u_int32_t sc_flags;
    120   1.6    chopps #define	CBB_CARDEXIST	0x01
    121   1.6    chopps #define	CBB_INSERTING	0x01000000
    122   1.6    chopps #define	CBB_16BITCARD	0x04
    123   1.6    chopps #define	CBB_32BITCARD	0x08
    124  1.19  nakayama #define	CBB_MEMHMAPPED	0x02000000
    125   1.1      haya 
    126   1.6    chopps 	pci_chipset_tag_t sc_pc;
    127   1.6    chopps 	pcitag_t sc_tag;
    128   1.6    chopps 	int sc_chipset;			/* chipset id */
    129   1.6    chopps 
    130   1.6    chopps 	bus_addr_t sc_mem_start;	/* CardBus/PCMCIA memory start */
    131   1.6    chopps 	bus_addr_t sc_mem_end;		/* CardBus/PCMCIA memory end */
    132   1.6    chopps 	bus_addr_t sc_io_start;		/* CardBus/PCMCIA io start */
    133   1.6    chopps 	bus_addr_t sc_io_end;		/* CardBus/PCMCIA io end */
    134  1.15   minoura 
    135  1.15   minoura 	pcireg_t sc_sockbase;		/* Socket base register */
    136  1.15   minoura 	pcireg_t sc_busnum;		/* bus number */
    137   1.6    chopps 
    138   1.6    chopps 	/* CardBus stuff */
    139   1.6    chopps 	struct cardslot_softc *sc_csc;
    140   1.6    chopps 
    141   1.7   thorpej 	struct pccbb_win_chain_head sc_memwindow;
    142   1.7   thorpej 	struct pccbb_win_chain_head sc_iowindow;
    143   1.6    chopps 
    144   1.6    chopps 	/* pcmcia stuff */
    145   1.6    chopps 	struct pcic_handle sc_pcmcia_h;
    146   1.6    chopps 	pcmcia_chipset_tag_t sc_pct;
    147   1.6    chopps 	int sc_pcmcia_flags;
    148   1.6    chopps #define	PCCBB_PCMCIA_IO_RELOC	0x01	/* IO addr relocatable stuff exists */
    149   1.6    chopps #define	PCCBB_PCMCIA_MEM_32	0x02	/* 32-bit memory address ready */
    150   1.1      haya 
    151   1.6    chopps 	struct proc *sc_event_thread;
    152   1.7   thorpej 	SIMPLEQ_HEAD(, pcic_event) sc_events;
    153  1.28    dyoung 	volatile int sc_pwrcycle;
    154   1.5      haya 
    155   1.6    chopps 	/* interrupt handler list on the bridge */
    156  1.18      haya 	LIST_HEAD(, pccbb_intrhand_list) sc_pil;
    157  1.11      haya 	int sc_pil_intr_enable;	/* can i call intr handler for child device? */
    158  1.17      haya 
    159  1.17      haya 	int sc_pwrmgt_offs;	/* Offset for power management capability */
    160  1.23  jmcneill 	struct pci_conf_state sc_pciconf;
    161  1.26  jmcneill 	pcireg_t sc_ricoh_misc_ctrl;
    162   1.5      haya };
    163   1.5      haya 
    164   1.5      haya /*
    165   1.5      haya  * struct pccbb_intrhand_list holds interrupt handler and argument for
    166   1.5      haya  * child devices.
    167   1.5      haya  */
    168   1.5      haya 
    169   1.5      haya struct pccbb_intrhand_list {
    170  1.24     perry 	int (*pil_func)(void *);
    171   1.6    chopps 	void *pil_arg;
    172  1.27      yamt 	ipl_cookie_t pil_icookie;
    173  1.18      haya 	LIST_ENTRY(pccbb_intrhand_list) pil_next;
    174   1.1      haya };
    175  1.16       mcr 
    176  1.24     perry void pccbb_intr_route(struct pccbb_softc *sc);
    177  1.16       mcr 
    178   1.1      haya 
    179   1.1      haya #endif /* _DEV_PCI_PCCBBREG_H_ */
    180