summaryrefslogtreecommitdiffstats
path: root/sys/cam/scsi/scsi_cd.h
diff options
context:
space:
mode:
authorken <ken@FreeBSD.org>2003-02-21 06:19:38 +0000
committerken <ken@FreeBSD.org>2003-02-21 06:19:38 +0000
commit915501ccb2cd04785110ff8472f007e5a0b61101 (patch)
tree914528d9dce9c7668d13bb7c38e332bc381a4abb /sys/cam/scsi/scsi_cd.h
parentf66a29b519183414fcd71d2fcc007723367a37bf (diff)
downloadFreeBSD-src-915501ccb2cd04785110ff8472f007e5a0b61101.zip
FreeBSD-src-915501ccb2cd04785110ff8472f007e5a0b61101.tar.gz
Fix ATAPI/USB/Firewire CDROM drive handling in cd(4) and hopefully fix
a number of related problems along the way. - Automatically detect CDROM drives that can't handle 6 byte mode sense and mode select, and adjust our command size accordingly. We have to handle this in the cd(4) driver (where the buffers are allocated), since the parameter list length is different for the 6 and 10 byte mode sense commands. - Remove MODE_SENSE and MODE_SELECT translation removed in ATAPICAM and in the umass(4) driver, since there's no way for that to work properly. - Add a quirk entry for CDROM drives that just hang when they get a 6 byte mode sense or mode select. The reason for the quirk must be documented in a PR, and all quirks must be approved by ken@FreeBSD.org. This is to make sure that we fully understand why each quirk is needed. Once the CAM_NEW_TRAN_CODE is finished, we should be able to remove any such quirks, since we'll know what protocol the drive speaks (SCSI, ATAPI, etc.) and therefore whether we should use 6 or 10 byte mode sense/select commands. - Change the way the da(4) handles the no_6_byte sysctl. There is now a per-drive sysctl to set the minimum command size for that particular disk. (Since you could have multiple disks with multiple requirements in one system.) - Loader tunable support for all the sysctls in the da(4) and cd(4) drivers. - Add a CDIOCCLOSE ioctl for cd(4) (bde pointed this out a long time ago). - Add a media validation routine (cdcheckmedia()) to the cd(4) driver, to fix some problems bde pointed out a long time ago. We now allow open() to succeed no matter what, but if we don't detect valid media, the user can only issue CDIOCCLOSE or CDIOCEJECT ioctls. - The media validation routine also reads the table of contents off the drive. We use the table of contents to implement the CDIOCPLAYTRACKS ioctl using the PLAY AUDIO MSF command. The PLAY AUDIO TRACK INDEX command that we previously used was deprecated after SCSI-2. It works in every SCSI CDROM I've tried, but doesn't seem to work on ATAPI CDROM drives. We still use the play audio track index command if we don't have a valid TOC, but I suppose it'll fail anyway in that case. - Add _len() versions of scsi_mode_sense() and scsi_mode_select() so that we can specify the minimum command length. - Fix a couple of formatting problems in the sense printing code. MFC after: 4 weeks
Diffstat (limited to 'sys/cam/scsi/scsi_cd.h')
-rw-r--r--sys/cam/scsi/scsi_cd.h85
1 files changed, 54 insertions, 31 deletions
diff --git a/sys/cam/scsi/scsi_cd.h b/sys/cam/scsi/scsi_cd.h
index f242139..f502d66 100644
--- a/sys/cam/scsi/scsi_cd.h
+++ b/sys/cam/scsi/scsi_cd.h
@@ -1,5 +1,5 @@
/*-
- * Copyright (c) 2000 Kenneth D. Merry
+ * Copyright (c) 2000, 2002 Kenneth D. Merry
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -655,38 +655,47 @@ struct scsi_read_cd_cap_data
u_int8_t length_0; /* Least significant */
};
-union cd_pages
+struct cd_audio_page
{
- struct audio_page
+ u_int8_t page_code;
+#define CD_PAGE_CODE 0x3F
+#define AUDIO_PAGE 0x0e
+#define CD_PAGE_PS 0x80
+ u_int8_t param_len;
+ u_int8_t flags;
+#define CD_PA_SOTC 0x02
+#define CD_PA_IMMED 0x04
+ u_int8_t unused[2];
+ u_int8_t format_lba;
+#define CD_PA_FORMAT_LBA 0x0F
+#define CD_PA_APR_VALID 0x80
+ u_int8_t lb_per_sec[2];
+ struct port_control
{
- u_int8_t page_code;
-#define CD_PAGE_CODE 0x3F
-#define AUDIO_PAGE 0x0e
-#define CD_PAGE_PS 0x80
- u_int8_t param_len;
- u_int8_t flags;
-#define CD_PA_SOTC 0x02
-#define CD_PA_IMMED 0x04
- u_int8_t unused[2];
- u_int8_t format_lba;
-#define CD_PA_FORMAT_LBA 0x0F
-#define CD_PA_APR_VALID 0x80
- u_int8_t lb_per_sec[2];
- struct port_control
- {
- u_int8_t channels;
-#define CHANNEL 0x0F
-#define CHANNEL_0 1
-#define CHANNEL_1 2
-#define CHANNEL_2 4
-#define CHANNEL_3 8
-#define LEFT_CHANNEL CHANNEL_0
-#define RIGHT_CHANNEL CHANNEL_1
- u_int8_t volume;
- } port[4];
-#define LEFT_PORT 0
-#define RIGHT_PORT 1
- }audio;
+ u_int8_t channels;
+#define CHANNEL 0x0F
+#define CHANNEL_0 1
+#define CHANNEL_1 2
+#define CHANNEL_2 4
+#define CHANNEL_3 8
+#define LEFT_CHANNEL CHANNEL_0
+#define RIGHT_CHANNEL CHANNEL_1
+ u_int8_t volume;
+ } port[4];
+#define LEFT_PORT 0
+#define RIGHT_PORT 1
+};
+
+union cd_pages
+{
+ struct cd_audio_page audio;
+};
+
+struct cd_mode_data_10
+{
+ struct scsi_mode_header_10 header;
+ struct scsi_mode_blk_desc blk_desc;
+ union cd_pages page;
};
struct cd_mode_data
@@ -696,6 +705,20 @@ struct cd_mode_data
union cd_pages page;
};
+union cd_mode_data_6_10
+{
+ struct cd_mode_data mode_data_6;
+ struct cd_mode_data_10 mode_data_10;
+};
+
+struct cd_mode_params
+{
+ STAILQ_ENTRY(cd_mode_params) links;
+ int cdb_size;
+ int alloc_len;
+ u_int8_t *mode_buf;
+};
+
__BEGIN_DECLS
void scsi_report_key(struct ccb_scsiio *csio, u_int32_t retries,
void (*cbfcnp)(struct cam_periph *, union ccb *),
OpenPOWER on IntegriCloud