added a lot of printk output to ease writing of emulator
[linux-2.4.21-pre4.git] / include / linux / sisfb.h
1 #ifndef _LINUX_SISFB
2 #define _LINUX_SISFB
3
4 #include <linux/spinlock.h>
5
6 #include <asm/ioctl.h>
7 #include <asm/types.h>
8
9 #define DISPTYPE_CRT1       0x00000008L
10 #define DISPTYPE_CRT2       0x00000004L
11 #define DISPTYPE_LCD        0x00000002L
12 #define DISPTYPE_TV         0x00000001L
13 #define DISPTYPE_DISP1      DISPTYPE_CRT1
14 #define DISPTYPE_DISP2      (DISPTYPE_CRT2 | DISPTYPE_LCD | DISPTYPE_TV)
15 #define DISPMODE_SINGLE     0x00000020L
16 #define DISPMODE_MIRROR     0x00000010L
17 #define DISPMODE_DUALVIEW   0x00000040L
18
19 #define HASVB_NONE              0x00
20 #define HASVB_301               0x01
21 #define HASVB_LVDS              0x02
22 #define HASVB_TRUMPION          0x04
23 #define HASVB_LVDS_CHRONTEL     0x10
24 #define HASVB_302               0x20
25 #define HASVB_303               0x40
26 #define HASVB_CHRONTEL          0x80
27
28 /* TW: *Never* change the order of the following enum */
29 typedef enum _SIS_CHIP_TYPE {
30         SIS_VGALegacy = 0,
31         SIS_300,
32         SIS_630,
33         SIS_540,
34         SIS_730, 
35         SIS_315H,
36         SIS_315,
37         SIS_550,
38         SIS_315PRO,
39         SIS_640,
40         SIS_740,
41         SIS_650,
42         SIS_330,
43         MAX_SIS_CHIP
44 } SIS_CHIP_TYPE;
45
46 typedef enum _VGA_ENGINE {
47         UNKNOWN_VGA = 0,
48         SIS_300_VGA,
49         SIS_315_VGA,
50 } VGA_ENGINE;
51
52 typedef enum _TVTYPE {
53         TVMODE_NTSC = 0,
54         TVMODE_PAL,
55         TVMODE_HIVISION,
56         TVMODE_TOTAL
57 } SIS_TV_TYPE;
58
59 typedef enum _TVPLUGTYPE {
60         TVPLUG_Legacy = 0,
61         TVPLUG_COMPOSITE,
62         TVPLUG_SVIDEO,
63         TVPLUG_SCART,
64         TVPLUG_TOTAL
65 } SIS_TV_PLUG;
66
67 struct sis_memreq {
68         unsigned long offset;
69         unsigned long size;
70 };
71
72 struct mode_info {
73         int    bpp;
74         int    xres;
75         int    yres;
76         int    v_xres;
77         int    v_yres;
78         int    org_x;
79         int    org_y;
80         unsigned int  vrate;
81 };
82
83 struct ap_data {
84         struct mode_info minfo;
85         unsigned long iobase;
86         unsigned int  mem_size;
87         unsigned long disp_state;       
88         SIS_CHIP_TYPE chip;
89         unsigned char hasVB;
90         SIS_TV_TYPE TV_type;
91         SIS_TV_PLUG TV_plug;
92         unsigned long version;
93         char reserved[256];
94 };
95
96 struct video_info {
97         int           chip_id;
98         unsigned int  video_size;
99         unsigned long video_base;
100         char  *       video_vbase;
101         unsigned long mmio_base;
102         char  *       mmio_vbase;
103         unsigned long vga_base;
104         unsigned long mtrr;
105         unsigned long heapstart;
106
107         int    video_bpp;
108         int    video_cmap_len;
109         int    video_width;
110         int    video_height;
111         int    video_vwidth;
112         int    video_vheight;
113         int    org_x;
114         int    org_y;
115         int    video_linelength;
116         unsigned int refresh_rate;
117
118         unsigned long disp_state;
119         unsigned char hasVB;
120         unsigned char TV_type;
121         unsigned char TV_plug;
122
123         SIS_CHIP_TYPE chip;
124         unsigned char revision_id;
125
126         unsigned short DstColor;                /* TW: For 2d acceleration */
127         unsigned long  SiS310_AccelDepth;
128         unsigned long  CommandReg;
129
130         spinlock_t     lockaccel;
131
132         char reserved[256];
133 };
134
135
136 /* TW: Addtional IOCTL for communication sisfb <> X driver                 */
137 /*     If changing this, vgatypes.h must also be changed (for X driver)    */
138
139 /* TW: ioctl for identifying and giving some info (esp. memory heap start) */
140 #define SISFB_GET_INFO    _IOR('n',0xF8,sizeof(__u32))
141
142 /* TW: Structure argument for SISFB_GET_INFO ioctl  */
143 typedef struct _SISFB_INFO sisfb_info, *psisfb_info;
144
145 struct _SISFB_INFO {
146         unsigned long sisfb_id;         /* for identifying sisfb */
147 #ifndef SISFB_ID
148 #define SISFB_ID          0x53495346    /* Identify myself with 'SISF' */
149 #endif
150         int    chip_id;                 /* PCI ID of detected chip */
151         int    memory;                  /* video memory in KB which sisfb manages */
152         int    heapstart;               /* heap start (= sisfb "mem" argument) in KB */
153         unsigned char fbvidmode;        /* current sisfb mode */
154         
155         unsigned char sisfb_version;
156         unsigned char sisfb_revision;
157         unsigned char sisfb_patchlevel;
158
159         unsigned char sisfb_caps;       /* Sisfb capabilities */
160
161         int    sisfb_tqlen;             /* turbo queue length (in KB) */
162
163         char reserved[249];             /* for future use */
164 };
165
166 #ifdef __KERNEL__
167 extern struct video_info ivideo;
168
169 extern void sis_malloc(struct sis_memreq *req);
170 extern void sis_free(unsigned long base);
171 extern void sis_dispinfo(struct ap_data *rec);
172 #endif
173 #endif