Details | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
467 | giacomo | 1 | /* |
2 | * linux/include/video/neo_reg.h -- NeoMagic Framebuffer Driver |
||
3 | * |
||
4 | * Copyright (c) 2001 Denis Oliver Kropp <dok@convergence.de> |
||
5 | * |
||
6 | * This file is subject to the terms and conditions of the GNU General |
||
7 | * Public License. See the file COPYING in the main directory of this |
||
8 | * archive for more details. |
||
9 | */ |
||
10 | |||
11 | #define NEO_BS0_BLT_BUSY 0x00000001 |
||
12 | #define NEO_BS0_FIFO_AVAIL 0x00000002 |
||
13 | #define NEO_BS0_FIFO_PEND 0x00000004 |
||
14 | |||
15 | #define NEO_BC0_DST_Y_DEC 0x00000001 |
||
16 | #define NEO_BC0_X_DEC 0x00000002 |
||
17 | #define NEO_BC0_SRC_TRANS 0x00000004 |
||
18 | #define NEO_BC0_SRC_IS_FG 0x00000008 |
||
19 | #define NEO_BC0_SRC_Y_DEC 0x00000010 |
||
20 | #define NEO_BC0_FILL_PAT 0x00000020 |
||
21 | #define NEO_BC0_SRC_MONO 0x00000040 |
||
22 | #define NEO_BC0_SYS_TO_VID 0x00000080 |
||
23 | |||
24 | #define NEO_BC1_DEPTH8 0x00000100 |
||
25 | #define NEO_BC1_DEPTH16 0x00000200 |
||
26 | #define NEO_BC1_X_320 0x00000400 |
||
27 | #define NEO_BC1_X_640 0x00000800 |
||
28 | #define NEO_BC1_X_800 0x00000c00 |
||
29 | #define NEO_BC1_X_1024 0x00001000 |
||
30 | #define NEO_BC1_X_1152 0x00001400 |
||
31 | #define NEO_BC1_X_1280 0x00001800 |
||
32 | #define NEO_BC1_X_1600 0x00001c00 |
||
33 | #define NEO_BC1_DST_TRANS 0x00002000 |
||
34 | #define NEO_BC1_MSTR_BLT 0x00004000 |
||
35 | #define NEO_BC1_FILTER_Z 0x00008000 |
||
36 | |||
37 | #define NEO_BC2_WR_TR_DST 0x00800000 |
||
38 | |||
39 | #define NEO_BC3_SRC_XY_ADDR 0x01000000 |
||
40 | #define NEO_BC3_DST_XY_ADDR 0x02000000 |
||
41 | #define NEO_BC3_CLIP_ON 0x04000000 |
||
42 | #define NEO_BC3_FIFO_EN 0x08000000 |
||
43 | #define NEO_BC3_BLT_ON_ADDR 0x10000000 |
||
44 | #define NEO_BC3_SKIP_MAPPING 0x80000000 |
||
45 | |||
46 | #define NEO_MODE1_DEPTH8 0x0100 |
||
47 | #define NEO_MODE1_DEPTH16 0x0200 |
||
48 | #define NEO_MODE1_DEPTH24 0x0300 |
||
49 | #define NEO_MODE1_X_320 0x0400 |
||
50 | #define NEO_MODE1_X_640 0x0800 |
||
51 | #define NEO_MODE1_X_800 0x0c00 |
||
52 | #define NEO_MODE1_X_1024 0x1000 |
||
53 | #define NEO_MODE1_X_1152 0x1400 |
||
54 | #define NEO_MODE1_X_1280 0x1800 |
||
55 | #define NEO_MODE1_X_1600 0x1c00 |
||
56 | #define NEO_MODE1_BLT_ON_ADDR 0x2000 |
||
57 | |||
58 | #ifdef __KERNEL__ |
||
59 | |||
60 | #ifdef NEOFB_DEBUG |
||
61 | # define DBG(x) printk (KERN_DEBUG "neofb: %s\n", (x)); |
||
62 | #else |
||
63 | # define DBG(x) |
||
64 | #endif |
||
65 | |||
66 | #define PCI_CHIP_NM2070 0x0001 |
||
67 | #define PCI_CHIP_NM2090 0x0002 |
||
68 | #define PCI_CHIP_NM2093 0x0003 |
||
69 | #define PCI_CHIP_NM2097 0x0083 |
||
70 | #define PCI_CHIP_NM2160 0x0004 |
||
71 | #define PCI_CHIP_NM2200 0x0005 |
||
72 | #define PCI_CHIP_NM2230 0x0025 |
||
73 | #define PCI_CHIP_NM2360 0x0006 |
||
74 | #define PCI_CHIP_NM2380 0x0016 |
||
75 | |||
76 | |||
77 | struct xtimings { |
||
78 | unsigned int pixclock; |
||
79 | unsigned int HDisplay; |
||
80 | unsigned int HSyncStart; |
||
81 | unsigned int HSyncEnd; |
||
82 | unsigned int HTotal; |
||
83 | unsigned int VDisplay; |
||
84 | unsigned int VSyncStart; |
||
85 | unsigned int VSyncEnd; |
||
86 | unsigned int VTotal; |
||
87 | unsigned int sync; |
||
88 | int dblscan; |
||
89 | int interlaced; |
||
90 | }; |
||
91 | |||
92 | |||
93 | /* --------------------------------------------------------------------- */ |
||
94 | |||
95 | typedef volatile struct { |
||
96 | __u32 bltStat; |
||
97 | __u32 bltCntl; |
||
98 | __u32 xpColor; |
||
99 | __u32 fgColor; |
||
100 | __u32 bgColor; |
||
101 | __u32 pitch; |
||
102 | __u32 clipLT; |
||
103 | __u32 clipRB; |
||
104 | __u32 srcBitOffset; |
||
105 | __u32 srcStart; |
||
106 | __u32 reserved0; |
||
107 | __u32 dstStart; |
||
108 | __u32 xyExt; |
||
109 | |||
110 | __u32 reserved1[19]; |
||
111 | |||
112 | __u32 pageCntl; |
||
113 | __u32 pageBase; |
||
114 | __u32 postBase; |
||
115 | __u32 postPtr; |
||
116 | __u32 dataPtr; |
||
117 | } Neo2200; |
||
118 | |||
119 | #define NR_PALETTE 256 |
||
120 | |||
121 | #define MMIO_SIZE 0x200000 |
||
122 | |||
123 | #define NEO_EXT_CR_MAX 0x85 |
||
124 | #define NEO_EXT_GR_MAX 0xC7 |
||
125 | |||
126 | struct neofb_par { |
||
127 | |||
128 | unsigned char MiscOutReg; /* Misc */ |
||
129 | unsigned char CRTC[25]; /* Crtc Controller */ |
||
130 | unsigned char Sequencer[5]; /* Video Sequencer */ |
||
131 | unsigned char Graphics[9]; /* Video Graphics */ |
||
132 | unsigned char Attribute[21]; /* Video Atribute */ |
||
133 | |||
134 | unsigned char GeneralLockReg; |
||
135 | unsigned char ExtCRTDispAddr; |
||
136 | unsigned char ExtCRTOffset; |
||
137 | unsigned char SysIfaceCntl1; |
||
138 | unsigned char SysIfaceCntl2; |
||
139 | unsigned char ExtColorModeSelect; |
||
140 | unsigned char biosMode; |
||
141 | |||
142 | unsigned char PanelDispCntlReg1; |
||
143 | unsigned char PanelDispCntlReg2; |
||
144 | unsigned char PanelDispCntlReg3; |
||
145 | unsigned char PanelVertCenterReg1; |
||
146 | unsigned char PanelVertCenterReg2; |
||
147 | unsigned char PanelVertCenterReg3; |
||
148 | unsigned char PanelVertCenterReg4; |
||
149 | unsigned char PanelVertCenterReg5; |
||
150 | unsigned char PanelHorizCenterReg1; |
||
151 | unsigned char PanelHorizCenterReg2; |
||
152 | unsigned char PanelHorizCenterReg3; |
||
153 | unsigned char PanelHorizCenterReg4; |
||
154 | unsigned char PanelHorizCenterReg5; |
||
155 | |||
156 | int ProgramVCLK; |
||
157 | unsigned char VCLK3NumeratorLow; |
||
158 | unsigned char VCLK3NumeratorHigh; |
||
159 | unsigned char VCLK3Denominator; |
||
160 | unsigned char VerticalExt; |
||
161 | |||
162 | #ifdef CONFIG_MTRR |
||
163 | int mtrr; |
||
164 | #endif |
||
165 | u8 *mmio_vbase; |
||
166 | |||
167 | Neo2200 *neo2200; |
||
168 | |||
169 | /* Panels size */ |
||
170 | int NeoPanelWidth; |
||
171 | int NeoPanelHeight; |
||
172 | |||
173 | int maxClock; |
||
174 | |||
175 | int pci_burst; |
||
176 | int lcd_stretch; |
||
177 | int internal_display; |
||
178 | int external_display; |
||
179 | int libretto; |
||
180 | }; |
||
181 | |||
182 | typedef struct { |
||
183 | int x_res; |
||
184 | int y_res; |
||
185 | int mode; |
||
186 | } biosMode; |
||
187 | |||
188 | /* vga IO functions */ |
||
189 | static inline u8 VGArCR (u8 index) |
||
190 | { |
||
191 | outb (index, 0x3d4); |
||
192 | return inb (0x3d5); |
||
193 | } |
||
194 | |||
195 | static inline void VGAwCR (u8 index, u8 val) |
||
196 | { |
||
197 | outb (index, 0x3d4); |
||
198 | outb (val, 0x3d5); |
||
199 | } |
||
200 | |||
201 | static inline u8 VGArGR (u8 index) |
||
202 | { |
||
203 | outb (index, 0x3ce); |
||
204 | return inb (0x3cf); |
||
205 | } |
||
206 | |||
207 | static inline void VGAwGR (u8 index, u8 val) |
||
208 | { |
||
209 | outb (index, 0x3ce); |
||
210 | outb (val, 0x3cf); |
||
211 | } |
||
212 | |||
213 | static inline u8 VGArSEQ (u8 index) |
||
214 | { |
||
215 | outb (index, 0x3c4); |
||
216 | return inb (0x3c5); |
||
217 | } |
||
218 | |||
219 | static inline void VGAwSEQ (u8 index, u8 val) |
||
220 | { |
||
221 | outb (index, 0x3c4); |
||
222 | outb (val, 0x3c5); |
||
223 | } |
||
224 | |||
225 | |||
226 | static int paletteEnabled = 0; |
||
227 | |||
228 | static inline void VGAenablePalette (void) |
||
229 | { |
||
230 | u8 tmp; |
||
231 | |||
232 | tmp = inb (0x3da); |
||
233 | outb (0x00, 0x3c0); |
||
234 | paletteEnabled = 1; |
||
235 | } |
||
236 | |||
237 | static inline void VGAdisablePalette (void) |
||
238 | { |
||
239 | u8 tmp; |
||
240 | |||
241 | tmp = inb (0x3da); |
||
242 | outb (0x20, 0x3c0); |
||
243 | paletteEnabled = 0; |
||
244 | } |
||
245 | |||
246 | static inline void VGAwATTR (u8 index, u8 value) |
||
247 | { |
||
248 | u8 tmp; |
||
249 | |||
250 | if (paletteEnabled) |
||
251 | index &= ~0x20; |
||
252 | else |
||
253 | index |= 0x20; |
||
254 | |||
255 | tmp = inb (0x3da); |
||
256 | outb (index, 0x3c0); |
||
257 | outb (value, 0x3c0); |
||
258 | } |
||
259 | |||
260 | static inline void VGAwMISC (u8 value) |
||
261 | { |
||
262 | outb (value, 0x3c2); |
||
263 | } |
||
264 | #endif |
||
265 |