1/* 2 * Copyright (c) 2006-2012 Apple Inc. All rights reserved. 3 * 4 * @APPLE_LICENSE_HEADER_START@ 5 * 6 * This file contains Original Code and/or Modifications of Original Code 7 * as defined in and that are subject to the Apple Public Source License 8 * Version 2.0 (the 'License'). You may not use this file except in 9 * compliance with the License. Please obtain a copy of the License at 10 * http://www.opensource.apple.com/apsl/ and read it before using this 11 * file. 12 * 13 * The Original Code and all software distributed under the License are 14 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER 15 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, 16 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, 17 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. 18 * Please see the License for the specific language governing rights and 19 * limitations under the License. 20 * 21 * @APPLE_LICENSE_HEADER_END@ 22 */ 23 24/* 25 * @header IOBDBlockStorageDriver 26 * @abstract 27 * This header contains the IOBDBlockStorageDriver class definition. 28 * @discussion 29 * This class implements BD functionality, independent of 30 * the physical connection protocol (e.g. SCSI, ATA, USB). 31 * 32 * A protocol-specific provider implements the functionality using an appropriate 33 * protocol and commands. 34 */ 35 36#ifndef _IOBDBLOCKSTORAGEDRIVER_H 37#define _IOBDBLOCKSTORAGEDRIVER_H 38 39#include <IOKit/storage/IOBDBlockStorageDevice.h> 40#include <IOKit/storage/IODVDBlockStorageDriver.h> 41 42/* 43 * @defined kIOBDBlockStorageDriverClass 44 * @abstract 45 * kIOBDBlockStorageDriverClass is the name of the IOBDBlockStorageDriver class. 46 * @discussion 47 * kIOBDBlockStorageDriverClass is the name of the IOBDBlockStorageDriver class. 48 */ 49 50#define kIOBDBlockStorageDriverClass "IOBDBlockStorageDriver" 51 52/* 53 * @class 54 * IOBDBlockStorageDriver 55 * @abstract 56 * Generic BD Driver. 57 * @discussion 58 * Storage drivers are split into two parts: the Generic Driver handles 59 * all generic device issues, independent of the lower-level transport 60 * mechanism (e.g. SCSI, ATA, USB, FireWire). All storage operations 61 * at the Generic Driver level are translated into a series of generic 62 * device operations. These operations are passed via the Device Nub 63 * to a Transport Driver, which implements the appropriate 64 * transport-dependent protocol to execute these operations. 65 * 66 * To determine the write-protect state of a device (or media), for 67 * example, the generic driver would issue a call to the 68 * Transport Driver's reportWriteProtection method. If this were a SCSI 69 * device, its Transport Driver would issue a Mode Sense command to 70 * extract the write-protection status bit. The Transport Driver then 71 * reports true or false to the generic driver. 72 * 73 * The generic driver therefore has no knowledge of, or involvement 74 * with, the actual commands and mechanisms used to communicate with 75 * the device. It is expected that the generic driver will rarely, if 76 * ever, need to be subclassed to handle device idiosyncrasies; rather, 77 * the Transport Driver should be changed via overrides. 78 * 79 * A generic driver could be subclassed to create a different type of 80 * generic device. The generic driver IOBDBlockStorageDriver class is a subclass 81 * of IODVDBlockStorageDriver, adding BD functions. Similarly, the Transport Driver 82 * IOBDBlockStorageDevice is a subclass of IODVDBlockStorageDevice, adding BD 83 * functions. 84*/ 85 86class IOBDBlockStorageDriver : public IODVDBlockStorageDriver 87{ 88 OSDeclareDefaultStructors(IOBDBlockStorageDriver) 89 90protected: 91 92 struct ExpansionData { /* */ }; 93 ExpansionData * _expansionData; 94 95 /* Overrides of IODVDBlockStorageDriver. */ 96 97 virtual IOReturn acceptNewMedia(void); 98 99 /* End of IODVDBlockStorageDriver overrides. */ 100 101public: 102 103 /* 104 * Obtain this object's provider. We override the superclass's method to 105 * return a more specific subclass of IOService -- IOBDBlockStorageDevice. 106 * This method serves simply as a convenience to subclass developers. 107 */ 108 109 virtual IOBDBlockStorageDevice * getProvider() const; 110 111 /* Overrides of IODVDBlockStorageDriver: */ 112 113 virtual const char * getDeviceTypeName(void); 114 virtual IOMedia * instantiateDesiredMediaObject(void); 115 virtual IOMedia * instantiateMediaObject(UInt64 base,UInt64 byteSize, 116 UInt32 blockSize,char *mediaName); 117 virtual IOReturn readStructure(IOMemoryDescriptor *buffer,const DVDStructureFormat format, 118 const UInt32 address,const UInt8 layer,const UInt8 agid); 119 120 /* End of IODVDBlockStorageDriver overrides. */ 121 122 /* 123 * @function splitTrack 124 * @discussion 125 * Issue an MMC RESERVE TRACK command with the ARSV bit. 126 * @param address 127 * As documented by MMC. 128 * @result 129 * Returns the status of the operation. 130 */ 131 132 virtual IOReturn splitTrack(UInt32 address); 133 134 OSMetaClassDeclareReservedUnused(IOBDBlockStorageDriver, 0); 135 OSMetaClassDeclareReservedUnused(IOBDBlockStorageDriver, 1); 136 OSMetaClassDeclareReservedUnused(IOBDBlockStorageDriver, 2); 137 OSMetaClassDeclareReservedUnused(IOBDBlockStorageDriver, 3); 138 OSMetaClassDeclareReservedUnused(IOBDBlockStorageDriver, 4); 139 OSMetaClassDeclareReservedUnused(IOBDBlockStorageDriver, 5); 140 OSMetaClassDeclareReservedUnused(IOBDBlockStorageDriver, 6); 141 OSMetaClassDeclareReservedUnused(IOBDBlockStorageDriver, 7); 142 OSMetaClassDeclareReservedUnused(IOBDBlockStorageDriver, 8); 143 OSMetaClassDeclareReservedUnused(IOBDBlockStorageDriver, 9); 144 OSMetaClassDeclareReservedUnused(IOBDBlockStorageDriver, 10); 145 OSMetaClassDeclareReservedUnused(IOBDBlockStorageDriver, 11); 146 OSMetaClassDeclareReservedUnused(IOBDBlockStorageDriver, 12); 147 OSMetaClassDeclareReservedUnused(IOBDBlockStorageDriver, 13); 148 OSMetaClassDeclareReservedUnused(IOBDBlockStorageDriver, 14); 149 OSMetaClassDeclareReservedUnused(IOBDBlockStorageDriver, 15); 150}; 151 152#endif /* !_IOBDBLOCKSTORAGEDRIVER_H */ 153