]> git.saurik.com Git - apple/xnu.git/blame - iokit/Kernel/IOServicePrivate.h
xnu-344.21.73.tar.gz
[apple/xnu.git] / iokit / Kernel / IOServicePrivate.h
CommitLineData
1c79356b
A
1/*
2 * Copyright (c) 1998-2000 Apple Computer, Inc. All rights reserved.
3 *
4 * @APPLE_LICENSE_HEADER_START@
5 *
d7e50217 6 * Copyright (c) 1999-2003 Apple Computer, Inc. All Rights Reserved.
1c79356b 7 *
d7e50217
A
8 * This file contains Original Code and/or Modifications of Original Code
9 * as defined in and that are subject to the Apple Public Source License
10 * Version 2.0 (the 'License'). You may not use this file except in
11 * compliance with the License. Please obtain a copy of the License at
12 * http://www.opensource.apple.com/apsl/ and read it before using this
13 * file.
14 *
15 * The Original Code and all software distributed under the License are
16 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
1c79356b
A
17 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
18 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
d7e50217
A
19 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
20 * Please see the License for the specific language governing rights and
21 * limitations under the License.
1c79356b
A
22 *
23 * @APPLE_LICENSE_HEADER_END@
24 */
25/*
26 * Copyright (c) 1999 Apple Computer, Inc. All rights reserved.
27 *
28 * HISTORY
29 *
30 */
31
32
33#ifndef _IOKIT_IOSERVICEPRIVATE_H
34#define _IOKIT_IOSERVICEPRIVATE_H
35
36// options for getExistingServices()
37enum {
38 kIONotifyOnce = 0x00000001
39};
40
41// masks for __state[1]
42enum {
43 kIOServiceBusyStateMask = 0x000000ff,
44 kIOServiceBusyMax = 255,
0b4e3aa0
A
45 kIOServiceNeedConfigState = 0x80000000,
46 kIOServiceSynchronousState = 0x40000000,
47 kIOServiceModuleStallState = 0x20000000,
48 kIOServiceBusyWaiterState = 0x10000000,
49
50 kIOServiceSyncPubState = 0x08000000,
51 kIOServiceConfigState = 0x04000000,
52 kIOServiceTermPhase2State = 0x01000000,
53 kIOServiceTermPhase3State = 0x00800000,
1c79356b
A
54};
55
56// options for terminate()
57enum {
58 kIOServiceRecursing = 0x00100000,
59};
60
1c79356b
A
61// notify state
62enum {
0b4e3aa0
A
63 kIOServiceNotifyEnable = 0x00000001,
64 kIOServiceNotifyWaiter = 0x00000002
1c79356b
A
65};
66
67struct _IOServiceNotifierInvocation
68{
69 IOThread thread;
70 queue_chain_t link;
71};
72
73class _IOServiceNotifier : public IONotifier
74{
9bccf70c 75 friend class IOService;
1c79356b
A
76
77 OSDeclareDefaultStructors(_IOServiceNotifier)
78
79public:
80 OSOrderedSet * whence;
81
82 OSDictionary * matching;
83 IOServiceNotificationHandler handler;
84 void * target;
85 void * ref;
86 SInt32 priority;
87 queue_head_t handlerInvocations;
88 IOOptionBits state;
89
90 virtual void free();
91 virtual void remove();
92 virtual bool disable();
93 virtual void enable( bool was );
94 virtual void wait();
95};
96
97class _IOServiceInterestNotifier : public IONotifier
98{
9bccf70c 99 friend class IOService;
1c79356b
A
100
101 OSDeclareDefaultStructors(_IOServiceInterestNotifier)
102
103public:
104 OSArray * whence;
105
106 IOServiceInterestHandler handler;
107 void * target;
108 void * ref;
109 queue_head_t handlerInvocations;
110 IOOptionBits state;
111
112 virtual void free();
113 virtual void remove();
114 virtual bool disable();
115 virtual void enable( bool was );
116 virtual void wait();
117};
118
119class _IOConfigThread : public OSObject
120{
9bccf70c 121 friend class IOService;
1c79356b
A
122
123 OSDeclareDefaultStructors(_IOConfigThread)
124
125public:
126 IOThread thread;
127
128 virtual void free();
129
130 static _IOConfigThread * configThread( void );
131 static void main( _IOConfigThread * self );
132};
133
134enum {
135#ifdef LESS_THREAD_CREATE
136 kMaxConfigThreads = 4,
137#else
138 kMaxConfigThreads = 32,
139#endif
140};
141
142enum {
143 kMatchNubJob = 10,
1c79356b
A
144};
145
146class _IOServiceJob : public OSObject
147{
9bccf70c 148 friend class IOService;
1c79356b
A
149
150 OSDeclareDefaultStructors(_IOServiceJob)
151
152public:
153 int type;
154 IOService * nub;
155 IOOptionBits options;
156
157 static _IOServiceJob * startJob( IOService * nub, int type,
158 IOOptionBits options = 0 );
159 static void pingConfig( class _IOServiceJob * job );
160
161};
162
163class IOResources : public IOService
164{
9bccf70c 165 friend class IOService;
1c79356b
A
166
167 OSDeclareDefaultStructors(IOResources)
168
169public:
170 static IOService * resources( void );
171 virtual IOWorkLoop * getWorkLoop( ) const;
172 virtual bool matchPropertyTable( OSDictionary * table );
9bccf70c 173 virtual IOReturn setProperties( OSObject * properties );
1c79356b
A
174};
175
176class _IOOpenServiceIterator : public OSIterator
177{
9bccf70c 178 friend class IOService;
1c79356b
A
179
180 OSDeclareDefaultStructors(_IOOpenServiceIterator)
181
182 OSIterator * iter;
183 const IOService * client;
184 const IOService * provider;
185 IOService * last;
186
187public:
188 static OSIterator * iterator( OSIterator * _iter,
189 const IOService * client,
190 const IOService * provider );
191 virtual void free();
192 virtual void reset();
193 virtual bool isValid();
194 virtual OSObject * getNextObject();
195};
196
197#endif /* ! _IOKIT_IOSERVICEPRIVATE_H */
198