|
|
1.1 root 1: /*
2: * Copyright (c) 1999 Apple Computer, Inc. All rights reserved.
3: *
4: * @APPLE_LICENSE_HEADER_START@
5: *
6: * Portions Copyright (c) 1999 Apple Computer, Inc. All Rights
7: * Reserved. This file contains Original Code and/or Modifications of
8: * Original Code as defined in and that are subject to the Apple Public
9: * Source License Version 1.1 (the "License"). You may not use this file
10: * except in compliance with the License. Please obtain a copy of the
11: * License at http://www.apple.com/publicsource and read it before using
12: * this file.
13: *
14: * The Original Code and all software distributed under the License are
15: * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
16: * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
17: * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
18: * FITNESS FOR A PARTICULAR PURPOSE OR NON- INFRINGEMENT. Please see the
19: * License for the specific language governing rights and limitations
20: * under the License.
21: *
22: * @APPLE_LICENSE_HEADER_END@
23: */
24: /*
25: * File: libDriver/driverServer.defs
26: *
27: * HISTORY
28: * 19980312 [email protected]
29: * Removed CreateMachPort and added IOServerConnect.
30: * 13-Jan-98 Martin Minow at Apple
31: * Added createMachPort
32: */
33: subsystem
34: #if KERNEL_SERVER && defined(MACH_IPC_FLAVOR)
35: KernelServer
36: #endif KERNEL_SERVER
37: driverServer 2700;
38: serverprefix kern;
39:
40: #include <mach/std_types.defs>
41: #include <mach/mach_types.defs>
42:
43: #ifndef MACH_IPC_FLAVOR
44: type unsigned = int;
45: #endif
46: type u_char = char;
47: type IOChannelCommand = unsigned;
48: type IOChannelEnqueueOption = unsigned;
49: type IOChannelDequeueOption = unsigned;
50: type IODMADirection = unsigned;
51: type IODescriptorCommand = char;
52: type IODMAStatus = int;
53: type IOUserStatus = char;
54: type IODeviceNumber = unsigned;
55: type IOObjectNumber = unsigned;
56: type IOSlotId = unsigned;
57: type IODeviceType = unsigned;
58: type BOOL = char;
59: type IOString = array[80] of char;
60: type IOParameterName = array[64] of char;
61: type IOIntParameter = array[*:512] of int;
62: type IOCharParameter = array[*:512] of char;
63: type IOByteParameter = array[*:2048] of char;
64: type IOCache = int;
65: type IOConfigData = array[*:4096] of char;
66:
67: /*
68: * This type is needed to allow intran function of device ports.
69: */
70: type IODevicePort = port_t
71: intran: kernDevice_p convert_port_to_dev(IODevicePort)
72: ;
73:
74: import <driverkit/driverTypes.h>;
75: import <driverkit/driverTypesPrivate.h>;
76: simport <driverkit/driverServerXXX.h>;
77:
78: skip;
79: skip;
80: skip;
81: skip;
82: skip;
83: skip;
84: skip;
85: skip;
86: skip;
87: skip;
88: skip;
89: skip;
90: skip;
91: skip;
92: skip;
93: skip;
94: skip;
95: skip;
96:
97: /*
98: * Lookup device by IOObjectNumber.
99: */
100: routine _IOLookupByObjectNumber(
101: device_master : host_t;
102: in objectNumber : IOObjectNumber;
103: out deviceKind : IOString;
104: out deviceName : IOString);
105:
106: /*
107: * Lookup device by IOUnitName.
108: */
109: routine _IOLookupByDeviceName(
110: device_master : host_t;
111: in deviceName : IOString;
112: out objectNumber : IOObjectNumber;
113: out deviceKind : IOString);
114:
115: /*
116: * Get/set parameter RPCs.
117: */
118:
119: routine _IOGetIntValues(
120: device_master : host_t;
121: in objectNumber : IOObjectNumber;
122: in parameterName : IOParameterName;
123: in maxCount : unsigned;
124: out parameterArray : IOIntParameter);
125:
126: routine _IOGetCharValues(
127: device_master : host_t;
128: in objectNumber : IOObjectNumber;
129: in parameterName : IOParameterName;
130: in maxCount : unsigned;
131: out parameterArray : IOCharParameter);
132:
133: routine _IOSetIntValues(
134: device_master : host_priv_t;
135: in objectNumber : IOObjectNumber;
136: in parameterName : IOParameterName;
137: in parameterArray : IOIntParameter);
138:
139: routine _IOSetCharValues(
140: device_master : host_priv_t;
141: in objectNumber : IOObjectNumber;
142: in parameterName : IOParameterName;
143: in parameterArray : IOCharParameter);
144:
145: #if defined(ppc)
146:
147: type IOPPCMemoryRange = struct[2] of int; /* IORange */
148: type IOPPCMemoryMap = array[*:4] of IOPPCMemoryRange;
149: type IOPPCInterruptList = array[*:7] of int;
150:
151: /*
152: ** Return the configuration information for the device.
153: */
154: routine _IOGetDeviceConfig(
155: device : IODevicePort;
156: out intr_conf : IOPPCInterruptList;
157: out mem_conf : IOPPCMemoryMap);
158:
159: skip; /* was _IOMapLockShmem */
160: skip; /* was _IOUnMapLockShmem */
161:
162: /*
163: ** Map the indicated device memory mapped region into the task address space.
164: ** The phys parameter is the physical address of the region.
165: ** To unmap, use vm_deallocate().
166: */
167: routine _IOMapDeviceMemory(
168: device : IODevicePort;
169: in target_task : task_t;
170: in phys : vm_offset_t;
171: in length : vm_size_t;
172: inout addr : vm_offset_t;
173: in anywhere : BOOL;
174: in cache : IOCache);
175:
176: #elif defined(i386)
177: /*
178: * These are EISA specific calls.
179: */
180:
181: type IOEISAPortRange = struct[2] of int;
182: type IOEISAMemoryRange = struct[2] of int;
183: type IOEISAInterrupt = struct[1] of int;
184: type IOEISADMAChannel = struct[1] of int;
185:
186: type IOEISAPortMap = array[*:20] of IOEISAPortRange;
187: type IOEISAMemoryMap = array[*:9] of IOEISAMemoryRange;
188: type IOEISAInterruptList = array[*:7] of IOEISAInterrupt;
189: type IOEISADMAChannelList = array[*:4] of IOEISADMAChannel;
190:
191: /*
192: * Return the EISA configuration
193: * information for the device.
194: */
195:
196: routine _IOGetEISADeviceConfig(
197: device : IODevicePort;
198: out intr_conf : IOEISAInterruptList;
199: out dma_conf : IOEISADMAChannelList;
200: out io_conf : IOEISAPortMap;
201: out phys_conf : IOEISAMemoryMap);
202:
203: /*
204: * Enable *ALL* of the IO registers
205: * for the device so that the thread
206: * can access (read and write) them.
207: */
208:
209: routine _IOMapEISADevicePorts(
210: device : IODevicePort;
211: in thread : thread_t);
212:
213: /*
214: * Revoke access to the IO registers
215: * for the device so that the thread
216: * can no longer access them. Note:
217: * destroying a thread accomplishes this
218: * automatically.
219: */
220:
221: routine _IOUnMapEISADevicePorts(
222: device : IODevicePort;
223: in thread : thread_t);
224:
225: /*
226: * Map the indicated device memory mapped
227: * region into the task address space. The
228: * phys parameter is the physical address of
229: * the region. To unmap, use vm_deallocate().
230: */
231:
232: routine _IOMapEISADeviceMemory(
233: device : IODevicePort;
234: in target_task : task_t;
235: in phys : vm_offset_t;
236: in length : vm_size_t;
237: inout addr : vm_offset_t;
238: in anywhere : BOOL;
239: in cache : IOCache);
240:
241: #elif defined(hppa)
242:
243: type IOHPPAMemoryRange = struct[2] of int; /* IORange */
244: type IOHPPAMemoryMap = array[*:4] of IOHPPAMemoryRange;
245: type IOHPPAInterruptList = array[*:7] of int;
246:
247: /*
248: ** Return the configuration information for the device.
249: */
250: routine _IOGetDeviceConfig(
251: device : IODevicePort;
252: out intr_conf : IOHPPAInterruptList;
253: out mem_conf : IOHPPAMemoryMap);
254:
255: routine _IOMapLockShmem(
256: device : IODevicePort;
257: in task : task_t;
258: in size : vm_size_t;
259: inout addr : vm_offset_t );
260:
261: routine _IOUnMapLockShmem(
262: device : IODevicePort;
263: in task : task_t;
264: in size : vm_size_t;
265: in addr : vm_offset_t );
266:
267: /*
268: ** Map the indicated device memory mapped region into the task address space.
269: ** The phys parameter is the physical address of the region.
270: ** To unmap, use vm_deallocate().
271: */
272: routine _IOMapDeviceMemory(
273: device : IODevicePort;
274: in target_task : task_t;
275: in phys : vm_offset_t;
276: in length : vm_size_t;
277: inout addr : vm_offset_t;
278: in anywhere : BOOL;
279: in cache : IOCache);
280:
281: #elif defined(sparc)
282:
283: type IOSPARCMemoryRange = struct[2] of int; /* IORange */
284: type IOSPARCMemoryMap = array[*:4] of IOSPARCMemoryRange;
285: type IOSPARCInterruptList = array[*:7] of int;
286:
287: /*
288: ** Return the configuration information for the device.
289: */
290: routine _IOGetDeviceConfig(
291: device : IODevicePort;
292: out intr_conf : IOSPARCInterruptList;
293: out mem_conf : IOSPARCMemoryMap);
294:
295: routine _IOMapLockShmem(
296: device : IODevicePort;
297: in task : task_t;
298: in size : vm_size_t;
299: inout addr : vm_offset_t );
300:
301: routine _IOUnMapLockShmem(
302: device : IODevicePort;
303: in task : task_t;
304: in size : vm_size_t;
305: in addr : vm_offset_t );
306:
307: /*
308: ** Map the indicated device memory mapped region into the task address space.
309: ** The phys parameter is the physical address of the region.
310: ** To unmap, use vm_deallocate().
311: */
312: routine _IOMapSparcDeviceMemory(
313: device : IODevicePort;
314: in target_task : task_t;
315: in phys : vm_offset_t;
316: in length : vm_size_t;
317: inout addr : vm_offset_t;
318: in anywhere : BOOL;
319: in cache : IOCache);
320:
321:
322: #else
323: skip;
324: skip;
325: skip;
326: skip;
327: #endif
328:
329: skip;
330: skip;
331:
332: /*
333: * Create an IODeviceDescription for the config table data passed in
334: * configData, and probe the appropriate device class. Returns IO_R_SUCCESS
335: * if a driver was successfully instantiated, else returns IO_R_NO_DEVICE.
336: */
337: routine _IOProbeDriver(
338: device_master : host_t;
339: in configTable : IOConfigData);
340:
341: /*
342: * Obtain the current system config table data.
343: */
344: routine _IOGetSystemConfig(
345: device_master : host_t;
346: in maxDataSize : unsigned;
347: out configTable : IOConfigData);
348:
349: /*
350: * Unload a driver.
351: */
352: routine _IOUnloadDriver(
353: device_master : host_t;
354: in configTable : IOConfigData);
355:
356: /*
357: * Get the current config table for driver 'n'.
358: */
359: routine _IOGetDriverConfig(
360: device_master : host_t;
361: in driverNum : unsigned;
362: in maxDataSize : unsigned;
363: out configTable : IOConfigData);
364:
365: type PMReturn = int;
366: type PMDeviceID = struct [2] of short;
367: type PMPowerState = int;
368: type PMPowerEvent = int;
369: type PMPowerStatus = struct [3] of int;
370: type PMPowerManagementState = int;
371:
372: import <kern/power.h>;
373:
374: /*
375: * Set the power state of a device or the entire computer.
376: */
377:
378: routine _PMSetPowerState(
379: host : host_t;
380: in device : PMDeviceID;
381: in state : PMPowerState);
382:
383: routine _PMGetPowerEvent(
384: host : host_t;
385: out event : PMPowerEvent);
386:
387: routine _PMGetPowerStatus(
388: host : host_t;
389: out status : PMPowerStatus);
390:
391: routine _PMSetPowerManagement(
392: host : host_t;
393: device : PMDeviceID;
394: state : PMPowerManagementState);
395:
396: routine _PMRestoreDefaults(
397: host : host_t);
398:
399: routine _IOCallDeviceMethod(
400: device_master : host_priv_t;
401: in objectNumber : IOObjectNumber;
402: in parameterName : IOString;
403: in inputParams : IOByteParameter;
404: inout maxOutput : unsigned;
405: out outputParams : IOByteParameter);
406:
407: routine _IOServerConnect(
408: device_master : host_t;
409: in objectNumber : IOObjectNumber;
410: in clientTask : port_t;
411: out serverPort : port_t);
412:
413: routine _IOLookUpByStringPropertyList (
414: device_master : host_t;
415: in values : IOByteParameter;
416: out results : IOByteParameter;
417: in maxLength : unsigned);
418:
419: routine _IOGetStringPropertyList (
420: device_master : host_t;
421: in objectNumber : IOObjectNumber;
422: in names : IOByteParameter;
423: out results : IOByteParameter;
424: in maxLength : unsigned);
425:
426: routine _IOGetByteProperty (
427: device_master : host_t;
428: in objectNumber : IOObjectNumber;
429: in name : IOByteParameter;
430: out results : IOByteParameter;
431: in maxLength : unsigned);
432:
433:
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.