2 * Copyright (c) 1998-2012 Apple Computer, Inc. All rights reserved.
4 * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
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 not be used 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.
15 * Please obtain a copy of the License at
16 * http://www.opensource.apple.com/apsl/ and read it before using this file.
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.
26 * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
28 #ifndef __IOKIT_IOTYPES_H
29 #define __IOKIT_IOTYPES_H
31 #ifndef PLATFORM_DriverKit
38 #include <IOKit/system.h>
40 #include <mach/message.h>
41 #include <mach/vm_types.h>
44 #include <IOKit/IOReturn.h>
51 #if defined (__cplusplus)
52 #ifdef XNU_KERNEL_PRIVATE
55 #if __cplusplus >= 201103L && (defined(__arm__) || defined(__arm64__))
62 #define NULL ((void *)0)
70 #include <libkern/OSTypes.h>
73 #include <libkern/OSBase.h>
76 typedef UInt32 IOOptionBits
;
77 typedef SInt32 IOFixed
;
78 typedef UInt32 IOVersion
;
79 typedef UInt32 IOItemCount
;
80 typedef UInt32 IOCacheMode
;
82 typedef UInt32 IOByteCount32
;
83 typedef UInt64 IOByteCount64
;
85 typedef UInt32 IOPhysicalAddress32
;
86 typedef UInt64 IOPhysicalAddress64
;
87 typedef UInt32 IOPhysicalLength32
;
88 typedef UInt64 IOPhysicalLength64
;
90 #if !defined(__arm__) && !defined(__i386__)
91 typedef mach_vm_address_t IOVirtualAddress
;
93 typedef vm_address_t IOVirtualAddress
;
96 #if !defined(__arm__) && !defined(__i386__) && !(defined(__x86_64__) && !defined(KERNEL)) && !(defined(__arm64__) && !defined(__LP64__))
97 typedef IOByteCount64 IOByteCount
;
99 typedef IOByteCount32 IOByteCount
;
102 typedef IOVirtualAddress IOLogicalAddress
;
104 #if !defined(__arm__) && !defined(__i386__) && !(defined(__x86_64__) && !defined(KERNEL))
106 typedef IOPhysicalAddress64 IOPhysicalAddress
;
107 typedef IOPhysicalLength64 IOPhysicalLength
;
108 #define IOPhysical32( hi, lo ) ((UInt64) lo + ((UInt64)(hi) << 32))
109 #define IOPhysSize 64
113 typedef IOPhysicalAddress32 IOPhysicalAddress
;
114 typedef IOPhysicalLength32 IOPhysicalLength
;
115 #define IOPhysical32( hi, lo ) (lo)
116 #define IOPhysSize 32
122 IOPhysicalAddress address
;
127 IOVirtualAddress address
;
131 #if !defined(__arm__) && !defined(__i386__)
132 typedef IOVirtualRange IOAddressRange
;
135 mach_vm_address_t address
;
136 mach_vm_size_t length
;
141 * Map between #defined or enum'd constants and text description.
150 * Memory alignment -- specified as a power of two.
152 typedef unsigned int IOAlignment
;
154 #define IO_NULL_VM_TASK ((vm_task_t)0)
158 * Pull in machine specific stuff.
161 //#include <IOKit/machine/IOTypes.h>
165 #ifndef __IOKIT_PORTS_DEFINED__
166 #define __IOKIT_PORTS_DEFINED__
170 typedef OSObject
* io_object_t
;
172 typedef struct OSObject
* io_object_t
;
175 typedef mach_port_t io_object_t
;
177 #endif /* __IOKIT_PORTS_DEFINED__ */
179 #include <device/device_types.h>
181 typedef io_object_t io_connect_t
;
182 typedef io_object_t io_enumerator_t
;
183 typedef io_object_t io_iterator_t
;
184 typedef io_object_t io_registry_entry_t
;
185 typedef io_object_t io_service_t
;
186 typedef io_object_t uext_object_t
;
188 #define IO_OBJECT_NULL ((io_object_t) 0)
190 #endif /* MACH_KERNEL */
192 // IOConnectMapMemory memoryTypes
194 kIODefaultMemoryType
= 0
200 kIOWriteThruCache
= 2,
201 kIOCopybackCache
= 3,
202 kIOWriteCombineCache
= 4,
203 kIOCopybackInnerCache
= 5,
205 kIORealTimeCache
= 7,
206 kIOPostedReordered
= 8,
209 // IOMemory mapping options
211 kIOMapAnywhere
= 0x00000001,
213 kIOMapCacheMask
= 0x00000f00,
214 kIOMapCacheShift
= 8,
215 kIOMapDefaultCache
= kIODefaultCache
<< kIOMapCacheShift
,
216 kIOMapInhibitCache
= kIOInhibitCache
<< kIOMapCacheShift
,
217 kIOMapWriteThruCache
= kIOWriteThruCache
<< kIOMapCacheShift
,
218 kIOMapCopybackCache
= kIOCopybackCache
<< kIOMapCacheShift
,
219 kIOMapWriteCombineCache
= kIOWriteCombineCache
<< kIOMapCacheShift
,
220 kIOMapCopybackInnerCache
= kIOCopybackInnerCache
<< kIOMapCacheShift
,
221 kIOMapPostedWrite
= kIOPostedWrite
<< kIOMapCacheShift
,
222 kIOMapRealTimeCache
= kIORealTimeCache
<< kIOMapCacheShift
,
223 kIOMapPostedReordered
= kIOPostedReordered
<< kIOMapCacheShift
,
225 kIOMapUserOptionsMask
= 0x00000fff,
227 kIOMapReadOnly
= 0x00001000,
229 kIOMapStatic
= 0x01000000,
230 kIOMapReference
= 0x02000000,
231 kIOMapUnique
= 0x04000000,
232 #ifdef XNU_KERNEL_PRIVATE
233 kIOMap64Bit
= 0x08000000,
235 kIOMapPrefault
= 0x10000000,
236 kIOMapOverwrite
= 0x20000000
239 /*! @enum Scale Factors
240 * @discussion Used when a scale_factor parameter is required to define a unit of time.
241 * @constant kNanosecondScale Scale factor for nanosecond based times.
242 * @constant kMicrosecondScale Scale factor for microsecond based times.
243 * @constant kMillisecondScale Scale factor for millisecond based times.
244 * @constant kTickScale Scale factor for the standard (100Hz) tick.
245 * @constant kSecondScale Scale factor for second based times. */
248 kNanosecondScale
= 1,
249 kMicrosecondScale
= 1000,
250 kMillisecondScale
= 1000 * 1000,
251 kSecondScale
= 1000 * 1000 * 1000,
252 kTickScale
= (kSecondScale
/ 100)
256 kIOConnectMethodVarOutputSize
= -3
259 /* compatibility types */
263 typedef unsigned int IODeviceNumber
;
271 #else /* !PLATFORM_DriverKit */
275 typedef uint32_t IOOptionBits
;
276 typedef int32_t IOFixed
;
277 typedef uint32_t IOVersion
;
278 typedef uint32_t IOItemCount
;
279 typedef uint32_t IOCacheMode
;
281 typedef uint32_t IOByteCount32
;
282 typedef uint64_t IOByteCount64
;
283 typedef IOByteCount64 IOByteCount
;
285 typedef uint32_t IOPhysicalAddress32
;
286 typedef uint64_t IOPhysicalAddress64
;
287 typedef uint32_t IOPhysicalLength32
;
288 typedef uint64_t IOPhysicalLength64
;
290 typedef IOPhysicalAddress64 IOPhysicalAddress
;
291 typedef IOPhysicalLength64 IOPhysicalLength
;
293 typedef uint64_t IOVirtualAddress
;
295 #endif /* PLATFORM_DriverKit */
297 #endif /* ! __IOKIT_IOTYPES_H */