interrupt.h 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653
  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/hrtimer.h>
  14. #include <linux/kref.h>
  15. #include <linux/workqueue.h>
  16. #include <linux/atomic.h>
  17. #include <asm/ptrace.h>
  18. #include <asm/irq.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. * DEPRECATED. This flag is a NOOP and scheduled to be removed
  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. * IRQF_NO_SUSPEND - Do not disable this IRQ during suspend
  52. * IRQF_FORCE_RESUME - Force enable it on resume even if IRQF_NO_SUSPEND is set
  53. * IRQF_NO_THREAD - Interrupt cannot be threaded
  54. * IRQF_EARLY_RESUME - Resume IRQ early during syscore instead of at device
  55. * resume time.
  56. */
  57. #define IRQF_DISABLED 0x00000020
  58. #define IRQF_SHARED 0x00000080
  59. #define IRQF_PROBE_SHARED 0x00000100
  60. #define __IRQF_TIMER 0x00000200
  61. #define IRQF_PERCPU 0x00000400
  62. #define IRQF_NOBALANCING 0x00000800
  63. #define IRQF_IRQPOLL 0x00001000
  64. #define IRQF_ONESHOT 0x00002000
  65. #define IRQF_NO_SUSPEND 0x00004000
  66. #define IRQF_FORCE_RESUME 0x00008000
  67. #define IRQF_NO_THREAD 0x00010000
  68. #define IRQF_EARLY_RESUME 0x00020000
  69. #define IRQF_TIMER (__IRQF_TIMER | IRQF_NO_SUSPEND | IRQF_NO_THREAD)
  70. /*
  71. * These values can be returned by request_any_context_irq() and
  72. * describe the context the interrupt will be run in.
  73. *
  74. * IRQC_IS_HARDIRQ - interrupt runs in hardirq context
  75. * IRQC_IS_NESTED - interrupt runs in a nested threaded context
  76. */
  77. enum {
  78. IRQC_IS_HARDIRQ = 0,
  79. IRQC_IS_NESTED,
  80. };
  81. typedef irqreturn_t (*irq_handler_t)(int, void *);
  82. /**
  83. * struct irqaction - per interrupt action descriptor
  84. * @handler: interrupt handler function
  85. * @name: name of the device
  86. * @dev_id: cookie to identify the device
  87. * @percpu_dev_id: cookie to identify the device
  88. * @next: pointer to the next irqaction for shared interrupts
  89. * @irq: interrupt number
  90. * @flags: flags (see IRQF_* above)
  91. * @thread_fn: interrupt handler function for threaded interrupts
  92. * @thread: thread pointer for threaded interrupts
  93. * @thread_flags: flags related to @thread
  94. * @thread_mask: bitmask for keeping track of @thread activity
  95. * @dir: pointer to the proc/irq/NN/name entry
  96. */
  97. struct irqaction {
  98. irq_handler_t handler;
  99. void *dev_id;
  100. void __percpu *percpu_dev_id;
  101. struct irqaction *next;
  102. irq_handler_t thread_fn;
  103. struct task_struct *thread;
  104. unsigned int irq;
  105. unsigned int flags;
  106. unsigned long thread_flags;
  107. unsigned long thread_mask;
  108. const char *name;
  109. struct proc_dir_entry *dir;
  110. } ____cacheline_internodealigned_in_smp;
  111. extern irqreturn_t no_action(int cpl, void *dev_id);
  112. extern int __must_check
  113. request_threaded_irq(unsigned int irq, irq_handler_t handler,
  114. irq_handler_t thread_fn,
  115. unsigned long flags, const char *name, void *dev);
  116. static inline int __must_check
  117. request_irq(unsigned int irq, irq_handler_t handler, unsigned long flags,
  118. const char *name, void *dev)
  119. {
  120. return request_threaded_irq(irq, handler, NULL, flags, name, dev);
  121. }
  122. extern int __must_check
  123. request_any_context_irq(unsigned int irq, irq_handler_t handler,
  124. unsigned long flags, const char *name, void *dev_id);
  125. extern int __must_check
  126. request_percpu_irq(unsigned int irq, irq_handler_t handler,
  127. const char *devname, void __percpu *percpu_dev_id);
  128. extern void free_irq(unsigned int, void *);
  129. extern void free_percpu_irq(unsigned int, void __percpu *);
  130. struct device;
  131. extern int __must_check
  132. devm_request_threaded_irq(struct device *dev, unsigned int irq,
  133. irq_handler_t handler, irq_handler_t thread_fn,
  134. unsigned long irqflags, const char *devname,
  135. void *dev_id);
  136. static inline int __must_check
  137. devm_request_irq(struct device *dev, unsigned int irq, irq_handler_t handler,
  138. unsigned long irqflags, const char *devname, void *dev_id)
  139. {
  140. return devm_request_threaded_irq(dev, irq, handler, NULL, irqflags,
  141. devname, dev_id);
  142. }
  143. extern int __must_check
  144. devm_request_any_context_irq(struct device *dev, unsigned int irq,
  145. irq_handler_t handler, unsigned long irqflags,
  146. const char *devname, void *dev_id);
  147. extern void devm_free_irq(struct device *dev, unsigned int irq, void *dev_id);
  148. /*
  149. * On lockdep we dont want to enable hardirqs in hardirq
  150. * context. Use local_irq_enable_in_hardirq() to annotate
  151. * kernel code that has to do this nevertheless (pretty much
  152. * the only valid case is for old/broken hardware that is
  153. * insanely slow).
  154. *
  155. * NOTE: in theory this might break fragile code that relies
  156. * on hardirq delivery - in practice we dont seem to have such
  157. * places left. So the only effect should be slightly increased
  158. * irqs-off latencies.
  159. */
  160. #ifdef CONFIG_LOCKDEP
  161. # define local_irq_enable_in_hardirq() do { } while (0)
  162. #else
  163. # define local_irq_enable_in_hardirq() local_irq_enable()
  164. #endif
  165. extern void disable_irq_nosync(unsigned int irq);
  166. extern void disable_irq(unsigned int irq);
  167. extern void disable_percpu_irq(unsigned int irq);
  168. extern void enable_irq(unsigned int irq);
  169. extern void enable_percpu_irq(unsigned int irq, unsigned int type);
  170. extern void irq_wake_thread(unsigned int irq, void *dev_id);
  171. /* The following three functions are for the core kernel use only. */
  172. extern void suspend_device_irqs(void);
  173. extern void resume_device_irqs(void);
  174. #ifdef CONFIG_PM_SLEEP
  175. extern int check_wakeup_irqs(void);
  176. #else
  177. static inline int check_wakeup_irqs(void) { return 0; }
  178. #endif
  179. #if defined(CONFIG_SMP)
  180. extern cpumask_var_t irq_default_affinity;
  181. /* Internal implementation. Use the helpers below */
  182. extern int __irq_set_affinity(unsigned int irq, const struct cpumask *cpumask,
  183. bool force);
  184. /**
  185. * irq_set_affinity - Set the irq affinity of a given irq
  186. * @irq: Interrupt to set affinity
  187. * @cpumask: cpumask
  188. *
  189. * Fails if cpumask does not contain an online CPU
  190. */
  191. static inline int
  192. irq_set_affinity(unsigned int irq, const struct cpumask *cpumask)
  193. {
  194. return __irq_set_affinity(irq, cpumask, false);
  195. }
  196. /**
  197. * irq_force_affinity - Force the irq affinity of a given irq
  198. * @irq: Interrupt to set affinity
  199. * @cpumask: cpumask
  200. *
  201. * Same as irq_set_affinity, but without checking the mask against
  202. * online cpus.
  203. *
  204. * Solely for low level cpu hotplug code, where we need to make per
  205. * cpu interrupts affine before the cpu becomes online.
  206. */
  207. static inline int
  208. irq_force_affinity(unsigned int irq, const struct cpumask *cpumask)
  209. {
  210. return __irq_set_affinity(irq, cpumask, true);
  211. }
  212. extern int irq_can_set_affinity(unsigned int irq);
  213. extern int irq_select_affinity(unsigned int irq);
  214. extern int irq_set_affinity_hint(unsigned int irq, const struct cpumask *m);
  215. /**
  216. * struct irq_affinity_notify - context for notification of IRQ affinity changes
  217. * @irq: Interrupt to which notification applies
  218. * @kref: Reference count, for internal use
  219. * @work: Work item, for internal use
  220. * @notify: Function to be called on change. This will be
  221. * called in process context.
  222. * @release: Function to be called on release. This will be
  223. * called in process context. Once registered, the
  224. * structure must only be freed when this function is
  225. * called or later.
  226. */
  227. struct irq_affinity_notify {
  228. unsigned int irq;
  229. struct kref kref;
  230. struct work_struct work;
  231. void (*notify)(struct irq_affinity_notify *, const cpumask_t *mask);
  232. void (*release)(struct kref *ref);
  233. };
  234. extern int
  235. irq_set_affinity_notifier(unsigned int irq, struct irq_affinity_notify *notify);
  236. #else /* CONFIG_SMP */
  237. static inline int irq_set_affinity(unsigned int irq, const struct cpumask *m)
  238. {
  239. return -EINVAL;
  240. }
  241. static inline int irq_can_set_affinity(unsigned int irq)
  242. {
  243. return 0;
  244. }
  245. static inline int irq_select_affinity(unsigned int irq) { return 0; }
  246. static inline int irq_set_affinity_hint(unsigned int irq,
  247. const struct cpumask *m)
  248. {
  249. return -EINVAL;
  250. }
  251. #endif /* CONFIG_SMP */
  252. /*
  253. * Special lockdep variants of irq disabling/enabling.
  254. * These should be used for locking constructs that
  255. * know that a particular irq context which is disabled,
  256. * and which is the only irq-context user of a lock,
  257. * that it's safe to take the lock in the irq-disabled
  258. * section without disabling hardirqs.
  259. *
  260. * On !CONFIG_LOCKDEP they are equivalent to the normal
  261. * irq disable/enable methods.
  262. */
  263. static inline void disable_irq_nosync_lockdep(unsigned int irq)
  264. {
  265. disable_irq_nosync(irq);
  266. #ifdef CONFIG_LOCKDEP
  267. local_irq_disable();
  268. #endif
  269. }
  270. static inline void disable_irq_nosync_lockdep_irqsave(unsigned int irq, unsigned long *flags)
  271. {
  272. disable_irq_nosync(irq);
  273. #ifdef CONFIG_LOCKDEP
  274. local_irq_save(*flags);
  275. #endif
  276. }
  277. static inline void disable_irq_lockdep(unsigned int irq)
  278. {
  279. disable_irq(irq);
  280. #ifdef CONFIG_LOCKDEP
  281. local_irq_disable();
  282. #endif
  283. }
  284. static inline void enable_irq_lockdep(unsigned int irq)
  285. {
  286. #ifdef CONFIG_LOCKDEP
  287. local_irq_enable();
  288. #endif
  289. enable_irq(irq);
  290. }
  291. static inline void enable_irq_lockdep_irqrestore(unsigned int irq, unsigned long *flags)
  292. {
  293. #ifdef CONFIG_LOCKDEP
  294. local_irq_restore(*flags);
  295. #endif
  296. enable_irq(irq);
  297. }
  298. /* IRQ wakeup (PM) control: */
  299. extern int irq_set_irq_wake(unsigned int irq, unsigned int on);
  300. static inline int enable_irq_wake(unsigned int irq)
  301. {
  302. return irq_set_irq_wake(irq, 1);
  303. }
  304. static inline int disable_irq_wake(unsigned int irq)
  305. {
  306. return irq_set_irq_wake(irq, 0);
  307. }
  308. #ifdef CONFIG_IRQ_FORCED_THREADING
  309. extern bool force_irqthreads;
  310. #else
  311. #define force_irqthreads (0)
  312. #endif
  313. #ifndef __ARCH_SET_SOFTIRQ_PENDING
  314. #define set_softirq_pending(x) (local_softirq_pending() = (x))
  315. #define or_softirq_pending(x) (local_softirq_pending() |= (x))
  316. #endif
  317. /* Some architectures might implement lazy enabling/disabling of
  318. * interrupts. In some cases, such as stop_machine, we might want
  319. * to ensure that after a local_irq_disable(), interrupts have
  320. * really been disabled in hardware. Such architectures need to
  321. * implement the following hook.
  322. */
  323. #ifndef hard_irq_disable
  324. #define hard_irq_disable() do { } while(0)
  325. #endif
  326. /* PLEASE, avoid to allocate new softirqs, if you need not _really_ high
  327. frequency threaded job scheduling. For almost all the purposes
  328. tasklets are more than enough. F.e. all serial device BHs et
  329. al. should be converted to tasklets, not to softirqs.
  330. */
  331. enum
  332. {
  333. HI_SOFTIRQ=0,
  334. TIMER_SOFTIRQ,
  335. NET_TX_SOFTIRQ,
  336. NET_RX_SOFTIRQ,
  337. BLOCK_SOFTIRQ,
  338. BLOCK_IOPOLL_SOFTIRQ,
  339. TASKLET_SOFTIRQ,
  340. SCHED_SOFTIRQ,
  341. HRTIMER_SOFTIRQ,
  342. RCU_SOFTIRQ, /* Preferable RCU should always be the last softirq */
  343. NR_SOFTIRQS
  344. };
  345. #define SOFTIRQ_STOP_IDLE_MASK (~(1 << RCU_SOFTIRQ))
  346. /* map softirq index to softirq name. update 'softirq_to_name' in
  347. * kernel/softirq.c when adding a new softirq.
  348. */
  349. extern const char * const softirq_to_name[NR_SOFTIRQS];
  350. /* softirq mask and active fields moved to irq_cpustat_t in
  351. * asm/hardirq.h to get better cache usage. KAO
  352. */
  353. struct softirq_action
  354. {
  355. void (*action)(struct softirq_action *);
  356. };
  357. asmlinkage void do_softirq(void);
  358. asmlinkage void __do_softirq(void);
  359. #ifdef __ARCH_HAS_DO_SOFTIRQ
  360. void do_softirq_own_stack(void);
  361. #else
  362. static inline void do_softirq_own_stack(void)
  363. {
  364. __do_softirq();
  365. }
  366. #endif
  367. extern void open_softirq(int nr, void (*action)(struct softirq_action *));
  368. extern void softirq_init(void);
  369. extern void __raise_softirq_irqoff(unsigned int nr);
  370. extern void raise_softirq_irqoff(unsigned int nr);
  371. extern void raise_softirq(unsigned int nr);
  372. DECLARE_PER_CPU(struct task_struct *, ksoftirqd);
  373. static inline struct task_struct *this_cpu_ksoftirqd(void)
  374. {
  375. return this_cpu_read(ksoftirqd);
  376. }
  377. /* Tasklets --- multithreaded analogue of BHs.
  378. Main feature differing them of generic softirqs: tasklet
  379. is running only on one CPU simultaneously.
  380. Main feature differing them of BHs: different tasklets
  381. may be run simultaneously on different CPUs.
  382. Properties:
  383. * If tasklet_schedule() is called, then tasklet is guaranteed
  384. to be executed on some cpu at least once after this.
  385. * If the tasklet is already scheduled, but its execution is still not
  386. started, it will be executed only once.
  387. * If this tasklet is already running on another CPU (or schedule is called
  388. from tasklet itself), it is rescheduled for later.
  389. * Tasklet is strictly serialized wrt itself, but not
  390. wrt another tasklets. If client needs some intertask synchronization,
  391. he makes it with spinlocks.
  392. */
  393. struct tasklet_struct
  394. {
  395. struct tasklet_struct *next;
  396. unsigned long state;
  397. atomic_t count;
  398. void (*func)(unsigned long);
  399. unsigned long data;
  400. };
  401. #define DECLARE_TASKLET(name, func, data) \
  402. struct tasklet_struct name = { NULL, 0, ATOMIC_INIT(0), func, data }
  403. #define DECLARE_TASKLET_DISABLED(name, func, data) \
  404. struct tasklet_struct name = { NULL, 0, ATOMIC_INIT(1), func, data }
  405. enum
  406. {
  407. TASKLET_STATE_SCHED, /* Tasklet is scheduled for execution */
  408. TASKLET_STATE_RUN /* Tasklet is running (SMP only) */
  409. };
  410. #ifdef CONFIG_SMP
  411. static inline int tasklet_trylock(struct tasklet_struct *t)
  412. {
  413. return !test_and_set_bit(TASKLET_STATE_RUN, &(t)->state);
  414. }
  415. static inline void tasklet_unlock(struct tasklet_struct *t)
  416. {
  417. smp_mb__before_clear_bit();
  418. clear_bit(TASKLET_STATE_RUN, &(t)->state);
  419. }
  420. static inline void tasklet_unlock_wait(struct tasklet_struct *t)
  421. {
  422. while (test_bit(TASKLET_STATE_RUN, &(t)->state)) { barrier(); }
  423. }
  424. #else
  425. #define tasklet_trylock(t) 1
  426. #define tasklet_unlock_wait(t) do { } while (0)
  427. #define tasklet_unlock(t) do { } while (0)
  428. #endif
  429. extern void __tasklet_schedule(struct tasklet_struct *t);
  430. static inline void tasklet_schedule(struct tasklet_struct *t)
  431. {
  432. if (!test_and_set_bit(TASKLET_STATE_SCHED, &t->state))
  433. __tasklet_schedule(t);
  434. }
  435. extern void __tasklet_hi_schedule(struct tasklet_struct *t);
  436. static inline void tasklet_hi_schedule(struct tasklet_struct *t)
  437. {
  438. if (!test_and_set_bit(TASKLET_STATE_SCHED, &t->state))
  439. __tasklet_hi_schedule(t);
  440. }
  441. extern void __tasklet_hi_schedule_first(struct tasklet_struct *t);
  442. /*
  443. * This version avoids touching any other tasklets. Needed for kmemcheck
  444. * in order not to take any page faults while enqueueing this tasklet;
  445. * consider VERY carefully whether you really need this or
  446. * tasklet_hi_schedule()...
  447. */
  448. static inline void tasklet_hi_schedule_first(struct tasklet_struct *t)
  449. {
  450. if (!test_and_set_bit(TASKLET_STATE_SCHED, &t->state))
  451. __tasklet_hi_schedule_first(t);
  452. }
  453. static inline void tasklet_disable_nosync(struct tasklet_struct *t)
  454. {
  455. atomic_inc(&t->count);
  456. smp_mb__after_atomic_inc();
  457. }
  458. static inline void tasklet_disable(struct tasklet_struct *t)
  459. {
  460. tasklet_disable_nosync(t);
  461. tasklet_unlock_wait(t);
  462. smp_mb();
  463. }
  464. static inline void tasklet_enable(struct tasklet_struct *t)
  465. {
  466. smp_mb__before_atomic_dec();
  467. atomic_dec(&t->count);
  468. }
  469. static inline void tasklet_hi_enable(struct tasklet_struct *t)
  470. {
  471. smp_mb__before_atomic_dec();
  472. atomic_dec(&t->count);
  473. }
  474. extern void tasklet_kill(struct tasklet_struct *t);
  475. extern void tasklet_kill_immediate(struct tasklet_struct *t, unsigned int cpu);
  476. extern void tasklet_init(struct tasklet_struct *t,
  477. void (*func)(unsigned long), unsigned long data);
  478. struct tasklet_hrtimer {
  479. struct hrtimer timer;
  480. struct tasklet_struct tasklet;
  481. enum hrtimer_restart (*function)(struct hrtimer *);
  482. };
  483. extern void
  484. tasklet_hrtimer_init(struct tasklet_hrtimer *ttimer,
  485. enum hrtimer_restart (*function)(struct hrtimer *),
  486. clockid_t which_clock, enum hrtimer_mode mode);
  487. static inline
  488. int tasklet_hrtimer_start(struct tasklet_hrtimer *ttimer, ktime_t time,
  489. const enum hrtimer_mode mode)
  490. {
  491. return hrtimer_start(&ttimer->timer, time, mode);
  492. }
  493. static inline
  494. void tasklet_hrtimer_cancel(struct tasklet_hrtimer *ttimer)
  495. {
  496. hrtimer_cancel(&ttimer->timer);
  497. tasklet_kill(&ttimer->tasklet);
  498. }
  499. /*
  500. * Autoprobing for irqs:
  501. *
  502. * probe_irq_on() and probe_irq_off() provide robust primitives
  503. * for accurate IRQ probing during kernel initialization. They are
  504. * reasonably simple to use, are not "fooled" by spurious interrupts,
  505. * and, unlike other attempts at IRQ probing, they do not get hung on
  506. * stuck interrupts (such as unused PS2 mouse interfaces on ASUS boards).
  507. *
  508. * For reasonably foolproof probing, use them as follows:
  509. *
  510. * 1. clear and/or mask the device's internal interrupt.
  511. * 2. sti();
  512. * 3. irqs = probe_irq_on(); // "take over" all unassigned idle IRQs
  513. * 4. enable the device and cause it to trigger an interrupt.
  514. * 5. wait for the device to interrupt, using non-intrusive polling or a delay.
  515. * 6. irq = probe_irq_off(irqs); // get IRQ number, 0=none, negative=multiple
  516. * 7. service the device to clear its pending interrupt.
  517. * 8. loop again if paranoia is required.
  518. *
  519. * probe_irq_on() returns a mask of allocated irq's.
  520. *
  521. * probe_irq_off() takes the mask as a parameter,
  522. * and returns the irq number which occurred,
  523. * or zero if none occurred, or a negative irq number
  524. * if more than one irq occurred.
  525. */
  526. #if !defined(CONFIG_GENERIC_IRQ_PROBE)
  527. static inline unsigned long probe_irq_on(void)
  528. {
  529. return 0;
  530. }
  531. static inline int probe_irq_off(unsigned long val)
  532. {
  533. return 0;
  534. }
  535. static inline unsigned int probe_irq_mask(unsigned long val)
  536. {
  537. return 0;
  538. }
  539. #else
  540. extern unsigned long probe_irq_on(void); /* returns 0 on failure */
  541. extern int probe_irq_off(unsigned long); /* returns 0 or negative on failure */
  542. extern unsigned int probe_irq_mask(unsigned long); /* returns mask of ISA interrupts */
  543. #endif
  544. #ifdef CONFIG_PROC_FS
  545. /* Initialize /proc/irq/ */
  546. extern void init_irq_proc(void);
  547. #else
  548. static inline void init_irq_proc(void)
  549. {
  550. }
  551. #endif
  552. struct seq_file;
  553. int show_interrupts(struct seq_file *p, void *v);
  554. int arch_show_interrupts(struct seq_file *p, int prec);
  555. extern int early_irq_init(void);
  556. extern int arch_probe_nr_irqs(void);
  557. extern int arch_early_irq_init(void);
  558. #endif