summaryrefslogtreecommitdiff
path: root/hw/scsi-generic.c
AgeCommit message (Collapse)AuthorFilesLines
2008-10-17scsi-generic: correct error managementaurel321-29/+103
this patch allows to fully use a tape device connected to qemu through the scsi-generic interface. Previous patch introduced tape SCSI commands management, this one improve error case management: - the SCSI controller command completion must be called with the status value, not the sense value. In the case of scsi-generic, the SCSI status is given by the field status of sg_io_hdr_t (the value is left shifted by one regarding status codes defined in /usr/include/scsi/scsi.h) - when a read is aborted due to a mark/EOF/EOD/EOM, the len reported to controller can be 0. LSI controller emulation doesn't know how to manage this. A workaround found is to call the completion routine with SCSI_REASON_DONE just after calling it with SCSI_REASON_DATA with len=0. This patch also manages correctly the block size of the tape device. This patch has been tested with a real tape device "HP C5683A", linux guest (debian etch) and tools like "mt", "tar" and "btape". Windows guest is not better supported than before... Signed-off-by: Laurent Vivier <Laurent.Vivier@bull.net> Signed-off-by: Aurelien Jarno <aurelien@aurel32.net> git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5497 c046a42c-6fe2-441c-8c8c-71466251a162
2008-09-23scsi-generic: decode correctly SCSI tape commands (Laurent Vivier)aliguori1-9/+54
This patch allows to use a "real" SCSI tape with qemu using "-drive /dev/sgX,if=scsi". It allows to decode correctly transfer length when the type of the device is a tape. Some issues remain when the application reading the tape tries to go beyond the end of the stream (but they must be corrected at the SCSI controller level). Signed-off-by: Laurent Vivier <Laurent.Vivier@bull.net> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com> git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5305 c046a42c-6fe2-441c-8c8c-71466251a162
2008-09-22scsi-generic: correct 6-bytes commands transfer length (Laurent Vivier)aliguori1-0/+3
According to SCSI documentation, for 6 bytes commands (READ(6), WRITE(6)), if transfer length is 0 it specifies 256 blocks. Signed-off-by: Laurent Vivier <Laurent.Vivier@bull.net> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com> git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5292 c046a42c-6fe2-441c-8c8c-71466251a162
2008-09-22scsi-generic: correct usage of memset() (Laurent Vivier)aliguori1-2/+2
void *memset(void *s, int c, size_t n); DESCRIPTION The memset() function fills the first n bytes of the memory area pointed to by s with the constant byte c." Reported by Dietmar Maurer. Signed-off-by: Laurent Vivier <Laurent.Vivier@bull.net> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com> git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5291 c046a42c-6fe2-441c-8c8c-71466251a162
2008-09-02suppress a couple of spurious warnings in scsi-generic.caurel321-2/+2
This patch fixes two spurious `may be used uninitialised' warnings when compiling with some compilers. Signed-off-by: Andre Przywara <andre.przywara@amd.com> Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com> Signed-off-by: Aurelien Jarno <aurelien@aurel32.net> git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5127 c046a42c-6fe2-441c-8c8c-71466251a162
2007-12-24scsi-generic implemnentation, missing in last commit.ths1-0/+653
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@3852 c046a42c-6fe2-441c-8c8c-71466251a162