summaryrefslogtreecommitdiffstats
path: root/src/include/ipxe/iomap_virt.h
blob: 4962b7c377762665590c2daeb6502d781814e4b9 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
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 */