1/* 2 * Copyright (c) 2000-2008 Apple 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 23/* 24 * 25 * IOATABusInfo.cpp 26 * 27 */ 28 29 30#include<IOKit/IOTypes.h> 31#include"IOATATypes.h" 32#include"IOATABusInfo.h" 33 34#ifdef DLOG 35#undef DLOG 36#endif 37 38#ifdef ATA_DEBUG 39#define DLOG(fmt, args...) IOLog(fmt, ## args) 40#else 41#define DLOG(fmt, args...) 42#endif 43 44 45//--------------------------------------------------------------------------- 46 47#define super OSObject 48 49OSDefineMetaClassAndStructors( IOATABusInfo, OSObject ) 50 51OSMetaClassDefineReservedUnused(IOATABusInfo, 0); 52OSMetaClassDefineReservedUnused(IOATABusInfo, 1); 53OSMetaClassDefineReservedUnused(IOATABusInfo, 2); 54OSMetaClassDefineReservedUnused(IOATABusInfo, 3); 55OSMetaClassDefineReservedUnused(IOATABusInfo, 4); 56OSMetaClassDefineReservedUnused(IOATABusInfo, 5); 57OSMetaClassDefineReservedUnused(IOATABusInfo, 6); 58OSMetaClassDefineReservedUnused(IOATABusInfo, 7); 59OSMetaClassDefineReservedUnused(IOATABusInfo, 8); 60OSMetaClassDefineReservedUnused(IOATABusInfo, 9); 61OSMetaClassDefineReservedUnused(IOATABusInfo, 10); 62OSMetaClassDefineReservedUnused(IOATABusInfo, 11); 63OSMetaClassDefineReservedUnused(IOATABusInfo, 12); 64OSMetaClassDefineReservedUnused(IOATABusInfo, 13); 65OSMetaClassDefineReservedUnused(IOATABusInfo, 14); 66OSMetaClassDefineReservedUnused(IOATABusInfo, 15); 67OSMetaClassDefineReservedUnused(IOATABusInfo, 16); 68OSMetaClassDefineReservedUnused(IOATABusInfo, 17); 69OSMetaClassDefineReservedUnused(IOATABusInfo, 18); 70OSMetaClassDefineReservedUnused(IOATABusInfo, 19); 71OSMetaClassDefineReservedUnused(IOATABusInfo, 20); 72 73 74/*----------------------------------------------------------------------------- 75 * 76 * 77 *-----------------------------------------------------------------------------*/ 78IOATABusInfo* 79IOATABusInfo::atabusinfo(void) 80{ 81 IOATABusInfo* info = new IOATABusInfo; 82 83 if( ! info ) 84 return 0L; 85 86 if( !info->init() ) 87 return 0L; 88 89 return info; 90 91 92} 93 94 95 96/*----------------------------------------------------------------------------- 97 * 98 * 99 *-----------------------------------------------------------------------------*/ 100bool 101IOATABusInfo::init() 102{ 103 104 if( ! super::init() ) 105 return false; 106 107 zeroData(); 108 109 return true; 110 111} 112 113/*----------------------------------------------------------------------------- 114 * 115 * 116 *-----------------------------------------------------------------------------*/ 117void 118IOATABusInfo::zeroData(void) 119{ 120 121 _PIOModes = 0x00; 122 _MultiDMAModes = 0x00; 123 _UltraDMAModes = 0x00; 124 _ExtendedLBA = false; 125 _Overlapped = false; 126 _DMAQueued = false; 127 _SocketType = kUnknownSocket; 128 _maxBlocksExtended = 256; 129 130} 131 132 133 134 135/*----------------------------------------------------------------------------- 136 * 137 * 138 *-----------------------------------------------------------------------------*/ 139 140UInt8 141IOATABusInfo::getPIOModes( void ) 142{ 143 144 return _PIOModes; 145 146} 147 148 149 150 151 152/*----------------------------------------------------------------------------- 153 * 154 * 155 *-----------------------------------------------------------------------------*/ 156 157UInt8 158IOATABusInfo::getDMAModes( void ) 159{ 160 161 162 return _MultiDMAModes; 163 164} 165 166 167 168 169 170/*----------------------------------------------------------------------------- 171 * 172 * 173 *-----------------------------------------------------------------------------*/ 174 175UInt8 176IOATABusInfo::getUltraModes( void ) 177{ 178 179 return _UltraDMAModes; 180 181 182} 183 184 185 186 187 188 189/*----------------------------------------------------------------------------- 190 * 191 * 192 *-----------------------------------------------------------------------------*/ 193 194bool 195IOATABusInfo::supportsDMA( void ) 196{ 197 198 if( (_MultiDMAModes != 0x00) || (_UltraDMAModes != 0x00) ) 199 return true; 200 201 return false; 202 203 204} 205 206 207 208 209 210/*----------------------------------------------------------------------------- 211 * 212 * 213 *-----------------------------------------------------------------------------*/ 214 215bool 216IOATABusInfo::supportsExtendedLBA( void ) 217{ 218 219 return _ExtendedLBA; 220 221 222} 223 224 225 226 227 228/*----------------------------------------------------------------------------- 229 * 230 * 231 *-----------------------------------------------------------------------------*/ 232 233bool 234IOATABusInfo::supportsOverlapped( void ) 235{ 236 237 return _Overlapped; 238 239 240} 241 242 243 244 245 246/*----------------------------------------------------------------------------- 247 * 248 * 249 *-----------------------------------------------------------------------------*/ 250 251bool 252IOATABusInfo::supportsDMAQueued( void ) 253{ 254 255 256 return _DMAQueued; 257 258} 259 260 261 262 263 264/*----------------------------------------------------------------------------- 265 * 266 * 267 *-----------------------------------------------------------------------------*/ 268 269ataSocketType 270IOATABusInfo::getSocketType( void ) 271{ 272 273 return _SocketType; 274 275 276} 277 278 279 280 281 282 283 284/*----------------------------------------------------------------------------- 285 * 286 * 287 *-----------------------------------------------------------------------------*/ 288 289void 290IOATABusInfo::setPIOModes( UInt8 inModeBitMap) 291{ 292 293 _PIOModes = inModeBitMap; 294 295 296} 297 298 299 300 301 302/*----------------------------------------------------------------------------- 303 * 304 * 305 *-----------------------------------------------------------------------------*/ 306 307void 308IOATABusInfo::setDMAModes( UInt8 inModeBitMap ) 309{ 310 311 312 _MultiDMAModes = inModeBitMap; 313 314} 315 316 317 318 319 320/*----------------------------------------------------------------------------- 321 * 322 * 323 *-----------------------------------------------------------------------------*/ 324 325void 326IOATABusInfo::setUltraModes( UInt8 inModeBitMap ) 327{ 328 329 330 _UltraDMAModes = inModeBitMap; 331 332} 333 334 335 336 337 338 339/*----------------------------------------------------------------------------- 340 * 341 * 342 *-----------------------------------------------------------------------------*/ 343 344void 345IOATABusInfo::setExtendedLBA( bool inState ) 346{ 347 348 349 _ExtendedLBA = inState; 350 351} 352 353 354 355 356 357/*----------------------------------------------------------------------------- 358 * 359 * 360 *-----------------------------------------------------------------------------*/ 361 362void 363IOATABusInfo::setOverlapped( bool inState ) 364{ 365 366 367 _Overlapped = inState; 368 369} 370 371 372 373 374 375/*----------------------------------------------------------------------------- 376 * 377 * 378 *-----------------------------------------------------------------------------*/ 379 380void 381IOATABusInfo::setDMAQueued( bool inState ) 382{ 383 384 385 _DMAQueued = inState; 386 387} 388 389 390 391 392 393/*----------------------------------------------------------------------------- 394 * 395 * 396 *-----------------------------------------------------------------------------*/ 397 398void 399IOATABusInfo::setSocketType( ataSocketType inSocketType ) 400{ 401 402 _SocketType = inSocketType; 403 404 405} 406 407 408 409 410 411/*----------------------------------------------------------------------------- 412 * 413 * 414 *-----------------------------------------------------------------------------*/ 415 416UInt8 417IOATABusInfo::getUnits( void ) 418{ 419 420 return _numUnits; 421 422} 423 424 425/*----------------------------------------------------------------------------- 426 * 427 * 428 *-----------------------------------------------------------------------------*/ 429 430void 431IOATABusInfo::setUnits( UInt8 inNumUnits ) 432{ 433 434 _numUnits = inNumUnits; 435 436 437} 438 439 440void 441IOATABusInfo::setMaxBlocksExtended( UInt16 inMaxBlocks) 442{ 443 _maxBlocksExtended = inMaxBlocks; 444 445} 446 447UInt16 448IOATABusInfo::maxBlocksExtended(void) 449{ 450 451 return _maxBlocksExtended; 452 453} 454