Exemple #1
0
int xics_alloc(XICSState *icp, int src, int irq_hint, bool lsi, Error **errp)
{
    ICSState *ics = &icp->ics[src];
    int irq;

    if (irq_hint) {
        assert(src == xics_find_source(icp, irq_hint));
        if (!ICS_IRQ_FREE(ics, irq_hint - ics->offset)) {
            error_setg(errp, "can't allocate IRQ %d: already in use", irq_hint);
            return -1;
        }
        irq = irq_hint;
    } else {
        irq = ics_find_free_block(ics, 1, 1);
        if (irq < 0) {
            error_setg(errp, "can't allocate IRQ: no IRQ left");
            return -1;
        }
        irq += ics->offset;
    }

    ics_set_irq_type(ics, irq - ics->offset, lsi);
    trace_xics_alloc(src, irq);

    return irq;
}
Exemple #2
0
int xics_alloc(XICSState *icp, int src, int irq_hint, bool lsi)
{
    ICSState *ics = &icp->ics[src];
    int irq;

    if (irq_hint) {
        assert(src == xics_find_source(icp, irq_hint));
        if (!ICS_IRQ_FREE(ics, irq_hint - ics->offset)) {
            trace_xics_alloc_failed_hint(src, irq_hint);
            return -1;
        }
        irq = irq_hint;
    } else {
        irq = ics_find_free_block(ics, 1, 1);
        if (irq < 0) {
            trace_xics_alloc_failed_no_left(src);
            return -1;
        }
        irq += ics->offset;
    }

    ics_set_irq_type(ics, irq - ics->offset, lsi);
    trace_xics_alloc(src, irq);

    return irq;
}
Exemple #3
0
void xics_set_irq_type(XICSState *icp, int irq, bool lsi)
{
    int src = xics_find_source(icp, irq);
    ICSState *ics;

    assert(src >= 0);

    ics = &icp->ics[src];
    ics_set_irq_type(ics, irq - ics->offset, lsi);
}
Exemple #4
0
qemu_irq xics_get_qirq(XICSState *icp, int irq)
{
    int src = xics_find_source(icp, irq);

    if (src >= 0) {
        ICSState *ics = &icp->ics[src];
        return ics->qirqs[irq - ics->offset];
    }

    return NULL;
}
Exemple #5
0
void xics_free(XICSState *icp, int irq, int num)
{
    int src = xics_find_source(icp, irq);

    if (src >= 0) {
        ICSState *ics = &icp->ics[src];

        /* FIXME: implement multiple sources */
        assert(src == 0);

        trace_xics_ics_free(ics - icp->ics, irq, num);
        ics_free(ics, irq - ics->offset, num);
    }
}