Subversion Repositories planix.SVN

Rev

Details | 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 86C80[15] GUI Accelerator.
10
 */
11
static void
12
snarf(Vga* vga, Ctlr* ctlr)
13
{
14
	s3generic.snarf(vga, ctlr);
15
}
16
 
17
static void
18
options(Vga*, Ctlr* ctlr)
19
{
20
	ctlr->flag |= Henhanced|Foptions;
21
}
22
 
23
static void
24
init(Vga* vga, Ctlr* ctlr)
25
{
26
	ulong x;
27
 
28
	s3generic.init(vga, ctlr);
29
	vga->crt[0x3B] = vga->crt[0]-5;
30
 
31
	if(vga->mode->z > 8)
32
		error("depth %d not supported\n", vga->mode->z);
33
 
34
	/*
35
	 * Display memory access control.
36
	 * Calculation of the M-parameter (Crt54) is
37
	 * memory-system and dot-clock dependent, the
38
	 * values below are guesses from dumping
39
	 * registers.
40
	 */
41
	vga->crt[0x60] = 0xFF;
42
	x = (vga->mode->x)/4;
43
	vga->crt[0x61] = 0x80|((x>>8) & 0x07);
44
	vga->crt[0x62] = (x & 0xFF);
45
 
46
	if(vga->mode->x <= 800)
47
		vga->crt[0x54] = 0x88;
48
	else if(vga->mode->x <= 1024)
49
		vga->crt[0x54] = 0xF8;
50
	else
51
		vga->crt[0x54] = 0x40;
52
}
53
 
54
static void
55
load(Vga* vga, Ctlr* ctlr)
56
{
57
	ushort advfunc;
58
 
59
	s3generic.load(vga, ctlr);
60
	vgaxo(Crtx, 0x60, vga->crt[0x60]);
61
	vgaxo(Crtx, 0x61, vga->crt[0x61]);
62
	vgaxo(Crtx, 0x62, vga->crt[0x62]);
63
 
64
	advfunc = 0x0000;
65
	if(ctlr->flag & Uenhanced){
66
		if(vga->mode->x == 1024 || vga->mode->x == 800)
67
			advfunc = 0x0057;
68
		else
69
			advfunc = 0x0053;
70
	}
71
	outportw(0x4AE8, advfunc);
72
}
73
 
74
static void
75
dump(Vga* vga, Ctlr* ctlr)
76
{
77
	s3generic.dump(vga, ctlr);
78
}
79
 
80
Ctlr s3801 = {
81
	"s3801",			/* name */
82
	snarf,				/* snarf */
83
	options,			/* options */
84
	init,				/* init */
85
	load,				/* load */
86
	dump,				/* dump */
87
};
88
 
89
Ctlr s3805 = {
90
	"s3805",			/* name */
91
	snarf,				/* snarf */
92
	options,			/* options */
93
	init,				/* init */
94
	load,				/* load */
95
	dump,				/* dump */
96
};