Blame view

drivers/video/vga16fb.c 37.4 KB
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
  /*
   * linux/drivers/video/vga16.c -- VGA 16-color framebuffer driver
   * 
   * Copyright 1999 Ben Pfaff <pfaffben@debian.org> and Petr Vandrovec <VANDROVE@vc.cvut.cz>
   * Based on VGA info at http://www.goodnet.com/~tinara/FreeVGA/home.htm
   * Based on VESA framebuffer (c) 1998 Gerd Knorr <kraxel@goldbach.in-berlin.de>
   *
   * This file is subject to the terms and conditions of the GNU General
   * Public License.  See the file COPYING in the main directory of this
   * archive for more details.  
   */
  
  #include <linux/module.h>
  #include <linux/kernel.h>
  #include <linux/errno.h>
  #include <linux/string.h>
  #include <linux/mm.h>
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
18
19
20
21
  #include <linux/delay.h>
  #include <linux/fb.h>
  #include <linux/ioport.h>
  #include <linux/init.h>
120ddb41f   Antonino A. Daplas   [PATCH] vga16fb: ...
22
  #include <linux/platform_device.h>
a8f340e39   Jon Smirl   [PATCH] vt: Remov...
23
  #include <linux/screen_info.h>
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
24
25
26
  
  #include <asm/io.h>
  #include <video/vga.h>
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
27
28
29
30
31
32
33
34
35
36
37
38
39
  #define VGA_FB_PHYS 0xA0000
  #define VGA_FB_PHYS_LEN 65536
  
  #define MODE_SKIP4	1
  #define MODE_8BPP	2
  #define MODE_CFB	4
  #define MODE_TEXT	8
  
  /* --------------------------------------------------------------------- */
  
  /*
   * card parameters
   */
120ddb41f   Antonino A. Daplas   [PATCH] vga16fb: ...
40
  struct vga16fb_par {
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
41
42
43
  	/* structure holding original VGA register settings when the
             screen is blanked */
  	struct {
120ddb41f   Antonino A. Daplas   [PATCH] vga16fb: ...
44
45
46
47
48
49
50
51
52
53
54
55
  		unsigned char	SeqCtrlIndex;	  /* Sequencer Index reg.   */
  		unsigned char	CrtCtrlIndex;	  /* CRT-Contr. Index reg.  */
  		unsigned char	CrtMiscIO;	  /* Miscellaneous register */
  		unsigned char	HorizontalTotal;  /* CRT-Controller:00h */
  		unsigned char	HorizDisplayEnd;  /* CRT-Controller:01h */
  		unsigned char	StartHorizRetrace;/* CRT-Controller:04h */
  		unsigned char	EndHorizRetrace;  /* CRT-Controller:05h */
  		unsigned char	Overflow;	  /* CRT-Controller:07h */
  		unsigned char	StartVertRetrace; /* CRT-Controller:10h */
  		unsigned char	EndVertRetrace;	  /* CRT-Controller:11h */
  		unsigned char	ModeControl;	  /* CRT-Controller:17h */
  		unsigned char	ClockingMode;	  /* Seq-Controller:01h */
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
56
57
  	} vga_state;
  	struct vgastate state;
c4f28e54d   Jiri Slaby   [PATCH] Video: fb...
58
  	unsigned int ref_count;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
59
60
61
  	int palette_blanked, vesa_blanked, mode, isVGA;
  	u8 misc, pel_msk, vss, clkdiv;
  	u8 crtc[VGA_CRT_C];
120ddb41f   Antonino A. Daplas   [PATCH] vga16fb: ...
62
  };
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
63
64
  
  /* --------------------------------------------------------------------- */
ad1458464   Henrik Kretzschmar   fbdev: section cl...
65
  static struct fb_var_screeninfo vga16fb_defined __devinitdata = {
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
  	.xres		= 640,
  	.yres		= 480,
  	.xres_virtual	= 640,
  	.yres_virtual	= 480,
  	.bits_per_pixel	= 4,	
  	.activate	= FB_ACTIVATE_TEST,
  	.height		= -1,
  	.width		= -1,
  	.pixclock	= 39721,
  	.left_margin	= 48,
  	.right_margin	= 16,
  	.upper_margin	= 33,
  	.lower_margin	= 10,
  	.hsync_len 	= 96,
  	.vsync_len	= 2,
  	.vmode		= FB_VMODE_NONINTERLACED,
  };
  
  /* name should not depend on EGA/VGA */
ad1458464   Henrik Kretzschmar   fbdev: section cl...
85
  static struct fb_fix_screeninfo vga16fb_fix __devinitdata = {
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
86
87
88
89
90
91
92
93
  	.id		= "VGA16 VGA",
  	.smem_start	= VGA_FB_PHYS,
  	.smem_len	= VGA_FB_PHYS_LEN,
  	.type		= FB_TYPE_VGA_PLANES,
  	.type_aux	= FB_AUX_VGA_PLANES_VGA4,
  	.visual		= FB_VISUAL_PSEUDOCOLOR,
  	.xpanstep	= 8,
  	.ypanstep	= 1,
98219374d   Krzysztof Helt   vga16fb: source c...
94
  	.line_length	= 640 / 8,
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
  	.accel		= FB_ACCEL_NONE
  };
  
  /* The VGA's weird architecture often requires that we read a byte and
     write a byte to the same location.  It doesn't matter *what* byte
     we write, however.  This is because all the action goes on behind
     the scenes in the VGA's 32-bit latch register, and reading and writing
     video memory just invokes latch behavior.
  
     To avoid race conditions (is this necessary?), reading and writing
     the memory byte should be done with a single instruction.  One
     suitable instruction is the x86 bitwise OR.  The following
     read-modify-write routine should optimize to one such bitwise
     OR. */
  static inline void rmw(volatile char __iomem *p)
  {
  	readb(p);
  	writeb(1, p);
  }
  
  /* Set the Graphics Mode Register, and return its previous value.
     Bits 0-1 are write mode, bit 3 is read mode. */
  static inline int setmode(int mode)
  {
  	int oldmode;
  	
98219374d   Krzysztof Helt   vga16fb: source c...
121
122
  	oldmode = vga_io_rgfx(VGA_GFX_MODE);
  	vga_io_w(VGA_GFX_D, mode);
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
123
124
125
126
127
128
  	return oldmode;
  }
  
  /* Select the Bit Mask Register and return its value. */
  static inline int selectmask(void)
  {
98219374d   Krzysztof Helt   vga16fb: source c...
129
  	return vga_io_rgfx(VGA_GFX_BIT_MASK);
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
130
131
132
133
134
135
  }
  
  /* Set the value of the Bit Mask Register.  It must already have been
     selected with selectmask(). */
  static inline void setmask(int mask)
  {
98219374d   Krzysztof Helt   vga16fb: source c...
136
  	vga_io_w(VGA_GFX_D, mask);
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
137
138
139
140
141
142
143
144
145
  }
  
  /* Set the Data Rotate Register and return its old value. 
     Bits 0-2 are rotate count, bits 3-4 are logical operation
     (0=NOP, 1=AND, 2=OR, 3=XOR). */
  static inline int setop(int op)
  {
  	int oldop;
  	
98219374d   Krzysztof Helt   vga16fb: source c...
146
147
  	oldop = vga_io_rgfx(VGA_GFX_DATA_ROTATE);
  	vga_io_w(VGA_GFX_D, op);
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
148
149
150
151
  	return oldop;
  }
  
  /* Set the Enable Set/Reset Register and return its old value.  
25985edce   Lucas De Marchi   Fix common misspe...
152
     The code here always uses value 0xf for this register. */
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
153
154
155
  static inline int setsr(int sr)
  {
  	int oldsr;
98219374d   Krzysztof Helt   vga16fb: source c...
156
157
  	oldsr = vga_io_rgfx(VGA_GFX_SR_ENABLE);
  	vga_io_w(VGA_GFX_D, sr);
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
158
159
160
161
162
163
164
  	return oldsr;
  }
  
  /* Set the Set/Reset Register and return its old value. */
  static inline int setcolor(int color)
  {
  	int oldcolor;
98219374d   Krzysztof Helt   vga16fb: source c...
165
166
  	oldcolor = vga_io_rgfx(VGA_GFX_SR_VALUE);
  	vga_io_w(VGA_GFX_D, color);
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
167
168
169
170
171
172
  	return oldcolor;
  }
  
  /* Return the value in the Graphics Address Register. */
  static inline int getindex(void)
  {
98219374d   Krzysztof Helt   vga16fb: source c...
173
  	return vga_io_r(VGA_GFX_I);
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
174
175
176
177
178
  }
  
  /* Set the value in the Graphics Address Register. */
  static inline void setindex(int index)
  {
98219374d   Krzysztof Helt   vga16fb: source c...
179
  	vga_io_w(VGA_GFX_I, index);
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
180
181
182
183
184
  }
  
  static void vga16fb_pan_var(struct fb_info *info, 
  			    struct fb_var_screeninfo *var)
  {
120ddb41f   Antonino A. Daplas   [PATCH] vga16fb: ...
185
  	struct vga16fb_par *par = info->par;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
  	u32 xoffset, pos;
  
  	xoffset = var->xoffset;
  	if (info->var.bits_per_pixel == 8) {
  		pos = (info->var.xres_virtual * var->yoffset + xoffset) >> 2;
  	} else if (par->mode & MODE_TEXT) {
  		int fh = 16; // FIXME !!! font height. Fugde for now.
  		pos = (info->var.xres_virtual * (var->yoffset / fh) + xoffset) >> 3;
  	} else {
  		if (info->var.nonstd)
  			xoffset--;
  		pos = (info->var.xres_virtual * var->yoffset + xoffset) >> 3;
  	}
  	vga_io_wcrt(VGA_CRTC_START_HI, pos >> 8);
  	vga_io_wcrt(VGA_CRTC_START_LO, pos & 0xFF);
  	/* if we support CFB4, then we must! support xoffset with pixel
  	 * granularity if someone supports xoffset in bit resolution */
  	vga_io_r(VGA_IS1_RC);		/* reset flip-flop */
  	vga_io_w(VGA_ATT_IW, VGA_ATC_PEL);
c272d6411   Laurent Pinchart   vga16fb: use disp...
205
  	if (info->var.bits_per_pixel == 8)
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
  		vga_io_w(VGA_ATT_IW, (xoffset & 3) << 1);
  	else
  		vga_io_w(VGA_ATT_IW, xoffset & 7);
  	vga_io_r(VGA_IS1_RC);
  	vga_io_w(VGA_ATT_IW, 0x20);
  }
  
  static void vga16fb_update_fix(struct fb_info *info)
  {
  	if (info->var.bits_per_pixel == 4) {
  		if (info->var.nonstd) {
  			info->fix.type = FB_TYPE_PACKED_PIXELS;
  			info->fix.line_length = info->var.xres_virtual / 2;
  		} else {
  			info->fix.type = FB_TYPE_VGA_PLANES;
  			info->fix.type_aux = FB_AUX_VGA_PLANES_VGA4;
  			info->fix.line_length = info->var.xres_virtual / 8;
  		}
  	} else if (info->var.bits_per_pixel == 0) {
  		info->fix.type = FB_TYPE_TEXT;
  		info->fix.type_aux = FB_AUX_TEXT_CGA;
  		info->fix.line_length = info->var.xres_virtual / 4;
  	} else {	/* 8bpp */
  		if (info->var.nonstd) {
  			info->fix.type = FB_TYPE_VGA_PLANES;
  			info->fix.type_aux = FB_AUX_VGA_PLANES_CFB8;
  			info->fix.line_length = info->var.xres_virtual / 4;
  		} else {
  			info->fix.type = FB_TYPE_PACKED_PIXELS;
  			info->fix.line_length = info->var.xres_virtual;
  		}
  	}
  }
  
  static void vga16fb_clock_chip(struct vga16fb_par *par,
  			       unsigned int pixclock,
  			       const struct fb_info *info,
  			       int mul, int div)
  {
ec1a7b3d7   Helge Deller   [PATCH] constify ...
245
  	static const struct {
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
  		u32 pixclock;
  		u8  misc;
  		u8  seq_clock_mode;
  	} *ptr, *best, vgaclocks[] = {
  		{ 79442 /* 12.587 */, 0x00, 0x08},
  		{ 70616 /* 14.161 */, 0x04, 0x08},
  		{ 39721 /* 25.175 */, 0x00, 0x00},
  		{ 35308 /* 28.322 */, 0x04, 0x00},
  		{     0 /* bad */,    0x00, 0x00}};
  	int err;
  
  	pixclock = (pixclock * mul) / div;
  	best = vgaclocks;
  	err = pixclock - best->pixclock;
  	if (err < 0) err = -err;
  	for (ptr = vgaclocks + 1; ptr->pixclock; ptr++) {
  		int tmp;
  
  		tmp = pixclock - ptr->pixclock;
  		if (tmp < 0) tmp = -tmp;
  		if (tmp < err) {
  			err = tmp;
  			best = ptr;
  		}
  	}
  	par->misc |= best->misc;
  	par->clkdiv = best->seq_clock_mode;
  	pixclock = (best->pixclock * div) / mul;		
  }
  			       
  #define FAIL(X) return -EINVAL
  
  static int vga16fb_open(struct fb_info *info, int user)
  {
120ddb41f   Antonino A. Daplas   [PATCH] vga16fb: ...
280
  	struct vga16fb_par *par = info->par;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
281

c4f28e54d   Jiri Slaby   [PATCH] Video: fb...
282
  	if (!par->ref_count) {
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
283
284
285
286
287
  		memset(&par->state, 0, sizeof(struct vgastate));
  		par->state.flags = VGA_SAVE_FONTS | VGA_SAVE_MODE |
  			VGA_SAVE_CMAP;
  		save_vga(&par->state);
  	}
c4f28e54d   Jiri Slaby   [PATCH] Video: fb...
288
  	par->ref_count++;
c4f28e54d   Jiri Slaby   [PATCH] Video: fb...
289

1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
290
291
292
293
294
  	return 0;
  }
  
  static int vga16fb_release(struct fb_info *info, int user)
  {
120ddb41f   Antonino A. Daplas   [PATCH] vga16fb: ...
295
  	struct vga16fb_par *par = info->par;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
296

9c8db4a26   Krzysztof Helt   vga16fb: remove o...
297
  	if (!par->ref_count)
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
298
  		return -EINVAL;
9c8db4a26   Krzysztof Helt   vga16fb: remove o...
299

c4f28e54d   Jiri Slaby   [PATCH] Video: fb...
300
  	if (par->ref_count == 1)
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
301
  		restore_vga(&par->state);
c4f28e54d   Jiri Slaby   [PATCH] Video: fb...
302
  	par->ref_count--;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
303
304
305
306
307
308
309
  
  	return 0;
  }
  
  static int vga16fb_check_var(struct fb_var_screeninfo *var,
  			     struct fb_info *info)
  {
120ddb41f   Antonino A. Daplas   [PATCH] vga16fb: ...
310
  	struct vga16fb_par *par = info->par;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
  	u32 xres, right, hslen, left, xtotal;
  	u32 yres, lower, vslen, upper, ytotal;
  	u32 vxres, xoffset, vyres, yoffset;
  	u32 pos;
  	u8 r7, rMode;
  	int shift;
  	int mode;
  	u32 maxmem;
  
  	par->pel_msk = 0xFF;
  
  	if (var->bits_per_pixel == 4) {
  		if (var->nonstd) {
  			if (!par->isVGA)
  				return -EINVAL;
  			shift = 3;
  			mode = MODE_SKIP4 | MODE_CFB;
  			maxmem = 16384;
  			par->pel_msk = 0x0F;
  		} else {
  			shift = 3;
  			mode = 0;
  			maxmem = 65536;
  		}
  	} else if (var->bits_per_pixel == 8) {
  		if (!par->isVGA)
  			return -EINVAL;	/* no support on EGA */
  		shift = 2;
  		if (var->nonstd) {
  			mode = MODE_8BPP | MODE_CFB;
  			maxmem = 65536;
  		} else {
  			mode = MODE_SKIP4 | MODE_8BPP | MODE_CFB;
  			maxmem = 16384;
  		}
  	} else
  		return -EINVAL;
  
  	xres = (var->xres + 7) & ~7;
  	vxres = (var->xres_virtual + 0xF) & ~0xF;
  	xoffset = (var->xoffset + 7) & ~7;
  	left = (var->left_margin + 7) & ~7;
  	right = (var->right_margin + 7) & ~7;
  	hslen = (var->hsync_len + 7) & ~7;
  
  	if (vxres < xres)
  		vxres = xres;
  	if (xres + xoffset > vxres)
  		xoffset = vxres - xres;
  
  	var->xres = xres;
  	var->right_margin = right;
  	var->hsync_len = hslen;
  	var->left_margin = left;
  	var->xres_virtual = vxres;
  	var->xoffset = xoffset;
  
  	xres >>= shift;
  	right >>= shift;
  	hslen >>= shift;
  	left >>= shift;
  	vxres >>= shift;
  	xtotal = xres + right + hslen + left;
  	if (xtotal >= 256)
  		FAIL("xtotal too big");
  	if (hslen > 32)
  		FAIL("hslen too big");
  	if (right + hslen + left > 64)
  		FAIL("hblank too big");
  	par->crtc[VGA_CRTC_H_TOTAL] = xtotal - 5;
  	par->crtc[VGA_CRTC_H_BLANK_START] = xres - 1;
  	par->crtc[VGA_CRTC_H_DISP] = xres - 1;
  	pos = xres + right;
  	par->crtc[VGA_CRTC_H_SYNC_START] = pos;
  	pos += hslen;
  	par->crtc[VGA_CRTC_H_SYNC_END] = pos & 0x1F;
  	pos += left - 2; /* blank_end + 2 <= total + 5 */
  	par->crtc[VGA_CRTC_H_BLANK_END] = (pos & 0x1F) | 0x80;
  	if (pos & 0x20)
  		par->crtc[VGA_CRTC_H_SYNC_END] |= 0x80;
  
  	yres = var->yres;
  	lower = var->lower_margin;
  	vslen = var->vsync_len;
  	upper = var->upper_margin;
  	vyres = var->yres_virtual;
  	yoffset = var->yoffset;
  
  	if (yres > vyres)
  		vyres = yres;
  	if (vxres * vyres > maxmem) {
  		vyres = maxmem / vxres;
  		if (vyres < yres)
  			return -ENOMEM;
  	}
  	if (yoffset + yres > vyres)
  		yoffset = vyres - yres;
  	var->yres = yres;
  	var->lower_margin = lower;
  	var->vsync_len = vslen;
  	var->upper_margin = upper;
  	var->yres_virtual = vyres;
  	var->yoffset = yoffset;
  
  	if (var->vmode & FB_VMODE_DOUBLE) {
  		yres <<= 1;
  		lower <<= 1;
  		vslen <<= 1;
  		upper <<= 1;
  	}
  	ytotal = yres + lower + vslen + upper;
  	if (ytotal > 1024) {
  		ytotal >>= 1;
  		yres >>= 1;
  		lower >>= 1;
  		vslen >>= 1;
  		upper >>= 1;
  		rMode = 0x04;
  	} else
  		rMode = 0x00;
  	if (ytotal > 1024)
  		FAIL("ytotal too big");
  	if (vslen > 16)
  		FAIL("vslen too big");
  	par->crtc[VGA_CRTC_V_TOTAL] = ytotal - 2;
  	r7 = 0x10;	/* disable linecompare */
  	if (ytotal & 0x100) r7 |= 0x01;
  	if (ytotal & 0x200) r7 |= 0x20;
  	par->crtc[VGA_CRTC_PRESET_ROW] = 0;
  	par->crtc[VGA_CRTC_MAX_SCAN] = 0x40;	/* 1 scanline, no linecmp */
  	if (var->vmode & FB_VMODE_DOUBLE)
  		par->crtc[VGA_CRTC_MAX_SCAN] |= 0x80;
  	par->crtc[VGA_CRTC_CURSOR_START] = 0x20;
  	par->crtc[VGA_CRTC_CURSOR_END]   = 0x00;
  	if ((mode & (MODE_CFB | MODE_8BPP)) == MODE_CFB)
  		xoffset--;
  	pos = yoffset * vxres + (xoffset >> shift);
  	par->crtc[VGA_CRTC_START_HI]     = pos >> 8;
  	par->crtc[VGA_CRTC_START_LO]     = pos & 0xFF;
  	par->crtc[VGA_CRTC_CURSOR_HI]    = 0x00;
  	par->crtc[VGA_CRTC_CURSOR_LO]    = 0x00;
  	pos = yres - 1;
  	par->crtc[VGA_CRTC_V_DISP_END] = pos & 0xFF;
  	par->crtc[VGA_CRTC_V_BLANK_START] = pos & 0xFF;
  	if (pos & 0x100)
  		r7 |= 0x0A;	/* 0x02 -> DISP_END, 0x08 -> BLANK_START */
  	if (pos & 0x200) {
  		r7 |= 0x40;	/* 0x40 -> DISP_END */
  		par->crtc[VGA_CRTC_MAX_SCAN] |= 0x20; /* BLANK_START */
  	}
  	pos += lower;
  	par->crtc[VGA_CRTC_V_SYNC_START] = pos & 0xFF;
  	if (pos & 0x100)
  		r7 |= 0x04;
  	if (pos & 0x200)
  		r7 |= 0x80;
  	pos += vslen;
  	par->crtc[VGA_CRTC_V_SYNC_END] = (pos & 0x0F) & ~0x10; /* disabled IRQ */
  	pos += upper - 1; /* blank_end + 1 <= ytotal + 2 */
  	par->crtc[VGA_CRTC_V_BLANK_END] = pos & 0xFF; /* 0x7F for original VGA,
                       but some SVGA chips requires all 8 bits to set */
  	if (vxres >= 512)
  		FAIL("vxres too long");
  	par->crtc[VGA_CRTC_OFFSET] = vxres >> 1;
  	if (mode & MODE_SKIP4)
  		par->crtc[VGA_CRTC_UNDERLINE] = 0x5F;	/* 256, cfb8 */
  	else
  		par->crtc[VGA_CRTC_UNDERLINE] = 0x1F;	/* 16, vgap */
  	par->crtc[VGA_CRTC_MODE] = rMode | ((mode & MODE_TEXT) ? 0xA3 : 0xE3);
  	par->crtc[VGA_CRTC_LINE_COMPARE] = 0xFF;
  	par->crtc[VGA_CRTC_OVERFLOW] = r7;
  
  	par->vss = 0x00;	/* 3DA */
  
  	par->misc = 0xE3;	/* enable CPU, ports 0x3Dx, positive sync */
  	if (var->sync & FB_SYNC_HOR_HIGH_ACT)
  		par->misc &= ~0x40;
  	if (var->sync & FB_SYNC_VERT_HIGH_ACT)
  		par->misc &= ~0x80;
  	
  	par->mode = mode;
  
  	if (mode & MODE_8BPP)
  		/* pixel clock == vga clock / 2 */
  		vga16fb_clock_chip(par, var->pixclock, info, 1, 2);
  	else
  		/* pixel clock == vga clock */
  		vga16fb_clock_chip(par, var->pixclock, info, 1, 1);
  	
  	var->red.offset = var->green.offset = var->blue.offset = 
  	var->transp.offset = 0;
  	var->red.length = var->green.length = var->blue.length =
  		(par->isVGA) ? 6 : 2;
  	var->transp.length = 0;
  	var->activate = FB_ACTIVATE_NOW;
  	var->height = -1;
  	var->width = -1;
  	var->accel_flags = 0;
  	return 0;
  }
  #undef FAIL
  
  static int vga16fb_set_par(struct fb_info *info)
  {
120ddb41f   Antonino A. Daplas   [PATCH] vga16fb: ...
515
  	struct vga16fb_par *par = info->par;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
  	u8 gdc[VGA_GFX_C];
  	u8 seq[VGA_SEQ_C];
  	u8 atc[VGA_ATT_C];
  	int fh, i;
  
  	seq[VGA_SEQ_CLOCK_MODE] = 0x01 | par->clkdiv;
  	if (par->mode & MODE_TEXT)
  		seq[VGA_SEQ_PLANE_WRITE] = 0x03;
  	else
  		seq[VGA_SEQ_PLANE_WRITE] = 0x0F;
  	seq[VGA_SEQ_CHARACTER_MAP] = 0x00;
  	if (par->mode & MODE_TEXT)
  		seq[VGA_SEQ_MEMORY_MODE] = 0x03;
  	else if (par->mode & MODE_SKIP4)
  		seq[VGA_SEQ_MEMORY_MODE] = 0x0E;
  	else
  		seq[VGA_SEQ_MEMORY_MODE] = 0x06;
  
  	gdc[VGA_GFX_SR_VALUE] = 0x00;
  	gdc[VGA_GFX_SR_ENABLE] = 0x00;
  	gdc[VGA_GFX_COMPARE_VALUE] = 0x00;
  	gdc[VGA_GFX_DATA_ROTATE] = 0x00;
  	gdc[VGA_GFX_PLANE_READ] = 0;
  	if (par->mode & MODE_TEXT) {
  		gdc[VGA_GFX_MODE] = 0x10;
  		gdc[VGA_GFX_MISC] = 0x06;
  	} else {
  		if (par->mode & MODE_CFB)
  			gdc[VGA_GFX_MODE] = 0x40;
  		else
  			gdc[VGA_GFX_MODE] = 0x00;
  		gdc[VGA_GFX_MISC] = 0x05;
  	}
  	gdc[VGA_GFX_COMPARE_MASK] = 0x0F;
  	gdc[VGA_GFX_BIT_MASK] = 0xFF;
  
  	for (i = 0x00; i < 0x10; i++)
  		atc[i] = i;
  	if (par->mode & MODE_TEXT)
  		atc[VGA_ATC_MODE] = 0x04;
  	else if (par->mode & MODE_8BPP)
  		atc[VGA_ATC_MODE] = 0x41;
  	else
  		atc[VGA_ATC_MODE] = 0x81;
  	atc[VGA_ATC_OVERSCAN] = 0x00;	/* 0 for EGA, 0xFF for VGA */
  	atc[VGA_ATC_PLANE_ENABLE] = 0x0F;
  	if (par->mode & MODE_8BPP)
  		atc[VGA_ATC_PEL] = (info->var.xoffset & 3) << 1;
  	else
  		atc[VGA_ATC_PEL] = info->var.xoffset & 7;
  	atc[VGA_ATC_COLOR_PAGE] = 0x00;
  	
  	if (par->mode & MODE_TEXT) {
  		fh = 16; // FIXME !!! Fudge font height. 
  		par->crtc[VGA_CRTC_MAX_SCAN] = (par->crtc[VGA_CRTC_MAX_SCAN] 
  					       & ~0x1F) | (fh - 1);
  	}
  
  	vga_io_w(VGA_MIS_W, vga_io_r(VGA_MIS_R) | 0x01);
  
  	/* Enable graphics register modification */
  	if (!par->isVGA) {
  		vga_io_w(EGA_GFX_E0, 0x00);
  		vga_io_w(EGA_GFX_E1, 0x01);
  	}
  	
  	/* update misc output register */
  	vga_io_w(VGA_MIS_W, par->misc);
  	
  	/* synchronous reset on */
  	vga_io_wseq(0x00, 0x01);
  
  	if (par->isVGA)
  		vga_io_w(VGA_PEL_MSK, par->pel_msk);
  
  	/* write sequencer registers */
  	vga_io_wseq(VGA_SEQ_CLOCK_MODE, seq[VGA_SEQ_CLOCK_MODE] | 0x20);
  	for (i = 2; i < VGA_SEQ_C; i++) {
  		vga_io_wseq(i, seq[i]);
  	}
  	
  	/* synchronous reset off */
  	vga_io_wseq(0x00, 0x03);
  
  	/* deprotect CRT registers 0-7 */
  	vga_io_wcrt(VGA_CRTC_V_SYNC_END, par->crtc[VGA_CRTC_V_SYNC_END]);
  
  	/* write CRT registers */
  	for (i = 0; i < VGA_CRTC_REGS; i++) {
  		vga_io_wcrt(i, par->crtc[i]);
  	}
  	
  	/* write graphics controller registers */
  	for (i = 0; i < VGA_GFX_C; i++) {
  		vga_io_wgfx(i, gdc[i]);
  	}
  	
  	/* write attribute controller registers */
  	for (i = 0; i < VGA_ATT_C; i++) {
  		vga_io_r(VGA_IS1_RC);		/* reset flip-flop */
  		vga_io_wattr(i, atc[i]);
  	}
  
  	/* Wait for screen to stabilize. */
  	mdelay(50);
  
  	vga_io_wseq(VGA_SEQ_CLOCK_MODE, seq[VGA_SEQ_CLOCK_MODE]);
  
  	vga_io_r(VGA_IS1_RC);
  	vga_io_w(VGA_ATT_IW, 0x20);
  
  	vga16fb_update_fix(info);
  	return 0;
  }
  
  static void ega16_setpalette(int regno, unsigned red, unsigned green, unsigned blue)
  {
ec1a7b3d7   Helge Deller   [PATCH] constify ...
633
  	static const unsigned char map[] = { 000, 001, 010, 011 };
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
634
635
636
637
638
639
640
641
642
643
644
645
646
  	int val;
  	
  	if (regno >= 16)
  		return;
  	val = map[red>>14] | ((map[green>>14]) << 1) | ((map[blue>>14]) << 2);
  	vga_io_r(VGA_IS1_RC);   /* ! 0x3BA */
  	vga_io_wattr(regno, val);
  	vga_io_r(VGA_IS1_RC);   /* some clones need it */
  	vga_io_w(VGA_ATT_IW, 0x20); /* unblank screen */
  }
  
  static void vga16_setpalette(int regno, unsigned red, unsigned green, unsigned blue)
  {
98219374d   Krzysztof Helt   vga16fb: source c...
647
648
649
650
  	outb(regno,       VGA_PEL_IW);
  	outb(red   >> 10, VGA_PEL_D);
  	outb(green >> 10, VGA_PEL_D);
  	outb(blue  >> 10, VGA_PEL_D);
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
651
652
653
654
655
656
  }
  
  static int vga16fb_setcolreg(unsigned regno, unsigned red, unsigned green,
  			     unsigned blue, unsigned transp,
  			     struct fb_info *info)
  {
120ddb41f   Antonino A. Daplas   [PATCH] vga16fb: ...
657
  	struct vga16fb_par *par = info->par;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
  	int gray;
  
  	/*
  	 *  Set a single color register. The values supplied are
  	 *  already rounded down to the hardware's capabilities
  	 *  (according to the entries in the `var' structure). Return
  	 *  != 0 for invalid regno.
  	 */
  	
  	if (regno >= 256)
  		return 1;
  
  	gray = info->var.grayscale;
  	
  	if (gray) {
  		/* gray = 0.30*R + 0.59*G + 0.11*B */
  		red = green = blue = (red * 77 + green * 151 + blue * 28) >> 8;
  	}
  	if (par->isVGA) 
  		vga16_setpalette(regno,red,green,blue);
  	else
  		ega16_setpalette(regno,red,green,blue);
  	return 0;
  }
  
  static int vga16fb_pan_display(struct fb_var_screeninfo *var,
  			       struct fb_info *info) 
  {
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
686
  	vga16fb_pan_var(info, var);
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
687
688
689
690
691
692
693
  	return 0;
  }
  
  /* The following VESA blanking code is taken from vgacon.c.  The VGA
     blanking code was originally by Huang shi chao, and modified by
     Christoph Rimek (chrimek@toppoint.de) and todd j. derr
     (tjd@barefoot.org) for Linux. */
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
694
695
696
  
  static void vga_vesa_blank(struct vga16fb_par *par, int mode)
  {
98219374d   Krzysztof Helt   vga16fb: source c...
697
698
  	unsigned char SeqCtrlIndex = vga_io_r(VGA_SEQ_I);
  	unsigned char CrtCtrlIndex = vga_io_r(VGA_CRT_IC);
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
699
  	
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
700
701
  	/* save original values of VGA controller registers */
  	if(!par->vesa_blanked) {
98219374d   Krzysztof Helt   vga16fb: source c...
702
  		par->vga_state.CrtMiscIO = vga_io_r(VGA_MIS_R);
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
  		//sti();
  
  		par->vga_state.HorizontalTotal = vga_io_rcrt(0x00);	/* HorizontalTotal */
  		par->vga_state.HorizDisplayEnd = vga_io_rcrt(0x01);	/* HorizDisplayEnd */
  		par->vga_state.StartHorizRetrace = vga_io_rcrt(0x04);	/* StartHorizRetrace */
  		par->vga_state.EndHorizRetrace = vga_io_rcrt(0x05);	/* EndHorizRetrace */
  		par->vga_state.Overflow = vga_io_rcrt(0x07);		/* Overflow */
  		par->vga_state.StartVertRetrace = vga_io_rcrt(0x10);	/* StartVertRetrace */
  		par->vga_state.EndVertRetrace = vga_io_rcrt(0x11);	/* EndVertRetrace */
  		par->vga_state.ModeControl = vga_io_rcrt(0x17);	/* ModeControl */
  		par->vga_state.ClockingMode = vga_io_rseq(0x01);	/* ClockingMode */
  	}
  
  	/* assure that video is enabled */
  	/* "0x20" is VIDEO_ENABLE_bit in register 01 of sequencer */
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
718
719
720
721
  	vga_io_wseq(0x01, par->vga_state.ClockingMode | 0x20);
  
  	/* test for vertical retrace in process.... */
  	if ((par->vga_state.CrtMiscIO & 0x80) == 0x80)
98219374d   Krzysztof Helt   vga16fb: source c...
722
  		vga_io_w(VGA_MIS_W, par->vga_state.CrtMiscIO & 0xef);
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
723
724
725
726
727
728
729
  
  	/*
  	 * Set <End of vertical retrace> to minimum (0) and
  	 * <Start of vertical Retrace> to maximum (incl. overflow)
  	 * Result: turn off vertical sync (VSync) pulse.
  	 */
  	if (mode & FB_BLANK_VSYNC_SUSPEND) {
98219374d   Krzysztof Helt   vga16fb: source c...
730
731
732
733
  		vga_io_wcrt(VGA_CRTC_V_SYNC_START, 0xff);
  		vga_io_wcrt(VGA_CRTC_V_SYNC_END, 0x40);
  		/* bits 9,10 of vert. retrace */
  		vga_io_wcrt(VGA_CRTC_OVERFLOW, par->vga_state.Overflow | 0x84);
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
734
735
736
737
738
739
740
741
  	}
  
  	if (mode & FB_BLANK_HSYNC_SUSPEND) {
  		/*
  		 * Set <End of horizontal retrace> to minimum (0) and
  		 *  <Start of horizontal Retrace> to maximum
  		 * Result: turn off horizontal sync (HSync) pulse.
  		 */
98219374d   Krzysztof Helt   vga16fb: source c...
742
743
  		vga_io_wcrt(VGA_CRTC_H_SYNC_START, 0xff);
  		vga_io_wcrt(VGA_CRTC_H_SYNC_END, 0x00);
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
744
745
746
  	}
  
  	/* restore both index registers */
98219374d   Krzysztof Helt   vga16fb: source c...
747
748
  	outb_p(SeqCtrlIndex, VGA_SEQ_I);
  	outb_p(CrtCtrlIndex, VGA_CRT_IC);
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
749
750
751
752
  }
  
  static void vga_vesa_unblank(struct vga16fb_par *par)
  {
98219374d   Krzysztof Helt   vga16fb: source c...
753
754
  	unsigned char SeqCtrlIndex = vga_io_r(VGA_SEQ_I);
  	unsigned char CrtCtrlIndex = vga_io_r(VGA_CRT_IC);
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
755
  	
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
756
  	/* restore original values of VGA controller registers */
98219374d   Krzysztof Helt   vga16fb: source c...
757
  	vga_io_w(VGA_MIS_W, par->vga_state.CrtMiscIO);
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
  
  	/* HorizontalTotal */
  	vga_io_wcrt(0x00, par->vga_state.HorizontalTotal);
  	/* HorizDisplayEnd */
  	vga_io_wcrt(0x01, par->vga_state.HorizDisplayEnd);
  	/* StartHorizRetrace */
  	vga_io_wcrt(0x04, par->vga_state.StartHorizRetrace);
  	/* EndHorizRetrace */
  	vga_io_wcrt(0x05, par->vga_state.EndHorizRetrace);
  	/* Overflow */
  	vga_io_wcrt(0x07, par->vga_state.Overflow);
  	/* StartVertRetrace */
  	vga_io_wcrt(0x10, par->vga_state.StartVertRetrace);
  	/* EndVertRetrace */
  	vga_io_wcrt(0x11, par->vga_state.EndVertRetrace);
  	/* ModeControl */
  	vga_io_wcrt(0x17, par->vga_state.ModeControl);
  	/* ClockingMode */
  	vga_io_wseq(0x01, par->vga_state.ClockingMode);
  
  	/* restore index/control registers */
98219374d   Krzysztof Helt   vga16fb: source c...
779
780
  	vga_io_w(VGA_SEQ_I, SeqCtrlIndex);
  	vga_io_w(VGA_CRT_IC, CrtCtrlIndex);
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
781
782
783
784
785
786
787
  }
  
  static void vga_pal_blank(void)
  {
  	int i;
  
  	for (i=0; i<16; i++) {
98219374d   Krzysztof Helt   vga16fb: source c...
788
789
790
791
  		outb_p(i, VGA_PEL_IW);
  		outb_p(0, VGA_PEL_D);
  		outb_p(0, VGA_PEL_D);
  		outb_p(0, VGA_PEL_D);
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
792
793
794
795
796
797
  	}
  }
  
  /* 0 unblank, 1 blank, 2 no vsync, 3 no hsync, 4 off */
  static int vga16fb_blank(int blank, struct fb_info *info)
  {
120ddb41f   Antonino A. Daplas   [PATCH] vga16fb: ...
798
  	struct vga16fb_par *par = info->par;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
  
  	switch (blank) {
  	case FB_BLANK_UNBLANK:				/* Unblank */
  		if (par->vesa_blanked) {
  			vga_vesa_unblank(par);
  			par->vesa_blanked = 0;
  		}
  		if (par->palette_blanked) {
  			par->palette_blanked = 0;
  		}
  		break;
  	case FB_BLANK_NORMAL:				/* blank */
  		vga_pal_blank();
  		par->palette_blanked = 1;
  		break;
  	default:			/* VESA blanking */
  		vga_vesa_blank(par, blank);
  		par->vesa_blanked = 1;
  		break;
  	}
  	return 0;
  }
  
  static void vga_8planes_fillrect(struct fb_info *info, const struct fb_fillrect *rect)
  {
  	u32 dx = rect->dx, width = rect->width;
          char oldindex = getindex();
          char oldmode = setmode(0x40);
          char oldmask = selectmask();
          int line_ofs, height;
          char oldop, oldsr;
          char __iomem *where;
  
          dx /= 4;
          where = info->screen_base + dx + rect->dy * info->fix.line_length;
  
          if (rect->rop == ROP_COPY) {
                  oldop = setop(0);
                  oldsr = setsr(0);
  
                  width /= 4;
                  line_ofs = info->fix.line_length - width;
                  setmask(0xff);
  
                  height = rect->height;
  
                  while (height--) {
                          int x;
  
                          /* we can do memset... */
                          for (x = width; x > 0; --x) {
                                  writeb(rect->color, where);
                                  where++;
                          }
                          where += line_ofs;
                  }
          } else {
                  char oldcolor = setcolor(0xf);
                  int y;
  
                  oldop = setop(0x18);
                  oldsr = setsr(0xf);
                  setmask(0x0F);
                  for (y = 0; y < rect->height; y++) {
                          rmw(where);
                          rmw(where+1);
                          where += info->fix.line_length;
                  }
                  setcolor(oldcolor);
          }
          setmask(oldmask);
          setsr(oldsr);
          setop(oldop);
          setmode(oldmode);
          setindex(oldindex);
  }
  
  static void vga16fb_fillrect(struct fb_info *info, const struct fb_fillrect *rect)
  {
  	int x, x2, y2, vxres, vyres, width, height, line_ofs;
  	char __iomem *dst;
  
  	vxres = info->var.xres_virtual;
  	vyres = info->var.yres_virtual;
  
  	if (!rect->width || !rect->height || rect->dx > vxres || rect->dy > vyres)
  		return;
  
  	/* We could use hardware clipping but on many cards you get around
  	 * hardware clipping by writing to framebuffer directly. */
  
  	x2 = rect->dx + rect->width;
  	y2 = rect->dy + rect->height;
  	x2 = x2 < vxres ? x2 : vxres;
  	y2 = y2 < vyres ? y2 : vyres;
  	width = x2 - rect->dx;
  
  	switch (info->fix.type) {
  	case FB_TYPE_VGA_PLANES:
  		if (info->fix.type_aux == FB_AUX_VGA_PLANES_VGA4) {
  
  			height = y2 - rect->dy;
  			width = rect->width/8;
  
  			line_ofs = info->fix.line_length - width;
  			dst = info->screen_base + (rect->dx/8) + rect->dy * info->fix.line_length;
  
  			switch (rect->rop) {
  			case ROP_COPY:
  				setmode(0);
  				setop(0);
  				setsr(0xf);
  				setcolor(rect->color);
  				selectmask();
  
  				setmask(0xff);
  
  				while (height--) {
  					for (x = 0; x < width; x++) {
  						writeb(0, dst);
  						dst++;
  					}
  					dst += line_ofs;
  				}
  				break;
  			case ROP_XOR:
  				setmode(0);
  				setop(0x18);
  				setsr(0xf);
  				setcolor(0xf);
  				selectmask();
  
  				setmask(0xff);
  				while (height--) {
  					for (x = 0; x < width; x++) {
  						rmw(dst);
  						dst++;
  					}
  					dst += line_ofs;
  				}
  				break;
  			}
  		} else 
  			vga_8planes_fillrect(info, rect);
  		break;
  	case FB_TYPE_PACKED_PIXELS:
  	default:
  		cfb_fillrect(info, rect);
  		break;
  	}
  }
  
  static void vga_8planes_copyarea(struct fb_info *info, const struct fb_copyarea *area)
  {
          char oldindex = getindex();
          char oldmode = setmode(0x41);
          char oldop = setop(0);
          char oldsr = setsr(0xf);
          int height, line_ofs, x;
  	u32 sx, dx, width;
  	char __iomem *dest;
  	char __iomem *src;
  
          height = area->height;
  
          sx = area->sx / 4;
          dx = area->dx / 4;
          width = area->width / 4;
  
          if (area->dy < area->sy || (area->dy == area->sy && dx < sx)) {
                  line_ofs = info->fix.line_length - width;
                  dest = info->screen_base + dx + area->dy * info->fix.line_length;
                  src = info->screen_base + sx + area->sy * info->fix.line_length;
                  while (height--) {
                          for (x = 0; x < width; x++) {
                                  readb(src);
                                  writeb(0, dest);
                                  src++;
                                  dest++;
                          }
                          src += line_ofs;
                          dest += line_ofs;
                  }
          } else {
                  line_ofs = info->fix.line_length - width;
                  dest = info->screen_base + dx + width +
  			(area->dy + height - 1) * info->fix.line_length;
                  src = info->screen_base + sx + width +
  			(area->sy + height - 1) * info->fix.line_length;
                  while (height--) {
                          for (x = 0; x < width; x++) {
                                  --src;
                                  --dest;
                                  readb(src);
                                  writeb(0, dest);
                          }
                          src -= line_ofs;
                          dest -= line_ofs;
                  }
          }
  
          setsr(oldsr);
          setop(oldop);
          setmode(oldmode);
          setindex(oldindex);
  }
  
  static void vga16fb_copyarea(struct fb_info *info, const struct fb_copyarea *area)
  {
  	u32 dx = area->dx, dy = area->dy, sx = area->sx, sy = area->sy; 
  	int x, x2, y2, old_dx, old_dy, vxres, vyres;
  	int height, width, line_ofs;
  	char __iomem *dst = NULL;
  	char __iomem *src = NULL;
  
  	vxres = info->var.xres_virtual;
  	vyres = info->var.yres_virtual;
  
  	if (area->dx > vxres || area->sx > vxres || area->dy > vyres ||
  	    area->sy > vyres)
  		return;
  
  	/* clip the destination */
  	old_dx = area->dx;
  	old_dy = area->dy;
  
  	/*
  	 * We could use hardware clipping but on many cards you get around
  	 * hardware clipping by writing to framebuffer directly.
  	 */
  	x2 = area->dx + area->width;
  	y2 = area->dy + area->height;
  	dx = area->dx > 0 ? area->dx : 0;
  	dy = area->dy > 0 ? area->dy : 0;
  	x2 = x2 < vxres ? x2 : vxres;
  	y2 = y2 < vyres ? y2 : vyres;
  	width = x2 - dx;
  	height = y2 - dy;
77a6e7abb   Roel Kluin   vga16fb: test vir...
1037
1038
  	if (sx + dx < old_dx || sy + dy < old_dy)
  		return;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
1039
1040
1041
1042
1043
  	/* update sx1,sy1 */
  	sx += (dx - old_dx);
  	sy += (dy - old_dy);
  
  	/* the source must be completely inside the virtual screen */
77a6e7abb   Roel Kluin   vga16fb: test vir...
1044
  	if (sx + width > vxres || sy + height > vyres)
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
  		return;
  
  	switch (info->fix.type) {
  	case FB_TYPE_VGA_PLANES:
  		if (info->fix.type_aux == FB_AUX_VGA_PLANES_VGA4) {
  			width = width/8;
  			height = height;
  			line_ofs = info->fix.line_length - width;
  
  			setmode(1);
  			setop(0);
  			setsr(0xf);
  
  			if (dy < sy || (dy == sy && dx < sx)) {
  				dst = info->screen_base + (dx/8) + dy * info->fix.line_length;
  				src = info->screen_base + (sx/8) + sy * info->fix.line_length;
  				while (height--) {
  					for (x = 0; x < width; x++) {
  						readb(src);
  						writeb(0, dst);
  						dst++;
  						src++;
  					}
  					src += line_ofs;
  					dst += line_ofs;
  				}
  			} else {
  				dst = info->screen_base + (dx/8) + width + 
  					(dy + height - 1) * info->fix.line_length;
  				src = info->screen_base + (sx/8) + width + 
  					(sy + height  - 1) * info->fix.line_length;
  				while (height--) {
  					for (x = 0; x < width; x++) {
  						dst--;
  						src--;
  						readb(src);
  						writeb(0, dst);
  					}
  					src -= line_ofs;
  					dst -= line_ofs;
  				}
  			}
  		} else 
  			vga_8planes_copyarea(info, area);
  		break;
  	case FB_TYPE_PACKED_PIXELS:
  	default:
  		cfb_copyarea(info, area);
  		break;
  	}
  }
ec1a7b3d7   Helge Deller   [PATCH] constify ...
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
  #define TRANS_MASK_LOW  {0x0,0x8,0x4,0xC,0x2,0xA,0x6,0xE,0x1,0x9,0x5,0xD,0x3,0xB,0x7,0xF}
  #define TRANS_MASK_HIGH {0x000, 0x800, 0x400, 0xC00, 0x200, 0xA00, 0x600, 0xE00, \
  			 0x100, 0x900, 0x500, 0xD00, 0x300, 0xB00, 0x700, 0xF00}
  
  #if defined(__LITTLE_ENDIAN)
  static const u16 transl_l[] = TRANS_MASK_LOW;
  static const u16 transl_h[] = TRANS_MASK_HIGH;
  #elif defined(__BIG_ENDIAN)
  static const u16 transl_l[] = TRANS_MASK_HIGH;
  static const u16 transl_h[] = TRANS_MASK_LOW;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
1106
1107
1108
  #else
  #error "Only __BIG_ENDIAN and __LITTLE_ENDIAN are supported in vga-planes"
  #endif
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
  
  static void vga_8planes_imageblit(struct fb_info *info, const struct fb_image *image)
  {
          char oldindex = getindex();
          char oldmode = setmode(0x40);
          char oldop = setop(0);
          char oldsr = setsr(0);
          char oldmask = selectmask();
          const char *cdat = image->data;
  	u32 dx = image->dx;
          char __iomem *where;
          int y;
  
          dx /= 4;
          where = info->screen_base + dx + image->dy * info->fix.line_length;
  
          setmask(0xff);
          writeb(image->bg_color, where);
          readb(where);
          selectmask();
          setmask(image->fg_color ^ image->bg_color);
          setmode(0x42);
          setop(0x18);
          for (y = 0; y < image->height; y++, where += info->fix.line_length)
                  writew(transl_h[cdat[y]&0xF] | transl_l[cdat[y] >> 4], where);
          setmask(oldmask);
          setsr(oldsr);
          setop(oldop);
          setmode(oldmode);
          setindex(oldindex);
  }
  
  static void vga_imageblit_expand(struct fb_info *info, const struct fb_image *image)
  {
  	char __iomem *where = info->screen_base + (image->dx/8) +
  		image->dy * info->fix.line_length;
120ddb41f   Antonino A. Daplas   [PATCH] vga16fb: ...
1145
  	struct vga16fb_par *par = info->par;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
  	char *cdat = (char *) image->data;
  	char __iomem *dst;
  	int x, y;
  
  	switch (info->fix.type) {
  	case FB_TYPE_VGA_PLANES:
  		if (info->fix.type_aux == FB_AUX_VGA_PLANES_VGA4) {
  			if (par->isVGA) {
  				setmode(2);
  				setop(0);
  				setsr(0xf);
  				setcolor(image->fg_color);
  				selectmask();
  				
  				setmask(0xff);
  				writeb(image->bg_color, where);
  				rmb();
  				readb(where); /* fill latches */
  				setmode(3);
  				wmb();
  				for (y = 0; y < image->height; y++) {
  					dst = where;
  					for (x = image->width/8; x--;) 
  						writeb(*cdat++, dst++);
  					where += info->fix.line_length;
  				}
  				wmb();
  			} else {
  				setmode(0);
  				setop(0);
  				setsr(0xf);
  				setcolor(image->bg_color);
  				selectmask();
  				
  				setmask(0xff);
  				for (y = 0; y < image->height; y++) {
  					dst = where;
  					for (x=image->width/8; x--;){
  						rmw(dst);
  						setcolor(image->fg_color);
  						selectmask();
  						if (*cdat) {
  							setmask(*cdat++);
  							rmw(dst++);
  						}
  					}
  					where += info->fix.line_length;
  				}
  			}
  		} else 
  			vga_8planes_imageblit(info, image);
  		break;
  	case FB_TYPE_PACKED_PIXELS:
  	default:
  		cfb_imageblit(info, image);
  		break;
  	}
  }
  
  static void vga_imageblit_color(struct fb_info *info, const struct fb_image *image)
  {
  	/*
  	 * Draw logo 
  	 */
120ddb41f   Antonino A. Daplas   [PATCH] vga16fb: ...
1210
  	struct vga16fb_par *par = info->par;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
  	char __iomem *where =
  		info->screen_base + image->dy * info->fix.line_length +
  		image->dx/8;
  	const char *cdat = image->data;
  	char __iomem *dst;
  	int x, y;
  
  	switch (info->fix.type) {
  	case FB_TYPE_VGA_PLANES:
  		if (info->fix.type_aux == FB_AUX_VGA_PLANES_VGA4 &&
  		    par->isVGA) {
  			setsr(0xf);
  			setop(0);
  			setmode(0);
  			
  			for (y = 0; y < image->height; y++) {
  				for (x = 0; x < image->width; x++) {
  					dst = where + x/8;
  
  					setcolor(*cdat);
  					selectmask();
  					setmask(1 << (7 - (x % 8)));
  					fb_readb(dst);
  					fb_writeb(0, dst);
  
  					cdat++;
  				}
  				where += info->fix.line_length;
  			}
  		}
  		break;
  	case FB_TYPE_PACKED_PIXELS:
  		cfb_imageblit(info, image);
  		break;
  	default:
  		break;
  	}
  }
  				
  static void vga16fb_imageblit(struct fb_info *info, const struct fb_image *image)
  {
  	if (image->depth == 1)
  		vga_imageblit_expand(info, image);
  	else
  		vga_imageblit_color(info, image);
  }
3b9676e7a   Marcin Slusarz   vga16fb, drm: vga...
1257
1258
  static void vga16fb_destroy(struct fb_info *info)
  {
a50d28de8   Bruno Prémont   video: Fix use-af...
1259
  	struct platform_device *dev = container_of(info->device, struct platform_device, dev);
3b9676e7a   Marcin Slusarz   vga16fb, drm: vga...
1260
1261
1262
  	iounmap(info->screen_base);
  	fb_dealloc_cmap(&info->cmap);
  	/* XXX unshare VGA regions */
a50d28de8   Bruno Prémont   video: Fix use-af...
1263
  	platform_set_drvdata(dev, NULL);
3b9676e7a   Marcin Slusarz   vga16fb, drm: vga...
1264
1265
  	framebuffer_release(info);
  }
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
1266
1267
1268
1269
  static struct fb_ops vga16fb_ops = {
  	.owner		= THIS_MODULE,
  	.fb_open        = vga16fb_open,
  	.fb_release     = vga16fb_release,
3b9676e7a   Marcin Slusarz   vga16fb, drm: vga...
1270
  	.fb_destroy	= vga16fb_destroy,
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
1271
1272
1273
1274
1275
1276
1277
1278
  	.fb_check_var	= vga16fb_check_var,
  	.fb_set_par	= vga16fb_set_par,
  	.fb_setcolreg 	= vga16fb_setcolreg,
  	.fb_pan_display = vga16fb_pan_display,
  	.fb_blank 	= vga16fb_blank,
  	.fb_fillrect	= vga16fb_fillrect,
  	.fb_copyarea	= vga16fb_copyarea,
  	.fb_imageblit	= vga16fb_imageblit,
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
1279
1280
1281
  };
  
  #ifndef MODULE
ad1458464   Henrik Kretzschmar   fbdev: section cl...
1282
  static int __init vga16fb_setup(char *options)
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
  {
  	char *this_opt;
  	
  	if (!options || !*options)
  		return 0;
  	
  	while ((this_opt = strsep(&options, ",")) != NULL) {
  		if (!*this_opt) continue;
  	}
  	return 0;
  }
  #endif
c2e13037e   Uwe Kleine-König   platform-drivers:...
1295
  static int __devinit vga16fb_probe(struct platform_device *dev)
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
1296
  {
120ddb41f   Antonino A. Daplas   [PATCH] vga16fb: ...
1297
1298
  	struct fb_info *info;
  	struct vga16fb_par *par;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
1299
  	int i;
120ddb41f   Antonino A. Daplas   [PATCH] vga16fb: ...
1300
  	int ret = 0;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
1301

1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
1302
1303
  	printk(KERN_DEBUG "vga16fb: initializing
  ");
120ddb41f   Antonino A. Daplas   [PATCH] vga16fb: ...
1304
1305
1306
1307
1308
1309
  	info = framebuffer_alloc(sizeof(struct vga16fb_par), &dev->dev);
  
  	if (!info) {
  		ret = -ENOMEM;
  		goto err_fb_alloc;
  	}
3b9676e7a   Marcin Slusarz   vga16fb, drm: vga...
1310
1311
1312
1313
1314
  	info->apertures = alloc_apertures(1);
  	if (!info->apertures) {
  		ret = -ENOMEM;
  		goto err_ioremap;
  	}
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
1315
1316
  
  	/* XXX share VGA_FB_PHYS and I/O region with vgacon and others */
4f1bcaf09   Bjorn Helgaas   [PATCH] vgacon: m...
1317
  	info->screen_base = (void __iomem *)VGA_MAP_MEM(VGA_FB_PHYS, 0);
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
1318

120ddb41f   Antonino A. Daplas   [PATCH] vga16fb: ...
1319
  	if (!info->screen_base) {
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
1320
1321
1322
1323
1324
  		printk(KERN_ERR "vga16fb: unable to map device
  ");
  		ret = -ENOMEM;
  		goto err_ioremap;
  	}
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
1325

120ddb41f   Antonino A. Daplas   [PATCH] vga16fb: ...
1326
1327
1328
  	printk(KERN_INFO "vga16fb: mapped to 0x%p
  ", info->screen_base);
  	par = info->par;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
1329

3ea335100   H. Peter Anvin   Remove magic macr...
1330
  	par->isVGA = screen_info.orig_video_isVGA;
120ddb41f   Antonino A. Daplas   [PATCH] vga16fb: ...
1331
1332
1333
1334
  	par->palette_blanked = 0;
  	par->vesa_blanked = 0;
  
  	i = par->isVGA? 6 : 2;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
1335
1336
1337
1338
1339
1340
  	
  	vga16fb_defined.red.length   = i;
  	vga16fb_defined.green.length = i;
  	vga16fb_defined.blue.length  = i;	
  
  	/* name should not depend on EGA/VGA */
120ddb41f   Antonino A. Daplas   [PATCH] vga16fb: ...
1341
1342
1343
  	info->fbops = &vga16fb_ops;
  	info->var = vga16fb_defined;
  	info->fix = vga16fb_fix;
7e645ffd8   Antonino A. Daplas   vga16fb: actually...
1344
1345
  	/* supports rectangles with widths of multiples of 8 */
  	info->pixmap.blit_x = 1 << 7 | 1 << 15 | 1 << 23 | 1 << 31;
3b9676e7a   Marcin Slusarz   vga16fb, drm: vga...
1346
  	info->flags = FBINFO_FLAG_DEFAULT | FBINFO_MISC_FIRMWARE |
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
1347
  		FBINFO_HWACCEL_YPAN;
120ddb41f   Antonino A. Daplas   [PATCH] vga16fb: ...
1348
1349
  	i = (info->var.bits_per_pixel == 8) ? 256 : 16;
  	ret = fb_alloc_cmap(&info->cmap, i, 0);
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
1350
1351
1352
1353
1354
1355
  	if (ret) {
  		printk(KERN_ERR "vga16fb: unable to allocate colormap
  ");
  		ret = -ENOMEM;
  		goto err_alloc_cmap;
  	}
120ddb41f   Antonino A. Daplas   [PATCH] vga16fb: ...
1356
  	if (vga16fb_check_var(&info->var, info)) {
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
1357
1358
1359
1360
1361
  		printk(KERN_ERR "vga16fb: unable to validate variable
  ");
  		ret = -EINVAL;
  		goto err_check_var;
  	}
120ddb41f   Antonino A. Daplas   [PATCH] vga16fb: ...
1362
  	vga16fb_update_fix(info);
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
1363

3b9676e7a   Marcin Slusarz   vga16fb, drm: vga...
1364
1365
  	info->apertures->ranges[0].base = VGA_FB_PHYS;
  	info->apertures->ranges[0].size = VGA_FB_PHYS_LEN;
120ddb41f   Antonino A. Daplas   [PATCH] vga16fb: ...
1366
  	if (register_framebuffer(info) < 0) {
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
1367
1368
1369
1370
1371
1372
1373
1374
  		printk(KERN_ERR "vga16fb: unable to register framebuffer
  ");
  		ret = -EINVAL;
  		goto err_check_var;
  	}
  
  	printk(KERN_INFO "fb%d: %s frame buffer device
  ",
120ddb41f   Antonino A. Daplas   [PATCH] vga16fb: ...
1375
  	       info->node, info->fix.id);
ae6d32187   Antonino A. Daplas   [PATCH] vga16fb: ...
1376
  	platform_set_drvdata(dev, info);
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
1377
1378
1379
1380
  
  	return 0;
  
   err_check_var:
120ddb41f   Antonino A. Daplas   [PATCH] vga16fb: ...
1381
  	fb_dealloc_cmap(&info->cmap);
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
1382
   err_alloc_cmap:
120ddb41f   Antonino A. Daplas   [PATCH] vga16fb: ...
1383
  	iounmap(info->screen_base);
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
1384
   err_ioremap:
120ddb41f   Antonino A. Daplas   [PATCH] vga16fb: ...
1385
1386
1387
1388
  	framebuffer_release(info);
   err_fb_alloc:
  	return ret;
  }
ad1458464   Henrik Kretzschmar   fbdev: section cl...
1389
  static int __devexit vga16fb_remove(struct platform_device *dev)
120ddb41f   Antonino A. Daplas   [PATCH] vga16fb: ...
1390
  {
ae6d32187   Antonino A. Daplas   [PATCH] vga16fb: ...
1391
  	struct fb_info *info = platform_get_drvdata(dev);
120ddb41f   Antonino A. Daplas   [PATCH] vga16fb: ...
1392

3b9676e7a   Marcin Slusarz   vga16fb, drm: vga...
1393
  	if (info)
120ddb41f   Antonino A. Daplas   [PATCH] vga16fb: ...
1394
  		unregister_framebuffer(info);
120ddb41f   Antonino A. Daplas   [PATCH] vga16fb: ...
1395
1396
1397
  
  	return 0;
  }
ae6d32187   Antonino A. Daplas   [PATCH] vga16fb: ...
1398
  static struct platform_driver vga16fb_driver = {
120ddb41f   Antonino A. Daplas   [PATCH] vga16fb: ...
1399
  	.probe = vga16fb_probe,
ad1458464   Henrik Kretzschmar   fbdev: section cl...
1400
  	.remove = __devexit_p(vga16fb_remove),
ae6d32187   Antonino A. Daplas   [PATCH] vga16fb: ...
1401
1402
1403
  	.driver = {
  		.name = "vga16fb",
  	},
120ddb41f   Antonino A. Daplas   [PATCH] vga16fb: ...
1404
  };
ae6d32187   Antonino A. Daplas   [PATCH] vga16fb: ...
1405
  static struct platform_device *vga16fb_device;
120ddb41f   Antonino A. Daplas   [PATCH] vga16fb: ...
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
  
  static int __init vga16fb_init(void)
  {
  	int ret;
  #ifndef MODULE
  	char *option = NULL;
  
  	if (fb_get_options("vga16fb", &option))
  		return -ENODEV;
  
  	vga16fb_setup(option);
  #endif
ae6d32187   Antonino A. Daplas   [PATCH] vga16fb: ...
1418
  	ret = platform_driver_register(&vga16fb_driver);
120ddb41f   Antonino A. Daplas   [PATCH] vga16fb: ...
1419
1420
  
  	if (!ret) {
ae6d32187   Antonino A. Daplas   [PATCH] vga16fb: ...
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
  		vga16fb_device = platform_device_alloc("vga16fb", 0);
  
  		if (vga16fb_device)
  			ret = platform_device_add(vga16fb_device);
  		else
  			ret = -ENOMEM;
  
  		if (ret) {
  			platform_device_put(vga16fb_device);
  			platform_driver_unregister(&vga16fb_driver);
  		}
120ddb41f   Antonino A. Daplas   [PATCH] vga16fb: ...
1432
  	}
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
1433
1434
1435
1436
1437
  	return ret;
  }
  
  static void __exit vga16fb_exit(void)
  {
ae6d32187   Antonino A. Daplas   [PATCH] vga16fb: ...
1438
1439
  	platform_device_unregister(vga16fb_device);
  	platform_driver_unregister(&vga16fb_driver);
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
1440
  }
98219374d   Krzysztof Helt   vga16fb: source c...
1441
  MODULE_DESCRIPTION("Legacy VGA framebuffer device driver");
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
  MODULE_LICENSE("GPL");
  module_init(vga16fb_init);
  module_exit(vga16fb_exit);
  
  
  /*
   * Overrides for Emacs so that we follow Linus's tabbing style.
   * ---------------------------------------------------------------------------
   * Local variables:
   * c-basic-offset: 8
   * End:
   */