]>
Commit | Line | Data |
---|---|---|
1c79356b A |
1 | /* |
2 | * Copyright (c) 1998-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 | /* | |
23 | * Copyright (c) 1999 Apple Computer, Inc. All rights reserved. | |
24 | * | |
25 | * IOATAPIHDDriveNub.cpp | |
26 | * | |
27 | * This subclass implements a relay to a protocol and device-specific | |
28 | * provider. | |
29 | * | |
30 | * HISTORY | |
31 | * 2-Sep-1999 Joe Liu (jliu) created. | |
32 | */ | |
33 | ||
34 | #include <IOKit/IOLib.h> | |
35 | #include <IOKit/storage/ata/IOATAPIHDDriveNub.h> | |
36 | #include <IOKit/storage/ata/IOATAPIHDDrive.h> | |
37 | ||
38 | #define super IOBlockStorageDevice | |
39 | OSDefineMetaClassAndStructors( IOATAPIHDDriveNub, IOBlockStorageDevice ) | |
40 | ||
41 | //--------------------------------------------------------------------------- | |
42 | // attach to provider. | |
43 | ||
44 | bool IOATAPIHDDriveNub::attach(IOService * provider) | |
45 | { | |
46 | if (!super::attach(provider)) | |
47 | return false; | |
48 | ||
49 | _provider = OSDynamicCast(IOATAPIHDDrive, provider); | |
50 | if (_provider == 0) { | |
51 | IOLog("IOATAPIHDDriveNub: attach; wrong provider type!\n"); | |
52 | return false; | |
53 | } | |
54 | ||
55 | return true; | |
56 | } | |
57 | ||
58 | //--------------------------------------------------------------------------- | |
59 | // detach from provider. | |
60 | ||
61 | void IOATAPIHDDriveNub::detach(IOService * provider) | |
62 | { | |
63 | if (_provider == provider) | |
64 | _provider = 0; | |
65 | ||
66 | super::detach(provider); | |
67 | } | |
68 | ||
69 | //--------------------------------------------------------------------------- | |
70 | // doAsyncReadWrite | |
71 | ||
72 | IOReturn IOATAPIHDDriveNub::doAsyncReadWrite(IOMemoryDescriptor * buffer, | |
73 | UInt32 block, | |
74 | UInt32 nblks, | |
75 | IOStorageCompletion completion) | |
76 | { | |
77 | return _provider->doAsyncReadWrite(buffer, block, nblks, completion); | |
78 | } | |
79 | ||
80 | //--------------------------------------------------------------------------- | |
81 | // doSyncReadWrite | |
82 | ||
83 | IOReturn IOATAPIHDDriveNub::doSyncReadWrite(IOMemoryDescriptor * buffer, | |
84 | UInt32 block, | |
85 | UInt32 nblks) | |
86 | { | |
87 | return _provider->doSyncReadWrite(buffer, block, nblks); | |
88 | } | |
89 | ||
90 | ||
91 | //--------------------------------------------------------------------------- | |
92 | // doEjectMedia | |
93 | ||
94 | IOReturn IOATAPIHDDriveNub::doEjectMedia() | |
95 | { | |
96 | return _provider->doEjectMedia(); | |
97 | } | |
98 | ||
99 | //--------------------------------------------------------------------------- | |
100 | // doFormatMedia | |
101 | ||
102 | IOReturn IOATAPIHDDriveNub::doFormatMedia(UInt64 byteCapacity) | |
103 | { | |
104 | return _provider->doFormatMedia(byteCapacity); | |
105 | } | |
106 | ||
107 | //--------------------------------------------------------------------------- | |
108 | // doGetFormatCapacities | |
109 | ||
110 | UInt32 | |
111 | IOATAPIHDDriveNub::doGetFormatCapacities(UInt64 * capacities, | |
112 | UInt32 capacitiesMaxCount) const | |
113 | { | |
114 | return _provider->doGetFormatCapacities(capacities, capacitiesMaxCount); | |
115 | } | |
116 | ||
117 | //--------------------------------------------------------------------------- | |
118 | // doLockUnlockMedia | |
119 | ||
120 | IOReturn IOATAPIHDDriveNub::doLockUnlockMedia(bool doLock) | |
121 | { | |
122 | return _provider->doLockUnlockMedia(doLock); | |
123 | } | |
124 | ||
125 | //--------------------------------------------------------------------------- | |
126 | // doSynchronizeCache | |
127 | ||
128 | IOReturn IOATAPIHDDriveNub::doSynchronizeCache() | |
129 | { | |
130 | return _provider->doSynchronizeCache(); | |
131 | } | |
132 | ||
133 | //--------------------------------------------------------------------------- | |
134 | // getVendorString | |
135 | ||
136 | char * IOATAPIHDDriveNub::getVendorString() | |
137 | { | |
138 | return _provider->getVendorString(); | |
139 | } | |
140 | ||
141 | //--------------------------------------------------------------------------- | |
142 | // getProductString | |
143 | ||
144 | char * IOATAPIHDDriveNub::getProductString() | |
145 | { | |
146 | return _provider->getProductString(); | |
147 | } | |
148 | ||
149 | //--------------------------------------------------------------------------- | |
150 | // getRevisionString | |
151 | ||
152 | char * IOATAPIHDDriveNub::getRevisionString() | |
153 | { | |
154 | return _provider->getRevisionString(); | |
155 | } | |
156 | ||
157 | //--------------------------------------------------------------------------- | |
158 | // getAdditionalDeviceInfoString | |
159 | ||
160 | char * IOATAPIHDDriveNub::getAdditionalDeviceInfoString() | |
161 | { | |
162 | return _provider->getAdditionalDeviceInfoString(); | |
163 | } | |
164 | ||
165 | //--------------------------------------------------------------------------- | |
166 | // reportBlockSize | |
167 | ||
168 | IOReturn IOATAPIHDDriveNub::reportBlockSize(UInt64 * blockSize) | |
169 | { | |
170 | return _provider->reportBlockSize(blockSize); | |
171 | } | |
172 | ||
173 | //--------------------------------------------------------------------------- | |
174 | // reportEjectability | |
175 | ||
176 | IOReturn IOATAPIHDDriveNub::reportEjectability(bool * isEjectable) | |
177 | { | |
178 | return _provider->reportEjectability(isEjectable); | |
179 | } | |
180 | ||
181 | //--------------------------------------------------------------------------- | |
182 | // reportLockability | |
183 | ||
184 | IOReturn IOATAPIHDDriveNub::reportLockability(bool * isLockable) | |
185 | { | |
186 | return _provider->reportLockability(isLockable); | |
187 | } | |
188 | ||
189 | //--------------------------------------------------------------------------- | |
190 | // reportPollRequirements | |
191 | ||
192 | IOReturn IOATAPIHDDriveNub::reportPollRequirements(bool * pollIsRequired, | |
193 | bool * pollIsExpensive) | |
194 | { | |
195 | return _provider->reportPollRequirements(pollIsRequired, pollIsExpensive); | |
196 | } | |
197 | ||
198 | //--------------------------------------------------------------------------- | |
199 | // reportMaxReadTransfer | |
200 | ||
201 | IOReturn IOATAPIHDDriveNub::reportMaxReadTransfer(UInt64 blockSize, | |
202 | UInt64 * max) | |
203 | { | |
204 | return _provider->reportMaxReadTransfer(blockSize, max); | |
205 | } | |
206 | ||
207 | //--------------------------------------------------------------------------- | |
208 | // reportMaxValidBlock | |
209 | ||
210 | IOReturn IOATAPIHDDriveNub::reportMaxValidBlock(UInt64 * maxBlock) | |
211 | { | |
212 | return _provider->reportMaxValidBlock(maxBlock); | |
213 | } | |
214 | ||
215 | //--------------------------------------------------------------------------- | |
216 | // reportMaxWriteTransfer | |
217 | ||
218 | IOReturn IOATAPIHDDriveNub::reportMaxWriteTransfer(UInt64 blockSize, | |
219 | UInt64 * max) | |
220 | { | |
221 | return _provider->reportMaxWriteTransfer(blockSize, max); | |
222 | } | |
223 | ||
224 | //--------------------------------------------------------------------------- | |
225 | // reportMediaState | |
226 | ||
227 | IOReturn IOATAPIHDDriveNub::reportMediaState(bool * mediaPresent, | |
228 | bool * changed) | |
229 | { | |
230 | return _provider->reportMediaState(mediaPresent, changed); | |
231 | } | |
232 | ||
233 | //--------------------------------------------------------------------------- | |
234 | // reportRemovability | |
235 | ||
236 | IOReturn IOATAPIHDDriveNub::reportRemovability(bool * isRemovable) | |
237 | { | |
238 | return _provider->reportRemovability(isRemovable); | |
239 | } | |
240 | ||
241 | //--------------------------------------------------------------------------- | |
242 | // reportWriteProtection | |
243 | ||
244 | IOReturn IOATAPIHDDriveNub::reportWriteProtection(bool * isWriteProtected) | |
245 | { | |
246 | return _provider->reportWriteProtection(isWriteProtected); | |
247 | } |