qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [PATCH] scsi_command_complete() sends invalid values


From: Laurent Vivier
Subject: [Qemu-devel] [PATCH] scsi_command_complete() sends invalid values
Date: Fri, 26 Sep 2008 17:08:14 +0200

Hi,

it seems there are some inconsistencies between hw/lsi53c895a.c,
hw/scsi-disk.c and what linux driver is waiting (I found this by tracing
the linux driver).

The sense value sent by qemu/hw/scsi-disk.c in:

static void scsi_command_complete(SCSIRequest *r, int sense)
{
    SCSIDeviceState *s = r->dev;
    uint32_t tag;
    DPRINTF("Command complete tag=0x%x sense=%d\n", r->tag, sense);
    s->sense = sense;
    tag = r->tag;
    scsi_remove_request(r);
    s->completion(s->opaque, SCSI_REASON_DONE, tag, sense);
}

is decoded by linux/drivers/scsi/sym53c8xx_2/sym_hipd.c,
sym_sir_bad_scsi_status(), in s_status, and must be one of these values:

drivers/scsi/sym53c8xx_2/sym_defs.h

#define S_GOOD          SAM_STAT_GOOD
#define S_CHECK_COND    SAM_STAT_CHECK_CONDITION
#define S_COND_MET      SAM_STAT_CONDITION_MET
#define S_BUSY          SAM_STAT_BUSY
#define S_INT           SAM_STAT_INTERMEDIATE
#define S_INT_COND_MET  SAM_STAT_INTERMEDIATE_CONDITION_MET
#define S_CONFLICT      SAM_STAT_RESERVATION_CONFLICT
#define S_TERMINATED    SAM_STAT_COMMAND_TERMINATED
#define S_QUEUE_FULL    SAM_STAT_TASK_SET_FULL
#define S_ILLEGAL       (0xff)

The attached patch is a try to correct this.

It corrects also hw/scsi-generic.c, allowing to use commands like "mt
eod" or "mt fsf 4" on a SCSI stream device (tape).

Regards,
Laurent
-- 
----------------- address@hidden  ------------------
"Programmers who subconsciously view themselves as artists
 will enjoy what they do and will do it better." D. Knuth

Attachment: scsi-status.patch
Description: Text Data


reply via email to

[Prev in Thread] Current Thread [Next in Thread]