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 IOBDMedia
26 * @abstract
27 * This header contains the IOBDMedia class definition.
28 */
29
30#ifndef _IOBDMEDIA_H
31#define _IOBDMEDIA_H
32
33/*!
34 * @defined kIOBDMediaClass
35 * @abstract
36 * kIOBDMediaClass is the name of the IOBDMedia class.
37 * @discussion
38 * kIOBDMediaClass is the name of the IOBDMedia class.
39 */
40
41#define kIOBDMediaClass "IOBDMedia"
42
43/*!
44 * @defined kIOBDMediaTypeKey
45 * @abstract
46 * kIOBDMediaTypeKey is a property of IOBDMedia objects.  It has an OSString
47 * value.
48 * @discussion
49 * The kIOBDMediaTypeKey property identifies the BD media type (BD-ROM, BD-R,
50 * BD-RE, etc).  See the kIOBDMediaType contants for possible values.
51 */
52
53#define kIOBDMediaTypeKey "Type"
54
55/*!
56 * @defined kIOBDMediaTypeROM
57 * The kIOBDMediaTypeKey constant for BD-ROM media.
58 */
59
60#define kIOBDMediaTypeROM "BD-ROM"
61
62/*!
63 * @defined kIOBDMediaTypeR
64 * The kIOBDMediaTypeKey constant for BD-R media.
65 */
66
67#define kIOBDMediaTypeR "BD-R"
68
69/*!
70 * @defined kIOBDMediaTypeRE
71 * The kIOBDMediaTypeKey constant for BD-RE media.
72 */
73
74#define kIOBDMediaTypeRE "BD-RE"
75
76#ifdef KERNEL
77#ifdef __cplusplus
78
79/*
80 * Kernel
81 */
82
83#include <IOKit/storage/IOBDBlockStorageDriver.h>
84#include <IOKit/storage/IOMedia.h>
85
86/*!
87 * @class IOBDMedia
88 * @abstract
89 * The IOBDMedia class is a random-access disk device abstraction for BDs.
90 * @discussion
91 * The IOBDMedia class is a random-access disk device abstraction for BDs.
92 */
93
94class IOBDMedia : public IOMedia
95{
96    OSDeclareDefaultStructors(IOBDMedia)
97
98protected:
99
100    struct ExpansionData { /* */ };
101    ExpansionData * _expansionData;
102
103public:
104
105    /*
106     * Obtain this object's provider.   We override the superclass's method to
107     * return a more specific subclass of IOService -- IOBDBlockStorageDriver.
108     * This method serves simply as a convenience to subclass developers.
109     */
110
111    virtual IOBDBlockStorageDriver * getProvider() const;
112
113    /*
114     * Compare the properties in the supplied table to this object's properties.
115     */
116
117    virtual bool matchPropertyTable(OSDictionary * table, SInt32 * score);
118
119    /*!
120     * @function reportKey
121     * @discussion
122     * Issue an MMC REPORT KEY command.
123     * @param buffer
124     * Buffer for the data transfer.  The size of the buffer implies the size of
125     * the data transfer.
126     * @param keyClass
127     * As documented by MMC.
128     * @param address
129     * As documented by MMC.
130     * @param grantID
131     * As documented by MMC.
132     * @param format
133     * As documented by MMC.
134     * @result
135     * Returns the status of the data transfer.
136     */
137
138    virtual IOReturn reportKey( IOMemoryDescriptor * buffer,
139                                UInt8                keyClass,
140                                UInt32               address,
141                                UInt8                grantID,
142                                UInt8                format );
143
144    /*!
145     * @function sendKey
146     * @discussion
147     * Issue an MMC SEND KEY command.
148     * @param buffer
149     * Buffer for the data transfer.  The size of the buffer implies the size of
150     * the data transfer.
151     * @param keyClass
152     * As documented by MMC.
153     * @param grantID
154     * As documented by MMC.
155     * @param format
156     * As documented by MMC.
157     * @result
158     * Returns the status of the data transfer.
159     */
160
161    virtual IOReturn sendKey( IOMemoryDescriptor * buffer,
162                              UInt8                keyClass,
163                              UInt8                grantID,
164                              UInt8                format );
165
166    /*!
167     * @function readStructure
168     * @discussion
169     * Issue an MMC READ DISC STRUCTURE command.
170     * @param buffer
171     * Buffer for the data transfer.  The size of the buffer implies the size of
172     * the data transfer.
173     * @param format
174     * As documented by MMC.
175     * @param address
176     * As documented by MMC.
177     * @param layer
178     * As documented by MMC.
179     * @param grantID
180     * As documented by MMC.
181     * @result
182     * Returns the status of the data transfer.
183     */
184
185    virtual IOReturn readStructure( IOMemoryDescriptor *     buffer,
186                                    UInt8                    format,
187                                    UInt32                   address,
188                                    UInt8                    layer,
189                                    UInt8                    grantID );
190
191    /*!
192     * @function getSpeed
193     * @discussion
194     * Get the current speed used for data transfers.
195     * @param kilobytesPerSecond
196     * Returns the current speed used for data transfers, in kB/s.
197     *
198     * kBDSpeedMin specifies the minimum speed for all BD media (1X).
199     * kBDSpeedMax specifies the maximum speed supported in hardware.
200     * @result
201     * Returns the status of the operation.
202     */
203
204    virtual IOReturn getSpeed(UInt16 * kilobytesPerSecond);
205
206    /*!
207     * @function setSpeed
208     * @discussion
209     * Set the speed to be used for data transfers.
210     * @param kilobytesPerSecond
211     * Speed to be used for data transfers, in kB/s.
212     *
213     * kBDSpeedMin specifies the minimum speed for all BD media (1X).
214     * kBDSpeedMax specifies the maximum speed supported in hardware.
215     * @result
216     * Returns the status of the operation.
217     */
218
219    virtual IOReturn setSpeed(UInt16 kilobytesPerSecond);
220
221    /*!
222     * @function readDiscInfo
223     * @discussion
224     * Issue an MMC READ DISC INFORMATION command.
225     * @param buffer
226     * Buffer for the data transfer.  The size of the buffer implies the size of
227     * the data transfer.
228     * @param type
229     * Reserved for future use.  Set to zero.
230     * @param actualByteCount
231     * Returns the actual number of bytes transferred in the data transfer.
232     * @result
233     * Returns the status of the data transfer.
234     */
235
236    virtual IOReturn readDiscInfo( IOMemoryDescriptor * buffer,
237                                   UInt8                type,
238                                   UInt16 *             actualByteCount );
239
240    /*!
241     * @function readTrackInfo
242     * @discussion
243     * Issue an MMC READ TRACK INFORMATION command.
244     * @param buffer
245     * Buffer for the data transfer.  The size of the buffer implies the size of
246     * the data transfer.
247     * @param address
248     * As documented by MMC.
249     * @param addressType
250     * As documented by MMC.
251     * @param open
252     * Reserved for future use.  Set to zero.
253     * @param actualByteCount
254     * Returns the actual number of bytes transferred in the data transfer.
255     * @result
256     * Returns the status of the data transfer.
257     */
258
259    virtual IOReturn readTrackInfo( IOMemoryDescriptor * buffer,
260                                    UInt32               address,
261                                    UInt8                addressType,
262                                    UInt8                open,
263                                    UInt16 *             actualByteCount );
264
265    /*!
266     * @function splitTrack
267     * @discussion
268     * Issue an MMC RESERVE TRACK command with the ARSV bit.
269     * @param address
270     * As documented by MMC.
271     * @result
272     * Returns the status of the operation.
273     */
274
275    virtual IOReturn splitTrack(UInt32 address);
276
277    OSMetaClassDeclareReservedUnused(IOBDMedia,  0);
278    OSMetaClassDeclareReservedUnused(IOBDMedia,  1);
279    OSMetaClassDeclareReservedUnused(IOBDMedia,  2);
280    OSMetaClassDeclareReservedUnused(IOBDMedia,  3);
281    OSMetaClassDeclareReservedUnused(IOBDMedia,  4);
282    OSMetaClassDeclareReservedUnused(IOBDMedia,  5);
283    OSMetaClassDeclareReservedUnused(IOBDMedia,  6);
284    OSMetaClassDeclareReservedUnused(IOBDMedia,  7);
285    OSMetaClassDeclareReservedUnused(IOBDMedia,  8);
286    OSMetaClassDeclareReservedUnused(IOBDMedia,  9);
287    OSMetaClassDeclareReservedUnused(IOBDMedia, 10);
288    OSMetaClassDeclareReservedUnused(IOBDMedia, 11);
289    OSMetaClassDeclareReservedUnused(IOBDMedia, 12);
290    OSMetaClassDeclareReservedUnused(IOBDMedia, 13);
291    OSMetaClassDeclareReservedUnused(IOBDMedia, 14);
292    OSMetaClassDeclareReservedUnused(IOBDMedia, 15);
293};
294
295#endif /* __cplusplus */
296#endif /* KERNEL */
297#endif /* !_IOBDMEDIA_H */
298