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