xref: /xnu-8020.121.3/iokit/Kernel/i386/IOKeyStoreHelper.cpp (revision fdd8201d7b966f0c3ea610489d29bd841d358941)
1*fdd8201dSApple OSS Distributions /*
2*fdd8201dSApple OSS Distributions  * Copyright (c) 2010 Apple Inc. All rights reserved.
3*fdd8201dSApple OSS Distributions  *
4*fdd8201dSApple OSS Distributions  * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
5*fdd8201dSApple OSS Distributions  *
6*fdd8201dSApple OSS Distributions  * This file contains Original Code and/or Modifications of Original Code
7*fdd8201dSApple OSS Distributions  * as defined in and that are subject to the Apple Public Source License
8*fdd8201dSApple OSS Distributions  * Version 2.0 (the 'License'). You may not use this file except in
9*fdd8201dSApple OSS Distributions  * compliance with the License. The rights granted to you under the License
10*fdd8201dSApple OSS Distributions  * may not be used to create, or enable the creation or redistribution of,
11*fdd8201dSApple OSS Distributions  * unlawful or unlicensed copies of an Apple operating system, or to
12*fdd8201dSApple OSS Distributions  * circumvent, violate, or enable the circumvention or violation of, any
13*fdd8201dSApple OSS Distributions  * terms of an Apple operating system software license agreement.
14*fdd8201dSApple OSS Distributions  *
15*fdd8201dSApple OSS Distributions  * Please obtain a copy of the License at
16*fdd8201dSApple OSS Distributions  * http://www.opensource.apple.com/apsl/ and read it before using this file.
17*fdd8201dSApple OSS Distributions  *
18*fdd8201dSApple OSS Distributions  * The Original Code and all software distributed under the License are
19*fdd8201dSApple OSS Distributions  * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
20*fdd8201dSApple OSS Distributions  * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
21*fdd8201dSApple OSS Distributions  * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
22*fdd8201dSApple OSS Distributions  * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
23*fdd8201dSApple OSS Distributions  * Please see the License for the specific language governing rights and
24*fdd8201dSApple OSS Distributions  * limitations under the License.
25*fdd8201dSApple OSS Distributions  *
26*fdd8201dSApple OSS Distributions  * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
27*fdd8201dSApple OSS Distributions  */
28*fdd8201dSApple OSS Distributions 
29*fdd8201dSApple OSS Distributions #include <sys/cdefs.h>
30*fdd8201dSApple OSS Distributions #include <stdbool.h>
31*fdd8201dSApple OSS Distributions 
32*fdd8201dSApple OSS Distributions #include <IOKit/assert.h>
33*fdd8201dSApple OSS Distributions #include <IOKit/system.h>
34*fdd8201dSApple OSS Distributions #include <IOKit/IOLib.h>
35*fdd8201dSApple OSS Distributions #include <IOKit/IOMemoryDescriptor.h>
36*fdd8201dSApple OSS Distributions #include <IOKit/IOKitDebug.h>
37*fdd8201dSApple OSS Distributions 
38*fdd8201dSApple OSS Distributions __BEGIN_DECLS
39*fdd8201dSApple OSS Distributions 
40*fdd8201dSApple OSS Distributions #include <pexpert/pexpert.h>
41*fdd8201dSApple OSS Distributions 
42*fdd8201dSApple OSS Distributions static volatile UInt32 alreadyFetched = 0;
43*fdd8201dSApple OSS Distributions static IOMemoryDescriptor * newData;
44*fdd8201dSApple OSS Distributions 
45*fdd8201dSApple OSS Distributions IOMemoryDescriptor *
46*fdd8201dSApple OSS Distributions IOGetBootKeyStoreData(void);
47*fdd8201dSApple OSS Distributions void
48*fdd8201dSApple OSS Distributions IOSetKeyStoreData(IOMemoryDescriptor * data);
49*fdd8201dSApple OSS Distributions 
50*fdd8201dSApple OSS Distributions // APFS
51*fdd8201dSApple OSS Distributions static volatile UInt32 apfsKeyFetched = 0;
52*fdd8201dSApple OSS Distributions static IOMemoryDescriptor* apfsKeyData = NULL;
53*fdd8201dSApple OSS Distributions 
54*fdd8201dSApple OSS Distributions IOMemoryDescriptor* IOGetAPFSKeyStoreData();
55*fdd8201dSApple OSS Distributions void IOSetAPFSKeyStoreData(IOMemoryDescriptor* data);
56*fdd8201dSApple OSS Distributions 
57*fdd8201dSApple OSS Distributions static volatile UInt32 ARVRootHashFetched = 0;
58*fdd8201dSApple OSS Distributions static volatile UInt32 bsARVRootHashFetched = 0;
59*fdd8201dSApple OSS Distributions 
60*fdd8201dSApple OSS Distributions IOMemoryDescriptor* IOGetARVRootHashData(void);
61*fdd8201dSApple OSS Distributions IOMemoryDescriptor* IOGetBaseSystemARVRootHashData(void);
62*fdd8201dSApple OSS Distributions 
63*fdd8201dSApple OSS Distributions bool IOBaseSystemARVRootHashAvailable(void);
64*fdd8201dSApple OSS Distributions 
65*fdd8201dSApple OSS Distributions static volatile UInt32 ARVManifestFetched = 0;
66*fdd8201dSApple OSS Distributions static volatile UInt32 bsARVManifestFetched = 0;
67*fdd8201dSApple OSS Distributions 
68*fdd8201dSApple OSS Distributions IOMemoryDescriptor* IOGetARVManifestData(void);
69*fdd8201dSApple OSS Distributions IOMemoryDescriptor* IOGetBaseSystemARVManifestData(void);
70*fdd8201dSApple OSS Distributions 
71*fdd8201dSApple OSS Distributions __END_DECLS
72*fdd8201dSApple OSS Distributions 
73*fdd8201dSApple OSS Distributions #if 1
74*fdd8201dSApple OSS Distributions #define DEBG(fmt, args...)      { kprintf(fmt, ## args); }
75*fdd8201dSApple OSS Distributions #else
76*fdd8201dSApple OSS Distributions #define DEBG(fmt, args...)      {}
77*fdd8201dSApple OSS Distributions #endif
78*fdd8201dSApple OSS Distributions 
79*fdd8201dSApple OSS Distributions void
IOSetKeyStoreData(IOMemoryDescriptor * data)80*fdd8201dSApple OSS Distributions IOSetKeyStoreData(IOMemoryDescriptor * data)
81*fdd8201dSApple OSS Distributions {
82*fdd8201dSApple OSS Distributions 	newData = data;
83*fdd8201dSApple OSS Distributions 	alreadyFetched = 0;
84*fdd8201dSApple OSS Distributions }
85*fdd8201dSApple OSS Distributions 
86*fdd8201dSApple OSS Distributions IOMemoryDescriptor *
IOGetBootKeyStoreData(void)87*fdd8201dSApple OSS Distributions IOGetBootKeyStoreData(void)
88*fdd8201dSApple OSS Distributions {
89*fdd8201dSApple OSS Distributions 	IOMemoryDescriptor *memoryDescriptor;
90*fdd8201dSApple OSS Distributions 	boot_args *args = (boot_args *)PE_state.bootArgs;
91*fdd8201dSApple OSS Distributions 	IOOptionBits options;
92*fdd8201dSApple OSS Distributions 	IOAddressRange ranges;
93*fdd8201dSApple OSS Distributions 
94*fdd8201dSApple OSS Distributions 	if (!OSCompareAndSwap(0, 1, &alreadyFetched)) {
95*fdd8201dSApple OSS Distributions 		return NULL;
96*fdd8201dSApple OSS Distributions 	}
97*fdd8201dSApple OSS Distributions 
98*fdd8201dSApple OSS Distributions 	if (newData) {
99*fdd8201dSApple OSS Distributions 		IOMemoryDescriptor * data = newData;
100*fdd8201dSApple OSS Distributions 		newData = NULL;
101*fdd8201dSApple OSS Distributions 		return data;
102*fdd8201dSApple OSS Distributions 	}
103*fdd8201dSApple OSS Distributions 
104*fdd8201dSApple OSS Distributions 	DEBG("%s: data at address %u size %u\n", __func__,
105*fdd8201dSApple OSS Distributions 	    args->keyStoreDataStart,
106*fdd8201dSApple OSS Distributions 	    args->keyStoreDataSize);
107*fdd8201dSApple OSS Distributions 
108*fdd8201dSApple OSS Distributions 	if (args->keyStoreDataStart == 0) {
109*fdd8201dSApple OSS Distributions 		return NULL;
110*fdd8201dSApple OSS Distributions 	}
111*fdd8201dSApple OSS Distributions 
112*fdd8201dSApple OSS Distributions 	ranges.address = args->keyStoreDataStart;
113*fdd8201dSApple OSS Distributions 	ranges.length = args->keyStoreDataSize;
114*fdd8201dSApple OSS Distributions 
115*fdd8201dSApple OSS Distributions 	options = kIODirectionInOut | kIOMemoryTypePhysical64 | kIOMemoryMapperNone;
116*fdd8201dSApple OSS Distributions 
117*fdd8201dSApple OSS Distributions 	memoryDescriptor = IOMemoryDescriptor::withOptions(&ranges,
118*fdd8201dSApple OSS Distributions 	    1,
119*fdd8201dSApple OSS Distributions 	    0,
120*fdd8201dSApple OSS Distributions 	    NULL,
121*fdd8201dSApple OSS Distributions 	    options);
122*fdd8201dSApple OSS Distributions 
123*fdd8201dSApple OSS Distributions 	DEBG("%s: memory descriptor %p\n", __func__, memoryDescriptor);
124*fdd8201dSApple OSS Distributions 
125*fdd8201dSApple OSS Distributions 	return memoryDescriptor;
126*fdd8201dSApple OSS Distributions }
127*fdd8201dSApple OSS Distributions 
128*fdd8201dSApple OSS Distributions // APFS volume key fetcher
129*fdd8201dSApple OSS Distributions 
130*fdd8201dSApple OSS Distributions // Store in-memory key (could be used by IOHibernateDone)
131*fdd8201dSApple OSS Distributions void
IOSetAPFSKeyStoreData(IOMemoryDescriptor * data)132*fdd8201dSApple OSS Distributions IOSetAPFSKeyStoreData(IOMemoryDescriptor* data)
133*fdd8201dSApple OSS Distributions {
134*fdd8201dSApple OSS Distributions 	// Do not allow re-fetching of the boot_args key by passing NULL here.
135*fdd8201dSApple OSS Distributions 	if (data != NULL) {
136*fdd8201dSApple OSS Distributions 		apfsKeyData = data;
137*fdd8201dSApple OSS Distributions 		apfsKeyFetched = 0;
138*fdd8201dSApple OSS Distributions 	}
139*fdd8201dSApple OSS Distributions }
140*fdd8201dSApple OSS Distributions 
141*fdd8201dSApple OSS Distributions // Retrieve any key we may have (stored in boot_args or by Hibernate)
142*fdd8201dSApple OSS Distributions IOMemoryDescriptor*
IOGetAPFSKeyStoreData()143*fdd8201dSApple OSS Distributions IOGetAPFSKeyStoreData()
144*fdd8201dSApple OSS Distributions {
145*fdd8201dSApple OSS Distributions 	// Check if someone got the key before us
146*fdd8201dSApple OSS Distributions 	if (!OSCompareAndSwap(0, 1, &apfsKeyFetched)) {
147*fdd8201dSApple OSS Distributions 		return NULL;
148*fdd8201dSApple OSS Distributions 	}
149*fdd8201dSApple OSS Distributions 
150*fdd8201dSApple OSS Distributions 	// Do we have in-memory key?
151*fdd8201dSApple OSS Distributions 	if (apfsKeyData) {
152*fdd8201dSApple OSS Distributions 		IOMemoryDescriptor* data = apfsKeyData;
153*fdd8201dSApple OSS Distributions 		apfsKeyData = NULL;
154*fdd8201dSApple OSS Distributions 		return data;
155*fdd8201dSApple OSS Distributions 	}
156*fdd8201dSApple OSS Distributions 
157*fdd8201dSApple OSS Distributions 	// Looks like there was no in-memory key and it's the first call - try boot_args
158*fdd8201dSApple OSS Distributions 	boot_args* args = (boot_args*)PE_state.bootArgs;
159*fdd8201dSApple OSS Distributions 
160*fdd8201dSApple OSS Distributions 	DEBG("%s: data at address %u size %u\n", __func__, args->apfsDataStart, args->apfsDataSize);
161*fdd8201dSApple OSS Distributions 	if (args->apfsDataStart == 0) {
162*fdd8201dSApple OSS Distributions 		return NULL;
163*fdd8201dSApple OSS Distributions 	}
164*fdd8201dSApple OSS Distributions 
165*fdd8201dSApple OSS Distributions 	// We have the key in the boot_args, create IOMemoryDescriptor for the blob
166*fdd8201dSApple OSS Distributions 	IOAddressRange ranges;
167*fdd8201dSApple OSS Distributions 	ranges.address = args->apfsDataStart;
168*fdd8201dSApple OSS Distributions 	ranges.length = args->apfsDataSize;
169*fdd8201dSApple OSS Distributions 
170*fdd8201dSApple OSS Distributions 	const IOOptionBits options = kIODirectionInOut | kIOMemoryTypePhysical64 | kIOMemoryMapperNone;
171*fdd8201dSApple OSS Distributions 
172*fdd8201dSApple OSS Distributions 	IOMemoryDescriptor* memoryDescriptor = IOMemoryDescriptor::withOptions(&ranges, 1, 0, NULL, options);
173*fdd8201dSApple OSS Distributions 	DEBG("%s: memory descriptor %p\n", __func__, memoryDescriptor);
174*fdd8201dSApple OSS Distributions 	return memoryDescriptor;
175*fdd8201dSApple OSS Distributions }
176*fdd8201dSApple OSS Distributions 
177*fdd8201dSApple OSS Distributions // ARV Root Hash fetcher
178*fdd8201dSApple OSS Distributions 
179*fdd8201dSApple OSS Distributions // Retrieve any root hash we may have (stored in boot_args)
180*fdd8201dSApple OSS Distributions IOMemoryDescriptor*
IOGetARVRootHashData(void)181*fdd8201dSApple OSS Distributions IOGetARVRootHashData(void)
182*fdd8201dSApple OSS Distributions {
183*fdd8201dSApple OSS Distributions 	// Check if someone got the root hash before us
184*fdd8201dSApple OSS Distributions 	if (!OSCompareAndSwap(0, 1, &ARVRootHashFetched)) {
185*fdd8201dSApple OSS Distributions 		return NULL;
186*fdd8201dSApple OSS Distributions 	}
187*fdd8201dSApple OSS Distributions 
188*fdd8201dSApple OSS Distributions 	boot_args* args = (boot_args*)PE_state.bootArgs;
189*fdd8201dSApple OSS Distributions 
190*fdd8201dSApple OSS Distributions 	DEBG("%s: data at address %llu size %llu\n", __func__, args->arvRootHashStart, args->arvRootHashSize);
191*fdd8201dSApple OSS Distributions 	if (args->arvRootHashStart == 0) {
192*fdd8201dSApple OSS Distributions 		return NULL;
193*fdd8201dSApple OSS Distributions 	}
194*fdd8201dSApple OSS Distributions 
195*fdd8201dSApple OSS Distributions 	// We have the root hash in the boot_args, create IOMemoryDescriptor for the blob
196*fdd8201dSApple OSS Distributions 	IOAddressRange ranges;
197*fdd8201dSApple OSS Distributions 	ranges.address = args->arvRootHashStart;
198*fdd8201dSApple OSS Distributions 	ranges.length = args->arvRootHashSize;
199*fdd8201dSApple OSS Distributions 
200*fdd8201dSApple OSS Distributions 	const IOOptionBits options = kIODirectionInOut | kIOMemoryTypePhysical64 | kIOMemoryMapperNone;
201*fdd8201dSApple OSS Distributions 
202*fdd8201dSApple OSS Distributions 	IOMemoryDescriptor* memoryDescriptor = IOMemoryDescriptor::withOptions(&ranges, 1, 0, NULL, options);
203*fdd8201dSApple OSS Distributions 	DEBG("%s: memory descriptor %p\n", __func__, memoryDescriptor);
204*fdd8201dSApple OSS Distributions 	return memoryDescriptor;
205*fdd8201dSApple OSS Distributions }
206*fdd8201dSApple OSS Distributions 
207*fdd8201dSApple OSS Distributions // Base System Analogue
208*fdd8201dSApple OSS Distributions 
209*fdd8201dSApple OSS Distributions IOMemoryDescriptor*
IOGetBaseSystemARVRootHashData(void)210*fdd8201dSApple OSS Distributions IOGetBaseSystemARVRootHashData(void)
211*fdd8201dSApple OSS Distributions {
212*fdd8201dSApple OSS Distributions 	// Check if someone got the base system root hash before us
213*fdd8201dSApple OSS Distributions 	if (!OSCompareAndSwap(0, 1, &bsARVRootHashFetched)) {
214*fdd8201dSApple OSS Distributions 		return NULL;
215*fdd8201dSApple OSS Distributions 	}
216*fdd8201dSApple OSS Distributions 
217*fdd8201dSApple OSS Distributions 	boot_args* args = (boot_args*)PE_state.bootArgs;
218*fdd8201dSApple OSS Distributions 
219*fdd8201dSApple OSS Distributions 	DEBG("%s: data at address %llu size %llu\n", __func__, args->bsARVRootHashStart, args->bsARVRootHashSize);
220*fdd8201dSApple OSS Distributions 	if (args->bsARVRootHashStart == 0) {
221*fdd8201dSApple OSS Distributions 		return NULL;
222*fdd8201dSApple OSS Distributions 	}
223*fdd8201dSApple OSS Distributions 
224*fdd8201dSApple OSS Distributions 	// We have the base system root hash in the boot_args, create IOMemoryDescriptor for the blob
225*fdd8201dSApple OSS Distributions 	IOAddressRange ranges;
226*fdd8201dSApple OSS Distributions 	ranges.address = args->bsARVRootHashStart;
227*fdd8201dSApple OSS Distributions 	ranges.length = args->bsARVRootHashSize;
228*fdd8201dSApple OSS Distributions 
229*fdd8201dSApple OSS Distributions 	const IOOptionBits options = kIODirectionInOut | kIOMemoryTypePhysical64 | kIOMemoryMapperNone;
230*fdd8201dSApple OSS Distributions 
231*fdd8201dSApple OSS Distributions 	IOMemoryDescriptor* memoryDescriptor = IOMemoryDescriptor::withOptions(&ranges, 1, 0, NULL, options);
232*fdd8201dSApple OSS Distributions 	DEBG("%s: memory descriptor %p\n", __func__, memoryDescriptor);
233*fdd8201dSApple OSS Distributions 	return memoryDescriptor;
234*fdd8201dSApple OSS Distributions }
235*fdd8201dSApple OSS Distributions 
236*fdd8201dSApple OSS Distributions bool
IOBaseSystemARVRootHashAvailable(void)237*fdd8201dSApple OSS Distributions IOBaseSystemARVRootHashAvailable(void)
238*fdd8201dSApple OSS Distributions {
239*fdd8201dSApple OSS Distributions 	boot_args* args = (boot_args*)PE_state.bootArgs;
240*fdd8201dSApple OSS Distributions 
241*fdd8201dSApple OSS Distributions 	if (args->bsARVRootHashStart == 0 || args->bsARVRootHashSize == 0) {
242*fdd8201dSApple OSS Distributions 		return false;
243*fdd8201dSApple OSS Distributions 	}
244*fdd8201dSApple OSS Distributions 
245*fdd8201dSApple OSS Distributions 	if (args->bsARVManifestStart == 0 || args->bsARVManifestSize == 0) {
246*fdd8201dSApple OSS Distributions 		return false;
247*fdd8201dSApple OSS Distributions 	}
248*fdd8201dSApple OSS Distributions 
249*fdd8201dSApple OSS Distributions 	return true;
250*fdd8201dSApple OSS Distributions }
251*fdd8201dSApple OSS Distributions 
252*fdd8201dSApple OSS Distributions // ARV Manifest fetcher
253*fdd8201dSApple OSS Distributions 
254*fdd8201dSApple OSS Distributions // Retrieve any manifest we may have (stored in boot_args)
255*fdd8201dSApple OSS Distributions IOMemoryDescriptor*
IOGetARVManifestData(void)256*fdd8201dSApple OSS Distributions IOGetARVManifestData(void)
257*fdd8201dSApple OSS Distributions {
258*fdd8201dSApple OSS Distributions 	// Check if someone got the manifest before us
259*fdd8201dSApple OSS Distributions 	if (!OSCompareAndSwap(0, 1, &ARVManifestFetched)) {
260*fdd8201dSApple OSS Distributions 		return NULL;
261*fdd8201dSApple OSS Distributions 	}
262*fdd8201dSApple OSS Distributions 
263*fdd8201dSApple OSS Distributions 	boot_args* args = (boot_args*)PE_state.bootArgs;
264*fdd8201dSApple OSS Distributions 
265*fdd8201dSApple OSS Distributions 	DEBG("%s: data at address %llu size %llu\n", __func__, args->arvManifestStart, args->arvManifestSize);
266*fdd8201dSApple OSS Distributions 	if (args->arvManifestStart == 0) {
267*fdd8201dSApple OSS Distributions 		return NULL;
268*fdd8201dSApple OSS Distributions 	}
269*fdd8201dSApple OSS Distributions 
270*fdd8201dSApple OSS Distributions 	// We have the manifest in the boot_args, create IOMemoryDescriptor for the blob
271*fdd8201dSApple OSS Distributions 	IOAddressRange ranges;
272*fdd8201dSApple OSS Distributions 	ranges.address = args->arvManifestStart;
273*fdd8201dSApple OSS Distributions 	ranges.length = args->arvManifestSize;
274*fdd8201dSApple OSS Distributions 
275*fdd8201dSApple OSS Distributions 	const IOOptionBits options = kIODirectionInOut | kIOMemoryTypePhysical64 | kIOMemoryMapperNone;
276*fdd8201dSApple OSS Distributions 
277*fdd8201dSApple OSS Distributions 	IOMemoryDescriptor* memoryDescriptor = IOMemoryDescriptor::withOptions(&ranges, 1, 0, NULL, options);
278*fdd8201dSApple OSS Distributions 	DEBG("%s: memory descriptor %p\n", __func__, memoryDescriptor);
279*fdd8201dSApple OSS Distributions 	return memoryDescriptor;
280*fdd8201dSApple OSS Distributions }
281*fdd8201dSApple OSS Distributions 
282*fdd8201dSApple OSS Distributions // Base System Analogue
283*fdd8201dSApple OSS Distributions 
284*fdd8201dSApple OSS Distributions IOMemoryDescriptor*
IOGetBaseSystemARVManifestData(void)285*fdd8201dSApple OSS Distributions IOGetBaseSystemARVManifestData(void)
286*fdd8201dSApple OSS Distributions {
287*fdd8201dSApple OSS Distributions 	// Check if someone got the base system manifest before us
288*fdd8201dSApple OSS Distributions 	if (!OSCompareAndSwap(0, 1, &bsARVManifestFetched)) {
289*fdd8201dSApple OSS Distributions 		return NULL;
290*fdd8201dSApple OSS Distributions 	}
291*fdd8201dSApple OSS Distributions 
292*fdd8201dSApple OSS Distributions 	boot_args* args = (boot_args*)PE_state.bootArgs;
293*fdd8201dSApple OSS Distributions 
294*fdd8201dSApple OSS Distributions 	DEBG("%s: data at address %llu size %llu\n", __func__, args->bsARVManifestStart, args->bsARVManifestSize);
295*fdd8201dSApple OSS Distributions 	if (args->bsARVManifestStart == 0) {
296*fdd8201dSApple OSS Distributions 		return NULL;
297*fdd8201dSApple OSS Distributions 	}
298*fdd8201dSApple OSS Distributions 
299*fdd8201dSApple OSS Distributions 	// We have the manifest in the boot_args, create IOMemoryDescriptor for the blob
300*fdd8201dSApple OSS Distributions 	IOAddressRange ranges;
301*fdd8201dSApple OSS Distributions 	ranges.address = args->bsARVManifestStart;
302*fdd8201dSApple OSS Distributions 	ranges.length = args->bsARVManifestSize;
303*fdd8201dSApple OSS Distributions 
304*fdd8201dSApple OSS Distributions 	const IOOptionBits options = kIODirectionInOut | kIOMemoryTypePhysical64 | kIOMemoryMapperNone;
305*fdd8201dSApple OSS Distributions 
306*fdd8201dSApple OSS Distributions 	IOMemoryDescriptor* memoryDescriptor = IOMemoryDescriptor::withOptions(&ranges, 1, 0, NULL, options);
307*fdd8201dSApple OSS Distributions 	DEBG("%s: memory descriptor %p\n", __func__, memoryDescriptor);
308*fdd8201dSApple OSS Distributions 	return memoryDescriptor;
309*fdd8201dSApple OSS Distributions }
310