summaryrefslogtreecommitdiffstats
path: root/src/include/ipxe/iomap_virt.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/include/ipxe/iomap_virt.h')
-rw-r--r--src/include/ipxe/iomap_virt.h33
1 files changed, 33 insertions, 0 deletions
diff --git a/src/include/ipxe/iomap_virt.h b/src/include/ipxe/iomap_virt.h
new file mode 100644
index 000000000..4962b7c37
--- /dev/null
+++ b/src/include/ipxe/iomap_virt.h
@@ -0,0 +1,33 @@
+#ifndef _IPXE_IOMAP_VIRT_H
+#define _IPXE_IOMAP_VIRT_H
+
+/** @file
+ *
+ * iPXE I/O mapping API using phys_to_virt()
+ *
+ */
+
+FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
+
+#ifdef IOMAP_VIRT
+#define IOMAP_PREFIX_virt
+#else
+#define IOMAP_PREFIX_virt __virt_
+#endif
+
+static inline __always_inline void *
+IOMAP_INLINE ( virt, ioremap ) ( unsigned long bus_addr, size_t len __unused ) {
+ return ( bus_addr ? phys_to_virt ( bus_addr ) : NULL );
+}
+
+static inline __always_inline void
+IOMAP_INLINE ( virt, iounmap ) ( volatile const void *io_addr __unused ) {
+ /* Nothing to do */
+}
+
+static inline __always_inline unsigned long
+IOMAP_INLINE ( virt, io_to_bus ) ( volatile const void *io_addr ) {
+ return virt_to_phys ( io_addr );
+}
+
+#endif /* _IPXE_IOMAP_VIRT_H */