0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027
0028
0029
0030
0031
0032
0033
0034
0035
0036
0037
0038 #ifndef _SISUSB_H_
0039 #define _SISUSB_H_
0040
0041 #include <linux/mutex.h>
0042
0043
0044
0045 #define SISUSB_VERSION 0
0046 #define SISUSB_REVISION 0
0047 #define SISUSB_PATCHLEVEL 8
0048
0049
0050
0051 #include <linux/console.h>
0052 #include <linux/vt_kern.h>
0053 #include "sisusb_struct.h"
0054
0055
0056
0057 #define SISUSB_MINOR 133
0058
0059
0060 #define SISUSB_IBUF_SIZE 0x01000
0061 #define SISUSB_OBUF_SIZE 0x10000
0062
0063 #define NUMOBUFS 8
0064
0065
0066
0067
0068
0069
0070
0071
0072
0073
0074
0075
0076
0077
0078
0079
0080
0081 #ifdef __BIG_ENDIAN
0082 #define SISUSB_CORRECT_ENDIANNESS_PACKET(p) \
0083 do { \
0084 p->header = cpu_to_le16(p->header); \
0085 p->address = cpu_to_le32(p->address); \
0086 p->data = cpu_to_le32(p->data); \
0087 } while(0)
0088 #else
0089 #define SISUSB_CORRECT_ENDIANNESS_PACKET(p)
0090 #endif
0091
0092 struct sisusb_usb_data;
0093
0094 struct sisusb_urb_context {
0095 struct sisusb_usb_data *sisusb;
0096 int urbindex;
0097 int *actual_length;
0098 };
0099
0100 struct sisusb_usb_data {
0101 struct usb_device *sisusb_dev;
0102 struct usb_interface *interface;
0103 struct kref kref;
0104 wait_queue_head_t wait_q;
0105 struct mutex lock;
0106 unsigned int ifnum;
0107 int minor;
0108 int isopen;
0109 int present;
0110 int ready;
0111 int numobufs;
0112 char *obuf[NUMOBUFS], *ibuf;
0113 int obufsize, ibufsize;
0114 struct urb *sisurbout[NUMOBUFS];
0115 struct urb *sisurbin;
0116 unsigned char urbstatus[NUMOBUFS];
0117 unsigned char completein;
0118 struct sisusb_urb_context urbout_context[NUMOBUFS];
0119 unsigned long flagb0;
0120 unsigned long vrambase;
0121 unsigned int vramsize;
0122 unsigned long mmiobase;
0123 unsigned int mmiosize;
0124 unsigned long ioportbase;
0125 unsigned char devinit;
0126 unsigned char gfxinit;
0127 unsigned short chipid, chipvendor;
0128 unsigned short chiprevision;
0129 #ifdef CONFIG_USB_SISUSBVGA_CON
0130 struct SiS_Private *SiS_Pr;
0131 unsigned long scrbuf;
0132 unsigned int scrbuf_size;
0133 int haveconsole, con_first, con_last;
0134 int havethisconsole[MAX_NR_CONSOLES];
0135 int textmodedestroyed;
0136 unsigned int sisusb_num_columns;
0137 int cur_start_addr, con_rolled_over;
0138 int sisusb_cursor_loc, bad_cursor_pos;
0139 int sisusb_cursor_size_from;
0140 int sisusb_cursor_size_to;
0141 int current_font_height, current_font_512;
0142 int font_backup_size, font_backup_height, font_backup_512;
0143 char *font_backup;
0144 int font_slot;
0145 struct vc_data *sisusb_display_fg;
0146 int is_gfx;
0147 int con_blanked;
0148 #endif
0149 };
0150
0151 #define to_sisusb_dev(d) container_of(d, struct sisusb_usb_data, kref)
0152
0153
0154
0155
0156 #define SU_URB_BUSY 1
0157 #define SU_URB_ALLOC 2
0158
0159
0160
0161 #define SISUSB_EP_GFX_IN 0x0e
0162 #define SISUSB_EP_GFX_OUT 0x0e
0163
0164 #define SISUSB_EP_GFX_BULK_OUT 0x01
0165 #define SISUSB_EP_GFX_BULK_IN 0x02
0166
0167 #define SISUSB_EP_GFX_LBULK_OUT 0x03
0168
0169 #define SISUSB_EP_UNKNOWN_04 0x04
0170
0171 #define SISUSB_EP_BRIDGE_IN 0x0d
0172 #define SISUSB_EP_BRIDGE_OUT 0x0d
0173
0174 #define SISUSB_TYPE_MEM 0
0175 #define SISUSB_TYPE_IO 1
0176
0177 struct sisusb_packet {
0178 unsigned short header;
0179 u32 address;
0180 u32 data;
0181 } __attribute__ ((__packed__));
0182
0183 #define CLEARPACKET(packet) memset(packet, 0, 10)
0184
0185
0186
0187 #define SISUSB_PCI_MEMBASE 0xd0000000
0188 #define SISUSB_PCI_MMIOBASE 0xe4000000
0189 #define SISUSB_PCI_IOPORTBASE 0x0000d000
0190
0191 #define SISUSB_PCI_PSEUDO_MEMBASE 0x10000000
0192 #define SISUSB_PCI_PSEUDO_MMIOBASE 0x20000000
0193 #define SISUSB_PCI_PSEUDO_IOPORTBASE 0x0000d000
0194 #define SISUSB_PCI_PSEUDO_PCIBASE 0x00010000
0195
0196 #define SISUSB_PCI_MMIOSIZE (128*1024)
0197 #define SISUSB_PCI_PCONFSIZE 0x5c
0198
0199
0200
0201 #define AROFFSET 0x40
0202 #define ARROFFSET 0x41
0203 #define GROFFSET 0x4e
0204 #define SROFFSET 0x44
0205 #define CROFFSET 0x54
0206 #define MISCROFFSET 0x4c
0207 #define MISCWOFFSET 0x42
0208 #define INPUTSTATOFFSET 0x5A
0209 #define PART1OFFSET 0x04
0210 #define PART2OFFSET 0x10
0211 #define PART3OFFSET 0x12
0212 #define PART4OFFSET 0x14
0213 #define PART5OFFSET 0x16
0214 #define CAPTUREOFFSET 0x00
0215 #define VIDEOOFFSET 0x02
0216 #define COLREGOFFSET 0x48
0217 #define PELMASKOFFSET 0x46
0218 #define VGAENABLE 0x43
0219
0220 #define SISAR SISUSB_PCI_IOPORTBASE + AROFFSET
0221 #define SISARR SISUSB_PCI_IOPORTBASE + ARROFFSET
0222 #define SISGR SISUSB_PCI_IOPORTBASE + GROFFSET
0223 #define SISSR SISUSB_PCI_IOPORTBASE + SROFFSET
0224 #define SISCR SISUSB_PCI_IOPORTBASE + CROFFSET
0225 #define SISMISCR SISUSB_PCI_IOPORTBASE + MISCROFFSET
0226 #define SISMISCW SISUSB_PCI_IOPORTBASE + MISCWOFFSET
0227 #define SISINPSTAT SISUSB_PCI_IOPORTBASE + INPUTSTATOFFSET
0228 #define SISPART1 SISUSB_PCI_IOPORTBASE + PART1OFFSET
0229 #define SISPART2 SISUSB_PCI_IOPORTBASE + PART2OFFSET
0230 #define SISPART3 SISUSB_PCI_IOPORTBASE + PART3OFFSET
0231 #define SISPART4 SISUSB_PCI_IOPORTBASE + PART4OFFSET
0232 #define SISPART5 SISUSB_PCI_IOPORTBASE + PART5OFFSET
0233 #define SISCAP SISUSB_PCI_IOPORTBASE + CAPTUREOFFSET
0234 #define SISVID SISUSB_PCI_IOPORTBASE + VIDEOOFFSET
0235 #define SISCOLIDXR SISUSB_PCI_IOPORTBASE + COLREGOFFSET - 1
0236 #define SISCOLIDX SISUSB_PCI_IOPORTBASE + COLREGOFFSET
0237 #define SISCOLDATA SISUSB_PCI_IOPORTBASE + COLREGOFFSET + 1
0238 #define SISCOL2IDX SISPART5
0239 #define SISCOL2DATA SISPART5 + 1
0240 #define SISPEL SISUSB_PCI_IOPORTBASE + PELMASKOFFSET
0241 #define SISVGAEN SISUSB_PCI_IOPORTBASE + VGAENABLE
0242 #define SISDACA SISCOLIDX
0243 #define SISDACD SISCOLDATA
0244
0245
0246
0247
0248 struct sisusb_info {
0249 __u32 sisusb_id;
0250 #define SISUSB_ID 0x53495355
0251 __u8 sisusb_version;
0252 __u8 sisusb_revision;
0253 __u8 sisusb_patchlevel;
0254 __u8 sisusb_gfxinit;
0255
0256 __u32 sisusb_vrambase;
0257 __u32 sisusb_mmiobase;
0258 __u32 sisusb_iobase;
0259 __u32 sisusb_pcibase;
0260
0261 __u32 sisusb_vramsize;
0262
0263 __u32 sisusb_minor;
0264
0265 __u32 sisusb_fbdevactive;
0266
0267 __u32 sisusb_conactive;
0268
0269 __u8 sisusb_reserved[28];
0270 };
0271
0272 struct sisusb_command {
0273 __u8 operation;
0274 __u8 data0;
0275 __u8 data1;
0276 __u8 data2;
0277 __u32 data3;
0278 __u32 data4;
0279 };
0280
0281 #define SUCMD_GET 0x01
0282 #define SUCMD_SET 0x02
0283 #define SUCMD_SETOR 0x03
0284 #define SUCMD_SETAND 0x04
0285 #define SUCMD_SETANDOR 0x05
0286 #define SUCMD_SETMASK 0x06
0287
0288 #define SUCMD_CLRSCR 0x07
0289
0290 #define SUCMD_HANDLETEXTMODE 0x08
0291
0292 #define SUCMD_SETMODE 0x09
0293 #define SUCMD_SETVESAMODE 0x0a
0294
0295 #define SISUSB_COMMAND _IOWR(0xF3,0x3D,struct sisusb_command)
0296 #define SISUSB_GET_CONFIG_SIZE _IOR(0xF3,0x3E,__u32)
0297 #define SISUSB_GET_CONFIG _IOR(0xF3,0x3F,struct sisusb_info)
0298
0299 #endif