1#ifndef __ASM_SH_IO_TRAPPED_H 2#define __ASM_SH_IO_TRAPPED_H 3 4#include <linux/list.h> 5#include <linux/ioport.h> 6#include <asm/page.h> 7 8#define IO_TRAPPED_MAGIC 0xfeedbeef 9 10struct 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); 18 19#ifdef CONFIG_IO_TRAPPED 20int register_trapped_io(struct trapped_io *tiop); 21int handle_trapped_io(struct pt_regs *regs, unsigned long address); 22 23void __iomem *match_trapped_io_handler(struct list_head *list, 24 unsigned long offset, 25 unsigned long size); 26 27#ifdef CONFIG_HAS_IOMEM 28extern struct list_head trapped_mem; 29 30static inline void __iomem * 31__ioremap_trapped(unsigned long offset, unsigned long size) 32{ 33 return match_trapped_io_handler(&trapped_mem, offset, size); 34} 35#else 36#define __ioremap_trapped(offset, size) NULL 37#endif 38 39#ifdef CONFIG_HAS_IOPORT 40extern struct list_head trapped_io; 41 42static inline void __iomem * 43__ioport_map_trapped(unsigned long offset, unsigned long size) 44{ 45 return match_trapped_io_handler(&trapped_io, offset, size); 46} 47#else 48#define __ioport_map_trapped(offset, size) NULL 49#endif 50 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 57 58#endif /* __ASM_SH_IO_TRAPPED_H */ 59