Make cd driver to handle Audio CDs, reporting their 2352 bytes sectors to
GEOM and using READ CD command for reading data, same as acd driver does. Audio CDs identified by checking respective bit of the control field of the first track in TOC. This fixes bunch of error messages during boot (GEOM taste) with Audio CD inserted and allows to grab Audio CD image using just dd. MFC after: 1 month
This commit is contained in:
parent
40c56173c2
commit
90a987e4de
@ -932,6 +932,7 @@ struct ata_pass_16 {
|
||||
#define WRITE_12 0xAA
|
||||
#define WRITE_VERIFY_12 0xAE
|
||||
#define READ_ELEMENT_STATUS 0xB8
|
||||
#define READ_CD 0xBE
|
||||
|
||||
/* Maintenance In Service Action Codes */
|
||||
#define REPORT_IDENTIFYING_INFRMATION 0x05
|
||||
|
@ -1483,6 +1483,11 @@ cdstart(struct cam_periph *periph, union ccb *start_ccb)
|
||||
/* dxfer_len */ bp->bio_bcount,
|
||||
/* sense_len */ SSD_FULL_SIZE,
|
||||
/* timeout */ 30000);
|
||||
/* Use READ CD command for audio tracks. */
|
||||
if (softc->params.blksize == 2352) {
|
||||
start_ccb->csio.cdb_io.cdb_bytes[0] = READ_CD;
|
||||
start_ccb->csio.cdb_io.cdb_bytes[9] = 0xf8;
|
||||
}
|
||||
start_ccb->ccb_h.ccb_state = CD_CCB_BUFFER_IO;
|
||||
|
||||
|
||||
@ -2880,6 +2885,13 @@ cdcheckmedia(struct cam_periph *periph)
|
||||
|
||||
softc->flags |= CD_FLAG_VALID_TOC;
|
||||
|
||||
/* If the first track is audio, correct sector size. */
|
||||
if ((softc->toc.entries[0].control & 4) == 0) {
|
||||
softc->disk->d_sectorsize = softc->params.blksize = 2352;
|
||||
softc->disk->d_mediasize =
|
||||
(off_t)softc->params.blksize * softc->params.disksize;
|
||||
}
|
||||
|
||||
bailout:
|
||||
|
||||
/*
|
||||
|
Loading…
x
Reference in New Issue
Block a user