[SeaBIOS] WD Elements hang SeaBIOS at boot with "call16 with invalid stack"

Tobias Diedrich tobiasdiedrich at gmail.com
Wed Dec 23 21:14:44 CET 2015


Final diff attached (without the src/stacks.c change, with %d->%u change
for sector counts).
Bootlog with debug_level 1 attached.


On Wed, Dec 23, 2015 at 8:56 PM, Tobias Diedrich <tobiasdiedrich at gmail.com>
wrote:

> I replaced the printf(...) with dprintf(1, ...)  (since a dprintf earlier
> in the function was working fine).
>
> This appears to have fixed the issue (though PCHS seems to be wrong, maybe
> because sector count is negative when parsed as a signed int). Full log
> attached.
>
> |dfc02000| USB MSC vendor='WD' product='Elements 10B8' rev='1012' type=0
> removable=0
> \dfc04000/ End thread
> |dfbfd000| USB MSC vendor='Multiple' product='Card  Reader' rev='1.00'
> type=0 removable=1
> |dfbfd000| Device reports MEDIUM NOT PRESENT
> |dfbfd000| scsi_is_ready returned -1
> |dfbfd000| Unable to configure USB MSC drive.
> |dfbfd000| Unable to configure USB MSC device.
> \dfbfd000/ End thread
> |dfc02000| Waiting for device to detect medium... \dfc03000/ End thread
> |dfc02000| USB MSC blksize=512 sectors=-388003840
> |dfc02000| Registering bootable: USB MSC Drive WD Elements 10B8 1012
> (type:2 prio:103 data:f6110)
> \dfc02000/ End thread
> \dfc08000/ End thread
> All threads complete.
> Scan for option roms
>
> Press ESC for boot menu.
>
>
> On Wed, Dec 23, 2015 at 7:58 PM, Kevin O'Connor <kevin at koconnor.net>
> wrote:
>
>> On Wed, Dec 23, 2015 at 07:39:56PM +0100, Tobias Diedrich wrote:
>> > On Wed, Dec 23, 2015 at 7:10 PM, Kevin O'Connor <kevin at koconnor.net>
>> wrote:
>> >
>> > > On Wed, Dec 23, 2015 at 07:02:37PM +0100, Tobias Diedrich wrote:
>> > > > Wcall16 with invalid stack: eax=dfbf3e62 edx=0 func=0x000f9563
>> > > esp=dfbf3e50
>> > > >
>> > > > .text._farcall16 0x9563 : { *(.text._farcall16) }
>> > > >
>> > >
>> > > Can you include the full log?  It looks like the code tried to call a
>> > > 16bit function while in a "thread", and I need to figure out which
>> > > thread did that.
>> >
>> >
>> > From the esp address it looks like it'sin the USB probe for the MSC
>> device
>> > (full log attached):
>> > /dfc02000\ Start thread func=dfc135f1
>> > |dfc02000| set_address 0xdfc0a200
>> > |dfc02000| config_usb: 0xdfc0a0d0
>> > |dfc02000| device rev=0210 cls=00 sub=00 proto=00 size=64
>> > |dfc02000| Searching bootorder for: /pci at i0cf8/usb at 12,2/storage at 5
>> /*@0/*@0,0
>> > |dfc02000| Searching bootorder for: /pci at i0cf8/usb at 12,2/usb-*@5
>> > |dfc02000| USB MSC vendor='WD' product='Elements 10B8' rev='1012' type=0
>> > removable=0
>> > Wcall16 with invalid stack: eax=dfc02e66 edx=0 func=0x000f91f0
>> esp=dfc02e54
>> > ret=0x000f0604
>>
>> What happens if you apply the patch below?  (If it looks like it is
>> hanging, give it at least a minute before stopping it.)
>>
>> -Kevin
>>
>>
>> --- a/src/hw/blockcmd.c
>> +++ b/src/hw/blockcmd.c
>> @@ -168,7 +168,7 @@ scsi_is_ready(struct disk_op_s *op)
>>
>>          if (sense.asc == 0x04 && sense.ascq == 0x01 && !in_progress) {
>>              /* IN PROGRESS OF BECOMING READY */
>> -            printf("Waiting for device to detect medium... ");
>> +            //printf("Waiting for device to detect medium... ");
>>              /* Allow 30 seconds more */
>>              end = timer_calc(30000);
>>              in_progress = 1;
>>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.seabios.org/pipermail/seabios/attachments/20151223/ab8cf1f9/attachment.html>
-------------- next part --------------
diff --git a/src/block.c b/src/block.c
index 1762e2a..b4530fc 100644
--- a/src/block.c
+++ b/src/block.c
@@ -162,7 +162,7 @@ setup_translation(struct drive_s *drive)
     // clip to 1024 cylinders in lchs
     if (cylinders > 1024)
         cylinders = 1024;
-    dprintf(1, "drive %p: PCHS=%u/%d/%d translation=%s LCHS=%d/%d/%d s=%d\n"
+    dprintf(1, "drive %p: PCHS=%u/%d/%d translation=%s LCHS=%d/%d/%d s=%u\n"
             , drive
             , drive->pchs.cylinder, drive->pchs.head, drive->pchs.sector
             , desc
diff --git a/src/hw/blockcmd.c b/src/hw/blockcmd.c
index e20e3fc..6a2e179 100644
--- a/src/hw/blockcmd.c
+++ b/src/hw/blockcmd.c
@@ -168,7 +168,7 @@ scsi_is_ready(struct disk_op_s *op)
 
         if (sense.asc == 0x04 && sense.ascq == 0x01 && !in_progress) {
             /* IN PROGRESS OF BECOMING READY */
-            printf("Waiting for device to detect medium... ");
+            dprintf(1, "Waiting for device to detect medium...\n");
             /* Allow 30 seconds more */
             end = timer_calc(30000);
             in_progress = 1;
@@ -232,7 +232,7 @@ scsi_drive_setup(struct drive_s *drive, const char *s, int prio)
         return -1;
     }
     drive->sectors = (u64)be32_to_cpu(capdata.sectors) + 1;
-    dprintf(1, "%s blksize=%d sectors=%d\n"
+    dprintf(1, "%s blksize=%d sectors=%u\n"
             , s, drive->blksize, (unsigned)drive->sectors);
 
     // We do not recover from USB stalls, so try to be safe and avoid
-------------- next part --------------
SeaBIOS (version rel-1.9.0-43-g76327b9-dirty-20151223_210554-navi)
BUILD: gcc: (coreboot toolchain v1.33 November 25th, 2015) 5.2.0 binutils: (GNU Binutils) 2.25
SeaBIOS (version rel-1.9.0-43-g76327b9-dirty-20151223_210554-navi)
BUILD: gcc: (coreboot toolchain v1.33 November 25th, 2015) 5.2.0 binutils: (GNU Binutils) 2.25
Found coreboot cbmem console @ dffde000
Found mainboard PC Engines APU1
Relocating init from 0x000e6ac0 to 0xdfc0bfa0 (size 44992)
Found CBFS header at 0xffe00138
multiboot: eax=0, ebx=0
Found 27 PCI devices (max PCI bus is 05)
Copying SMBIOS entry point from 0xdfc5f000 to 0x000f1a60
Copying ACPI RSDP from 0xdfc70000 to 0x000f1a30
Copying MPTABLE from 0xdfc94000/dfc94010 to 0x000f1850
Copying PIR from 0xdfc95000 to 0x000f1820
Using pmtimer, ioport 0x808
Scan for VGA option rom
EHCI init on dev 00:12.2 (regs=0xf7f04020)
WARNING - Timeout at i8042_flush:71!
EHCI init on dev 00:13.2 (regs=0xf7f05020)
Found 1 lpt ports
Found 2 serial ports
ebda moved from 9f000 to 9e800
AHCI controller at 11.0, iobase f7f03000, irq 11
EHCI init on dev 00:16.2 (regs=0xf7f06020)
OHCI init on dev 00:12.0 (regs=0xf7f00000)
Searching bootorder for: /pci at i0cf8/*@11/drive at 0/disk at 0
OHCI init on dev 00:13.0 (regs=0xf7f01000)
AHCI/0: registering: "AHCI/0: SB mSATA SSD ATA-10 Hard-Disk (14318 MiBytes)"
OHCI init on dev 00:16.0 (regs=0xf7f02000)
Searching bootorder for: /pci at i0cf8/usb at 16,2/storage at 1/*@0/*@0,0
Searching bootorder for: /pci at i0cf8/usb at 16,2/usb-*@1
USB MSC vendor='Multiple' product='Card  Reader' rev='1.00' type=0 removable=1
Device reports MEDIUM NOT PRESENT
scsi_is_ready returned -1
Unable to configure USB MSC drive.
Unable to configure USB MSC device.
Searching bootorder for: /pci at i0cf8/usb at 12,2/storage at 5/*@0/*@0,0
Searching bootorder for: /pci at i0cf8/usb at 12,2/usb-*@5
USB MSC vendor='WD' product='Elements 10B8' rev='1012' type=0 removable=0
Waiting for device to detect medium...
Searching bootorder for: /pci at i0cf8/*@11/drive at 1/disk at 0
AHCI/1: registering: "AHCI/1: Corsair CSSD-F40GB2-A ATA-8 Hard-Disk (38164 MiBytes)"
USB MSC blksize=512 sectors=3906963456
All threads complete.
Scan for option roms
Searching bootorder for: /rom at genroms/sgabios.rom

Press ESC for boot menu.

Searching bootorder for: HALT
drive 0x000f17b0: PCHS=16383/16/63 translation=lba LCHS=1024/255/63 s=29323728
drive 0x000f1730: PCHS=16383/16/63 translation=lba LCHS=1024/255/63 s=78161328
drive 0x000f1780: PCHS=0/0/0 translation=lba LCHS=1024/255/63 s=3906963456
Running option rom at c000:0003

Google, Inc.
Serial Graphics Adapter 12/23/15
SGABIOS $Id: sgabios.S 8 2010-04-22 00:03:40Z nlaredo $ (ranma at navi) Wed Dec 23 14:21:28 UTC 2015
Term: 170x45
4 0
Space available for UMB: c1000-f0000, f0000-f1730
Returned 253952 bytes of ZoneHigh
e820 map has 7 items:
  0: 0000000000000000 - 000000000009e400 = 1 RAM
  1: 000000000009e400 - 00000000000a0000 = 2 RESERVED
  2: 00000000000f0000 - 0000000000100000 = 2 RESERVED
  3: 0000000000100000 - 00000000dfc55000 = 1 RAM
  4: 00000000dfc55000 - 00000000e0000000 = 2 RESERVED
  5: 00000000f8000000 - 00000000fc000000 = 2 RESERVED
  6: 0000000100000000 - 000000011f000000 = 1 RAM
enter handle_19:
  NULL
BBoooottiinngg  ffrroomm  HHaarrdd  DDiisskk......

Booting from 0000:7c00
MBR MBR 

LILO 23.2 boot: 
Linux               Linux.old           Linux.test          
boot: 
Loading Linux................................................................................................................................................
BIOS data check successful
[    0.000000] Initializing cgroup subsys cpuset
[    0.000000] Initializing cgroup subsys cpu
[    0.000000] Initializing cgroup subsys cpuacct
[    0.000000] Linux version 4.0.5 (ranma at nukunuku) (gcc version 4.9.2 (Debian 4.9.2-10) ) #15 SMP Sun Jun 7 18:17:21 CEST 2015
[...]


More information about the SeaBIOS mailing list