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

2000/0401/alphapc/arch164.c (diff list | history)

1999/0511/sys/src/9/alphapc/arch164.c:164,2632000/0401/sys/src/9/alphapc/arch164.c:164,189 (short | long | prev | next)
1999/0415    
	return kmapio(0x88, addr, len); 
} 
 
/* 
 *	interrupts -- adapted from PC, needs work. 
 */ 
                 
static Lock irqctllock; 
static Irqctl *irqctl[256]; 
static char irqmask[3]; 
                 
static void 
intr164(Ureg *ur) 
2000/0401    
static int 
intrenable164(Vctl *v) 
1999/0415    
{ 
	int i, v; 
	Irqctl *ctl; 
	Irq *irq; 
	Mach *mach; 
2000/0401    
	int vec, irq; 
1999/0415    
 
	v = (ulong)ur->a1>>4; 
	if (v < 0x80) { 
		iprint("unknown device intr v %d\n", v); 
		return; 
2000/0401    
	irq = v->irq; 
	if(irq > MaxIrqPIC) { 
		print("intrenable: irq %d out of range\n", v->irq); 
		return -1; 
1999/0415    
	} 
	v -= 0x80; 
	if(v < 256 && (ctl = irqctl[v])){ 
		if(ctl->isintr){ 
			m->intr++; 
			if(ctl->isr) 
				ctl->isr(v); 
/*				if(v >= VectorPIC && v <= MaxVectorPIC) 
				m->lastintr = v-VectorPIC; */ 
		} 
                 
		for(irq = ctl->irq; irq; irq = irq->next) 
			irq->f(ur, irq->a); 
                 
		if(ctl->eoi) 
			ctl->eoi(v); 
2000/0401    
	if(BUSTYPE(v->tbdf) == BusPCI) { 
		vec = irq+VectorPCI; 
		cserve(52, irq); 
1999/0415    
	} 
	else if(v >= VectorPIC && v <= MaxVectorPIC){ 
		/* 
		 * An unknown interrupt. 
		 * Check for a default IRQ7. This can happen when 
		 * the IRQ input goes away before the acknowledge. 
		 * In this case, a 'default IRQ7' is generated, but 
		 * the corresponding bit in the ISR isn't set. 
		 * In fact, just ignore all such interrupts. 
		 */ 
		iprint("cpu%d: spurious interrupt %d, last %d", 
			m->machno, v-VectorPIC, 0 /*m->lastintr*/); 
		for(i = 0; i < 32; i++){ 
			if(!(active.machs & (1<<i))) 
				continue; 
			mach = MACHP(i); 
			if(m->machno == mach->machno) 
				continue; 
			iprint(": cpu%d: last %d", mach->machno, 0 /*mach->lastintr*/); 
		} 
		iprint("\n"); 
/*			m->spuriousintr++; */ 
		return; 
	} 
	else{ 
		dumpregs(ur); 
		panic("unknown intr: %d\n", v); /* */ 
	} 
} 
                 
static int 
intrenable164(int v, void (*f)(Ureg*, void*), void*a, int tbdf) 
{ 
	Irq * irq; 
	Irqctl *ctl; 
                 
	lock(&irqctllock); 
	if(irqctl[v] == 0){ 
		ctl = xalloc(sizeof(Irqctl)); 
/* this is all wrong; FIXME! */ 
		if(BUSTYPE(tbdf) == BusPCI) 
			cserve(52, v-VectorPCI); 
		else if(v >= VectorPIC && i8259enable(v, tbdf, ctl) == -1){ 
			unlock(&irqctllock); 
			iprint("intrenable: didn't find v %d, tbdf 0x%uX\n", v, tbdf); 
			xfree(ctl); 
2000/0401    
	else { 
		vec = irq+VectorPIC; 
		if(i8259enable(irq, v->tbdf, v) == -1) 
1999/0415    
			return -1; 
		} 
		irqctl[v] = ctl; 
	} 
	ctl = irqctl[v]; 
	irq = xalloc(sizeof(Irq)); 
	irq->f = f; 
	irq->a = a; 
	irq->next = ctl->irq; 
	ctl->irq = irq; 
	unlock(&irqctllock); 
	return 0; 
2000/0401    
	return vec; 
1999/0415    
} 
 
/* 
1999/0511/sys/src/9/alphapc/arch164.c:405,4112000/0401/sys/src/9/alphapc/arch164.c:331,336
1999/0415    
	coredetach, 
	pcicfg2117x, 
	pcimem2117x, 
	intr164, 
	intrenable164, 
 
	inb2117x, 


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