Commit 4370fe1c authored by Magnus Damm's avatar Magnus Damm Committed by Paul Mundt

sh: intc register modify fix

Make sure register modifications stay atomic. Fixes processors with
shared priority register masking. Dual bitmap masking is unaffected.
Signed-off-by: default avatarMagnus Damm <damm@igel.co.jp>
Signed-off-by: default avatarPaul Mundt <lethal@linux-sh.org>
parent 720be990
...@@ -101,17 +101,26 @@ static void write_32(unsigned long addr, unsigned long h, unsigned long data) ...@@ -101,17 +101,26 @@ static void write_32(unsigned long addr, unsigned long h, unsigned long data)
static void modify_8(unsigned long addr, unsigned long h, unsigned long data) static void modify_8(unsigned long addr, unsigned long h, unsigned long data)
{ {
unsigned long flags;
local_irq_save(flags);
ctrl_outb(set_field(ctrl_inb(addr), data, h), addr); ctrl_outb(set_field(ctrl_inb(addr), data, h), addr);
local_irq_restore(flags);
} }
static void modify_16(unsigned long addr, unsigned long h, unsigned long data) static void modify_16(unsigned long addr, unsigned long h, unsigned long data)
{ {
unsigned long flags;
local_irq_save(flags);
ctrl_outw(set_field(ctrl_inw(addr), data, h), addr); ctrl_outw(set_field(ctrl_inw(addr), data, h), addr);
local_irq_restore(flags);
} }
static void modify_32(unsigned long addr, unsigned long h, unsigned long data) static void modify_32(unsigned long addr, unsigned long h, unsigned long data)
{ {
unsigned long flags;
local_irq_save(flags);
ctrl_outl(set_field(ctrl_inl(addr), data, h), addr); ctrl_outl(set_field(ctrl_inl(addr), data, h), addr);
local_irq_restore(flags);
} }
enum { REG_FN_ERR = 0, REG_FN_WRITE_BASE = 1, REG_FN_MODIFY_BASE = 5 }; enum { REG_FN_ERR = 0, REG_FN_WRITE_BASE = 1, REG_FN_MODIFY_BASE = 5 };
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment