Re: Hack to fix not working spindown over Firewire

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Stefan Richter
Date: Wednesday, April 30, 2008 - 6:31 am

Tino Keitel wrote:
[...]

For LKML:  There was previous discussion on linux1394-user and LSML.
http://marc.info/?t=120720546800001
The enclosure is a Raidsonic ICY Box.

Responsible for the spindown behavior is the IDE-to-FireWire bridge
controller which is a Prolific PL-3507, and its firmware which is
different from the USB firmware.  Also, there are different firmwares in
the wild for PL-3507.

The sdp->vendor string is assembled by the firmware from data gathered
from the IDE device.  It is therefore not suitable to detect affected
devices.

The traditional way to handle things like this is:

   - Implement this as a workaround in sd.

   - Make this workaround conditional on a quirks flag in
     struct scsi_device.

   - Switch this flag on in a place where it can be reliably
     detected that this device needs it.  There is an interface
     to do this in userspace.  But in this particular case, the
     best place is the sbp2 driver (ond firewire-sbp2 driver),
     because it can detect PL-3507 firmwares by means of firmware
     identifiers.

Tino, to find the firmware marker you can for example:
# echo 0x1000 > /sys/module/sbp2/parameters/workarounds
Then plug in the disk and
# dmesg | grep sbp2

On the other hand, perhaps we can enable the workaround unconditional
for all firewire disks (switch in the flag in sbp2 and firewire-sbp2
without looking at the device) or for all RBC disks (switch on the flag
in sd.c if sdev->type == TYPE_RBC).

RBC clause 5.4.1 states that support of the following POWER CONDITION
values in the START STOP UNIT cdb is mandatory:
0 = No change in power condition
1 = Place device in Active condition
2 = Place device in Idle condition
3 = Place device in Standby condition
5 = Place device in Sleep condition
There is also optional support for 7 = Device Control, which is
uninteresting for our purposes.  According to the description of Active,
Idle, Standby, Sleep in RBC, we do most certainly want code 1 on resume,
and rather 3 than 2 on suspend. 5 instead of 3 or 2 might even be better
from the POV of energy consumption but a "device reset may be required
before access to the device is allowed" which I'd rather not deal with.

Tino, does the scsi stack log the device as "Direct-Access-RBC" after it
was plugged in?

Note to self:  Test sg_start --pc={1,3} with all the various SBP-2
bridges I have access to...
-- 
Stefan Richter
-=====-==--- -=-- ====-
http://arcgraph.de/sr/
--
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
Hack to fix not working spindown over Firewire, Tino Keitel, (Tue Apr 29, 4:26 pm)
Re: Hack to fix not working spindown over Firewire, Stefan Richter, (Wed Apr 30, 6:31 am)
Re: Hack to fix not working spindown over Firewire, Stefan Richter, (Wed Apr 30, 6:36 am)
Re: Hack to fix not working spindown over Firewire, Tino Keitel, (Wed May 7, 11:00 am)
Re: Hack to fix not working spindown over Firewire, Stefan Richter, (Fri May 9, 11:32 am)
Re: Clean patch to fix not working spindown over Firewire, Stefan Richter, (Fri May 9, 2:13 pm)
Re: Clean patch to fix not working spindown over Firewire, Stefan Richter, (Fri May 9, 3:02 pm)
Re: Hack to fix not working spindown over Firewire, Stefan Richter, (Sat May 10, 8:31 am)
Re: Hack to fix not working spindown over Firewire, Stefan Richter, (Sat May 10, 3:53 pm)