source: mainline/kernel/arch/sparc64/src/trap/sun4u/interrupt.c

Last change on this file was c5429fe, checked in by Jakub Jermar <jakub@…>, 7 years ago

Disambiguate architecture specific doxygroups

  • Property mode set to 100644
File size: 3.2 KB
RevLine 
[95c4776]1/*
2 * Copyright (c) 2005 Jakub Jermar
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 *
9 * - Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 * - Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the distribution.
14 * - The name of the author may not be used to endorse or promote products
15 * derived from this software without specific prior written permission.
16 *
17 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
18 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
19 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
20 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
21 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
22 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 */
28
[c5429fe]29/** @addtogroup kernel_sparc64_interrupt
[95c4776]30 * @{
31 */
32/** @file
33 */
34
[7328ff4]35#include <arch/barrier.h>
[95c4776]36#include <arch/interrupt.h>
37#include <arch/sparc64.h>
38#include <arch/trap/interrupt.h>
39#include <interrupt.h>
40#include <ddi/irq.h>
[83dab11]41#include <stdint.h>
[95c4776]42#include <debug.h>
43#include <arch/asm.h>
[05882233]44#include <barrier.h>
[b2fa1204]45#include <log.h>
[95c4776]46#include <arch.h>
47#include <mm/tlb.h>
48#include <config.h>
49#include <synch/spinlock.h>
50
51/** Process hardware interrupt.
52 *
53 * @param n Ignored.
54 * @param istate Ignored.
55 */
[ec443d5]56void interrupt(unsigned int n, istate_t *istate)
[95c4776]57{
[da1bafb]58 uint64_t status = asi_u64_read(ASI_INTR_DISPATCH_STATUS, 0);
[95c4776]59 if (status & (!INTR_DISPATCH_STATUS_BUSY))
60 panic("Interrupt Dispatch Status busy bit not set\n");
[a35b458]61
[da1bafb]62 uint64_t intrcv = asi_u64_read(ASI_INTR_RECEIVE, 0);
[95c4776]63#if defined (US)
[da1bafb]64 uint64_t data0 = asi_u64_read(ASI_INTR_R, ASI_UDB_INTR_R_DATA_0);
[95c4776]65#elif defined (US3)
[da1bafb]66 uint64_t data0 = asi_u64_read(ASI_INTR_R, VA_INTR_R_DATA_0);
[95c4776]67#endif
[a35b458]68
[95c4776]69 irq_t *irq = irq_dispatch_and_lock(data0);
70 if (irq) {
71 /*
72 * The IRQ handler was found.
73 */
74 irq->handler(irq);
[a35b458]75
[95c4776]76 /*
77 * See if there is a clear-interrupt-routine and call it.
78 */
[da1bafb]79 if (irq->cir)
[95c4776]80 irq->cir(irq->cir_arg, irq->inr);
[a35b458]81
[da1bafb]82 irq_spinlock_unlock(&irq->lock, false);
[95c4776]83 } else if (data0 > config.base) {
84 /*
85 * This is a cross-call.
86 * data0 contains address of the kernel function.
87 * We call the function only after we verify
88 * it is one of the supported ones.
89 */
90#ifdef CONFIG_SMP
[da1bafb]91 if (data0 == (uintptr_t) tlb_shootdown_ipi_recv)
[95c4776]92 tlb_shootdown_ipi_recv();
93#endif
94 } else {
95 /*
96 * Spurious interrupt.
97 */
98#ifdef CONFIG_DEBUG
[b2fa1204]99 log(LF_ARCH, LVL_DEBUG,
100 "cpu%u: spurious interrupt (intrcv=%#" PRIx64 ", data0=%#"
101 PRIx64 ")", CPU->id, intrcv, data0);
[da1bafb]102#else
103 (void) intrcv;
[95c4776]104#endif
105 }
[a35b458]106
[95c4776]107 membar();
108 asi_u64_write(ASI_INTR_RECEIVE, 0, 0);
109}
110
111/** @}
112 */
Note: See TracBrowser for help on using the repository browser.