Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
hpsim_irq.c
Go to the documentation of this file.
1 /*
2  * Platform dependent support for HP simulator.
3  *
4  * Copyright (C) 1998-2001 Hewlett-Packard Co
5  * Copyright (C) 1998-2001 David Mosberger-Tang <[email protected]>
6  */
7 
8 #include <linux/init.h>
9 #include <linux/kernel.h>
10 #include <linux/sched.h>
11 #include <linux/irq.h>
12 
13 #include "hpsim_ssc.h"
14 
15 static unsigned int
16 hpsim_irq_startup(struct irq_data *data)
17 {
18  return 0;
19 }
20 
21 static void
22 hpsim_irq_noop(struct irq_data *data)
23 {
24 }
25 
26 static int
27 hpsim_set_affinity_noop(struct irq_data *d, const struct cpumask *b, bool f)
28 {
29  return 0;
30 }
31 
32 static struct irq_chip irq_type_hp_sim = {
33  .name = "hpsim",
34  .irq_startup = hpsim_irq_startup,
35  .irq_shutdown = hpsim_irq_noop,
36  .irq_enable = hpsim_irq_noop,
37  .irq_disable = hpsim_irq_noop,
38  .irq_ack = hpsim_irq_noop,
39  .irq_set_affinity = hpsim_set_affinity_noop,
40 };
41 
42 static void hpsim_irq_set_chip(int irq)
43 {
44  struct irq_chip *chip = irq_get_chip(irq);
45 
46  if (chip == &no_irq_chip)
47  irq_set_chip(irq, &irq_type_hp_sim);
48 }
49 
50 static void hpsim_connect_irq(int intr, int irq)
51 {
52  ia64_ssc(intr, irq, 0, 0, SSC_CONNECT_INTERRUPT);
53 }
54 
56 {
57  int irq = assign_irq_vector(AUTO_ASSIGN);
58 
59  if (irq >= 0) {
60  hpsim_irq_set_chip(irq);
61  irq_set_handler(irq, handle_simple_irq);
62  hpsim_connect_irq(intr, irq);
63  }
64 
65  return irq;
66 }
67 
68 void __init
70 {
71  int i;
72 
73  for_each_active_irq(i)
74  hpsim_irq_set_chip(i);
75 }