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