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
10FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
11FILE_SECBOOT ( PERMITTED );
12
13#include <stddef.h>
14#include <ipxe/uaccess.h>
15
16#ifdef IOMAP_VIRT
17#define IOMAP_PREFIX_virt
18#else
19#define IOMAP_PREFIX_virt __virt_
20#endif
21
22static inline __always_inline void *
23IOMAP_INLINE ( virt, ioremap ) ( unsigned long bus_addr, size_t len __unused ) {
24 return ( bus_addr ? phys_to_virt ( bus_addr ) : NULL );
25}
26
27static inline __always_inline void
28IOMAP_INLINE ( virt, iounmap ) ( volatile const void *io_addr __unused ) {
29 /* Nothing to do */
30}
31
32static inline __always_inline unsigned long
33IOMAP_INLINE ( virt, io_to_bus ) ( volatile const void *io_addr ) {
34 return virt_to_phys ( io_addr );
35}
36
37#endif /* _IPXE_IOMAP_VIRT_H */
#define NULL
NULL pointer (VOID *)
Definition Base.h:322
ring len
Length.
Definition dwmac.h:226
#define __always_inline
Declare a function to be always inline.
Definition compiler.h:611
#define __unused
Declare a variable or data structure as unused.
Definition compiler.h:573
#define FILE_LICENCE(_licence)
Declare a particular licence as applying to a file.
Definition compiler.h:896
#define FILE_SECBOOT(_status)
Declare a file's UEFI Secure Boot permission status.
Definition compiler.h:926
#define IOMAP_INLINE(_subsys, _api_func)
Calculate static inline I/O mapping API function name.
Definition iomap.h:26
unsigned long io_to_bus(volatile const void *io_addr)
Convert I/O address to bus address (for debug only)
void * ioremap(unsigned long bus_addr, size_t len)
Map bus address as an I/O address.
void iounmap(volatile const void *io_addr)
Unmap I/O address.
Access to external ("user") memory.
static __always_inline void unsigned long bus_addr
Definition pcibios.h:156