|
|
1.1 ! root 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: /* ! 23: * ! 24: * IOATADevice.h ! 25: * ! 26: * ! 27: * Methods in this header provide information about the ATA/ATAPI device ! 28: * the device client driver is submitting the ATACommand(s) to. ! 29: * ! 30: * Note: ATACommand(s) are allocated and freed by methods in this class. ! 31: * The remaining methods to setup and submit ATACommands are defined in ! 32: * IOATACommand.h ! 33: */ ! 34: ! 35: class IOATACommand; ! 36: class IOATAController; ! 37: ! 38: class IOATADevice : public IOService ! 39: { ! 40: OSDeclareDefaultStructors(IOATADevice) ! 41: ! 42: friend class IOATACommand; ! 43: friend class IOATAController; ! 44: ! 45: ! 46: /*------------------Methods provided to ATA/ATAPI device clients-----------------------*/ ! 47: public: ! 48: /* ! 49: * Allocate/release/clear an ATACommand ! 50: */ ! 51: IOATACommand *allocCommand( UInt32 clientDataSize = 0 ); ! 52: void releaseCommand( IOATACommand *cmd ); ! 53: void clearCommand( IOATACommand *cmd ); ! 54: ! 55: /* ! 56: * Obtain information about this device ! 57: */ ! 58: UInt32 getUnit(); ! 59: ATADeviceType getDeviceType(); ! 60: bool getIdentifyData( ATAIdentify *identifyBuffer ); ! 61: bool getInquiryData( UInt32 inquiryBufSize, ATAPIInquiry *inquiryBuffer ); ! 62: bool getDeviceCapacity( UInt32 *blockMax, UInt32 *blockSize ); ! 63: bool getProtocols( ATAProtocol *protocols ); ! 64: bool getTimingsSupported( ATATimingProtocol *timingsSupported ); ! 65: bool getTiming( ATATimingProtocol *timingProtocol, ATATiming *timing ); ! 66: IOCommandQueue *getDeviceQueue(); ! 67: ! 68: /* ! 69: * Set default command timeout for this device ! 70: */ ! 71: void setTimeout( UInt32 timeoutMS ); ! 72: ! 73: /* ! 74: * Select default device timing for this device ! 75: */ ! 76: bool selectTiming( ATATimingProtocol timingProtocol ); ! 77: ! 78: /* ! 79: * Misc ! 80: */ ! 81: bool open( IOService *customer ); ! 82: void close( IOService *customer ); ! 83: IOService *getClient(); ! 84: ! 85: bool getATAPIPktInt(); ! 86: ! 87: virtual bool matchPropertyTable( OSDictionary * table ); ! 88: IOService *matchLocation( IOService * ); ! 89: ! 90: /*------------------Methods private to the IOATADevice class----------------*/ ! 91: public: ! 92: bool init( UInt32 unitNum, IOATAController *ctlr ); ! 93: IOReturn message( UInt32 p0, IOService *p1, void *p2 ); ! 94: void free(); ! 95: ! 96: private: ! 97: bool probeDevice(); ! 98: ATADeviceType probeDeviceType(); ! 99: ATAReturnCode doIdentify(void **buffer ); ! 100: ATAReturnCode doInquiry(void **buffer ); ! 101: ATAReturnCode doSpinUp(); ! 102: ATAReturnCode doReadCapacity( void *data ); ! 103: ATAReturnCode doTestUnitReady(); ! 104: ATAReturnCode doSectorCommand( ATACommand ataCmd, UInt32 ataLBA, UInt32 ataCount, void **dataPtr ); ! 105: ! 106: void submitCommand( IOATACommand *cmd ); ! 107: ! 108: bool getATATimings(); ! 109: ! 110: void endianConvertData( void *data, void *endianTable ); ! 111: ! 112: bool executeCommand( IOATACommand *cmd ); ! 113: void completeCommand( IOATACommand *cmd ); ! 114: ! 115: OSDictionary *createProperties(); ! 116: bool addToRegistry( OSDictionary *propTable, OSObject *regObj, char *key ); ! 117: void stripBlanks( char *d, char *s, UInt32 l ); ! 118: ! 119: IOATACommand *makeRequestSense( IOATACommand *origCmd ); ! 120: bool completeRequestSense( IOATACommand *origCmd, IOATACommand *reqSenseCmd ); ! 121: ! 122: ! 123: private: ! 124: IOATAController *controller; ! 125: UInt32 unit; ! 126: ! 127: IOCommandQueue *deviceQueue; ! 128: ! 129: IOService *client; ! 130: ! 131: ATADeviceType deviceType; ! 132: ATAIdentify *identifyData; ! 133: ATAPIInquiry *inquiryData; ! 134: ! 135: IOATACommand *utilCmd; ! 136: IOATACommand *reqSenseCmd; ! 137: ! 138: UInt32 numTimings; ! 139: ATATiming ataTimings[ataMaxTimings]; ! 140: ! 141: bool atapiPktInt; ! 142: ! 143: IORWLock * resetSem; ! 144: ! 145: };
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.