]> git.saurik.com Git - apple/xnu.git/blame - iokit/Kernel/IOServicePrivate.h
xnu-201.19.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 *
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()
34enum {
35 kIONotifyOnce = 0x00000001
36};
37
38// masks for __state[1]
39enum {
40 kIOServiceBusyStateMask = 0x000000ff,
41 kIOServiceBusyMax = 255,
0b4e3aa0
A
42 kIOServiceNeedConfigState = 0x80000000,
43 kIOServiceSynchronousState = 0x40000000,
44 kIOServiceModuleStallState = 0x20000000,
45 kIOServiceBusyWaiterState = 0x10000000,
46
47 kIOServiceSyncPubState = 0x08000000,
48 kIOServiceConfigState = 0x04000000,
49 kIOServiceTermPhase2State = 0x01000000,
50 kIOServiceTermPhase3State = 0x00800000,
1c79356b
A
51};
52
53// options for terminate()
54enum {
55 kIOServiceRecursing = 0x00100000,
56};
57
1c79356b
A
58// notify state
59enum {
0b4e3aa0
A
60 kIOServiceNotifyEnable = 0x00000001,
61 kIOServiceNotifyWaiter = 0x00000002
1c79356b
A
62};
63
64struct _IOServiceNotifierInvocation
65{
66 IOThread thread;
67 queue_chain_t link;
68};
69
70class _IOServiceNotifier : public IONotifier
71{
72 friend IOService;
73
74 OSDeclareDefaultStructors(_IOServiceNotifier)
75
76public:
77 OSOrderedSet * whence;
78
79 OSDictionary * matching;
80 IOServiceNotificationHandler handler;
81 void * target;
82 void * ref;
83 SInt32 priority;
84 queue_head_t handlerInvocations;
85 IOOptionBits state;
86
87 virtual void free();
88 virtual void remove();
89 virtual bool disable();
90 virtual void enable( bool was );
91 virtual void wait();
92};
93
94class _IOServiceInterestNotifier : public IONotifier
95{
96 friend IOService;
97
98 OSDeclareDefaultStructors(_IOServiceInterestNotifier)
99
100public:
101 OSArray * whence;
102
103 IOServiceInterestHandler handler;
104 void * target;
105 void * ref;
106 queue_head_t handlerInvocations;
107 IOOptionBits state;
108
109 virtual void free();
110 virtual void remove();
111 virtual bool disable();
112 virtual void enable( bool was );
113 virtual void wait();
114};
115
116class _IOConfigThread : public OSObject
117{
118 friend IOService;
119
120 OSDeclareDefaultStructors(_IOConfigThread)
121
122public:
123 IOThread thread;
124
125 virtual void free();
126
127 static _IOConfigThread * configThread( void );
128 static void main( _IOConfigThread * self );
129};
130
131enum {
132#ifdef LESS_THREAD_CREATE
133 kMaxConfigThreads = 4,
134#else
135 kMaxConfigThreads = 32,
136#endif
137};
138
139enum {
140 kMatchNubJob = 10,
1c79356b
A
141};
142
143class _IOServiceJob : public OSObject
144{
145 friend IOService;
146
147 OSDeclareDefaultStructors(_IOServiceJob)
148
149public:
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
160class IOResources : public IOService
161{
162 friend IOService;
163
164 OSDeclareDefaultStructors(IOResources)
165
166public:
167 static IOService * resources( void );
168 virtual IOWorkLoop * getWorkLoop( ) const;
169 virtual bool matchPropertyTable( OSDictionary * table );
170};
171
172class _IOOpenServiceIterator : public OSIterator
173{
174 friend IOService;
175
176 OSDeclareDefaultStructors(_IOOpenServiceIterator)
177
178 OSIterator * iter;
179 const IOService * client;
180 const IOService * provider;
181 IOService * last;
182
183public:
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#endif /* ! _IOKIT_IOSERVICEPRIVATE_H */
194