mirror of
https://github.com/holub/mame
synced 2025-10-06 09:00:04 +03:00
Add ability to throttle HDD DMA transfer speed. Fixes MT07242
This commit is contained in:
parent
f4a57bf2cc
commit
d890319806
@ -588,7 +588,7 @@ uint16_t ata_hle_device::read_cs0(offs_t offset, uint16_t mem_mask)
|
|||||||
{
|
{
|
||||||
/* logit */
|
/* logit */
|
||||||
// if (offset != IDE_CS0_DATA_RW && offset != IDE_CS0_STATUS_R)
|
// if (offset != IDE_CS0_DATA_RW && offset != IDE_CS0_STATUS_R)
|
||||||
LOG(("%s:IDE cs0 read at %X, mem_mask=%d\n", machine().describe_context(), offset, mem_mask));
|
LOG(("%s:IDE cs0 read at %X, mem_mask=%X\n", machine().describe_context(), offset, mem_mask));
|
||||||
|
|
||||||
uint16_t result = 0xffff;
|
uint16_t result = 0xffff;
|
||||||
|
|
||||||
@ -692,7 +692,7 @@ uint16_t ata_hle_device::read_cs0(offs_t offset, uint16_t mem_mask)
|
|||||||
|
|
||||||
/* log anything else */
|
/* log anything else */
|
||||||
default:
|
default:
|
||||||
logerror("%s:unknown IDE cs0 read at %03X, mem_mask=%d\n", machine().describe_context(), offset, mem_mask);
|
logerror("%s:unknown IDE cs0 read at %03X, mem_mask=%X\n", machine().describe_context(), offset, mem_mask);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -284,20 +284,25 @@ void bus_master_ide_controller_device::set_dmarq(int state)
|
|||||||
|
|
||||||
READ32_MEMBER( bus_master_ide_controller_device::bmdma_r )
|
READ32_MEMBER( bus_master_ide_controller_device::bmdma_r )
|
||||||
{
|
{
|
||||||
LOG("%s:ide_bus_master32_r(%d, %08x)\n", machine().describe_context(), offset, mem_mask);
|
uint32_t result = 0;
|
||||||
|
|
||||||
switch( offset )
|
switch( offset )
|
||||||
{
|
{
|
||||||
case 0:
|
case 0:
|
||||||
/* command register/status register */
|
/* command register/status register */
|
||||||
return m_bus_master_command | (m_bus_master_status << 16);
|
result = m_bus_master_command | (m_bus_master_status << 16);
|
||||||
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
/* descriptor table register */
|
/* descriptor table register */
|
||||||
return m_bus_master_descriptor;
|
result = m_bus_master_descriptor;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
result = 0xffffffff;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0xffffffff;
|
LOG("%s:ide_bus_master32_r(%d, %08x, %08x)\n", machine().describe_context(), offset, mem_mask, result);
|
||||||
|
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -396,8 +401,7 @@ void bus_master_ide_controller_device::execute_dma()
|
|||||||
m_dma_bytes_left &= 0xfffe;
|
m_dma_bytes_left &= 0xfffe;
|
||||||
if (m_dma_bytes_left == 0)
|
if (m_dma_bytes_left == 0)
|
||||||
m_dma_bytes_left = 0x10000;
|
m_dma_bytes_left = 0x10000;
|
||||||
|
LOG("New DMA descriptor: address = %08X bytes = %04X last = %d time: %s\n", m_dma_address, m_dma_bytes_left, m_dma_last_buffer, machine().time().as_string());
|
||||||
// LOG("New DMA descriptor: address = %08X bytes = %04X last = %d\n", m_dma_address, m_dma_bytes_left, m_dma_last_buffer);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_bus_master_command & 8)
|
if (m_bus_master_command & 8)
|
||||||
@ -424,7 +428,7 @@ void bus_master_ide_controller_device::execute_dma()
|
|||||||
if (m_dma_bytes_left == 0 && m_dma_last_buffer)
|
if (m_dma_bytes_left == 0 && m_dma_last_buffer)
|
||||||
{
|
{
|
||||||
m_bus_master_status &= ~IDE_BUSMASTER_STATUS_ACTIVE;
|
m_bus_master_status &= ~IDE_BUSMASTER_STATUS_ACTIVE;
|
||||||
|
LOG("DMA Complete time: %s\n", machine().time().as_string());
|
||||||
if (m_dmarq)
|
if (m_dmarq)
|
||||||
{
|
{
|
||||||
LOG("DMA Out of buffer space!\n");
|
LOG("DMA Out of buffer space!\n");
|
||||||
|
@ -27,7 +27,8 @@ ata_mass_storage_device::ata_mass_storage_device(const machine_config &mconfig,
|
|||||||
m_num_sectors(0),
|
m_num_sectors(0),
|
||||||
m_num_heads(0), m_cur_lba(0), m_block_count(0), m_sectors_until_int(0), m_master_password_enable(0), m_user_password_enable(0),
|
m_num_heads(0), m_cur_lba(0), m_block_count(0), m_sectors_until_int(0), m_master_password_enable(0), m_user_password_enable(0),
|
||||||
m_master_password(nullptr),
|
m_master_password(nullptr),
|
||||||
m_user_password(nullptr)
|
m_user_password(nullptr),
|
||||||
|
m_dma_transfer_time(attotime::zero)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -426,6 +427,9 @@ void ata_mass_storage_device::fill_buffer()
|
|||||||
if (m_sector_count > 0)
|
if (m_sector_count > 0)
|
||||||
{
|
{
|
||||||
set_dasp(ASSERT_LINE);
|
set_dasp(ASSERT_LINE);
|
||||||
|
if (m_command == IDE_COMMAND_READ_DMA)
|
||||||
|
start_busy(TIME_BETWEEN_SECTORS + m_dma_transfer_time, PARAM_COMMAND);
|
||||||
|
else
|
||||||
start_busy(TIME_BETWEEN_SECTORS, PARAM_COMMAND);
|
start_busy(TIME_BETWEEN_SECTORS, PARAM_COMMAND);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -632,7 +636,7 @@ void ata_mass_storage_device::process_command()
|
|||||||
{
|
{
|
||||||
case IDE_COMMAND_READ_SECTORS:
|
case IDE_COMMAND_READ_SECTORS:
|
||||||
case IDE_COMMAND_READ_SECTORS_NORETRY:
|
case IDE_COMMAND_READ_SECTORS_NORETRY:
|
||||||
LOGPRINT(("IDE Read multiple: C=%d H=%d S=%d LBA=%d count=%d\n",
|
LOGPRINT(("IDE Read multiple: C=%u H=%d 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));
|
(m_cylinder_high << 8) | m_cylinder_low, m_device_head & IDE_DEVICE_HEAD_HS, m_sector_number, lba_address(), m_sector_count));
|
||||||
|
|
||||||
m_sectors_until_int = 1;
|
m_sectors_until_int = 1;
|
||||||
@ -642,7 +646,7 @@ void ata_mass_storage_device::process_command()
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case IDE_COMMAND_READ_MULTIPLE:
|
case IDE_COMMAND_READ_MULTIPLE:
|
||||||
LOGPRINT(("IDE Read multiple block: C=%d H=%d S=%d LBA=%d count=%d\n",
|
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));
|
(m_cylinder_high << 8) | m_cylinder_low, m_device_head & IDE_DEVICE_HEAD_HS, m_sector_number, lba_address(), m_sector_count));
|
||||||
|
|
||||||
m_sectors_until_int = 1;
|
m_sectors_until_int = 1;
|
||||||
@ -653,7 +657,7 @@ void ata_mass_storage_device::process_command()
|
|||||||
|
|
||||||
case IDE_COMMAND_VERIFY_SECTORS:
|
case IDE_COMMAND_VERIFY_SECTORS:
|
||||||
case IDE_COMMAND_VERIFY_SECTORS_NORETRY:
|
case IDE_COMMAND_VERIFY_SECTORS_NORETRY:
|
||||||
LOGPRINT(("IDE Read verify multiple with/without retries: C=%d H=%d S=%d LBA=%d count=%d\n",
|
LOGPRINT(("IDE Read verify multiple with/without retries: 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));
|
(m_cylinder_high << 8) | m_cylinder_low, m_device_head & IDE_DEVICE_HEAD_HS, m_sector_number, lba_address(), m_sector_count));
|
||||||
|
|
||||||
/* reset the buffer */
|
/* reset the buffer */
|
||||||
@ -664,7 +668,7 @@ void ata_mass_storage_device::process_command()
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case IDE_COMMAND_READ_DMA:
|
case IDE_COMMAND_READ_DMA:
|
||||||
LOGPRINT(("IDE Read multiple DMA: C=%d H=%d S=%d LBA=%d count=%d\n",
|
LOGPRINT(("IDE Read multiple DMA: 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));
|
(m_cylinder_high << 8) | m_cylinder_low, m_device_head & IDE_DEVICE_HEAD_HS, m_sector_number, lba_address(), m_sector_count));
|
||||||
|
|
||||||
/* reset the buffer */
|
/* reset the buffer */
|
||||||
@ -676,7 +680,7 @@ void ata_mass_storage_device::process_command()
|
|||||||
|
|
||||||
case IDE_COMMAND_WRITE_SECTORS:
|
case IDE_COMMAND_WRITE_SECTORS:
|
||||||
case IDE_COMMAND_WRITE_SECTORS_NORETRY:
|
case IDE_COMMAND_WRITE_SECTORS_NORETRY:
|
||||||
LOGPRINT(("IDE Write multiple: C=%d H=%d S=%d LBA=%d count=%d\n",
|
LOGPRINT(("IDE Write multiple: 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));
|
(m_cylinder_high << 8) | m_cylinder_low, m_device_head & IDE_DEVICE_HEAD_HS, m_sector_number, lba_address(), m_sector_count));
|
||||||
|
|
||||||
/* reset the buffer */
|
/* reset the buffer */
|
||||||
@ -687,7 +691,7 @@ void ata_mass_storage_device::process_command()
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case IDE_COMMAND_WRITE_MULTIPLE:
|
case IDE_COMMAND_WRITE_MULTIPLE:
|
||||||
LOGPRINT(("IDE Write multiple block: C=%d H=%d S=%d LBA=%d count=%d\n",
|
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));
|
(m_cylinder_high << 8) | m_cylinder_low, m_device_head & IDE_DEVICE_HEAD_HS, m_sector_number, lba_address(), m_sector_count));
|
||||||
|
|
||||||
/* reset the buffer */
|
/* reset the buffer */
|
||||||
@ -698,7 +702,7 @@ void ata_mass_storage_device::process_command()
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case IDE_COMMAND_WRITE_DMA:
|
case IDE_COMMAND_WRITE_DMA:
|
||||||
LOGPRINT(("IDE Write multiple DMA: C=%d H=%d S=%d LBA=%d count=%d\n",
|
LOGPRINT(("IDE Write multiple DMA: 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));
|
(m_cylinder_high << 8) | m_cylinder_low, m_device_head & IDE_DEVICE_HEAD_HS, m_sector_number, lba_address(), m_sector_count));
|
||||||
|
|
||||||
/* reset the buffer */
|
/* reset the buffer */
|
||||||
@ -745,7 +749,7 @@ void ata_mass_storage_device::process_command()
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case IDE_COMMAND_SET_CONFIG:
|
case IDE_COMMAND_SET_CONFIG:
|
||||||
LOGPRINT(("IDE Set configuration (%d heads, %d sectors)\n", (m_device_head & IDE_DEVICE_HEAD_HS) + 1, m_sector_count));
|
LOGPRINT(("IDE Set configuration (%u heads, %u sectors)\n", (m_device_head & IDE_DEVICE_HEAD_HS) + 1, m_sector_count));
|
||||||
|
|
||||||
start_busy(MINIMUM_COMMAND_TIME, PARAM_COMMAND);
|
start_busy(MINIMUM_COMMAND_TIME, PARAM_COMMAND);
|
||||||
break;
|
break;
|
||||||
@ -758,7 +762,7 @@ void ata_mass_storage_device::process_command()
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case IDE_COMMAND_SET_BLOCK_COUNT:
|
case IDE_COMMAND_SET_BLOCK_COUNT:
|
||||||
LOGPRINT(("IDE Set block count (%d)\n", m_sector_count));
|
LOGPRINT(("IDE Set block count (%u)\n", m_sector_count));
|
||||||
|
|
||||||
m_block_count = m_sector_count;
|
m_block_count = m_sector_count;
|
||||||
|
|
||||||
@ -828,8 +832,8 @@ void ide_hdd_device::device_reset()
|
|||||||
m_num_cylinders = hdinfo->cylinders;
|
m_num_cylinders = hdinfo->cylinders;
|
||||||
m_num_sectors = hdinfo->sectors;
|
m_num_sectors = hdinfo->sectors;
|
||||||
m_num_heads = hdinfo->heads;
|
m_num_heads = hdinfo->heads;
|
||||||
if (PRINTF_IDE_COMMANDS) osd_printf_debug("CHS: %d %d %d\n", m_num_cylinders, m_num_heads, m_num_sectors);
|
if (PRINTF_IDE_COMMANDS) osd_printf_debug("CHS: %u %u %u\n", m_num_cylinders, m_num_heads, m_num_sectors);
|
||||||
osd_printf_debug("CHS: %d %d %d\n", m_num_cylinders, m_num_heads, m_num_sectors);
|
osd_printf_debug("CHS: %u %u %u\n", m_num_cylinders, m_num_heads, m_num_sectors);
|
||||||
}
|
}
|
||||||
|
|
||||||
// build the features page
|
// build the features page
|
||||||
|
@ -34,6 +34,7 @@ public:
|
|||||||
m_user_password_enable = (password != nullptr);
|
m_user_password_enable = (password != nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void set_dma_transfer_time(const attotime time) { m_dma_transfer_time = time; };
|
||||||
protected:
|
protected:
|
||||||
ata_mass_storage_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock);
|
ata_mass_storage_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock);
|
||||||
|
|
||||||
@ -79,6 +80,8 @@ private:
|
|||||||
uint8_t m_user_password_enable;
|
uint8_t m_user_password_enable;
|
||||||
const uint8_t * m_master_password;
|
const uint8_t * m_master_password;
|
||||||
const uint8_t * m_user_password;
|
const uint8_t * m_user_password;
|
||||||
|
// DMA data transfer time for 1 sector
|
||||||
|
attotime m_dma_transfer_time;
|
||||||
};
|
};
|
||||||
|
|
||||||
// ======================> ide_hdd_device
|
// ======================> ide_hdd_device
|
||||||
|
@ -281,6 +281,7 @@
|
|||||||
#include "cpu/adsp2100/adsp2100.h"
|
#include "cpu/adsp2100/adsp2100.h"
|
||||||
#include "cpu/mips/mips3.h"
|
#include "cpu/mips/mips3.h"
|
||||||
#include "machine/idectrl.h"
|
#include "machine/idectrl.h"
|
||||||
|
#include "machine/idehd.h"
|
||||||
#include "machine/midwayic.h"
|
#include "machine/midwayic.h"
|
||||||
#include "machine/smc91c9x.h"
|
#include "machine/smc91c9x.h"
|
||||||
#include "machine/timekpr.h"
|
#include "machine/timekpr.h"
|
||||||
@ -527,6 +528,13 @@ void vegas_state::machine_reset()
|
|||||||
m_wheel_force = 0;
|
m_wheel_force = 0;
|
||||||
m_wheel_offset = 0;
|
m_wheel_offset = 0;
|
||||||
m_wheel_calibrated = false;
|
m_wheel_calibrated = false;
|
||||||
|
|
||||||
|
// Set the disk dma transfer speed
|
||||||
|
auto *hdd = subdevice<ide_hdd_device>(PCI_ID_IDE":ide:0:hdd");
|
||||||
|
hdd->set_dma_transfer_time(attotime::from_usec(15));
|
||||||
|
// Allow ultra dma
|
||||||
|
//uint16_t *identify_device = hdd->identify_device_buffer();
|
||||||
|
//identify_device[88] = 0x7f;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*************************************
|
/*************************************
|
||||||
|
Loading…
Reference in New Issue
Block a user