XenevaOS
Loading...
Searching...
No Matches
ioport.h
Go to the documentation of this file.
1#ifndef __LINUX_IOPORT_H__
2#define __LINUX_IOPORT_H__
3
4/*
5 * DCL <linux/ioport.h> -- I/O window bookkeeping.
6 *
7 * Xeneva has no I/O region allocator: there is no ioport_resource tree, no
8 * sparse iomem map, and no enforcement of exclusive claims. The serial code
9 * still asks for regions (8250_pci.c:2904 request_mem_region, :2917
10 * request_region, plus serial_core.c's resource bookkeeping), and the answer
11 * to a claim has to be truthful: mainline treats a NULL return as "someone
12 * else owns this window" and unwinds.
13 *
14 * So the claim is recorded in a small table with overlap detection and the
15 * window is only refused if it genuinely collides -- a real check, just over
16 * an eight-entry list instead of a resource tree. Reporting success blindly
17 * would let two drivers walk over the same registers, which on a UART means
18 * two writers corrupting each other's LCR; reporting failure blindly would
19 * leave every port unbound. Bodies in DCL/linux_irq_shim.c.
20 *
21 * __iomem is already defined (empty) in <linux/kernel.h>.
22 */
23
24#include <linux/kernel.h> /* resource_size_t, u32 */
25
26/*
27 * The three tree links, in mainline's order, plus the four fields this file
28 * already had. They were added for drm_cache.c:204, which walks the I/O
29 * memory map as a *tree* -- `for (tmp = iomem_resource.child; tmp;
30 * tmp = tmp->sibling)` -- to find the highest mapped address and decide
31 * whether a device with a narrower DMA mask would need bounce buffers.
32 *
33 * A struct with only start/end/name/flags would compile at the `child` read
34 * and fail at the `sibling` one, and the two errors point at different tokens
35 * in one expression, which is the shape a missing member has when the first
36 * dereference happens to find something.
37 *
38 * The tree is empty -- iomem_resource is defined in a shim with a NULL child
39 * -- because Xeneva maps nothing through request_mem_region() and has no
40 * SWIOTLB to bounce against. So the loop does not run, max_iomem keeps its
41 * initial 0, and drm_need_swiotlb() answers false, which is the correct
42 * answer for this kernel rather than a stubbed one.
43 */
44struct resource {
47 const char* name;
48 unsigned long flags;
51 struct resource* child;
52};
53
54#define IORESOURCE_IO 0x00000100
55#define IORESOURCE_MEM 0x00000200
56#define IORESOURCE_IRQ 0x00000400
57#define IORESOURCE_DMA 0x00000800
58#define IORESOURCE_BUSY 0x80000000
59
60/*
61 * The root of the I/O memory tree, and an empty one -- see the note on struct
62 * resource above for who reads it and why empty is the right answer here.
63 * Defined in DCL/linux_irq_shim.c beside request_mem_region().
64 */
65extern struct resource iomem_resource;
66
67/* Return the claim, or NULL if the window is already taken (mainline's rule). */
69 const char* name);
71 const char* name);
72
75
76#endif /* __LINUX_IOPORT_H__ */
struct drm_crtc struct drm_plane struct drm_plane const struct drm_crtc_funcs const char * name
Definition drm_crtc.h:1242
struct resource * request_region(resource_size_t start, resource_size_t n, const char *name)
struct resource * request_mem_region(resource_size_t start, resource_size_t n, const char *name)
void release_mem_region(resource_size_t start, resource_size_t n)
struct resource iomem_resource
void release_region(resource_size_t start, resource_size_t n)
uintptr_t resource_size_t
Definition kernel.h:41
Definition ioport.h:44
unsigned long flags
Definition ioport.h:48
resource_size_t start
Definition ioport.h:45
resource_size_t end
Definition ioport.h:46
struct resource * sibling
Definition ioport.h:50
struct resource * parent
Definition ioport.h:49
const char * name
Definition ioport.h:47
struct resource * child
Definition ioport.h:51