uv_irq.c 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  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/uv/uv_irq.h>
  13. static void uv_noop(unsigned int irq)
  14. {
  15. }
  16. static unsigned int uv_noop_ret(unsigned int irq)
  17. {
  18. return 0;
  19. }
  20. static void uv_ack_apic(unsigned int irq)
  21. {
  22. ack_APIC_irq();
  23. }
  24. struct irq_chip uv_irq_chip = {
  25. .name = "UV-CORE",
  26. .startup = uv_noop_ret,
  27. .shutdown = uv_noop,
  28. .enable = uv_noop,
  29. .disable = uv_noop,
  30. .ack = uv_noop,
  31. .mask = uv_noop,
  32. .unmask = uv_noop,
  33. .eoi = uv_ack_apic,
  34. .end = uv_noop,
  35. };
  36. /*
  37. * Set up a mapping of an available irq and vector, and enable the specified
  38. * MMR that defines the MSI that is to be sent to the specified CPU when an
  39. * interrupt is raised.
  40. */
  41. int uv_setup_irq(char *irq_name, int cpu, int mmr_blade,
  42. unsigned long mmr_offset)
  43. {
  44. int irq;
  45. int ret;
  46. irq = create_irq();
  47. if (irq <= 0)
  48. return -EBUSY;
  49. ret = arch_enable_uv_irq(irq_name, irq, cpu, mmr_blade, mmr_offset);
  50. if (ret != irq)
  51. destroy_irq(irq);
  52. return ret;
  53. }
  54. EXPORT_SYMBOL_GPL(uv_setup_irq);
  55. /*
  56. * Tear down a mapping of an irq and vector, and disable the specified MMR that
  57. * defined the MSI that was to be sent to the specified CPU when an interrupt
  58. * was raised.
  59. *
  60. * Set mmr_blade and mmr_offset to what was passed in on uv_setup_irq().
  61. */
  62. void uv_teardown_irq(unsigned int irq, int mmr_blade, unsigned long mmr_offset)
  63. {
  64. arch_disable_uv_irq(mmr_blade, mmr_offset);
  65. destroy_irq(irq);
  66. }
  67. EXPORT_SYMBOL_GPL(uv_teardown_irq);