Subversion Repositories HelenOS

Rev

Rev 3386 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 3386 Rev 4153
Line 65... Line 65...
65
 * @param n Ignored.
65
 * @param n Ignored.
66
 * @param istate Ignored.
66
 * @param istate Ignored.
67
 */
67
 */
68
void interrupt(int n, istate_t *istate)
68
void interrupt(int n, istate_t *istate)
69
{
69
{
-
 
70
    uint64_t status;
70
    uint64_t intrcv;
71
    uint64_t intrcv;
71
    uint64_t data0;
72
    uint64_t data0;
-
 
73
    status = asi_u64_read(ASI_INTR_DISPATCH_STATUS, 0);
-
 
74
    if (status & (!INTR_DISPATCH_STATUS_BUSY))
-
 
75
        panic("Interrupt Dispatch Status busy bit not set.");
72
 
76
 
73
    intrcv = asi_u64_read(ASI_INTR_RECEIVE, 0);
77
    intrcv = asi_u64_read(ASI_INTR_RECEIVE, 0);
-
 
78
#if defined (US)
74
    data0 = asi_u64_read(ASI_UDB_INTR_R, ASI_UDB_INTR_R_DATA_0);
79
    data0 = asi_u64_read(ASI_INTR_R, ASI_UDB_INTR_R_DATA_0);
-
 
80
#elif defined (US3)
-
 
81
    data0 = asi_u64_read(ASI_INTR_R, VA_INTR_R_DATA_0);
-
 
82
#endif
75
 
83
 
76
    irq_t *irq = irq_dispatch_and_lock(data0);
84
    irq_t *irq = irq_dispatch_and_lock(data0);
77
    if (irq) {
85
    if (irq) {
78
        /*
86
        /*
79
         * The IRQ handler was found.
87
         * The IRQ handler was found.
80
         */
88
         */
81
        irq->handler(irq, irq->arg);
89
        irq->handler(irq);
-
 
90
        /*
-
 
91
         * See if there is a clear-interrupt-routine and call it.
-
 
92
         */
-
 
93
        if (irq->cir) {
-
 
94
            irq->cir(irq->cir_arg, irq->inr);
-
 
95
        }
82
        spinlock_unlock(&irq->lock);
96
        spinlock_unlock(&irq->lock);
83
    } else if (data0 > config.base) {
97
    } else if (data0 > config.base) {
84
        /*
98
        /*
85
         * This is a cross-call.
99
         * This is a cross-call.
86
         * data0 contains address of the kernel function.
100
         * data0 contains address of the kernel function.
Line 96... Line 110...
96
        /*
110
        /*
97
         * Spurious interrupt.
111
         * Spurious interrupt.
98
         */
112
         */
99
#ifdef CONFIG_DEBUG
113
#ifdef CONFIG_DEBUG
100
        printf("cpu%u: spurious interrupt (intrcv=%#" PRIx64
114
        printf("cpu%u: spurious interrupt (intrcv=%#" PRIx64
101
            ", data0=%#" PRIx64 ")\n", CPU->id, intrcv, data0);
115
            ", data0=%#" PRIx64 ")\n", CPU->id, intrcv, data0);
102
#endif
116
#endif
103
    }
117
    }
104
 
118
 
105
    membar();
119
    membar();
106
    asi_u64_write(ASI_INTR_RECEIVE, 0, 0);
120
    asi_u64_write(ASI_INTR_RECEIVE, 0, 0);