]>
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 | #include <IOKit/IOLib.h> | |
23 | #include <IOKit/storage/scsi/IOSCSIHDDriveNub.h> | |
24 | #include <IOKit/storage/scsi/IOSCSIHDDrive.h> | |
25 | ||
26 | #define super IOBlockStorageDevice | |
27 | OSDefineMetaClassAndStructors(IOSCSIHDDriveNub,IOBlockStorageDevice) | |
28 | ||
29 | bool | |
30 | IOSCSIHDDriveNub::attach(IOService * provider) | |
31 | { | |
32 | // IOLog("IOSCSIHDDriveNub: attach\n"); | |
33 | ||
34 | if (!super::attach(provider)) { | |
35 | return(false); | |
36 | } | |
37 | ||
38 | // IOLog("IOSCSIHDDriveNub: attach; casting provider\n"); | |
39 | _provider = OSDynamicCast(IOSCSIHDDrive,provider); | |
40 | if (_provider == NULL) { | |
41 | IOLog("IOSCSIHDDriveNub: attach; wrong provider type!\n"); | |
42 | return(false); | |
43 | } else { | |
44 | // IOLog("IOSCSIHDDriveNub: attach; provider OK\n"); | |
45 | return(true); | |
46 | } | |
47 | } | |
48 | ||
49 | void IOSCSIHDDriveNub::detach(IOService * provider) | |
50 | { | |
51 | if( _provider == provider) | |
52 | _provider = 0; | |
53 | ||
54 | super::detach( provider ); | |
55 | } | |
56 | ||
57 | IOReturn | |
58 | IOSCSIHDDriveNub::doAsyncReadWrite(IOMemoryDescriptor *buffer, | |
59 | UInt32 block,UInt32 nblks, | |
60 | IOStorageCompletion completion) | |
61 | { | |
62 | return(_provider->doAsyncReadWrite(buffer,block,nblks,completion)); | |
63 | } | |
64 | ||
65 | IOReturn | |
66 | IOSCSIHDDriveNub::doSyncReadWrite(IOMemoryDescriptor *buffer,UInt32 block,UInt32 nblks) | |
67 | { | |
68 | return(_provider->doSyncReadWrite(buffer,block,nblks)); | |
69 | } | |
70 | ||
71 | IOReturn | |
72 | IOSCSIHDDriveNub::doEjectMedia(void) | |
73 | { | |
74 | return(_provider->doEjectMedia()); | |
75 | } | |
76 | ||
77 | IOReturn | |
78 | IOSCSIHDDriveNub::doFormatMedia(UInt64 byteCapacity) | |
79 | { | |
80 | return(_provider->doFormatMedia(byteCapacity)); | |
81 | } | |
82 | ||
83 | UInt32 | |
84 | IOSCSIHDDriveNub::doGetFormatCapacities(UInt64 * capacities, | |
85 | UInt32 capacitiesMaxCount) const | |
86 | { | |
87 | return(_provider->doGetFormatCapacities(capacities,capacitiesMaxCount)); | |
88 | } | |
89 | ||
90 | IOReturn | |
91 | IOSCSIHDDriveNub::doLockUnlockMedia(bool doLock) | |
92 | { | |
93 | return(_provider->doLockUnlockMedia(doLock)); | |
94 | } | |
95 | ||
96 | IOReturn | |
97 | IOSCSIHDDriveNub::doSynchronizeCache(void) | |
98 | { | |
99 | return(_provider->doSynchronizeCache()); | |
100 | } | |
101 | ||
102 | char * | |
103 | IOSCSIHDDriveNub::getVendorString(void) | |
104 | { | |
105 | return(_provider->getVendorString()); | |
106 | } | |
107 | ||
108 | char * | |
109 | IOSCSIHDDriveNub::getProductString(void) | |
110 | { | |
111 | return(_provider->getProductString()); | |
112 | } | |
113 | ||
114 | char * | |
115 | IOSCSIHDDriveNub::getRevisionString(void) | |
116 | { | |
117 | return(_provider->getRevisionString()); | |
118 | } | |
119 | ||
120 | char * | |
121 | IOSCSIHDDriveNub::getAdditionalDeviceInfoString(void) | |
122 | { | |
123 | return(_provider-> getAdditionalDeviceInfoString()); | |
124 | } | |
125 | ||
126 | IOReturn | |
127 | IOSCSIHDDriveNub::reportBlockSize(UInt64 *blockSize) | |
128 | { | |
129 | return(_provider->reportBlockSize(blockSize)); | |
130 | } | |
131 | ||
132 | IOReturn | |
133 | IOSCSIHDDriveNub::reportEjectability(bool *isEjectable) | |
134 | { | |
135 | return(_provider->reportEjectability(isEjectable)); | |
136 | } | |
137 | ||
138 | IOReturn | |
139 | IOSCSIHDDriveNub::reportLockability(bool *isLockable) | |
140 | { | |
141 | return(_provider->reportLockability(isLockable)); | |
142 | } | |
143 | ||
144 | IOReturn | |
145 | IOSCSIHDDriveNub::reportPollRequirements(bool *pollIsRequired,bool *pollIsExpensive) | |
146 | { | |
147 | return(_provider->reportPollRequirements(pollIsRequired,pollIsExpensive)); | |
148 | } | |
149 | ||
150 | IOReturn | |
151 | IOSCSIHDDriveNub::reportMaxReadTransfer (UInt64 blockSize,UInt64 *max) | |
152 | { | |
153 | return(_provider->reportMaxReadTransfer(blockSize,max)); | |
154 | } | |
155 | ||
156 | IOReturn | |
157 | IOSCSIHDDriveNub::reportMaxValidBlock(UInt64 *maxBlock) | |
158 | { | |
159 | return(_provider->reportMaxValidBlock(maxBlock)); | |
160 | } | |
161 | ||
162 | IOReturn | |
163 | IOSCSIHDDriveNub::reportMaxWriteTransfer(UInt64 blockSize,UInt64 *max) | |
164 | { | |
165 | return(_provider->reportMaxWriteTransfer(blockSize,max)); | |
166 | } | |
167 | ||
168 | IOReturn | |
169 | IOSCSIHDDriveNub::reportMediaState(bool *mediaPresent,bool *changed) | |
170 | { | |
171 | return(_provider->reportMediaState(mediaPresent,changed)); | |
172 | } | |
173 | ||
174 | IOReturn | |
175 | IOSCSIHDDriveNub::reportRemovability(bool *isRemovable) | |
176 | { | |
177 | return(_provider->reportRemovability(isRemovable)); | |
178 | } | |
179 | ||
180 | IOReturn | |
181 | IOSCSIHDDriveNub::reportWriteProtection(bool *isWriteProtected) | |
182 | { | |
183 | return(_provider->reportWriteProtection(isWriteProtected)); | |
184 | } |