/* So a Legacy PA I/O device on a PA 2.0 box can't use all the bits supported by the processor...and the N/L-class I/O subsystem supports more bits than PA2.0 has. The first case is the problem.  */
int txn_alloc_irq(unsigned int bits_wide)
/* So a Legacy PA I/O device on a PA 2.0 box can't use all the bits supported by the processor...and the N/L-class I/O subsystem supports more bits than PA2.0 has. The first case is the problem.  */
int txn_alloc_irq(unsigned int bits_wide)
{
	int irq;
	for (irq = CPU_IRQ_BASE + 1; irq <= CPU_IRQ_MAX; irq++) {
		if (cpu_claim_irq(irq, NULL, NULL) < 0)
			continue;
		if ((irq - CPU_IRQ_BASE) >= (1 << bits_wide))
			continue;
		return irq;
	}
	return -1;
}