qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] Fix sparc booting with no CD in drive
@ 2006-08-13 20:00 Blue Swirl
  2006-08-14 15:08 ` [Qemu-devel] " Paul Brook
  0 siblings, 1 reply; 4+ messages in thread
From: Blue Swirl @ 2006-08-13 20:00 UTC (permalink / raw)
  To: paul; +Cc: qemu-devel

[-- Attachment #1: Type: text/plain, Size: 377 bytes --]

If there is no CD in drive, sparc system emulator fails to boot. This 
happens because error handling is a bit broken in scsi-disk.c. The older 
OpenBIOS just didn't care.

_________________________________________________________________
Express yourself instantly with MSN Messenger! Download today it's FREE! 
http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/

[-- Attachment #2: scsi-fix.diff --]
[-- Type: text/plain, Size: 772 bytes --]

Fix booting without CD in drive.

Index: qemu/hw/scsi-disk.c
===================================================================
--- qemu.orig/hw/scsi-disk.c	2006-08-13 19:44:42.000000000 +0000
+++ qemu/hw/scsi-disk.c	2006-08-13 19:49:58.000000000 +0000
@@ -109,8 +109,10 @@
     uint32_t n;

     DPRINTF("Read %d (%d/%d)\n", len, s->buf_len, s->sector_count);
-    if (s->buf_len == 0 && s->sector_count == 0)
+    if (s->buf_len == 0 && s->sector_count == 0) {
+        scsi_command_complete(s, SENSE_NO_SENSE);
         return 1;
+    }

     if (s->buf_len) {
         n = s->buf_len;
@@ -447,6 +449,7 @@
             s->buf_len = 8;
         } else {
             scsi_command_complete(s, SENSE_NOT_READY);
+            return 0;
         }
	break;
     case 0x08:


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Qemu-devel] Re: [PATCH] Fix sparc booting with no CD in drive
  2006-08-13 20:00 [Qemu-devel] [PATCH] Fix sparc booting with no CD in drive Blue Swirl
@ 2006-08-14 15:08 ` Paul Brook
  2006-08-15 15:45   ` Blue Swirl
  0 siblings, 1 reply; 4+ messages in thread
From: Paul Brook @ 2006-08-14 15:08 UTC (permalink / raw)
  To: Blue Swirl; +Cc: qemu-devel

On Sunday 13 August 2006 21:00, Blue Swirl wrote:
> If there is no CD in drive, sparc system emulator fails to boot. This
> happens because error handling is a bit broken in scsi-disk.c. The older
> OpenBIOS just didn't care.

> Index: qemu/hw/scsi-disk.c
> ===================================================================
> --- qemu.orig/hw/scsi-disk.c	2006-08-13 19:44:42.000000000 +0000
> +++ qemu/hw/scsi-disk.c	2006-08-13 19:49:58.000000000 +0000
> @@ -109,8 +109,10 @@
>      uint32_t n;
>
>      DPRINTF("Read %d (%d/%d)\n", len, s->buf_len, s->sector_count);
> -    if (s->buf_len == 0 && s->sector_count == 0)
> +    if (s->buf_len == 0 && s->sector_count == 0) {
> +        scsi_command_complete(s, SENSE_NO_SENSE);
>          return 1;
> +    }
>

Why are we getting reads when no data is available? The command should already 
have completed.

> @@ -447,6 +449,7 @@
>              s->buf_len = 8;
>          } else {
>              scsi_command_complete(s, SENSE_NOT_READY);
> +            return 0;
>          }
> 	break;
>      case 0x08:

This bit looks ok.

Paul

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Qemu-devel] Re: [PATCH] Fix sparc booting with no CD in drive
  2006-08-14 15:08 ` [Qemu-devel] " Paul Brook
@ 2006-08-15 15:45   ` Blue Swirl
  2006-08-15 17:45     ` Paul Brook
  0 siblings, 1 reply; 4+ messages in thread
From: Blue Swirl @ 2006-08-15 15:45 UTC (permalink / raw)
  To: paul; +Cc: qemu-devel

>Why are we getting reads when no data is available? The command should 
>already
>have completed.

I don't know. Should all SCSI commands return something with the transfer 
mechanism? Or is it a bug in OpenBIOS, should it get the SCSI error status 
somehow without transferring data?

The background here is that OpenBIOS probes for SCSI devices, but when 
probing of capacity for nonexistent CDROM, the command fails.

_________________________________________________________________
FREE pop-up blocking with the new MSN Toolbar - get it now! 
http://toolbar.msn.click-url.com/go/onm00200415ave/direct/01/

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Qemu-devel] Re: [PATCH] Fix sparc booting with no CD in drive
  2006-08-15 15:45   ` Blue Swirl
@ 2006-08-15 17:45     ` Paul Brook
  0 siblings, 0 replies; 4+ messages in thread
From: Paul Brook @ 2006-08-15 17:45 UTC (permalink / raw)
  To: Blue Swirl; +Cc: qemu-devel

On Tuesday 15 August 2006 16:45, Blue Swirl wrote:
> >Why are we getting reads when no data is available? The command should
> >already
> >have completed.
>
> I don't know. Should all SCSI commands return something with the transfer
> mechanism? Or is it a bug in OpenBIOS, should it get the SCSI error status
> somehow without transferring data?

The scsi_read_data and scsi_write_data routines correspond directly to the 
SCSI DATA IN and DATA OUT phases.

It's up to the HBA (ie. esp) emulation to keep track of the SCSI phase based 
on the return value of scsi_send_command and whether the command completion 
routine has been called.
It's also up to the HBA to implement the SCSI STATUS phase based on the sense 
code passed to the completion routine. Calling completion routine with 
SCSI_REASON_DONE indicates that the command has finished (success is 
determined by the sense code) and the disk is ready for the next command.

Commands can fail at any time, including before any data has been transferred. 
On LSI HBA this causes an invalid phase exception to be raised when data 
transfer is attempted. I don't remember offhand how the ESP controller 
handles this. There are also some commands that complete successfully without 
transfering any data.

> The background here is that OpenBIOS probes for SCSI devices, but when
> probing of capacity for nonexistent CDROM, the command fails.

The read capacity command deliberately fails when there is no media present.

Paul

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2006-08-15 17:45 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-08-13 20:00 [Qemu-devel] [PATCH] Fix sparc booting with no CD in drive Blue Swirl
2006-08-14 15:08 ` [Qemu-devel] " Paul Brook
2006-08-15 15:45   ` Blue Swirl
2006-08-15 17:45     ` Paul Brook

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).