Annotation of XNU/iokit/IOKit/storage/scsi/IOSCSIHDDrive.h, revision 1.1

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:  * Copyright (c) 1999 Apple Computer, Inc.  All rights reserved. 
        !            24:  *
        !            25:  * IOSCSIHDDrive.h
        !            26:  *
        !            27:  * This class implements SCSI hard disk functionality.
        !            28:  *
        !            29:  * Subclasses may modify the operations to handle device-specific variations.
        !            30:  */
        !            31: 
        !            32: #ifndef        _IOSCSIHDDRIVE_H
        !            33: #define        _IOSCSIHDDRIVE_H
        !            34: 
        !            35: #include <IOKit/IOTypes.h>
        !            36: //xxx#include <IOKit/storage/IOStorage.h>
        !            37: #include <IOKit/scsi/IOSCSIDeviceInterface.h>
        !            38: #include <IOKit/storage/scsi/IOBasicSCSI.h>
        !            39: 
        !            40: /* SCSI operation codes: */
        !            41: 
        !            42: const UInt8    SOP_FORMAT      = 0x04;         /* format unit */
        !            43: const UInt8    SOP_STARTSTOP   = 0x1b;         /* start/stop unit */
        !            44: const UInt8    SOP_PREVALLOW   = 0x1e;         /* prevent/allow removal */
        !            45: const UInt8    SOP_SYNCCACHE   = 0x35;         /* synchronize cache */
        !            46: 
        !            47: struct IOFormatcdb {
        !            48:     UInt8      opcode;                 /* 0x12 */
        !            49:     UInt8      lunbits;                /* lun and control bits */
        !            50:     UInt8      vendor;
        !            51:     UInt8      interleave_msb;
        !            52:     UInt8      interleave_lsb;
        !            53:     UInt8      ctlbyte;
        !            54: };
        !            55: 
        !            56: struct IOPrevAllowcdb {
        !            57:     UInt8      opcode;
        !            58:     UInt8      lunbits;
        !            59:     UInt8      reserved1;
        !            60:     UInt8      reserved2;
        !            61:     UInt8      prevent;
        !            62:     UInt8      ctlbyte;
        !            63: };
        !            64: 
        !            65: struct IOStartStopcdb {
        !            66:     UInt8      opcode;
        !            67:     UInt8      lunImmed;
        !            68:     UInt8      reserved1;
        !            69:     UInt8      reserved2;
        !            70: 
        !            71:     /* Control bits: */
        !            72:                                         /* Power Conditions */
        !            73: static const UInt8     P_NOCHANGE      = 0x00; /*  0 - no change */
        !            74: static const UInt8     P_ACTIVE        = 0x10; /*  1 - change to Active */
        !            75: static const UInt8     P_IDLE          = 0x20; /*  2 - change to Idle */
        !            76: static const UInt8     P_STANDBY       = 0x30; /*  3 - change to Standby */
        !            77: static const UInt8     P_RESERVED4     = 0x40; /*  4 - reserved */
        !            78: static const UInt8     P_SLEEP         = 0x50; /*  5 - change to Sleep */
        !            79: static const UInt8     P_RESERVED6     = 0x60; /*  6 - reserved */
        !            80: static const UInt8     P_LUNCONTROL    = 0x70; /*  7 - give pwr ctl to LUN */
        !            81: static const UInt8     P_RESERVED8     = 0x80; /*  8 - reserved */
        !            82: static const UInt8     P_RESERVED9     = 0x90; /*  9 - reserved */
        !            83: static const UInt8     P_TIDLEZERO     = 0xa0; /*  a - force Idle Cond Timer = 0 */
        !            84: static const UInt8     P_TSTDBYZERO    = 0xb0; /*  b - force Stby Cond Timer = 0 */
        !            85: 
        !            86: static const UInt8     C_LOEJ          = 0x02; /* load on start/eject on stop */
        !            87: static const UInt8     C_SPINUP        = 0x01;
        !            88: static const UInt8     C_SPINDOWN      = 0x00;
        !            89: 
        !            90:     UInt8      controls;
        !            91:     UInt8      ctlbyte;
        !            92: };
        !            93: 
        !            94: struct IOSyncCachecdb {
        !            95:     UInt8      opcode;
        !            96:     UInt8      lunbits;
        !            97:     UInt8      lba_3;                  /* msb */
        !            98:     UInt8      lba_2;
        !            99:     UInt8      lba_1;
        !           100:     UInt8      lba_0;                  /* lsb */
        !           101:     UInt8      reserved;
        !           102:     UInt8      nblks_msb;
        !           103:     UInt8      nblks_lsb;
        !           104:     UInt8      ctlbyte;
        !           105: };
        !           106: 
        !           107: /*!
        !           108:  * @enum Power States
        !           109:  * @discussion
        !           110:  * We define and understand three basic, generic power states. A subclass may change
        !           111:  * the power management logic, but all power-management routines should be examined
        !           112:  * if anything is changed. The only routines that deal directly with these values
        !           113:  * are directly related to power management. All other functions merely ask for and
        !           114:  * pass along power state values.
        !           115:  * @constant kAllOff
        !           116:  * The power state for an all-off condition.
        !           117:  * @constant kElectronicsOn
        !           118:  * The power state for the electronics on, but the media off.
        !           119:  * @constant kAllOn
        !           120:  * The power state for the electronics and media on.
        !           121:  * @constant kNumberOfPowerStates
        !           122:  * The maximum enum value.
        !           123:  */
        !           124: enum {                                 /* electronics          mechanical      */
        !           125:     kAllOff            = 0,            /*      OFF             OFF             */
        !           126:     kElectronicsOn     = 1,            /*       ON             OFF             */
        !           127:     kAllOn             = 2,            /*       ON              ON             */
        !           128: 
        !           129:     kNumberOfPowerStates = 3
        !           130: };
        !           131: 
        !           132: /*!
        !           133:  * @class
        !           134:  * IOSCSIHDDrive : public IOBasicSCSI
        !           135:  * @abstract
        !           136:  * SCSI Hard Disk driver.
        !           137:  * @discussion
        !           138:  * IOSCSIHDDrive derives from IOBasicSCSI and adds all functionality
        !           139:  * needed to support removable or fixed hard disk drives.
        !           140:  */
        !           141: 
        !           142: class IOSCSIHDDrive : public IOBasicSCSI {
        !           143: 
        !           144:     OSDeclareDefaultStructors(IOSCSIHDDrive)
        !           145: 
        !           146: public:
        !           147: 
        !           148:     /* Overrides from IOService: */
        !           149: 
        !           150:     virtual bool       init(OSDictionary * properties);
        !           151: 
        !           152:     /*!
        !           153:      * @function start
        !           154:      * @abstract
        !           155:      * Start the driver.
        !           156:      * @discussion
        !           157:      * We override IOBasicSCSI::start so we can initialize Power Management,
        !           158:      * then we call createNub to create an IOSCSIHDDriveNub.
        !           159:      */
        !           160:     virtual bool       start(IOService * provider);
        !           161: 
        !           162:     /* Overrides from IOBasicSCSI: */
        !           163:     
        !           164:     /*!
        !           165:      * @function deviceTypeMatches
        !           166:      * @abstract
        !           167:      * Determine if device type matches expected type.
        !           168:      * @discussion
        !           169:      * We implement this function so we can return a match
        !           170:      * on the hard disk device type.
        !           171:      */
        !           172:     virtual bool       deviceTypeMatches(UInt8 inqBuf[],UInt32 inqLen);
        !           173: 
        !           174:     /*!
        !           175:      * @function constructDeviceProperties
        !           176:      * @abstract
        !           177:      * Construct a set of properties about the device.
        !           178:      * @discussion
        !           179:      * This function creates a set of properties reflecting information
        !           180:      * about the device.
        !           181:      * 
        !           182:      * This function is presently not used.
        !           183:      * @result
        !           184:      * A pointer to an OSDictionary containing the properties. The caller
        !           185:      * is responsible for releasing the OSDictionary.
        !           186:      */
        !           187:     virtual OSDictionary *constructDeviceProperties(void);
        !           188: 
        !           189:     /*!
        !           190:      * @function RWCompletion
        !           191:      * @abstract
        !           192:      * Asynchronous read/write completion routine.
        !           193:      * @discussion
        !           194:      * We implement this function in this class. It is called from the base
        !           195:      * class when an IO operation completes.
        !           196:      */
        !           197:     virtual void       RWCompletion(struct context *cx);
        !           198: 
        !           199:     /* End of IOBasicSCSI overrides */
        !           200:     
        !           201:     /* Additional API added to IOBasicSCSI: */
        !           202: 
        !           203:     /*!
        !           204:      * @function doAsyncReadWrite
        !           205:      * @abstract
        !           206:      * Start an asynchronous read or write operation.
        !           207:      * @discussion
        !           208:      * See IOHDDriveNub for details.
        !           209:      */    
        !           210:     virtual IOReturn   doAsyncReadWrite(IOMemoryDescriptor *buffer,
        !           211:                                             UInt32 block,UInt32 nblks,
        !           212:                                             gdCompletionFunction action,
        !           213:                                             IOService *target,void *param);
        !           214: 
        !           215:     /*!
        !           216:      * @function doSyncReadWrite
        !           217:      * @abstract
        !           218:      * Perform a synchronous read or write operation.
        !           219:      * @discussion
        !           220:      * See IOHDDriveNub for details.
        !           221:      */    
        !           222:     virtual IOReturn   doSyncReadWrite(IOMemoryDescriptor *buffer,UInt32 block,UInt32 nblks);
        !           223: 
        !           224:     /*!
        !           225:      * @function doEjectMedia
        !           226:      * @abstract
        !           227:      * Eject the media.
        !           228:      * @discussion
        !           229:      * See IOHDDriveNub for details.
        !           230:      */    
        !           231:     virtual IOReturn   doEjectMedia(void);
        !           232: 
        !           233:     /*!
        !           234:      * @function doFormatMedia
        !           235:      * @abstract
        !           236:      * Format the media to the specified byte capacity.
        !           237:      * @discussion
        !           238:      * The default implementation ignores the byteCapacity parameter.
        !           239:      * See IOHDDriveNub for details.
        !           240:      */    
        !           241:     virtual IOReturn   doFormatMedia(UInt64 byteCapacity);  
        !           242: 
        !           243:     /*!
        !           244:      * @function doGetFormatCapacities
        !           245:      * @abstract
        !           246:      * Return the allowable formatting byte capacities.
        !           247:      * @discussion
        !           248:      * The default implementation of this method returns a value of block
        !           249:      * size * max block, and a capacities count of 1.
        !           250:      * See IOHDDriveNub for details.
        !           251:      */    
        !           252:     virtual UInt32     doGetFormatCapacities(UInt64 * capacities,
        !           253:                                             UInt32   capacitiesMaxCount) const;   
        !           254: 
        !           255:     /*!
        !           256:      * @function doLockUnlockMedia
        !           257:      * @abstract
        !           258:      * Lock or unlock the (removable) media in the drive.
        !           259:      * @discussion
        !           260:      * This method issues a standard SCSI Prevent/Allow command to lock
        !           261:      * or unlock the media in the drive.
        !           262:      * See IOHDDriveNub for details.
        !           263:      */    
        !           264:     virtual IOReturn   doLockUnlockMedia(bool doLock);
        !           265: 
        !           266:     /*!
        !           267:      * @function doSynchronizeCache
        !           268:      * @abstract
        !           269:      * Force data blocks in the drive's buffer to be flushed to the media.
        !           270:      * @discussion
        !           271:      * This method issues a SCSI Synchronize Cache command, to ensure that
        !           272:      * all blocks in the device cache are written to the media.
        !           273:      * See IOHDDriveNub for details.
        !           274:      */    
        !           275:     virtual IOReturn   doSynchronizeCache(void);
        !           276: 
        !           277:     /*!
        !           278:      * @function reportMediaState
        !           279:      * @abstract
        !           280:      * Report the device's media state.
        !           281:      * @discussion
        !           282:      * This method reports whether media is present or not, and also
        !           283:      * whether the media state has changed since the last call to
        !           284:      * reportMediaState.  The default implementation issues a SCSI Test
        !           285:      * Unit Ready command: depending on the result of that command, the
        !           286:      * following cases are reported:
        !           287:      * 
        !           288:      * 1. TUR status == good completion: we report media present and return
        !           289:      * kIOReturnSuccess.
        !           290:      * 
        !           291:      * 2. TUR status != good completion, but good autosense returned:
        !           292:      * 
        !           293:      * 2a: sense key says not ready: we report media not present
        !           294:      * and return kIOReturnSuccess.
        !           295:      * 
        !           296:      * 2b: sense key is anything else: we report media not present
        !           297:      * and return kIOReturnIOError.
        !           298:      * 
        !           299:      * 3. TUR status != good completion, and no autosense data: we do not
        !           300:      * set mediaPresent or changedState, and we return whatever result
        !           301:      * came back from the SCSI operation.
        !           302:      */    
        !           303:     virtual IOReturn   reportMediaState(bool *mediaPresent,bool *changed);
        !           304:     
        !           305:     /* --- end of additional API --- */
        !           306: 
        !           307: protected:
        !           308:         
        !           309:     /*!
        !           310:      * @function createFormatCdb
        !           311:      * @abstract
        !           312:      * Create a SCSI CDB for a format operation.
        !           313:      * @discussion
        !           314:      * Override this to control the cdb created for a format operation.
        !           315:      * The default implementation creates a 6-byte format command with
        !           316:      * no data buffer, disconnect allowed, 8-byte autosense, and a 15-minute timeout.
        !           317:      * 
        !           318:      * See also: allocateFormatBuffer, deleteFormatBuffer, composeFormatBuffer.
        !           319:      * @param byteCapacity
        !           320:      * The requested byte capacity to which the media should be formatted. This value
        !           321:      * should have been previously validated, otherwise the device may return an error.
        !           322:      * @param cdb
        !           323:      * A pointer to the CDB bytes.
        !           324:      * @param cdbLength
        !           325:      * The length of the CDB in bytes.
        !           326:      * @param block
        !           327:      * The device block to be written.
        !           328:      * @param nblks
        !           329:      * The number of blocks to be transferred.
        !           330:      * @param maxAutoSenseLength
        !           331:      * The maximum size of the autosense data, in bytes. A value of zero
        !           332:      * will disable autosense.
        !           333:      * @param timeoutSeconds
        !           334:      * The command timeout in seconds.
        !           335:      * @result
        !           336:      * The IOSCSICommandOptions returned will be used to issue the command.
        !           337:      */
        !           338:     virtual UInt32     createFormatCdb(
        !           339:                             UInt64 byteCapacity,       /* in  */
        !           340:                             UInt8 *cdb,                        /* in  */
        !           341:                             UInt32 *cdbLength,         /* out */
        !           342:                             UInt8 buf[],               /* in  */
        !           343:                             UInt32 bufLen,             /* in  */
        !           344:                             UInt32 *maxAutoSenseLength,        /* out */
        !           345:                             UInt32 *timeoutSeconds);   /* out */
        !           346: 
        !           347: 
        !           348:     /*!
        !           349:      * @function allocateFormatBuffer
        !           350:      * @abstract
        !           351:      * Create a data buffer to be used for formatting the media.
        !           352:      * @discussion
        !           353:      * If a format buffer is to be used, then "allocateFormatBuffer" and
        !           354:      * deleteFormatBuffer" must be overridden to manage the buffer. The
        !           355:      * buffer must be prepared for IO upon return from allocateFormatBuffer.
        !           356:      * The default implementations of these methods don't allocate a buffer.
        !           357:      * @param buf
        !           358:      * A pointer for the returned buffer pointer.
        !           359:      * @param buflen
        !           360:      * The desired length of the buffer, in bytes.
        !           361:      */    
        !           362:     virtual IOReturn   allocateFormatBuffer(UInt8 **buf,UInt32 *buflen);
        !           363: 
        !           364:     /*!
        !           365:      * @function deleteFormatBuffer
        !           366:      * @abstract
        !           367:      * Delete the data buffer to be used for formatting the media.
        !           368:      * @discussion
        !           369:      * If a format buffer is to be used, then "allocateFormatBuffer" and
        !           370:      * deleteFormatBuffer" must be overridden to manage the buffer.
        !           371:      * The default implementation of this method does nothing.
        !           372:      * @param buf
        !           373:      * A pointer to the buffer to delete.
        !           374:      * @param buflen
        !           375:      * The size of the buffer, in bytes.
        !           376:      */    
        !           377:     virtual void       deleteFormatBuffer(UInt8 *buf,UInt32 buflen);
        !           378: 
        !           379:     /*!
        !           380:      * @function composeFormatBuffer
        !           381:      * @abstract
        !           382:      * Compose the data in the buffer used for the format command.
        !           383:      * @discussion
        !           384:      * This method will be called to compose the data in the format buffer.
        !           385:      * 
        !           386:      * The default implementation of this method does nothing.
        !           387:      * @param buf
        !           388:      * A pointer to the format data buffer.
        !           389:      * @param buflen
        !           390:      * The size of the format data buffer, in bytes.
        !           391:      * @result
        !           392:      * The return value should be the desired values for the "CmpLst" and Defect
        !           393:      * List Format bits in the CDB. The default implementation returns zero.
        !           394:      */    
        !           395:     virtual UInt8      composeFormatBuffer(UInt8 *buf,UInt32 buflen);
        !           396: 
        !           397:     /* Override these methods to save and restore the state of the device electronics
        !           398:      * when power is turned off and on. The defaults do nothing and return kIOReturnSuccess.
        !           399:      */
        !           400: 
        !           401:     /*!
        !           402:      * @function restoreElectronicsState
        !           403:      * @abstract
        !           404:      * Restore the state of the device electronics when powering-up.
        !           405:      * @discussion
        !           406:      * This method is called just after the device transitions from a powered-off state.
        !           407:      * 
        !           408:      * The default implementation of this method does nothing and returns kIOReturnSuccess.
        !           409:      */    
        !           410:     virtual IOReturn   restoreElectronicsState(void);
        !           411: 
        !           412:     /*!
        !           413:      * @function saveElectronicsState
        !           414:      * @abstract
        !           415:      * Save the state of the device electronics when powering-down.
        !           416:      * @discussion
        !           417:      * This method is called just before the device transitions to a powered-off state.
        !           418:      * 
        !           419:      * The default implementation of this method does nothing and returns kIOReturnSuccess.
        !           420:      */    
        !           421:     virtual IOReturn   saveElectronicsState(void);
        !           422:                                                  
        !           423:     /*!
        !           424:      * @function initialPowerStateForDomainState
        !           425:      * @abstract
        !           426:      * Return the initial power state for the device.
        !           427:      * @discussion
        !           428:      * This method is called to obtain the initial power state for the device,
        !           429:      * by calling getInitialPowerState.
        !           430:      * @param domainState
        !           431:      * Power domain state flags.
        !           432:      * @result
        !           433:      * The return value must be a valid power state value.
        !           434:      */    
        !           435:     virtual unsigned long initialPowerStateForDomainState ( IOPMPowerFlags domainState );
        !           436: 
        !           437:     /*!
        !           438:      * @function maxCapabilityForDomainState
        !           439:      * @abstract
        !           440:      * Return the maximum power level obtainable for the given state.
        !           441:      * @discussion
        !           442:      * This method is called to obtain the maximum power level obtainable for the
        !           443:      * given state.
        !           444:      * @param domainState
        !           445:      * Power domain state flags.
        !           446:      * @result
        !           447:      * The return value must be a valid power state value.
        !           448:      */    
        !           449:     virtual unsigned long  maxCapabilityForDomainState ( IOPMPowerFlags domainState );
        !           450: 
        !           451:     /*!
        !           452:      * @function powerStateForDomainState
        !           453:      * Return the maximum power level obtainable for the given state.
        !           454:      * @discussion
        !           455:      * This method is called to obtain the maximum power level obtainable for the
        !           456:      * given state.
        !           457:      * @param domainState
        !           458:      * Power domain state flags.
        !           459:      * @result
        !           460:      * The return value must be a valid power state value.
        !           461:      */    
        !           462:     virtual unsigned long powerStateForDomainState ( IOPMPowerFlags domainState );
        !           463: 
        !           464:     /*!
        !           465:      * @function powerStateDidChangeTo
        !           466:      * @abstract
        !           467:      * React to a change in power state.
        !           468:      * @discussion
        !           469:      * This method is called when the power state changes. We call restoreElectronicsState
        !           470:      * if necessary, then call dequeueCommands if we have changed to a state that has power.
        !           471:      * @param stateOrdinal
        !           472:      * The power level to which we have changed.
        !           473:      */    
        !           474:     virtual IOReturn powerStateDidChangeTo ( unsigned long, unsigned long stateOrdinal, IOService* );
        !           475: 
        !           476:     /*!
        !           477:      * @function powerStateWillChangeTo
        !           478:      * @abstract
        !           479:      * Prepare for a power state change.
        !           480:      * @discussion
        !           481:      * This method is called when the power state will change. If we are powering-up from kAllOff,
        !           482:      * we schedule a call to restoreElectronicsState. If, instead, we are powering-down from an "on" state,
        !           483:      * we schedule a call to saveElectronicsState.
        !           484:      * @param stateOrdinal
        !           485:      * The power level to which we will change.
        !           486:      */    
        !           487:     virtual IOReturn powerStateWillChangeTo ( unsigned long, unsigned long stateOrdinal, IOService* );
        !           488: 
        !           489:     /*!
        !           490:      * @function setPowerState
        !           491:      * @abstract
        !           492:      * Set the power state to the specified state.
        !           493:      * @discussion
        !           494:      * This method is called to cause a change in power state. We handle changes to and from
        !           495:      * kAllOn and kElectronicsOn, which are done by spinning up and down the media.
        !           496:      * @param powerStateOrdinal
        !           497:      * The power level to which we must change.
        !           498:      */    
        !           499:     virtual IOReturn setPowerState ( unsigned long powerStateOrdinal, IOService* );
        !           500: 
        !           501:     /*!
        !           502:      * @function powerTickle
        !           503:      * Check for the device power state currently being in the desired state.
        !           504:      * @discussion
        !           505:      * This method simply "tickles"
        !           506:      * the Power Management subsystem to ensure that the device transitions to the desired
        !           507:      * state if necessary.
        !           508:      */    
        !           509:     virtual bool       powerTickle(UInt32 desiredState);
        !           510: 
        !           511:     /* Override this method to report the initial device power state when its domain is
        !           512:      * powered up. The default implementation assumes the drive spins up.
        !           513:      */
        !           514: 
        !           515:     /*!
        !           516:      * @function getInitialPowerState
        !           517:      * @abstract
        !           518:      * Report the initial power state of the device.
        !           519:      * @discussion
        !           520:      * The default implementation of this method returns kAllOn, assuming that the
        !           521:      * drive spindle spins up initially.
        !           522:      * @result
        !           523:      * The return value must be a valid power state value.
        !           524:      */    
        !           525:     virtual unsigned long getInitialPowerState(void);  /* default = kAllOn */
        !           526:                                                  
        !           527:     /* Override these to change power level required to do various commands. */
        !           528:                                                  
        !           529:     /*!
        !           530:      * @function getEjectPowerState
        !           531:      * @abstract
        !           532:      * Return the required device power level to determine eject the media.
        !           533:      * @discussion
        !           534:      * The default implementation of this method returns kElectronicsOn.
        !           535:      * @result
        !           536:      * The return value must be a valid power state value.
        !           537:      */    
        !           538:     virtual UInt32     getEjectPowerState(void);               /* default = kElectronicsOn */
        !           539: 
        !           540:     /*!
        !           541:      * @function getExecuteCDBPowerState
        !           542:      * @abstract
        !           543:      * @discussion
        !           544:      * @param
        !           545:      * @result
        !           546:      * The return value must be a valid power state value.
        !           547:      */    
        !           548:     virtual UInt32     getExecuteCDBPowerState(void);          /* default = kAllOn */
        !           549: 
        !           550:     /*!
        !           551:      * @function getFormatMediaPowerState
        !           552:      * @abstract
        !           553:      * Return the required device power level to execute a client CDB.
        !           554:      * @discussion
        !           555:      * The default implementation of this method returns kAllOn.
        !           556:      * @result
        !           557:      * The return value must be a valid power state value.
        !           558:      */    
        !           559:     virtual UInt32     getFormatMediaPowerState(void);         /* default = kAllOn */
        !           560: 
        !           561:     /*!
        !           562:      * @function getInquiryPowerState
        !           563:      * @abstract
        !           564:      * Return the required device power level to execute an Inquiry command.
        !           565:      * @discussion
        !           566:      * The default implementation of this method returns kElectronicsOn.
        !           567:      * @result
        !           568:      * The return value must be a valid power state value.
        !           569:      */    
        !           570:     virtual UInt32     getInquiryPowerState(void);             /* default = kElectronicsOn */
        !           571: 
        !           572:     /*!
        !           573:      * @function getLockUnlockMediaPowerState
        !           574:      * @abstract
        !           575:      * Return the required device power level to lock or unlock the media.
        !           576:      * @discussion
        !           577:      * The default implementation of this method returns kElectronicsOn.
        !           578:      * @result
        !           579:      * The return value must be a valid power state value.
        !           580:      */    
        !           581:     virtual UInt32     getLockUnlockMediaPowerState(void);     /* default = kElectronicsOn */
        !           582: 
        !           583:     /*!
        !           584:      * @function getReadCapacityPowerState
        !           585:      * @abstract
        !           586:      * Return the required device power level to execute a Read-Capacity command.
        !           587:      * @discussion
        !           588:      * The default implementation of this method returns kElectronicsOn.
        !           589:      * @result
        !           590:      * The return value must be a valid power state value.
        !           591:      */    
        !           592:     virtual UInt32     getReadCapacityPowerState(void);        /* default = kElectronicsOn */
        !           593: 
        !           594:     /*!
        !           595:      * @function getReadWritePowerState
        !           596:      * @abstract
        !           597:      * Return the required device power level to execute a Read or Write command.
        !           598:      * @discussion
        !           599:      * The default implementation of this method returns kAllOn.
        !           600:      * @result
        !           601:      * The return value must be a valid power state value.
        !           602:      */    
        !           603:     virtual UInt32     getReadWritePowerState(void);           /* default = kAllOn */
        !           604: 
        !           605:     /*!
        !           606:      * @function getReportWriteProtectionPowerState
        !           607:      * @abstract
        !           608:      * Return the required device power level to report media write protection.
        !           609:      * @discussion
        !           610:      * The default implementation of this method returns kElectronicsOn.
        !           611:      * @result
        !           612:      * The return value must be a valid power state value.
        !           613:      */    
        !           614:     virtual UInt32     getReportWriteProtectionPowerState(void); /* default = kElectronicsOn */
        !           615: 
        !           616:     /*!
        !           617:      * @function getStartPowerState
        !           618:      * @abstract
        !           619:      * Return the required device power level to start (spin up) the media.
        !           620:      * @discussion
        !           621:      * The default implementation of this method returns kElectronicsOn.
        !           622:      * @result
        !           623:      * The return value must be a valid power state value.
        !           624:      */    
        !           625:     virtual UInt32     getStartPowerState(void);               /* default = kElectronicsOn */
        !           626: 
        !           627:     /*!
        !           628:      * @function getStopPowerState
        !           629:      * @abstract
        !           630:      * Return the required device power level to stop (spin down) the media.
        !           631:      * @discussion
        !           632:      * The default implementation of this method returns kAllOn.
        !           633:      * @result
        !           634:      * The return value must be a valid power state value.
        !           635:      */    
        !           636:     virtual UInt32     getStopPowerState(void);                /* default = kAllOn */
        !           637: 
        !           638:     /*!
        !           639:      * @function getSynchronizeCachePowerState
        !           640:      * @abstract
        !           641:      * Return the required device power level to issue a Synchronize-Cache command.
        !           642:      * @discussion
        !           643:      * The default implementation of this method returns kAllOn.
        !           644:      * @result
        !           645:      * The return value must be a valid power state value.
        !           646:      */    
        !           647:     virtual UInt32     getSynchronizeCachePowerState(void);    /* default = kAllOn */
        !           648: 
        !           649:     /*!
        !           650:      * @function getTestUnitReadyPowerState
        !           651:      * @abstract
        !           652:      * Return the required device power level to issue a Test Unit Ready command.
        !           653:      * @discussion
        !           654:      * The default implementation of this method returns kElectronicsOn.
        !           655:      * @result
        !           656:      * The return value must be a valid power state value.
        !           657:      */    
        !           658:     virtual UInt32     getTestUnitReadyPowerState(void);       /* default = kElectronicsOn */
        !           659:                                    
        !           660:     /*
        !           661:      * @group
        !           662:      * Internally used methods.
        !           663:      */
        !           664: 
        !           665:     /*!
        !           666:      * @function createNub
        !           667:      * @abstract
        !           668:      * Create, init, attach, and register the device nub.
        !           669:      * @discussion
        !           670:      * This method calls instantiateNub, then init, attach, and register.
        !           671:      * @result
        !           672:      * A pointer to the nub or NULL if something failed.
        !           673:      */    
        !           674:     virtual IOService *        createNub(void);
        !           675: 
        !           676:     /*!
        !           677:      * @function getDeviceTypeName
        !           678:      * @abstract
        !           679:      * Return a character string for the device type.
        !           680:      * @discussion
        !           681:      * The default implementation of this method returns kDeviceTypeHardDisk.   
        !           682:      */
        !           683:     virtual const char * getDeviceTypeName(void);
        !           684: 
        !           685:     /*!
        !           686:      * @function instantiateNub
        !           687:      * @abstract
        !           688:      * Create the device nub.
        !           689:      * @discussion
        !           690:      * A subclass will override this method to change the type of nub created.
        !           691:      * A CD driver, for example, will instantiate an IOSCSICDDriveNub instead
        !           692:      * of the default implementation's IOSCSIHDDriveNub.
        !           693:      */    
        !           694:     virtual IOService *        instantiateNub(void);
        !           695: 
        !           696:     /*!
        !           697:      * @function doStart
        !           698:      * @abstract
        !           699:      * Start (spin up) the media.
        !           700:      * @discussion
        !           701:      * This method calls doStartStop.
        !           702:      */    
        !           703:     virtual IOReturn   doStart(void);
        !           704: 
        !           705:     /*!
        !           706:      * @function doStartStop
        !           707:      * @abstract
        !           708:      * Perform the actual spin up/down command.
        !           709:      * @discussion
        !           710:      * This method issues a SCSI Start Stop Unit command to start or stop
        !           711:      * the device. Because the powerCondition value is only for use with
        !           712:      * SCSI-3 devices, the current implementation ignores powerCondition.
        !           713:      * @param start
        !           714:      * True to start (spin-up) the media; False to stop (spin-down) the media.
        !           715:      * @param loadEject
        !           716:      * True to eject; False to not eject. This parameter is applicable only to a stop
        !           717:      * operation.
        !           718:      * @param powerCondition
        !           719:      * The power condition to which the drive should transition. This is a SCSI-3
        !           720:      * capability; it is presently unused.
        !           721:      */    
        !           722:     virtual IOReturn   doStartStop(bool start,bool loadEject,UInt8 powerCondition);
        !           723: 
        !           724:     /*!
        !           725:      * @function doStop
        !           726:      * @abstract
        !           727:      * Stop (spin down) the media.
        !           728:      * @discussion
        !           729:      * This method calls doStartStop.
        !           730:      */    
        !           731:     virtual IOReturn   doStop(void);
        !           732: 
        !           733:     /*
        !           734:      * @endgroup
        !           735:      */
        !           736:     
        !           737:     /* Device information : */
        !           738: 
        !           739:     /*!
        !           740:      * @var _mediaPresent
        !           741:      * True if media is present; False if media is not present.
        !           742:      */                                                
        !           743:     bool               _mediaPresent;
        !           744: 
        !           745:     /*!
        !           746:      * @var _startStopDisabled
        !           747:      * True if the start/stop commands are disabled due to an error.
        !           748:      */                                                
        !           749:     bool               _startStopDisabled;
        !           750: 
        !           751:     /*!
        !           752:      * @var _restoreState
        !           753:      * True if we must restore the device electronics state after a power-up.
        !           754:      */                                                
        !           755:     bool               _restoreState;          /* true if we must restore after power-up */                                        };
        !           756: #endif

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.