A dynamic recompiler block's validity is now separate from its starting code address, should fix most of the known recompiler fatals;
The CD-ROM buffer is now dynamically malloc'd; Did a lot of bugfixing in cdrom.c and scsi_disk.c, Debian 8's modprobe aha1542 and the NT 3.10.404.1 Trantor 310b driver now work; Fixed the IDE IRQ/MIRQ mess and ATAPI DMA transfer length; Fixed the operation of mmutranslate() a bit; Commented out several instances of excess logging; Applied the mainline PCem commit prefetch commit; Readded missing Sound Blaster DSP MIDI behavior and gave it the correct MPU struct; All non-IBM 486 machines now correctly have the VLB flag set.
This commit is contained in:
@@ -38,8 +38,9 @@
|
||||
|
||||
uint32_t SCSI_BufferLength;
|
||||
|
||||
int scsi_bus_do_log = 0;
|
||||
|
||||
#ifdef ENABLE_SCSI_BUS_LOG
|
||||
int scsi_bus_do_log = ENABLE_SCSI_BUS_LOG;
|
||||
#endif
|
||||
|
||||
void scsi_bus_log(const char *format, ...)
|
||||
{
|
||||
@@ -161,17 +162,15 @@ int scsi_bus_update(scsi_bus_t *bus, int bus_assert)
|
||||
|
||||
dev->BufferLength = -1;
|
||||
|
||||
pclog("(%02X:%02X): Command %02X: Buffer length %i\n", bus->dev_id, lun, bus->command[0], dev->BufferLength);
|
||||
|
||||
scsi_device_command_phase0(bus->dev_id, lun, get_cmd_len(bus->command[0]), bus->command);
|
||||
|
||||
pclog("SCSI Phase: %02X\n", SCSIPhase);
|
||||
scsi_bus_log("(%02X:%02X): Command %02X: Buffer Length %i, SCSI Phase %02X\n", bus->dev_id, lun, bus->command[0], dev->BufferLength, SCSIPhase);
|
||||
|
||||
if ((SCSIPhase == SCSI_PHASE_DATA_IN) || (SCSIPhase == SCSI_PHASE_DATA_OUT))
|
||||
{
|
||||
pclog("dev->CmdBuffer = %08X\n", dev->CmdBuffer);
|
||||
scsi_bus_log("dev->CmdBuffer = %08X\n", dev->CmdBuffer);
|
||||
dev->CmdBuffer = (uint8_t *) malloc(dev->BufferLength);
|
||||
pclog("dev->CmdBuffer = %08X\n", dev->CmdBuffer);
|
||||
scsi_bus_log("dev->CmdBuffer = %08X\n", dev->CmdBuffer);
|
||||
}
|
||||
|
||||
if (SCSIPhase == SCSI_PHASE_DATA_OUT)
|
||||
@@ -249,7 +248,7 @@ int scsi_bus_update(scsi_bus_t *bus, int bus_assert)
|
||||
|
||||
if (bus->data_pos >= SCSIDevices[bus->dev_id][lun].BufferLength)
|
||||
{
|
||||
/* pclog("%04X bytes written (%02X %02X)\n", bus->data_pos, bus->command[0], bus->command[1]); */
|
||||
/* scsi_bus_log("%04X bytes written (%02X %02X)\n", bus->data_pos, bus->command[0], bus->command[1]); */
|
||||
scsi_bus_log("Actually executing write command\n");
|
||||
scsi_device_command_phase1(bus->dev_id, lun);
|
||||
free(dev->CmdBuffer);
|
||||
@@ -271,7 +270,7 @@ int scsi_bus_update(scsi_bus_t *bus, int bus_assert)
|
||||
|
||||
if ((bus_assert & BUS_ACK) && !(bus->bus_in & BUS_ACK))
|
||||
{
|
||||
/* pclog("Preparing for message in\n"); */
|
||||
/* scsi_bus_log("Preparing for message in\n"); */
|
||||
bus->bus_out &= ~BUS_REQ;
|
||||
bus->new_state = SCSI_PHASE_MESSAGE_IN;
|
||||
bus->change_state_delay = 4;
|
||||
@@ -353,12 +352,12 @@ int scsi_bus_read(scsi_bus_t *bus)
|
||||
bus->state = STATE_STATUS;
|
||||
bus->bus_out |= BUS_REQ;
|
||||
bus->bus_out = (bus->bus_out & ~BUS_DATAMASK) | BUS_SETDATA(SCSIStatus) | BUS_DBP;
|
||||
/* pclog("SCSI Status (command %02X): %02X (%08X)\n", bus->command[0], SCSIStatus, bus->bus_out); */
|
||||
/* scsi_bus_log("SCSI Status (command %02X): %02X (%08X)\n", bus->command[0], SCSIStatus, bus->bus_out); */
|
||||
break;
|
||||
|
||||
case SCSI_PHASE_MESSAGE_IN:
|
||||
scsi_bus_log("Phase message in\n");
|
||||
/* pclog("Message in\n"); */
|
||||
/* scsi_bus_log("Message in\n"); */
|
||||
bus->state = STATE_MESSAGEIN;
|
||||
bus->bus_out = (bus->bus_out & ~BUS_DATAMASK) | BUS_SETDATA(0) | BUS_DBP;
|
||||
break;
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
*
|
||||
* Emulation of SCSI fixed and removable disks.
|
||||
*
|
||||
* Version: @(#)scsi_disk.c 1.0.15 2017/10/14
|
||||
* Version: @(#)scsi_disk.c 1.0.16 2017/10/16
|
||||
*
|
||||
* Author: Miran Grca, <mgrca8@gmail.com>
|
||||
* Copyright 2017 Miran Grca.
|
||||
@@ -90,7 +90,10 @@ uint8_t scsi_hd_command_flags[0x100] = {
|
||||
0, 0, 0, 0, 0, 0, 0,
|
||||
IMPLEMENTED | ALLOW_UA, /* 0x12 */
|
||||
IMPLEMENTED | CHECK_READY | NONDATA | SCSI_ONLY, /* 0x13 */
|
||||
0, 0, 0, 0, 0, 0, 0,
|
||||
0,
|
||||
IMPLEMENTED, /* 0x15 */
|
||||
0, 0, 0, 0,
|
||||
IMPLEMENTED,
|
||||
IMPLEMENTED | CHECK_READY, /* 0x1B */
|
||||
0, 0,
|
||||
IMPLEMENTED | CHECK_READY, /* 0x1E */
|
||||
@@ -104,7 +107,11 @@ uint8_t scsi_hd_command_flags[0x100] = {
|
||||
IMPLEMENTED | CHECK_READY | NONDATA | SCSI_ONLY, /* 0x2F */
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0,
|
||||
IMPLEMENTED, /* 0x55 */
|
||||
0, 0, 0, 0,
|
||||
IMPLEMENTED, /* 0x5A */
|
||||
0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
@@ -439,8 +446,9 @@ uint8_t scsi_hd_mode_sense_pages_saved[HDD_NUM][0x40][0x40] =
|
||||
[0x30] = { 0xB0, 0x16, '8', '6', 'B', 'o', 'x', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ' } }
|
||||
};
|
||||
|
||||
int scsi_hd_do_log = 0;
|
||||
|
||||
#ifdef ENABLE_SCSI_HD_LOG
|
||||
int scsi_hd_do_log = ENABLE_SCSI_HD_LOG;
|
||||
#endif
|
||||
|
||||
void scsi_hd_log(const char *format, ...)
|
||||
{
|
||||
@@ -656,18 +664,21 @@ uint32_t scsi_hd_mode_sense(uint8_t id, uint8_t *buf, uint32_t pos, uint8_t type
|
||||
int j = 0;
|
||||
|
||||
uint8_t msplen;
|
||||
int size = 0;
|
||||
|
||||
type &= 0x3f;
|
||||
|
||||
size = hdd_image_get_last_sector(id);
|
||||
|
||||
if (block_descriptor_len)
|
||||
{
|
||||
buf[pos++] = 1; /* Density code. */
|
||||
buf[pos++] = 0; /* Number of blocks (0 = all). */
|
||||
buf[pos++] = 0;
|
||||
buf[pos++] = 0;
|
||||
buf[pos++] = (size >> 16) & 0xff; /* Number of blocks (0 = all). */
|
||||
buf[pos++] = (size >> 8) & 0xff;
|
||||
buf[pos++] = size & 0xff;
|
||||
buf[pos++] = 0; /* Reserved. */
|
||||
buf[pos++] = 0; /* Block length (0x800 = 2048 bytes). */
|
||||
buf[pos++] = 8;
|
||||
buf[pos++] = 0; /* Block length (0x200 = 512 bytes). */
|
||||
buf[pos++] = 2;
|
||||
buf[pos++] = 0;
|
||||
}
|
||||
|
||||
@@ -1640,16 +1651,19 @@ void scsi_hd_command(uint8_t id, uint8_t *cdb)
|
||||
|
||||
shdc[id].current_page_code = cdb[2] & 0x3F;
|
||||
|
||||
#if 0
|
||||
if (!(scsi_hd_mode_sense_page_flags[id] & (1LL << shdc[id].current_page_code)))
|
||||
{
|
||||
scsi_hd_invalid_field(id);
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
memset(hdbufferb, 0, len);
|
||||
alloc_length = len;
|
||||
|
||||
shdc[id].temp_buffer = (uint8_t *) malloc(256);
|
||||
shdc[id].temp_buffer = (uint8_t *) malloc(65536);
|
||||
memset(shdc[id].temp_buffer, 0, 65536);
|
||||
|
||||
if (cdb[0] == GPCMD_MODE_SENSE_6)
|
||||
{
|
||||
len = scsi_hd_mode_sense(id, shdc[id].temp_buffer, 4, cdb[2], block_desc);
|
||||
@@ -1661,7 +1675,7 @@ void scsi_hd_command(uint8_t id, uint8_t *cdb)
|
||||
shdc[id].temp_buffer[1] = 0;
|
||||
if (block_desc)
|
||||
{
|
||||
hdbufferb[3] = 8;
|
||||
shdc[id].temp_buffer[3] = 8;
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -1793,7 +1807,7 @@ void scsi_hd_command(uint8_t id, uint8_t *cdb)
|
||||
shdc[id].temp_buffer[idx++] = 0x00;
|
||||
shdc[id].temp_buffer[idx++] = 0x00;
|
||||
shdc[id].temp_buffer[idx++] = 20;
|
||||
ide_padstr8(hdbufferb + idx, 20, "53R141"); /* Serial */
|
||||
ide_padstr8(shdc[id].temp_buffer + idx, 20, "53R141"); /* Serial */
|
||||
idx += 20;
|
||||
|
||||
if (idx + 72 > cdb[4])
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
* series of SCSI Host Adapters made by Mylex.
|
||||
* These controllers were designed for various buses.
|
||||
*
|
||||
* Version: @(#)scsi_x54x.c 1.0.0 2017/10/14
|
||||
* Version: @(#)scsi_x54x.c 1.0.1 2017/10/14
|
||||
*
|
||||
* Authors: TheCollector1995, <mariogplayer@gmail.com>
|
||||
* Miran Grca, <mgrca8@gmail.com>
|
||||
@@ -1283,9 +1283,9 @@ x54x_do_mail(x54x_t *dev)
|
||||
if (dev->is_aggressive_mode) {
|
||||
aggressive = dev->is_aggressive_mode(dev);
|
||||
x54x_log("Processing mailboxes in %s mode...\n", aggressive ? "aggressive" : "strict");
|
||||
} else {
|
||||
}/* else {
|
||||
x54x_log("Defaulting to process mailboxes in %s mode...\n", aggressive ? "aggressive" : "strict");
|
||||
}
|
||||
}*/
|
||||
|
||||
if (!dev->MailboxCount) {
|
||||
x54x_log("x54x_do_mail(): No Mailboxes\n");
|
||||
@@ -1832,12 +1832,12 @@ void
|
||||
x54x_io_set(x54x_t *dev, uint32_t base)
|
||||
{
|
||||
if (dev->bus & DEVICE_PCI) {
|
||||
x54x_log("x54x: [PCI] Setting I/O handler at %04X\n", dev->Base);
|
||||
x54x_log("x54x: [PCI] Setting I/O handler at %04X\n", base);
|
||||
io_sethandler(base, 4,
|
||||
x54x_in, x54x_inw, x54x_inl,
|
||||
x54x_out, x54x_outw, x54x_outl, dev);
|
||||
} else {
|
||||
x54x_log("x54x: [ISA] Setting I/O handler at %04X\n", dev->Base);
|
||||
x54x_log("x54x: [ISA] Setting I/O handler at %04X\n", base);
|
||||
io_sethandler(base, 4,
|
||||
x54x_in, x54x_inw, NULL,
|
||||
x54x_out, x54x_outw, NULL, dev);
|
||||
@@ -1848,7 +1848,7 @@ x54x_io_set(x54x_t *dev, uint32_t base)
|
||||
void
|
||||
x54x_io_remove(x54x_t *dev, uint32_t base)
|
||||
{
|
||||
x54x_log("x54x: Removing I/O handler at %04X\n", dev->Base);
|
||||
x54x_log("x54x: Removing I/O handler at %04X\n", base);
|
||||
|
||||
if (dev->bus & DEVICE_PCI) {
|
||||
io_removehandler(base, 4,
|
||||
|
||||
@@ -416,7 +416,7 @@ typedef struct {
|
||||
ATBusSpeed;
|
||||
|
||||
char *fw_rev; /* The 4 bytes of the revision command information + 2 extra bytes for BusLogic */
|
||||
uint8_t bus; /* Basically a copy of device flags */
|
||||
uint16_t bus; /* Basically a copy of device flags */
|
||||
uint8_t setup_info_len;
|
||||
uint8_t max_id;
|
||||
uint8_t pci_slot;
|
||||
|
||||
Reference in New Issue
Block a user