示例#1
0
static void
nvidiaenable(VGAscr* scr)
{
	Pcidev *p;
	ulong *q;
	int tmp;

	if(scr->mmio)
		return;
	p = scr->pci;
	if(p == nil)
		return;
	scr->id = p->did;

	scr->mmio = vmap(p->mem[0].bar & ~0x0F, p->mem[0].size);
	if(scr->mmio == nil)
		return;
	addvgaseg("nvidiammio", p->mem[0].bar&~0x0F, p->mem[0].size);
	vgalinearpci(scr);
	if(scr->apsize)
		addvgaseg("nvidiascreen", scr->paddr, scr->apsize);
	/* find video memory size */
	switch (scr->id & 0x0ff0) {
	case 0x0020:
	case 0x00A0:
		q = (void*)((uchar*)scr->mmio + Pfb);
		tmp = *q;
		if (tmp & 0x0100) {
			scr->storage = ((tmp >> 12) & 0x0F) * 1024 + 1024 * 2;
		} else {
示例#2
0
static void
tdfxenable(VGAscr* scr)
{
	Pcidev *p;
	int i, *mmio;

	if(scr->mmio)
		return;
	if(p = pcimatch(nil, 0x121A, 0)){
		switch(p->did){
		case 0x0003:		/* Banshee */
		case 0x0005:		/* Avenger (a.k.a. Voodoo3) */
			break;
		default:
			return;
		}
	}
	else
		return;
	
	scr->mmio = vmap(p->mem[0].bar&~0x0F, p->mem[0].size);
	if(scr->mmio == nil)
		return;
	scr->pci = p;
	
	addvgaseg("3dfxmmio", p->mem[0].bar&~0x0F, p->mem[0].size);
	vgalinearpci(scr);
	if(scr->apsize)
		addvgaseg("3dfxscreen", scr->paddr, scr->apsize);

	/*
	 * Find a place for the cursor data in display memory.
	 * If SDRAM then there's 16MB memory else it's SGRAM
	 * and can count it based on the power-on straps -
	 * chip size can be 8Mb or 16Mb, and there can be 4 or
	 * 8 of them.
	 * Use the last 1KB of the framebuffer.
	 */
	mmio = (void*)((uchar*)scr->mmio+dramInit0);
	if(*(mmio+1) & 0x40000000)
		i = 16*1024*1024;
	else{
		if(*mmio & 0x08000000)
			i = 16*1024*1024/8;
		else
			i = 8*1024*1024/8;
		if(*mmio & 0x04000000)
			i *= 8;
		else
			i *= 4;
	}
	scr->storage = i - 1024;
}
示例#3
0
void
vgalinearpciid(VGAscr *scr, int vid, int did)
{
	Pcidev *p;

	p = nil;
	while((p = pcimatch(p, vid, 0)) != nil){
		if(p->ccrb != 3)	/* video card */
			continue;
		if(did != 0 && p->did != did)
			continue;
		break;
	}
	if(p == nil)
		error("pci video card not found");

	scr->pci = p;
	vgalinearpci(scr);
}