mirror of
https://github.com/fhgwright/SCSI2SD.git
synced 2024-12-29 11:31:00 +00:00
Use the LUN provided in IDENTIFY messages in preference to the CDB.
This fixes extra LUNS being seen by VMS.
This commit is contained in:
parent
91fbbd80d6
commit
f45769aed5
@ -1,3 +1,6 @@
|
||||
201407XX 3.6
|
||||
- Fix handling requests for LUNs other than 0 from SCSI-2 hosts.
|
||||
|
||||
20140718 3.5.2
|
||||
- Fix blank SCSI ID in scsi2sd-config output.
|
||||
|
||||
|
@ -28,7 +28,7 @@
|
||||
|
||||
// CYDEV_EEPROM_ROW_SIZE == 16.
|
||||
static const char magic[CYDEV_EEPROM_ROW_SIZE] = "codesrc_00000002";
|
||||
static const uint16_t FIRMWARE_VERSION = 0x0352;
|
||||
static const uint16_t FIRMWARE_VERSION = 0x0360;
|
||||
|
||||
// Config shadow RAM (copy of EEPROM)
|
||||
static Config shadow =
|
||||
@ -36,7 +36,7 @@ static Config shadow =
|
||||
0, // SCSI ID
|
||||
" codesrc", // vendor (68k Apple Drive Setup: Set to " SEAGATE")
|
||||
" SCSI2SD", //prodId (68k Apple Drive Setup: Set to " ST225N")
|
||||
" 3.5", // revision (68k Apple Drive Setup: Set to "1.0 ")
|
||||
" 3.6", // revision (68k Apple Drive Setup: Set to "1.0 ")
|
||||
1, // enable parity
|
||||
1, // enable unit attention,
|
||||
0, // RESERVED
|
||||
|
@ -123,9 +123,8 @@ void scsiReceiveDiagnostic()
|
||||
}
|
||||
|
||||
{
|
||||
uint8 lun = scsiDev.cdb[1] >> 5;
|
||||
// Set the first byte to indicate LUN presence.
|
||||
if (lun) // We only support lun 0
|
||||
if (scsiDev.lun) // We only support lun 0
|
||||
{
|
||||
scsiDev.data[0] = 0x7F;
|
||||
}
|
||||
|
@ -95,7 +95,6 @@ void scsiInquiry()
|
||||
{
|
||||
uint8 evpd = scsiDev.cdb[1] & 1; // enable vital product data.
|
||||
uint8 pageCode = scsiDev.cdb[2];
|
||||
uint8 lun = scsiDev.cdb[1] >> 5;
|
||||
uint32 allocationLength = scsiDev.cdb[4];
|
||||
if (allocationLength == 0) allocationLength = 256;
|
||||
|
||||
@ -180,7 +179,7 @@ void scsiInquiry()
|
||||
}
|
||||
|
||||
// Set the first byte to indicate LUN presence.
|
||||
if (lun) // We only support lun 0
|
||||
if (scsiDev.lun) // We only support lun 0
|
||||
{
|
||||
scsiDev.data[0] = 0x7F;
|
||||
}
|
||||
|
@ -225,7 +225,6 @@ static void process_Command()
|
||||
{
|
||||
int group;
|
||||
uint8 command;
|
||||
uint8 lun;
|
||||
uint8 control;
|
||||
|
||||
scsiEnterPhase(COMMAND);
|
||||
@ -239,7 +238,13 @@ static void process_Command()
|
||||
scsiRead(scsiDev.cdb + 1, scsiDev.cdbLen - 1);
|
||||
|
||||
command = scsiDev.cdb[0];
|
||||
lun = scsiDev.cdb[1] >> 5;
|
||||
|
||||
// Prefer LUN's set by IDENTIFY messages for newer hosts.
|
||||
if (scsiDev.lun < 0)
|
||||
{
|
||||
scsiDev.lun = scsiDev.cdb[1] >> 5;
|
||||
}
|
||||
|
||||
control = scsiDev.cdb[scsiDev.cdbLen - 1];
|
||||
|
||||
scsiDev.cmdCount++;
|
||||
@ -313,7 +318,7 @@ static void process_Command()
|
||||
|
||||
enter_Status(CHECK_CONDITION);
|
||||
}
|
||||
else if (lun)
|
||||
else if (scsiDev.lun)
|
||||
{
|
||||
scsiDev.sense.code = ILLEGAL_REQUEST;
|
||||
scsiDev.sense.asc = LOGICAL_UNIT_NOT_SUPPORTED;
|
||||
@ -424,6 +429,7 @@ static void scsiReset()
|
||||
scsiDev.phase = BUS_FREE;
|
||||
scsiDev.atnFlag = 0;
|
||||
scsiDev.resetFlag = 0;
|
||||
scsiDev.lun = -1;
|
||||
|
||||
if (scsiDev.unitAttention != POWER_ON_RESET)
|
||||
{
|
||||
@ -458,6 +464,7 @@ static void enter_SelectionPhase()
|
||||
scsiDev.dataLen = 0;
|
||||
scsiDev.status = GOOD;
|
||||
scsiDev.phase = SELECTION;
|
||||
scsiDev.lun = -1;
|
||||
|
||||
transfer.blocks = 0;
|
||||
transfer.currentBlock = 0;
|
||||
@ -626,15 +633,12 @@ static void process_MessageOut()
|
||||
// IDENTIFY
|
||||
// We don't disconnect, so ignore disconnect privilege.
|
||||
if ((scsiDev.msgOut & 0x18) || // Reserved bits set.
|
||||
(scsiDev.msgOut & 0x20) || // We don't have any target routines!
|
||||
(scsiDev.msgOut & 0x7) // We only support LUN 0!
|
||||
)
|
||||
(scsiDev.msgOut & 0x20)) // We don't have any target routines!
|
||||
{
|
||||
//scsiDev.sense.code = ILLEGAL_REQUEST;
|
||||
//scsiDev.sense.asc = INVALID_BITS_IN_IDENTIFY_MESSAGE;
|
||||
//enter_Status(CHECK_CONDITION);
|
||||
messageReject();
|
||||
}
|
||||
|
||||
scsiDev.lun = scsiDev.msgOut & 0x7;
|
||||
//scsiDev.allowDisconnect = scsiDev.msgOut & 0x40;
|
||||
}
|
||||
else if (scsiDev.msgOut >= 0x20 && scsiDev.msgOut <= 0x2F)
|
||||
|
@ -84,6 +84,7 @@ typedef struct
|
||||
|
||||
uint8 cdb[12]; // command descriptor block
|
||||
uint8 cdbLen; // 6, 10, or 12 byte message.
|
||||
int8 lun; // Target lun, set by IDENTIFY message.
|
||||
|
||||
// Only let the reserved initiator talk to us.
|
||||
// A 3rd party may be sending the RESERVE/RELEASE commands
|
||||
|
Loading…
Reference in New Issue
Block a user