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