Linux Audio

Check our new training course

Real-Time Linux with PREEMPT_RT training

Feb 18-20, 2025
Register
Loading...
v5.9
  1/* SPDX-License-Identifier: (GPL-2.0 OR BSD-3-Clause) */
  2/*
  3 * sisusb - usb kernel driver for Net2280/SiS315 based USB2VGA dongles
  4 *
  5 * Copyright (C) 2005 by Thomas Winischhofer, Vienna, Austria
  6 *
  7 * If distributed as part of the Linux kernel, this code is licensed under the
  8 * terms of the GPL v2.
  9 *
 10 * Otherwise, the following license terms apply:
 11 *
 12 * Redistribution and use in source and binary forms, with or without
 13 * modification, are permitted provided that the following conditions
 14 * are met:
 15 * 1) Redistributions of source code must retain the above copyright
 16 *    notice, this list of conditions and the following disclaimer.
 17 * 2) Redistributions in binary form must reproduce the above copyright
 18 *    notice, this list of conditions and the following disclaimer in the
 19 *    documentation and/or other materials provided with the distribution.
 20 * 3) The name of the author may not be used to endorse or promote products
 21 *    derived from this software without specific prior written permission.
 22 *
 23 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESSED OR
 24 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
 25 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
 26 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
 27 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
 28 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
 29 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
 30 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 31 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
 32 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 33 *
 34 * Author:	Thomas Winischhofer <thomas@winischhofer.net>
 35 *
 36 */
 37
 38#ifndef _SISUSB_H_
 39#define _SISUSB_H_
 40
 41#include <linux/mutex.h>
 42
 43/* Version Information */
 44
 45#define SISUSB_VERSION		0
 46#define SISUSB_REVISION		0
 47#define SISUSB_PATCHLEVEL	8
 48
 49/* Include console and mode switching code? */
 50
 51#include <linux/console.h>
 52#include <linux/vt_kern.h>
 53#include "sisusb_struct.h"
 54
 55/* USB related */
 56
 57#define SISUSB_MINOR		133	/* official */
 58
 59/* Size of the sisusb input/output buffers */
 60#define SISUSB_IBUF_SIZE  0x01000
 61#define SISUSB_OBUF_SIZE  0x10000	/* fixed */
 62
 63#define NUMOBUFS 8		/* max number of output buffers/output URBs */
 64
 65/* About endianness:
 66 *
 67 * 1) I/O ports, PCI config registers. The read/write()
 68 *    calls emulate inX/outX. Hence, the data is
 69 *    expected/delivered in machine endiannes by this
 70 *    driver.
 71 * 2) Video memory. The data is copied 1:1. There is
 72 *    no swapping. Ever. This means for userland that
 73 *    the data has to be prepared properly. (Hint:
 74 *    think graphics data format, command queue,
 75 *    hardware cursor.)
 76 * 3) MMIO. Data is copied 1:1. MMIO must be swapped
 77 *    properly by userland.
 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
 92struct sisusb_usb_data;
 93
 94struct sisusb_urb_context {	/* urb->context for outbound bulk URBs */
 95	struct sisusb_usb_data *sisusb;
 96	int urbindex;
 97	int *actual_length;
 98};
 99
100struct 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;	/* for syncind and timeouts */
105	struct mutex lock;	/* general race avoidance */
106	unsigned int ifnum;	/* interface number of the USB device */
107	int minor;		/* minor (for logging clarity) */
108	int isopen;		/* !=0 if open */
109	int present;		/* !=0 if device is present on the bus */
110	int ready;		/* !=0 if device is ready for userland */
111	int numobufs;		/* number of obufs = number of out urbs */
112	char *obuf[NUMOBUFS], *ibuf;	/* transfer buffers */
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;	/* framebuffer base */
121	unsigned int vramsize;	/* framebuffer size (bytes) */
122	unsigned long mmiobase;
123	unsigned int mmiosize;
124	unsigned long ioportbase;
125	unsigned char devinit;	/* device initialized? */
126	unsigned char gfxinit;	/* graphics core initialized? */
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;	/* real number, not vt's idea */
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/* USB transport related */
154
155/* urbstatus */
156#define SU_URB_BUSY   1
157#define SU_URB_ALLOC  2
158
159/* Endpoints */
160
161#define SISUSB_EP_GFX_IN	0x0e	/* gfx std packet out(0e)/in(8e) */
162#define SISUSB_EP_GFX_OUT	0x0e
163
164#define SISUSB_EP_GFX_BULK_OUT	0x01	/* gfx mem bulk out/in */
165#define SISUSB_EP_GFX_BULK_IN	0x02	/* ? 2 is "OUT" ? */
166
167#define SISUSB_EP_GFX_LBULK_OUT	0x03	/* gfx large mem bulk out */
168
169#define SISUSB_EP_UNKNOWN_04	0x04	/* ? 4 is "OUT" ? - unused */
170
171#define SISUSB_EP_BRIDGE_IN	0x0d	/* Net2280 out(0d)/in(8d) */
172#define SISUSB_EP_BRIDGE_OUT	0x0d
173
174#define SISUSB_TYPE_MEM		0
175#define SISUSB_TYPE_IO		1
176
177struct 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/* PCI bridge related */
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/* graphics core related */
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/* ioctl related */
246
247/* Structure argument for SISUSB_GET_INFO ioctl  */
248struct sisusb_info {
249	__u32 sisusb_id;	/* for identifying sisusb */
250#define SISUSB_ID  0x53495355	/* Identify myself with 'SISU' */
251	__u8 sisusb_version;
252	__u8 sisusb_revision;
253	__u8 sisusb_patchlevel;
254	__u8 sisusb_gfxinit;	/* graphics core initialized? */
255
256	__u32 sisusb_vrambase;
257	__u32 sisusb_mmiobase;
258	__u32 sisusb_iobase;
259	__u32 sisusb_pcibase;
260
261	__u32 sisusb_vramsize;	/* framebuffer size in bytes */
262
263	__u32 sisusb_minor;
264
265	__u32 sisusb_fbdevactive;	/* != 0 if framebuffer device active */
266
267	__u32 sisusb_conactive;	/* != 0 if console driver active */
268
269	__u8 sisusb_reserved[28];	/* for future use */
270};
271
272struct sisusb_command {
273	__u8 operation;		/* see below */
274	__u8 data0;		/* operation dependent */
275	__u8 data1;		/* operation dependent */
276	__u8 data2;		/* operation dependent */
277	__u32 data3;		/* operation dependent */
278	__u32 data4;		/* for future use */
279};
280
281#define SUCMD_GET	0x01	/* for all: data0 = index, data3 = port */
282#define SUCMD_SET	0x02	/* data1 = value */
283#define SUCMD_SETOR	0x03	/* data1 = or */
284#define SUCMD_SETAND	0x04	/* data1 = and */
285#define SUCMD_SETANDOR	0x05	/* data1 = and, data2 = or */
286#define SUCMD_SETMASK	0x06	/* data1 = data, data2 = mask */
287
288#define SUCMD_CLRSCR	0x07	/* data0:1:2 = length, data3 = address */
289
290#define SUCMD_HANDLETEXTMODE 0x08	/* Reset/destroy text mode */
291
292#define SUCMD_SETMODE	0x09	/* Set a display mode (data3 = SiS mode) */
293#define SUCMD_SETVESAMODE 0x0a	/* Set a display mode (data3 = VESA mode) */
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 /* SISUSB_H */
v6.9.4
  1/* SPDX-License-Identifier: (GPL-2.0 OR BSD-3-Clause) */
  2/*
  3 * sisusb - usb kernel driver for Net2280/SiS315 based USB2VGA dongles
  4 *
  5 * Copyright (C) 2005 by Thomas Winischhofer, Vienna, Austria
  6 *
  7 * If distributed as part of the Linux kernel, this code is licensed under the
  8 * terms of the GPL v2.
  9 *
 10 * Otherwise, the following license terms apply:
 11 *
 12 * Redistribution and use in source and binary forms, with or without
 13 * modification, are permitted provided that the following conditions
 14 * are met:
 15 * 1) Redistributions of source code must retain the above copyright
 16 *    notice, this list of conditions and the following disclaimer.
 17 * 2) Redistributions in binary form must reproduce the above copyright
 18 *    notice, this list of conditions and the following disclaimer in the
 19 *    documentation and/or other materials provided with the distribution.
 20 * 3) The name of the author may not be used to endorse or promote products
 21 *    derived from this software without specific prior written permission.
 22 *
 23 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESSED OR
 24 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
 25 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
 26 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
 27 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
 28 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
 29 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
 30 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 31 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
 32 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 33 *
 34 * Author:	Thomas Winischhofer <thomas@winischhofer.net>
 35 *
 36 */
 37
 38#ifndef _SISUSB_H_
 39#define _SISUSB_H_
 40
 41#include <linux/mutex.h>
 42
 43/* Version Information */
 44
 45#define SISUSB_VERSION		0
 46#define SISUSB_REVISION		0
 47#define SISUSB_PATCHLEVEL	8
 48
 49/* Include console and mode switching code? */
 50
 
 51#include <linux/vt_kern.h>
 52#include "sisusb_struct.h"
 53
 54/* USB related */
 55
 56#define SISUSB_MINOR		133	/* official */
 57
 58/* Size of the sisusb input/output buffers */
 59#define SISUSB_IBUF_SIZE  0x01000
 60#define SISUSB_OBUF_SIZE  0x10000	/* fixed */
 61
 62#define NUMOBUFS 8		/* max number of output buffers/output URBs */
 63
 64/* About endianness:
 65 *
 66 * 1) I/O ports, PCI config registers. The read/write()
 67 *    calls emulate inX/outX. Hence, the data is
 68 *    expected/delivered in machine endiannes by this
 69 *    driver.
 70 * 2) Video memory. The data is copied 1:1. There is
 71 *    no swapping. Ever. This means for userland that
 72 *    the data has to be prepared properly. (Hint:
 73 *    think graphics data format, command queue,
 74 *    hardware cursor.)
 75 * 3) MMIO. Data is copied 1:1. MMIO must be swapped
 76 *    properly by userland.
 77 *
 78 */
 79
 80#ifdef __BIG_ENDIAN
 81#define SISUSB_CORRECT_ENDIANNESS_PACKET(p)		\
 82	do {						\
 83		p->header  = cpu_to_le16(p->header);	\
 84		p->address = cpu_to_le32(p->address);	\
 85		p->data    = cpu_to_le32(p->data);	\
 86	} while(0)
 87#else
 88#define SISUSB_CORRECT_ENDIANNESS_PACKET(p)
 89#endif
 90
 91struct sisusb_usb_data;
 92
 93struct sisusb_urb_context {	/* urb->context for outbound bulk URBs */
 94	struct sisusb_usb_data *sisusb;
 95	int urbindex;
 96	int *actual_length;
 97};
 98
 99struct sisusb_usb_data {
100	struct usb_device *sisusb_dev;
101	struct usb_interface *interface;
102	struct kref kref;
103	wait_queue_head_t wait_q;	/* for syncind and timeouts */
104	struct mutex lock;	/* general race avoidance */
105	unsigned int ifnum;	/* interface number of the USB device */
106	int minor;		/* minor (for logging clarity) */
107	int isopen;		/* !=0 if open */
108	int present;		/* !=0 if device is present on the bus */
109	int ready;		/* !=0 if device is ready for userland */
110	int numobufs;		/* number of obufs = number of out urbs */
111	char *obuf[NUMOBUFS], *ibuf;	/* transfer buffers */
112	int obufsize, ibufsize;
113	struct urb *sisurbout[NUMOBUFS];
114	struct urb *sisurbin;
115	unsigned char urbstatus[NUMOBUFS];
116	unsigned char completein;
117	struct sisusb_urb_context urbout_context[NUMOBUFS];
118	unsigned long flagb0;
119	unsigned long vrambase;	/* framebuffer base */
120	unsigned int vramsize;	/* framebuffer size (bytes) */
121	unsigned long mmiobase;
122	unsigned int mmiosize;
123	unsigned long ioportbase;
124	unsigned char devinit;	/* device initialized? */
125	unsigned char gfxinit;	/* graphics core initialized? */
126	unsigned short chipid, chipvendor;
127	unsigned short chiprevision;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
128};
129
130#define to_sisusb_dev(d) container_of(d, struct sisusb_usb_data, kref)
131
132/* USB transport related */
133
134/* urbstatus */
135#define SU_URB_BUSY   1
136#define SU_URB_ALLOC  2
137
138/* Endpoints */
139
140#define SISUSB_EP_GFX_IN	0x0e	/* gfx std packet out(0e)/in(8e) */
141#define SISUSB_EP_GFX_OUT	0x0e
142
143#define SISUSB_EP_GFX_BULK_OUT	0x01	/* gfx mem bulk out/in */
144#define SISUSB_EP_GFX_BULK_IN	0x02	/* ? 2 is "OUT" ? */
145
146#define SISUSB_EP_GFX_LBULK_OUT	0x03	/* gfx large mem bulk out */
147
148#define SISUSB_EP_UNKNOWN_04	0x04	/* ? 4 is "OUT" ? - unused */
149
150#define SISUSB_EP_BRIDGE_IN	0x0d	/* Net2280 out(0d)/in(8d) */
151#define SISUSB_EP_BRIDGE_OUT	0x0d
152
153#define SISUSB_TYPE_MEM		0
154#define SISUSB_TYPE_IO		1
155
156struct sisusb_packet {
157	unsigned short header;
158	u32 address;
159	u32 data;
160} __attribute__ ((__packed__));
161
162#define CLEARPACKET(packet) memset(packet, 0, 10)
163
164/* PCI bridge related */
165
166#define SISUSB_PCI_MEMBASE	0xd0000000
167#define SISUSB_PCI_MMIOBASE	0xe4000000
168#define SISUSB_PCI_IOPORTBASE	0x0000d000
169
170#define SISUSB_PCI_PSEUDO_MEMBASE	0x10000000
171#define SISUSB_PCI_PSEUDO_MMIOBASE	0x20000000
172#define SISUSB_PCI_PSEUDO_IOPORTBASE	0x0000d000
173#define SISUSB_PCI_PSEUDO_PCIBASE	0x00010000
174
175#define SISUSB_PCI_MMIOSIZE	(128*1024)
176#define SISUSB_PCI_PCONFSIZE	0x5c
177
178/* graphics core related */
179
180#define AROFFSET	0x40
181#define ARROFFSET	0x41
182#define GROFFSET	0x4e
183#define SROFFSET	0x44
184#define CROFFSET	0x54
185#define MISCROFFSET	0x4c
186#define MISCWOFFSET	0x42
187#define INPUTSTATOFFSET 0x5A
188#define PART1OFFSET	0x04
189#define PART2OFFSET	0x10
190#define PART3OFFSET	0x12
191#define PART4OFFSET	0x14
192#define PART5OFFSET	0x16
193#define CAPTUREOFFSET	0x00
194#define VIDEOOFFSET	0x02
195#define COLREGOFFSET	0x48
196#define PELMASKOFFSET	0x46
197#define VGAENABLE	0x43
198
199#define SISAR		SISUSB_PCI_IOPORTBASE + AROFFSET
200#define SISARR		SISUSB_PCI_IOPORTBASE + ARROFFSET
201#define SISGR		SISUSB_PCI_IOPORTBASE + GROFFSET
202#define SISSR		SISUSB_PCI_IOPORTBASE + SROFFSET
203#define SISCR		SISUSB_PCI_IOPORTBASE + CROFFSET
204#define SISMISCR	SISUSB_PCI_IOPORTBASE + MISCROFFSET
205#define SISMISCW	SISUSB_PCI_IOPORTBASE + MISCWOFFSET
206#define SISINPSTAT	SISUSB_PCI_IOPORTBASE + INPUTSTATOFFSET
207#define SISPART1	SISUSB_PCI_IOPORTBASE + PART1OFFSET
208#define SISPART2	SISUSB_PCI_IOPORTBASE + PART2OFFSET
209#define SISPART3	SISUSB_PCI_IOPORTBASE + PART3OFFSET
210#define SISPART4	SISUSB_PCI_IOPORTBASE + PART4OFFSET
211#define SISPART5	SISUSB_PCI_IOPORTBASE + PART5OFFSET
212#define SISCAP		SISUSB_PCI_IOPORTBASE + CAPTUREOFFSET
213#define SISVID		SISUSB_PCI_IOPORTBASE + VIDEOOFFSET
214#define SISCOLIDXR	SISUSB_PCI_IOPORTBASE + COLREGOFFSET - 1
215#define SISCOLIDX	SISUSB_PCI_IOPORTBASE + COLREGOFFSET
216#define SISCOLDATA	SISUSB_PCI_IOPORTBASE + COLREGOFFSET + 1
217#define SISCOL2IDX	SISPART5
218#define SISCOL2DATA	SISPART5 + 1
219#define SISPEL		SISUSB_PCI_IOPORTBASE + PELMASKOFFSET
220#define SISVGAEN	SISUSB_PCI_IOPORTBASE + VGAENABLE
221#define SISDACA		SISCOLIDX
222#define SISDACD		SISCOLDATA
223
224/* ioctl related */
225
226/* Structure argument for SISUSB_GET_INFO ioctl  */
227struct sisusb_info {
228	__u32 sisusb_id;	/* for identifying sisusb */
229#define SISUSB_ID  0x53495355	/* Identify myself with 'SISU' */
230	__u8 sisusb_version;
231	__u8 sisusb_revision;
232	__u8 sisusb_patchlevel;
233	__u8 sisusb_gfxinit;	/* graphics core initialized? */
234
235	__u32 sisusb_vrambase;
236	__u32 sisusb_mmiobase;
237	__u32 sisusb_iobase;
238	__u32 sisusb_pcibase;
239
240	__u32 sisusb_vramsize;	/* framebuffer size in bytes */
241
242	__u32 sisusb_minor;
243
244	__u32 sisusb_fbdevactive;	/* != 0 if framebuffer device active */
245
246	__u32 sisusb_conactive;	/* != 0 if console driver active */
247
248	__u8 sisusb_reserved[28];	/* for future use */
249};
250
251struct sisusb_command {
252	__u8 operation;		/* see below */
253	__u8 data0;		/* operation dependent */
254	__u8 data1;		/* operation dependent */
255	__u8 data2;		/* operation dependent */
256	__u32 data3;		/* operation dependent */
257	__u32 data4;		/* for future use */
258};
259
260#define SUCMD_GET	0x01	/* for all: data0 = index, data3 = port */
261#define SUCMD_SET	0x02	/* data1 = value */
262#define SUCMD_SETOR	0x03	/* data1 = or */
263#define SUCMD_SETAND	0x04	/* data1 = and */
264#define SUCMD_SETANDOR	0x05	/* data1 = and, data2 = or */
265#define SUCMD_SETMASK	0x06	/* data1 = data, data2 = mask */
266
267#define SUCMD_CLRSCR	0x07	/* data0:1:2 = length, data3 = address */
268
269#define SUCMD_HANDLETEXTMODE 0x08	/* Reset/destroy text mode */
270
271#define SUCMD_SETMODE	0x09	/* Set a display mode (data3 = SiS mode) */
272#define SUCMD_SETVESAMODE 0x0a	/* Set a display mode (data3 = VESA mode) */
273
274#define SISUSB_COMMAND		_IOWR(0xF3,0x3D,struct sisusb_command)
275#define SISUSB_GET_CONFIG_SIZE	_IOR(0xF3,0x3E,__u32)
276#define SISUSB_GET_CONFIG	_IOR(0xF3,0x3F,struct sisusb_info)
277
278#endif /* SISUSB_H */