xref: /reactos/drivers/storage/class/cdrom/data.c (revision ea6e7740)
1 /*++
2 
3 Copyright (C) Microsoft Corporation. All rights reserved.
4 
5 Module Name:
6 
7 
8 Abstract:
9 
10 
11 Environment:
12 
13 
14 Notes:
15 
16 Revision History:
17 
18 --*/
19 
20 #include "ntddk.h"
21 #include "cdrom.h"
22 
23 
24 #ifdef ALLOC_DATA_PRAGMA
25 #pragma data_seg("PAGEDATA")
26 #endif
27 
28 /*
29 
30 #define CDROM_HACK_DEC_RRD                 (0x00000001)
31 #define CDROM_HACK_FUJITSU_FMCD_10x        (0x00000002)
32     #define CDROM_HACK_HITACHI_1750            (0x00000004) - obsolete.
33 #define CDROM_HACK_HITACHI_GD_2000         (0x00000008)
34 #define CDROM_HACK_TOSHIBA_SD_W1101        (0x00000010)
35     #define CDROM_HACK_TOSHIBA_XM_3xx          (0x00000020) - obsolete.
36 #define CDROM_HACK_NEC_CDDA                (0x00000040)
37 #define CDROM_HACK_PLEXTOR_CDDA            (0x00000080)
38 #define CDROM_HACK_BAD_GET_CONFIG_SUPPORT  (0x00000100)
39 #define CDROM_HACK_FORCE_READ_CD_DETECTION (0x00000200)
40 #define CDROM_HACK_READ_CD_SUPPORTED       (0x00000400)
41 
42 */
43 
44 CDROM_SCAN_FOR_SPECIAL_INFO CdromHackItems[] = {
45     // digital put out drives using 512 byte block sizes,
46     // and needed us to send a mode page to set the sector
47     // size back to 2048.
48     { "DEC"     , "RRD"                            , NULL,   0x0001 },
49     // these fujitsu drives take longer than ten seconds to
50     // timeout commands when audio discs are placed in them
51     { "FUJITSU" , "FMCD-101"                       , NULL,   0x0002 },
52     { "FUJITSU" , "FMCD-102"                       , NULL,   0x0002 },
53     // these hitachi drives don't work properly in PIO mode
54     //{ "HITACHI ", "CDR-1750S"                      , NULL,   0x0004 },
55     //{ "HITACHI ", "CDR-3650/1650S"                 , NULL,   0x0004 },
56     // this particular gem doesn't automatcially spin up
57     // on some media access commands.
58     { ""        , "HITACHI GD-2000"                , NULL,   0x0008 },
59     { ""        , "HITACHI DVD-ROM GD-2000"        , NULL,   0x0008 },
60     // this particular drive doesn't support DVD playback.
61     // just print an error message in CHK builds.
62     { "TOSHIBA ", "SD-W1101 DVD-RAM"               , NULL,   0x0010 },
63     // not sure what this device's issue was.  seems to
64     // require mode selects at various times.
65     //{ "TOSHIBA ", "CD-ROM XM-3"                    , NULL,   0x0020 },
66     // NEC defined a "READ_CD" type command before there was
67     // a standard, so fall back on this as an option.
68     { "NEC"     , NULL                             , NULL,   0x0040 },
69     // plextor defined a "READ_CD" type command before there was
70     // a standard, so fall back on this as an option.
71     { "PLEXTOR ", NULL                             , NULL,   0x0080 },
72     // this drive times out and sometimes disappears from the bus
73     // when send GET_CONFIGURATION commands.  don't send them.
74     { ""        , "LG DVD-ROM DRD-840B"            , NULL,   0x0100 },
75     { ""        , "SAMSUNG DVD-ROM SD-608"         , NULL,   0x0300 },
76     // these drives should have supported READ_CD, but at least
77     // some firmware revisions did not.  force READ_CD detection.
78     { ""        , "SAMSUNG DVD-ROM SD-"            , NULL,   0x0200 },
79     // the mitsumi drive below doesn't follow the block-only spec,
80     // and we end up hanging when sending it commands it doesn't
81     // understand.  this causes complications later, also.
82     { "MITSUMI ", "CR-4802TE       "               , NULL,   0x0100 },
83     // some drives return various funky errors (such as 3/2/0 NO_SEEK_COMPLETE)
84     // during the detection of READ_CD support, resulting in iffy detection.
85     // since they probably don't support mode switching, which is really old
86     // legacy stuff anyways, the ability to read digitally is lost when
87     // these drives return unexpected error codes.  note: MMC compliant drives
88     // are presumed to support READ_CD, as are DVD drives, and anything
89     // connected to a bus type other than IDE or SCSI, and therefore don't
90     // need to be here.
91     { "YAMAHA  ", "CRW8424S        "               , NULL,   0x0400 },
92     // Polling frequently on virtual optical devices created by Hyper-V will
93     // cause a significant perf / power hit. These devices need to be polled
94     // less frequently for device state changes.
95     { "MSFT    ", NULL                             , NULL,   0x2000 },
96     // and finally, a place to finish the list. :)
97     { NULL      , NULL                             , NULL,   0x0000 }
98 };
99 
100 CDROM_SCAN_FOR_SPECIAL_INFO CdRomBadItems[] = {                     // Type (HH, slim) + WHQL Date, if known
101     { ""        , "MITSUMI CD-ROM FX240"           , NULL  ,   0x02 },
102     { ""        , "MITSUMI CD-ROM FX320"           , NULL  ,   0x02 },
103     { ""        , "MITSUMI CD-ROM FX322"           , NULL  ,   0x02 },
104     { ""        , "TEAC DV-28E-A"                  , "2.0A",   0x02 },
105     { ""        , "HP CD-Writer cd16h"             , "Q000",   0x02 },
106     { ""        , "_NEC NR-7800A"                  , "1.33",   0x02 },
107     { ""        , "COMPAQ CRD-8481B"               , NULL  ,   0x04 },
108     // The following is a list of device that report too many OpChange/Add events.
109     // They require ignoring (or not sending) the OpChange flag in the GESN command.
110     // This list contains vendor ID and product ID as separate strings for USB/1394 interface.
111     { "HL-DT-ST", "DVDRAM GMA-4020B"               , NULL  ,   0x10 }, // hh  , 2002/04/22
112     { "HL-DT-ST", "DVD-RW GCA-4020B"               , NULL  ,   0x10 }, // hh  , 2002/05/14
113     { "HL-DT-ST", "DVDRAM GSA-4040B"               , NULL  ,   0x10 }, // hh  , 2003/05/06
114     { "HL-DT-ST", "DVDRAM GMA-4040B"               , NULL  ,   0x10 }, // hh  , 2003/07/27
115     { "HL-DT-ST", "DVD-RW GWA-4040B"               , NULL  ,   0x10 }, // hh  , 2003/11/18
116     { "HL-DT-ST", "DVDRAM GSA-4081B"               , NULL  ,   0x10 }, // hh  , 2003/11/06
117     { "HL-DT-ST", "DVDRAM GSA-4082B"               , NULL  ,   0x10 }, // hh  , 2004/01/27
118     { "HL-DT-ST", "DVD-RW GWA-4082B"               , NULL  ,   0x10 }, // hh  , 2004/03/11
119     { "HL-DT-ST", "DVDRAM GSA-4120B"               , NULL  ,   0x10 }, // hh  , 2004/05/16
120     { "HL-DT-ST", "DVD+RW GRA-4120B"               , NULL  ,   0x10 }, // hh  , 2004/04/28
121     { "HL-DT-ST", "DVDRAM GSA-4160B"               , NULL  ,   0x10 }, // hh  , 2004/08/12
122     { "HL-DT-ST", "DVD-RW GWA-4160B"               , NULL  ,   0x10 }, // hh  , 2004/08/24
123     { "HL-DT-ST", "DVDRAM GSA-4163B"               , NULL  ,   0x10 }, // hh  , 2004/11/09
124     { "HL-DT-ST", "DVD-RW GWA-4163B"               , NULL  ,   0x10 }, // hh  , 2004/12/29
125     { "HL-DT-ST", "DVDRAM GSA-4165B"               , NULL  ,   0x10 }, // hh  , 2005/06/09
126     { "HL-DT-ST", "DVDRAM_GSA-4165B"               , NULL  ,   0x10 }, // hh  , 2005/06/28
127     { "HL-DT-ST", "DVD-RW GWA-4165B"               , NULL  ,   0x10 }, // hh  , 2005/08/23
128     { "HL-DT-ST", "DVDRAM GSA-4167B"               , NULL  ,   0x10 }, // hh  , 2005/07/01
129     { "HL-DT-ST", "DVDRAM GSA-H10N"                , NULL  ,   0x10 }, // hh  , 2006/02/16
130     { "HL-DT-ST", "DVDRAM_GSA-H10N"                , NULL  ,   0x10 }, // hh  , 2006/02/16
131     { "HL-DT-ST", "DVDRAM GSA-H10L"                , NULL  ,   0x10 }, // hh  , 2006/02/27
132     { "HL-DT-ST", "DVDRAM_GSA-H10L"                , NULL  ,   0x10 }, // hh  , 2006/04/21
133     { "HL-DT-ST", "DVDRAM GSA-H10A"                , NULL  ,   0x10 }, // hh  , 2006/01/03
134     { "HL-DT-ST", "DVDRAM_GSA-H10A"                , NULL  ,   0x10 }, // hh  , 2006/05/14
135     { "HL-DT-ST", "DVD-RW GSA-H11N"                , NULL  ,   0x10 }, // hh  , 2006/04/28
136     { "HL-DT-ST", "DVD-RW_GSA-H11N"                , NULL  ,   0x10 }, // hh  , 2006/02/22
137 
138     { "HL-DT-ST", "DVDRAM GSA-4080N"               , NULL  ,   0x10 }, // slim, 2004/08/08
139     { "HL-DT-ST", "DVDRAM GMA-4080N"               , NULL  ,   0x10 }, // slim, 2004/11/09
140     { "HL-DT-ST", "DVD-RW GCA-4080N"               , NULL  ,   0x10 }, // slim, 2004/11/22
141     { "HL-DT-ST", "DVD-RW GWA-4080N"               , NULL  ,   0x10 }, // slim, 2004/08/17
142     { "HL-DT-ST", "DVDRAM GSA-4082N"               , NULL  ,   0x10 }, // slim, 2005/07/12
143     { "HL-DT-ST", "DVDRAM_GSA-4082N"               , NULL  ,   0x10 }, // slim, 2005/09/21
144     { "HL-DT-ST", "DVDRAM GMA-4082N"               , NULL  ,   0x10 }, // slim, 2005/10/20
145     { "HL-DT-ST", "DVD-RW GRA-4082N"               , NULL  ,   0x10 }, // slim, 2006/06/07
146     { "HL-DT-ST", "DVD-RW GWA-4082N"               , NULL  ,   0x10 }, // slim, 2005/05/24
147     { "HL-DT-ST", "DVDRAM GMA4082Nf"               , NULL  ,   0x10 }, // slim, 2006/02/28
148     { "HL-DT-ST", "DVDRAM GMA4082Nj"               , NULL  ,   0x10 }, // slim, 2006/01/26
149 
150     { "HL-DT-ST", "DVDRAM GSA-4084N"               , NULL  ,   0x10 }, // slim, 2005/12/21
151     { "HL-DT-ST", "DVDRAM GMA-4084N"               , NULL  ,   0x10 }, // slim, 2006/02/15
152     { "HP"      , "DVD Writer 550s"                , NULL  ,   0x10 }, // slim, 2006/05/08
153     { "HL-DT-ST", "DVDRAM GSA-T10N"                , NULL  ,   0x10 }, // slim, 2006/07/26
154     { "HL-DT-ST", "DVDRAM_GSA-T10N"                , NULL  ,   0x10 }, // slim, 2006/07/26
155     { "HL-DT-ST", "DVD+-RW GSA-T11N"               , NULL  ,   0x10 }, // slim, 2006/07/25
156 
157     { "HL-DT-ST", "DVD-ROM GDR8160B"               , NULL  ,   0x10 }, // hh  , 2001/10/12
158     { "COMPAQ"  , "DVD-ROM GDR8160B"               , NULL  ,   0x10 }, // hh  , 2001/11/08
159     { "HL-DT-ST", "DVD-ROM GDR8161B"               , NULL  ,   0x10 }, // hh  , 2002/07/19
160     { "HL-DT-ST", "DVD-ROM GDR8162B"               , NULL  ,   0x10 }, // hh  , 2003/04/22
161     { "HL-DT-ST", "DVD-ROM GDR8163B"               , NULL  ,   0x10 }, // hh  , 2004/05/19
162     { "HL-DT-ST", "DVD-ROM GDR8164B"               , NULL  ,   0x10 }, // hh  , 2005/06/29
163     { "HL-DT-ST", "DVD-ROM GDRH10N"                , NULL  ,   0x10 }, // hh  , 2006/03/07
164 
165     { "HL-DT-ST", "DVD-ROM GDR8081N"               , NULL  ,   0x10 }, // slim, 2001/08/27
166     { "HL-DT-ST", "DVD-ROM GDR8082N"               , NULL  ,   0x10 }, // slim, 2003/02/02
167     { "HL-DT-ST", "DVD-ROM GDR8083N"               , NULL  ,   0x10 }, // slim, 2003/02/02
168     { "HL-DT-ST", "DVD-ROM GDR8085N"               , NULL  ,   0x10 }, // slim, 2005/11/10
169 
170     { "HL-DT-ST", "RW/DVD GCC-4080N"               , NULL  ,   0x10 }, // slim, 2001/08/21
171     { "HL-DT-ST", "RW/DVD_GCC-4080N"               , NULL  ,   0x10 }, // slim,
172     { "HL-DT-ST", "RW/DVD GCC-4160N"               , NULL  ,   0x10 }, // slim, 2002/04/08
173     { "HL-DT-ST", "RW/DVD GCC-4240N"               , NULL  ,   0x10 }, // slim, 2002/04/26
174     { "HL-DT-ST", "RW/DVD GCC-4241N"               , NULL  ,   0x10 }, // slim, 2003/04/07
175     { "HL-DT-ST", "RW/DVD_GCC-4241N"               , NULL  ,   0x10 }, // slim, 2004/03/07
176     { "HL-DT-ST", "RW/DVD GCC-4242N"               , NULL  ,   0x10 }, // slim, 2003/12/21
177     { "HL-DT-ST", "RW/DVD GCC-4246N"               , NULL  ,   0x10 }, // slim, 2005/05/23
178     { "HL-DT-ST", "BD-RE  GBW-H10N"                , NULL  ,   0x10 }, // hh  , 2006/06/27
179 
180     { "HL-DT-ST", "DVDRAM GSA-4083N"               , NULL  ,   0x10 }, // hh  , 2006/05/17
181     { "HL-DT-ST", "DVD+-RW GWA4083N"               , NULL  ,   0x10 }, // hh  , 2006/06/05
182 
183     { "PIONEER",  "DVD-RW  DVR-106D"               , NULL  ,   0x10 }, // hh  , ?
184     { "ASUS",     "DVD-RW DRW-0402P"               , NULL  ,   0x10 }, // hh  , ?
185 
186     //
187     // This list contains devices that claims to support asynchronous notification, but
188     // doesn't handle it well (e.g., some TSST devices will not report media removal if
189     // the GESN command is sent down immediately after the AN interrupt, they need some
190     // time in between to be able to correctly report media removal).
191     //
192 
193     { "TSSTcorp", "CDDVDW SN-S083A"                , "SB00",   0x40 }, // slim, ?
194 
195     //
196     // This list contains vendor ID and product ID as a single string for ATAPI interface.
197     //
198 
199     { "", "HL-DT-ST DVDRAM GMA-4020B"              , NULL  ,   0x10 }, // hh  , 2002/04/22
200     { "", "HL-DT-ST DVD-RW GCA-4020B"              , NULL  ,   0x10 }, // hh  , 2002/05/14
201     { "", "HL-DT-ST DVDRAM GSA-4040B"              , NULL  ,   0x10 }, // hh  , 2003/05/06
202     { "", "HL-DT-ST DVDRAM GMA-4040B"              , NULL  ,   0x10 }, // hh  , 2003/07/27
203     { "", "HL-DT-ST DVD-RW GWA-4040B"              , NULL  ,   0x10 }, // hh  , 2003/11/18
204     { "", "HL-DT-ST DVDRAM GSA-4081B"              , NULL  ,   0x10 }, // hh  , 2003/11/06
205     { "", "HL-DT-ST DVDRAM GSA-4082B"              , NULL  ,   0x10 }, // hh  , 2004/01/27
206     { "", "HL-DT-ST DVD-RW GWA-4082B"              , NULL  ,   0x10 }, // hh  , 2004/03/11
207     { "", "HL-DT-ST DVDRAM GSA-4120B"              , NULL  ,   0x10 }, // hh  , 2004/05/16
208     { "", "HL-DT-ST DVD+RW GRA-4120B"              , NULL  ,   0x10 }, // hh  , 2004/04/28
209     { "", "HL-DT-ST DVDRAM GSA-4160B"              , NULL  ,   0x10 }, // hh  , 2004/08/12
210     { "", "HL-DT-ST DVD-RW GWA-4160B"              , NULL  ,   0x10 }, // hh  , 2004/08/24
211     { "", "HL-DT-ST DVDRAM GSA-4163B"              , NULL  ,   0x10 }, // hh  , 2004/11/09
212     { "", "HL-DT-ST DVD-RW GWA-4163B"              , NULL  ,   0x10 }, // hh  , 2004/12/29
213     { "", "HL-DT-ST DVDRAM GSA-4165B"              , NULL  ,   0x10 }, // hh  , 2005/06/09
214     { "", "HL-DT-ST DVDRAM_GSA-4165B"              , NULL  ,   0x10 }, // hh  , 2005/06/28
215     { "", "HL-DT-ST DVD-RW GWA-4165B"              , NULL  ,   0x10 }, // hh  , 2005/08/23
216     { "", "HL-DT-ST DVDRAM GSA-4167B"              , NULL  ,   0x10 }, // hh  , 2005/07/01
217     { "", "HL-DT-ST DVDRAM GSA-H10N"               , NULL  ,   0x10 }, // hh  , 2006/02/16
218     { "", "HL-DT-ST DVDRAM_GSA-H10N"               , NULL  ,   0x10 }, // hh  , 2006/02/16
219     { "", "HL-DT-ST DVDRAM GSA-H10L"               , NULL  ,   0x10 }, // hh  , 2006/02/27
220     { "", "HL-DT-ST DVDRAM_GSA-H10L"               , NULL  ,   0x10 }, // hh  , 2006/04/21
221     { "", "HL-DT-ST DVDRAM GSA-H10A"               , NULL  ,   0x10 }, // hh  , 2006/01/03
222     { "", "HL-DT-ST DVDRAM_GSA-H10A"               , NULL  ,   0x10 }, // hh  , 2006/05/14
223     { "", "HL-DT-ST DVD-RW GSA-H11N"               , NULL  ,   0x10 }, // hh  , 2006/04/28
224     { "", "HL-DT-ST DVD-RW_GSA-H11N"               , NULL  ,   0x10 }, // hh  , 2006/02/22
225 
226     { "", "HL-DT-ST DVDRAM GSA-4080N"              , NULL  ,   0x10 }, // slim, 2004/08/08
227     { "", "HL-DT-ST DVDRAM GMA-4080N"              , NULL  ,   0x10 }, // slim, 2004/11/09
228     { "", "HL-DT-ST DVD-RW GCA-4080N"              , NULL  ,   0x10 }, // slim, 2004/11/22
229     { "", "HL-DT-ST DVD-RW GWA-4080N"              , NULL  ,   0x10 }, // slim, 2004/08/17
230     { "", "HL-DT-ST DVDRAM GSA-4082N"              , NULL  ,   0x10 }, // slim, 2005/07/12
231     { "", "HL-DT-ST DVDRAM_GSA-4082N"              , NULL  ,   0x10 }, // slim, 2005/09/21
232     { "", "HL-DT-ST DVDRAM GMA-4082N"              , NULL  ,   0x10 }, // slim, 2005/10/20
233     { "", "HL-DT-ST DVD-RW GRA-4082N"              , NULL  ,   0x10 }, // slim, 2006/06/07
234     { "", "HL-DT-ST DVD-RW GWA-4082N"              , NULL  ,   0x10 }, // slim, 2005/05/24
235     { "", "HL-DT-ST DVDRAM GMA4082Nf"              , NULL  ,   0x10 }, // slim, 2006/02/28
236     { "", "HL-DT-ST DVDRAM GMA4082Nj"              , NULL  ,   0x10 }, // slim, 2006/01/26
237 
238     { "", "HL-DT-ST DVDRAM GSA-4084N"              , NULL  ,   0x10 }, // slim, 2005/12/21
239     { "", "HL-DT-ST DVDRAM GMA-4084N"              , NULL  ,   0x10 }, // slim, 2006/02/15
240     { "", "HP DVD Writer 550s"                     , NULL  ,   0x10 }, // slim, 2006/05/08
241     { "", "HL-DT-ST DVDRAM GSA-T10N"               , NULL  ,   0x10 }, // slim, 2006/07/26
242     { "", "HL-DT-ST DVDRAM_GSA-T10N"               , NULL  ,   0x10 }, // slim, 2006/07/26
243     { "", "HL-DT-ST DVD+-RW GSA-T11N"              , NULL  ,   0x10 }, // slim, 2006/07/25
244 
245     { "", "HL-DT-ST DVD-ROM GDR8160B"              , NULL  ,   0x10 }, // hh  , 2001/10/12
246     { "", "COMPAQ DVD-ROM GDR8160B"                , NULL  ,   0x10 }, // hh  , 2001/11/08
247     { "", "HL-DT-ST DVD-ROM GDR8161B"              , NULL  ,   0x10 }, // hh  , 2002/07/19
248     { "", "HL-DT-ST DVD-ROM GDR8162B"              , NULL  ,   0x10 }, // hh  , 2003/04/22
249     { "", "HL-DT-ST DVD-ROM GDR8163B"              , NULL  ,   0x10 }, // hh  , 2004/05/19
250     { "", "HL-DT-ST DVD-ROM GDR8164B"              , NULL  ,   0x10 }, // hh  , 2005/06/29
251     { "", "HL-DT-ST DVD-ROM GDRH10N"               , NULL  ,   0x10 }, // hh  , 2006/03/07
252 
253     { "", "HL-DT-ST DVD-ROM GDR8081N"              , NULL  ,   0x10 }, // slim, 2001/08/27
254     { "", "HL-DT-ST DVD-ROM GDR8082N"              , NULL  ,   0x10 }, // slim, 2003/02/02
255     { "", "HL-DT-ST DVD-ROM GDR8083N"              , NULL  ,   0x10 }, // slim, 2003/02/02
256     { "", "HL-DT-ST DVD-ROM GDR8085N"              , NULL  ,   0x10 }, // slim, 2005/11/10
257 
258     { "", "HL-DT-ST RW/DVD GCC-4080N"              , NULL  ,   0x10 }, // slim, 2001/08/21
259     { "", "HL-DT-ST RW/DVD_GCC-4080N"              , NULL  ,   0x10 }, // slim,
260     { "", "HL-DT-ST RW/DVD GCC-4160N"              , NULL  ,   0x10 }, // slim, 2002/04/08
261     { "", "HL-DT-ST RW/DVD GCC-4240N"              , NULL  ,   0x10 }, // slim, 2002/04/26
262     { "", "HL-DT-ST RW/DVD GCC-4241N"              , NULL  ,   0x10 }, // slim, 2003/04/07
263     { "", "HL-DT-ST RW/DVD_GCC-4241N"              , NULL  ,   0x10 }, // slim, 2004/03/07
264     { "", "HL-DT-ST RW/DVD GCC-4242N"              , NULL  ,   0x10 }, // slim, 2003/12/21
265     { "", "HL-DT-ST RW/DVD GCC-4246N"              , NULL  ,   0x10 }, // slim, 2005/05/23
266     { "", "HL-DT-ST BD-RE  GBW-H10N"               , NULL  ,   0x10 }, // hh  , 2006/06/27
267 
268     { "", "HL-DT-ST DVDRAM GSA-4083N"              , NULL  ,   0x10 }, // hh  , 2006/05/17
269     { "", "HL-DT-ST DVD+-RW GWA4083N"              , NULL  ,   0x10 }, // hh  , 2006/06/05
270 
271     { "", "PIONEER DVD-RW  DVR-106D"               , NULL  ,   0x10 }, // hh  , ?
272     { "", "ASUS DVD-RW DRW-0402P"                  , NULL  ,   0x10 }, // hh  , ?
273 
274 
275     // Sony sourced some drives from LG also....
276 
277     { NULL      , NULL                             , NULL  ,   0x00 },
278 };
279 
280 
281 #ifdef ALLOC_DATA_PRAGMA
282 #pragma data_seg()
283 #endif
284