io_trapped.h 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. #ifndef __ASM_SH_IO_TRAPPED_H
  2. #define __ASM_SH_IO_TRAPPED_H
  3. #include <linux/list.h>
  4. #include <linux/ioport.h>
  5. #include <asm/page.h>
  6. #define IO_TRAPPED_MAGIC 0xfeedbeef
  7. struct trapped_io {
  8. unsigned int magic;
  9. struct resource *resource;
  10. unsigned int num_resources;
  11. unsigned int minimum_bus_width;
  12. struct list_head list;
  13. void __iomem *virt_base;
  14. } __aligned(PAGE_SIZE);
  15. #ifdef CONFIG_IO_TRAPPED
  16. int register_trapped_io(struct trapped_io *tiop);
  17. int handle_trapped_io(struct pt_regs *regs, unsigned long address);
  18. void __iomem *match_trapped_io_handler(struct list_head *list,
  19. unsigned long offset,
  20. unsigned long size);
  21. #ifdef CONFIG_HAS_IOMEM
  22. extern struct list_head trapped_mem;
  23. static inline void __iomem *
  24. __ioremap_trapped(unsigned long offset, unsigned long size)
  25. {
  26. return match_trapped_io_handler(&trapped_mem, offset, size);
  27. }
  28. #else
  29. #define __ioremap_trapped(offset, size) NULL
  30. #endif
  31. #ifdef CONFIG_HAS_IOPORT_MAP
  32. extern struct list_head trapped_io;
  33. static inline void __iomem *
  34. __ioport_map_trapped(unsigned long offset, unsigned long size)
  35. {
  36. return match_trapped_io_handler(&trapped_io, offset, size);
  37. }
  38. #else
  39. #define __ioport_map_trapped(offset, size) NULL
  40. #endif
  41. #else
  42. #define register_trapped_io(tiop) (-1)
  43. #define handle_trapped_io(tiop, address) 0
  44. #define __ioremap_trapped(offset, size) NULL
  45. #define __ioport_map_trapped(offset, size) NULL
  46. #endif
  47. #endif /* __ASM_SH_IO_TRAPPED_H */