Plan 9 from Bell Labs’s /usr/web/sources/contrib/quanstro/root/sys/src/boot/pc-e820/patchvesa.c

Copyright © 2021 Plan 9 Foundation.
Distributed under the MIT License.
Download the Plan 9 distribution.


/*
 * translated by paul reed from the oberon
 * translation of the linux utility 1280patch,
 * by andrew tipton & christian zietz
 */
#include "u.h"
#include "lib.h"
#include "mem.h"
#include "dat.h"
#include "fns.h"
#include "io.h"

enum{
	Aport	= 0xcf8,
	Rport	= 0xcfc,

	Clock	= 80140,
	Hdisp	= 1280,
	Hstart	= 1343,
	Hend	= 1479,
	Htotal	= 1679,
	Vdisp	= 768,
	Vstart	= 768,
	Vend	= 771,
	Vtotal	= 779,
};

void
patchvesa(void)
{
	ushort *p;

	if(getconf("patchvesa") == 0)
		return;

	outl(Aport, 1<<31);
	if(inl(Rport) != 0x35808086)
		return;

	outl(Aport, 1<<31|0x58);
	outb(Rport+2, 0x33);

	p = (ushort*)(0xc025b+6+28*0);		/* timing table */
	p = KADDR(p);
	*(ulong*)p = Clock;
	p += 2;
	*p++ = Hdisp-1;
	*p++ = Htotal;
	*p++ = Hdisp-1;
	*p++ = Htotal;
	*p++ = Hstart;
	*p++ = Hend;
	*p++ = Vdisp-1;
	*p++ = Vtotal;
	*p++ = Vdisp-1;
	*p++ = Vtotal;
	*p++ = Vstart;
	*p++ = Vend;

	USED(p);

	outl(Aport, 1<<31|0x58);
	outb(Rport+2, 0x11);
}

Bell Labs OSI certified Powered by Plan 9

(Return to Plan 9 Home Page)

Copyright © 2021 Plan 9 Foundation. All Rights Reserved.
Comments to [email protected].