]> git.saurik.com Git - apple/xnu.git/blob - iokit/Families/IOSCSIDVDDrive/IOSCSIDVDDriveNub.cpp
9061f004d60ccfedd96562d2780715d949753222
[apple/xnu.git] / iokit / Families / IOSCSIDVDDrive / IOSCSIDVDDriveNub.cpp
1 /*
2 * Copyright (c) 2000 Apple Computer, Inc. All rights reserved.
3 *
4 * @APPLE_LICENSE_HEADER_START@
5 *
6 * The contents of this file constitute Original Code as defined in and
7 * are subject to the Apple Public Source License Version 1.1 (the
8 * "License"). You may not use this file except in compliance with the
9 * License. Please obtain a copy of the License at
10 * http://www.apple.com/publicsource and read it before using this file.
11 *
12 * This Original Code and all software distributed under the License are
13 * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
14 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
15 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
16 * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT. Please see the
17 * License for the specific language governing rights and limitations
18 * under the License.
19 *
20 * @APPLE_LICENSE_HEADER_END@
21 */
22 #include <IOKit/IOMemoryDescriptor.h>
23 #include <IOKit/IOLib.h>
24 #include <IOKit/storage/IODVDBlockStorageDevice.h>
25 #include <IOKit/storage/scsi/IOSCSIDVDDriveNub.h>
26 #include <IOKit/storage/scsi/IOSCSIDVDDrive.h>
27
28 #define super IODVDBlockStorageDevice
29 OSDefineMetaClassAndStructors(IOSCSIDVDDriveNub,IODVDBlockStorageDevice)
30
31 bool
32 IOSCSIDVDDriveNub::attach(IOService * provider)
33 {
34 if (!super::attach(provider)) {
35 return(false);
36 }
37
38 _provider = OSDynamicCast(IOSCSIDVDDrive,provider);
39 if (_provider == NULL) {
40 return(false);
41 } else {
42 return(true);
43 }
44 }
45
46 IOReturn
47 IOSCSIDVDDriveNub::audioPause(bool pause)
48 {
49 return(_provider->audioPause(pause));
50 }
51
52 IOReturn
53 IOSCSIDVDDriveNub::audioPlay(CDMSF timeStart,CDMSF timeStop)
54 {
55 return(_provider->audioPlay(timeStart,timeStop));
56 }
57
58 IOReturn
59 IOSCSIDVDDriveNub::audioScan(CDMSF timeStart,bool reverse)
60 {
61 return(_provider->audioScan(timeStart,reverse));
62 }
63
64 IOReturn
65 IOSCSIDVDDriveNub::audioStop()
66 {
67 return(_provider->audioStop());
68 }
69
70 IOReturn
71 IOSCSIDVDDriveNub::doAsyncReadCD(IOMemoryDescriptor *buffer,
72 UInt32 block,UInt32 nblks,
73 CDSectorArea sectorArea,
74 CDSectorType sectorType,
75 IOStorageCompletion completion)
76 {
77 return(_provider->doAsyncReadCD(buffer,block,nblks,
78 sectorArea,sectorType,
79 completion));
80 }
81
82 IOReturn
83 IOSCSIDVDDriveNub::doAsyncReadWrite(IOMemoryDescriptor *buffer,
84 UInt32 block,UInt32 nblks,
85 IOStorageCompletion completion)
86 {
87 return(_provider->doAsyncReadWrite(buffer,block,nblks,completion));
88 }
89
90 IOReturn
91 IOSCSIDVDDriveNub::doSyncReadWrite(IOMemoryDescriptor *buffer,UInt32 block,UInt32 nblks)
92 {
93 return(_provider->doSyncReadWrite(buffer,block,nblks));
94 }
95
96 IOReturn
97 IOSCSIDVDDriveNub::doEjectMedia(void)
98 {
99 return(_provider->doEjectMedia());
100 }
101
102 IOReturn
103 IOSCSIDVDDriveNub::doFormatMedia(UInt64 byteCapacity)
104 {
105 return(_provider->doFormatMedia(byteCapacity));
106 }
107
108 UInt32
109 IOSCSIDVDDriveNub::doGetFormatCapacities(UInt64 * capacities,UInt32 capacitiesMaxCount) const
110 {
111 return(_provider->doGetFormatCapacities(capacities,capacitiesMaxCount));
112 }
113
114 IOReturn
115 IOSCSIDVDDriveNub::doLockUnlockMedia(bool doLock)
116 {
117 return(_provider->doLockUnlockMedia(doLock));
118 }
119
120 IOReturn
121 IOSCSIDVDDriveNub::doSynchronizeCache(void)
122 {
123 return(_provider->doSynchronizeCache());
124 }
125
126 IOReturn
127 IOSCSIDVDDriveNub::getAudioStatus(CDAudioStatus *status)
128 {
129 return(_provider->getAudioStatus(status));
130 }
131
132 IOReturn
133 IOSCSIDVDDriveNub::getAudioVolume(UInt8 *leftVolume,UInt8 *rightVolume)
134 {
135 return(_provider->getAudioVolume(leftVolume,rightVolume));
136 }
137
138 UInt32
139 IOSCSIDVDDriveNub::getMediaType(void)
140 {
141 return(_provider->getMediaType());
142 }
143
144 char *
145 IOSCSIDVDDriveNub::getVendorString(void)
146 {
147 return(_provider->getVendorString());
148 }
149
150 char *
151 IOSCSIDVDDriveNub::getProductString(void)
152 {
153 return(_provider->getProductString());
154 }
155
156 char *
157 IOSCSIDVDDriveNub::getRevisionString(void)
158 {
159 return(_provider->getRevisionString());
160 }
161
162 char *
163 IOSCSIDVDDriveNub::getAdditionalDeviceInfoString(void)
164 {
165 return(_provider->getAdditionalDeviceInfoString());
166 }
167
168 IOReturn
169 IOSCSIDVDDriveNub::readISRC(UInt8 track,CDISRC isrc)
170 {
171 return(_provider->readISRC(track,isrc));
172 }
173
174 IOReturn
175 IOSCSIDVDDriveNub::readMCN(CDMCN mcn)
176 {
177 return(_provider->readMCN(mcn));
178 }
179
180 IOReturn
181 IOSCSIDVDDriveNub::readTOC(IOMemoryDescriptor *buffer)
182 {
183 return(_provider->readTOC(buffer));
184 }
185
186 IOReturn
187 IOSCSIDVDDriveNub::reportBlockSize(UInt64 *blockSize)
188 {
189 return(_provider->reportBlockSize(blockSize));
190 }
191
192 IOReturn
193 IOSCSIDVDDriveNub::reportEjectability(bool *isEjectable)
194 {
195 return(_provider->reportEjectability(isEjectable));
196 }
197
198 IOReturn
199 IOSCSIDVDDriveNub::reportKey(IOMemoryDescriptor *buffer,const DVDKeyClass keyClass,
200 const UInt32 lba,const UInt8 agid,const DVDKeyFormat keyFormat)
201 {
202 return(_provider->reportKey(buffer,keyClass,lba,agid,keyFormat));
203 }
204
205 IOReturn
206 IOSCSIDVDDriveNub::reportLockability(bool *isLockable)
207 {
208 return(_provider->reportLockability(isLockable));
209 }
210
211 IOReturn
212 IOSCSIDVDDriveNub::reportPollRequirements(bool *pollIsRequired,bool *pollIsExpensive)
213 {
214 return(_provider-> reportPollRequirements(pollIsRequired,pollIsExpensive));
215 }
216
217 IOReturn
218 IOSCSIDVDDriveNub::reportMaxReadTransfer (UInt64 blockSize,UInt64 *max)
219 {
220 return(_provider->reportMaxReadTransfer(blockSize,max));
221 }
222
223 IOReturn
224 IOSCSIDVDDriveNub::reportMaxValidBlock(UInt64 *maxBlock)
225 {
226 return(_provider->reportMaxValidBlock(maxBlock));
227 }
228
229 IOReturn
230 IOSCSIDVDDriveNub::reportMaxWriteTransfer(UInt64 blockSize,UInt64 *max)
231 {
232 return(_provider->reportMaxWriteTransfer(blockSize,max));
233 }
234
235 IOReturn
236 IOSCSIDVDDriveNub::reportMediaState(bool *mediaPresent,bool *changed)
237 {
238 return(_provider->reportMediaState(mediaPresent,changed));
239 }
240
241 IOReturn
242 IOSCSIDVDDriveNub::reportRemovability(bool *isRemovable)
243 {
244 return(_provider->reportRemovability(isRemovable));
245 }
246
247 IOReturn
248 IOSCSIDVDDriveNub::reportWriteProtection(bool *isWriteProtected)
249 {
250 return(_provider->reportWriteProtection(isWriteProtected));
251 }
252
253 IOReturn
254 IOSCSIDVDDriveNub::sendKey(IOMemoryDescriptor *buffer,const DVDKeyClass keyClass,
255 const UInt8 agid,const DVDKeyFormat keyFormat)
256 {
257 return(_provider->sendKey(buffer,keyClass,agid,keyFormat));
258 }
259
260 IOReturn
261 IOSCSIDVDDriveNub::setAudioVolume(UInt8 leftVolume,UInt8 rightVolume)
262 {
263 return(_provider->setAudioVolume(leftVolume,rightVolume));
264 }