Committer: Michael Beasley <mike@snafu.setup>
[mikesnafu-overlay.git] / include / asm-sh / io_trapped.h
blobf1251d4f0ba9ec5a5b42dfad33275e8123a227c3
1 #ifndef __ASM_SH_IO_TRAPPED_H
2 #define __ASM_SH_IO_TRAPPED_H
4 #include <linux/list.h>
5 #include <linux/ioport.h>
6 #include <asm/page.h>
8 #define IO_TRAPPED_MAGIC 0xfeedbeef
10 struct trapped_io {
11 unsigned int magic;
12 struct resource *resource;
13 unsigned int num_resources;
14 unsigned int minimum_bus_width;
15 struct list_head list;
16 void __iomem *virt_base;
17 } __aligned(PAGE_SIZE);
19 #ifdef CONFIG_IO_TRAPPED
20 int register_trapped_io(struct trapped_io *tiop);
21 int handle_trapped_io(struct pt_regs *regs, unsigned long address);
23 void __iomem *match_trapped_io_handler(struct list_head *list,
24 unsigned long offset,
25 unsigned long size);
27 #ifdef CONFIG_HAS_IOMEM
28 extern struct list_head trapped_mem;
30 static inline void __iomem *
31 __ioremap_trapped(unsigned long offset, unsigned long size)
33 return match_trapped_io_handler(&trapped_mem, offset, size);
35 #else
36 #define __ioremap_trapped(offset, size) NULL
37 #endif
39 #ifdef CONFIG_HAS_IOPORT
40 extern struct list_head trapped_io;
42 static inline void __iomem *
43 __ioport_map_trapped(unsigned long offset, unsigned long size)
45 return match_trapped_io_handler(&trapped_io, offset, size);
47 #else
48 #define __ioport_map_trapped(offset, size) NULL
49 #endif
51 #else
52 #define register_trapped_io(tiop) (-1)
53 #define handle_trapped_io(tiop, address) 0
54 #define __ioremap_trapped(offset, size) NULL
55 #define __ioport_map_trapped(offset, size) NULL
56 #endif
58 #endif /* __ASM_SH_IO_TRAPPED_H */