Annotation of XNU/iokit/Families/IOATAPIHDDrive/IOATAPIHDDriveNub.cpp, 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:  * IOATAPIHDDriveNub.cpp
        !            26:  *
        !            27:  * This subclass implements a relay to a protocol and device-specific
        !            28:  * provider.
        !            29:  *
        !            30:  * HISTORY
        !            31:  * 2-Sep-1999          Joe Liu (jliu) created.
        !            32:  */
        !            33: 
        !            34: #include <IOKit/IOLib.h>
        !            35: #include <IOKit/storage/ata/IOATAPIHDDriveNub.h>
        !            36: #include <IOKit/storage/ata/IOATAPIHDDrive.h>
        !            37: 
        !            38: #define        super   IOHDDriveNub
        !            39: OSDefineMetaClassAndStructors( IOATAPIHDDriveNub, IOHDDriveNub )
        !            40: 
        !            41: // --------------------------------------------------------------------------
        !            42: // attach to provider.
        !            43: 
        !            44: bool IOATAPIHDDriveNub::attach(IOService * provider)
        !            45: {    
        !            46:     if (!super::attach(provider))
        !            47:         return false;
        !            48: 
        !            49:     _provider = OSDynamicCast(IOATAPIHDDrive, provider);
        !            50:     if (_provider == 0) {
        !            51:         IOLog("IOATAPIHDDriveNub: attach; wrong provider type!\n");
        !            52:         return false;
        !            53:        }
        !            54: 
        !            55:        return true;
        !            56: }
        !            57: 
        !            58: // --------------------------------------------------------------------------
        !            59: // detach from provider.
        !            60: 
        !            61: void IOATAPIHDDriveNub::detach(IOService * provider)
        !            62: {
        !            63:     if (_provider == provider)
        !            64:                _provider = 0;
        !            65: 
        !            66:     super::detach(provider);
        !            67: }
        !            68: 
        !            69: // --------------------------------------------------------------------------
        !            70: // 
        !            71: 
        !            72: IOReturn IOATAPIHDDriveNub::doAsyncReadWrite(IOMemoryDescriptor * buffer,
        !            73:                                              UInt32               block,
        !            74:                                              UInt32               nblks,
        !            75:                                              gdCompletionFunction action,
        !            76:                                              IOService *          target,
        !            77:                                              void *               param)
        !            78: {
        !            79:        return (_provider->doAsyncReadWrite(buffer,
        !            80:                                         block,
        !            81:                                         nblks,
        !            82:                                         action,
        !            83:                                         target,
        !            84:                                         param));
        !            85: }
        !            86: 
        !            87: IOReturn IOATAPIHDDriveNub::doSyncReadWrite(IOMemoryDescriptor *buffer,
        !            88:                                      UInt32 block,UInt32 nblks)
        !            89: {
        !            90:         return(kIOReturnUnsupported);  //xxx must be implemented!
        !            91: }
        !            92: 
        !            93: 
        !            94: // --------------------------------------------------------------------------
        !            95: // 
        !            96: 
        !            97: IOReturn IOATAPIHDDriveNub::doEjectMedia()
        !            98: {
        !            99:     return (_provider->doEjectMedia());
        !           100: }
        !           101: 
        !           102: // --------------------------------------------------------------------------
        !           103: // 
        !           104: 
        !           105: IOReturn IOATAPIHDDriveNub::doFormatMedia(UInt64 byteCapacity)  
        !           106: {
        !           107:     return (_provider->doFormatMedia(byteCapacity));
        !           108: }
        !           109: 
        !           110: // --------------------------------------------------------------------------
        !           111: // 
        !           112: 
        !           113: UInt32
        !           114: IOATAPIHDDriveNub::doGetFormatCapacities(UInt64 * capacities,
        !           115:                                          UInt32   capacitiesMaxCount) const
        !           116: {
        !           117:     return (_provider->doGetFormatCapacities(capacities, capacitiesMaxCount));
        !           118: }
        !           119: 
        !           120: // --------------------------------------------------------------------------
        !           121: // 
        !           122: 
        !           123: IOReturn IOATAPIHDDriveNub::doLockUnlockMedia(bool doLock)
        !           124: {
        !           125:     return (_provider->doLockUnlockMedia(doLock));
        !           126: }
        !           127: 
        !           128: // --------------------------------------------------------------------------
        !           129: // 
        !           130: 
        !           131: IOReturn IOATAPIHDDriveNub::doSynchronizeCache()
        !           132: {
        !           133:     if (_provider)
        !           134:         return (_provider->doSynchronizeCache());
        !           135:        
        !           136:        return kIOReturnSuccess;
        !           137: }
        !           138: 
        !           139: IOReturn IOATAPIHDDriveNub::executeCdb(struct cdbParams *params)
        !           140: {
        !           141:     return(kIOReturnUnsupported);              // xxx must be implemented!
        !           142: }
        !           143: 
        !           144: // --------------------------------------------------------------------------
        !           145: // 
        !           146: 
        !           147: char * IOATAPIHDDriveNub::getVendorString()
        !           148: {
        !           149:     return (_provider->getVendorString());
        !           150: }
        !           151: 
        !           152: // --------------------------------------------------------------------------
        !           153: // 
        !           154: 
        !           155: char * IOATAPIHDDriveNub::getProductString()
        !           156: {
        !           157:     return (_provider->getProductString());
        !           158: }
        !           159: 
        !           160: // --------------------------------------------------------------------------
        !           161: // 
        !           162: 
        !           163: char * IOATAPIHDDriveNub::getRevisionString()
        !           164: {
        !           165:     return (_provider->getRevisionString());
        !           166: }
        !           167: 
        !           168: // --------------------------------------------------------------------------
        !           169: // 
        !           170: 
        !           171: char * IOATAPIHDDriveNub::getAdditionalDeviceInfoString()
        !           172: {
        !           173:     return (_provider->getAdditionalDeviceInfoString());
        !           174: }
        !           175: 
        !           176: // --------------------------------------------------------------------------
        !           177: // 
        !           178: 
        !           179: IOReturn IOATAPIHDDriveNub::reportBlockSize(UInt64 * blockSize)
        !           180: {
        !           181:     return (_provider->reportBlockSize(blockSize));
        !           182: }
        !           183: 
        !           184: // --------------------------------------------------------------------------
        !           185: // 
        !           186: 
        !           187: IOReturn IOATAPIHDDriveNub::reportEjectability(bool * isEjectable)
        !           188: {
        !           189:     return (_provider->reportEjectability(isEjectable));
        !           190: }
        !           191: 
        !           192: // --------------------------------------------------------------------------
        !           193: // 
        !           194: 
        !           195: IOReturn IOATAPIHDDriveNub::reportLockability(bool * isLockable)
        !           196: {
        !           197:     return (_provider->reportLockability(isLockable));
        !           198: }
        !           199: 
        !           200: // --------------------------------------------------------------------------
        !           201: // 
        !           202: 
        !           203: IOReturn IOATAPIHDDriveNub::reportPollRequirements(bool * pollIsRequired,
        !           204:                                                    bool * pollIsExpensive)
        !           205: {
        !           206:     return (_provider->reportPollRequirements(pollIsRequired, 
        !           207:                                               pollIsExpensive));
        !           208: }
        !           209: 
        !           210: // --------------------------------------------------------------------------
        !           211: // 
        !           212: 
        !           213: IOReturn IOATAPIHDDriveNub::reportMaxReadTransfer(UInt64   blockSize,
        !           214:                                                   UInt64 * max)
        !           215: {
        !           216:     return (_provider->reportMaxReadTransfer(blockSize, max));
        !           217: }
        !           218: 
        !           219: // --------------------------------------------------------------------------
        !           220: // 
        !           221: 
        !           222: IOReturn IOATAPIHDDriveNub::reportMaxValidBlock(UInt64 * maxBlock)
        !           223: {
        !           224:     return (_provider->reportMaxValidBlock(maxBlock));
        !           225: }
        !           226: 
        !           227: // --------------------------------------------------------------------------
        !           228: // 
        !           229: 
        !           230: IOReturn IOATAPIHDDriveNub::reportMaxWriteTransfer(UInt64   blockSize, 
        !           231:                                                    UInt64 * max)
        !           232: {
        !           233:     return (_provider->reportMaxWriteTransfer(blockSize, max));
        !           234: }
        !           235: 
        !           236: // --------------------------------------------------------------------------
        !           237: // 
        !           238: 
        !           239: IOReturn IOATAPIHDDriveNub::reportMediaState(bool * mediaPresent,
        !           240:                                              bool * changed)    
        !           241: {
        !           242:     return (_provider->reportMediaState(mediaPresent,changed));
        !           243: }
        !           244: 
        !           245: // --------------------------------------------------------------------------
        !           246: // 
        !           247: 
        !           248: IOReturn IOATAPIHDDriveNub::reportRemovability(bool * isRemovable)
        !           249: {
        !           250:     return (_provider->reportRemovability(isRemovable));
        !           251: }
        !           252: 
        !           253: // --------------------------------------------------------------------------
        !           254: // 
        !           255: 
        !           256: IOReturn IOATAPIHDDriveNub::reportWriteProtection(bool * isWriteProtected)
        !           257: {
        !           258:     return (_provider->reportWriteProtection(isWriteProtected));
        !           259: }

unix.superglobalmegacorp.com

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