diff options
author | Paul Mundt <lethal@linux-sh.org> | 2011-01-13 01:06:28 -0500 |
---|---|---|
committer | Paul Mundt <lethal@linux-sh.org> | 2011-01-13 01:06:28 -0500 |
commit | f43dc23d5ea91fca257be02138a255f02d98e806 (patch) | |
tree | b29722f6e965316e90ac97abf79923ced250dc21 /arch/sh/kernel/io_trapped.c | |
parent | f8e53553f452dcbf67cb89c8cba63a1cd6eb4cc0 (diff) | |
parent | 4162cf64973df51fc885825bc9ca4d055891c49f (diff) |
Merge branch 'master' of master.kernel.org:/pub/scm/linux/kernel/git/torvalds/linux-2.6 into common/serial-rework
Conflicts:
arch/sh/kernel/cpu/sh2/setup-sh7619.c
arch/sh/kernel/cpu/sh2a/setup-mxg.c
arch/sh/kernel/cpu/sh2a/setup-sh7201.c
arch/sh/kernel/cpu/sh2a/setup-sh7203.c
arch/sh/kernel/cpu/sh2a/setup-sh7206.c
arch/sh/kernel/cpu/sh3/setup-sh7705.c
arch/sh/kernel/cpu/sh3/setup-sh770x.c
arch/sh/kernel/cpu/sh3/setup-sh7710.c
arch/sh/kernel/cpu/sh3/setup-sh7720.c
arch/sh/kernel/cpu/sh4/setup-sh4-202.c
arch/sh/kernel/cpu/sh4/setup-sh7750.c
arch/sh/kernel/cpu/sh4/setup-sh7760.c
arch/sh/kernel/cpu/sh4a/setup-sh7343.c
arch/sh/kernel/cpu/sh4a/setup-sh7366.c
arch/sh/kernel/cpu/sh4a/setup-sh7722.c
arch/sh/kernel/cpu/sh4a/setup-sh7723.c
arch/sh/kernel/cpu/sh4a/setup-sh7724.c
arch/sh/kernel/cpu/sh4a/setup-sh7763.c
arch/sh/kernel/cpu/sh4a/setup-sh7770.c
arch/sh/kernel/cpu/sh4a/setup-sh7780.c
arch/sh/kernel/cpu/sh4a/setup-sh7785.c
arch/sh/kernel/cpu/sh4a/setup-sh7786.c
arch/sh/kernel/cpu/sh4a/setup-shx3.c
arch/sh/kernel/cpu/sh5/setup-sh5.c
drivers/serial/sh-sci.c
drivers/serial/sh-sci.h
include/linux/serial_sci.h
Diffstat (limited to 'arch/sh/kernel/io_trapped.c')
-rw-r--r-- | arch/sh/kernel/io_trapped.c | 32 |
1 files changed, 20 insertions, 12 deletions
diff --git a/arch/sh/kernel/io_trapped.c b/arch/sh/kernel/io_trapped.c index 77dfecb64373..32c385ef1011 100644 --- a/arch/sh/kernel/io_trapped.c +++ b/arch/sh/kernel/io_trapped.c | |||
@@ -91,10 +91,14 @@ int register_trapped_io(struct trapped_io *tiop) | |||
91 | tiop->magic = IO_TRAPPED_MAGIC; | 91 | tiop->magic = IO_TRAPPED_MAGIC; |
92 | INIT_LIST_HEAD(&tiop->list); | 92 | INIT_LIST_HEAD(&tiop->list); |
93 | spin_lock_irq(&trapped_lock); | 93 | spin_lock_irq(&trapped_lock); |
94 | #ifdef CONFIG_HAS_IOPORT | ||
94 | if (flags & IORESOURCE_IO) | 95 | if (flags & IORESOURCE_IO) |
95 | list_add(&tiop->list, &trapped_io); | 96 | list_add(&tiop->list, &trapped_io); |
97 | #endif | ||
98 | #ifdef CONFIG_HAS_IOMEM | ||
96 | if (flags & IORESOURCE_MEM) | 99 | if (flags & IORESOURCE_MEM) |
97 | list_add(&tiop->list, &trapped_mem); | 100 | list_add(&tiop->list, &trapped_mem); |
101 | #endif | ||
98 | spin_unlock_irq(&trapped_lock); | 102 | spin_unlock_irq(&trapped_lock); |
99 | 103 | ||
100 | return 0; | 104 | return 0; |
@@ -112,14 +116,15 @@ void __iomem *match_trapped_io_handler(struct list_head *list, | |||
112 | struct trapped_io *tiop; | 116 | struct trapped_io *tiop; |
113 | struct resource *res; | 117 | struct resource *res; |
114 | int k, len; | 118 | int k, len; |
119 | unsigned long flags; | ||
115 | 120 | ||
116 | spin_lock_irq(&trapped_lock); | 121 | spin_lock_irqsave(&trapped_lock, flags); |
117 | list_for_each_entry(tiop, list, list) { | 122 | list_for_each_entry(tiop, list, list) { |
118 | voffs = 0; | 123 | voffs = 0; |
119 | for (k = 0; k < tiop->num_resources; k++) { | 124 | for (k = 0; k < tiop->num_resources; k++) { |
120 | res = tiop->resource + k; | 125 | res = tiop->resource + k; |
121 | if (res->start == offset) { | 126 | if (res->start == offset) { |
122 | spin_unlock_irq(&trapped_lock); | 127 | spin_unlock_irqrestore(&trapped_lock, flags); |
123 | return tiop->virt_base + voffs; | 128 | return tiop->virt_base + voffs; |
124 | } | 129 | } |
125 | 130 | ||
@@ -127,7 +132,7 @@ void __iomem *match_trapped_io_handler(struct list_head *list, | |||
127 | voffs += roundup(len, PAGE_SIZE); | 132 | voffs += roundup(len, PAGE_SIZE); |
128 | } | 133 | } |
129 | } | 134 | } |
130 | spin_unlock_irq(&trapped_lock); | 135 | spin_unlock_irqrestore(&trapped_lock, flags); |
131 | return NULL; | 136 | return NULL; |
132 | } | 137 | } |
133 | EXPORT_SYMBOL_GPL(match_trapped_io_handler); | 138 | EXPORT_SYMBOL_GPL(match_trapped_io_handler); |
@@ -183,31 +188,31 @@ static unsigned long long copy_word(unsigned long src_addr, int src_len, | |||
183 | 188 | ||
184 | switch (src_len) { | 189 | switch (src_len) { |
185 | case 1: | 190 | case 1: |
186 | tmp = ctrl_inb(src_addr); | 191 | tmp = __raw_readb(src_addr); |
187 | break; | 192 | break; |
188 | case 2: | 193 | case 2: |
189 | tmp = ctrl_inw(src_addr); | 194 | tmp = __raw_readw(src_addr); |
190 | break; | 195 | break; |
191 | case 4: | 196 | case 4: |
192 | tmp = ctrl_inl(src_addr); | 197 | tmp = __raw_readl(src_addr); |
193 | break; | 198 | break; |
194 | case 8: | 199 | case 8: |
195 | tmp = ctrl_inq(src_addr); | 200 | tmp = __raw_readq(src_addr); |
196 | break; | 201 | break; |
197 | } | 202 | } |
198 | 203 | ||
199 | switch (dst_len) { | 204 | switch (dst_len) { |
200 | case 1: | 205 | case 1: |
201 | ctrl_outb(tmp, dst_addr); | 206 | __raw_writeb(tmp, dst_addr); |
202 | break; | 207 | break; |
203 | case 2: | 208 | case 2: |
204 | ctrl_outw(tmp, dst_addr); | 209 | __raw_writew(tmp, dst_addr); |
205 | break; | 210 | break; |
206 | case 4: | 211 | case 4: |
207 | ctrl_outl(tmp, dst_addr); | 212 | __raw_writel(tmp, dst_addr); |
208 | break; | 213 | break; |
209 | case 8: | 214 | case 8: |
210 | ctrl_outq(tmp, dst_addr); | 215 | __raw_writeq(tmp, dst_addr); |
211 | break; | 216 | break; |
212 | } | 217 | } |
213 | 218 | ||
@@ -270,6 +275,8 @@ int handle_trapped_io(struct pt_regs *regs, unsigned long address) | |||
270 | insn_size_t instruction; | 275 | insn_size_t instruction; |
271 | int tmp; | 276 | int tmp; |
272 | 277 | ||
278 | if (trapped_io_disable) | ||
279 | return 0; | ||
273 | if (!lookup_tiop(address)) | 280 | if (!lookup_tiop(address)) |
274 | return 0; | 281 | return 0; |
275 | 282 | ||
@@ -283,7 +290,8 @@ int handle_trapped_io(struct pt_regs *regs, unsigned long address) | |||
283 | return 0; | 290 | return 0; |
284 | } | 291 | } |
285 | 292 | ||
286 | tmp = handle_unaligned_access(instruction, regs, &trapped_io_access); | 293 | tmp = handle_unaligned_access(instruction, regs, |
294 | &trapped_io_access, 1, address); | ||
287 | set_fs(oldfs); | 295 | set_fs(oldfs); |
288 | return tmp == 0; | 296 | return tmp == 0; |
289 | } | 297 | } |