plan 9 kernel history: overview | file list | diff list

2000/0612/pc/vgas3.c (diff list | history)

2000/0611/sys/src/9/pc/vgas3.c:64,712000/0612/sys/src/9/pc/vgas3.c:64,72 (short | long | prev | next)
1997/1101    
static ulong 
s3linear(VGAscr* scr, int* size, int* align) 
{ 
1999/1005    
	ulong aperture, oaperture; 
2000/0611    
	int i, osize, oapsize, wasupamem; 
2000/0612    
	char *mmioname; 
	ulong aperture, oaperture, mmiobase, mmiosize; 
	int i, id, j, osize, oapsize, wasupamem; 
1997/1101    
	Pcidev *p; 
1999/0716    
	Physseg seg; 
1997/1101    
 
2000/0611/sys/src/9/pc/vgas3.c:74,792000/0612/sys/src/9/pc/vgas3.c:75,83
1997/1101    
	oapsize = scr->apsize; 
	wasupamem = scr->isupamem; 
 
2000/0612    
	mmiosize = 0; 
	mmiobase = 0; 
	mmioname = nil; 
1997/1101    
	if(p = pcimatch(nil, 0x5333, 0)){ 
2000/0611    
		for(i=0; i<nelem(p->mem); i++){ 
			if(p->mem[i].size >= *size 
2000/0611/sys/src/9/pc/vgas3.c:86,912000/0612/sys/src/9/pc/vgas3.c:90,122
2000/0611    
		} 
		aperture = p->mem[i].bar & ~0x0F; 
		*size = p->mem[i].size; 
2000/0612    
 
		id = (vgaxi(Crtx, 0x30)<<8)|vgaxi(Crtx, 0x2E); 
		if(id == 0xE122){		/* find Savage4 mmio */ 
			/* 
			 * We could assume that the MMIO registers 
			 * will be in the screen segment and just use 
			 * that, but PCI software is allowed to move them 
			 * if it feels like it, so we look for an aperture of 
			 * the right size; only the first 512k actually means 
			 * anything.  The S3 engineers overestimated how 
			 * much space they would need in the first design. 
			 */ 
			for(j=0; j<nelem(p->mem); j++){ 
				if(i == j) 
					continue; 
				if(p->mem[j].size==512*1024 || p->mem[j].size==16*1024*1024){ 
					mmiobase = p->mem[j].bar & ~0x0F; 
					mmiosize = 512*1024; 
					mmioname = "savage4mmio"; 
					break; 
				} 
			} 
			if(mmiosize == 0){ 
				print("savage4: mmio not found\n"); 
				return 0; 
			} 
		} 
2000/0611    
	}else 
1997/1101    
		aperture = 0; 
 
2000/0611/sys/src/9/pc/vgas3.c:111,1162000/0612/sys/src/9/pc/vgas3.c:142,156
1999/0716    
	seg.size = osize; 
	addphysseg(&seg); 
1999/1005    
 
2000/0612    
	if(mmiosize){ 
		memset(&seg, 0, sizeof(seg)); 
		seg.attr = SG_PHYSICAL; 
		seg.name = smalloc(NAMELEN); 
		snprint(seg.name, NAMELEN, mmioname); 
		seg.pa = mmiobase; 
		seg.size = mmiosize; 
		addphysseg(&seg); 
	} 
1997/1101    
	return aperture; 
} 
 
2000/0611/sys/src/9/pc/vgas3.c:166,1722000/0612/sys/src/9/pc/vgas3.c:206,212
1994/0803    
	 * Must be on a 1024-byte boundary. 
	 */ 
1997/1101    
	storage = (scr->gscreen->width*BY2WD*scr->gscreen->r.max.y+1023)/1024; 
1994/0803    
	vgaxo(Crtx, 0x4C, (storage>>8) & 0x0F); 
2000/0612    
	vgaxo(Crtx, 0x4C, storage>>8); 
1994/0803    
	vgaxo(Crtx, 0x4D, storage & 0xFF); 
	storage *= 1024; 
1997/1101    
	scr->storage = storage; 
2000/0611/sys/src/9/pc/vgas3.c:325,3302000/0612/sys/src/9/pc/vgas3.c:365,373
1999/1005    
	ulong linear; 
	ulong fifo; 
	ulong idle; 
2000/0612    
	ulong lineartimeout; 
	ulong fifotimeout; 
	ulong idletimeout; 
1999/1005    
} waitcount; 
 
static void 
2000/0611/sys/src/9/pc/vgas3.c:352,3572000/0612/sys/src/9/pc/vgas3.c:395,402
1999/1005    
	x = 0; 
	while((mmio[FifoStat]&mask) != val && x++ < Maxloop) 
		waitcount.linear++; 
2000/0612    
	if(x >= Maxloop) 
		waitcount.lineartimeout++; 
1999/1005    
} 
 
static void 
2000/0611/sys/src/9/pc/vgas3.c:365,3702000/0612/sys/src/9/pc/vgas3.c:410,417
1999/1005    
	x = 0; 
	while((mmio[SubStat]&0x1F00) < ((entries+2)<<8) && x++ < Maxloop) 
		waitcount.fifo++; 
2000/0612    
	if(x >= Maxloop) 
		waitcount.fifotimeout++; 
1999/1005    
} 
 
static void 
2000/0611/sys/src/9/pc/vgas3.c:377,3822000/0612/sys/src/9/pc/vgas3.c:424,431
1999/1005    
	x = 0; 
	while((mmio[SubStat]&0x3F00) != 0x3000 && x++ < Maxloop) 
		waitcount.idle++; 
2000/0612    
	if(x >= Maxloop) 
		waitcount.idletimeout++; 
1999/1005    
} 
 
static int 


source code copyright © 1990-2005 Lucent Technologies; see license
Plan 9 distribution
comments to russ cox (rsc@swtch.com)