1d7cd6603SJérôme Duval/*
2d7cd6603SJérôme Duval * driver_ops.h 1.17 2001/10/04 03:15:22
3d7cd6603SJérôme Duval *
4d7cd6603SJérôme Duval * The contents of this file are subject to the Mozilla Public License
5d7cd6603SJérôme Duval * Version 1.1 (the "License"); you may not use this file except in
6d7cd6603SJérôme Duval * compliance with the License. You may obtain a copy of the License
7d7cd6603SJérôme Duval * at http://www.mozilla.org/MPL/
8d7cd6603SJérôme Duval *
9d7cd6603SJérôme Duval * Software distributed under the License is distributed on an "AS IS"
10d7cd6603SJérôme Duval * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
11d7cd6603SJérôme Duval * the License for the specific language governing rights and
12d7cd6603SJérôme Duval * limitations under the License.
13d7cd6603SJérôme Duval *
14d7cd6603SJérôme Duval * The initial developer of the original code is David A. Hinds
15d7cd6603SJérôme Duval * <dahinds@users.sourceforge.net>.  Portions created by David A. Hinds
16d7cd6603SJérôme Duval * are Copyright (C) 1999 David A. Hinds.  All Rights Reserved.
17d7cd6603SJérôme Duval *
18d7cd6603SJérôme Duval * Alternatively, the contents of this file may be used under the
19d7cd6603SJérôme Duval * terms of the GNU General Public License version 2 (the "GPL"), in
20d7cd6603SJérôme Duval * which case the provisions of the GPL are applicable instead of the
21d7cd6603SJérôme Duval * above.  If you wish to allow the use of your version of this file
22d7cd6603SJérôme Duval * only under the terms of the GPL and not to allow others to use
23d7cd6603SJérôme Duval * your version of this file under the MPL, indicate your decision by
24d7cd6603SJérôme Duval * deleting the provisions above and replace them with the notice and
25d7cd6603SJérôme Duval * other provisions required by the GPL.  If you do not delete the
26d7cd6603SJérôme Duval * provisions above, a recipient may use your version of this file
27d7cd6603SJérôme Duval * under either the MPL or the GPL.
28d7cd6603SJérôme Duval */
29d7cd6603SJérôme Duval
30d7cd6603SJérôme Duval#ifndef _LINUX_DRIVER_OPS_H
31d7cd6603SJérôme Duval#define _LINUX_DRIVER_OPS_H
32d7cd6603SJérôme Duval
33d7cd6603SJérôme Duval#ifndef DEV_NAME_LEN
34d7cd6603SJérôme Duval#define DEV_NAME_LEN	32
35d7cd6603SJérôme Duval#endif
36d7cd6603SJérôme Duval
37d7cd6603SJérôme Duval#ifdef __KERNEL__
38d7cd6603SJérôme Duval
39d7cd6603SJérôme Duvaltypedef struct dev_node_t {
40d7cd6603SJérôme Duval    char		dev_name[DEV_NAME_LEN];
41d7cd6603SJérôme Duval    u_short		major, minor;
42d7cd6603SJérôme Duval    struct dev_node_t	*next;
43d7cd6603SJérôme Duval} dev_node_t;
44d7cd6603SJérôme Duval
45d7cd6603SJérôme Duvaltypedef struct dev_locator_t {
46d7cd6603SJérôme Duval    enum { LOC_ISA, LOC_PCI } bus;
47d7cd6603SJérôme Duval    union {
48d7cd6603SJérôme Duval	struct {
49d7cd6603SJérôme Duval	    u_short	io_base_1, io_base_2;
50d7cd6603SJérôme Duval	    u_long	mem_base;
51d7cd6603SJérôme Duval	    u_char	irq, dma;
52d7cd6603SJérôme Duval	} isa;
53d7cd6603SJérôme Duval	struct {
54d7cd6603SJérôme Duval	    u_char	bus;
55d7cd6603SJérôme Duval	    u_char	devfn;
56d7cd6603SJérôme Duval	} pci;
57d7cd6603SJérôme Duval    } b;
58d7cd6603SJérôme Duval} dev_locator_t;
59d7cd6603SJérôme Duval
60d7cd6603SJérôme Duvaltypedef struct driver_operations {
61d7cd6603SJérôme Duval    char		*name;
62d7cd6603SJérôme Duval    dev_node_t		*(*attach) (dev_locator_t *loc);
63d7cd6603SJérôme Duval    void		(*suspend) (dev_node_t *dev);
64d7cd6603SJérôme Duval    void		(*resume) (dev_node_t *dev);
65d7cd6603SJérôme Duval    void		(*detach) (dev_node_t *dev);
66d7cd6603SJérôme Duval} driver_operations;
67d7cd6603SJérôme Duval
68d7cd6603SJérôme Duvalint register_driver(struct driver_operations *ops);
69d7cd6603SJérôme Duvalvoid unregister_driver(struct driver_operations *ops);
70d7cd6603SJérôme Duval
71d7cd6603SJérôme Duval#endif /* __KERNEL__ */
72d7cd6603SJérôme Duval
73d7cd6603SJérôme Duval#endif /* _LINUX_DRIVER_OPS_H */
74