You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. #ifndef _IPXE_IOMAP_H
  2. #define _IPXE_IOMAP_H
  3. /** @file
  4. *
  5. * iPXE I/O mapping API
  6. *
  7. * The I/O mapping API provides methods for mapping and unmapping I/O
  8. * devices.
  9. */
  10. FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
  11. #include <stdint.h>
  12. #include <ipxe/api.h>
  13. #include <config/ioapi.h>
  14. #include <ipxe/uaccess.h>
  15. /**
  16. * Calculate static inline I/O mapping API function name
  17. *
  18. * @v _prefix Subsystem prefix
  19. * @v _api_func API function
  20. * @ret _subsys_func Subsystem API function
  21. */
  22. #define IOMAP_INLINE( _subsys, _api_func ) \
  23. SINGLE_API_INLINE ( IOMAP_PREFIX_ ## _subsys, _api_func )
  24. /**
  25. * Provide an I/O mapping API implementation
  26. *
  27. * @v _prefix Subsystem prefix
  28. * @v _api_func API function
  29. * @v _func Implementing function
  30. */
  31. #define PROVIDE_IOMAP( _subsys, _api_func, _func ) \
  32. PROVIDE_SINGLE_API ( IOMAP_PREFIX_ ## _subsys, _api_func, _func )
  33. /**
  34. * Provide a static inline I/O mapping API implementation
  35. *
  36. * @v _prefix Subsystem prefix
  37. * @v _api_func API function
  38. */
  39. #define PROVIDE_IOMAP_INLINE( _subsys, _api_func ) \
  40. PROVIDE_SINGLE_API_INLINE ( IOMAP_PREFIX_ ## _subsys, _api_func )
  41. /* Include all architecture-independent I/O API headers */
  42. #include <ipxe/iomap_virt.h>
  43. /* Include all architecture-dependent I/O API headers */
  44. #include <bits/iomap.h>
  45. /**
  46. * Map bus address as an I/O address
  47. *
  48. * @v bus_addr Bus address
  49. * @v len Length of region
  50. * @ret io_addr I/O address
  51. */
  52. void * ioremap ( unsigned long bus_addr, size_t len );
  53. /**
  54. * Unmap I/O address
  55. *
  56. * @v io_addr I/O address
  57. */
  58. void iounmap ( volatile const void *io_addr );
  59. /**
  60. * Convert I/O address to bus address (for debug only)
  61. *
  62. * @v io_addr I/O address
  63. * @ret bus_addr Bus address
  64. */
  65. unsigned long io_to_bus ( volatile const void *io_addr );
  66. #endif /* _IPXE_IOMAP_H */