io.h 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. /*
  2. * Copyright (c) 2011 The Chromium OS Authors.
  3. *
  4. * SPDX-License-Identifier: GPL-2.0+
  5. */
  6. #ifndef __SANDBOX_ASM_IO_H
  7. #define __SANDBOX_ASM_IO_H
  8. /*
  9. * Given a physical address and a length, return a virtual address
  10. * that can be used to access the memory range with the caching
  11. * properties specified by "flags".
  12. */
  13. #define MAP_NOCACHE (0)
  14. #define MAP_WRCOMBINE (0)
  15. #define MAP_WRBACK (0)
  16. #define MAP_WRTHROUGH (0)
  17. void *map_physmem(phys_addr_t paddr, unsigned long len, unsigned long flags);
  18. /*
  19. * Take down a mapping set up by map_physmem().
  20. */
  21. void unmap_physmem(const void *vaddr, unsigned long flags);
  22. /* For sandbox, we want addresses to point into our RAM buffer */
  23. static inline void *map_sysmem(phys_addr_t paddr, unsigned long len)
  24. {
  25. return map_physmem(paddr, len, MAP_WRBACK);
  26. }
  27. /* Remove a previous mapping */
  28. static inline void unmap_sysmem(const void *vaddr)
  29. {
  30. unmap_physmem(vaddr, MAP_WRBACK);
  31. }
  32. /* Map from a pointer to our RAM buffer */
  33. phys_addr_t map_to_sysmem(const void *ptr);
  34. /* Define nops for sandbox I/O access */
  35. #define readb(addr) 0
  36. #define readw(addr) 0
  37. #define readl(addr) 0
  38. #define writeb(v, addr)
  39. #define writew(v, addr)
  40. #define writel(v, addr)
  41. /* I/O access functions */
  42. int inl(unsigned int addr);
  43. int inw(unsigned int addr);
  44. int inb(unsigned int addr);
  45. void outl(unsigned int value, unsigned int addr);
  46. void outw(unsigned int value, unsigned int addr);
  47. void outb(unsigned int value, unsigned int addr);
  48. #include <iotrace.h>
  49. #endif