1/*
2 * Copyright (c) 1998-2000 Apple Computer, Inc. All rights reserved.
3 *
4 * @APPLE_OSREFERENCE_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. The rights granted to you under the License
10 * may notificationused to create, or enable the creation or redistribution of,
11 * unlawful or unlicensed copies of an Apple operating system, or to
12 * circumvent, violate, or enable the circumvention or violation of, any
13 * terms of an Apple operating system software license agreement.
14 *
15 * Please obtain a copy of the License at
16 * http://www.opensource.apple.com/apsl/ and read it before using this file.
17 *
18 * The Original Code and all software distributed under the License are
19 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
20 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
21 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
22 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
23 * Please see the License for the specific language governing rights and
24 * limitations under the License.
25 *
26 * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
27 */
28
29#ifndef __IOKIT_IOMESSAGE_H
30#define __IOKIT_IOMESSAGE_H
31
32#include <IOKit/IOReturn.h>
33#include <IOKit/IOTypes.h>
34
35/*!
36 * @header IOMessage.h
37 *
38 * Defines message type constants for several IOKit messaging API's.
39 *
40 */
41
42typedef UInt32 IOMessage;
43
44#define iokit_common_msg(message)          (UInt32)(sys_iokit|sub_iokit_common|message)
45#define iokit_family_msg(sub,message)      (UInt32)(sys_iokit|sub|message)
46
47/*!
48 * @defined         iokit_vendor_specific_msg
49 * @discussion      iokit_vendor_specific_msg passes messages in the sub_iokit_vendor_specific
50 *                  subsystem. It can be used to generate messages that are used for private
51 *                  communication between vendor specific code with the IOService::message() etc. APIs.
52 */
53#define iokit_vendor_specific_msg(message) (UInt32)(sys_iokit|sub_iokit_vendor_specific|message)
54
55#define kIOMessageServiceIsTerminated      iokit_common_msg(0x010)
56#define kIOMessageServiceIsSuspended       iokit_common_msg(0x020)
57#define kIOMessageServiceIsResumed         iokit_common_msg(0x030)
58
59#define kIOMessageServiceIsRequestingClose iokit_common_msg(0x100)
60#define kIOMessageServiceIsAttemptingOpen  iokit_common_msg(0x101)
61#define kIOMessageServiceWasClosed         iokit_common_msg(0x110)
62
63#define kIOMessageServiceBusyStateChange   iokit_common_msg(0x120)
64
65#define kIOMessageConsoleSecurityChange    iokit_common_msg(0x128)
66
67#define kIOMessageServicePropertyChange    iokit_common_msg(0x130)
68
69#define kIOMessageCopyClientID             iokit_common_msg(0x330)
70
71#define kIOMessageSystemCapabilityChange   iokit_common_msg(0x340)
72#define kIOMessageDeviceSignaledWakeup     iokit_common_msg(0x350)
73
74
75/*!
76 * @defined         kIOMessageDeviceWillPowerOff
77 * @discussion      Indicates the device is about to move to a lower power state.
78 *                  Sent to IOKit interest notification clients of type <code>kIOAppPowerStateInterest</code>
79 *                  and <code>kIOGeneralInterest</code>.
80 */
81#define kIOMessageDeviceWillPowerOff       iokit_common_msg(0x210)
82
83/*!
84 * @defined         kIOMessageDeviceHasPoweredOn
85 * @discussion      Indicates the device has just moved to a higher power state.
86 *                  Sent to IOKit interest notification clients of type <code>kIOAppPowerStateInterest</code>
87 *                  and <code>kIOGeneralInterest</code>.
88 */
89#define kIOMessageDeviceHasPoweredOn       iokit_common_msg(0x230)
90
91/*! @group          In-kernel system shutdown and restart notifications
92 */
93
94/*!
95 * @defined         kIOMessageSystemWillPowerOff
96 * @discussion      Indicates an imminent system shutdown. Recipients have a limited
97 *                  amount of time to respond, otherwise the system will timeout and
98 *                  shutdown even without a response.
99 *                  Delivered to in-kernel IOKit drivers via <code>IOService::systemWillShutdown()</code>,
100 *                  and to clients of <code>registerPrioritySleepWakeInterest()</code>.
101 *                  Never delivered to user space notification clients.
102 */
103#define kIOMessageSystemWillPowerOff       iokit_common_msg(0x250)
104
105/*!
106 * @defined         kIOMessageSystemWillRestart
107 * @discussion      Indicates an imminent system restart. Recipients have a limited
108 *                  amount of time to respond, otherwise the system will timeout and
109 *                  restart even without a response.
110 *                  Delivered to in-kernel IOKit drivers via <code>IOService::systemWillShutdown()</code>,
111 *                  and to clients of <code>registerPrioritySleepWakeInterest()</code>.
112 *                  Never delivered to user space notification clients.
113 */
114#define kIOMessageSystemWillRestart        iokit_common_msg(0x310)
115
116/*!
117 * @defined         kIOMessageSystemPagingOff
118 * @discussion      Indicates an imminent system shutdown, paging device now unavailable.
119 *					Recipients have a limited amount of time to respond, otherwise the
120 *					system will timeout and shutdown even without a response.
121 *                  Delivered to clients of <code>registerPrioritySleepWakeInterest()</code>.
122 *                  Never delivered to user space notification clients.
123 */
124#define kIOMessageSystemPagingOff       iokit_common_msg(0x255)
125
126
127/*! @group          System sleep and wake notifications
128 */
129
130/*!
131 * @defined         kIOMessageCanSystemSleep
132 * @discussion      Announces/Requests permission to proceed to system sleep.
133 *                  Delivered to in-kernel IOKit drivers via <code>kIOGeneralInterest</code>
134 *                  and <code>kIOPriorityPowerStateInterest</code>.
135 *                  Delivered to user clients of <code>IORegisterForSystemPower</code>.
136 */
137#define kIOMessageCanSystemSleep           iokit_common_msg(0x270)
138
139/*!
140 * @defined         kIOMessageSystemWillNotSleep
141 * @discussion      Announces that the system has retracted a previous attempt to sleep;
142 *                  it follows <code>kIOMessageCanSystemSleep</code>.
143 *                  Delivered to in-kernel IOKit drivers via <code>kIOGeneralInterest</code>
144 *                  and <code>kIOPriorityPowerStateInterest</code>.
145 *                  Delivered to user clients of <code>IORegisterForSystemPower</code>.
146 */
147#define kIOMessageSystemWillNotSleep       iokit_common_msg(0x290)
148
149/*!
150 * @defined         kIOMessageSystemWillSleep
151 * @discussion      Announces that sleep is beginning.
152 *                  Delivered to in-kernel IOKit drivers via <code>kIOGeneralInterest</code>
153 *                  and <code>kIOPriorityPowerStateInterest</code>.
154 *                  Delivered to user clients of <code>IORegisterForSystemPower</code>.
155 */
156#define kIOMessageSystemWillSleep          iokit_common_msg(0x280)
157
158/*!
159 * @defined         kIOMessageSystemWillPowerOn
160 * @discussion      Announces that the system is beginning to power the device tree; most
161 *                  devices are unavailable at this point..
162 *                  Delivered to in-kernel IOKit drivers via <code>kIOGeneralInterest</code>
163 *                  and <code>kIOPriorityPowerStateInterest</code>.
164 *                  Delivered to user clients of <code>IORegisterForSystemPower</code>.
165 */
166#define kIOMessageSystemWillPowerOn        iokit_common_msg(0x320)
167
168/*!
169 * @defined         kIOMessageSystemHasPoweredOn
170 * @discussion      Announces that the system and its devices have woken up.
171 *                  Delivered to in-kernel IOKit drivers via <code>kIOGeneralInterest</code>
172 *                  and <code>kIOPriorityPowerStateInterest</code>.
173 *                  Delivered to user clients of <code>IORegisterForSystemPower</code>.
174 */
175#define kIOMessageSystemHasPoweredOn       iokit_common_msg(0x300)
176
177/*! @group          Unused and deprecated notifications
178 */
179
180/*!
181 * @defined         kIOMessageCanDevicePowerOff
182 * @discussion      Delivered to <code>kIOAppPowerStateInterest</code> clients of
183 *                  devices that implement their own idle timeouts.
184 *                  This message type is almost never used.
185 */
186#define kIOMessageCanDevicePowerOff        iokit_common_msg(0x200)
187
188/*!
189 * @defined         kIOMessageDeviceWillNotPowerOff
190 * @discussion      This IOKit interest notification is largely unused;
191 *                  it's not very interesting.
192 */
193#define kIOMessageDeviceWillNotPowerOff    iokit_common_msg(0x220)
194
195/*!
196 * @defined         kIOMessageSystemWillNotPowerOff
197 * @deprecated      This IOKit message is unused.
198 */
199#define kIOMessageSystemWillNotPowerOff    iokit_common_msg(0x260)
200
201/*!
202 * @defined         kIOMessageCanSystemPowerOff
203 * @deprecated      This IOKit message is unused.
204 */
205#define kIOMessageCanSystemPowerOff        iokit_common_msg(0x240)
206
207/*!
208 * @defined         kIOMessageDeviceWillPowerOn
209 * @discussion      IOService power mgt does not send kIOMessageDeviceWillPowerOn.
210 */
211#define kIOMessageDeviceWillPowerOn        iokit_common_msg(0x215)
212
213/*!
214 * @defined         kIOMessageDeviceHasPoweredOff
215 * @discussion      IOService power mgt does not send kIOMessageDeviceHasPoweredOff.
216 */
217#define kIOMessageDeviceHasPoweredOff      iokit_common_msg(0x225)
218
219
220#endif /* ! __IOKIT_IOMESSAGE_H */
221