Go to the documentation of this file.
8 #ifndef _LINUX_IOPORT_H
9 #define _LINUX_IOPORT_H
12 #include <linux/compiler.h>
13 #include <linux/types.h>
29 #define IORESOURCE_BITS 0x000000ff
31 #define IORESOURCE_TYPE_BITS 0x00001f00
32 #define IORESOURCE_IO 0x00000100
33 #define IORESOURCE_MEM 0x00000200
34 #define IORESOURCE_REG 0x00000300
35 #define IORESOURCE_IRQ 0x00000400
36 #define IORESOURCE_DMA 0x00000800
37 #define IORESOURCE_BUS 0x00001000
39 #define IORESOURCE_PREFETCH 0x00002000
40 #define IORESOURCE_READONLY 0x00004000
41 #define IORESOURCE_CACHEABLE 0x00008000
42 #define IORESOURCE_RANGELENGTH 0x00010000
43 #define IORESOURCE_SHADOWABLE 0x00020000
45 #define IORESOURCE_SIZEALIGN 0x00040000
46 #define IORESOURCE_STARTALIGN 0x00080000
48 #define IORESOURCE_MEM_64 0x00100000
49 #define IORESOURCE_WINDOW 0x00200000
50 #define IORESOURCE_MUXED 0x00400000
52 #define IORESOURCE_EXCLUSIVE 0x08000000
53 #define IORESOURCE_DISABLED 0x10000000
54 #define IORESOURCE_UNSET 0x20000000
55 #define IORESOURCE_AUTO 0x40000000
56 #define IORESOURCE_BUSY 0x80000000
59 #define IORESOURCE_IRQ_HIGHEDGE (1<<0)
60 #define IORESOURCE_IRQ_LOWEDGE (1<<1)
61 #define IORESOURCE_IRQ_HIGHLEVEL (1<<2)
62 #define IORESOURCE_IRQ_LOWLEVEL (1<<3)
63 #define IORESOURCE_IRQ_SHAREABLE (1<<4)
64 #define IORESOURCE_IRQ_OPTIONAL (1<<5)
67 #define IORESOURCE_DMA_TYPE_MASK (3<<0)
68 #define IORESOURCE_DMA_8BIT (0<<0)
69 #define IORESOURCE_DMA_8AND16BIT (1<<0)
70 #define IORESOURCE_DMA_16BIT (2<<0)
72 #define IORESOURCE_DMA_MASTER (1<<2)
73 #define IORESOURCE_DMA_BYTE (1<<3)
74 #define IORESOURCE_DMA_WORD (1<<4)
76 #define IORESOURCE_DMA_SPEED_MASK (3<<6)
77 #define IORESOURCE_DMA_COMPATIBLE (0<<6)
78 #define IORESOURCE_DMA_TYPEA (1<<6)
79 #define IORESOURCE_DMA_TYPEB (2<<6)
80 #define IORESOURCE_DMA_TYPEF (3<<6)
83 #define IORESOURCE_MEM_WRITEABLE (1<<0)
84 #define IORESOURCE_MEM_CACHEABLE (1<<1)
85 #define IORESOURCE_MEM_RANGELENGTH (1<<2)
86 #define IORESOURCE_MEM_TYPE_MASK (3<<3)
87 #define IORESOURCE_MEM_8BIT (0<<3)
88 #define IORESOURCE_MEM_16BIT (1<<3)
89 #define IORESOURCE_MEM_8AND16BIT (2<<3)
90 #define IORESOURCE_MEM_32BIT (3<<3)
91 #define IORESOURCE_MEM_SHADOWABLE (1<<5)
92 #define IORESOURCE_MEM_EXPANSIONROM (1<<6)
95 #define IORESOURCE_IO_16BIT_ADDR (1<<0)
96 #define IORESOURCE_IO_FIXED (1<<1)
99 #define IORESOURCE_ROM_ENABLE (1<<0)
100 #define IORESOURCE_ROM_SHADOW (1<<1)
101 #define IORESOURCE_ROM_COPY (1<<2)
102 #define IORESOURCE_ROM_BIOS_COPY (1<<3)
105 #define IORESOURCE_PCI_FIXED (1<<4)
109 #define DEFINE_RES_NAMED(_start, _size, _name, _flags) \
112 .end = (_start) + (_size) - 1, \
117 #define DEFINE_RES_IO_NAMED(_start, _size, _name) \
118 DEFINE_RES_NAMED((_start), (_size), (_name), IORESOURCE_IO)
119 #define DEFINE_RES_IO(_start, _size) \
120 DEFINE_RES_IO_NAMED((_start), (_size), NULL)
122 #define DEFINE_RES_MEM_NAMED(_start, _size, _name) \
123 DEFINE_RES_NAMED((_start), (_size), (_name), IORESOURCE_MEM)
124 #define DEFINE_RES_MEM(_start, _size) \
125 DEFINE_RES_MEM_NAMED((_start), (_size), NULL)
127 #define DEFINE_RES_IRQ_NAMED(_irq, _name) \
128 DEFINE_RES_NAMED((_irq), 1, (_name), IORESOURCE_IRQ)
129 #define DEFINE_RES_IRQ(_irq) \
130 DEFINE_RES_IRQ_NAMED((_irq), NULL)
132 #define DEFINE_RES_DMA_NAMED(_dma, _name) \
133 DEFINE_RES_NAMED((_dma), 1, (_name), IORESOURCE_DMA)
134 #define DEFINE_RES_DMA(_dma) \
135 DEFINE_RES_DMA_NAMED((_dma), NULL)
174 #define request_region(start,n,name) __request_region(&ioport_resource, (start), (n), (name), 0)
175 #define request_muxed_region(start,n,name) __request_region(&ioport_resource, (start), (n), (name), IORESOURCE_MUXED)
176 #define __request_mem_region(start,n,name, excl) __request_region(&iomem_resource, (start), (n), (name), excl)
177 #define request_mem_region(start,n,name) __request_region(&iomem_resource, (start), (n), (name), 0)
178 #define request_mem_region_exclusive(start,n,name) \
179 __request_region(&iomem_resource, (start), (n), (name), IORESOURCE_EXCLUSIVE)
180 #define rename_region(region, newname) do { (region)->name = (newname); } while (0)
188 #define release_region(start,n) __release_region(&ioport_resource, (start), (n))
189 #define check_mem_region(start,n) __check_region(&iomem_resource, (start), (n))
190 #define release_mem_region(start,n) __release_region(&iomem_resource, (start), (n))
204 #define devm_request_region(dev,start,n,name) \
205 __devm_request_region(dev, &ioport_resource, (start), (n), (name))
206 #define devm_request_mem_region(dev,start,n,name) \
207 __devm_request_region(dev, &iomem_resource, (start), (n), (name))
213 #define devm_release_region(dev, start, n) \
214 __devm_release_region(dev, &ioport_resource, (start), (n))
215 #define devm_release_mem_region(dev, start, n) \
216 __devm_release_region(dev, &iomem_resource, (start), (n))
225 void *
arg,
int (*
func)(
unsigned long,
unsigned long,
void *));