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.
27 * This subclass implements a relay to a protocol and device-specific
31 * Aug 27, 1999 jliu - Created.
34 #include <IOKit/IOLib.h>
35 #include <IOKit/storage/ata/IOATAHDDriveNub.h>
36 #include <IOKit/storage/ata/IOATAHDDrive.h>
38 #define super IOBlockStorageDevice
39 OSDefineMetaClassAndStructors( IOATAHDDriveNub
, IOBlockStorageDevice
)
41 //---------------------------------------------------------------------------
42 // attach to provider.
44 bool IOATAHDDriveNub::attach(IOService
* provider
)
46 if (!super::attach(provider
))
49 _provider
= OSDynamicCast(IOATAHDDrive
, provider
);
51 IOLog("IOATAHDDriveNub: attach; wrong provider type!\n");
58 //---------------------------------------------------------------------------
59 // detach from provider.
61 void IOATAHDDriveNub::detach(IOService
* provider
)
63 if (_provider
== provider
)
66 super::detach(provider
);
69 //---------------------------------------------------------------------------
72 IOReturn
IOATAHDDriveNub::doAsyncReadWrite(IOMemoryDescriptor
* buffer
,
75 IOStorageCompletion completion
)
77 return _provider
->doAsyncReadWrite(buffer
, block
, nblks
, completion
);
80 //---------------------------------------------------------------------------
83 IOReturn
IOATAHDDriveNub::doSyncReadWrite(IOMemoryDescriptor
*buffer
,
84 UInt32 block
,UInt32 nblks
)
86 return _provider
->doSyncReadWrite(buffer
, block
, nblks
);
89 //---------------------------------------------------------------------------
92 IOReturn
IOATAHDDriveNub::doEjectMedia()
94 return _provider
->doEjectMedia();
97 //---------------------------------------------------------------------------
100 IOReturn
IOATAHDDriveNub::doFormatMedia(UInt64 byteCapacity
)
102 return _provider
->doFormatMedia(byteCapacity
);
105 //---------------------------------------------------------------------------
109 IOATAHDDriveNub::doGetFormatCapacities(UInt64
* capacities
,
110 UInt32 capacitiesMaxCount
) const
112 return _provider
->doGetFormatCapacities(capacities
, capacitiesMaxCount
);
115 //---------------------------------------------------------------------------
118 IOReturn
IOATAHDDriveNub::doLockUnlockMedia(bool doLock
)
120 return _provider
->doLockUnlockMedia(doLock
);
123 //---------------------------------------------------------------------------
126 IOReturn
IOATAHDDriveNub::doSynchronizeCache()
128 return _provider
->doSynchronizeCache();
131 //---------------------------------------------------------------------------
134 char * IOATAHDDriveNub::getVendorString()
136 return _provider
->getVendorString();
139 //---------------------------------------------------------------------------
142 char * IOATAHDDriveNub::getProductString()
144 return _provider
->getProductString();
147 //---------------------------------------------------------------------------
150 char * IOATAHDDriveNub::getRevisionString()
152 return _provider
->getRevisionString();
155 //---------------------------------------------------------------------------
158 char * IOATAHDDriveNub::getAdditionalDeviceInfoString()
160 return _provider
->getAdditionalDeviceInfoString();
163 //---------------------------------------------------------------------------
166 IOReturn
IOATAHDDriveNub::reportBlockSize(UInt64
* blockSize
)
168 return _provider
->reportBlockSize(blockSize
);
171 //---------------------------------------------------------------------------
174 IOReturn
IOATAHDDriveNub::reportEjectability(bool * isEjectable
)
176 return _provider
->reportEjectability(isEjectable
);
179 //---------------------------------------------------------------------------
182 IOReturn
IOATAHDDriveNub::reportLockability(bool * isLockable
)
184 return _provider
->reportLockability(isLockable
);
187 //---------------------------------------------------------------------------
190 IOReturn
IOATAHDDriveNub::reportPollRequirements(bool * pollIsRequired
,
191 bool * pollIsExpensive
)
193 return _provider
->reportPollRequirements(pollIsRequired
, pollIsExpensive
);
196 //---------------------------------------------------------------------------
199 IOReturn
IOATAHDDriveNub::reportMaxReadTransfer(UInt64 blockSize
,
202 return _provider
->reportMaxReadTransfer(blockSize
, max
);
205 //---------------------------------------------------------------------------
208 IOReturn
IOATAHDDriveNub::reportMaxValidBlock(UInt64
* maxBlock
)
210 return _provider
->reportMaxValidBlock(maxBlock
);
213 //---------------------------------------------------------------------------
216 IOReturn
IOATAHDDriveNub::reportMaxWriteTransfer(UInt64 blockSize
,
219 return _provider
->reportMaxWriteTransfer(blockSize
, max
);
222 //---------------------------------------------------------------------------
225 IOReturn
IOATAHDDriveNub::reportMediaState(bool * mediaPresent
,
228 return _provider
->reportMediaState(mediaPresent
, changed
);
231 //---------------------------------------------------------------------------
234 IOReturn
IOATAHDDriveNub::reportRemovability(bool * isRemovable
)
236 return _provider
->reportRemovability(isRemovable
);
239 //---------------------------------------------------------------------------
242 IOReturn
IOATAHDDriveNub::reportWriteProtection(bool * isWriteProtected
)
244 return _provider
->reportWriteProtection(isWriteProtected
);