summaryrefslogtreecommitdiffstatshomepage
path: root/src/devices/machine/nscsi_hd.cpp
diff options
context:
space:
mode:
author Patrick Mackinlay <pmackinlay@hotmail.com>2018-07-06 20:31:29 +0700
committer ajrhacker <ajrhacker@users.noreply.github.com>2018-07-06 09:31:29 -0400
commit5d9e33b786d7ef452317439359f3cbd8cc920513 (patch)
tree0e40ae3cb7fc20d56dd6e854f318d83eeb7f6d08 /src/devices/machine/nscsi_hd.cpp
parentab0f99373d41efc7b74df1e66fcbe70d8c6f025c (diff)
nscsi: add support for CD-ROMs with 512-byte blocks (#3727)
* nscsi: add support for CD-ROMs with 512-byte blocks Older UNIX workstations used SCSI CD-ROM drives with 512-byte logical blocks instead of the now standard 2048. This change makes the block size configurable, and adds logic to translate logical blocks to/from the underlying 2048 byte sectors as needed. * add support for 512-byte logical blocks * logmacro.h logging (turned on by default to retain current behaviour) * added stub for "prevent/allow medium removal" command * removed some unnecessary state * minor fix for nscsi_hd "inquiry" command * minor changes (nw) * doh (nw) * this too (nw)
Diffstat (limited to 'src/devices/machine/nscsi_hd.cpp')
-rw-r--r--src/devices/machine/nscsi_hd.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/devices/machine/nscsi_hd.cpp b/src/devices/machine/nscsi_hd.cpp
index 7f480169715..da417cae25e 100644
--- a/src/devices/machine/nscsi_hd.cpp
+++ b/src/devices/machine/nscsi_hd.cpp
@@ -136,7 +136,11 @@ void nscsi_harddisk_device::scsi_command()
int size = scsi_cmdbuf[4];
switch(page) {
case 0:
- memset(scsi_cmdbuf, 0, 148);
+ std::fill_n(scsi_cmdbuf, 148, 0);
+
+ // vendor and product information must be padded with spaces
+ std::fill_n(&scsi_cmdbuf[8], 28, 0x20);
+
// From Seagate SCSI Commands Reference Manual (http://www.seagate.com/staticfiles/support/disc/manuals/scsi/100293068a.pdf), page 73:
// If the SCSI target device is not capable of supporting a peripheral device connected to this logical unit, the
// device server shall set these fields to 7Fh (i.e., PERIPHERAL QUALIFIER field set to 011b and PERIPHERAL DEVICE
@@ -148,6 +152,7 @@ void nscsi_harddisk_device::scsi_command()
scsi_cmdbuf[1] = 0x00; // media is not removable
scsi_cmdbuf[2] = 0x05; // device complies with SPC-3 standard
scsi_cmdbuf[3] = 0x01; // response data format = CCS
+ scsi_cmdbuf[4] = 52; // additional length
if(m_inquiry_data.empty()) {
LOG("IDNT tag not found in chd metadata, using default inquiry data\n");