Skip to content

Commit

Permalink
Specify default SCSI inquiry size (36 bytes) on IOCS_S_INQUIRY() comm…
Browse files Browse the repository at this point in the history
…and.

X680x0 SCSI IOCS stalls if SCSI device doesn't return inquiry data
of specified allocation length size on the INQUIRY command,
and it causes hangup on the XM6 based emulators that return only
upto 36 byte inquiry data on SCSI disk emulation.

Many real SCSI-2 hard drives seem to support >100 byte inquiry data,
but at least there is a harddisk that returns only supported inquiry
data size and quits transfer.

The bootloader checks only the device type and there is no reason
to read 100 bytes that includes vender specific data.

Analyzed and reported by GIMONS, a developer of XM6 TypeG emulator,
which also can run NetBSD/x68k.
  • Loading branch information
tsutsui committed Feb 11, 2014
1 parent 737221e commit a81affd
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
7 changes: 5 additions & 2 deletions sys/arch/x68k/stand/libiocs/iocs.h
Expand Up @@ -6,7 +6,7 @@
* (based on PD libc 1.1.32 by PROJECT C Library)
* public domain
*
* $NetBSD: iocs.h,v 1.8 2011/02/21 02:31:59 itohy Exp $
* $NetBSD: iocs.h,v 1.9 2014/02/11 08:06:07 tsutsui Exp $
*/
/*
* PROJECT C Library, X68000 PROGRAMMING INTERFACE DEFINITION
Expand Down Expand Up @@ -224,7 +224,10 @@ struct iocs_inquiry {
unsigned char ver;
unsigned char reserve;
unsigned char size;
unsigned char buff[0]; /* actually longer */
unsigned char class[3];
char vendor[8];
char product[16];
char revision[4];
};

/*
Expand Down
6 changes: 3 additions & 3 deletions sys/arch/x68k/stand/libsa/sdcd.c
@@ -1,4 +1,4 @@
/* $NetBSD: sdcd.c,v 1.14 2012/11/22 20:15:49 tsutsui Exp $ */
/* $NetBSD: sdcd.c,v 1.15 2014/02/11 08:06:07 tsutsui Exp $ */

/*
* Copyright (c) 2001 MINOURA Makoto.
Expand Down Expand Up @@ -67,9 +67,9 @@ check_unit(int id)
}

{
struct iocs_inquiry *inqdata= buffer;
struct iocs_inquiry *inqdata = buffer;

error = IOCS_S_INQUIRY(100, id, inqdata);
error = IOCS_S_INQUIRY(sizeof(*inqdata), id, inqdata);
if (error < 0) { /* WHY??? */
error = ENXIO;
goto out;
Expand Down

0 comments on commit a81affd

Please sign in to comment.