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