summaryrefslogtreecommitdiff
path: root/sys/src/cmd/aux/vga/s3801.c
diff options
context:
space:
mode:
authorTaru Karttunen <taruti@taruti.net>2011-03-30 15:46:40 +0300
committerTaru Karttunen <taruti@taruti.net>2011-03-30 15:46:40 +0300
commite5888a1ffdae813d7575f5fb02275c6bb07e5199 (patch)
treed8d51eac403f07814b9e936eed0c9a79195e2450 /sys/src/cmd/aux/vga/s3801.c
Import sources from 2011-03-30 iso image
Diffstat (limited to 'sys/src/cmd/aux/vga/s3801.c')
-rwxr-xr-xsys/src/cmd/aux/vga/s3801.c96
1 files changed, 96 insertions, 0 deletions
diff --git a/sys/src/cmd/aux/vga/s3801.c b/sys/src/cmd/aux/vga/s3801.c
new file mode 100755
index 000000000..acc8db47f
--- /dev/null
+++ b/sys/src/cmd/aux/vga/s3801.c
@@ -0,0 +1,96 @@
+#include <u.h>
+#include <libc.h>
+#include <bio.h>
+
+#include "pci.h"
+#include "vga.h"
+
+/*
+ * S3 86C80[15] GUI Accelerator.
+ */
+static void
+snarf(Vga* vga, Ctlr* ctlr)
+{
+ s3generic.snarf(vga, ctlr);
+}
+
+static void
+options(Vga*, Ctlr* ctlr)
+{
+ ctlr->flag |= Henhanced|Foptions;
+}
+
+static void
+init(Vga* vga, Ctlr* ctlr)
+{
+ ulong x;
+
+ s3generic.init(vga, ctlr);
+ vga->crt[0x3B] = vga->crt[0]-5;
+
+ if(vga->mode->z > 8)
+ error("depth %d not supported\n", vga->mode->z);
+
+ /*
+ * Display memory access control.
+ * Calculation of the M-parameter (Crt54) is
+ * memory-system and dot-clock dependent, the
+ * values below are guesses from dumping
+ * registers.
+ */
+ vga->crt[0x60] = 0xFF;
+ x = (vga->mode->x)/4;
+ vga->crt[0x61] = 0x80|((x>>8) & 0x07);
+ vga->crt[0x62] = (x & 0xFF);
+
+ if(vga->mode->x <= 800)
+ vga->crt[0x54] = 0x88;
+ else if(vga->mode->x <= 1024)
+ vga->crt[0x54] = 0xF8;
+ else
+ vga->crt[0x54] = 0x40;
+}
+
+static void
+load(Vga* vga, Ctlr* ctlr)
+{
+ ushort advfunc;
+
+ s3generic.load(vga, ctlr);
+ vgaxo(Crtx, 0x60, vga->crt[0x60]);
+ vgaxo(Crtx, 0x61, vga->crt[0x61]);
+ vgaxo(Crtx, 0x62, vga->crt[0x62]);
+
+ advfunc = 0x0000;
+ if(ctlr->flag & Uenhanced){
+ if(vga->mode->x == 1024 || vga->mode->x == 800)
+ advfunc = 0x0057;
+ else
+ advfunc = 0x0053;
+ }
+ outportw(0x4AE8, advfunc);
+}
+
+static void
+dump(Vga* vga, Ctlr* ctlr)
+{
+ s3generic.dump(vga, ctlr);
+}
+
+Ctlr s3801 = {
+ "s3801", /* name */
+ snarf, /* snarf */
+ options, /* options */
+ init, /* init */
+ load, /* load */
+ dump, /* dump */
+};
+
+Ctlr s3805 = {
+ "s3805", /* name */
+ snarf, /* snarf */
+ options, /* options */
+ init, /* init */
+ load, /* load */
+ dump, /* dump */
+};