FreeBSD/Linux Kernel Cross Reference
sys/device/conf.h
1 /*
2 * Mach Operating System
3 * Copyright (c) 1993,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.7 93/11/17 16:31:00 dbg
30 * Added include of mach/machine/vm_types.h to get vm_offset_t.
31 * [93/05/21 dbg]
32 *
33 * Revision 2.6 93/05/17 16:23:23 rvb
34 * Since maps return vm_offset_t's, we need a "nomap()" that does
35 * so also, to keep the type system happy.
36 * [93/05/17 rvb]
37 *
38 * Revision 2.5 93/02/05 07:50:17 danner
39 * The map function really returns a phys address.
40 * [93/02/04 01:54:45 af]
41 *
42 * Revision 2.4 91/08/28 11:11:12 jsb
43 * Change block size entry to general device info entry.
44 * [91/08/12 17:24:37 dlb]
45 *
46 * Add block size entry. Only needed for block_io devices.
47 * [91/08/05 17:28:42 dlb]
48 *
49 * Revision 2.3 91/05/14 15:39:57 mrt
50 * Correcting copyright
51 *
52 * Revision 2.2 91/02/05 17:08:10 mrt
53 * Changed to new Mach copyright
54 * [91/01/31 17:26:55 mrt]
55 *
56 * Revision 2.1 89/08/03 15:26:07 rwd
57 * Created.
58 *
59 * 12-May-89 David Golub (dbg) at Carnegie-Mellon University
60 * Added indirect devices.
61 *
62 * 12-Apr-89 David Golub (dbg) at Carnegie-Mellon University
63 * Added port_death routine.
64 *
65 * 24-Aug-88 David Golub (dbg) at Carnegie-Mellon University
66 * Created.
67 *
68 */
69 /*
70 * Author: David B. Golub, Carnegie Mellon University
71 * Date: 8/88
72 */
73
74 #ifndef _DEVICE_CONF_H_
75 #define _DEVICE_CONF_H_
76
77 #include <mach/machine/vm_types.h>
78
79 /*
80 * Operations list for major device types.
81 */
82 struct dev_ops {
83 char * d_name; /* name for major device */
84 int (*d_open)(); /* open device */
85 int (*d_close)(); /* close device */
86 int (*d_read)(); /* read */
87 int (*d_write)(); /* write */
88 int (*d_getstat)(); /* get status/control */
89 int (*d_setstat)(); /* set status/control */
90 vm_offset_t (*d_mmap)(); /* map memory */
91 int (*d_async_in)();/* asynchronous input setup */
92 int (*d_reset)(); /* reset device */
93 int (*d_port_death)();
94 /* clean up reply ports */
95 int d_subdev; /* number of sub-devices per
96 unit */
97 int (*d_dev_info)(); /* driver info for kernel */
98 };
99 typedef struct dev_ops *dev_ops_t;
100
101 /*
102 * Routines for null entries.
103 */
104 extern int nulldev(); /* no operation - OK */
105 extern int nodev(); /* no operation - error */
106 extern vm_offset_t nomap(); /* no operation - error */
107
108 /*
109 * Flavor constants for d_dev_info routine
110 */
111 #define D_INFO_BLOCK_SIZE 1
112
113 /*
114 * Head of list of attached devices
115 */
116 extern struct dev_ops dev_name_list[];
117 extern int dev_name_count;
118
119 /*
120 * Macro to search device list
121 */
122 #define dev_search(dp) \
123 for (dp = dev_name_list; \
124 dp < &dev_name_list[dev_name_count]; \
125 dp++)
126
127 /*
128 * Indirection vectors for certain devices.
129 */
130 struct dev_indirect {
131 char * d_name; /* name for device */
132 dev_ops_t d_ops; /* operations (major device) */
133 int d_unit; /* and unit number */
134 };
135 typedef struct dev_indirect *dev_indirect_t;
136
137 /*
138 * List of indirect devices.
139 */
140 extern struct dev_indirect dev_indirect_list[];
141 extern int dev_indirect_count;
142
143 /*
144 * Macro to search indirect list
145 */
146 #define dev_indirect_search(di) \
147 for (di = dev_indirect_list; \
148 di < &dev_indirect_list[dev_indirect_count]; \
149 di++)
150
151 /*
152 * Exported routine to set indirection.
153 */
154 extern void dev_set_indirect();
155
156 #endif /* _DEVICE_CONF_H_ */
157
Cache object: a72033874ae0d7617a1795bc068379f1
|