FreeBSD/Linux Kernel Cross Reference
sys/device/conf.h
1 /*
2 * Mach Operating System
3 * Copyright (c) 1991,1990,1989 Carnegie Mellon University
4 * All Rights Reserved.
5 *
6 * Permission to use, copy, modify and distribute this software and its
7 * documentation is hereby granted, provided that both the copyright
8 * notice and this permission notice appear in all copies of the
9 * software, derivative works or modified versions, and any portions
10 * thereof, and that both notices appear in supporting documentation.
11 *
12 * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
13 * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
14 * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
15 *
16 * Carnegie Mellon requests users of this software to return to
17 *
18 * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
19 * School of Computer Science
20 * Carnegie Mellon University
21 * Pittsburgh PA 15213-3890
22 *
23 * any improvements or extensions that they make and grant Carnegie Mellon
24 * the rights to redistribute these changes.
25 */
26 /*
27 * HISTORY
28 * $Log: conf.h,v $
29 * Revision 2.6 93/05/17 16:23:23 rvb
30 * Since map's return vm_offset_t's, we need a "nomap()" that does
31 * so also, to keep the type system happy.
32 * [93/05/17 rvb]
33 *
34 * Revision 2.5 93/02/05 07:50:17 danner
35 * The map function really returns a phys address.
36 * [93/02/04 01:54:45 af]
37 *
38 * Revision 2.4 91/08/28 11:11:12 jsb
39 * Change block size entry to general device info entry.
40 * [91/08/12 17:24:37 dlb]
41 *
42 * Add block size entry. Only needed for block_io devices.
43 * [91/08/05 17:28:42 dlb]
44 *
45 * Revision 2.3 91/05/14 15:39:57 mrt
46 * Correcting copyright
47 *
48 * Revision 2.2 91/02/05 17:08:10 mrt
49 * Changed to new Mach copyright
50 * [91/01/31 17:26:55 mrt]
51 *
52 * Revision 2.1 89/08/03 15:26:07 rwd
53 * Created.
54 *
55 * 12-May-89 David Golub (dbg) at Carnegie-Mellon University
56 * Added indirect devices.
57 *
58 * 12-Apr-89 David Golub (dbg) at Carnegie-Mellon University
59 * Added port_death routine.
60 *
61 * 24-Aug-88 David Golub (dbg) at Carnegie-Mellon University
62 * Created.
63 *
64 */
65 /*
66 * Author: David B. Golub, Carnegie Mellon University
67 * Date: 8/88
68 */
69
70 #ifndef _CONF_
71 #define _CONF_
72
73 /*
74 * Operations list for major device types.
75 */
76 struct dev_ops {
77 char * d_name; /* name for major device */
78 int (*d_open)(); /* open device */
79 int (*d_close)(); /* close device */
80 int (*d_read)(); /* read */
81 int (*d_write)(); /* write */
82 int (*d_getstat)(); /* get status/control */
83 int (*d_setstat)(); /* set status/control */
84 vm_offset_t (*d_mmap)(); /* map memory */
85 int (*d_async_in)();/* asynchronous input setup */
86 int (*d_reset)(); /* reset device */
87 int (*d_port_death)();
88 /* clean up reply ports */
89 int d_subdev; /* number of sub-devices per
90 unit */
91 int (*d_dev_info)(); /* driver info for kernel */
92 };
93 typedef struct dev_ops *dev_ops_t;
94
95 /*
96 * Routines for null entries.
97 */
98 extern int nulldev(); /* no operation - OK */
99 extern int nodev(); /* no operation - error */
100 extern vm_offset_t nomap(); /* no operation - error */
101
102 /*
103 * Flavor constants for d_dev_info routine
104 */
105 #define D_INFO_BLOCK_SIZE 1
106
107 /*
108 * Head of list of attached devices
109 */
110 extern struct dev_ops dev_name_list[];
111 extern int dev_name_count;
112
113 /*
114 * Macro to search device list
115 */
116 #define dev_search(dp) \
117 for (dp = dev_name_list; \
118 dp < &dev_name_list[dev_name_count]; \
119 dp++)
120
121 /*
122 * Indirection vectors for certain devices.
123 */
124 struct dev_indirect {
125 char * d_name; /* name for device */
126 dev_ops_t d_ops; /* operations (major device) */
127 int d_unit; /* and unit number */
128 };
129 typedef struct dev_indirect *dev_indirect_t;
130
131 /*
132 * List of indirect devices.
133 */
134 extern struct dev_indirect dev_indirect_list[];
135 extern int dev_indirect_count;
136
137 /*
138 * Macro to search indirect list
139 */
140 #define dev_indirect_search(di) \
141 for (di = dev_indirect_list; \
142 di < &dev_indirect_list[dev_indirect_count]; \
143 di++)
144
145 /*
146 * Exported routine to set indirection.
147 */
148 extern void dev_set_indirect();
149
150 #endif _CONF_
Cache object: 3ee506fb1305b73c4d3081d84525194d
|