/* This is called when we receive an interrupt with apparently comes from this chip - check, returning the highest interrupt generated or return NO_IRQ  */
unsigned int gef_pic_get_irq(void)
/* This is called when we receive an interrupt with apparently comes from this chip - check, returning the highest interrupt generated or return NO_IRQ  */
unsigned int gef_pic_get_irq(void)
{
	u32 cause, mask, active;
	unsigned int virq = NO_IRQ;
	int hwirq;
	cause = in_be32(gef_pic_irq_reg_base + GEF_PIC_INTR_STATUS);
	mask = in_be32(gef_pic_irq_reg_base + GEF_PIC_INTR_MASK(0));
	active = cause & mask;
	if (active) {
		for (hwirq = GEF_PIC_NUM_IRQS - 1; hwirq > -1; hwirq--) {
			if (active & (0x1 << hwirq))
				break;
		}
		virq = irq_linear_revmap(gef_pic_irq_host,
			(irq_hw_number_t)hwirq);
	}
	return virq;
}