1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
|
/*
* Mach Operating System
* Copyright (c) 1991,1990,1989 Carnegie Mellon University
* All Rights Reserved.
*
* Permission to use, copy, modify and distribute this software and its
* documentation is hereby granted, provided that both the copyright
* notice and this permission notice appear in all copies of the
* software, derivative works or modified versions, and any portions
* thereof, and that both notices appear in supporting documentation.
*
* CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
* CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
* ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
*
* Carnegie Mellon requests users of this software to return to
*
* Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
* School of Computer Science
* Carnegie Mellon University
* Pittsburgh PA 15213-3890
*
* any improvements or extensions that they make and grant Carnegie Mellon
* the rights to redistribute these changes.
*/
/*
* File: device/device.defs
* Author: Douglas Orr
* Feb 10, 1988
* Abstract:
* Mach device support. Mach devices are accessed through
* block and character device interfaces to the kernel.
*/
#ifdef MACH_KERNEL
simport <kern/compat_xxx_defs.h>; /* for obsolete routines */
#endif
subsystem
#if KERNEL_SERVER
KernelServer
#endif
device 2800;
#include <mach/std_types.defs>
#include <mach/mach_types.defs>
#include <device/device_types.defs>
serverprefix ds_;
type pci_config_data_t = array[*:4] of char;
type reply_port_t = MACH_MSG_TYPE_MAKE_SEND_ONCE | polymorphic
ctype: mach_port_t;
routine device_open(
master_port : mach_port_t;
sreplyport reply_port : reply_port_t;
mode : dev_mode_t;
name : dev_name_t;
out device : device_t
);
routine device_close(
device : device_t
);
routine device_write(
device : device_t;
sreplyport reply_port : reply_port_t;
in mode : dev_mode_t;
in recnum : recnum_t;
in data : io_buf_ptr_t;
out bytes_written : int
);
routine device_write_inband(
device : device_t;
sreplyport reply_port : reply_port_t;
in mode : dev_mode_t;
in recnum : recnum_t;
in data : io_buf_ptr_inband_t;
out bytes_written : int
);
routine device_read(
device : device_t;
sreplyport reply_port : reply_port_t;
in mode : dev_mode_t;
in recnum : recnum_t;
in bytes_wanted : int;
out data : io_buf_ptr_t
);
routine device_read_inband(
device : device_t;
sreplyport reply_port : reply_port_t;
in mode : dev_mode_t;
in recnum : recnum_t;
in bytes_wanted : int;
out data : io_buf_ptr_inband_t
);
/* obsolete */
routine xxx_device_set_status(
device : device_t;
in flavor : dev_flavor_t;
in status : dev_status_t, IsLong
);
/* obsolete */
routine xxx_device_get_status(
device : device_t;
in flavor : dev_flavor_t;
out status : dev_status_t, IsLong
);
/* obsolete */
routine xxx_device_set_filter(
device : device_t;
in receive_port : mach_port_send_t;
in priority : int;
in filter : filter_array_t, IsLong
);
routine device_map(
device : device_t;
in prot : vm_prot_t;
in offset : vm_offset_t;
in size : vm_size_t;
out pager : memory_object_t;
in unmap : int
);
routine device_set_status(
device : device_t;
in flavor : dev_flavor_t;
in status : dev_status_t
);
routine device_get_status(
device : device_t;
in flavor : dev_flavor_t;
out status : dev_status_t, CountInOut
);
routine device_set_filter(
device : device_t;
in receive_port : mach_port_send_t;
in priority : int;
in filter : filter_array_t
);
routine device_intr_notify(
master_port : mach_port_t;
in irq : int;
in id : int;
in receive_port : mach_port_send_t
);
/*
* Test whether IPC devices exist.
*/
routine pci_present(
master_port : mach_port_t);
/*
* Find the specified PCI device.
*/
routine pci_find_device(
master_port : mach_port_t;
vendor : short;
device_id : short;
index : short;
out bus : char;
out device_fn : char);
/*
* Read the configuration space of a IPC device.
*/
routine pci_read_config(
master_port : mach_port_t;
bus : char;
device_fn : char;
where : char;
bytes_wanted : int;
out result : pci_config_data_t);
/*
* Write the configuration space of a IPC device.
*/
routine pci_write_config(
master_port : mach_port_t;
bus : char;
device_fn : char;
where : char;
data : pci_config_data_t);
/*
* enable/disable the specified irq.
*/
routine device_irq_enable(
master_port : mach_port_t;
irq : int;
status : char);
|