irq.c 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781
  1. /* irq.c: FRV IRQ handling
  2. *
  3. * Copyright (C) 2003, 2004 Red Hat, Inc. All Rights Reserved.
  4. * Written by David Howells (dhowells@redhat.com)
  5. *
  6. * This program is free software; you can redistribute it and/or
  7. * modify it under the terms of the GNU General Public License
  8. * as published by the Free Software Foundation; either version
  9. * 2 of the License, or (at your option) any later version.
  10. */
  11. /*
  12. * (mostly architecture independent, will move to kernel/irq.c in 2.5.)
  13. *
  14. * IRQs are in fact implemented a bit like signal handlers for the kernel.
  15. * Naturally it's not a 1:1 relation, but there are similarities.
  16. */
  17. #include <linux/config.h>
  18. #include <linux/ptrace.h>
  19. #include <linux/errno.h>
  20. #include <linux/signal.h>
  21. #include <linux/sched.h>
  22. #include <linux/ioport.h>
  23. #include <linux/interrupt.h>
  24. #include <linux/timex.h>
  25. #include <linux/slab.h>
  26. #include <linux/random.h>
  27. #include <linux/smp_lock.h>
  28. #include <linux/init.h>
  29. #include <linux/kernel_stat.h>
  30. #include <linux/irq.h>
  31. #include <linux/proc_fs.h>
  32. #include <linux/seq_file.h>
  33. #include <linux/module.h>
  34. #include <asm/atomic.h>
  35. #include <asm/io.h>
  36. #include <asm/smp.h>
  37. #include <asm/system.h>
  38. #include <asm/bitops.h>
  39. #include <asm/uaccess.h>
  40. #include <asm/pgalloc.h>
  41. #include <asm/delay.h>
  42. #include <asm/irq.h>
  43. #include <asm/irc-regs.h>
  44. #include <asm/irq-routing.h>
  45. #include <asm/gdb-stub.h>
  46. extern void __init fpga_init(void);
  47. extern void __init route_mb93493_irqs(void);
  48. static void register_irq_proc (unsigned int irq);
  49. /*
  50. * Special irq handlers.
  51. */
  52. irqreturn_t no_action(int cpl, void *dev_id, struct pt_regs *regs) { return IRQ_HANDLED; }
  53. atomic_t irq_err_count;
  54. /*
  55. * Generic, controller-independent functions:
  56. */
  57. int show_interrupts(struct seq_file *p, void *v)
  58. {
  59. struct irqaction *action;
  60. struct irq_group *group;
  61. unsigned long flags;
  62. int level, grp, ix, i, j;
  63. i = *(loff_t *) v;
  64. switch (i) {
  65. case 0:
  66. seq_printf(p, " ");
  67. for (j = 0; j < NR_CPUS; j++)
  68. if (cpu_online(j))
  69. seq_printf(p, "CPU%d ",j);
  70. seq_putc(p, '\n');
  71. break;
  72. case 1 ... NR_IRQ_GROUPS * NR_IRQ_ACTIONS_PER_GROUP:
  73. local_irq_save(flags);
  74. grp = (i - 1) / NR_IRQ_ACTIONS_PER_GROUP;
  75. group = irq_groups[grp];
  76. if (!group)
  77. goto skip;
  78. ix = (i - 1) % NR_IRQ_ACTIONS_PER_GROUP;
  79. action = group->actions[ix];
  80. if (!action)
  81. goto skip;
  82. seq_printf(p, "%3d: ", i - 1);
  83. #ifndef CONFIG_SMP
  84. seq_printf(p, "%10u ", kstat_irqs(i));
  85. #else
  86. for (j = 0; j < NR_CPUS; j++)
  87. if (cpu_online(j))
  88. seq_printf(p, "%10u ", kstat_cpu(j).irqs[i - 1]);
  89. #endif
  90. level = group->sources[ix]->level - frv_irq_levels;
  91. seq_printf(p, " %12s@%x", group->sources[ix]->muxname, level);
  92. seq_printf(p, " %s", action->name);
  93. for (action = action->next; action; action = action->next)
  94. seq_printf(p, ", %s", action->name);
  95. seq_putc(p, '\n');
  96. skip:
  97. local_irq_restore(flags);
  98. break;
  99. case NR_IRQ_GROUPS * NR_IRQ_ACTIONS_PER_GROUP + 1:
  100. seq_printf(p, "ERR: %10u\n", atomic_read(&irq_err_count));
  101. break;
  102. default:
  103. break;
  104. }
  105. return 0;
  106. }
  107. /*
  108. * Generic enable/disable code: this just calls
  109. * down into the PIC-specific version for the actual
  110. * hardware disable after having gotten the irq
  111. * controller lock.
  112. */
  113. /**
  114. * disable_irq_nosync - disable an irq without waiting
  115. * @irq: Interrupt to disable
  116. *
  117. * Disable the selected interrupt line. Disables and Enables are
  118. * nested.
  119. * Unlike disable_irq(), this function does not ensure existing
  120. * instances of the IRQ handler have completed before returning.
  121. *
  122. * This function may be called from IRQ context.
  123. */
  124. void disable_irq_nosync(unsigned int irq)
  125. {
  126. struct irq_source *source;
  127. struct irq_group *group;
  128. struct irq_level *level;
  129. unsigned long flags;
  130. int idx = irq & (NR_IRQ_ACTIONS_PER_GROUP - 1);
  131. group = irq_groups[irq >> NR_IRQ_LOG2_ACTIONS_PER_GROUP];
  132. if (!group)
  133. BUG();
  134. source = group->sources[idx];
  135. if (!source)
  136. BUG();
  137. level = source->level;
  138. spin_lock_irqsave(&level->lock, flags);
  139. if (group->control) {
  140. if (!group->disable_cnt[idx]++)
  141. group->control(group, idx, 0);
  142. } else if (!level->disable_count++) {
  143. __set_MASK(level - frv_irq_levels);
  144. }
  145. spin_unlock_irqrestore(&level->lock, flags);
  146. }
  147. EXPORT_SYMBOL(disable_irq_nosync);
  148. /**
  149. * disable_irq - disable an irq and wait for completion
  150. * @irq: Interrupt to disable
  151. *
  152. * Disable the selected interrupt line. Enables and Disables are
  153. * nested.
  154. * This function waits for any pending IRQ handlers for this interrupt
  155. * to complete before returning. If you use this function while
  156. * holding a resource the IRQ handler may need you will deadlock.
  157. *
  158. * This function may be called - with care - from IRQ context.
  159. */
  160. void disable_irq(unsigned int irq)
  161. {
  162. disable_irq_nosync(irq);
  163. #ifdef CONFIG_SMP
  164. if (!local_irq_count(smp_processor_id())) {
  165. do {
  166. barrier();
  167. } while (irq_desc[irq].status & IRQ_INPROGRESS);
  168. }
  169. #endif
  170. }
  171. EXPORT_SYMBOL(disable_irq);
  172. /**
  173. * enable_irq - enable handling of an irq
  174. * @irq: Interrupt to enable
  175. *
  176. * Undoes the effect of one call to disable_irq(). If this
  177. * matches the last disable, processing of interrupts on this
  178. * IRQ line is re-enabled.
  179. *
  180. * This function may be called from IRQ context.
  181. */
  182. void enable_irq(unsigned int irq)
  183. {
  184. struct irq_source *source;
  185. struct irq_group *group;
  186. struct irq_level *level;
  187. unsigned long flags;
  188. int idx = irq & (NR_IRQ_ACTIONS_PER_GROUP - 1);
  189. int count;
  190. group = irq_groups[irq >> NR_IRQ_LOG2_ACTIONS_PER_GROUP];
  191. if (!group)
  192. BUG();
  193. source = group->sources[idx];
  194. if (!source)
  195. BUG();
  196. level = source->level;
  197. spin_lock_irqsave(&level->lock, flags);
  198. if (group->control)
  199. count = group->disable_cnt[idx];
  200. else
  201. count = level->disable_count;
  202. switch (count) {
  203. case 1:
  204. if (group->control) {
  205. if (group->actions[idx])
  206. group->control(group, idx, 1);
  207. } else {
  208. if (level->usage)
  209. __clr_MASK(level - frv_irq_levels);
  210. }
  211. /* fall-through */
  212. default:
  213. count--;
  214. break;
  215. case 0:
  216. printk("enable_irq(%u) unbalanced from %p\n", irq, __builtin_return_address(0));
  217. }
  218. if (group->control)
  219. group->disable_cnt[idx] = count;
  220. else
  221. level->disable_count = count;
  222. spin_unlock_irqrestore(&level->lock, flags);
  223. }
  224. EXPORT_SYMBOL(enable_irq);
  225. /*****************************************************************************/
  226. /*
  227. * handles all normal device IRQ's
  228. * - registers are referred to by the __frame variable (GR28)
  229. * - IRQ distribution is complicated in this arch because of the many PICs, the
  230. * way they work and the way they cascade
  231. */
  232. asmlinkage void do_IRQ(void)
  233. {
  234. struct irq_source *source;
  235. int level, cpu;
  236. level = (__frame->tbr >> 4) & 0xf;
  237. cpu = smp_processor_id();
  238. #if 0
  239. {
  240. static u32 irqcount;
  241. *(volatile u32 *) 0xe1200004 = ~((irqcount++ << 8) | level);
  242. *(volatile u16 *) 0xffc00100 = (u16) ~0x9999;
  243. mb();
  244. }
  245. #endif
  246. if ((unsigned long) __frame - (unsigned long) (current + 1) < 512)
  247. BUG();
  248. __set_MASK(level);
  249. __clr_RC(level);
  250. __clr_IRL();
  251. kstat_this_cpu.irqs[level]++;
  252. irq_enter();
  253. for (source = frv_irq_levels[level].sources; source; source = source->next)
  254. source->doirq(source);
  255. irq_exit();
  256. __clr_MASK(level);
  257. /* only process softirqs if we didn't interrupt another interrupt handler */
  258. if ((__frame->psr & PSR_PIL) == PSR_PIL_0)
  259. if (local_softirq_pending())
  260. do_softirq();
  261. #ifdef CONFIG_PREEMPT
  262. local_irq_disable();
  263. while (--current->preempt_count == 0) {
  264. if (!(__frame->psr & PSR_S) ||
  265. current->need_resched == 0 ||
  266. in_interrupt())
  267. break;
  268. current->preempt_count++;
  269. local_irq_enable();
  270. preempt_schedule();
  271. local_irq_disable();
  272. }
  273. #endif
  274. #if 0
  275. {
  276. *(volatile u16 *) 0xffc00100 = (u16) ~0x6666;
  277. mb();
  278. }
  279. #endif
  280. } /* end do_IRQ() */
  281. /*****************************************************************************/
  282. /*
  283. * handles all NMIs when not co-opted by the debugger
  284. * - registers are referred to by the __frame variable (GR28)
  285. */
  286. asmlinkage void do_NMI(void)
  287. {
  288. } /* end do_NMI() */
  289. /*****************************************************************************/
  290. /**
  291. * request_irq - allocate an interrupt line
  292. * @irq: Interrupt line to allocate
  293. * @handler: Function to be called when the IRQ occurs
  294. * @irqflags: Interrupt type flags
  295. * @devname: An ascii name for the claiming device
  296. * @dev_id: A cookie passed back to the handler function
  297. *
  298. * This call allocates interrupt resources and enables the
  299. * interrupt line and IRQ handling. From the point this
  300. * call is made your handler function may be invoked. Since
  301. * your handler function must clear any interrupt the board
  302. * raises, you must take care both to initialise your hardware
  303. * and to set up the interrupt handler in the right order.
  304. *
  305. * Dev_id must be globally unique. Normally the address of the
  306. * device data structure is used as the cookie. Since the handler
  307. * receives this value it makes sense to use it.
  308. *
  309. * If your interrupt is shared you must pass a non NULL dev_id
  310. * as this is required when freeing the interrupt.
  311. *
  312. * Flags:
  313. *
  314. * SA_SHIRQ Interrupt is shared
  315. *
  316. * SA_INTERRUPT Disable local interrupts while processing
  317. *
  318. * SA_SAMPLE_RANDOM The interrupt can be used for entropy
  319. *
  320. */
  321. int request_irq(unsigned int irq,
  322. irqreturn_t (*handler)(int, void *, struct pt_regs *),
  323. unsigned long irqflags,
  324. const char * devname,
  325. void *dev_id)
  326. {
  327. int retval;
  328. struct irqaction *action;
  329. #if 1
  330. /*
  331. * Sanity-check: shared interrupts should REALLY pass in
  332. * a real dev-ID, otherwise we'll have trouble later trying
  333. * to figure out which interrupt is which (messes up the
  334. * interrupt freeing logic etc).
  335. */
  336. if (irqflags & SA_SHIRQ) {
  337. if (!dev_id)
  338. printk("Bad boy: %s (at 0x%x) called us without a dev_id!\n",
  339. devname, (&irq)[-1]);
  340. }
  341. #endif
  342. if ((irq >> NR_IRQ_LOG2_ACTIONS_PER_GROUP) >= NR_IRQ_GROUPS)
  343. return -EINVAL;
  344. if (!handler)
  345. return -EINVAL;
  346. action = (struct irqaction *) kmalloc(sizeof(struct irqaction), GFP_KERNEL);
  347. if (!action)
  348. return -ENOMEM;
  349. action->handler = handler;
  350. action->flags = irqflags;
  351. action->mask = CPU_MASK_NONE;
  352. action->name = devname;
  353. action->next = NULL;
  354. action->dev_id = dev_id;
  355. retval = setup_irq(irq, action);
  356. if (retval)
  357. kfree(action);
  358. return retval;
  359. }
  360. EXPORT_SYMBOL(request_irq);
  361. /**
  362. * free_irq - free an interrupt
  363. * @irq: Interrupt line to free
  364. * @dev_id: Device identity to free
  365. *
  366. * Remove an interrupt handler. The handler is removed and if the
  367. * interrupt line is no longer in use by any driver it is disabled.
  368. * On a shared IRQ the caller must ensure the interrupt is disabled
  369. * on the card it drives before calling this function. The function
  370. * does not return until any executing interrupts for this IRQ
  371. * have completed.
  372. *
  373. * This function may be called from interrupt context.
  374. *
  375. * Bugs: Attempting to free an irq in a handler for the same irq hangs
  376. * the machine.
  377. */
  378. void free_irq(unsigned int irq, void *dev_id)
  379. {
  380. struct irq_source *source;
  381. struct irq_group *group;
  382. struct irq_level *level;
  383. struct irqaction **p, **pp;
  384. unsigned long flags;
  385. if ((irq >> NR_IRQ_LOG2_ACTIONS_PER_GROUP) >= NR_IRQ_GROUPS)
  386. return;
  387. group = irq_groups[irq >> NR_IRQ_LOG2_ACTIONS_PER_GROUP];
  388. if (!group)
  389. BUG();
  390. source = group->sources[irq & (NR_IRQ_ACTIONS_PER_GROUP - 1)];
  391. if (!source)
  392. BUG();
  393. level = source->level;
  394. p = &group->actions[irq & (NR_IRQ_ACTIONS_PER_GROUP - 1)];
  395. spin_lock_irqsave(&level->lock, flags);
  396. for (pp = p; *pp; pp = &(*pp)->next) {
  397. struct irqaction *action = *pp;
  398. if (action->dev_id != dev_id)
  399. continue;
  400. /* found it - remove from the list of entries */
  401. *pp = action->next;
  402. level->usage--;
  403. if (p == pp && group->control)
  404. group->control(group, irq & (NR_IRQ_ACTIONS_PER_GROUP - 1), 0);
  405. if (level->usage == 0)
  406. __set_MASK(level - frv_irq_levels);
  407. spin_unlock_irqrestore(&level->lock,flags);
  408. #ifdef CONFIG_SMP
  409. /* Wait to make sure it's not being used on another CPU */
  410. while (desc->status & IRQ_INPROGRESS)
  411. barrier();
  412. #endif
  413. kfree(action);
  414. return;
  415. }
  416. }
  417. EXPORT_SYMBOL(free_irq);
  418. /*
  419. * IRQ autodetection code..
  420. *
  421. * This depends on the fact that any interrupt that comes in on to an
  422. * unassigned IRQ will cause GxICR_DETECT to be set
  423. */
  424. static DECLARE_MUTEX(probe_sem);
  425. /**
  426. * probe_irq_on - begin an interrupt autodetect
  427. *
  428. * Commence probing for an interrupt. The interrupts are scanned
  429. * and a mask of potential interrupt lines is returned.
  430. *
  431. */
  432. unsigned long probe_irq_on(void)
  433. {
  434. down(&probe_sem);
  435. return 0;
  436. }
  437. EXPORT_SYMBOL(probe_irq_on);
  438. /*
  439. * Return a mask of triggered interrupts (this
  440. * can handle only legacy ISA interrupts).
  441. */
  442. /**
  443. * probe_irq_mask - scan a bitmap of interrupt lines
  444. * @val: mask of interrupts to consider
  445. *
  446. * Scan the ISA bus interrupt lines and return a bitmap of
  447. * active interrupts. The interrupt probe logic state is then
  448. * returned to its previous value.
  449. *
  450. * Note: we need to scan all the irq's even though we will
  451. * only return ISA irq numbers - just so that we reset them
  452. * all to a known state.
  453. */
  454. unsigned int probe_irq_mask(unsigned long xmask)
  455. {
  456. up(&probe_sem);
  457. return 0;
  458. }
  459. EXPORT_SYMBOL(probe_irq_mask);
  460. /*
  461. * Return the one interrupt that triggered (this can
  462. * handle any interrupt source).
  463. */
  464. /**
  465. * probe_irq_off - end an interrupt autodetect
  466. * @xmask: mask of potential interrupts (unused)
  467. *
  468. * Scans the unused interrupt lines and returns the line which
  469. * appears to have triggered the interrupt. If no interrupt was
  470. * found then zero is returned. If more than one interrupt is
  471. * found then minus the first candidate is returned to indicate
  472. * their is doubt.
  473. *
  474. * The interrupt probe logic state is returned to its previous
  475. * value.
  476. *
  477. * BUGS: When used in a module (which arguably shouldnt happen)
  478. * nothing prevents two IRQ probe callers from overlapping. The
  479. * results of this are non-optimal.
  480. */
  481. int probe_irq_off(unsigned long xmask)
  482. {
  483. up(&probe_sem);
  484. return -1;
  485. }
  486. EXPORT_SYMBOL(probe_irq_off);
  487. /* this was setup_x86_irq but it seems pretty generic */
  488. int setup_irq(unsigned int irq, struct irqaction *new)
  489. {
  490. struct irq_source *source;
  491. struct irq_group *group;
  492. struct irq_level *level;
  493. struct irqaction **p, **pp;
  494. unsigned long flags;
  495. group = irq_groups[irq >> NR_IRQ_LOG2_ACTIONS_PER_GROUP];
  496. if (!group)
  497. BUG();
  498. source = group->sources[irq & (NR_IRQ_ACTIONS_PER_GROUP - 1)];
  499. if (!source)
  500. BUG();
  501. level = source->level;
  502. p = &group->actions[irq & (NR_IRQ_ACTIONS_PER_GROUP - 1)];
  503. /*
  504. * Some drivers like serial.c use request_irq() heavily,
  505. * so we have to be careful not to interfere with a
  506. * running system.
  507. */
  508. if (new->flags & SA_SAMPLE_RANDOM) {
  509. /*
  510. * This function might sleep, we want to call it first,
  511. * outside of the atomic block.
  512. * Yes, this might clear the entropy pool if the wrong
  513. * driver is attempted to be loaded, without actually
  514. * installing a new handler, but is this really a problem,
  515. * only the sysadmin is able to do this.
  516. */
  517. rand_initialize_irq(irq);
  518. }
  519. /* must juggle the interrupt processing stuff with interrupts disabled */
  520. spin_lock_irqsave(&level->lock, flags);
  521. /* can't share interrupts unless all parties agree to */
  522. if (level->usage != 0 && !(level->flags & new->flags & SA_SHIRQ)) {
  523. spin_unlock_irqrestore(&level->lock,flags);
  524. return -EBUSY;
  525. }
  526. /* add new interrupt at end of irq queue */
  527. pp = p;
  528. while (*pp)
  529. pp = &(*pp)->next;
  530. *pp = new;
  531. level->usage++;
  532. level->flags = new->flags;
  533. /* turn the interrupts on */
  534. if (level->usage == 1)
  535. __clr_MASK(level - frv_irq_levels);
  536. if (p == pp && group->control)
  537. group->control(group, irq & (NR_IRQ_ACTIONS_PER_GROUP - 1), 1);
  538. spin_unlock_irqrestore(&level->lock, flags);
  539. register_irq_proc(irq);
  540. return 0;
  541. }
  542. static struct proc_dir_entry * root_irq_dir;
  543. static struct proc_dir_entry * irq_dir [NR_IRQS];
  544. #define HEX_DIGITS 8
  545. static unsigned int parse_hex_value (const char *buffer,
  546. unsigned long count, unsigned long *ret)
  547. {
  548. unsigned char hexnum [HEX_DIGITS];
  549. unsigned long value;
  550. int i;
  551. if (!count)
  552. return -EINVAL;
  553. if (count > HEX_DIGITS)
  554. count = HEX_DIGITS;
  555. if (copy_from_user(hexnum, buffer, count))
  556. return -EFAULT;
  557. /*
  558. * Parse the first 8 characters as a hex string, any non-hex char
  559. * is end-of-string. '00e1', 'e1', '00E1', 'E1' are all the same.
  560. */
  561. value = 0;
  562. for (i = 0; i < count; i++) {
  563. unsigned int c = hexnum[i];
  564. switch (c) {
  565. case '0' ... '9': c -= '0'; break;
  566. case 'a' ... 'f': c -= 'a'-10; break;
  567. case 'A' ... 'F': c -= 'A'-10; break;
  568. default:
  569. goto out;
  570. }
  571. value = (value << 4) | c;
  572. }
  573. out:
  574. *ret = value;
  575. return 0;
  576. }
  577. static int prof_cpu_mask_read_proc (char *page, char **start, off_t off,
  578. int count, int *eof, void *data)
  579. {
  580. unsigned long *mask = (unsigned long *) data;
  581. if (count < HEX_DIGITS+1)
  582. return -EINVAL;
  583. return sprintf (page, "%08lx\n", *mask);
  584. }
  585. static int prof_cpu_mask_write_proc (struct file *file, const char *buffer,
  586. unsigned long count, void *data)
  587. {
  588. unsigned long *mask = (unsigned long *) data, full_count = count, err;
  589. unsigned long new_value;
  590. show_state();
  591. err = parse_hex_value(buffer, count, &new_value);
  592. if (err)
  593. return err;
  594. *mask = new_value;
  595. return full_count;
  596. }
  597. #define MAX_NAMELEN 10
  598. static void register_irq_proc (unsigned int irq)
  599. {
  600. char name [MAX_NAMELEN];
  601. if (!root_irq_dir || irq_dir[irq])
  602. return;
  603. memset(name, 0, MAX_NAMELEN);
  604. sprintf(name, "%d", irq);
  605. /* create /proc/irq/1234 */
  606. irq_dir[irq] = proc_mkdir(name, root_irq_dir);
  607. }
  608. unsigned long prof_cpu_mask = -1;
  609. void init_irq_proc (void)
  610. {
  611. struct proc_dir_entry *entry;
  612. int i;
  613. /* create /proc/irq */
  614. root_irq_dir = proc_mkdir("irq", 0);
  615. /* create /proc/irq/prof_cpu_mask */
  616. entry = create_proc_entry("prof_cpu_mask", 0600, root_irq_dir);
  617. if (!entry)
  618. return;
  619. entry->nlink = 1;
  620. entry->data = (void *)&prof_cpu_mask;
  621. entry->read_proc = prof_cpu_mask_read_proc;
  622. entry->write_proc = prof_cpu_mask_write_proc;
  623. /*
  624. * Create entries for all existing IRQs.
  625. */
  626. for (i = 0; i < NR_IRQS; i++)
  627. register_irq_proc(i);
  628. }
  629. /*****************************************************************************/
  630. /*
  631. * initialise the interrupt system
  632. */
  633. void __init init_IRQ(void)
  634. {
  635. route_cpu_irqs();
  636. fpga_init();
  637. #ifdef CONFIG_FUJITSU_MB93493
  638. route_mb93493_irqs();
  639. #endif
  640. } /* end init_IRQ() */