interrupt.h 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639
  1. /* interrupt.h */
  2. #ifndef _LINUX_INTERRUPT_H
  3. #define _LINUX_INTERRUPT_H
  4. #include <linux/kernel.h>
  5. #include <linux/linkage.h>
  6. #include <linux/bitops.h>
  7. #include <linux/preempt.h>
  8. #include <linux/cpumask.h>
  9. #include <linux/irqreturn.h>
  10. #include <linux/irqnr.h>
  11. #include <linux/hardirq.h>
  12. #include <linux/irqflags.h>
  13. #include <linux/smp.h>
  14. #include <linux/percpu.h>
  15. #include <linux/hrtimer.h>
  16. #include <asm/atomic.h>
  17. #include <asm/ptrace.h>
  18. #include <asm/system.h>
  19. /*
  20. * These correspond to the IORESOURCE_IRQ_* defines in
  21. * linux/ioport.h to select the interrupt line behaviour. When
  22. * requesting an interrupt without specifying a IRQF_TRIGGER, the
  23. * setting should be assumed to be "as already configured", which
  24. * may be as per machine or firmware initialisation.
  25. */
  26. #define IRQF_TRIGGER_NONE 0x00000000
  27. #define IRQF_TRIGGER_RISING 0x00000001
  28. #define IRQF_TRIGGER_FALLING 0x00000002
  29. #define IRQF_TRIGGER_HIGH 0x00000004
  30. #define IRQF_TRIGGER_LOW 0x00000008
  31. #define IRQF_TRIGGER_MASK (IRQF_TRIGGER_HIGH | IRQF_TRIGGER_LOW | \
  32. IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING)
  33. #define IRQF_TRIGGER_PROBE 0x00000010
  34. /*
  35. * These flags used only by the kernel as part of the
  36. * irq handling routines.
  37. *
  38. * IRQF_DISABLED - keep irqs disabled when calling the action handler
  39. * IRQF_SAMPLE_RANDOM - irq is used to feed the random generator
  40. * IRQF_SHARED - allow sharing the irq among several devices
  41. * IRQF_PROBE_SHARED - set by callers when they expect sharing mismatches to occur
  42. * IRQF_TIMER - Flag to mark this interrupt as timer interrupt
  43. * IRQF_PERCPU - Interrupt is per cpu
  44. * IRQF_NOBALANCING - Flag to exclude this interrupt from irq balancing
  45. * IRQF_IRQPOLL - Interrupt is used for polling (only the interrupt that is
  46. * registered first in an shared interrupt is considered for
  47. * performance reasons)
  48. * IRQF_ONESHOT - Interrupt is not reenabled after the hardirq handler finished.
  49. * Used by threaded interrupts which need to keep the
  50. * irq line disabled until the threaded handler has been run.
  51. */
  52. #define IRQF_DISABLED 0x00000020
  53. #define IRQF_SAMPLE_RANDOM 0x00000040
  54. #define IRQF_SHARED 0x00000080
  55. #define IRQF_PROBE_SHARED 0x00000100
  56. #define IRQF_TIMER 0x00000200
  57. #define IRQF_PERCPU 0x00000400
  58. #define IRQF_NOBALANCING 0x00000800
  59. #define IRQF_IRQPOLL 0x00001000
  60. #define IRQF_ONESHOT 0x00002000
  61. /*
  62. * Bits used by threaded handlers:
  63. * IRQTF_RUNTHREAD - signals that the interrupt handler thread should run
  64. * IRQTF_DIED - handler thread died
  65. * IRQTF_WARNED - warning "IRQ_WAKE_THREAD w/o thread_fn" has been printed
  66. * IRQTF_AFFINITY - irq thread is requested to adjust affinity
  67. */
  68. enum {
  69. IRQTF_RUNTHREAD,
  70. IRQTF_DIED,
  71. IRQTF_WARNED,
  72. IRQTF_AFFINITY,
  73. };
  74. /**
  75. * These values can be returned by request_any_context_irq() and
  76. * describe the context the interrupt will be run in.
  77. *
  78. * IRQC_IS_HARDIRQ - interrupt runs in hardirq context
  79. * IRQC_IS_NESTED - interrupt runs in a nested threaded context
  80. */
  81. enum {
  82. IRQC_IS_HARDIRQ = 0,
  83. IRQC_IS_NESTED,
  84. };
  85. typedef irqreturn_t (*irq_handler_t)(int, void *);
  86. /**
  87. * struct irqaction - per interrupt action descriptor
  88. * @handler: interrupt handler function
  89. * @flags: flags (see IRQF_* above)
  90. * @name: name of the device
  91. * @dev_id: cookie to identify the device
  92. * @next: pointer to the next irqaction for shared interrupts
  93. * @irq: interrupt number
  94. * @dir: pointer to the proc/irq/NN/name entry
  95. * @thread_fn: interupt handler function for threaded interrupts
  96. * @thread: thread pointer for threaded interrupts
  97. * @thread_flags: flags related to @thread
  98. */
  99. struct irqaction {
  100. irq_handler_t handler;
  101. unsigned long flags;
  102. const char *name;
  103. void *dev_id;
  104. struct irqaction *next;
  105. int irq;
  106. struct proc_dir_entry *dir;
  107. irq_handler_t thread_fn;
  108. struct task_struct *thread;
  109. unsigned long thread_flags;
  110. };
  111. extern irqreturn_t no_action(int cpl, void *dev_id);
  112. #ifdef CONFIG_GENERIC_HARDIRQS
  113. extern int __must_check
  114. request_threaded_irq(unsigned int irq, irq_handler_t handler,
  115. irq_handler_t thread_fn,
  116. unsigned long flags, const char *name, void *dev);
  117. static inline int __must_check
  118. request_irq(unsigned int irq, irq_handler_t handler, unsigned long flags,
  119. const char *name, void *dev)
  120. {
  121. return request_threaded_irq(irq, handler, NULL, flags, name, dev);
  122. }
  123. extern int __must_check
  124. request_any_context_irq(unsigned int irq, irq_handler_t handler,
  125. unsigned long flags, const char *name, void *dev_id);
  126. extern void exit_irq_thread(void);
  127. #else
  128. extern int __must_check
  129. request_irq(unsigned int irq, irq_handler_t handler, unsigned long flags,
  130. const char *name, void *dev);
  131. /*
  132. * Special function to avoid ifdeffery in kernel/irq/devres.c which
  133. * gets magically built by GENERIC_HARDIRQS=n architectures (sparc,
  134. * m68k). I really love these $@%#!* obvious Makefile references:
  135. * ../../../kernel/irq/devres.o
  136. */
  137. static inline int __must_check
  138. request_threaded_irq(unsigned int irq, irq_handler_t handler,
  139. irq_handler_t thread_fn,
  140. unsigned long flags, const char *name, void *dev)
  141. {
  142. return request_irq(irq, handler, flags, name, dev);
  143. }
  144. static inline int __must_check
  145. request_any_context_irq(unsigned int irq, irq_handler_t handler,
  146. unsigned long flags, const char *name, void *dev_id)
  147. {
  148. return request_irq(irq, handler, flags, name, dev_id);
  149. }
  150. static inline void exit_irq_thread(void) { }
  151. #endif
  152. extern void free_irq(unsigned int, void *);
  153. struct device;
  154. extern int __must_check
  155. devm_request_threaded_irq(struct device *dev, unsigned int irq,
  156. irq_handler_t handler, irq_handler_t thread_fn,
  157. unsigned long irqflags, const char *devname,
  158. void *dev_id);
  159. static inline int __must_check
  160. devm_request_irq(struct device *dev, unsigned int irq, irq_handler_t handler,
  161. unsigned long irqflags, const char *devname, void *dev_id)
  162. {
  163. return devm_request_threaded_irq(dev, irq, handler, NULL, irqflags,
  164. devname, dev_id);
  165. }
  166. extern void devm_free_irq(struct device *dev, unsigned int irq, void *dev_id);
  167. /*
  168. * On lockdep we dont want to enable hardirqs in hardirq
  169. * context. Use local_irq_enable_in_hardirq() to annotate
  170. * kernel code that has to do this nevertheless (pretty much
  171. * the only valid case is for old/broken hardware that is
  172. * insanely slow).
  173. *
  174. * NOTE: in theory this might break fragile code that relies
  175. * on hardirq delivery - in practice we dont seem to have such
  176. * places left. So the only effect should be slightly increased
  177. * irqs-off latencies.
  178. */
  179. #ifdef CONFIG_LOCKDEP
  180. # define local_irq_enable_in_hardirq() do { } while (0)
  181. #else
  182. # define local_irq_enable_in_hardirq() local_irq_enable()
  183. #endif
  184. extern void disable_irq_nosync(unsigned int irq);
  185. extern void disable_irq(unsigned int irq);
  186. extern void enable_irq(unsigned int irq);
  187. /* The following three functions are for the core kernel use only. */
  188. #ifdef CONFIG_GENERIC_HARDIRQS
  189. extern void suspend_device_irqs(void);
  190. extern void resume_device_irqs(void);
  191. #ifdef CONFIG_PM_SLEEP
  192. extern int check_wakeup_irqs(void);
  193. #else
  194. static inline int check_wakeup_irqs(void) { return 0; }
  195. #endif
  196. #else
  197. static inline void suspend_device_irqs(void) { };
  198. static inline void resume_device_irqs(void) { };
  199. static inline int check_wakeup_irqs(void) { return 0; }
  200. #endif
  201. #if defined(CONFIG_SMP) && defined(CONFIG_GENERIC_HARDIRQS)
  202. extern cpumask_var_t irq_default_affinity;
  203. extern int irq_set_affinity(unsigned int irq, const struct cpumask *cpumask);
  204. extern int irq_can_set_affinity(unsigned int irq);
  205. extern int irq_select_affinity(unsigned int irq);
  206. #else /* CONFIG_SMP */
  207. static inline int irq_set_affinity(unsigned int irq, const struct cpumask *m)
  208. {
  209. return -EINVAL;
  210. }
  211. static inline int irq_can_set_affinity(unsigned int irq)
  212. {
  213. return 0;
  214. }
  215. static inline int irq_select_affinity(unsigned int irq) { return 0; }
  216. #endif /* CONFIG_SMP && CONFIG_GENERIC_HARDIRQS */
  217. #ifdef CONFIG_GENERIC_HARDIRQS
  218. /*
  219. * Special lockdep variants of irq disabling/enabling.
  220. * These should be used for locking constructs that
  221. * know that a particular irq context which is disabled,
  222. * and which is the only irq-context user of a lock,
  223. * that it's safe to take the lock in the irq-disabled
  224. * section without disabling hardirqs.
  225. *
  226. * On !CONFIG_LOCKDEP they are equivalent to the normal
  227. * irq disable/enable methods.
  228. */
  229. static inline void disable_irq_nosync_lockdep(unsigned int irq)
  230. {
  231. disable_irq_nosync(irq);
  232. #ifdef CONFIG_LOCKDEP
  233. local_irq_disable();
  234. #endif
  235. }
  236. static inline void disable_irq_nosync_lockdep_irqsave(unsigned int irq, unsigned long *flags)
  237. {
  238. disable_irq_nosync(irq);
  239. #ifdef CONFIG_LOCKDEP
  240. local_irq_save(*flags);
  241. #endif
  242. }
  243. static inline void disable_irq_lockdep(unsigned int irq)
  244. {
  245. disable_irq(irq);
  246. #ifdef CONFIG_LOCKDEP
  247. local_irq_disable();
  248. #endif
  249. }
  250. static inline void enable_irq_lockdep(unsigned int irq)
  251. {
  252. #ifdef CONFIG_LOCKDEP
  253. local_irq_enable();
  254. #endif
  255. enable_irq(irq);
  256. }
  257. static inline void enable_irq_lockdep_irqrestore(unsigned int irq, unsigned long *flags)
  258. {
  259. #ifdef CONFIG_LOCKDEP
  260. local_irq_restore(*flags);
  261. #endif
  262. enable_irq(irq);
  263. }
  264. /* IRQ wakeup (PM) control: */
  265. extern int set_irq_wake(unsigned int irq, unsigned int on);
  266. static inline int enable_irq_wake(unsigned int irq)
  267. {
  268. return set_irq_wake(irq, 1);
  269. }
  270. static inline int disable_irq_wake(unsigned int irq)
  271. {
  272. return set_irq_wake(irq, 0);
  273. }
  274. #else /* !CONFIG_GENERIC_HARDIRQS */
  275. /*
  276. * NOTE: non-genirq architectures, if they want to support the lock
  277. * validator need to define the methods below in their asm/irq.h
  278. * files, under an #ifdef CONFIG_LOCKDEP section.
  279. */
  280. #ifndef CONFIG_LOCKDEP
  281. # define disable_irq_nosync_lockdep(irq) disable_irq_nosync(irq)
  282. # define disable_irq_nosync_lockdep_irqsave(irq, flags) \
  283. disable_irq_nosync(irq)
  284. # define disable_irq_lockdep(irq) disable_irq(irq)
  285. # define enable_irq_lockdep(irq) enable_irq(irq)
  286. # define enable_irq_lockdep_irqrestore(irq, flags) \
  287. enable_irq(irq)
  288. # endif
  289. static inline int enable_irq_wake(unsigned int irq)
  290. {
  291. return 0;
  292. }
  293. static inline int disable_irq_wake(unsigned int irq)
  294. {
  295. return 0;
  296. }
  297. #endif /* CONFIG_GENERIC_HARDIRQS */
  298. #ifndef __ARCH_SET_SOFTIRQ_PENDING
  299. #define set_softirq_pending(x) (local_softirq_pending() = (x))
  300. #define or_softirq_pending(x) (local_softirq_pending() |= (x))
  301. #endif
  302. /* Some architectures might implement lazy enabling/disabling of
  303. * interrupts. In some cases, such as stop_machine, we might want
  304. * to ensure that after a local_irq_disable(), interrupts have
  305. * really been disabled in hardware. Such architectures need to
  306. * implement the following hook.
  307. */
  308. #ifndef hard_irq_disable
  309. #define hard_irq_disable() do { } while(0)
  310. #endif
  311. /* PLEASE, avoid to allocate new softirqs, if you need not _really_ high
  312. frequency threaded job scheduling. For almost all the purposes
  313. tasklets are more than enough. F.e. all serial device BHs et
  314. al. should be converted to tasklets, not to softirqs.
  315. */
  316. enum
  317. {
  318. HI_SOFTIRQ=0,
  319. TIMER_SOFTIRQ,
  320. NET_TX_SOFTIRQ,
  321. NET_RX_SOFTIRQ,
  322. BLOCK_SOFTIRQ,
  323. BLOCK_IOPOLL_SOFTIRQ,
  324. TASKLET_SOFTIRQ,
  325. SCHED_SOFTIRQ,
  326. HRTIMER_SOFTIRQ,
  327. RCU_SOFTIRQ, /* Preferable RCU should always be the last softirq */
  328. NR_SOFTIRQS
  329. };
  330. /* map softirq index to softirq name. update 'softirq_to_name' in
  331. * kernel/softirq.c when adding a new softirq.
  332. */
  333. extern char *softirq_to_name[NR_SOFTIRQS];
  334. /* softirq mask and active fields moved to irq_cpustat_t in
  335. * asm/hardirq.h to get better cache usage. KAO
  336. */
  337. struct softirq_action
  338. {
  339. void (*action)(struct softirq_action *);
  340. };
  341. asmlinkage void do_softirq(void);
  342. asmlinkage void __do_softirq(void);
  343. extern void open_softirq(int nr, void (*action)(struct softirq_action *));
  344. extern void softirq_init(void);
  345. #define __raise_softirq_irqoff(nr) do { or_softirq_pending(1UL << (nr)); } while (0)
  346. extern void raise_softirq_irqoff(unsigned int nr);
  347. extern void raise_softirq(unsigned int nr);
  348. extern void wakeup_softirqd(void);
  349. /* This is the worklist that queues up per-cpu softirq work.
  350. *
  351. * send_remote_sendirq() adds work to these lists, and
  352. * the softirq handler itself dequeues from them. The queues
  353. * are protected by disabling local cpu interrupts and they must
  354. * only be accessed by the local cpu that they are for.
  355. */
  356. DECLARE_PER_CPU(struct list_head [NR_SOFTIRQS], softirq_work_list);
  357. /* Try to send a softirq to a remote cpu. If this cannot be done, the
  358. * work will be queued to the local cpu.
  359. */
  360. extern void send_remote_softirq(struct call_single_data *cp, int cpu, int softirq);
  361. /* Like send_remote_softirq(), but the caller must disable local cpu interrupts
  362. * and compute the current cpu, passed in as 'this_cpu'.
  363. */
  364. extern void __send_remote_softirq(struct call_single_data *cp, int cpu,
  365. int this_cpu, int softirq);
  366. /* Tasklets --- multithreaded analogue of BHs.
  367. Main feature differing them of generic softirqs: tasklet
  368. is running only on one CPU simultaneously.
  369. Main feature differing them of BHs: different tasklets
  370. may be run simultaneously on different CPUs.
  371. Properties:
  372. * If tasklet_schedule() is called, then tasklet is guaranteed
  373. to be executed on some cpu at least once after this.
  374. * If the tasklet is already scheduled, but its excecution is still not
  375. started, it will be executed only once.
  376. * If this tasklet is already running on another CPU (or schedule is called
  377. from tasklet itself), it is rescheduled for later.
  378. * Tasklet is strictly serialized wrt itself, but not
  379. wrt another tasklets. If client needs some intertask synchronization,
  380. he makes it with spinlocks.
  381. */
  382. struct tasklet_struct
  383. {
  384. struct tasklet_struct *next;
  385. unsigned long state;
  386. atomic_t count;
  387. void (*func)(unsigned long);
  388. unsigned long data;
  389. };
  390. #define DECLARE_TASKLET(name, func, data) \
  391. struct tasklet_struct name = { NULL, 0, ATOMIC_INIT(0), func, data }
  392. #define DECLARE_TASKLET_DISABLED(name, func, data) \
  393. struct tasklet_struct name = { NULL, 0, ATOMIC_INIT(1), func, data }
  394. enum
  395. {
  396. TASKLET_STATE_SCHED, /* Tasklet is scheduled for execution */
  397. TASKLET_STATE_RUN /* Tasklet is running (SMP only) */
  398. };
  399. #ifdef CONFIG_SMP
  400. static inline int tasklet_trylock(struct tasklet_struct *t)
  401. {
  402. return !test_and_set_bit(TASKLET_STATE_RUN, &(t)->state);
  403. }
  404. static inline void tasklet_unlock(struct tasklet_struct *t)
  405. {
  406. smp_mb__before_clear_bit();
  407. clear_bit(TASKLET_STATE_RUN, &(t)->state);
  408. }
  409. static inline void tasklet_unlock_wait(struct tasklet_struct *t)
  410. {
  411. while (test_bit(TASKLET_STATE_RUN, &(t)->state)) { barrier(); }
  412. }
  413. #else
  414. #define tasklet_trylock(t) 1
  415. #define tasklet_unlock_wait(t) do { } while (0)
  416. #define tasklet_unlock(t) do { } while (0)
  417. #endif
  418. extern void __tasklet_schedule(struct tasklet_struct *t);
  419. static inline void tasklet_schedule(struct tasklet_struct *t)
  420. {
  421. if (!test_and_set_bit(TASKLET_STATE_SCHED, &t->state))
  422. __tasklet_schedule(t);
  423. }
  424. extern void __tasklet_hi_schedule(struct tasklet_struct *t);
  425. static inline void tasklet_hi_schedule(struct tasklet_struct *t)
  426. {
  427. if (!test_and_set_bit(TASKLET_STATE_SCHED, &t->state))
  428. __tasklet_hi_schedule(t);
  429. }
  430. extern void __tasklet_hi_schedule_first(struct tasklet_struct *t);
  431. /*
  432. * This version avoids touching any other tasklets. Needed for kmemcheck
  433. * in order not to take any page faults while enqueueing this tasklet;
  434. * consider VERY carefully whether you really need this or
  435. * tasklet_hi_schedule()...
  436. */
  437. static inline void tasklet_hi_schedule_first(struct tasklet_struct *t)
  438. {
  439. if (!test_and_set_bit(TASKLET_STATE_SCHED, &t->state))
  440. __tasklet_hi_schedule_first(t);
  441. }
  442. static inline void tasklet_disable_nosync(struct tasklet_struct *t)
  443. {
  444. atomic_inc(&t->count);
  445. smp_mb__after_atomic_inc();
  446. }
  447. static inline void tasklet_disable(struct tasklet_struct *t)
  448. {
  449. tasklet_disable_nosync(t);
  450. tasklet_unlock_wait(t);
  451. smp_mb();
  452. }
  453. static inline void tasklet_enable(struct tasklet_struct *t)
  454. {
  455. smp_mb__before_atomic_dec();
  456. atomic_dec(&t->count);
  457. }
  458. static inline void tasklet_hi_enable(struct tasklet_struct *t)
  459. {
  460. smp_mb__before_atomic_dec();
  461. atomic_dec(&t->count);
  462. }
  463. extern void tasklet_kill(struct tasklet_struct *t);
  464. extern void tasklet_kill_immediate(struct tasklet_struct *t, unsigned int cpu);
  465. extern void tasklet_init(struct tasklet_struct *t,
  466. void (*func)(unsigned long), unsigned long data);
  467. struct tasklet_hrtimer {
  468. struct hrtimer timer;
  469. struct tasklet_struct tasklet;
  470. enum hrtimer_restart (*function)(struct hrtimer *);
  471. };
  472. extern void
  473. tasklet_hrtimer_init(struct tasklet_hrtimer *ttimer,
  474. enum hrtimer_restart (*function)(struct hrtimer *),
  475. clockid_t which_clock, enum hrtimer_mode mode);
  476. static inline
  477. int tasklet_hrtimer_start(struct tasklet_hrtimer *ttimer, ktime_t time,
  478. const enum hrtimer_mode mode)
  479. {
  480. return hrtimer_start(&ttimer->timer, time, mode);
  481. }
  482. static inline
  483. void tasklet_hrtimer_cancel(struct tasklet_hrtimer *ttimer)
  484. {
  485. hrtimer_cancel(&ttimer->timer);
  486. tasklet_kill(&ttimer->tasklet);
  487. }
  488. /*
  489. * Autoprobing for irqs:
  490. *
  491. * probe_irq_on() and probe_irq_off() provide robust primitives
  492. * for accurate IRQ probing during kernel initialization. They are
  493. * reasonably simple to use, are not "fooled" by spurious interrupts,
  494. * and, unlike other attempts at IRQ probing, they do not get hung on
  495. * stuck interrupts (such as unused PS2 mouse interfaces on ASUS boards).
  496. *
  497. * For reasonably foolproof probing, use them as follows:
  498. *
  499. * 1. clear and/or mask the device's internal interrupt.
  500. * 2. sti();
  501. * 3. irqs = probe_irq_on(); // "take over" all unassigned idle IRQs
  502. * 4. enable the device and cause it to trigger an interrupt.
  503. * 5. wait for the device to interrupt, using non-intrusive polling or a delay.
  504. * 6. irq = probe_irq_off(irqs); // get IRQ number, 0=none, negative=multiple
  505. * 7. service the device to clear its pending interrupt.
  506. * 8. loop again if paranoia is required.
  507. *
  508. * probe_irq_on() returns a mask of allocated irq's.
  509. *
  510. * probe_irq_off() takes the mask as a parameter,
  511. * and returns the irq number which occurred,
  512. * or zero if none occurred, or a negative irq number
  513. * if more than one irq occurred.
  514. */
  515. #if defined(CONFIG_GENERIC_HARDIRQS) && !defined(CONFIG_GENERIC_IRQ_PROBE)
  516. static inline unsigned long probe_irq_on(void)
  517. {
  518. return 0;
  519. }
  520. static inline int probe_irq_off(unsigned long val)
  521. {
  522. return 0;
  523. }
  524. static inline unsigned int probe_irq_mask(unsigned long val)
  525. {
  526. return 0;
  527. }
  528. #else
  529. extern unsigned long probe_irq_on(void); /* returns 0 on failure */
  530. extern int probe_irq_off(unsigned long); /* returns 0 or negative on failure */
  531. extern unsigned int probe_irq_mask(unsigned long); /* returns mask of ISA interrupts */
  532. #endif
  533. #ifdef CONFIG_PROC_FS
  534. /* Initialize /proc/irq/ */
  535. extern void init_irq_proc(void);
  536. #else
  537. static inline void init_irq_proc(void)
  538. {
  539. }
  540. #endif
  541. struct seq_file;
  542. int show_interrupts(struct seq_file *p, void *v);
  543. struct irq_desc;
  544. extern int early_irq_init(void);
  545. extern int arch_probe_nr_irqs(void);
  546. extern int arch_early_irq_init(void);
  547. extern int arch_init_chip_data(struct irq_desc *desc, int node);
  548. #endif