sr_ioctl.c 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594
  1. #include <linux/kernel.h>
  2. #include <linux/mm.h>
  3. #include <linux/fs.h>
  4. #include <linux/errno.h>
  5. #include <linux/string.h>
  6. #include <linux/blkdev.h>
  7. #include <linux/module.h>
  8. #include <linux/blkpg.h>
  9. #include <linux/cdrom.h>
  10. #include <linux/delay.h>
  11. #include <linux/slab.h>
  12. #include <asm/io.h>
  13. #include <asm/uaccess.h>
  14. #include <scsi/scsi.h>
  15. #include <scsi/scsi_dbg.h>
  16. #include <scsi/scsi_device.h>
  17. #include <scsi/scsi_eh.h>
  18. #include <scsi/scsi_host.h>
  19. #include <scsi/scsi_ioctl.h>
  20. #include <scsi/scsi_cmnd.h>
  21. #include "sr.h"
  22. #if 0
  23. #define DEBUG
  24. #endif
  25. /* The sr_is_xa() seems to trigger firmware bugs with some drives :-(
  26. * It is off by default and can be turned on with this module parameter */
  27. static int xa_test = 0;
  28. module_param(xa_test, int, S_IRUGO | S_IWUSR);
  29. /* primitive to determine whether we need to have GFP_DMA set based on
  30. * the status of the unchecked_isa_dma flag in the host structure */
  31. #define SR_GFP_DMA(cd) (((cd)->device->host->unchecked_isa_dma) ? GFP_DMA : 0)
  32. static int sr_read_tochdr(struct cdrom_device_info *cdi,
  33. struct cdrom_tochdr *tochdr)
  34. {
  35. struct scsi_cd *cd = cdi->handle;
  36. struct packet_command cgc;
  37. int result;
  38. unsigned char *buffer;
  39. buffer = kmalloc(32, GFP_KERNEL | SR_GFP_DMA(cd));
  40. if (!buffer)
  41. return -ENOMEM;
  42. memset(&cgc, 0, sizeof(struct packet_command));
  43. cgc.timeout = IOCTL_TIMEOUT;
  44. cgc.cmd[0] = GPCMD_READ_TOC_PMA_ATIP;
  45. cgc.cmd[8] = 12; /* LSB of length */
  46. cgc.buffer = buffer;
  47. cgc.buflen = 12;
  48. cgc.quiet = 1;
  49. cgc.data_direction = DMA_FROM_DEVICE;
  50. result = sr_do_ioctl(cd, &cgc);
  51. tochdr->cdth_trk0 = buffer[2];
  52. tochdr->cdth_trk1 = buffer[3];
  53. kfree(buffer);
  54. return result;
  55. }
  56. static int sr_read_tocentry(struct cdrom_device_info *cdi,
  57. struct cdrom_tocentry *tocentry)
  58. {
  59. struct scsi_cd *cd = cdi->handle;
  60. struct packet_command cgc;
  61. int result;
  62. unsigned char *buffer;
  63. buffer = kmalloc(32, GFP_KERNEL | SR_GFP_DMA(cd));
  64. if (!buffer)
  65. return -ENOMEM;
  66. memset(&cgc, 0, sizeof(struct packet_command));
  67. cgc.timeout = IOCTL_TIMEOUT;
  68. cgc.cmd[0] = GPCMD_READ_TOC_PMA_ATIP;
  69. cgc.cmd[1] |= (tocentry->cdte_format == CDROM_MSF) ? 0x02 : 0;
  70. cgc.cmd[6] = tocentry->cdte_track;
  71. cgc.cmd[8] = 12; /* LSB of length */
  72. cgc.buffer = buffer;
  73. cgc.buflen = 12;
  74. cgc.data_direction = DMA_FROM_DEVICE;
  75. result = sr_do_ioctl(cd, &cgc);
  76. tocentry->cdte_ctrl = buffer[5] & 0xf;
  77. tocentry->cdte_adr = buffer[5] >> 4;
  78. tocentry->cdte_datamode = (tocentry->cdte_ctrl & 0x04) ? 1 : 0;
  79. if (tocentry->cdte_format == CDROM_MSF) {
  80. tocentry->cdte_addr.msf.minute = buffer[9];
  81. tocentry->cdte_addr.msf.second = buffer[10];
  82. tocentry->cdte_addr.msf.frame = buffer[11];
  83. } else
  84. tocentry->cdte_addr.lba = (((((buffer[8] << 8) + buffer[9]) << 8)
  85. + buffer[10]) << 8) + buffer[11];
  86. kfree(buffer);
  87. return result;
  88. }
  89. #define IOCTL_RETRIES 3
  90. /* ATAPI drives don't have a SCMD_PLAYAUDIO_TI command. When these drives
  91. are emulating a SCSI device via the idescsi module, they need to have
  92. CDROMPLAYTRKIND commands translated into CDROMPLAYMSF commands for them */
  93. static int sr_fake_playtrkind(struct cdrom_device_info *cdi, struct cdrom_ti *ti)
  94. {
  95. struct cdrom_tocentry trk0_te, trk1_te;
  96. struct cdrom_tochdr tochdr;
  97. struct packet_command cgc;
  98. int ntracks, ret;
  99. ret = sr_read_tochdr(cdi, &tochdr);
  100. if (ret)
  101. return ret;
  102. ntracks = tochdr.cdth_trk1 - tochdr.cdth_trk0 + 1;
  103. if (ti->cdti_trk1 == ntracks)
  104. ti->cdti_trk1 = CDROM_LEADOUT;
  105. else if (ti->cdti_trk1 != CDROM_LEADOUT)
  106. ti->cdti_trk1 ++;
  107. trk0_te.cdte_track = ti->cdti_trk0;
  108. trk0_te.cdte_format = CDROM_MSF;
  109. trk1_te.cdte_track = ti->cdti_trk1;
  110. trk1_te.cdte_format = CDROM_MSF;
  111. ret = sr_read_tocentry(cdi, &trk0_te);
  112. if (ret)
  113. return ret;
  114. ret = sr_read_tocentry(cdi, &trk1_te);
  115. if (ret)
  116. return ret;
  117. memset(&cgc, 0, sizeof(struct packet_command));
  118. cgc.cmd[0] = GPCMD_PLAY_AUDIO_MSF;
  119. cgc.cmd[3] = trk0_te.cdte_addr.msf.minute;
  120. cgc.cmd[4] = trk0_te.cdte_addr.msf.second;
  121. cgc.cmd[5] = trk0_te.cdte_addr.msf.frame;
  122. cgc.cmd[6] = trk1_te.cdte_addr.msf.minute;
  123. cgc.cmd[7] = trk1_te.cdte_addr.msf.second;
  124. cgc.cmd[8] = trk1_te.cdte_addr.msf.frame;
  125. cgc.data_direction = DMA_NONE;
  126. cgc.timeout = IOCTL_TIMEOUT;
  127. return sr_do_ioctl(cdi->handle, &cgc);
  128. }
  129. static int sr_play_trkind(struct cdrom_device_info *cdi,
  130. struct cdrom_ti *ti)
  131. {
  132. struct scsi_cd *cd = cdi->handle;
  133. struct packet_command cgc;
  134. int result;
  135. memset(&cgc, 0, sizeof(struct packet_command));
  136. cgc.timeout = IOCTL_TIMEOUT;
  137. cgc.cmd[0] = GPCMD_PLAYAUDIO_TI;
  138. cgc.cmd[4] = ti->cdti_trk0;
  139. cgc.cmd[5] = ti->cdti_ind0;
  140. cgc.cmd[7] = ti->cdti_trk1;
  141. cgc.cmd[8] = ti->cdti_ind1;
  142. cgc.data_direction = DMA_NONE;
  143. result = sr_do_ioctl(cd, &cgc);
  144. if (result == -EDRIVE_CANT_DO_THIS)
  145. result = sr_fake_playtrkind(cdi, ti);
  146. return result;
  147. }
  148. /* We do our own retries because we want to know what the specific
  149. error code is. Normally the UNIT_ATTENTION code will automatically
  150. clear after one error */
  151. int sr_do_ioctl(Scsi_CD *cd, struct packet_command *cgc)
  152. {
  153. struct scsi_device *SDev;
  154. struct scsi_sense_hdr sshdr;
  155. int result, err = 0, retries = 0;
  156. struct request_sense *sense = cgc->sense;
  157. SDev = cd->device;
  158. if (!sense) {
  159. sense = kmalloc(SCSI_SENSE_BUFFERSIZE, GFP_KERNEL);
  160. if (!sense) {
  161. err = -ENOMEM;
  162. goto out;
  163. }
  164. }
  165. retry:
  166. if (!scsi_block_when_processing_errors(SDev)) {
  167. err = -ENODEV;
  168. goto out;
  169. }
  170. memset(sense, 0, sizeof(*sense));
  171. result = scsi_execute(SDev, cgc->cmd, cgc->data_direction,
  172. cgc->buffer, cgc->buflen, (char *)sense,
  173. cgc->timeout, IOCTL_RETRIES, 0, NULL);
  174. scsi_normalize_sense((char *)sense, sizeof(*sense), &sshdr);
  175. /* Minimal error checking. Ignore cases we know about, and report the rest. */
  176. if (driver_byte(result) != 0) {
  177. switch (sshdr.sense_key) {
  178. case UNIT_ATTENTION:
  179. SDev->changed = 1;
  180. if (!cgc->quiet)
  181. sr_printk(KERN_INFO, cd,
  182. "disc change detected.\n");
  183. if (retries++ < 10)
  184. goto retry;
  185. err = -ENOMEDIUM;
  186. break;
  187. case NOT_READY: /* This happens if there is no disc in drive */
  188. if (sshdr.asc == 0x04 &&
  189. sshdr.ascq == 0x01) {
  190. /* sense: Logical unit is in process of becoming ready */
  191. if (!cgc->quiet)
  192. sr_printk(KERN_INFO, cd,
  193. "CDROM not ready yet.\n");
  194. if (retries++ < 10) {
  195. /* sleep 2 sec and try again */
  196. ssleep(2);
  197. goto retry;
  198. } else {
  199. /* 20 secs are enough? */
  200. err = -ENOMEDIUM;
  201. break;
  202. }
  203. }
  204. if (!cgc->quiet)
  205. sr_printk(KERN_INFO, cd,
  206. "CDROM not ready. Make sure there "
  207. "is a disc in the drive.\n");
  208. err = -ENOMEDIUM;
  209. break;
  210. case ILLEGAL_REQUEST:
  211. err = -EIO;
  212. if (sshdr.asc == 0x20 &&
  213. sshdr.ascq == 0x00)
  214. /* sense: Invalid command operation code */
  215. err = -EDRIVE_CANT_DO_THIS;
  216. break;
  217. default:
  218. err = -EIO;
  219. }
  220. }
  221. /* Wake up a process waiting for device */
  222. out:
  223. if (!cgc->sense)
  224. kfree(sense);
  225. cgc->stat = err;
  226. return err;
  227. }
  228. /* ---------------------------------------------------------------------- */
  229. /* interface to cdrom.c */
  230. int sr_tray_move(struct cdrom_device_info *cdi, int pos)
  231. {
  232. Scsi_CD *cd = cdi->handle;
  233. struct packet_command cgc;
  234. memset(&cgc, 0, sizeof(struct packet_command));
  235. cgc.cmd[0] = GPCMD_START_STOP_UNIT;
  236. cgc.cmd[4] = (pos == 0) ? 0x03 /* close */ : 0x02 /* eject */ ;
  237. cgc.data_direction = DMA_NONE;
  238. cgc.timeout = IOCTL_TIMEOUT;
  239. return sr_do_ioctl(cd, &cgc);
  240. }
  241. int sr_lock_door(struct cdrom_device_info *cdi, int lock)
  242. {
  243. Scsi_CD *cd = cdi->handle;
  244. return scsi_set_medium_removal(cd->device, lock ?
  245. SCSI_REMOVAL_PREVENT : SCSI_REMOVAL_ALLOW);
  246. }
  247. int sr_drive_status(struct cdrom_device_info *cdi, int slot)
  248. {
  249. struct scsi_cd *cd = cdi->handle;
  250. struct scsi_sense_hdr sshdr;
  251. struct media_event_desc med;
  252. if (CDSL_CURRENT != slot) {
  253. /* we have no changer support */
  254. return -EINVAL;
  255. }
  256. if (!scsi_test_unit_ready(cd->device, SR_TIMEOUT, MAX_RETRIES, &sshdr))
  257. return CDS_DISC_OK;
  258. /* SK/ASC/ASCQ of 2/4/1 means "unit is becoming ready" */
  259. if (scsi_sense_valid(&sshdr) && sshdr.sense_key == NOT_READY
  260. && sshdr.asc == 0x04 && sshdr.ascq == 0x01)
  261. return CDS_DRIVE_NOT_READY;
  262. if (!cdrom_get_media_event(cdi, &med)) {
  263. if (med.media_present)
  264. return CDS_DISC_OK;
  265. else if (med.door_open)
  266. return CDS_TRAY_OPEN;
  267. else
  268. return CDS_NO_DISC;
  269. }
  270. /*
  271. * SK/ASC/ASCQ of 2/4/2 means "initialization required"
  272. * Using CD_TRAY_OPEN results in an START_STOP_UNIT to close
  273. * the tray, which resolves the initialization requirement.
  274. */
  275. if (scsi_sense_valid(&sshdr) && sshdr.sense_key == NOT_READY
  276. && sshdr.asc == 0x04 && sshdr.ascq == 0x02)
  277. return CDS_TRAY_OPEN;
  278. /*
  279. * 0x04 is format in progress .. but there must be a disc present!
  280. */
  281. if (sshdr.sense_key == NOT_READY && sshdr.asc == 0x04)
  282. return CDS_DISC_OK;
  283. /*
  284. * If not using Mt Fuji extended media tray reports,
  285. * just return TRAY_OPEN since ATAPI doesn't provide
  286. * any other way to detect this...
  287. */
  288. if (scsi_sense_valid(&sshdr) &&
  289. /* 0x3a is medium not present */
  290. sshdr.asc == 0x3a)
  291. return CDS_NO_DISC;
  292. else
  293. return CDS_TRAY_OPEN;
  294. return CDS_DRIVE_NOT_READY;
  295. }
  296. int sr_disk_status(struct cdrom_device_info *cdi)
  297. {
  298. Scsi_CD *cd = cdi->handle;
  299. struct cdrom_tochdr toc_h;
  300. struct cdrom_tocentry toc_e;
  301. int i, rc, have_datatracks = 0;
  302. /* look for data tracks */
  303. rc = sr_read_tochdr(cdi, &toc_h);
  304. if (rc)
  305. return (rc == -ENOMEDIUM) ? CDS_NO_DISC : CDS_NO_INFO;
  306. for (i = toc_h.cdth_trk0; i <= toc_h.cdth_trk1; i++) {
  307. toc_e.cdte_track = i;
  308. toc_e.cdte_format = CDROM_LBA;
  309. if (sr_read_tocentry(cdi, &toc_e))
  310. return CDS_NO_INFO;
  311. if (toc_e.cdte_ctrl & CDROM_DATA_TRACK) {
  312. have_datatracks = 1;
  313. break;
  314. }
  315. }
  316. if (!have_datatracks)
  317. return CDS_AUDIO;
  318. if (cd->xa_flag)
  319. return CDS_XA_2_1;
  320. else
  321. return CDS_DATA_1;
  322. }
  323. int sr_get_last_session(struct cdrom_device_info *cdi,
  324. struct cdrom_multisession *ms_info)
  325. {
  326. Scsi_CD *cd = cdi->handle;
  327. ms_info->addr.lba = cd->ms_offset;
  328. ms_info->xa_flag = cd->xa_flag || cd->ms_offset > 0;
  329. return 0;
  330. }
  331. int sr_get_mcn(struct cdrom_device_info *cdi, struct cdrom_mcn *mcn)
  332. {
  333. Scsi_CD *cd = cdi->handle;
  334. struct packet_command cgc;
  335. char *buffer = kmalloc(32, GFP_KERNEL | SR_GFP_DMA(cd));
  336. int result;
  337. if (!buffer)
  338. return -ENOMEM;
  339. memset(&cgc, 0, sizeof(struct packet_command));
  340. cgc.cmd[0] = GPCMD_READ_SUBCHANNEL;
  341. cgc.cmd[2] = 0x40; /* I do want the subchannel info */
  342. cgc.cmd[3] = 0x02; /* Give me medium catalog number info */
  343. cgc.cmd[8] = 24;
  344. cgc.buffer = buffer;
  345. cgc.buflen = 24;
  346. cgc.data_direction = DMA_FROM_DEVICE;
  347. cgc.timeout = IOCTL_TIMEOUT;
  348. result = sr_do_ioctl(cd, &cgc);
  349. memcpy(mcn->medium_catalog_number, buffer + 9, 13);
  350. mcn->medium_catalog_number[13] = 0;
  351. kfree(buffer);
  352. return result;
  353. }
  354. int sr_reset(struct cdrom_device_info *cdi)
  355. {
  356. return 0;
  357. }
  358. int sr_select_speed(struct cdrom_device_info *cdi, int speed)
  359. {
  360. Scsi_CD *cd = cdi->handle;
  361. struct packet_command cgc;
  362. if (speed == 0)
  363. speed = 0xffff; /* set to max */
  364. else
  365. speed *= 177; /* Nx to kbyte/s */
  366. memset(&cgc, 0, sizeof(struct packet_command));
  367. cgc.cmd[0] = GPCMD_SET_SPEED; /* SET CD SPEED */
  368. cgc.cmd[2] = (speed >> 8) & 0xff; /* MSB for speed (in kbytes/sec) */
  369. cgc.cmd[3] = speed & 0xff; /* LSB */
  370. cgc.data_direction = DMA_NONE;
  371. cgc.timeout = IOCTL_TIMEOUT;
  372. if (sr_do_ioctl(cd, &cgc))
  373. return -EIO;
  374. return 0;
  375. }
  376. /* ----------------------------------------------------------------------- */
  377. /* this is called by the generic cdrom driver. arg is a _kernel_ pointer, */
  378. /* because the generic cdrom driver does the user access stuff for us. */
  379. /* only cdromreadtochdr and cdromreadtocentry are left - for use with the */
  380. /* sr_disk_status interface for the generic cdrom driver. */
  381. int sr_audio_ioctl(struct cdrom_device_info *cdi, unsigned int cmd, void *arg)
  382. {
  383. switch (cmd) {
  384. case CDROMREADTOCHDR:
  385. return sr_read_tochdr(cdi, arg);
  386. case CDROMREADTOCENTRY:
  387. return sr_read_tocentry(cdi, arg);
  388. case CDROMPLAYTRKIND:
  389. return sr_play_trkind(cdi, arg);
  390. default:
  391. return -EINVAL;
  392. }
  393. }
  394. /* -----------------------------------------------------------------------
  395. * a function to read all sorts of funny cdrom sectors using the READ_CD
  396. * scsi-3 mmc command
  397. *
  398. * lba: linear block address
  399. * format: 0 = data (anything)
  400. * 1 = audio
  401. * 2 = data (mode 1)
  402. * 3 = data (mode 2)
  403. * 4 = data (mode 2 form1)
  404. * 5 = data (mode 2 form2)
  405. * blksize: 2048 | 2336 | 2340 | 2352
  406. */
  407. static int sr_read_cd(Scsi_CD *cd, unsigned char *dest, int lba, int format, int blksize)
  408. {
  409. struct packet_command cgc;
  410. #ifdef DEBUG
  411. sr_printk(KERN_INFO, cd, "sr_read_cd lba=%d format=%d blksize=%d\n",
  412. lba, format, blksize);
  413. #endif
  414. memset(&cgc, 0, sizeof(struct packet_command));
  415. cgc.cmd[0] = GPCMD_READ_CD; /* READ_CD */
  416. cgc.cmd[1] = ((format & 7) << 2);
  417. cgc.cmd[2] = (unsigned char) (lba >> 24) & 0xff;
  418. cgc.cmd[3] = (unsigned char) (lba >> 16) & 0xff;
  419. cgc.cmd[4] = (unsigned char) (lba >> 8) & 0xff;
  420. cgc.cmd[5] = (unsigned char) lba & 0xff;
  421. cgc.cmd[8] = 1;
  422. switch (blksize) {
  423. case 2336:
  424. cgc.cmd[9] = 0x58;
  425. break;
  426. case 2340:
  427. cgc.cmd[9] = 0x78;
  428. break;
  429. case 2352:
  430. cgc.cmd[9] = 0xf8;
  431. break;
  432. default:
  433. cgc.cmd[9] = 0x10;
  434. break;
  435. }
  436. cgc.buffer = dest;
  437. cgc.buflen = blksize;
  438. cgc.data_direction = DMA_FROM_DEVICE;
  439. cgc.timeout = IOCTL_TIMEOUT;
  440. return sr_do_ioctl(cd, &cgc);
  441. }
  442. /*
  443. * read sectors with blocksizes other than 2048
  444. */
  445. static int sr_read_sector(Scsi_CD *cd, int lba, int blksize, unsigned char *dest)
  446. {
  447. struct packet_command cgc;
  448. int rc;
  449. /* we try the READ CD command first... */
  450. if (cd->readcd_known) {
  451. rc = sr_read_cd(cd, dest, lba, 0, blksize);
  452. if (-EDRIVE_CANT_DO_THIS != rc)
  453. return rc;
  454. cd->readcd_known = 0;
  455. sr_printk(KERN_INFO, cd,
  456. "CDROM does'nt support READ CD (0xbe) command\n");
  457. /* fall & retry the other way */
  458. }
  459. /* ... if this fails, we switch the blocksize using MODE SELECT */
  460. if (blksize != cd->device->sector_size) {
  461. if (0 != (rc = sr_set_blocklength(cd, blksize)))
  462. return rc;
  463. }
  464. #ifdef DEBUG
  465. sr_printk(KERN_INFO, cd, "sr_read_sector lba=%d blksize=%d\n",
  466. lba, blksize);
  467. #endif
  468. memset(&cgc, 0, sizeof(struct packet_command));
  469. cgc.cmd[0] = GPCMD_READ_10;
  470. cgc.cmd[2] = (unsigned char) (lba >> 24) & 0xff;
  471. cgc.cmd[3] = (unsigned char) (lba >> 16) & 0xff;
  472. cgc.cmd[4] = (unsigned char) (lba >> 8) & 0xff;
  473. cgc.cmd[5] = (unsigned char) lba & 0xff;
  474. cgc.cmd[8] = 1;
  475. cgc.buffer = dest;
  476. cgc.buflen = blksize;
  477. cgc.data_direction = DMA_FROM_DEVICE;
  478. cgc.timeout = IOCTL_TIMEOUT;
  479. rc = sr_do_ioctl(cd, &cgc);
  480. return rc;
  481. }
  482. /*
  483. * read a sector in raw mode to check the sector format
  484. * ret: 1 == mode2 (XA), 0 == mode1, <0 == error
  485. */
  486. int sr_is_xa(Scsi_CD *cd)
  487. {
  488. unsigned char *raw_sector;
  489. int is_xa;
  490. if (!xa_test)
  491. return 0;
  492. raw_sector = kmalloc(2048, GFP_KERNEL | SR_GFP_DMA(cd));
  493. if (!raw_sector)
  494. return -ENOMEM;
  495. if (0 == sr_read_sector(cd, cd->ms_offset + 16,
  496. CD_FRAMESIZE_RAW1, raw_sector)) {
  497. is_xa = (raw_sector[3] == 0x02) ? 1 : 0;
  498. } else {
  499. /* read a raw sector failed for some reason. */
  500. is_xa = -1;
  501. }
  502. kfree(raw_sector);
  503. #ifdef DEBUG
  504. sr_printk(KERN_INFO, cd, "sr_is_xa: %d\n", is_xa);
  505. #endif
  506. return is_xa;
  507. }