]> git.saurik.com Git - apple/xnu.git/blob - iokit/Kernel/IOServicePrivate.h
xnu-344.49.tar.gz
[apple/xnu.git] / iokit / Kernel / IOServicePrivate.h
1 /*
2 * Copyright (c) 1998-2000 Apple Computer, Inc. All rights reserved.
3 *
4 * @APPLE_LICENSE_HEADER_START@
5 *
6 * Copyright (c) 1999-2003 Apple Computer, Inc. All Rights Reserved.
7 *
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
17 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
18 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
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.
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()
37 enum {
38 kIONotifyOnce = 0x00000001
39 };
40
41 // masks for __state[1]
42 enum {
43 kIOServiceBusyStateMask = 0x000000ff,
44 kIOServiceBusyMax = 255,
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,
54 };
55
56 // options for terminate()
57 enum {
58 kIOServiceRecursing = 0x00100000,
59 };
60
61 // notify state
62 enum {
63 kIOServiceNotifyEnable = 0x00000001,
64 kIOServiceNotifyWaiter = 0x00000002
65 };
66
67 struct _IOServiceNotifierInvocation
68 {
69 IOThread thread;
70 queue_chain_t link;
71 };
72
73 class _IOServiceNotifier : public IONotifier
74 {
75 friend class IOService;
76
77 OSDeclareDefaultStructors(_IOServiceNotifier)
78
79 public:
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
97 class _IOServiceInterestNotifier : public IONotifier
98 {
99 friend class IOService;
100
101 OSDeclareDefaultStructors(_IOServiceInterestNotifier)
102
103 public:
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
119 class _IOConfigThread : public OSObject
120 {
121 friend class IOService;
122
123 OSDeclareDefaultStructors(_IOConfigThread)
124
125 public:
126 IOThread thread;
127
128 virtual void free();
129
130 static _IOConfigThread * configThread( void );
131 static void main( _IOConfigThread * self );
132 };
133
134 enum {
135 #ifdef LESS_THREAD_CREATE
136 kMaxConfigThreads = 4,
137 #else
138 kMaxConfigThreads = 32,
139 #endif
140 };
141
142 enum {
143 kMatchNubJob = 10,
144 };
145
146 class _IOServiceJob : public OSObject
147 {
148 friend class IOService;
149
150 OSDeclareDefaultStructors(_IOServiceJob)
151
152 public:
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
163 class IOResources : public IOService
164 {
165 friend class IOService;
166
167 OSDeclareDefaultStructors(IOResources)
168
169 public:
170 static IOService * resources( void );
171 virtual IOWorkLoop * getWorkLoop( ) const;
172 virtual bool matchPropertyTable( OSDictionary * table );
173 virtual IOReturn setProperties( OSObject * properties );
174 };
175
176 class _IOOpenServiceIterator : public OSIterator
177 {
178 friend class IOService;
179
180 OSDeclareDefaultStructors(_IOOpenServiceIterator)
181
182 OSIterator * iter;
183 const IOService * client;
184 const IOService * provider;
185 IOService * last;
186
187 public:
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