Subversion Repositories planix.SVN

Rev

Rev 2 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
2 - 1
#include <u.h>
2
#include <libc.h>
3
#include <bio.h>
4
 
5
#include "pci.h"
6
#include "vga.h"
7
 
8
/*
9
 * S3 Vision864 GUI Accelerator.
10
 * Pretty much the same as the 86C80[15].
11
 * First pass, needs tuning.
12
 */
13
static void
14
snarf(Vga* vga, Ctlr* ctlr)
15
{
16
	s3generic.snarf(vga, ctlr);
17
}
18
 
19
static void
20
options(Vga*, Ctlr* ctlr)
21
{
22
	ctlr->flag |= Hlinear|Hpclk2x8|Henhanced|Foptions;
23
}
24
 
25
static void
26
init(Vga* vga, Ctlr* ctlr)
27
{
28
	ulong x;
29
	char *val;
30
 
31
	s3generic.init(vga, ctlr);
32
	vga->crt[0x3B] = vga->crt[0]-5;
33
 
34
	if(vga->mode->z > 8)
35
		error("depth %d not supported\n", vga->mode->z);
36
 
37
	/*
38
	 * VL-bus crap.
39
	 */
40
	if((vga->crt[0x36] & 0x03) == 0x01){
41
		vga->crt[0x40] |= 0x08;
42
		vga->crt[0x58] &= ~0x88;
43
	}
44
 
45
	/*
46
	 * Display memory access control.
47
	 * Calculation of the M-parameter (Crt54) is
48
	 * memory-system and dot-clock dependent, the
49
	 * values below are guesses from dumping
50
	 * registers.
51
	 */
52
	vga->crt[0x60] = 0xFF;
53
	x = vga->mode->x/8;
54
	vga->crt[0x61] = 0x80|((x>>8) & 0x07);
55
	vga->crt[0x62] = (x & 0xFF);
56
	if(vga->mode->x <= 800)
57
		vga->crt[0x54] = 0x88;
58
	else if(vga->mode->x <= 1024)
59
		vga->crt[0x54] = 0xF8;
60
	else
61
		vga->crt[0x54] = 0x40;
62
 
63
	vga->crt[0x67] &= ~0xF0;
64
	if(ctlr->flag & Upclk2x8)
65
		vga->crt[0x67] |= 0x10;
66
 
67
	vga->crt[0x69] = 0x00;
68
	vga->crt[0x6A] = 0x00;
69
 
70
	/*
71
	 * Blank adjust.
72
	 * This may not be correct for all monitors.
73
	 */
74
	vga->crt[0x6D] = 0x00;
75
	if(val = dbattr(vga->attr, "delaybl"))
76
		vga->crt[0x6D] |= strtoul(val, 0, 0) & 0x07;
77
	else
78
		vga->crt[0x6D] |= 2;
79
	if(val = dbattr(vga->attr, "delaysc"))
80
		vga->crt[0x6D] |= (strtoul(val, 0, 0) & 0x07)<<4;
81
}
82
 
83
static void
84
load(Vga* vga, Ctlr* ctlr)
85
{
86
	ushort advfunc;
87
 
88
	s3generic.load(vga, ctlr);
89
	vgaxo(Crtx, 0x60, vga->crt[0x60]);
90
	vgaxo(Crtx, 0x61, vga->crt[0x61]);
91
	vgaxo(Crtx, 0x62, vga->crt[0x62]);
92
	vgaxo(Crtx, 0x67, vga->crt[0x67]);
93
	vgaxo(Crtx, 0x69, vga->crt[0x69]);
94
	vgaxo(Crtx, 0x6A, vga->crt[0x6A]);
95
	vgaxo(Crtx, 0x6D, vga->crt[0x6D]);
96
 
97
	advfunc = 0x0000;
98
	if(ctlr->flag & Uenhanced){
99
		if(vga->mode->x == 1024 || vga->mode->x == 800)
100
			advfunc = 0x0057;
101
		else
102
			advfunc = 0x0053;
103
	}
104
	outportw(0x4AE8, advfunc);
105
}
106
 
107
static void
108
dump(Vga* vga, Ctlr* ctlr)
109
{
110
	s3generic.dump(vga, ctlr);
111
}
112
 
113
Ctlr vision864 = {
114
	"vision864",			/* name */
115
	snarf,				/* snarf */
116
	options,			/* options */
117
	init,				/* init */
118
	load,				/* load */
119
	dump,				/* dump */
120
};