1/* 2 * Copyright (c) 1998-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 @header ATADeviceNub.h 25 @abstract A concrete implementation of IOATADevice. 26 */ 27 28#ifndef _ATADEVICENUB_H 29#define _ATADEVICENUB_H 30 31#include <IOKit/IOTypes.h> 32#include "IOATATypes.h" 33#include "IOATADevice.h" 34#include "IOATAController.h" 35 36#include "IOATABusCommand.h" 37 38 39/*! 40@class ATADeviceNub 41@abstract ATADeviceNub is a concrete implementation of IOATADevice. 42@discussion clients of IOATA (disk drivers) should use the interface presented 43by IOATADevice. Concrete nubs are private to the IOATA family and 44specific subclasses of IOATADevice are instantiated by controller 45drivers to provide the abstract interface to clients. 46 47*/ 48class ATADeviceNub : public IOATADevice 49{ 50 OSDeclareDefaultStructors(ATADeviceNub); 51 52public: 53 54 /*!@function ataDeviceNub 55 @abstract static creator function - used by IOATAControllers to create nubs. 56 */ 57 static ATADeviceNub* ataDeviceNub( IOATAController* provider, ataUnitID unit, ataDeviceType devType); 58 59 /*!@function attach 60 @abstract override of IOService method. 61 */ 62 virtual bool attach(IOService* provider ); 63 64 65 // overrides from IOATADevice to provide actual client interface 66 67 68 /*!@function executeCommand 69 @abstract Submit IO requests 70 */ 71 virtual IOReturn executeCommand(IOATACommand* command); 72 73 // create and destroy IOATACommands 74 /*!@function allocCommand 75 @abstract create command objects for clients. 76 */ 77 virtual IOATACommand* allocCommand( void ); 78 79 /*!@function freeCommand 80 @abstract Clients use this method to dispose of command objects. 81 */ 82 virtual void freeCommand( IOATACommand* inCommand); 83 84 85protected: 86 87 /*!@function init 88 @abstract used after creating the nub. 89 */ 90 virtual bool init(IOATAController* provider, ataUnitID unit, ataDeviceType devType); 91 92 /*!@function publishProperties 93 @abstract publish the nub's properties in the device tree. 94 */ 95 virtual void publishProperties( void ); 96 97 /*!@function publishBusProperties 98 @abstract puts info about this device's bus capability in the device tree. 99 */ 100 virtual void publishBusProperties(void); 101 102 /*!@function publishVendorProperties 103 @abstract will be deprecated. 104 */ 105 virtual void publishVendorProperties( void ); 106 107 /*!@function getDeviceID 108 @abstract get the unit id of this drive (0 or 1) 109 */ 110 virtual IOReturn getDeviceID(void); 111 112 /*!@function MyATACallback 113 @abstract to be deprecated. 114 */ 115 static void MyATACallback(IOATACommand* command ); 116 117 /*!@function processCallback 118 @abstract to be deprecated. 119 */ 120 void processCallback(IOATACommand* command ); 121 122 /*!@function swapBytes16 123 @abstract to be deprecated. 124 */ 125 void swapBytes16( UInt8* dataBuffer, IOByteCount length); 126 127 UInt8* buffer; 128 129protected: 130/*! @struct ExpansionData 131 @discussion This structure will be used to expand the capablilties of the ATADeviceNub in the future. 132 */ 133 struct ExpansionData { }; 134 135/*! @var reserved 136 Reserved for future use. (Internal use only) */ 137 ExpansionData *reserved; 138 139private: 140 OSMetaClassDeclareReservedUnused(ATADeviceNub, 0); 141 OSMetaClassDeclareReservedUnused(ATADeviceNub, 1); 142 OSMetaClassDeclareReservedUnused(ATADeviceNub, 2); 143 OSMetaClassDeclareReservedUnused(ATADeviceNub, 3); 144 OSMetaClassDeclareReservedUnused(ATADeviceNub, 4); 145 OSMetaClassDeclareReservedUnused(ATADeviceNub, 5); 146 OSMetaClassDeclareReservedUnused(ATADeviceNub, 6); 147 OSMetaClassDeclareReservedUnused(ATADeviceNub, 7); 148 OSMetaClassDeclareReservedUnused(ATADeviceNub, 8); 149 OSMetaClassDeclareReservedUnused(ATADeviceNub, 9); 150 OSMetaClassDeclareReservedUnused(ATADeviceNub, 10); 151 OSMetaClassDeclareReservedUnused(ATADeviceNub, 11); 152 OSMetaClassDeclareReservedUnused(ATADeviceNub, 12); 153 OSMetaClassDeclareReservedUnused(ATADeviceNub, 13); 154 OSMetaClassDeclareReservedUnused(ATADeviceNub, 14); 155 OSMetaClassDeclareReservedUnused(ATADeviceNub, 15); 156 OSMetaClassDeclareReservedUnused(ATADeviceNub, 16); 157 OSMetaClassDeclareReservedUnused(ATADeviceNub, 17); 158 OSMetaClassDeclareReservedUnused(ATADeviceNub, 18); 159 OSMetaClassDeclareReservedUnused(ATADeviceNub, 19); 160 OSMetaClassDeclareReservedUnused(ATADeviceNub, 20); 161 162}; 163 164#endif /* !_IOATABUSNUB_H */ 165