mirror of
https://github.com/fhgwright/SCSI2SD.git
synced 2025-01-14 06:30:00 +00:00
Add scsi mode page 0 support
This commit is contained in:
parent
076117156e
commit
baf133df4e
@ -157,6 +157,7 @@ void scsiInquiry()
|
||||
memcpy(&scsiDev.data[8], config->vendor, sizeof(config->vendor));
|
||||
memcpy(&scsiDev.data[16], config->prodId, sizeof(config->prodId));
|
||||
memcpy(&scsiDev.data[32], config->revision, sizeof(config->revision));
|
||||
|
||||
scsiDev.dataLen = sizeof(StandardResponse) +
|
||||
sizeof(config->vendor) +
|
||||
sizeof(config->prodId) +
|
||||
@ -229,20 +230,19 @@ void scsiInquiry()
|
||||
scsiDev.dataLen = allocationLength;
|
||||
|
||||
// Set the device type as needed.
|
||||
scsiDev.data[0] = getDeviceTypeQualifier();
|
||||
|
||||
switch (scsiDev.target->cfg->deviceType)
|
||||
{
|
||||
case CONFIG_OPTICAL:
|
||||
scsiDev.data[0] = 0x05; // device type
|
||||
scsiDev.data[1] |= 0x80; // Removable bit.
|
||||
break;
|
||||
|
||||
case CONFIG_SEQUENTIAL:
|
||||
scsiDev.data[0] = 0x01; // device type
|
||||
scsiDev.data[1] |= 0x80; // Removable bit.
|
||||
break;
|
||||
|
||||
case CONFIG_MO:
|
||||
scsiDev.data[0] = 0x07; // device type
|
||||
scsiDev.data[1] |= 0x80; // Removable bit.
|
||||
break;
|
||||
|
||||
@ -254,6 +254,7 @@ void scsiInquiry()
|
||||
// Accept defaults for a fixed disk.
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// Set the first byte to indicate LUN presence.
|
||||
@ -263,3 +264,31 @@ void scsiInquiry()
|
||||
}
|
||||
}
|
||||
|
||||
uint8_t getDeviceTypeQualifier()
|
||||
{
|
||||
// Set the device type as needed.
|
||||
switch (scsiDev.target->cfg->deviceType)
|
||||
{
|
||||
case CONFIG_OPTICAL:
|
||||
return 0x05;
|
||||
break;
|
||||
|
||||
case CONFIG_SEQUENTIAL:
|
||||
return 0x01;
|
||||
break;
|
||||
|
||||
case CONFIG_MO:
|
||||
return 0x07;
|
||||
break;
|
||||
|
||||
case CONFIG_FLOPPY_14MB:
|
||||
case CONFIG_REMOVEABLE:
|
||||
return 0;
|
||||
break;
|
||||
|
||||
default:
|
||||
// Accept defaults for a fixed disk.
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -19,4 +19,6 @@
|
||||
|
||||
void scsiInquiry(void);
|
||||
|
||||
uint8_t getDeviceTypeQualifier(void);
|
||||
|
||||
#endif
|
||||
|
@ -19,9 +19,26 @@
|
||||
#include "scsi.h"
|
||||
#include "mode.h"
|
||||
#include "disk.h"
|
||||
#include "inquiry.h"
|
||||
|
||||
#include <string.h>
|
||||
|
||||
// "Vendor" defined page which was included by Seagate, and required for
|
||||
// Amiga 500 using DKB SpitFire controller.
|
||||
static const uint8 OperatingPage[] =
|
||||
{
|
||||
0x00, // Page code
|
||||
0x02, // Page length
|
||||
|
||||
// Bit 4 = unit attension (0 = on, 1 = off).
|
||||
// Bit 7 = usage bit, EEPROM life exceeded warning = 1.
|
||||
0x80,
|
||||
|
||||
// Bit 7 = reserved.
|
||||
// Bits 0:6: Device type qualifier, as per Inquiry data
|
||||
0x00
|
||||
};
|
||||
|
||||
static const uint8 ReadWriteErrorRecoveryPage[] =
|
||||
{
|
||||
0x01, // Page code
|
||||
@ -518,6 +535,21 @@ static void doModeSense(
|
||||
idx += sizeof(AppleVendorPage);
|
||||
}
|
||||
|
||||
// SCSI 2 standard says page 0 is always last.
|
||||
if (pageCode == 0x00 || pageCode == 0x3F)
|
||||
{
|
||||
pageFound = 1;
|
||||
pageIn(pc, idx, OperatingPage, sizeof(OperatingPage));
|
||||
|
||||
// Note inverted logic for the flag.
|
||||
scsiDev.data[idx+2] =
|
||||
(scsiDev.boardCfg.flags & CONFIG_ENABLE_UNIT_ATTENTION) ? 0x80 : 0x90;
|
||||
|
||||
scsiDev.data[idx+3] = getDeviceTypeQualifier();
|
||||
|
||||
idx += sizeof(OperatingPage);
|
||||
}
|
||||
|
||||
if (!pageFound)
|
||||
{
|
||||
// Unknown Page Code
|
||||
|
Loading…
x
Reference in New Issue
Block a user