2 * Copyright (c) 1998-2000 Apple Computer, Inc. All rights reserved.
4 * @APPLE_LICENSE_HEADER_START@
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.
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
20 * @APPLE_LICENSE_HEADER_END@
23 * Copyright (c) 1999 Apple Computer, Inc. All rights reserved.
25 * IOATAPIHDDriveNub.cpp
27 * This subclass implements a relay to a protocol and device-specific
31 * 2-Sep-1999 Joe Liu (jliu) created.
34 #include <IOKit/IOLib.h>
35 #include <IOKit/storage/ata/IOATAPIHDDriveNub.h>
36 #include <IOKit/storage/ata/IOATAPIHDDrive.h>
38 #define super IOBlockStorageDevice
39 OSDefineMetaClassAndStructors( IOATAPIHDDriveNub
, IOBlockStorageDevice
)
41 //---------------------------------------------------------------------------
42 // attach to provider.
44 bool IOATAPIHDDriveNub::attach(IOService
* provider
)
46 if (!super::attach(provider
))
49 _provider
= OSDynamicCast(IOATAPIHDDrive
, provider
);
51 IOLog("IOATAPIHDDriveNub: attach; wrong provider type!\n");
58 //---------------------------------------------------------------------------
59 // detach from provider.
61 void IOATAPIHDDriveNub::detach(IOService
* provider
)
63 if (_provider
== provider
)
66 super::detach(provider
);
69 //---------------------------------------------------------------------------
72 IOReturn
IOATAPIHDDriveNub::doAsyncReadWrite(IOMemoryDescriptor
* buffer
,
75 IOStorageCompletion completion
)
77 return _provider
->doAsyncReadWrite(buffer
, block
, nblks
, completion
);
80 //---------------------------------------------------------------------------
83 IOReturn
IOATAPIHDDriveNub::doSyncReadWrite(IOMemoryDescriptor
* buffer
,
87 return _provider
->doSyncReadWrite(buffer
, block
, nblks
);
91 //---------------------------------------------------------------------------
94 IOReturn
IOATAPIHDDriveNub::doEjectMedia()
96 return _provider
->doEjectMedia();
99 //---------------------------------------------------------------------------
102 IOReturn
IOATAPIHDDriveNub::doFormatMedia(UInt64 byteCapacity
)
104 return _provider
->doFormatMedia(byteCapacity
);
107 //---------------------------------------------------------------------------
108 // doGetFormatCapacities
111 IOATAPIHDDriveNub::doGetFormatCapacities(UInt64
* capacities
,
112 UInt32 capacitiesMaxCount
) const
114 return _provider
->doGetFormatCapacities(capacities
, capacitiesMaxCount
);
117 //---------------------------------------------------------------------------
120 IOReturn
IOATAPIHDDriveNub::doLockUnlockMedia(bool doLock
)
122 return _provider
->doLockUnlockMedia(doLock
);
125 //---------------------------------------------------------------------------
126 // doSynchronizeCache
128 IOReturn
IOATAPIHDDriveNub::doSynchronizeCache()
130 return _provider
->doSynchronizeCache();
133 //---------------------------------------------------------------------------
136 char * IOATAPIHDDriveNub::getVendorString()
138 return _provider
->getVendorString();
141 //---------------------------------------------------------------------------
144 char * IOATAPIHDDriveNub::getProductString()
146 return _provider
->getProductString();
149 //---------------------------------------------------------------------------
152 char * IOATAPIHDDriveNub::getRevisionString()
154 return _provider
->getRevisionString();
157 //---------------------------------------------------------------------------
158 // getAdditionalDeviceInfoString
160 char * IOATAPIHDDriveNub::getAdditionalDeviceInfoString()
162 return _provider
->getAdditionalDeviceInfoString();
165 //---------------------------------------------------------------------------
168 IOReturn
IOATAPIHDDriveNub::reportBlockSize(UInt64
* blockSize
)
170 return _provider
->reportBlockSize(blockSize
);
173 //---------------------------------------------------------------------------
174 // reportEjectability
176 IOReturn
IOATAPIHDDriveNub::reportEjectability(bool * isEjectable
)
178 return _provider
->reportEjectability(isEjectable
);
181 //---------------------------------------------------------------------------
184 IOReturn
IOATAPIHDDriveNub::reportLockability(bool * isLockable
)
186 return _provider
->reportLockability(isLockable
);
189 //---------------------------------------------------------------------------
190 // reportPollRequirements
192 IOReturn
IOATAPIHDDriveNub::reportPollRequirements(bool * pollIsRequired
,
193 bool * pollIsExpensive
)
195 return _provider
->reportPollRequirements(pollIsRequired
, pollIsExpensive
);
198 //---------------------------------------------------------------------------
199 // reportMaxReadTransfer
201 IOReturn
IOATAPIHDDriveNub::reportMaxReadTransfer(UInt64 blockSize
,
204 return _provider
->reportMaxReadTransfer(blockSize
, max
);
207 //---------------------------------------------------------------------------
208 // reportMaxValidBlock
210 IOReturn
IOATAPIHDDriveNub::reportMaxValidBlock(UInt64
* maxBlock
)
212 return _provider
->reportMaxValidBlock(maxBlock
);
215 //---------------------------------------------------------------------------
216 // reportMaxWriteTransfer
218 IOReturn
IOATAPIHDDriveNub::reportMaxWriteTransfer(UInt64 blockSize
,
221 return _provider
->reportMaxWriteTransfer(blockSize
, max
);
224 //---------------------------------------------------------------------------
227 IOReturn
IOATAPIHDDriveNub::reportMediaState(bool * mediaPresent
,
230 return _provider
->reportMediaState(mediaPresent
, changed
);
233 //---------------------------------------------------------------------------
234 // reportRemovability
236 IOReturn
IOATAPIHDDriveNub::reportRemovability(bool * isRemovable
)
238 return _provider
->reportRemovability(isRemovable
);
241 //---------------------------------------------------------------------------
242 // reportWriteProtection
244 IOReturn
IOATAPIHDDriveNub::reportWriteProtection(bool * isWriteProtected
)
246 return _provider
->reportWriteProtection(isWriteProtected
);