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

1998/0508/pc/vgamach64xx.c (diff list | history)

1998/0507/sys/src/9/pc/vgamach64xx.c:12,181998/0508/sys/src/9/pc/vgamach64xx.c:12,18 (short | long | prev | next)
Add support for more cards.
rsc Fri Mar 4 12:44:25 2005
1998/0507    
#include "screen.h" 
 
/* 
 * ATI Mach64. 
1998/0508    
 * ATI Mach64(CT|ET|GP|GT|GU|VT|VU). 
1998/0507    
 */ 
static ushort mach64xxdid[] = { 
	('C'<<8)|'T', 
1998/0507/sys/src/9/pc/vgamach64xx.c:35,461998/0508/sys/src/9/pc/vgamach64xx.c:35,44
1998/0507    
		return nil; 
	for(did = mach64xxdid; *did; did++){ 
		if(*did == p->did) 
			break; 
1998/0508    
			return p; 
1998/0507    
	} 
	if(*did == 0) 
		return nil; 
 
	return p; 
1998/0508    
	return nil; 
1998/0507    
} 
 
static void 
1998/0507/sys/src/9/pc/vgamach64xx.c:53,601998/0508/sys/src/9/pc/vgamach64xx.c:51,67
1998/0507    
	 */ 
	if(scr->io) 
		return; 
	if(p = mach64xxpci()) 
		scr->io = p->mem[1].bar & ~0x01; 
1998/0508    
	if(p = mach64xxpci()){ 
		/* 
		 * The CT doesn't always have the I/O base address 
		 * in the PCI base registers. There is a way to find 
		 * it via the vendor-specific PCI config space but 
		 * this will do for now. 
		 */ 
		scr->io = p->mem[1].bar & ~0x03; 
		if(scr->io == 0 && p->did == ('C'<<8)|'T') 
			scr->io = 0x2EC; 
	} 
1998/0507    
} 
 
static ulong 
1998/0507/sys/src/9/pc/vgamach64xx.c:89,1141998/0508/sys/src/9/pc/vgamach64xx.c:96,137
1998/0507    
	return aperture; 
} 
 
enum {					/* I/O select */ 
	CurClr0		= 0x18, 
	CurClr1		= 0x19, 
	CurOffset	= 0x1a, 
	CurHVposn	= 0x1b, 
	CurHVoff	= 0x1c, 
1998/0508    
enum {					/* MM offset */ 
1998/0507    
 
	GenTestCntl	= 0x34, 
1998/0508    
	CurClr0		= 0x0B,		/* I/O Select */ 
	CurClr1		= 0x0C, 
	CurOffset	= 0x0D, 
	CurHVposn	= 0x0E, 
	CurHVoff	= 0x0F, 
 
	GenTestCntl	= 0x19, 
1998/0507    
}; 
 
1998/0508    
static uchar mmoffset[] = { 
	[CurClr0]	0x18, 
	[CurClr1]	0x19, 
	[CurOffset]	0x1a, 
	[CurHVposn]	0x1b, 
	[CurHVoff]	0x1c, 
 
	[GenTestCntl]	0x34, 
}; 
 
1998/0507    
static ulong 
ior32(VGAscr* scr, int r) 
{ 
	return inl((r<<2)+scr->io); 
1998/0508    
	if(scr->io == 0x2EC || scr->io == 0x1C8) 
		return inl((r<<10)+scr->io); 
	return inl((mmoffset[r]<<2)+scr->io); 
1998/0507    
} 
 
static void 
iow32(VGAscr* scr, int r, ulong l) 
{ 
	outl(((r)<<2)+scr->io, l); 
1998/0508    
	if(scr->io == 0x2EC || scr->io == 0x1C8) 
		outl(((r)<<10)+scr->io, l); 
	else 
		outl((mmoffset[r]<<2)+scr->io, l); 
1998/0507    
} 
 
static void 


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