hw_irq.h
上传用户:jlfgdled
上传日期:2013-04-10
资源大小:33168k
文件大小:2k
源码类别:

Linux/Unix编程

开发平台:

Unix_Linux

  1. /*
  2.  * Copyright (C) 1999 Cort Dougan <cort@cs.nmt.edu>
  3.  *
  4.  * Use inline IRQs where possible - Anton Blanchard <anton@au.ibm.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. #ifdef __KERNEL__
  12. #ifndef _PPC64_HW_IRQ_H
  13. #define _PPC64_HW_IRQ_H
  14. #include <linux/config.h>
  15. #include <asm/irq.h>
  16. int timer_interrupt(struct pt_regs *);
  17. #ifdef CONFIG_PPC_ISERIES
  18. extern void __no_use_sti(void);
  19. extern void __no_use_cli(void);
  20. extern void __no_use_restore_flags(unsigned long);
  21. extern unsigned long __no_use_save_flags(void);
  22. extern void __no_use_set_lost(unsigned long);
  23. extern void __no_lpq_restore_flags(unsigned long);
  24. #define __cli() __no_use_cli()
  25. #define __sti() __no_use_sti()
  26. #define __save_flags(flags) ((flags) = __no_use_save_flags())
  27. #define __restore_flags(flags) __no_use_restore_flags((unsigned long)flags)
  28. #define __save_and_cli(flags) ({__save_flags(flags);__cli();})
  29. #else
  30. #define __save_flags(flags) ((flags) = mfmsr())
  31. #define __restore_flags(flags) mtmsrd(flags)
  32. static inline void __cli(void)
  33. {
  34. unsigned long msr;
  35. msr = mfmsr();
  36. mtmsrd(msr & ~MSR_EE);
  37. __asm__ __volatile__("": : :"memory");
  38. }
  39. static inline void __sti(void)
  40. {
  41. unsigned long msr;
  42. __asm__ __volatile__("": : :"memory");
  43. msr = mfmsr();
  44. mtmsrd(msr | MSR_EE);
  45. }
  46. static inline void __do_save_and_cli(unsigned long *flags)
  47. {
  48. unsigned long msr;
  49. msr = mfmsr();
  50. *flags = msr;
  51. mtmsrd(msr & ~MSR_EE);
  52. __asm__ __volatile__("": : :"memory");
  53. }
  54. #define __save_and_cli(flags)          __do_save_and_cli(&flags)
  55. #endif /* CONFIG_PPC_ISERIES */
  56. #define mask_irq(irq) ({if (irq_desc[irq].handler && irq_desc[irq].handler->disable) irq_desc[irq].handler->disable(irq);})
  57. #define unmask_irq(irq) ({if (irq_desc[irq].handler && irq_desc[irq].handler->enable) irq_desc[irq].handler->enable(irq);})
  58. #define ack_irq(irq) ({if (irq_desc[irq].handler && irq_desc[irq].handler->ack) irq_desc[irq].handler->ack(irq);})
  59. /* Should we handle this via lost interrupts and IPIs or should we don't care like
  60.  * we do now ? --BenH.
  61.  */
  62. struct hw_interrupt_type;
  63. static inline void hw_resend_irq(struct hw_interrupt_type *h, unsigned int i) {}
  64. #endif /* _PPC64_HW_IRQ_H */
  65. #endif /* __KERNEL__ */