aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/ioport.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/linux/ioport.h')
-rw-r--r--include/linux/ioport.h31
1 files changed, 31 insertions, 0 deletions
diff --git a/include/linux/ioport.h b/include/linux/ioport.h
index e9bb22cba764..9d57a71775b5 100644
--- a/include/linux/ioport.h
+++ b/include/linux/ioport.h
@@ -109,6 +109,36 @@ struct resource_list {
109/* PCI control bits. Shares IORESOURCE_BITS with above PCI ROM. */ 109/* PCI control bits. Shares IORESOURCE_BITS with above PCI ROM. */
110#define IORESOURCE_PCI_FIXED (1<<4) /* Do not move resource */ 110#define IORESOURCE_PCI_FIXED (1<<4) /* Do not move resource */
111 111
112
113/* helpers to define resources */
114#define DEFINE_RES_NAMED(_start, _size, _name, _flags) \
115 { \
116 .start = (_start), \
117 .end = (_start) + (_size) - 1, \
118 .name = (_name), \
119 .flags = (_flags), \
120 }
121
122#define DEFINE_RES_IO_NAMED(_start, _size, _name) \
123 DEFINE_RES_NAMED((_start), (_size), (_name), IORESOURCE_IO)
124#define DEFINE_RES_IO(_start, _size) \
125 DEFINE_RES_IO_NAMED((_start), (_size), NULL)
126
127#define DEFINE_RES_MEM_NAMED(_start, _size, _name) \
128 DEFINE_RES_NAMED((_start), (_size), (_name), IORESOURCE_MEM)
129#define DEFINE_RES_MEM(_start, _size) \
130 DEFINE_RES_MEM_NAMED((_start), (_size), NULL)
131
132#define DEFINE_RES_IRQ_NAMED(_irq, _name) \
133 DEFINE_RES_NAMED((_irq), 1, (_name), IORESOURCE_IRQ)
134#define DEFINE_RES_IRQ(_irq) \
135 DEFINE_RES_IRQ_NAMED((_irq), NULL)
136
137#define DEFINE_RES_DMA_NAMED(_dma, _name) \
138 DEFINE_RES_NAMED((_dma), 1, (_name), IORESOURCE_DMA)
139#define DEFINE_RES_DMA(_dma) \
140 DEFINE_RES_DMA_NAMED((_dma), NULL)
141
112/* PC/ISA/whatever - the normal PC address spaces: IO and memory */ 142/* PC/ISA/whatever - the normal PC address spaces: IO and memory */
113extern struct resource ioport_resource; 143extern struct resource ioport_resource;
114extern struct resource iomem_resource; 144extern struct resource iomem_resource;
@@ -132,6 +162,7 @@ extern int allocate_resource(struct resource *root, struct resource *new,
132 resource_size_t, 162 resource_size_t,
133 resource_size_t), 163 resource_size_t),
134 void *alignf_data); 164 void *alignf_data);
165struct resource *lookup_resource(struct resource *root, resource_size_t start);
135int adjust_resource(struct resource *res, resource_size_t start, 166int adjust_resource(struct resource *res, resource_size_t start,
136 resource_size_t size); 167 resource_size_t size);
137resource_size_t resource_alignment(struct resource *res); 168resource_size_t resource_alignment(struct resource *res);