xref: /xnu-12377.81.4/iokit/IOKit/OSMessageNotification.h (revision 043036a2b3718f7f0be807e2870f8f47d3fa0796)
1*043036a2SApple OSS Distributions /*
2*043036a2SApple OSS Distributions  * Copyright (c) 1998-2000 Apple Computer, Inc. All rights reserved.
3*043036a2SApple OSS Distributions  *
4*043036a2SApple OSS Distributions  * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
5*043036a2SApple OSS Distributions  *
6*043036a2SApple OSS Distributions  * This file contains Original Code and/or Modifications of Original Code
7*043036a2SApple OSS Distributions  * as defined in and that are subject to the Apple Public Source License
8*043036a2SApple OSS Distributions  * Version 2.0 (the 'License'). You may not use this file except in
9*043036a2SApple OSS Distributions  * compliance with the License. The rights granted to you under the License
10*043036a2SApple OSS Distributions  * may not be used to create, or enable the creation or redistribution of,
11*043036a2SApple OSS Distributions  * unlawful or unlicensed copies of an Apple operating system, or to
12*043036a2SApple OSS Distributions  * circumvent, violate, or enable the circumvention or violation of, any
13*043036a2SApple OSS Distributions  * terms of an Apple operating system software license agreement.
14*043036a2SApple OSS Distributions  *
15*043036a2SApple OSS Distributions  * Please obtain a copy of the License at
16*043036a2SApple OSS Distributions  * http://www.opensource.apple.com/apsl/ and read it before using this file.
17*043036a2SApple OSS Distributions  *
18*043036a2SApple OSS Distributions  * The Original Code and all software distributed under the License are
19*043036a2SApple OSS Distributions  * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
20*043036a2SApple OSS Distributions  * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
21*043036a2SApple OSS Distributions  * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
22*043036a2SApple OSS Distributions  * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
23*043036a2SApple OSS Distributions  * Please see the License for the specific language governing rights and
24*043036a2SApple OSS Distributions  * limitations under the License.
25*043036a2SApple OSS Distributions  *
26*043036a2SApple OSS Distributions  * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
27*043036a2SApple OSS Distributions  */
28*043036a2SApple OSS Distributions /*
29*043036a2SApple OSS Distributions  * Copyright (c) 1999 Apple Computer, Inc.  All rights reserved.
30*043036a2SApple OSS Distributions  *
31*043036a2SApple OSS Distributions  * HISTORY
32*043036a2SApple OSS Distributions  *
33*043036a2SApple OSS Distributions  */
34*043036a2SApple OSS Distributions 
35*043036a2SApple OSS Distributions #ifndef __OS_OSMESSAGENOTIFICATION_H
36*043036a2SApple OSS Distributions #define __OS_OSMESSAGENOTIFICATION_H
37*043036a2SApple OSS Distributions 
38*043036a2SApple OSS Distributions #ifdef __cplusplus
39*043036a2SApple OSS Distributions extern "C" {
40*043036a2SApple OSS Distributions #endif
41*043036a2SApple OSS Distributions 
42*043036a2SApple OSS Distributions #include <mach/mach_types.h>
43*043036a2SApple OSS Distributions #include <device/device_types.h>
44*043036a2SApple OSS Distributions #include <IOKit/IOReturn.h>
45*043036a2SApple OSS Distributions 
46*043036a2SApple OSS Distributions enum {
47*043036a2SApple OSS Distributions 	kFirstIOKitNotificationType                 = 100,
48*043036a2SApple OSS Distributions 	kIOServicePublishNotificationType           = 100,
49*043036a2SApple OSS Distributions 	kIOServiceMatchedNotificationType           = 101,
50*043036a2SApple OSS Distributions 	kIOServiceTerminatedNotificationType        = 102,
51*043036a2SApple OSS Distributions 	kIOAsyncCompletionNotificationType          = 150,
52*043036a2SApple OSS Distributions 	kIOServiceMessageNotificationType           = 160,
53*043036a2SApple OSS Distributions 	kLastIOKitNotificationType                  = 199,
54*043036a2SApple OSS Distributions 
55*043036a2SApple OSS Distributions 	// reserved bits
56*043036a2SApple OSS Distributions 	kIOKitNoticationTypeMask                    = 0x00000FFF,
57*043036a2SApple OSS Distributions 	kIOKitNoticationTypeSizeAdjShift            = 30,
58*043036a2SApple OSS Distributions 	kIOKitNoticationMsgSizeMask                 = 3,
59*043036a2SApple OSS Distributions };
60*043036a2SApple OSS Distributions 
61*043036a2SApple OSS Distributions enum {
62*043036a2SApple OSS Distributions 	kOSNotificationMessageID            = 53,
63*043036a2SApple OSS Distributions 	kOSAsyncCompleteMessageID           = 57,
64*043036a2SApple OSS Distributions 	kMaxAsyncArgs                       = 16
65*043036a2SApple OSS Distributions };
66*043036a2SApple OSS Distributions 
67*043036a2SApple OSS Distributions enum {
68*043036a2SApple OSS Distributions 	kIOAsyncReservedIndex       = 0,
69*043036a2SApple OSS Distributions 	kIOAsyncReservedCount,
70*043036a2SApple OSS Distributions 
71*043036a2SApple OSS Distributions 	kIOAsyncCalloutFuncIndex    = kIOAsyncReservedCount,
72*043036a2SApple OSS Distributions 	kIOAsyncCalloutRefconIndex,
73*043036a2SApple OSS Distributions 	kIOAsyncCalloutCount,
74*043036a2SApple OSS Distributions 
75*043036a2SApple OSS Distributions 	kIOMatchingCalloutFuncIndex = kIOAsyncReservedCount,
76*043036a2SApple OSS Distributions 	kIOMatchingCalloutRefconIndex,
77*043036a2SApple OSS Distributions 	kIOMatchingCalloutCount,
78*043036a2SApple OSS Distributions 
79*043036a2SApple OSS Distributions 	kIOInterestCalloutFuncIndex = kIOAsyncReservedCount,
80*043036a2SApple OSS Distributions 	kIOInterestCalloutRefconIndex,
81*043036a2SApple OSS Distributions 	kIOInterestCalloutServiceIndex,
82*043036a2SApple OSS Distributions 	kIOInterestCalloutCount
83*043036a2SApple OSS Distributions };
84*043036a2SApple OSS Distributions 
85*043036a2SApple OSS Distributions 
86*043036a2SApple OSS Distributions 
87*043036a2SApple OSS Distributions // --------------
88*043036a2SApple OSS Distributions enum {
89*043036a2SApple OSS Distributions 	kOSAsyncRef64Count  = 8,
90*043036a2SApple OSS Distributions 	kOSAsyncRef64Size   = kOSAsyncRef64Count * ((int) sizeof(io_user_reference_t))
91*043036a2SApple OSS Distributions };
92*043036a2SApple OSS Distributions typedef io_user_reference_t OSAsyncReference64[kOSAsyncRef64Count];
93*043036a2SApple OSS Distributions 
94*043036a2SApple OSS Distributions struct OSNotificationHeader64 {
95*043036a2SApple OSS Distributions 	mach_msg_size_t     size;       /* content size */
96*043036a2SApple OSS Distributions 	natural_t           type;
97*043036a2SApple OSS Distributions 	OSAsyncReference64  reference;
98*043036a2SApple OSS Distributions 
99*043036a2SApple OSS Distributions #if defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L)
100*043036a2SApple OSS Distributions 	unsigned char       content[];
101*043036a2SApple OSS Distributions #else
102*043036a2SApple OSS Distributions 	unsigned char       content[0];
103*043036a2SApple OSS Distributions #endif
104*043036a2SApple OSS Distributions };
105*043036a2SApple OSS Distributions 
106*043036a2SApple OSS Distributions #pragma pack(4)
107*043036a2SApple OSS Distributions struct IOServiceInterestContent64 {
108*043036a2SApple OSS Distributions 	natural_t           messageType;
109*043036a2SApple OSS Distributions 	io_user_reference_t messageArgument[1];
110*043036a2SApple OSS Distributions };
111*043036a2SApple OSS Distributions #pragma pack()
112*043036a2SApple OSS Distributions // --------------
113*043036a2SApple OSS Distributions 
114*043036a2SApple OSS Distributions #if !KERNEL_USER32
115*043036a2SApple OSS Distributions 
116*043036a2SApple OSS Distributions enum {
117*043036a2SApple OSS Distributions 	kOSAsyncRefCount    = 8,
118*043036a2SApple OSS Distributions 	kOSAsyncRefSize     = 32
119*043036a2SApple OSS Distributions };
120*043036a2SApple OSS Distributions typedef natural_t OSAsyncReference[kOSAsyncRefCount] __kernel_ptr_semantics;
121*043036a2SApple OSS Distributions 
122*043036a2SApple OSS Distributions struct OSNotificationHeader {
123*043036a2SApple OSS Distributions 	mach_msg_size_t     size;       /* content size */
124*043036a2SApple OSS Distributions 	natural_t           type;
125*043036a2SApple OSS Distributions 	OSAsyncReference    reference;
126*043036a2SApple OSS Distributions 
127*043036a2SApple OSS Distributions #if defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L)
128*043036a2SApple OSS Distributions 	unsigned char       content[];
129*043036a2SApple OSS Distributions #else
130*043036a2SApple OSS Distributions 	unsigned char       content[0];
131*043036a2SApple OSS Distributions #endif
132*043036a2SApple OSS Distributions };
133*043036a2SApple OSS Distributions 
134*043036a2SApple OSS Distributions #pragma pack(4)
135*043036a2SApple OSS Distributions struct IOServiceInterestContent {
136*043036a2SApple OSS Distributions 	natural_t   messageType;
137*043036a2SApple OSS Distributions 	void *      messageArgument[1];
138*043036a2SApple OSS Distributions };
139*043036a2SApple OSS Distributions #pragma pack()
140*043036a2SApple OSS Distributions 
141*043036a2SApple OSS Distributions #endif /* KERNEL_USER32  */
142*043036a2SApple OSS Distributions 
143*043036a2SApple OSS Distributions struct IOAsyncCompletionContent {
144*043036a2SApple OSS Distributions 	IOReturn result;
145*043036a2SApple OSS Distributions #if defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L)
146*043036a2SApple OSS Distributions 	void * args[] __attribute__ ((packed));
147*043036a2SApple OSS Distributions #else
148*043036a2SApple OSS Distributions 	void * args[0] __attribute__ ((packed));
149*043036a2SApple OSS Distributions #endif
150*043036a2SApple OSS Distributions };
151*043036a2SApple OSS Distributions 
152*043036a2SApple OSS Distributions #ifndef __cplusplus
153*043036a2SApple OSS Distributions typedef struct OSNotificationHeader OSNotificationHeader;
154*043036a2SApple OSS Distributions typedef struct IOServiceInterestContent IOServiceInterestContent;
155*043036a2SApple OSS Distributions typedef struct IOAsyncCompletionContent IOAsyncCompletionContent;
156*043036a2SApple OSS Distributions #endif
157*043036a2SApple OSS Distributions 
158*043036a2SApple OSS Distributions #ifdef __cplusplus
159*043036a2SApple OSS Distributions }
160*043036a2SApple OSS Distributions #endif
161*043036a2SApple OSS Distributions 
162*043036a2SApple OSS Distributions #endif /*  __OS_OSMESSAGENOTIFICATION_H */
163