2 * Copyright (c) 2000 Apple Computer, Inc. All rights reserved.
4 * @APPLE_LICENSE_HEADER_START@
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.
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
20 * @APPLE_LICENSE_HEADER_END@
22 #include <IOKit/IOLib.h>
23 #include <IOKit/storage/IODVDBlockStorageDevice.h>
24 #include <IOKit/storage/IODVDBlockStorageDriver.h>
25 #include <IOKit/storage/IODVDMedia.h>
27 #define super IOCDBlockStorageDriver
28 OSDefineMetaClassAndStructors(IODVDBlockStorageDriver
,IOCDBlockStorageDriver
)
30 IODVDBlockStorageDevice
*
31 IODVDBlockStorageDriver::getProvider() const
33 return (IODVDBlockStorageDevice
*) IOService::getProvider();
36 /* Accept a new piece of media, doing whatever's necessary to make it
37 * show up properly to the system.
40 IODVDBlockStorageDriver::acceptNewMedia(void)
42 UInt32 mediaType
= getMediaType();
44 if (mediaType
>= kCDMediaTypeMin
&& mediaType
<= kCDMediaTypeMax
) {
45 return IOCDBlockStorageDriver::acceptNewMedia();
47 return IOBlockStorageDriver::acceptNewMedia();
52 IODVDBlockStorageDriver::getDeviceTypeName(void)
54 return(kIOBlockStorageDeviceTypeDVD
);
58 IODVDBlockStorageDriver::instantiateDesiredMediaObject(void)
60 UInt32 mediaType
= getMediaType();
62 if (mediaType
>= kCDMediaTypeMin
&& mediaType
<= kCDMediaTypeMax
) {
63 return IOCDBlockStorageDriver::instantiateDesiredMediaObject();
65 return(new IODVDMedia
);
70 IODVDBlockStorageDriver::instantiateMediaObject(UInt64 base
,UInt64 byteSize
,
71 UInt32 blockSize
,char *mediaName
)
73 IOMedia
*media
= NULL
;
74 UInt32 mediaType
= getMediaType();
76 if (mediaType
>= kCDMediaTypeMin
&& mediaType
<= kCDMediaTypeMax
) {
77 return IOCDBlockStorageDriver::instantiateMediaObject(
78 base
,byteSize
,blockSize
,mediaName
);
80 media
= IOBlockStorageDriver::instantiateMediaObject(
81 base
,byteSize
,blockSize
,mediaName
);
85 char *description
= NULL
;
88 case kDVDMediaTypeROM
:
89 description
= kIODVDMediaTypeROM
;
91 case kDVDMediaTypeRAM
:
92 description
= kIODVDMediaTypeRAM
;
95 description
= kIODVDMediaTypeR
;
98 description
= kIODVDMediaTypeRW
;
100 case kDVDMediaTypePlusRW
:
101 description
= kIODVDMediaTypePlusRW
;
106 media
->setProperty(kIODVDMediaTypeKey
, description
);
114 IODVDBlockStorageDriver::reportKey(IOMemoryDescriptor
*buffer
,const DVDKeyClass keyClass
,
115 const UInt32 lba
,const UInt8 agid
,const DVDKeyFormat keyFormat
)
117 return(getProvider()->reportKey(buffer
,keyClass
,lba
,agid
,keyFormat
));
121 IODVDBlockStorageDriver::sendKey(IOMemoryDescriptor
*buffer
,const DVDKeyClass keyClass
,
122 const UInt8 agid
,const DVDKeyFormat keyFormat
)
124 return(getProvider()->sendKey(buffer
,keyClass
,agid
,keyFormat
));
127 OSMetaClassDefineReservedUnused(IODVDBlockStorageDriver
, 0);
128 OSMetaClassDefineReservedUnused(IODVDBlockStorageDriver
, 1);
129 OSMetaClassDefineReservedUnused(IODVDBlockStorageDriver
, 2);
130 OSMetaClassDefineReservedUnused(IODVDBlockStorageDriver
, 3);
131 OSMetaClassDefineReservedUnused(IODVDBlockStorageDriver
, 4);
132 OSMetaClassDefineReservedUnused(IODVDBlockStorageDriver
, 5);
133 OSMetaClassDefineReservedUnused(IODVDBlockStorageDriver
, 6);
134 OSMetaClassDefineReservedUnused(IODVDBlockStorageDriver
, 7);
135 OSMetaClassDefineReservedUnused(IODVDBlockStorageDriver
, 8);
136 OSMetaClassDefineReservedUnused(IODVDBlockStorageDriver
, 9);
137 OSMetaClassDefineReservedUnused(IODVDBlockStorageDriver
, 10);
138 OSMetaClassDefineReservedUnused(IODVDBlockStorageDriver
, 11);
139 OSMetaClassDefineReservedUnused(IODVDBlockStorageDriver
, 12);
140 OSMetaClassDefineReservedUnused(IODVDBlockStorageDriver
, 13);
141 OSMetaClassDefineReservedUnused(IODVDBlockStorageDriver
, 14);
142 OSMetaClassDefineReservedUnused(IODVDBlockStorageDriver
, 15);
143 OSMetaClassDefineReservedUnused(IODVDBlockStorageDriver
, 16);
144 OSMetaClassDefineReservedUnused(IODVDBlockStorageDriver
, 17);
145 OSMetaClassDefineReservedUnused(IODVDBlockStorageDriver
, 18);
146 OSMetaClassDefineReservedUnused(IODVDBlockStorageDriver
, 19);
147 OSMetaClassDefineReservedUnused(IODVDBlockStorageDriver
, 20);
148 OSMetaClassDefineReservedUnused(IODVDBlockStorageDriver
, 21);
149 OSMetaClassDefineReservedUnused(IODVDBlockStorageDriver
, 22);
150 OSMetaClassDefineReservedUnused(IODVDBlockStorageDriver
, 23);
151 OSMetaClassDefineReservedUnused(IODVDBlockStorageDriver
, 24);
152 OSMetaClassDefineReservedUnused(IODVDBlockStorageDriver
, 25);
153 OSMetaClassDefineReservedUnused(IODVDBlockStorageDriver
, 26);
154 OSMetaClassDefineReservedUnused(IODVDBlockStorageDriver
, 27);
155 OSMetaClassDefineReservedUnused(IODVDBlockStorageDriver
, 28);
156 OSMetaClassDefineReservedUnused(IODVDBlockStorageDriver
, 29);
157 OSMetaClassDefineReservedUnused(IODVDBlockStorageDriver
, 30);
158 OSMetaClassDefineReservedUnused(IODVDBlockStorageDriver
, 31);