blob: 8fc05b997b6db4cf4fc917a53cf88e2e180ef8d8 [file] [log] [blame]
Paul Mundt03fdb702009-10-17 21:06:39 +09001/*
2 * SHmedia irqflags support
3 *
4 * Copyright (C) 2006 - 2009 Paul Mundt
5 *
6 * This file is subject to the terms and conditions of the GNU General Public
7 * License. See the file "COPYING" in the main directory of this archive
8 * for more details.
9 */
10#include <linux/irqflags.h>
11#include <linux/module.h>
12#include <cpu/registers.h>
13
Paul Mundt31b37c72010-10-27 15:34:51 +090014void notrace arch_local_irq_restore(unsigned long flags)
Paul Mundt03fdb702009-10-17 21:06:39 +090015{
16 unsigned long long __dummy;
17
Paul Mundt31b37c72010-10-27 15:34:51 +090018 if (flags == ARCH_IRQ_DISABLED) {
Paul Mundt03fdb702009-10-17 21:06:39 +090019 __asm__ __volatile__ (
20 "getcon " __SR ", %0\n\t"
21 "or %0, %1, %0\n\t"
22 "putcon %0, " __SR "\n\t"
23 : "=&r" (__dummy)
Paul Mundt31b37c72010-10-27 15:34:51 +090024 : "r" (ARCH_IRQ_DISABLED)
Paul Mundt03fdb702009-10-17 21:06:39 +090025 );
26 } else {
27 __asm__ __volatile__ (
28 "getcon " __SR ", %0\n\t"
29 "and %0, %1, %0\n\t"
30 "putcon %0, " __SR "\n\t"
31 : "=&r" (__dummy)
Paul Mundt31b37c72010-10-27 15:34:51 +090032 : "r" (~ARCH_IRQ_DISABLED)
Paul Mundt03fdb702009-10-17 21:06:39 +090033 );
34 }
35}
Paul Mundt31b37c72010-10-27 15:34:51 +090036EXPORT_SYMBOL(arch_local_irq_restore);
Paul Mundt03fdb702009-10-17 21:06:39 +090037
Paul Mundt31b37c72010-10-27 15:34:51 +090038unsigned long notrace arch_local_save_flags(void)
Paul Mundt03fdb702009-10-17 21:06:39 +090039{
40 unsigned long flags;
41
42 __asm__ __volatile__ (
43 "getcon " __SR ", %0\n\t"
44 "and %0, %1, %0"
45 : "=&r" (flags)
Paul Mundt31b37c72010-10-27 15:34:51 +090046 : "r" (ARCH_IRQ_DISABLED)
Paul Mundt03fdb702009-10-17 21:06:39 +090047 );
48
49 return flags;
50}
Paul Mundt31b37c72010-10-27 15:34:51 +090051EXPORT_SYMBOL(arch_local_save_flags);