hpsim_irq.c 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. // SPDX-License-Identifier: GPL-2.0
  2. /*
  3. * Platform dependent support for HP simulator.
  4. *
  5. * Copyright (C) 1998-2001 Hewlett-Packard Co
  6. * Copyright (C) 1998-2001 David Mosberger-Tang <davidm@hpl.hp.com>
  7. */
  8. #include <linux/init.h>
  9. #include <linux/kernel.h>
  10. #include <linux/sched.h>
  11. #include <linux/irq.h>
  12. #include "hpsim_ssc.h"
  13. static unsigned int
  14. hpsim_irq_startup(struct irq_data *data)
  15. {
  16. return 0;
  17. }
  18. static void
  19. hpsim_irq_noop(struct irq_data *data)
  20. {
  21. }
  22. static int
  23. hpsim_set_affinity_noop(struct irq_data *d, const struct cpumask *b, bool f)
  24. {
  25. return 0;
  26. }
  27. static struct irq_chip irq_type_hp_sim = {
  28. .name = "hpsim",
  29. .irq_startup = hpsim_irq_startup,
  30. .irq_shutdown = hpsim_irq_noop,
  31. .irq_enable = hpsim_irq_noop,
  32. .irq_disable = hpsim_irq_noop,
  33. .irq_ack = hpsim_irq_noop,
  34. .irq_set_affinity = hpsim_set_affinity_noop,
  35. };
  36. static void hpsim_irq_set_chip(int irq)
  37. {
  38. struct irq_chip *chip = irq_get_chip(irq);
  39. if (chip == &no_irq_chip)
  40. irq_set_chip(irq, &irq_type_hp_sim);
  41. }
  42. static void hpsim_connect_irq(int intr, int irq)
  43. {
  44. ia64_ssc(intr, irq, 0, 0, SSC_CONNECT_INTERRUPT);
  45. }
  46. int hpsim_get_irq(int intr)
  47. {
  48. int irq = assign_irq_vector(AUTO_ASSIGN);
  49. if (irq >= 0) {
  50. hpsim_irq_set_chip(irq);
  51. irq_set_handler(irq, handle_simple_irq);
  52. hpsim_connect_irq(intr, irq);
  53. }
  54. return irq;
  55. }
  56. void __init
  57. hpsim_irq_init (void)
  58. {
  59. int i;
  60. for_each_active_irq(i)
  61. hpsim_irq_set_chip(i);
  62. }