Implement MMC_TRACKINFO_DATA and MMC_TRACKINFO_AUDIO detection for cdrom and
dvdrom devices. These two compatibility codes were forgotten when those were introduced.
This commit is contained in:
parent
e8c7343395
commit
42726265fe
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: cd.c,v 1.290 2009/03/18 16:00:20 cegger Exp $ */
|
||||
/* $NetBSD: cd.c,v 1.291 2009/04/01 12:19:04 reinoud Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1998, 2001, 2003, 2004, 2005, 2008 The NetBSD Foundation,
|
||||
@ -50,7 +50,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: cd.c,v 1.290 2009/03/18 16:00:20 cegger Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: cd.c,v 1.291 2009/04/01 12:19:04 reinoud Exp $");
|
||||
|
||||
#include "rnd.h"
|
||||
|
||||
@ -3181,7 +3181,7 @@ mmc_gettrackinfo_cdrom(struct scsipi_periph *periph,
|
||||
const uint32_t buffer_size = 4 * 1024; /* worst case TOC estimate */
|
||||
uint8_t *buffer;
|
||||
uint8_t track_sessionnr, last_tracknr, sessionnr, adr, tno, point;
|
||||
uint8_t tmin, tsec, tframe, pmin, psec, pframe;
|
||||
uint8_t control, tmin, tsec, tframe, pmin, psec, pframe;
|
||||
int size, req_size;
|
||||
int error, flags;
|
||||
|
||||
@ -3225,6 +3225,7 @@ mmc_gettrackinfo_cdrom(struct scsipi_periph *periph,
|
||||
|
||||
/* read in complete raw toc */
|
||||
req_size = _2btol(toc_hdr->length);
|
||||
req_size = 2*((req_size + 1) / 2); /* for ATAPI */
|
||||
_lto2b(req_size, gtoc_cmd.data_len);
|
||||
|
||||
error = scsipi_command(periph,
|
||||
@ -3255,6 +3256,7 @@ mmc_gettrackinfo_cdrom(struct scsipi_periph *periph,
|
||||
tno = rawtoc->tno;
|
||||
sessionnr = rawtoc->sessionnr;
|
||||
adr = rawtoc->adrcontrol >> 4;
|
||||
control = rawtoc->adrcontrol & 0xf;
|
||||
point = rawtoc->point;
|
||||
tmin = rawtoc->min;
|
||||
tsec = rawtoc->sec;
|
||||
@ -3292,6 +3294,14 @@ mmc_gettrackinfo_cdrom(struct scsipi_periph *periph,
|
||||
}
|
||||
}
|
||||
|
||||
if ((control & (3<<2)) == 4) /* 01xxb */
|
||||
flags |= MMC_TRACKINFO_DATA;
|
||||
if ((control & (1<<2)) == 0) { /* x0xxb */
|
||||
flags |= MMC_TRACKINFO_AUDIO;
|
||||
if (control & 1) /* xxx1b */
|
||||
flags |= MMC_TRACKINFO_PRE_EMPH;
|
||||
}
|
||||
|
||||
rawtoc++;
|
||||
size -= sizeof(struct scsipi_toc_rawtoc);
|
||||
}
|
||||
@ -3351,7 +3361,7 @@ mmc_gettrackinfo_dvdrom(struct scsipi_periph *periph,
|
||||
uint32_t lba, lead_out;
|
||||
const uint32_t buffer_size = 4 * 1024; /* worst case TOC estimate */
|
||||
uint8_t *buffer;
|
||||
uint8_t last_tracknr;
|
||||
uint8_t control, last_tracknr;
|
||||
int size, req_size;
|
||||
int error, flags;
|
||||
|
||||
@ -3417,12 +3427,15 @@ mmc_gettrackinfo_dvdrom(struct scsipi_periph *periph,
|
||||
track_start = 0;
|
||||
track_size = 0;
|
||||
lead_out = 0;
|
||||
flags = 0;
|
||||
|
||||
size = req_size - sizeof(struct scsipi_toc_header) + 1;
|
||||
while (size > 0) {
|
||||
/* remember, DVD-ROM: tracknr == sessionnr */
|
||||
lba = _4btol(toc->msf_lba);
|
||||
tracknr = toc->tracknr;
|
||||
control = toc->adrcontrol & 0xf;
|
||||
|
||||
if (trackinfo->tracknr == tracknr) {
|
||||
track_start = lba;
|
||||
}
|
||||
@ -3433,6 +3446,17 @@ mmc_gettrackinfo_dvdrom(struct scsipi_periph *periph,
|
||||
if (tracknr == 0xAA) {
|
||||
lead_out = lba;
|
||||
}
|
||||
|
||||
if ((control & (3<<2)) == 4) /* 01xxb */
|
||||
flags |= MMC_TRACKINFO_DATA;
|
||||
if ((control & (1<<2)) == 0) { /* x0xxb */
|
||||
flags |= MMC_TRACKINFO_AUDIO;
|
||||
if (control & (1<<3)) /* 10xxb */
|
||||
flags |= MMC_TRACKINFO_AUDIO_4CHAN;
|
||||
if (control & 1) /* xxx1b */
|
||||
flags |= MMC_TRACKINFO_PRE_EMPH;
|
||||
}
|
||||
|
||||
toc++;
|
||||
size -= sizeof(struct scsipi_toc_formatted);
|
||||
}
|
||||
@ -3446,7 +3470,7 @@ mmc_gettrackinfo_dvdrom(struct scsipi_periph *periph,
|
||||
trackinfo->track_mode = 0; /* unknown */
|
||||
trackinfo->data_mode = 8; /* 2048 bytes mode1 */
|
||||
|
||||
trackinfo->flags = 0;
|
||||
trackinfo->flags = flags;
|
||||
trackinfo->track_start = track_start;
|
||||
trackinfo->next_writable = 0;
|
||||
trackinfo->free_blocks = 0;
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: scsipi_cd.h,v 1.20 2008/09/08 23:36:54 gmcgarry Exp $ */
|
||||
/* $NetBSD: scsipi_cd.h,v 1.21 2009/04/01 12:19:04 reinoud Exp $ */
|
||||
|
||||
/*
|
||||
* Written by Julian Elischer (julian@tfs.com)
|
||||
@ -115,7 +115,7 @@ struct scsipi_toc_header {
|
||||
/* read TOC form 0 result entries */
|
||||
struct scsipi_toc_formatted {
|
||||
uint8_t unused1;
|
||||
uint8_t adrcontol;
|
||||
uint8_t adrcontrol;
|
||||
uint8_t tracknr;
|
||||
uint8_t unused2;
|
||||
uint8_t msf_lba[4]; /* union msf_lba from cdio.h */
|
||||
|
Loading…
Reference in New Issue
Block a user