1/* 2 * Copyright (c) 1998-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 * IODVDBlockStorageDriver.h 25 * 26 * This class implements DVD functionality, independent of 27 * the physical connection protocol (e.g. SCSI, ATA, USB). 28 * 29 * A protocol-specific provider implements the functionality using an appropriate 30 * protocol and commands. 31 */ 32 33#ifndef _IODVDBLOCKSTORAGEDRIVER_H 34#define _IODVDBLOCKSTORAGEDRIVER_H 35 36#include <IOKit/IOTypes.h> 37#include <IOKit/storage/IOCDBlockStorageDriver.h> 38#include <IOKit/storage/IODVDBlockStorageDevice.h> 39#include <IOKit/storage/IODVDTypes.h> 40 41/* 42 * @defined kIODVDBlockStorageDriverClass 43 * @abstract 44 * kIODVDBlockStorageDriverClass is the name of the IODVDBlockStorageDriver class. 45 * @discussion 46 * kIODVDBlockStorageDriverClass is the name of the IODVDBlockStorageDriver class. 47 */ 48 49#define kIODVDBlockStorageDriverClass "IODVDBlockStorageDriver" 50 51class IODVDBlockStorageDevice; 52 53/* 54 * @class 55 * IODVDBlockStorageDriver : public IOCDBlockStorageDriver 56 * @abstract 57 * Generic DVD Driver. 58 * @discussion 59 * Storage drivers are split into two parts: the Generic Driver handles 60 * all generic device issues, independent of the lower-level transport 61 * mechanism (e.g. SCSI, ATA, USB, FireWire). All storage operations 62 * at the Generic Driver level are translated into a series of generic 63 * device operations. These operations are passed via the Device Nub 64 * to a Transport Driver, which implements the appropriate 65 * transport-dependent protocol to execute these operations. 66 * 67 * To determine the write-protect state of a device (or media), for 68 * example, the generic driver would issue a call to the 69 * Transport Driver's reportWriteProtection method. If this were a SCSI 70 * device, its Transport Driver would issue a Mode Sense command to 71 * extract the write-protection status bit. The Transport Driver then 72 * reports true or false to the generic driver. 73 * 74 * The generic driver therefore has no knowledge of, or involvement 75 * with, the actual commands and mechanisms used to communicate with 76 * the device. It is expected that the generic driver will rarely, if 77 * ever, need to be subclassed to handle device idiosyncrasies; rather, 78 * the Transport Driver should be changed via overrides. 79 * 80 * A generic driver could be subclassed to create a different type of 81 * generic device. The generic driver IODVDBlockStorageDriver class is a subclass 82 * of IOCDBlockStorageDriver, adding DVD functions. Similarly, the Transport Driver 83 * IODVDBlockStorageDevice is a subclass of IOCDBlockStorageDevice, adding DVD 84 * functions. 85*/ 86 87class IODVDBlockStorageDriver : public IOCDBlockStorageDriver { 88 89 OSDeclareDefaultStructors(IODVDBlockStorageDriver) 90 91protected: 92 93 struct ExpansionData { /* */ }; 94 ExpansionData * _expansionData; 95 96 /* Overrides of IOCDBlockStorageDriver. */ 97 98 virtual IOReturn acceptNewMedia(void); 99 100 /* End of IOCDBlockStorageDriver overrides. */ 101 102public: 103 104 /* 105 * Obtain this object's provider. We override the superclass's method to 106 * return a more specific subclass of IOService -- IODVDBlockStorageDevice. 107 * This method serves simply as a convenience to subclass developers. 108 */ 109 110 virtual IODVDBlockStorageDevice * getProvider() const; 111 112 /* Overrides of IOCDBlockStorageDriver: */ 113 114 virtual const char * getDeviceTypeName(void); 115 virtual IOMedia * instantiateDesiredMediaObject(void); 116 virtual IOMedia * instantiateMediaObject(UInt64 base,UInt64 byteSize, 117 UInt32 blockSize,char *mediaName); 118 119 /* End of IOCDBlockStorageDriver overrides. */ 120 121 /* 122 * @function reportKey 123 * @abstract 124 * Get key info from the DVD drive. 125 * @discussion 126 * This function handles the getting of key- and encryption-related data for the drive. 127 * @param buffer 128 * A buffer containing information, as documented in the specification 129 * "MtFuji Commands For Multimedia Devices." 130 * @param keyClass 131 * As documented by MtFuji. See DVDKeyClass. 132 * @param lba 133 * As documented by MtFuji. 134 * @param agid 135 * As documented by MtFuji. 136 * @param keyFormat 137 * As documented by MtFuji. See DVDKeyFormat. 138 */ 139 virtual IOReturn reportKey(IOMemoryDescriptor *buffer,const DVDKeyClass keyClass, 140 const UInt32 lba,const UInt8 agid,const DVDKeyFormat keyFormat); 141 142 /* 143 * @function sendKey 144 * @abstract 145 * Send key info to the DVD drive. 146 * @discussion 147 * This function handles the setting of key- and encryption-related data for the drive. 148 * @param buffer 149 * A buffer containing information, as documented in the specification 150 * "MtFuji Commands For Multimedia Devices." 151 * @param keyClass 152 * As documented by MtFuji. See DVDKeyClass. 153 * @param agid 154 * As documented by MtFuji. 155 * @param keyFormat 156 * As documented by MtFuji. See DVDKeyFormat. 157 */ 158 virtual IOReturn sendKey(IOMemoryDescriptor *buffer,const DVDKeyClass keyClass, 159 const UInt8 agid,const DVDKeyFormat keyFormat); 160 161 /* 162 * @function readStructure 163 * @abstract 164 * Get control structures from the DVD media. 165 * @discussion 166 * This function handles the getting of control structure data for the media. 167 * @param buffer 168 * A buffer containing information, as documented in the specification 169 * "MtFuji Commands For Multimedia Devices." 170 * @param format 171 * As documented by MtFuji. See DVDStructureFormat. 172 * @param address 173 * As documented by MtFuji. 174 * @param layer 175 * As documented by MtFuji. 176 * @param agid 177 * As documented by MtFuji. 178 */ 179 virtual IOReturn readStructure(IOMemoryDescriptor *buffer,const DVDStructureFormat format, 180 const UInt32 address,const UInt8 layer,const UInt8 agid); /* 10.1.0 */ 181 182#ifdef __LP64__ 183 OSMetaClassDeclareReservedUnused(IODVDBlockStorageDriver, 0); 184#else /* !__LP64__ */ 185 OSMetaClassDeclareReservedUsed(IODVDBlockStorageDriver, 0); 186#endif /* !__LP64__ */ 187 OSMetaClassDeclareReservedUnused(IODVDBlockStorageDriver, 1); 188 OSMetaClassDeclareReservedUnused(IODVDBlockStorageDriver, 2); 189 OSMetaClassDeclareReservedUnused(IODVDBlockStorageDriver, 3); 190 OSMetaClassDeclareReservedUnused(IODVDBlockStorageDriver, 4); 191 OSMetaClassDeclareReservedUnused(IODVDBlockStorageDriver, 5); 192 OSMetaClassDeclareReservedUnused(IODVDBlockStorageDriver, 6); 193 OSMetaClassDeclareReservedUnused(IODVDBlockStorageDriver, 7); 194 OSMetaClassDeclareReservedUnused(IODVDBlockStorageDriver, 8); 195 OSMetaClassDeclareReservedUnused(IODVDBlockStorageDriver, 9); 196 OSMetaClassDeclareReservedUnused(IODVDBlockStorageDriver, 10); 197 OSMetaClassDeclareReservedUnused(IODVDBlockStorageDriver, 11); 198 OSMetaClassDeclareReservedUnused(IODVDBlockStorageDriver, 12); 199 OSMetaClassDeclareReservedUnused(IODVDBlockStorageDriver, 13); 200 OSMetaClassDeclareReservedUnused(IODVDBlockStorageDriver, 14); 201 OSMetaClassDeclareReservedUnused(IODVDBlockStorageDriver, 15); 202 OSMetaClassDeclareReservedUnused(IODVDBlockStorageDriver, 16); 203 OSMetaClassDeclareReservedUnused(IODVDBlockStorageDriver, 17); 204 OSMetaClassDeclareReservedUnused(IODVDBlockStorageDriver, 18); 205 OSMetaClassDeclareReservedUnused(IODVDBlockStorageDriver, 19); 206 OSMetaClassDeclareReservedUnused(IODVDBlockStorageDriver, 20); 207 OSMetaClassDeclareReservedUnused(IODVDBlockStorageDriver, 21); 208 OSMetaClassDeclareReservedUnused(IODVDBlockStorageDriver, 22); 209 OSMetaClassDeclareReservedUnused(IODVDBlockStorageDriver, 23); 210 OSMetaClassDeclareReservedUnused(IODVDBlockStorageDriver, 24); 211 OSMetaClassDeclareReservedUnused(IODVDBlockStorageDriver, 25); 212 OSMetaClassDeclareReservedUnused(IODVDBlockStorageDriver, 26); 213 OSMetaClassDeclareReservedUnused(IODVDBlockStorageDriver, 27); 214 OSMetaClassDeclareReservedUnused(IODVDBlockStorageDriver, 28); 215 OSMetaClassDeclareReservedUnused(IODVDBlockStorageDriver, 29); 216 OSMetaClassDeclareReservedUnused(IODVDBlockStorageDriver, 30); 217 OSMetaClassDeclareReservedUnused(IODVDBlockStorageDriver, 31); 218}; 219#endif 220