patch-2.3.11 linux/include/linux/ioport.h

Next file: linux/include/linux/kernel_stat.h
Previous file: linux/include/linux/file.h
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.3.10/linux/include/linux/ioport.h linux/include/linux/ioport.h
@@ -2,56 +2,45 @@
  * ioport.h	Definitions of routines for detecting, reserving and
  *		allocating system resources.
  *
- * Authors:	Donald Becker (becker@cesdis.gsfc.nasa.gov)
- *		David Hinds (dhinds@zen.stanford.edu)
+ * Authors:	Linus Torvalds
  */
 
 #ifndef _LINUX_IOPORT_H
 #define _LINUX_IOPORT_H
 
-#define RES_IO		0
-#define RES_MEM		1
+/*
+ * Resources are tree-like, allowing
+ * nesting etc..
+ */
+struct resource {
+	const char *name;
+	unsigned long start, end;
+	unsigned long flags;
+	struct resource *parent, *sibling, *child;
+};
+
+/* PC/ISA/whatever - the normal PC address spaces: IO and memory */
+extern struct resource ioport_resource;
+extern struct resource iomem_resource;
 
 extern void reserve_setup(char *str, int *ints);
+extern int get_resource_list(struct resource *, char *buf, int size);
 
-extern struct resource_entry *iolist, *memlist;
-
-extern int get_resource_list(int class, char *buf);
-extern int check_resource(int class,
-			  unsigned long from, unsigned long extent);
-extern void request_resource(int class,
-			     unsigned long from, unsigned long extent,
-			     const char *name);
-extern void release_resource(int class,
-			     unsigned long from, unsigned long extent);
-extern unsigned long occupy_resource(int class,
-				     unsigned long base, unsigned long end,
-				     unsigned long num, unsigned long align,
-				     const char *name);
-extern void vacate_resource(int class,
-			    unsigned long from, unsigned long extent);
+extern int request_resource(struct resource *root, struct resource *new);
+extern int release_resource(struct resource *new);
 
-#define get_ioport_list(buf)	get_resource_list(RES_IO, buf)
-#define get_mem_list(buf)	get_resource_list(RES_MEM, buf)
+/* Convenience shorthand with allocation */
+#define request_region(start,n,name)	__request_region(&ioport_resource, (start), (n), (name))
+extern struct resource * __request_region(struct resource *, unsigned long start, unsigned long n, const char *name);
+
+/* Compatibility cruft */
+#define check_region(start,n)	__check_region(&ioport_resource, (start), (n))
+#define release_region(start,n)	__release_region(&ioport_resource, (start), (n))
+extern int __check_region(struct resource *, unsigned long, unsigned long);
+extern void __release_region(struct resource *, unsigned long, unsigned long);
 
-#define HAVE_PORTRESERVE
-/*
- * Call check_region() before probing for your hardware.
- * Once you have found you hardware, register it with request_region().
- * If you unload the driver, use release_region to free ports.
- */
-#define check_region(f,e)		check_resource(RES_IO,f,e)
-#define request_region(f,e,n)		request_resource(RES_IO,f,e,n)
-#define release_region(f,e)		release_resource(RES_IO,f,e)
-#define occupy_region(b,e,n,a,s)	occupy_resource(RES_IO,b,e,n,a,s)
-#define vacate_region(f,e)		vacate_resource(RES_IO,f,e)
-
-#define HAVE_MEMRESERVE
-#define check_mem_region(f,e)		check_resource(RES_MEM,f,e)
-#define request_mem_region(f,e,n)	request_resource(RES_MEM,f,e,n)
-#define release_mem_region(f,e)		release_resource(RES_MEM,f,e)
-#define occupy_mem_region(b,e,n,a,s)	occupy_resource(RES_MEM,b,e,n,a,s)
-#define vacate_mem_region(f,e)		vacate_resource(RES_MEM,f,e)
+#define get_ioport_list(buf)	get_resource_list(&ioport_resource, buf, PAGE_SIZE)
+#define get_mem_list(buf)	get_resource_list(&iomem_resource, buf, PAGE_SIZE)
 
 #define HAVE_AUTOIRQ
 extern void autoirq_setup(int waittime);

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)