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@
22 #include <IOKit/IOLib.h>
23 #include <IOKit/storage/scsi/IOSCSIHDDriveNub.h>
24 #include <IOKit/storage/scsi/IOSCSIHDDrive.h>
26 #define super IOBlockStorageDevice
27 OSDefineMetaClassAndStructors(IOSCSIHDDriveNub
,IOBlockStorageDevice
)
30 IOSCSIHDDriveNub::attach(IOService
* provider
)
32 // IOLog("IOSCSIHDDriveNub: attach\n");
34 if (!super::attach(provider
)) {
38 // IOLog("IOSCSIHDDriveNub: attach; casting provider\n");
39 _provider
= OSDynamicCast(IOSCSIHDDrive
,provider
);
40 if (_provider
== NULL
) {
41 IOLog("IOSCSIHDDriveNub: attach; wrong provider type!\n");
44 // IOLog("IOSCSIHDDriveNub: attach; provider OK\n");
49 void IOSCSIHDDriveNub::detach(IOService
* provider
)
51 if( _provider
== provider
)
54 super::detach( provider
);
58 IOSCSIHDDriveNub::doAsyncReadWrite(IOMemoryDescriptor
*buffer
,
59 UInt32 block
,UInt32 nblks
,
60 IOStorageCompletion completion
)
62 return(_provider
->doAsyncReadWrite(buffer
,block
,nblks
,completion
));
66 IOSCSIHDDriveNub::doSyncReadWrite(IOMemoryDescriptor
*buffer
,UInt32 block
,UInt32 nblks
)
68 return(_provider
->doSyncReadWrite(buffer
,block
,nblks
));
72 IOSCSIHDDriveNub::doEjectMedia(void)
74 return(_provider
->doEjectMedia());
78 IOSCSIHDDriveNub::doFormatMedia(UInt64 byteCapacity
)
80 return(_provider
->doFormatMedia(byteCapacity
));
84 IOSCSIHDDriveNub::doGetFormatCapacities(UInt64
* capacities
,
85 UInt32 capacitiesMaxCount
) const
87 return(_provider
->doGetFormatCapacities(capacities
,capacitiesMaxCount
));
91 IOSCSIHDDriveNub::doLockUnlockMedia(bool doLock
)
93 return(_provider
->doLockUnlockMedia(doLock
));
97 IOSCSIHDDriveNub::doSynchronizeCache(void)
99 return(_provider
->doSynchronizeCache());
103 IOSCSIHDDriveNub::getVendorString(void)
105 return(_provider
->getVendorString());
109 IOSCSIHDDriveNub::getProductString(void)
111 return(_provider
->getProductString());
115 IOSCSIHDDriveNub::getRevisionString(void)
117 return(_provider
->getRevisionString());
121 IOSCSIHDDriveNub::getAdditionalDeviceInfoString(void)
123 return(_provider
-> getAdditionalDeviceInfoString());
127 IOSCSIHDDriveNub::reportBlockSize(UInt64
*blockSize
)
129 return(_provider
->reportBlockSize(blockSize
));
133 IOSCSIHDDriveNub::reportEjectability(bool *isEjectable
)
135 return(_provider
->reportEjectability(isEjectable
));
139 IOSCSIHDDriveNub::reportLockability(bool *isLockable
)
141 return(_provider
->reportLockability(isLockable
));
145 IOSCSIHDDriveNub::reportPollRequirements(bool *pollIsRequired
,bool *pollIsExpensive
)
147 return(_provider
->reportPollRequirements(pollIsRequired
,pollIsExpensive
));
151 IOSCSIHDDriveNub::reportMaxReadTransfer (UInt64 blockSize
,UInt64
*max
)
153 return(_provider
->reportMaxReadTransfer(blockSize
,max
));
157 IOSCSIHDDriveNub::reportMaxValidBlock(UInt64
*maxBlock
)
159 return(_provider
->reportMaxValidBlock(maxBlock
));
163 IOSCSIHDDriveNub::reportMaxWriteTransfer(UInt64 blockSize
,UInt64
*max
)
165 return(_provider
->reportMaxWriteTransfer(blockSize
,max
));
169 IOSCSIHDDriveNub::reportMediaState(bool *mediaPresent
,bool *changed
)
171 return(_provider
->reportMediaState(mediaPresent
,changed
));
175 IOSCSIHDDriveNub::reportRemovability(bool *isRemovable
)
177 return(_provider
->reportRemovability(isRemovable
));
181 IOSCSIHDDriveNub::reportWriteProtection(bool *isWriteProtected
)
183 return(_provider
->reportWriteProtection(isWriteProtected
));