iPXE
iomap_virt.h
Go to the documentation of this file.
1 #ifndef _IPXE_IOMAP_VIRT_H
2 #define _IPXE_IOMAP_VIRT_H
3 
4 /** @file
5  *
6  * iPXE I/O mapping API using phys_to_virt()
7  *
8  */
9 
10 FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
11 
12 #ifdef IOMAP_VIRT
13 #define IOMAP_PREFIX_virt
14 #else
15 #define IOMAP_PREFIX_virt __virt_
16 #endif
17 
18 static inline __always_inline void *
19 IOMAP_INLINE ( virt, ioremap ) ( unsigned long bus_addr, size_t len __unused ) {
20  return ( bus_addr ? phys_to_virt ( bus_addr ) : NULL );
21 }
22 
23 static inline __always_inline void
24 IOMAP_INLINE ( virt, iounmap ) ( volatile const void *io_addr __unused ) {
25  /* Nothing to do */
26 }
27 
28 static inline __always_inline unsigned long
29 IOMAP_INLINE ( virt, io_to_bus ) ( volatile const void *io_addr ) {
30  return virt_to_phys ( io_addr );
31 }
32 
33 #endif /* _IPXE_IOMAP_VIRT_H */
static __always_inline void * IOMAP_INLINE(virt, ioremap)(unsigned long bus_addr
unsigned long io_to_bus(volatile const void *io_addr)
Convert I/O address to bus address (for debug only)
static __always_inline unsigned long virt_to_phys(volatile const void *addr)
Convert virtual address to a physical address.
Definition: uaccess.h:287
static __always_inline void * phys_to_virt(unsigned long phys_addr)
Convert physical address to a virtual address.
Definition: uaccess.h:299
static __always_inline void size_t len __unused
Definition: iomap_virt.h:19
#define __always_inline
Declare a function to be always inline.
Definition: compiler.h:611
FILE_LICENCE(GPL2_OR_LATER_OR_UBDL)
uint32_t len
Length.
Definition: ena.h:14
void iounmap(volatile const void *io_addr)
Unmap I/O address.
void * ioremap(unsigned long bus_addr, size_t len)
Map bus address as an I/O address.
#define NULL
NULL pointer (VOID *)
Definition: Base.h:362