| 1 | /* |
| 2 | * arch/ubicom32/include/asm/irqflags.h |
| 3 | * Raw implementation of local IRQ functions. |
| 4 | * |
| 5 | * (C) Copyright 2009, Ubicom, Inc. |
| 6 | * |
| 7 | * This file is part of the Ubicom32 Linux Kernel Port. |
| 8 | * |
| 9 | * The Ubicom32 Linux Kernel Port is free software: you can redistribute |
| 10 | * it and/or modify it under the terms of the GNU General Public License |
| 11 | * as published by the Free Software Foundation, either version 2 of the |
| 12 | * License, or (at your option) any later version. |
| 13 | * |
| 14 | * The Ubicom32 Linux Kernel Port is distributed in the hope that it |
| 15 | * will be useful, but WITHOUT ANY WARRANTY; without even the implied |
| 16 | * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See |
| 17 | * the GNU General Public License for more details. |
| 18 | * |
| 19 | * You should have received a copy of the GNU General Public License |
| 20 | * along with the Ubicom32 Linux Kernel Port. If not, |
| 21 | * see <http://www.gnu.org/licenses/>. |
| 22 | * |
| 23 | * Ubicom32 implementation derived from (with many thanks): |
| 24 | * arch/m68knommu |
| 25 | * arch/blackfin |
| 26 | * arch/parisc |
| 27 | */ |
| 28 | #ifndef _ASM_UBICOM32_IRQFLAGS_H |
| 29 | #define _ASM_UBICOM32_IRQFLAGS_H |
| 30 | |
| 31 | #include <linux/thread_info.h> |
| 32 | #include <asm/ubicom32-common.h> |
| 33 | #if defined(CONFIG_SMP) |
| 34 | #include <asm/smp.h> |
| 35 | #endif |
| 36 | #include <asm/ldsr.h> |
| 37 | |
| 38 | #if defined(CONFIG_PREEMPT) |
| 39 | #error Not supported by Ubicom32 irq handling, yet! |
| 40 | #endif |
| 41 | |
| 42 | /* |
| 43 | * raw_local_irq_enable() |
| 44 | * Enable interrupts for this thread. |
| 45 | */ |
| 46 | static inline void raw_local_irq_enable(void) |
| 47 | { |
| 48 | ldsr_local_irq_enable(); |
| 49 | } |
| 50 | |
| 51 | /* |
| 52 | * raw_local_irq_disable() |
| 53 | * Disable interrupts for this thread. |
| 54 | */ |
| 55 | static inline void raw_local_irq_disable(void) |
| 56 | { |
| 57 | ldsr_local_irq_disable(); |
| 58 | } |
| 59 | |
| 60 | /* |
| 61 | * raw_local_save_flags() |
| 62 | * Get the current IRQ state. |
| 63 | */ |
| 64 | #define raw_local_save_flags(flags) \ |
| 65 | do { \ |
| 66 | (flags) = ldsr_local_irq_is_disabled(); \ |
| 67 | } while (0) |
| 68 | |
| 69 | /* |
| 70 | * raw_local_irq_save() |
| 71 | * Save the current interrupt state and disable interrupts. |
| 72 | */ |
| 73 | #define raw_local_irq_save(flags) \ |
| 74 | do { \ |
| 75 | (flags) = ldsr_local_irq_save(); \ |
| 76 | } while (0) |
| 77 | |
| 78 | /* |
| 79 | * raw_local_irq_restore() |
| 80 | * Restore the IRQ state back to flags. |
| 81 | */ |
| 82 | static inline void raw_local_irq_restore(unsigned long flags) |
| 83 | { |
| 84 | ldsr_local_irq_restore(flags); |
| 85 | } |
| 86 | |
| 87 | /* |
| 88 | * raw_irqs_disabled_flags() |
| 89 | * Return true if the flags indicate that IRQ(s) are disabled. |
| 90 | */ |
| 91 | static inline int raw_irqs_disabled_flags(unsigned long flags) |
| 92 | { |
| 93 | return (flags); |
| 94 | } |
| 95 | |
| 96 | #endif /* _ASM_UBICOM32_IRQFLAGS_H */ |
| 97 | |