Here are my latest results. The sg_modes command has a "-a" option to dump out all of the supported page codes - it reports that none of the thumbdrives (tested 9) support page code = 4 - it reports that most of the thumbdrives (tested 9) support page code = 5 - it commented that page code 5 is obsolete
the page_code=4 and 5 cyc/head info must be garbage these are the types of values I get back. I haven't found a spec yet for the page_code 5 geometry struct so it could be bogus because of that.
cyc[0]/cyc[1]/cyc[2] head ------------------------------- page_code 4 page_code 5 ================================================ old_sandisk 00/00/00 0 80/00/04 20 new_sandisk stall 00/00/10 3F verbatim 66/b5/02 f f0/00/ff 20 wintec 00/00/80 0 13/88/10 3F
I think the booting drives boot because ... A) using page_code=5 got rid of the stall (even though the data is bogus) B) the MBR is at sector 0, and 0 is 0 no matter what the geometry C) perhaps there is code later in seabios that understands it's booting from a USB drive and knows better than us what to do and uses something like linear sectors.
Marc suggested that I leave the page_code set to 4 in order to preserve functionality for drives that actually report valid CHS geometry, and to add code that would clear the stall from the USB controller and thumbdrive.
Questions: 1) Any recommendations on my direction? 2) Is there any way to differentiate between a USB thumbdrive and a USB-to-SATA adapter?
dave
----- Original Message -----
From: "Dave Frodin" dave@camp.se-eng.com To: seabios@seabios.org Sent: Friday, March 2, 2012 8:53:54 AM Subject: Re: [SeaBIOS] Booting from USB thumbdrives, older drives boot, newer drives don't.
Paolo, Thanks for the reply. I ran the sg_modes for pages 4 and 5 on 4 USB thumbdrives. sandisk_old is a 4GB Sandisk Cruzer (yes, the old is ver=8.02) sandisk_new is a 4GB Sandisk Cruzer transcend is a 2GB drive verbatim is a 2GB drive
If I use the unmodified "master" SeaBIOS ... sandisk_old boots sandisk_new stalls at mode sense transcend stalls at mode sense verbatim boots
If I change the mode page from 4 to 5 ... sandisk_old boots sandisk_new boots transcend stalls at mode sense verbatim boots
The mode page change from 4 to 5 allowed four of my none booting drives to boot. Hopefully these logs will be helpful.
Thanks again, dave
starting sandisk_old tests sudo sg_modes -HHp 4 /dev/sdb SanDisk Cruzer 8.02 peripheral_type: disk [0x0] Mode parameter header from MODE SENSE(10): 00 00 46 00 00 00 00 00 00 Mode data length=72, medium type=0x00, WP=0, DpoFua=0, longlba=0 Block descriptor length=0
page_code=0x0, page_control=0
00 00 00 Unexpectedly received extra mode page responses, ignore
sudo sg_modes -HHp 5 /dev/sdb SanDisk Cruzer 8.02 peripheral_type: disk [0x0] Mode parameter header from MODE SENSE(10): 00 00 26 00 00 00 00 00 00 Mode data length=40, medium type=0x00, WP=0, DpoFua=0, longlba=0 Block descriptor length=0
page_code=0x5, page_control=0
00 05 1e 80 00 04 20 02 00 ef c0 00 00 00 00 00 00 10 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
starting sandisk_new tests sudo sg_modes -HHp 4 /dev/sdb SanDisk Cruzer 1.26 peripheral_type: disk [0x0] invalid field in cdb (perhaps page 0x4 not supported)
sudo sg_modes -HHp 5 /dev/sdb SanDisk Cruzer 1.26 peripheral_type: disk [0x0] Mode parameter header from MODE SENSE(10): 00 00 26 00 00 00 00 00 00 Mode data length=40, medium type=0x00, WP=0, DpoFua=0, longlba=0 Block descriptor length=0
page_code=0x5, page_control=0
00 05 1e 00 00 10 3f 02 00 1e 4f 00 00 00 00 00 00 10 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
starting transcend sudo sg_modes -HHp 4 /dev/sdb JetFlash Transcend 2GB 8.07 peripheral_type: disk [0x0] Mode parameter header from MODE SENSE(10): 00 00 06 00 00 00 00 00 00 Mode data length=8, medium type=0x00, WP=0, DpoFua=0, longlba=0 Block descriptor length=0
sudo sg_modes -HHp 5 /dev/sdb JetFlash Transcend 2GB 8.07 peripheral_type: disk [0x0] Mode parameter header from MODE SENSE(10): 00 00 06 00 00 00 00 00 00 Mode data length=8, medium type=0x00, WP=0, DpoFua=0, longlba=0 Block descriptor length=0
starting verbatim sudo sg_modes -HHp 4 /dev/sdb Verbatim STORE N GO 5.00 peripheral_type: disk [0x0] Mode parameter header from MODE SENSE(10): 00 00 06 00 00 00 00 00 00 Mode data length=8, medium type=0x00, WP=0, DpoFua=0, longlba=0 Block descriptor length=0
sudo sg_modes -HHp 5 /dev/sdb Verbatim STORE N GO 5.00 peripheral_type: disk [0x0] Mode parameter header from MODE SENSE(10): 00 00 26 00 00 00 00 00 00 Mode data length=40, medium type=0x00, WP=0, DpoFua=0, longlba=0 Block descriptor length=0
page_code=0x5, page_control=0
00 05 1e f0 00 ff 20 02 00 01 df 00 00 00 00 00 00 10 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
----- Original Message -----
From: "Paolo Bonzini" pbonzini@redhat.com To: seabios@seabios.org, dave@camp.se-eng.com Sent: Friday, March 2, 2012 7:20:28 AM Subject: Re: Booting from USB thumbdrives, older drives boot, newer drives don't.
Il 02/03/2012 01:34, Dave Frodin ha scritto:
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?
The first eight bytes are not part of the page, they are common to all MODE SENSE responses.
Perhaps we could restrict the MODE SENSE to disks of 504MiB and less. I still have a couple of 256 MB pen drives around, I can test them.
Can you try "sg_modes -HHp 4 /dev/sda" (from Linux) on both those that fail and those that work?
Paolo
SeaBIOS mailing list SeaBIOS@seabios.org http://www.seabios.org/mailman/listinfo/seabios