1/* 2 * Copyright (c) 1998-2014 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#ifndef _IOKIT_UFI_STORAGE_SERVICES_H_ 26#define _IOKIT_UFI_STORAGE_SERVICES_H_ 27 28#if defined(KERNEL) && defined(__cplusplus) 29 30#include <IOKit/IOTypes.h> 31#include <IOKit/storage/IOBlockStorageDevice.h> 32#include <IOKit/usb/IOUSBMassStorageUFISubclass.h> 33 34 35class IOUFIStorageServices : public IOBlockStorageDevice 36{ 37 38 OSDeclareDefaultStructors ( IOUFIStorageServices ) 39 40private: 41 bool fMediaChanged; 42 bool fMediaPresent; 43 44protected: 45 46 IOUSBMassStorageUFIDevice * fProvider; 47 48 UInt64 fMaxReadBlocks; 49 UInt64 fMaxWriteBlocks; 50 51 virtual bool attach ( IOService * provider ); 52 virtual void detach ( IOService * provider ); 53 54 // Reserve space for future expansion. 55 struct IOUFIStorageServicesExpansionData { }; 56 IOUFIStorageServicesExpansionData *fIOUFIStorageServicesReserved; 57 58public: 59 60 virtual IOReturn message ( UInt32 type, IOService * provider, void * argument ); 61 62 static void AsyncReadWriteComplete ( void * clientData, 63 IOReturn status, 64 UInt64 actualByteCount ); 65 66 // Deprecated 67 virtual IOReturn doAsyncReadWrite ( IOMemoryDescriptor * buffer, 68 UInt32 block, 69 UInt32 nblks, 70 IOStorageCompletion completion ); 71 72 virtual IOReturn doAsyncReadWrite ( IOMemoryDescriptor * buffer, 73 UInt64 block, 74 UInt64 nblks, 75 IOStorageAttributes * attributes, 76 IOStorageCompletion * completion ); 77 78 virtual IOReturn doSyncReadWrite ( IOMemoryDescriptor * buffer, 79 UInt32 block, 80 UInt32 nblks ); 81 82 virtual IOReturn doEjectMedia ( void ); 83 84 virtual IOReturn doFormatMedia ( UInt64 byteCapacity ); 85 86 virtual UInt32 doGetFormatCapacities ( UInt64 * capacities, 87 UInt32 capacitiesMaxCount ) const; 88 89 virtual IOReturn doSynchronizeCache ( void ); 90 91 virtual char * getVendorString ( void ); 92 93 virtual char * getProductString ( void ); 94 95 virtual char * getRevisionString ( void ); 96 97 virtual char * getAdditionalDeviceInfoString ( void ); 98 99 virtual IOReturn reportBlockSize ( UInt64 * blockSize ); 100 101 virtual IOReturn reportEjectability ( bool * isEjectable ); 102 103 virtual IOReturn reportMediaState ( bool * mediaPresent, bool * changed ); 104 105 virtual IOReturn reportMaxValidBlock ( UInt64 * maxBlock ); 106 107 virtual IOReturn reportRemovability ( bool * isRemovable ); 108 109 virtual IOReturn reportWriteProtection ( bool * isWriteProtected ); 110 111 virtual IOReturn getWriteCacheState ( bool * enabled ); 112 113 virtual IOReturn setWriteCacheState ( bool enabled ); 114 115 // Space reserved for future expansion. 116 OSMetaClassDeclareReservedUnused( IOUFIStorageServices, 1 ); 117 OSMetaClassDeclareReservedUnused( IOUFIStorageServices, 2 ); 118 OSMetaClassDeclareReservedUnused( IOUFIStorageServices, 3 ); 119 OSMetaClassDeclareReservedUnused( IOUFIStorageServices, 4 ); 120 OSMetaClassDeclareReservedUnused( IOUFIStorageServices, 5 ); 121 OSMetaClassDeclareReservedUnused( IOUFIStorageServices, 6 ); 122 OSMetaClassDeclareReservedUnused( IOUFIStorageServices, 7 ); 123 OSMetaClassDeclareReservedUnused( IOUFIStorageServices, 8 ); 124 125}; 126 127#endif /* defined(KERNEL) && defined(__cplusplus) */ 128 129#endif /* _IOKIT_UFI_STORAGE_SERVICES_H_ */ 130