io.h 961 B

12345678910111213141516171819202122232425262728293031323334353637383940414243
  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. static inline void unmap_physmem(void *vaddr, unsigned long flags)
  22. {
  23. }
  24. /* For sandbox, we want addresses to point into our RAM buffer */
  25. static inline void *map_sysmem(phys_addr_t paddr, unsigned long len)
  26. {
  27. return map_physmem(paddr, len, MAP_WRBACK);
  28. }
  29. static inline void unmap_sysmem(const void *vaddr)
  30. {
  31. }
  32. /* Map from a pointer to our RAM buffer */
  33. phys_addr_t map_to_sysmem(void *ptr);
  34. #endif