pccbbvar.h revision 1.41 1 1.41 dyoung /* $NetBSD: pccbbvar.h,v 1.41 2010/04/20 23:39:11 dyoung Exp $ */
2 1.39 snj
3 1.1 haya /*
4 1.1 haya * Copyright (c) 1999 HAYAKAWA Koichi. All rights reserved.
5 1.1 haya *
6 1.1 haya * Redistribution and use in source and binary forms, with or without
7 1.1 haya * modification, are permitted provided that the following conditions
8 1.1 haya * are met:
9 1.1 haya * 1. Redistributions of source code must retain the above copyright
10 1.1 haya * notice, this list of conditions and the following disclaimer.
11 1.1 haya * 2. Redistributions in binary form must reproduce the above copyright
12 1.1 haya * notice, this list of conditions and the following disclaimer in the
13 1.1 haya * documentation and/or other materials provided with the distribution.
14 1.1 haya *
15 1.1 haya * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
16 1.1 haya * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
17 1.1 haya * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
18 1.1 haya * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
19 1.1 haya * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
20 1.1 haya * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
21 1.1 haya * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
22 1.1 haya * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23 1.1 haya * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
24 1.1 haya * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25 1.1 haya */
26 1.1 haya
27 1.1 haya /* require sys/device.h */
28 1.1 haya /* require sys/queue.h */
29 1.12 thorpej /* require sys/callout.h */
30 1.1 haya /* require dev/ic/i82365reg.h */
31 1.1 haya
32 1.1 haya #ifndef _DEV_PCI_PCCBBVAR_H_
33 1.1 haya #define _DEV_PCI_PCCBBVAR_H_
34 1.1 haya
35 1.38 dyoung #include <sys/mutex.h>
36 1.38 dyoung #include <sys/condvar.h>
37 1.38 dyoung
38 1.1 haya #define PCIC_FLAG_SOCKETP 0x0001
39 1.1 haya #define PCIC_FLAG_CARDP 0x0002
40 1.1 haya
41 1.1 haya /* Chipset ID */
42 1.6 chopps #define CB_UNKNOWN 0 /* NOT Cardbus-PCI bridge */
43 1.6 chopps #define CB_TI113X 1 /* TI PCI1130/1131 */
44 1.20 briggs #define CB_TI12XX 2 /* TI PCI12xx/14xx/44xx/15xx/45xx */
45 1.6 chopps #define CB_RX5C47X 3 /* RICOH RX5C475/476/477 */
46 1.6 chopps #define CB_RX5C46X 4 /* RICOH RX5C465/466/467 */
47 1.6 chopps #define CB_TOPIC95 5 /* Toshiba ToPIC95 */
48 1.6 chopps #define CB_TOPIC95B 6 /* Toshiba ToPIC95B */
49 1.6 chopps #define CB_TOPIC97 7 /* Toshiba ToPIC97 */
50 1.6 chopps #define CB_CIRRUS 8 /* Cirrus Logic CL-PD683X */
51 1.20 briggs #define CB_TI125X 9 /* TI PCI1250/1251(B)/1450 */
52 1.29 dyoung #define CB_TI1420 10 /* TI PCI1420 */
53 1.34 dyoung #define CB_O2MICRO 11 /* O2 Micro 67xx/68xx/69xx */
54 1.1 haya
55 1.5 haya struct pccbb_intrhand_list;
56 1.1 haya
57 1.1 haya struct pccbb_win_chain {
58 1.6 chopps bus_addr_t wc_start; /* Caution: region [start, end], */
59 1.6 chopps bus_addr_t wc_end; /* instead of [start, end). */
60 1.6 chopps int wc_flags;
61 1.6 chopps bus_space_handle_t wc_handle;
62 1.7 thorpej TAILQ_ENTRY(pccbb_win_chain) wc_list;
63 1.1 haya };
64 1.6 chopps #define PCCBB_MEM_CACHABLE 1
65 1.1 haya
66 1.7 thorpej TAILQ_HEAD(pccbb_win_chain_head, pccbb_win_chain);
67 1.7 thorpej
68 1.36 drochner struct pccbb_softc; /* forward */
69 1.36 drochner struct pcic_handle {
70 1.36 drochner /* extracted from i82365var.h */
71 1.36 drochner int memalloc;
72 1.36 drochner struct {
73 1.36 drochner bus_addr_t addr;
74 1.36 drochner bus_size_t size;
75 1.36 drochner long offset;
76 1.36 drochner int kind;
77 1.36 drochner } mem[PCIC_MEM_WINS];
78 1.36 drochner int ioalloc;
79 1.36 drochner struct {
80 1.36 drochner bus_addr_t addr;
81 1.36 drochner bus_size_t size;
82 1.36 drochner int width;
83 1.36 drochner } io[PCIC_IO_WINS];
84 1.36 drochner };
85 1.36 drochner
86 1.1 haya struct pccbb_softc {
87 1.35 drochner device_t sc_dev;
88 1.6 chopps bus_space_tag_t sc_iot;
89 1.6 chopps bus_space_tag_t sc_memt;
90 1.6 chopps bus_dma_tag_t sc_dmat;
91 1.1 haya
92 1.6 chopps rbus_tag_t sc_rbus_iot; /* rbus for i/o donated from parent */
93 1.6 chopps rbus_tag_t sc_rbus_memt; /* rbus for mem donated from parent */
94 1.1 haya
95 1.6 chopps bus_space_tag_t sc_base_memt;
96 1.6 chopps bus_space_handle_t sc_base_memh;
97 1.31 dyoung bus_size_t sc_base_size;
98 1.12 thorpej
99 1.12 thorpej struct callout sc_insert_ch;
100 1.1 haya
101 1.6 chopps void *sc_ih; /* interrupt handler */
102 1.14 sommerfe struct pci_attach_args sc_pa; /* copy of our attach args */
103 1.6 chopps u_int32_t sc_flags;
104 1.6 chopps #define CBB_CARDEXIST 0x01
105 1.6 chopps #define CBB_INSERTING 0x01000000
106 1.6 chopps #define CBB_16BITCARD 0x04
107 1.6 chopps #define CBB_32BITCARD 0x08
108 1.19 nakayama #define CBB_MEMHMAPPED 0x02000000
109 1.31 dyoung #define CBB_SPECMAPPED 0x04000000 /* "special" mapping */
110 1.1 haya
111 1.6 chopps pci_chipset_tag_t sc_pc;
112 1.6 chopps pcitag_t sc_tag;
113 1.6 chopps int sc_chipset; /* chipset id */
114 1.6 chopps
115 1.6 chopps bus_addr_t sc_mem_start; /* CardBus/PCMCIA memory start */
116 1.6 chopps bus_addr_t sc_mem_end; /* CardBus/PCMCIA memory end */
117 1.6 chopps bus_addr_t sc_io_start; /* CardBus/PCMCIA io start */
118 1.6 chopps bus_addr_t sc_io_end; /* CardBus/PCMCIA io end */
119 1.15 minoura
120 1.6 chopps /* CardBus stuff */
121 1.6 chopps struct cardslot_softc *sc_csc;
122 1.6 chopps
123 1.7 thorpej struct pccbb_win_chain_head sc_memwindow;
124 1.7 thorpej struct pccbb_win_chain_head sc_iowindow;
125 1.6 chopps
126 1.6 chopps /* pcmcia stuff */
127 1.6 chopps struct pcic_handle sc_pcmcia_h;
128 1.6 chopps int sc_pcmcia_flags;
129 1.6 chopps #define PCCBB_PCMCIA_IO_RELOC 0x01 /* IO addr relocatable stuff exists */
130 1.6 chopps #define PCCBB_PCMCIA_MEM_32 0x02 /* 32-bit memory address ready */
131 1.1 haya
132 1.28 dyoung volatile int sc_pwrcycle;
133 1.38 dyoung kcondvar_t sc_pwr_cv;
134 1.38 dyoung kmutex_t sc_pwr_mtx;
135 1.5 haya
136 1.6 chopps /* interrupt handler list on the bridge */
137 1.18 haya LIST_HEAD(, pccbb_intrhand_list) sc_pil;
138 1.41 dyoung /* can i call intr handler for child device? */
139 1.41 dyoung bool sc_pil_intr_enable;
140 1.5 haya };
141 1.5 haya
142 1.5 haya /*
143 1.5 haya * struct pccbb_intrhand_list holds interrupt handler and argument for
144 1.5 haya * child devices.
145 1.5 haya */
146 1.5 haya
147 1.5 haya struct pccbb_intrhand_list {
148 1.24 perry int (*pil_func)(void *);
149 1.6 chopps void *pil_arg;
150 1.27 yamt ipl_cookie_t pil_icookie;
151 1.18 haya LIST_ENTRY(pccbb_intrhand_list) pil_next;
152 1.1 haya };
153 1.16 mcr
154 1.24 perry void pccbb_intr_route(struct pccbb_softc *sc);
155 1.16 mcr
156 1.1 haya
157 1.1 haya #endif /* _DEV_PCI_PCCBBREG_H_ */
158