hpsim_irq.c 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  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 <davidm@hpl.hp.com>
  6. */
  7. #include <linux/init.h>
  8. #include <linux/kernel.h>
  9. #include <linux/sched.h>
  10. #include <linux/irq.h>
  11. #include "hpsim_ssc.h"
  12. static unsigned int
  13. hpsim_irq_startup(struct irq_data *data)
  14. {
  15. return 0;
  16. }
  17. static void
  18. hpsim_irq_noop(struct irq_data *data)
  19. {
  20. }
  21. static int
  22. hpsim_set_affinity_noop(struct irq_data *d, const struct cpumask *b, bool f)
  23. {
  24. return 0;
  25. }
  26. static struct irq_chip irq_type_hp_sim = {
  27. .name = "hpsim",
  28. .irq_startup = hpsim_irq_startup,
  29. .irq_shutdown = hpsim_irq_noop,
  30. .irq_enable = hpsim_irq_noop,
  31. .irq_disable = hpsim_irq_noop,
  32. .irq_ack = hpsim_irq_noop,
  33. .irq_set_affinity = hpsim_set_affinity_noop,
  34. };
  35. static void hpsim_irq_set_chip(int irq)
  36. {
  37. struct irq_chip *chip = irq_get_chip(irq);
  38. if (chip == &no_irq_chip)
  39. irq_set_chip(irq, &irq_type_hp_sim);
  40. }
  41. static void hpsim_connect_irq(int intr, int irq)
  42. {
  43. ia64_ssc(intr, irq, 0, 0, SSC_CONNECT_INTERRUPT);
  44. }
  45. int hpsim_get_irq(int intr)
  46. {
  47. int irq = assign_irq_vector(AUTO_ASSIGN);
  48. if (irq >= 0) {
  49. hpsim_irq_set_chip(irq);
  50. irq_set_handler(irq, handle_simple_irq);
  51. hpsim_connect_irq(intr, irq);
  52. }
  53. return irq;
  54. }
  55. void __init
  56. hpsim_irq_init (void)
  57. {
  58. int i;
  59. for_each_active_irq(i)
  60. hpsim_irq_set_chip(i);
  61. }