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@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@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@i0cf8/usb@12,2/storage@5/*@0/*@0,0
> |dfc02000| Searching bootorder for: /pci@i0cf8/usb@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;