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