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