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