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 #include <stddef.h>
13 #include <ipxe/uaccess.h>
14 
15 #ifdef IOMAP_VIRT
16 #define IOMAP_PREFIX_virt
17 #else
18 #define IOMAP_PREFIX_virt __virt_
19 #endif
20 
21 static inline __always_inline void *
22 IOMAP_INLINE ( virt, ioremap ) ( unsigned long bus_addr, size_t len __unused ) {
23  return ( bus_addr ? phys_to_virt ( bus_addr ) : NULL );
24 }
25 
26 static inline __always_inline void
27 IOMAP_INLINE ( virt, iounmap ) ( volatile const void *io_addr __unused ) {
28  /* Nothing to do */
29 }
30 
31 static inline __always_inline unsigned long
32 IOMAP_INLINE ( virt, io_to_bus ) ( volatile const void *io_addr ) {
33  return virt_to_phys ( io_addr );
34 }
35 
36 #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 void unsigned long bus_addr
Definition: pcibios.h:155
Access to external ("user") memory.
ring len
Length.
Definition: dwmac.h:231
static __always_inline void size_t len __unused
Definition: iomap_virt.h:22
#define __always_inline
Declare a function to be always inline.
Definition: compiler.h:611
FILE_LICENCE(GPL2_OR_LATER_OR_UBDL)
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:321