iPXE
iomap.h
Go to the documentation of this file.
1 #ifndef _IPXE_IOMAP_H
2 #define _IPXE_IOMAP_H
3 
4 /** @file
5  *
6  * iPXE I/O mapping API
7  *
8  * The I/O mapping API provides methods for mapping and unmapping I/O
9  * devices.
10  */
11 
12 FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
13 
14 #include <stdint.h>
15 #include <ipxe/api.h>
16 #include <config/ioapi.h>
17 
18 /**
19  * Calculate static inline I/O mapping API function name
20  *
21  * @v _prefix Subsystem prefix
22  * @v _api_func API function
23  * @ret _subsys_func Subsystem API function
24  */
25 #define IOMAP_INLINE( _subsys, _api_func ) \
26  SINGLE_API_INLINE ( IOMAP_PREFIX_ ## _subsys, _api_func )
27 
28 /**
29  * Provide an I/O mapping API implementation
30  *
31  * @v _prefix Subsystem prefix
32  * @v _api_func API function
33  * @v _func Implementing function
34  */
35 #define PROVIDE_IOMAP( _subsys, _api_func, _func ) \
36  PROVIDE_SINGLE_API ( IOMAP_PREFIX_ ## _subsys, _api_func, _func )
37 
38 /**
39  * Provide a static inline I/O mapping API implementation
40  *
41  * @v _prefix Subsystem prefix
42  * @v _api_func API function
43  */
44 #define PROVIDE_IOMAP_INLINE( _subsys, _api_func ) \
45  PROVIDE_SINGLE_API_INLINE ( IOMAP_PREFIX_ ## _subsys, _api_func )
46 
47 /* Include all architecture-independent I/O API headers */
48 #include <ipxe/iomap_virt.h>
49 
50 /* Include all architecture-dependent I/O API headers */
51 #include <bits/iomap.h>
52 
53 /**
54  * Map bus address as an I/O address
55  *
56  * @v bus_addr Bus address
57  * @v len Length of region
58  * @ret io_addr I/O address
59  */
60 void * ioremap ( unsigned long bus_addr, size_t len );
61 
62 /**
63  * Unmap I/O address
64  *
65  * @v io_addr I/O address
66  */
67 void iounmap ( volatile const void *io_addr );
68 
69 /**
70  * Convert I/O address to bus address (for debug only)
71  *
72  * @v io_addr I/O address
73  * @ret bus_addr Bus address
74  */
75 unsigned long io_to_bus ( volatile const void *io_addr );
76 
77 #endif /* _IPXE_IOMAP_H */
iPXE internal APIs
FILE_LICENCE(GPL2_OR_LATER_OR_UBDL)
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
ring len
Length.
Definition: dwmac.h:231
I/O API configuration.
iPXE I/O mapping API using phys_to_virt()
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.