]> git.saurik.com Git - apple/xnu.git/blame - iokit/Families/IOSCSIHDDrive/IOSCSIHDDriveNub.cpp
xnu-123.5.tar.gz
[apple/xnu.git] / iokit / Families / IOSCSIHDDrive / IOSCSIHDDriveNub.cpp
CommitLineData
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
27OSDefineMetaClassAndStructors(IOSCSIHDDriveNub,IOBlockStorageDevice)
28
29bool
30IOSCSIHDDriveNub::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
49void IOSCSIHDDriveNub::detach(IOService * provider)
50{
51 if( _provider == provider)
52 _provider = 0;
53
54 super::detach( provider );
55}
56
57IOReturn
58IOSCSIHDDriveNub::doAsyncReadWrite(IOMemoryDescriptor *buffer,
59 UInt32 block,UInt32 nblks,
60 IOStorageCompletion completion)
61{
62 return(_provider->doAsyncReadWrite(buffer,block,nblks,completion));
63}
64
65IOReturn
66IOSCSIHDDriveNub::doSyncReadWrite(IOMemoryDescriptor *buffer,UInt32 block,UInt32 nblks)
67{
68 return(_provider->doSyncReadWrite(buffer,block,nblks));
69}
70
71IOReturn
72IOSCSIHDDriveNub::doEjectMedia(void)
73{
74 return(_provider->doEjectMedia());
75}
76
77IOReturn
78IOSCSIHDDriveNub::doFormatMedia(UInt64 byteCapacity)
79{
80 return(_provider->doFormatMedia(byteCapacity));
81}
82
83UInt32
84IOSCSIHDDriveNub::doGetFormatCapacities(UInt64 * capacities,
85 UInt32 capacitiesMaxCount) const
86{
87 return(_provider->doGetFormatCapacities(capacities,capacitiesMaxCount));
88}
89
90IOReturn
91IOSCSIHDDriveNub::doLockUnlockMedia(bool doLock)
92{
93 return(_provider->doLockUnlockMedia(doLock));
94}
95
96IOReturn
97IOSCSIHDDriveNub::doSynchronizeCache(void)
98{
99 return(_provider->doSynchronizeCache());
100}
101
102char *
103IOSCSIHDDriveNub::getVendorString(void)
104{
105 return(_provider->getVendorString());
106}
107
108char *
109IOSCSIHDDriveNub::getProductString(void)
110{
111 return(_provider->getProductString());
112}
113
114char *
115IOSCSIHDDriveNub::getRevisionString(void)
116{
117 return(_provider->getRevisionString());
118}
119
120char *
121IOSCSIHDDriveNub::getAdditionalDeviceInfoString(void)
122{
123 return(_provider-> getAdditionalDeviceInfoString());
124}
125
126IOReturn
127IOSCSIHDDriveNub::reportBlockSize(UInt64 *blockSize)
128{
129 return(_provider->reportBlockSize(blockSize));
130}
131
132IOReturn
133IOSCSIHDDriveNub::reportEjectability(bool *isEjectable)
134{
135 return(_provider->reportEjectability(isEjectable));
136}
137
138IOReturn
139IOSCSIHDDriveNub::reportLockability(bool *isLockable)
140{
141 return(_provider->reportLockability(isLockable));
142}
143
144IOReturn
145IOSCSIHDDriveNub::reportPollRequirements(bool *pollIsRequired,bool *pollIsExpensive)
146{
147 return(_provider->reportPollRequirements(pollIsRequired,pollIsExpensive));
148}
149
150IOReturn
151IOSCSIHDDriveNub::reportMaxReadTransfer (UInt64 blockSize,UInt64 *max)
152{
153 return(_provider->reportMaxReadTransfer(blockSize,max));
154}
155
156IOReturn
157IOSCSIHDDriveNub::reportMaxValidBlock(UInt64 *maxBlock)
158{
159 return(_provider->reportMaxValidBlock(maxBlock));
160}
161
162IOReturn
163IOSCSIHDDriveNub::reportMaxWriteTransfer(UInt64 blockSize,UInt64 *max)
164{
165 return(_provider->reportMaxWriteTransfer(blockSize,max));
166}
167
168IOReturn
169IOSCSIHDDriveNub::reportMediaState(bool *mediaPresent,bool *changed)
170{
171 return(_provider->reportMediaState(mediaPresent,changed));
172}
173
174IOReturn
175IOSCSIHDDriveNub::reportRemovability(bool *isRemovable)
176{
177 return(_provider->reportRemovability(isRemovable));
178}
179
180IOReturn
181IOSCSIHDDriveNub::reportWriteProtection(bool *isWriteProtected)
182{
183 return(_provider->reportWriteProtection(isWriteProtected));
184}