summaryrefslogtreecommitdiffstats
path: root/arch/ia64/kernel/irq_internal.c
blob: cc59e0c7227d1a6be88b549088db8ff7484b3806 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
/*
 * Internal Interrupt Vectors 
 *
 * This takes care of interrupts that are generated by the CPU
 * internally, such as the ITC and IPI interrupts.
 *
 * Copyright (C) 1999 VA Linux Systems
 * Copyright (C) 1999 Walt Drummond <drummond@valinux.com>
 */

#include <linux/kernel.h>
#include <linux/sched.h>

#include <asm/irq.h>
#include <asm/processor.h>
#include <asm/ptrace.h>

/*
 * This is identical to IOSAPIC handle_irq.  It may go away . . .
 */
static int
internal_handle_irq (unsigned int irq, struct pt_regs *regs)
{
	struct irqaction *action = 0;
	struct irq_desc *id = irq_desc + irq;
	unsigned int status;
	int retval;

	spin_lock(&irq_controller_lock);
	{
		status = id->status;
		if ((status & IRQ_ENABLED) != 0)
			action = id->action;
		id->status = status & ~(IRQ_REPLAY | IRQ_WAITING);
	}
	spin_unlock(&irq_controller_lock);

	if (!action) {
		if (!(id->status & IRQ_AUTODETECT))
			printk("irq_hpsim_handle_irq: unexpected interrupt %u\n", irq);
		return 0;
	}

	retval = invoke_irq_handlers(irq, regs, action);

	spin_lock(&irq_controller_lock);
	{
		status = (id->status & ~IRQ_INPROGRESS);
		id->status = status;
	}
	spin_unlock(&irq_controller_lock);

	return retval;
}

static void
internal_noop (unsigned int irq)
{
	/* nuthing to do... */
}

struct hw_interrupt_type irq_type_ia64_internal = {
	"IA64-internal",
	(void (*)(unsigned long)) internal_noop,	/* init */
	internal_noop,					/* startup */
	internal_noop,					/* shutdown */
	internal_handle_irq,				/* handle */
	internal_noop,					/* enable */
	internal_noop					/* disable */
};