machine/atahle.cpp, machine/atastorage.cpp: Updates [R. Belmont]

* Support READ_BUFFER and WRITE_BUFFER commands, used by early ATA Macs to verify drive communications
* Don't report an error on SET_FEATURES for ENABLE_ECC, ENABLE_RETRIES, and ENABLE_READ_LOOK_AHEAD
* Support the secondary "hdd" interface so software lists can work with multiple drive types

bus/nscsi/hd.cpp: Support the secondary "hdd" interface so software lists can work with multiple drive types [R. Belmont]
This commit is contained in:
arbee 2023-08-13 18:44:35 -04:00
parent 61b37c5e53
commit f4a3f783d8
4 changed files with 71 additions and 5 deletions

View File

@ -50,7 +50,7 @@ void nscsi_harddisk_device::device_reset()
void nscsi_harddisk_device::device_add_mconfig(machine_config &config)
{
HARDDISK(config, image).set_interface("scsi_hdd");
HARDDISK(config, image).set_interface("scsi_hdd,hdd");
}
uint8_t nscsi_harddisk_device::scsi_get_data(int id, int pos)

View File

@ -312,6 +312,12 @@ bool ata_hle_device_base::set_features()
case IDE_SET_FEATURES_ENABLE_REVERTING_TO_POWER_ON_DEFAULTS:
m_revert_to_defaults = true;
return true;
// not actually handled, but reply as if we did
case IDE_SET_FEATURES_ENABLE_ECC:
case IDE_SET_FEATURES_ENABLE_RETRIES:
case IDE_SET_FEATURES_ENABLE_READ_LOOK_AHEAD:
return true;
}
return false;

View File

@ -152,8 +152,10 @@ protected:
IDE_COMMAND_IDLE_IMMEDIATE = 0xe1,
IDE_COMMAND_STANDBY = 0xe2,
IDE_COMMAND_IDLE = 0xe3,
IDE_COMMAND_READ_BUFFER = 0xe4,
IDE_COMMAND_CHECK_POWER_MODE = 0xe5,
IDE_COMMAND_CACHE_FLUSH = 0xe7,
IDE_COMMAND_WRITE_BUFFER = 0xe8,
IDE_COMMAND_IDENTIFY_DEVICE = 0xec,
IDE_COMMAND_SET_FEATURES = 0xef,
IDE_COMMAND_SECURITY_UNLOCK = 0xf2,
@ -168,6 +170,9 @@ protected:
IDE_SET_FEATURES_TRANSFER_MODE = 0x03,
IDE_SET_FEATURES_DISABLE_REVERTING_TO_POWER_ON_DEFAULTS = 0x66,
IDE_SET_FEATURES_DISABLE_8BIT_DATA_TRANSFERS = 0x81,
IDE_SET_FEATURES_ENABLE_ECC = 0x88,
IDE_SET_FEATURES_ENABLE_RETRIES = 0x99,
IDE_SET_FEATURES_ENABLE_READ_LOOK_AHEAD = 0xaa,
IDE_SET_FEATURES_ENABLE_REVERTING_TO_POWER_ON_DEFAULTS = 0xcc
};

View File

@ -275,6 +275,7 @@ void ata_mass_storage_device_base::finished_command()
case IDE_COMMAND_VERIFY_SECTORS:
case IDE_COMMAND_VERIFY_SECTORS_NORETRY:
case IDE_COMMAND_READ_DMA:
case IDE_COMMAND_READ_BUFFER:
finished_read();
break;
@ -282,6 +283,7 @@ void ata_mass_storage_device_base::finished_command()
case IDE_COMMAND_WRITE_SECTORS_NORETRY:
case IDE_COMMAND_WRITE_MULTIPLE:
case IDE_COMMAND_WRITE_DMA:
case IDE_COMMAND_WRITE_BUFFER:
finished_write();
break;
@ -393,7 +395,9 @@ attotime ata_mass_storage_device_base::seek_time()
m_cur_lba = new_lba;
if (diff == 0)
{
return TIME_BETWEEN_SECTORS;
}
attotime seek_time = (TIME_FULL_STROKE_SEEK * diff) / m_num_cylinders;
@ -419,6 +423,10 @@ void ata_mass_storage_device_base::fill_buffer()
}
break;
case IDE_COMMAND_READ_BUFFER:
set_irq(ASSERT_LINE);
break;
default:
/* if there is more data to read, keep going */
if (m_sector_count > 0)
@ -444,7 +452,14 @@ void ata_mass_storage_device_base::finished_read()
set_dasp(CLEAR_LINE);
/* now do the read */
read_status = read_sector(lba, &m_buffer[0]);
if (m_command == IDE_COMMAND_READ_BUFFER)
{
read_status = 1;
}
else
{
read_status = read_sector(lba, &m_buffer[0]);
}
/* if we succeeded, advance to the next sector and set the nice bits */
if (read_status)
@ -499,7 +514,15 @@ void ata_mass_storage_device_base::read_first_sector()
{
set_dasp(ASSERT_LINE);
start_busy(seek_time(), PARAM_COMMAND);
if (m_command == IDE_COMMAND_READ_BUFFER)
{
// don't call seek_time() here (that will trash m_cur_lba), just give a nominal delay
start_busy(TIME_BETWEEN_SECTORS, PARAM_COMMAND);
}
else
{
start_busy(seek_time(), PARAM_COMMAND);
}
}
}
@ -545,6 +568,10 @@ void ata_mass_storage_device_base::process_buffer()
{
LOGPRINT(("IDE Done unimplemented SECURITY_DISABLE_PASSWORD command\n"));
}
else if (m_command == IDE_COMMAND_WRITE_BUFFER)
{
set_irq(ASSERT_LINE);
}
else
{
set_dasp(ASSERT_LINE);
@ -578,7 +605,14 @@ void ata_mass_storage_device_base::finished_write()
set_dasp(CLEAR_LINE);
/* now do the write */
count = write_sector(lba, &m_buffer[0]);
if (m_command == IDE_COMMAND_WRITE_BUFFER)
{
count = 1;
}
else
{
count = write_sector(lba, &m_buffer[0]);
}
/* if we succeeded, advance to the next sector and set the nice bits */
if (count == 1)
@ -645,6 +679,16 @@ void ata_mass_storage_device_base::process_command()
read_first_sector();
break;
case IDE_COMMAND_READ_BUFFER:
LOGPRINT(("IDE Read Buffer\n"));
m_sectors_until_int = 1;
m_buffer_offset = 0;
/* start the read going */
read_first_sector();
break;
case IDE_COMMAND_READ_MULTIPLE:
LOGPRINT(("IDE Read multiple block: C=%u H=%u S=%u LBA=%u count=%u\n",
(m_cylinder_high << 8) | m_cylinder_low, m_device_head & IDE_DEVICE_HEAD_HS, m_sector_number, lba_address(), m_sector_count));
@ -690,6 +734,17 @@ void ata_mass_storage_device_base::process_command()
m_status |= IDE_STATUS_DRQ;
break;
case IDE_COMMAND_WRITE_BUFFER:
LOGPRINT(("IDE Write Buffer\n"));
/* reset the buffer */
m_sectors_until_int = 1;
m_buffer_offset = 0;
/* mark the buffer ready */
m_status |= IDE_STATUS_DRQ;
break;
case IDE_COMMAND_WRITE_MULTIPLE:
LOGPRINT(("IDE Write multiple block: C=%u H=%u S=%u LBA=%u count=%u\n",
(m_cylinder_high << 8) | m_cylinder_low, m_device_head & IDE_DEVICE_HEAD_HS, m_sector_number, lba_address(), m_sector_count));
@ -865,7 +920,7 @@ uint8_t ide_hdd_device_base::calculate_status()
void ide_hdd_device_base::device_add_mconfig(machine_config &config)
{
HARDDISK(config, "image", "ide_hdd");
HARDDISK(config, "image", "ide_hdd,hdd");
}
//**************************************************************************