Import 2.3.15pre2
[davej-history.git] / include / linux / ioport.h
blob555ebdf1dda2e8030b4015e3a74e2b78f036b6e7
1 /*
2 * ioport.h Definitions of routines for detecting, reserving and
3 * allocating system resources.
5 * Authors: Linus Torvalds
6 */
8 #ifndef _LINUX_IOPORT_H
9 #define _LINUX_IOPORT_H
12 * Resources are tree-like, allowing
13 * nesting etc..
15 struct resource {
16 const char *name;
17 unsigned long start, end;
18 unsigned long flags;
19 struct resource *parent, *sibling, *child;
23 * IO resources have these defined flags.
25 #define IORESOURCE_BITS 0x000000ff /* Bus-specific bits */
27 #define IORESOURCE_IO 0x00000100 /* Resource type */
28 #define IORESOURCE_MEM 0x00000200
29 #define IORESOURCE_IRQ 0x00000400
30 #define IORESOURCE_DMA 0x00000800
32 #define IORESOURCE_PREFETCH 0x00001000 /* No side effects */
33 #define IORESOURCE_READONLY 0x00002000
34 #define IORESOURCE_CACHEABLE 0x00004000
35 #define IORESOURCE_RANGELENGTH 0x00008000
36 #define IORESOURCE_SHADOWABLE 0x00010000
38 #define IORESOURCE_UNSET 0x00020000
39 #define IORESOURCE_AUTO 0x00040000
41 #define IORESOURCE_BUSY 0x80000000 /* Driver has marked this resource busy */
43 /* PC/ISA/whatever - the normal PC address spaces: IO and memory */
44 extern struct resource ioport_resource;
45 extern struct resource iomem_resource;
47 extern int get_resource_list(struct resource *, char *buf, int size);
49 extern int request_resource(struct resource *root, struct resource *new);
50 extern int release_resource(struct resource *new);
52 /* Convenience shorthand with allocation */
53 #define request_region(start,n,name) __request_region(&ioport_resource, (start), (n), (name))
54 extern struct resource * __request_region(struct resource *, unsigned long start, unsigned long n, const char *name);
56 /* Compatibility cruft */
57 #define check_region(start,n) __check_region(&ioport_resource, (start), (n))
58 #define release_region(start,n) __release_region(&ioport_resource, (start), (n))
59 extern int __check_region(struct resource *, unsigned long, unsigned long);
60 extern void __release_region(struct resource *, unsigned long, unsigned long);
62 #define get_ioport_list(buf) get_resource_list(&ioport_resource, buf, PAGE_SIZE)
63 #define get_mem_list(buf) get_resource_list(&iomem_resource, buf, PAGE_SIZE)
65 #define HAVE_AUTOIRQ
66 extern void autoirq_setup(int waittime);
67 extern int autoirq_report(int waittime);
69 #endif /* _LINUX_IOPORT_H */