[SeaBIOS] Booting from USB thumbdrives, older drives boot, newer drives don't.

Dave Frodin dave at camp.se-eng.com
Fri Mar 2 01:34:41 CET 2012


I have some addition results and questions.

I changed the "page mode" value that is in the struct sent in the 
MODE SENSE command from the existing value of 04h (rigid disk) to
05h (flexible disk). This change increased the number of passing
USB thumbdrives from 6 to 10. I'm testing with a total of 12 different
vendor/size drives.

The two failing drives still send a USB stall but the failure mode is
different. With the page mode type set to 4 the failure sequence was ...
   1) send MODE SENSE command to drive => device accepts data and ACKs
   2) device stalls the USB bus
With the page mode set to 5 the failure sequence is ...
   1) send MODE SENSE command to drive => device accepts data and ACKs
   2) device sends response => host accepts data and ACKs
   3) device stalls the USB bus
Also, the device only sends 6 bytes instead of the requested 27 bytes.

I'm planning on seeing if there isn't something missing prior to the mode
sense command tomorrow.

On a related topic, I have a copy of the "Indispensable PC Hardware" book
that lists the return values for the mode page 4 request. It list the cyc/head
data as follows...
 offset   value
==================
   2     cyl(msb)
   3     cyl
   4     cyl(lsb)
   5     heads

the struct in the blockcmd.h file shows...
  struct cdbres_mode_sense_geom {
    u8 unused_00[3];
    u8 read_only;
    u32 unused_04;
    u8 page;
    u8 length;
    u8 cyl[3];     
    u8 heads;
    u8 precomp[3];
    u8 reduced[3];
    u16 step_rate;
    u8 landing[3];
    u16 rpm;
  } PACKED;
which would put cyl[3] at offset 10 thru 12 and heads at offset 13.
Am I missing something here?

USB thumbdrives that don't stall on the mode sense return values like
cyl = 10h 3Fh 02h
heads = 00h
???

The values for that drive have 00h at offsets 2 thru 5.

I'm looking forward to any insight into this from anyone knowledgeable on the subject.

Dave

----- Original Message -----
> From: "Dave Frodin" <dave at camp.se-eng.com>
> To: seabios at seabios.org
> Sent: Wednesday, February 29, 2012 4:38:21 PM
> Subject: [SeaBIOS] Booting from USB thumbdrives, older drives boot,	newer drives don't.
> 
> I'm a new subscriber to seabios.org so feel free to straighten me out
> if needed.
> 
> I've been debugging an problem we've been seeing with not being able
> to boot (Ubuntu specifically) off
> of a variety of "newer" USB thumb drives. I've been specifically
> looking at an older/newer pair of
> Sandisk Cruzer 4GB drives. I've been adding dprintf's to narrow down
> the problem to the blockcmd.c file.
> The function scsi_init_drive() queries the USB device to determine
> stuff like vendor/device/size/etc.
> Near the end of the function is a call to cdb_mode_sense_geom(&dop,
> &geomdata) to retrieve the info
> related to cyl/head type stuff. On the older/working thumbdrive it
> returns zeroes for all of the values
> that get used by the code. The newer/failing drive generates a
> "stall" on the USB bus, which it never
> recovers from. The cdb_mode_sense_geom() function is sending a SCSI
> CDB Mode Sense (CMD=0x5A) to the device.
> 
> As a hack of a test, I removed the call to cdb_mode_sense_geom() and
> filled the buffer it should have returned
> with zeroes and the failing thumbdrive now boots.
> 
> I have some searching I need to do to find out...
> 1) Is there a SCSI command to determine what protocols are supported?
> 2) Is there another SCSI command that might return similar required
> data?
> 
> Has anyone out there experienced similar booting difficulties?
> Or does anyone have any recommendations on what approach I should
> take?
> 
> thanks,
> Dave
> 
> _______________________________________________
> SeaBIOS mailing list
> SeaBIOS at seabios.org
> http://www.seabios.org/mailman/listinfo/seabios
> 



More information about the SeaBIOS mailing list