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#ifndef _IOATABUSINFO_H 25#define _IOATABUSINFO_H 26 27#include <libkern/c++/OSObject.h> 28#include <IOKit/IOTypes.h> 29#include "IOATATypes.h" 30 31/*! 32@class IOATABusInfo 33@discussion used to indicate the capabilities of the bus the device is connected to, PIO and DMA modes supported, etc. 34*/ 35 36class IOATABusInfo : public OSObject 37{ 38 OSDeclareDefaultStructors( IOATABusInfo ); 39 40 public: 41 42 /*!@function atabusinfo 43 @abstract factory method 44 */ 45 static IOATABusInfo* atabusinfo(void); 46 47 /*!@function zeroData 48 @abstract set this object to a blank state. 49 */ 50 virtual void zeroData(void); 51 52 // Used by clients of ATAControllers to find out about the bus 53 // capability. 54 55 /*!@function getSocketType 56 @abstract returns the socket type, internal fixed, media-bay, PC-Card 57 Used by clients of ATAControllers to find out about the bus 58 */ 59 ataSocketType getSocketType( void ); 60 61 /*!@function getPIOModes 62 @abstract returns the bit-significant map of PIO mode(s) supported on the bus. 63 Used by clients of ATAControllers to find out about the bus. 64 */ 65 UInt8 getPIOModes( void ); 66 67 /*!@function getDMAModes 68 @abstract bit-significant map of DMA mode(s) supported on the bus. 69 Used by clients of ATAControllers to find out about the bus. 70 */ 71 UInt8 getDMAModes( void ); 72 73 /*!@function getUltraModes 74 @abstract bit-significant map of Ultra mode(s) supported on the bus. 75 Used by clients of ATAControllers to find out about the bus. 76 */ 77 UInt8 getUltraModes( void ); 78 79 /*!@function getUnits 80 @abstract How many devices are present on bus. 81 Used by clients of ATAControllers to find out about the bus. 82 */ 83 UInt8 getUnits( void ); 84 85 /*!@function supportsDMA 86 @abstract True = DMA supported on bus - inferred by looking at the DMA mode bits. 87 Used by clients of ATAControllers to find out about the bus. 88 */ 89 bool supportsDMA( void ); 90 91 /*!@function supportsExtendedLBA 92 @abstract Supports 48-bit LBA if true. 93 Used by clients of ATAControllers to find out about the bus. 94 */ 95 bool supportsExtendedLBA( void ); 96 97 /*!@function maxBlocksExtended 98 @abstract The maximum number of 512-byte blocks this controller supports 99 in a single Extended LBA transfer. Some controllers may be limited to less than 100 the maximum sector count allowed under extended LBA protocol. 101 */ 102 UInt16 maxBlocksExtended(void); 103 104 /*!@function supportsOverlapped 105 @abstract Supports overlapped packet feature set if true. 106 Used by clients of ATAControllers to find out about the bus. 107 */ 108 bool supportsOverlapped( void ); 109 110 /*!@function supportsDMAQueued 111 @abstract Supports DMA Queued Feature set if true. 112 Used by clients of ATAControllers to find out about the bus. 113 */ 114 bool supportsDMAQueued( void ); 115 116 117 // Used by ATAControllers to generate an information object. 118 // Would not be used by disk device drivers normally. 119 // Bus controllers should set these items everytime. 120 121 /*!@function setSocketType 122 @abstract internal fixed, media-bay, PC-Card. Set by ATAControllers. 123 */ 124 void setSocketType( ataSocketType inSocketType ); 125 126 /*!@function setPIOModes 127 @abstract Bit significant map of supported transfer modes. Set by ATAControllers. 128 */ 129 void setPIOModes( UInt8 inModeBitMap); 130 131 /*!@function setDMAModes 132 @abstract Bit significant map of supported transfer modes. Set by ATAControllers. 133 */ 134 void setDMAModes( UInt8 inModeBitMap ); 135 136 /*!@function setUltraModes 137 @abstract Bit significant map of supported transfer modes. Set by ATAControllers. 138 */ 139 void setUltraModes( UInt8 inModeBitMap ); 140 141 /*!@function setUnits 142 @abstract set to indicate how many devices are on this bus. Set by ATAControllers. 143 */ 144 void setUnits( UInt8 inNumUnits ); 145 146 // Optional bus protocols some busses may support 147 /*!@function setExtendedLBA 148 @abstract Set true for supports 48-bit LBA. Set by ATAControllers. 149 */ 150 void setExtendedLBA( bool inState ); 151 152 /*!function setMaxBlocksExtended 153 @abstract value set by controllers to indicate the maximum number of blocks 154 allowed in a single transfer of data. Some dma engines may not be capable of supporting the full 155 16-bit worth of sector count allowed under 48 bit extended LBA. Default is 256 blocks, same as 156 standard ATA. 157 */ 158 void setMaxBlocksExtended( UInt16 inMaxBlocks); 159 160 /*!@function setOverlapped 161 @abstract Set true for supports overlapped packet feature set. Set by ATAControllers. 162 */ 163 void setOverlapped( bool inState); 164 165 /*!@function setDMAQueued 166 @abstract Set true if supports DMA Queued Feature. Set by ATAControllers. 167 */ 168 void setDMAQueued( bool inState); // 169 170 protected: 171 172 UInt8 _PIOModes; /* PIO modes supported (bit-significant) */ 173 UInt8 _MultiDMAModes; /* <--: Multiword DMA modes supported (b-sig) */ 174 UInt8 _UltraDMAModes; /* <--: Ultra DMA modes supported (b-sig) */ 175 bool _ExtendedLBA; /* <--: Suppports 48-bit LBA protocol */ 176 bool _Overlapped; /* <--: Supports overlapped packet feature set */ 177 bool _DMAQueued; /* <--: Supports DMA Queued Feature set */ 178 ataSocketType _SocketType; /* <--: Indicates bus is fixed internal, removable media-bay, removable PC-Card or unknown type */ 179 UInt8 _numUnits; /* <--: How many devices on this bus */ 180 UInt16 _maxBlocksExtended; 181 182 protected: 183/*! @struct ExpansionData 184 @discussion This structure will be used to expand the capablilties of the IOWorkLoop in the future. 185 */ 186 struct ExpansionData { }; 187 188/*! @var reserved 189 Reserved for future use. (Internal use only) */ 190 ExpansionData *reserved; 191 192 virtual bool init(); 193 194private: 195 OSMetaClassDeclareReservedUnused(IOATABusInfo, 0); 196 OSMetaClassDeclareReservedUnused(IOATABusInfo, 1); 197 OSMetaClassDeclareReservedUnused(IOATABusInfo, 2); 198 OSMetaClassDeclareReservedUnused(IOATABusInfo, 3); 199 OSMetaClassDeclareReservedUnused(IOATABusInfo, 4); 200 OSMetaClassDeclareReservedUnused(IOATABusInfo, 5); 201 OSMetaClassDeclareReservedUnused(IOATABusInfo, 6); 202 OSMetaClassDeclareReservedUnused(IOATABusInfo, 7); 203 OSMetaClassDeclareReservedUnused(IOATABusInfo, 8); 204 OSMetaClassDeclareReservedUnused(IOATABusInfo, 9); 205 OSMetaClassDeclareReservedUnused(IOATABusInfo, 10); 206 OSMetaClassDeclareReservedUnused(IOATABusInfo, 11); 207 OSMetaClassDeclareReservedUnused(IOATABusInfo, 12); 208 OSMetaClassDeclareReservedUnused(IOATABusInfo, 13); 209 OSMetaClassDeclareReservedUnused(IOATABusInfo, 14); 210 OSMetaClassDeclareReservedUnused(IOATABusInfo, 15); 211 OSMetaClassDeclareReservedUnused(IOATABusInfo, 16); 212 OSMetaClassDeclareReservedUnused(IOATABusInfo, 17); 213 OSMetaClassDeclareReservedUnused(IOATABusInfo, 18); 214 OSMetaClassDeclareReservedUnused(IOATABusInfo, 19); 215 OSMetaClassDeclareReservedUnused(IOATABusInfo, 20); 216}; 217 218 219#endif /* !_IOATABUSINFO_H */ 220