static void openpic_update_irq(openpic_t *opp, int n_IRQ)

{

    IRQ_src_t *src;

    int i;



    src = &opp->src[n_IRQ];



    if (!src->pending) {

        /* no irq pending */

        DPRINTF("%s: IRQ %d is not pending\n", __func__, n_IRQ);

        return;

    }

    if (test_bit(&src->ipvp, IPVP_MASK)) {

        /* Interrupt source is disabled */

        DPRINTF("%s: IRQ %d is disabled\n", __func__, n_IRQ);

        return;

    }

    if (IPVP_PRIORITY(src->ipvp) == 0) {

        /* Priority set to zero */

        DPRINTF("%s: IRQ %d has 0 priority\n", __func__, n_IRQ);

        return;

    }

    if (test_bit(&src->ipvp, IPVP_ACTIVITY)) {

        /* IRQ already active */

        DPRINTF("%s: IRQ %d is already active\n", __func__, n_IRQ);

        return;

    }

    if (src->ide == 0x00000000) {

        /* No target */

        DPRINTF("%s: IRQ %d has no target\n", __func__, n_IRQ);

        return;

    }



    if (src->ide == (1 << src->last_cpu)) {

        /* Only one CPU is allowed to receive this IRQ */

        IRQ_local_pipe(opp, src->last_cpu, n_IRQ);

    } else if (!test_bit(&src->ipvp, IPVP_MODE)) {

        /* Directed delivery mode */

        for (i = 0; i < opp->nb_cpus; i++) {

            if (test_bit(&src->ide, i))

                IRQ_local_pipe(opp, i, n_IRQ);

        }

    } else {

        /* Distributed delivery mode */

        for (i = src->last_cpu + 1; i != src->last_cpu; i++) {

            if (i == opp->nb_cpus)

                i = 0;

            if (test_bit(&src->ide, i)) {

                IRQ_local_pipe(opp, i, n_IRQ);

                src->last_cpu = i;

                break;

            }

        }

    }

}

static void openpic_update_irq(openpic_t *opp, int n_IRQ)

{

    IRQ_src_t *src;

    int i;



    src = &opp->src[n_IRQ];



    if (!src->pending) {

        

        DPRINTF("%s: IRQ %d is not pending\n", __func__, n_IRQ);

        return;

    }

    if (test_bit(&src->ipvp, IPVP_MASK)) {

        

        DPRINTF("%s: IRQ %d is disabled\n", __func__, n_IRQ);

        return;

    }

    if (IPVP_PRIORITY(src->ipvp) == 0) {

        

        DPRINTF("%s: IRQ %d has 0 priority\n", __func__, n_IRQ);

        return;

    }

    if (test_bit(&src->ipvp, IPVP_ACTIVITY)) {

        

        DPRINTF("%s: IRQ %d is already active\n", __func__, n_IRQ);

        return;

    }

    if (src->ide == 0x00000000) {

        

        DPRINTF("%s: IRQ %d has no target\n", __func__, n_IRQ);

        return;

    }



    if (src->ide == (1 << src->last_cpu)) {

        

        IRQ_local_pipe(opp, src->last_cpu, n_IRQ);

    } else if (!test_bit(&src->ipvp, IPVP_MODE)) {

        

        for (i = 0; i < opp->nb_cpus; i++) {

            if (test_bit(&src->ide, i))

                IRQ_local_pipe(opp, i, n_IRQ);

        }

    } else {

        

        for (i = src->last_cpu + 1; i != src->last_cpu; i++) {

            if (i == opp->nb_cpus)

                i = 0;

            if (test_bit(&src->ide, i)) {

                IRQ_local_pipe(opp, i, n_IRQ);

                src->last_cpu = i;

                break;

            }

        }

    }

}

static void FUNC_0(openpic_t *VAR_0, int VAR_1)

{

    IRQ_src_t *src;

    int VAR_2;



    src = &VAR_0->src[VAR_1];



    if (!src->pending) {

        

        DPRINTF("%s: IRQ %d is not pending\n", __func__, VAR_1);

        return;

    }

    if (test_bit(&src->ipvp, IPVP_MASK)) {

        

        DPRINTF("%s: IRQ %d is disabled\n", __func__, VAR_1);

        return;

    }

    if (IPVP_PRIORITY(src->ipvp) == 0) {

        

        DPRINTF("%s: IRQ %d has 0 priority\n", __func__, VAR_1);

        return;

    }

    if (test_bit(&src->ipvp, IPVP_ACTIVITY)) {

        

        DPRINTF("%s: IRQ %d is already active\n", __func__, VAR_1);

        return;

    }

    if (src->ide == 0x00000000) {

        

        DPRINTF("%s: IRQ %d has no target\n", __func__, VAR_1);

        return;

    }



    if (src->ide == (1 << src->last_cpu)) {

        

        IRQ_local_pipe(VAR_0, src->last_cpu, VAR_1);

    } else if (!test_bit(&src->ipvp, IPVP_MODE)) {

        

        for (VAR_2 = 0; VAR_2 < VAR_0->nb_cpus; VAR_2++) {

            if (test_bit(&src->ide, VAR_2))

                IRQ_local_pipe(VAR_0, VAR_2, VAR_1);

        }

    } else {

        

        for (VAR_2 = src->last_cpu + 1; VAR_2 != src->last_cpu; VAR_2++) {

            if (VAR_2 == VAR_0->nb_cpus)

                VAR_2 = 0;

            if (test_bit(&src->ide, VAR_2)) {

                IRQ_local_pipe(VAR_0, VAR_2, VAR_1);

                src->last_cpu = VAR_2;

                break;

            }

        }

    }

}

static void FUNC_0(openpic_t *VAR_0, int VAR_1)
{ IRQ_src_t *src; int VAR_2; src = &VAR_0->src[VAR_1]; if (!src->pending) { DPRINTF("%s: IRQ %d is not pending\n", __func__, VAR_1); return; } if (test_bit(&src->ipvp, IPVP_MASK)) { DPRINTF("%s: IRQ %d is disabled\n", __func__, VAR_1); return; } if (IPVP_PRIORITY(src->ipvp) == 0) { DPRINTF("%s: IRQ %d has 0 priority\n", __func__, VAR_1); return; } if (test_bit(&src->ipvp, IPVP_ACTIVITY)) { DPRINTF("%s: IRQ %d is already active\n", __func__, VAR_1); return; } if (src->ide == 0x00000000) { DPRINTF("%s: IRQ %d has no target\n", __func__, VAR_1); return; } if (src->ide == (1 << src->last_cpu)) { IRQ_local_pipe(VAR_0, src->last_cpu, VAR_1); } else if (!test_bit(&src->ipvp, IPVP_MODE)) { for (VAR_2 = 0; VAR_2 < VAR_0->nb_cpus; VAR_2++) { if (test_bit(&src->ide, VAR_2))
IRQ_local_pipe(VAR_0, VAR_2, VAR_1); } } else { for (VAR_2 = src->last_cpu + 1; VAR_2 != src->last_cpu; VAR_2++) { if (VAR_2 == VAR_0->nb_cpus)
VAR_2 = 0; if (test_bit(&src->ide, VAR_2)) { IRQ_local_pipe(VAR_0, VAR_2, VAR_1); src->last_cpu = VAR_2; break; } } } }