aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ieee1394/sbp2.c
diff options
context:
space:
mode:
authorStefan Richter <stefanr@s5r6.in-berlin.de>2006-02-14 22:04:19 -0500
committerJody McIntyre <scjody@modernduck.com>2006-02-23 00:29:31 -0500
commita80614d1adba903a1e5cb22bf14ebc640fc2ba4c (patch)
tree353e980f946f22cd49805794da70ff221981a8fb /drivers/ieee1394/sbp2.c
parent35bdddb83f62978b5fad82a14fbfd78cc3a5a60c (diff)
sbp2: update 36byte inquiry workaround (fix compatibility regression)
Since about Linux 2.6.14, sbp2's inquiry workaround did not work anymore due to changes in the SCSI layer. Update it to become effective again. Testing one of the two known affected bridges has shown that skip_ms_page_8 is required as well. Also, make force_inquiry_hack tunable via /sys/module/sbp2/parameters. Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de> Signed-off-by: Jody McIntyre <scjody@modernduck.com> (cherry picked from 99496037c6744fd938ffb8ccfc8fc91762322ff8 commit)
Diffstat (limited to 'drivers/ieee1394/sbp2.c')
-rw-r--r--drivers/ieee1394/sbp2.c42
1 files changed, 19 insertions, 23 deletions
diff --git a/drivers/ieee1394/sbp2.c b/drivers/ieee1394/sbp2.c
index 0672224fa109..eca92eb475a1 100644
--- a/drivers/ieee1394/sbp2.c
+++ b/drivers/ieee1394/sbp2.c
@@ -137,15 +137,15 @@ MODULE_PARM_DESC(exclusive_login, "Exclusive login to sbp2 device (default = 1)"
137/* 137/*
138 * SCSI inquiry hack for really badly behaved sbp2 devices. Turn this on 138 * SCSI inquiry hack for really badly behaved sbp2 devices. Turn this on
139 * if your sbp2 device is not properly handling the SCSI inquiry command. 139 * if your sbp2 device is not properly handling the SCSI inquiry command.
140 * This hack makes the inquiry look more like a typical MS Windows 140 * This hack makes the inquiry look more like a typical MS Windows inquiry
141 * inquiry. 141 * by enforcing 36 byte inquiry and avoiding access to mode_sense page 8.
142 * 142 *
143 * If force_inquiry_hack=1 is required for your device to work, 143 * If force_inquiry_hack=1 is required for your device to work,
144 * please submit the logged sbp2_firmware_revision value of this device to 144 * please submit the logged sbp2_firmware_revision value of this device to
145 * the linux1394-devel mailing list. 145 * the linux1394-devel mailing list.
146 */ 146 */
147static int force_inquiry_hack; 147static int force_inquiry_hack;
148module_param(force_inquiry_hack, int, 0444); 148module_param(force_inquiry_hack, int, 0644);
149MODULE_PARM_DESC(force_inquiry_hack, "Force SCSI inquiry hack (default = 0)"); 149MODULE_PARM_DESC(force_inquiry_hack, "Force SCSI inquiry hack (default = 0)");
150 150
151/* 151/*
@@ -264,18 +264,17 @@ static struct hpsb_protocol_driver sbp2_driver = {
264 }, 264 },
265}; 265};
266 266
267 267/*
268/* List of device firmware's that require a forced 36 byte inquiry. */ 268 * List of device firmwares that require the inquiry hack.
269 * Yields a few false positives but did not break other devices so far.
270 */
269static u32 sbp2_broken_inquiry_list[] = { 271static u32 sbp2_broken_inquiry_list[] = {
270 0x00002800, /* Stefan Richter <richtest@bauwesen.tu-cottbus.de> */ 272 0x00002800, /* Stefan Richter <stefanr@s5r6.in-berlin.de> */
271 /* DViCO Momobay CX-1 */ 273 /* DViCO Momobay CX-1 */
272 0x00000200 /* Andreas Plesch <plesch@fas.harvard.edu> */ 274 0x00000200 /* Andreas Plesch <plesch@fas.harvard.edu> */
273 /* QPS Fire DVDBurner */ 275 /* QPS Fire DVDBurner */
274}; 276};
275 277
276#define NUM_BROKEN_INQUIRY_DEVS \
277 (sizeof(sbp2_broken_inquiry_list)/sizeof(*sbp2_broken_inquiry_list))
278
279/************************************** 278/**************************************
280 * General utility functions 279 * General utility functions
281 **************************************/ 280 **************************************/
@@ -1575,7 +1574,7 @@ static void sbp2_parse_unit_directory(struct scsi_id_instance_data *scsi_id,
1575 /* Check for a blacklisted set of devices that require us to force 1574 /* Check for a blacklisted set of devices that require us to force
1576 * a 36 byte host inquiry. This can be overriden as a module param 1575 * a 36 byte host inquiry. This can be overriden as a module param
1577 * (to force all hosts). */ 1576 * (to force all hosts). */
1578 for (i = 0; i < NUM_BROKEN_INQUIRY_DEVS; i++) { 1577 for (i = 0; i < ARRAY_SIZE(sbp2_broken_inquiry_list); i++) {
1579 if ((firmware_revision & 0xffff00) == 1578 if ((firmware_revision & 0xffff00) ==
1580 sbp2_broken_inquiry_list[i]) { 1579 sbp2_broken_inquiry_list[i]) {
1581 SBP2_WARN("Node " NODE_BUS_FMT ": Using 36byte inquiry workaround", 1580 SBP2_WARN("Node " NODE_BUS_FMT ": Using 36byte inquiry workaround",
@@ -2022,18 +2021,6 @@ static int sbp2_send_command(struct scsi_id_instance_data *scsi_id,
2022 } 2021 }
2023 2022
2024 /* 2023 /*
2025 * The scsi stack sends down a request_bufflen which does not match the
2026 * length field in the scsi cdb. This causes some sbp2 devices to
2027 * reject this inquiry command. Fix the request_bufflen.
2028 */
2029 if (*cmd == INQUIRY) {
2030 if (force_inquiry_hack || scsi_id->workarounds & SBP2_BREAKAGE_INQUIRY_HACK)
2031 request_bufflen = cmd[4] = 0x24;
2032 else
2033 request_bufflen = cmd[4];
2034 }
2035
2036 /*
2037 * Now actually fill in the comamnd orb and sbp2 s/g list 2024 * Now actually fill in the comamnd orb and sbp2 s/g list
2038 */ 2025 */
2039 sbp2_create_command_orb(scsi_id, command, cmd, SCpnt->use_sg, 2026 sbp2_create_command_orb(scsi_id, command, cmd, SCpnt->use_sg,
@@ -2489,7 +2476,16 @@ static void sbp2scsi_complete_command(struct scsi_id_instance_data *scsi_id,
2489 2476
2490static int sbp2scsi_slave_alloc(struct scsi_device *sdev) 2477static int sbp2scsi_slave_alloc(struct scsi_device *sdev)
2491{ 2478{
2492 ((struct scsi_id_instance_data *)sdev->host->hostdata[0])->sdev = sdev; 2479 struct scsi_id_instance_data *scsi_id =
2480 (struct scsi_id_instance_data *)sdev->host->hostdata[0];
2481
2482 scsi_id->sdev = sdev;
2483
2484 if (force_inquiry_hack ||
2485 scsi_id->workarounds & SBP2_BREAKAGE_INQUIRY_HACK) {
2486 sdev->inquiry_len = 36;
2487 sdev->skip_ms_page_8 = 1;
2488 }
2493 return 0; 2489 return 0;
2494} 2490}
2495 2491