1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38 #ifndef _SISUSB_H_
39 #define _SISUSB_H_
40
41 #include <linux/mutex.h>
42
43
44
45 #define SISUSB_VERSION 0
46 #define SISUSB_REVISION 0
47 #define SISUSB_PATCHLEVEL 8
48
49
50
51 #include <linux/console.h>
52 #include <linux/vt_kern.h>
53 #include "sisusb_struct.h"
54
55
56
57 #define SISUSB_MINOR 133
58
59
60 #define SISUSB_IBUF_SIZE 0x01000
61 #define SISUSB_OBUF_SIZE 0x10000
62
63 #define NUMOBUFS 8
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81 #ifdef __BIG_ENDIAN
82 #define SISUSB_CORRECT_ENDIANNESS_PACKET(p) \
83 do { \
84 p->header = cpu_to_le16(p->header); \
85 p->address = cpu_to_le32(p->address); \
86 p->data = cpu_to_le32(p->data); \
87 } while(0)
88 #else
89 #define SISUSB_CORRECT_ENDIANNESS_PACKET(p)
90 #endif
91
92 struct sisusb_usb_data;
93
94 struct sisusb_urb_context {
95 struct sisusb_usb_data *sisusb;
96 int urbindex;
97 int *actual_length;
98 };
99
100 struct sisusb_usb_data {
101 struct usb_device *sisusb_dev;
102 struct usb_interface *interface;
103 struct kref kref;
104 wait_queue_head_t wait_q;
105 struct mutex lock;
106 unsigned int ifnum;
107 int minor;
108 int isopen;
109 int present;
110 int ready;
111 int numobufs;
112 char *obuf[NUMOBUFS], *ibuf;
113 int obufsize, ibufsize;
114 struct urb *sisurbout[NUMOBUFS];
115 struct urb *sisurbin;
116 unsigned char urbstatus[NUMOBUFS];
117 unsigned char completein;
118 struct sisusb_urb_context urbout_context[NUMOBUFS];
119 unsigned long flagb0;
120 unsigned long vrambase;
121 unsigned int vramsize;
122 unsigned long mmiobase;
123 unsigned int mmiosize;
124 unsigned long ioportbase;
125 unsigned char devinit;
126 unsigned char gfxinit;
127 unsigned short chipid, chipvendor;
128 unsigned short chiprevision;
129 #ifdef CONFIG_USB_SISUSBVGA_CON
130 struct SiS_Private *SiS_Pr;
131 unsigned long scrbuf;
132 unsigned int scrbuf_size;
133 int haveconsole, con_first, con_last;
134 int havethisconsole[MAX_NR_CONSOLES];
135 int textmodedestroyed;
136 unsigned int sisusb_num_columns;
137 int cur_start_addr, con_rolled_over;
138 int sisusb_cursor_loc, bad_cursor_pos;
139 int sisusb_cursor_size_from;
140 int sisusb_cursor_size_to;
141 int current_font_height, current_font_512;
142 int font_backup_size, font_backup_height, font_backup_512;
143 char *font_backup;
144 int font_slot;
145 struct vc_data *sisusb_display_fg;
146 int is_gfx;
147 int con_blanked;
148 #endif
149 };
150
151 #define to_sisusb_dev(d) container_of(d, struct sisusb_usb_data, kref)
152
153
154
155
156 #define SU_URB_BUSY 1
157 #define SU_URB_ALLOC 2
158
159
160
161 #define SISUSB_EP_GFX_IN 0x0e
162 #define SISUSB_EP_GFX_OUT 0x0e
163
164 #define SISUSB_EP_GFX_BULK_OUT 0x01
165 #define SISUSB_EP_GFX_BULK_IN 0x02
166
167 #define SISUSB_EP_GFX_LBULK_OUT 0x03
168
169 #define SISUSB_EP_UNKNOWN_04 0x04
170
171 #define SISUSB_EP_BRIDGE_IN 0x0d
172 #define SISUSB_EP_BRIDGE_OUT 0x0d
173
174 #define SISUSB_TYPE_MEM 0
175 #define SISUSB_TYPE_IO 1
176
177 struct sisusb_packet {
178 unsigned short header;
179 u32 address;
180 u32 data;
181 } __attribute__ ((__packed__));
182
183 #define CLEARPACKET(packet) memset(packet, 0, 10)
184
185
186
187 #define SISUSB_PCI_MEMBASE 0xd0000000
188 #define SISUSB_PCI_MMIOBASE 0xe4000000
189 #define SISUSB_PCI_IOPORTBASE 0x0000d000
190
191 #define SISUSB_PCI_PSEUDO_MEMBASE 0x10000000
192 #define SISUSB_PCI_PSEUDO_MMIOBASE 0x20000000
193 #define SISUSB_PCI_PSEUDO_IOPORTBASE 0x0000d000
194 #define SISUSB_PCI_PSEUDO_PCIBASE 0x00010000
195
196 #define SISUSB_PCI_MMIOSIZE (128*1024)
197 #define SISUSB_PCI_PCONFSIZE 0x5c
198
199
200
201 #define AROFFSET 0x40
202 #define ARROFFSET 0x41
203 #define GROFFSET 0x4e
204 #define SROFFSET 0x44
205 #define CROFFSET 0x54
206 #define MISCROFFSET 0x4c
207 #define MISCWOFFSET 0x42
208 #define INPUTSTATOFFSET 0x5A
209 #define PART1OFFSET 0x04
210 #define PART2OFFSET 0x10
211 #define PART3OFFSET 0x12
212 #define PART4OFFSET 0x14
213 #define PART5OFFSET 0x16
214 #define CAPTUREOFFSET 0x00
215 #define VIDEOOFFSET 0x02
216 #define COLREGOFFSET 0x48
217 #define PELMASKOFFSET 0x46
218 #define VGAENABLE 0x43
219
220 #define SISAR SISUSB_PCI_IOPORTBASE + AROFFSET
221 #define SISARR SISUSB_PCI_IOPORTBASE + ARROFFSET
222 #define SISGR SISUSB_PCI_IOPORTBASE + GROFFSET
223 #define SISSR SISUSB_PCI_IOPORTBASE + SROFFSET
224 #define SISCR SISUSB_PCI_IOPORTBASE + CROFFSET
225 #define SISMISCR SISUSB_PCI_IOPORTBASE + MISCROFFSET
226 #define SISMISCW SISUSB_PCI_IOPORTBASE + MISCWOFFSET
227 #define SISINPSTAT SISUSB_PCI_IOPORTBASE + INPUTSTATOFFSET
228 #define SISPART1 SISUSB_PCI_IOPORTBASE + PART1OFFSET
229 #define SISPART2 SISUSB_PCI_IOPORTBASE + PART2OFFSET
230 #define SISPART3 SISUSB_PCI_IOPORTBASE + PART3OFFSET
231 #define SISPART4 SISUSB_PCI_IOPORTBASE + PART4OFFSET
232 #define SISPART5 SISUSB_PCI_IOPORTBASE + PART5OFFSET
233 #define SISCAP SISUSB_PCI_IOPORTBASE + CAPTUREOFFSET
234 #define SISVID SISUSB_PCI_IOPORTBASE + VIDEOOFFSET
235 #define SISCOLIDXR SISUSB_PCI_IOPORTBASE + COLREGOFFSET - 1
236 #define SISCOLIDX SISUSB_PCI_IOPORTBASE + COLREGOFFSET
237 #define SISCOLDATA SISUSB_PCI_IOPORTBASE + COLREGOFFSET + 1
238 #define SISCOL2IDX SISPART5
239 #define SISCOL2DATA SISPART5 + 1
240 #define SISPEL SISUSB_PCI_IOPORTBASE + PELMASKOFFSET
241 #define SISVGAEN SISUSB_PCI_IOPORTBASE + VGAENABLE
242 #define SISDACA SISCOLIDX
243 #define SISDACD SISCOLDATA
244
245
246
247
248 struct sisusb_info {
249 __u32 sisusb_id;
250 #define SISUSB_ID 0x53495355
251 __u8 sisusb_version;
252 __u8 sisusb_revision;
253 __u8 sisusb_patchlevel;
254 __u8 sisusb_gfxinit;
255
256 __u32 sisusb_vrambase;
257 __u32 sisusb_mmiobase;
258 __u32 sisusb_iobase;
259 __u32 sisusb_pcibase;
260
261 __u32 sisusb_vramsize;
262
263 __u32 sisusb_minor;
264
265 __u32 sisusb_fbdevactive;
266
267 __u32 sisusb_conactive;
268
269 __u8 sisusb_reserved[28];
270 };
271
272 struct sisusb_command {
273 __u8 operation;
274 __u8 data0;
275 __u8 data1;
276 __u8 data2;
277 __u32 data3;
278 __u32 data4;
279 };
280
281 #define SUCMD_GET 0x01
282 #define SUCMD_SET 0x02
283 #define SUCMD_SETOR 0x03
284 #define SUCMD_SETAND 0x04
285 #define SUCMD_SETANDOR 0x05
286 #define SUCMD_SETMASK 0x06
287
288 #define SUCMD_CLRSCR 0x07
289
290 #define SUCMD_HANDLETEXTMODE 0x08
291
292 #define SUCMD_SETMODE 0x09
293 #define SUCMD_SETVESAMODE 0x0a
294
295 #define SISUSB_COMMAND _IOWR(0xF3,0x3D,struct sisusb_command)
296 #define SISUSB_GET_CONFIG_SIZE _IOR(0xF3,0x3E,__u32)
297 #define SISUSB_GET_CONFIG _IOR(0xF3,0x3F,struct sisusb_info)
298
299 #endif