uv_irq.c 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. /*
  2. * This file is subject to the terms and conditions of the GNU General Public
  3. * License. See the file "COPYING" in the main directory of this archive
  4. * for more details.
  5. *
  6. * SGI UV IRQ functions
  7. *
  8. * Copyright (C) 2008 Silicon Graphics, Inc. All rights reserved.
  9. */
  10. #include <linux/module.h>
  11. #include <linux/irq.h>
  12. #include <asm/apic.h>
  13. #include <asm/uv/uv_irq.h>
  14. static void uv_noop(unsigned int irq)
  15. {
  16. }
  17. static unsigned int uv_noop_ret(unsigned int irq)
  18. {
  19. return 0;
  20. }
  21. static void uv_ack_apic(unsigned int irq)
  22. {
  23. ack_APIC_irq();
  24. }
  25. struct irq_chip uv_irq_chip = {
  26. .name = "UV-CORE",
  27. .startup = uv_noop_ret,
  28. .shutdown = uv_noop,
  29. .enable = uv_noop,
  30. .disable = uv_noop,
  31. .ack = uv_noop,
  32. .mask = uv_noop,
  33. .unmask = uv_noop,
  34. .eoi = uv_ack_apic,
  35. .end = uv_noop,
  36. };
  37. /*
  38. * Set up a mapping of an available irq and vector, and enable the specified
  39. * MMR that defines the MSI that is to be sent to the specified CPU when an
  40. * interrupt is raised.
  41. */
  42. int uv_setup_irq(char *irq_name, int cpu, int mmr_blade,
  43. unsigned long mmr_offset)
  44. {
  45. int irq;
  46. int ret;
  47. irq = create_irq();
  48. if (irq <= 0)
  49. return -EBUSY;
  50. ret = arch_enable_uv_irq(irq_name, irq, cpu, mmr_blade, mmr_offset);
  51. if (ret != irq)
  52. destroy_irq(irq);
  53. return ret;
  54. }
  55. EXPORT_SYMBOL_GPL(uv_setup_irq);
  56. /*
  57. * Tear down a mapping of an irq and vector, and disable the specified MMR that
  58. * defined the MSI that was to be sent to the specified CPU when an interrupt
  59. * was raised.
  60. *
  61. * Set mmr_blade and mmr_offset to what was passed in on uv_setup_irq().
  62. */
  63. void uv_teardown_irq(unsigned int irq, int mmr_blade, unsigned long mmr_offset)
  64. {
  65. arch_disable_uv_irq(mmr_blade, mmr_offset);
  66. destroy_irq(irq);
  67. }
  68. EXPORT_SYMBOL_GPL(uv_teardown_irq);