Added emulation of BusLogic BT-958 PCI SCSI controller;
SCSI controller configuration moved to the Settings dialog, suggestion by RichardG.
This commit is contained in:
607
src/buslogic.c
607
src/buslogic.c
@@ -3,6 +3,11 @@
|
||||
*/
|
||||
/*Buslogic SCSI emulation (including Adaptec 154x ISA software backward compatibility) and the Adaptec 154x itself*/
|
||||
|
||||
/* Emulated SCSI controllers:
|
||||
0 - Adaptec AHA-154xB ISA;
|
||||
1 - BusLogic BT-542B ISA;
|
||||
2 - BusLogic BT-958 PCI (but BT-542B ISA on non-PCI machines). */
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
@@ -16,6 +21,7 @@
|
||||
#include "rom.h"
|
||||
#include "dma.h"
|
||||
#include "pic.h"
|
||||
#include "pci.h"
|
||||
#include "timer.h"
|
||||
|
||||
#include "scsi.h"
|
||||
@@ -509,6 +515,9 @@ typedef struct __attribute__((packed)) Buslogic_t
|
||||
uint32_t MailboxOutPosCur;
|
||||
uint32_t MailboxInAddr;
|
||||
uint32_t MailboxInPosCur;
|
||||
int Base;
|
||||
int PCIBase;
|
||||
int MMIOBase;
|
||||
int Irq;
|
||||
int DmaChannel;
|
||||
int IrqEnabled;
|
||||
@@ -517,20 +526,34 @@ typedef struct __attribute__((packed)) Buslogic_t
|
||||
int MbiActive[256];
|
||||
int PendingInterrupt;
|
||||
int Lock;
|
||||
mem_mapping_t mmio_mapping;
|
||||
} Buslogic_t;
|
||||
|
||||
int scsi_model = 1;
|
||||
int scsi_base = 0x330;
|
||||
int scsi_dma = 6;
|
||||
int scsi_irq = 11;
|
||||
|
||||
int BuslogicCallback = 0;
|
||||
int BuslogicInOperation = 0;
|
||||
|
||||
int buslogic_do_log = 0;
|
||||
/** Structure for the INQUIRE_PCI_HOST_ADAPTER_INFORMATION reply. */
|
||||
typedef struct __attribute__((packed)) BuslogicPCIInformation_t
|
||||
{
|
||||
uint8_t IsaIOPort;
|
||||
uint8_t IRQ;
|
||||
unsigned char LowByteTerminated:1;
|
||||
unsigned char HighByteTerminated:1;
|
||||
unsigned char uReserved:2; /* Reserved. */
|
||||
unsigned char JP1:1; /* Whatever that means. */
|
||||
unsigned char JP2:1; /* Whatever that means. */
|
||||
unsigned char JP3:1; /* Whatever that means. */
|
||||
/** Whether the provided info is valid. */
|
||||
unsigned char InformationIsValid:1;
|
||||
uint8_t uReserved2; /* Reserved. */
|
||||
} BuslogicPCIInformation_t;
|
||||
|
||||
static void BuslogicStartMailbox(Buslogic_t *Buslogic);
|
||||
|
||||
int buslogic_do_log = 0;
|
||||
|
||||
void BuslogicLog(const char *format, ...)
|
||||
{
|
||||
#ifdef ENABLE_BUSLOGIC_LOG
|
||||
@@ -545,6 +568,18 @@ void BuslogicLog(const char *format, ...)
|
||||
#endif
|
||||
}
|
||||
|
||||
static int BuslogicIsPCI()
|
||||
{
|
||||
if (PCI && (scsi_model == 2))
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
static void BuslogicClearInterrupt(Buslogic_t *Buslogic)
|
||||
{
|
||||
BuslogicLog("Buslogic: Lowering Interrupt 0x%02X\n", Buslogic->Interrupt);
|
||||
@@ -1053,11 +1088,24 @@ uint8_t BuslogicRead(uint16_t Port, void *p)
|
||||
Temp = Buslogic->Geometry;
|
||||
break;
|
||||
}
|
||||
|
||||
// BuslogicLog("Buslogic: Read Port 0x%02X, Returned Value %02X\n", Port, Temp);
|
||||
|
||||
if (Port < 0x1000)
|
||||
{
|
||||
BuslogicLog("Buslogic: Read Port 0x%02X, Returned Value %02X\n", Port, Temp);
|
||||
}
|
||||
return Temp;
|
||||
}
|
||||
|
||||
uint16_t BuslogicReadW(uint16_t Port, void *p)
|
||||
{
|
||||
return BuslogicRead(Port, p);
|
||||
}
|
||||
|
||||
uint32_t BuslogicReadL(uint16_t Port, void *p)
|
||||
{
|
||||
return BuslogicRead(Port, p);
|
||||
}
|
||||
|
||||
int buslogic_scsi_drive_is_cdrom(uint8_t id, uint8_t lun)
|
||||
{
|
||||
if (lun > 7)
|
||||
@@ -1082,6 +1130,9 @@ int buslogic_scsi_drive_is_cdrom(uint8_t id, uint8_t lun)
|
||||
}
|
||||
}
|
||||
|
||||
void BuslogicWriteW(uint16_t Port, uint16_t Val, void *p);
|
||||
void BuslogicWriteL(uint16_t Port, uint32_t Val, void *p);
|
||||
|
||||
void BuslogicWrite(uint16_t Port, uint8_t Val, void *p)
|
||||
{
|
||||
int i = 0;
|
||||
@@ -1190,9 +1241,16 @@ void BuslogicWrite(uint16_t Port, uint8_t Val, void *p)
|
||||
Buslogic->CmdParamLeft = scsi_model ? 0 : 2;
|
||||
break;
|
||||
|
||||
case 0x28:
|
||||
case 0x86: //Valid only for PCI
|
||||
Buslogic->CmdParamLeft = 0;
|
||||
break;
|
||||
|
||||
case 0x8C:
|
||||
case 0x95: //Valid only for PCI
|
||||
Buslogic->CmdParamLeft = BuslogicIsPCI() ? 1 : 0;
|
||||
break;
|
||||
|
||||
case 0x28:
|
||||
Buslogic->CmdParamLeft = 0;
|
||||
break;
|
||||
}
|
||||
@@ -1277,17 +1335,17 @@ void BuslogicWrite(uint16_t Port, uint8_t Val, void *p)
|
||||
break;
|
||||
|
||||
case 0x0A:
|
||||
for (i = 0; i < max_id; i++)
|
||||
memset(Buslogic->DataBuf, 0, 8);
|
||||
for (i = 0; i < 6; i++)
|
||||
{
|
||||
for (j = 0; j < 8; j++)
|
||||
{
|
||||
if (buslogic_scsi_drive_is_cdrom(i, j))
|
||||
Buslogic->DataBuf[i] = 1;
|
||||
|
||||
Buslogic->DataBuf[7] = 0;
|
||||
Buslogic->DataReplyLeft = 8;
|
||||
}
|
||||
}
|
||||
Buslogic->DataBuf[7] = 0;
|
||||
Buslogic->DataReplyLeft = 8;
|
||||
break;
|
||||
|
||||
case 0x0B:
|
||||
@@ -1302,6 +1360,7 @@ void BuslogicWrite(uint16_t Port, uint8_t Val, void *p)
|
||||
Buslogic->DataReplyLeft = Buslogic->CmdBuf[0];
|
||||
|
||||
ReplyInquireSetupInformation *Reply = (ReplyInquireSetupInformation *)Buslogic->DataBuf;
|
||||
memset(Reply, 0, sizeof(ReplyInquireSetupInformation));
|
||||
|
||||
Reply->fSynchronousInitiationEnabled = 1;
|
||||
Reply->fParityCheckingEnabled = 1;
|
||||
@@ -1315,7 +1374,7 @@ void BuslogicWrite(uint16_t Port, uint8_t Val, void *p)
|
||||
* friendly with Adaptec hardware and upsetting the HBA state.
|
||||
*/
|
||||
Reply->uCharacterD = 'D'; /* BusLogic model. */
|
||||
Reply->uHostBusType = 'A'; /* ISA bus. */
|
||||
Reply->uHostBusType = BuslogicIsPCI() ? 'F' : 'A'; /* ISA bus. */
|
||||
}
|
||||
|
||||
BuslogicLog("Return Setup Information: %d\n", Buslogic->CmdBuf[0]);
|
||||
@@ -1323,15 +1382,23 @@ void BuslogicWrite(uint16_t Port, uint8_t Val, void *p)
|
||||
break;
|
||||
|
||||
case 0x23:
|
||||
for (i = 0; i < max_id; i++)
|
||||
if (scsi_model)
|
||||
{
|
||||
for (i = 0; j < 8; j++)
|
||||
memset(Buslogic->DataBuf, 0, 8);
|
||||
for (i = 8; i < max_id; i++)
|
||||
{
|
||||
if (buslogic_scsi_drive_is_cdrom(i, j))
|
||||
Buslogic->DataBuf[i] = 1;
|
||||
|
||||
Buslogic->DataReplyLeft = 8;
|
||||
for (i = 0; j < 8; j++)
|
||||
{
|
||||
if (buslogic_scsi_drive_is_cdrom(i, j))
|
||||
Buslogic->DataBuf[i] = 1;
|
||||
}
|
||||
}
|
||||
Buslogic->DataReplyLeft = 8;
|
||||
}
|
||||
else
|
||||
{
|
||||
Buslogic->Status |= STAT_INVCMD;
|
||||
Buslogic->DataReplyLeft = 0;
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -1506,6 +1573,46 @@ void BuslogicWrite(uint16_t Port, uint8_t Val, void *p)
|
||||
}
|
||||
break;
|
||||
|
||||
case 0x86:
|
||||
if (BuslogicIsPCI())
|
||||
{
|
||||
BuslogicPCIInformation_t *Reply = (BuslogicPCIInformation_t *) Buslogic->DataBuf;
|
||||
memset(Reply, 0, sizeof(BuslogicPCIInformation_t));
|
||||
Reply->InformationIsValid = 0;
|
||||
switch(Buslogic->Base)
|
||||
{
|
||||
case 0x330:
|
||||
Reply->IsaIOPort = 0;
|
||||
break;
|
||||
case 0x334:
|
||||
Reply->IsaIOPort = 1;
|
||||
break;
|
||||
case 0x230:
|
||||
Reply->IsaIOPort = 2;
|
||||
break;
|
||||
case 0x234:
|
||||
Reply->IsaIOPort = 3;
|
||||
break;
|
||||
case 0x130:
|
||||
Reply->IsaIOPort = 4;
|
||||
break;
|
||||
case 0x134:
|
||||
Reply->IsaIOPort = 5;
|
||||
break;
|
||||
default:
|
||||
Reply->IsaIOPort = 0xFF;
|
||||
break;
|
||||
}
|
||||
Reply->IRQ = Buslogic->Irq;
|
||||
Buslogic->DataReplyLeft = sizeof(BuslogicPCIInformation_t);
|
||||
}
|
||||
else
|
||||
{
|
||||
Buslogic->DataReplyLeft = 0;
|
||||
Buslogic->Status |= STAT_INVCMD;
|
||||
}
|
||||
break;
|
||||
|
||||
case 0x8B:
|
||||
{
|
||||
if (scsi_model)
|
||||
@@ -1515,7 +1622,14 @@ void BuslogicWrite(uint16_t Port, uint8_t Val, void *p)
|
||||
/* The reply length is set by the guest and is found in the first byte of the command buffer. */
|
||||
Buslogic->DataReplyLeft = Buslogic->CmdBuf[0];
|
||||
memset(Buslogic->DataBuf, 0, Buslogic->DataReplyLeft);
|
||||
const char aModelName[] = "542B "; /* Trailing \0 is fine, that's the filler anyway. */
|
||||
char aModelName[] = "542B "; /* Trailing \0 is fine, that's the filler anyway. */
|
||||
if (BuslogicIsPCI())
|
||||
{
|
||||
aModelName[0] = '9';
|
||||
aModelName[1] = '5';
|
||||
aModelName[2] = '8';
|
||||
aModelName[3] = 'D';
|
||||
}
|
||||
int cCharsToTransfer = Buslogic->DataReplyLeft <= sizeof(aModelName)
|
||||
? Buslogic->DataReplyLeft
|
||||
: sizeof(aModelName);
|
||||
@@ -1531,18 +1645,42 @@ void BuslogicWrite(uint16_t Port, uint8_t Val, void *p)
|
||||
}
|
||||
break;
|
||||
|
||||
case 0x8C:
|
||||
if (BuslogicIsPCI())
|
||||
{
|
||||
int i = 0;
|
||||
Buslogic->DataReplyLeft = Buslogic->CmdBuf[0];
|
||||
for (i = 0; i < Buslogic->DataReplyLeft; i++)
|
||||
{
|
||||
Buslogic->DataBuf[0] = 0;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Buslogic->DataReplyLeft = 0;
|
||||
Buslogic->Status |= STAT_INVCMD;
|
||||
}
|
||||
break;
|
||||
|
||||
case 0x8D:
|
||||
{
|
||||
if (scsi_model)
|
||||
{
|
||||
Buslogic->DataReplyLeft = Buslogic->CmdBuf[0];
|
||||
ReplyInquireExtendedSetupInformation *Reply = (ReplyInquireExtendedSetupInformation *)Buslogic->DataBuf;
|
||||
memset(Reply, 0, sizeof(ReplyInquireExtendedSetupInformation));
|
||||
|
||||
Reply->uBusType = 'A'; /* ISA style */
|
||||
Reply->uBusType = (BuslogicIsPCI()) ? 'E' : 'A'; /* ISA style */
|
||||
Reply->uBiosAddress = 0;
|
||||
Reply->u16ScatterGatherLimit = 8192;
|
||||
Reply->cMailbox = Buslogic->MailboxCount;
|
||||
Reply->uMailboxAddressBase = Buslogic->MailboxOutAddr;
|
||||
if (BuslogicIsPCI())
|
||||
{
|
||||
Reply->fLevelSensitiveInterrupt = 1;
|
||||
Reply->fHostWideSCSI = 1;
|
||||
Reply->fHostUltraSCSI = 1;
|
||||
}
|
||||
memcpy(Reply->aFirmwareRevision, "07B", sizeof(Reply->aFirmwareRevision));
|
||||
BuslogicLog("Return Extended Setup Information: %d\n", Buslogic->CmdBuf[0]);
|
||||
}
|
||||
@@ -1586,7 +1724,51 @@ void BuslogicWrite(uint16_t Port, uint8_t Val, void *p)
|
||||
Buslogic->DataReply = Offset;
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case 0x95:
|
||||
if (BuslogicIsPCI())
|
||||
{
|
||||
if (Buslogic->Base != 0)
|
||||
{
|
||||
io_removehandler(Buslogic->Base, 0x0004, BuslogicRead, BuslogicReadW, BuslogicReadL, BuslogicWrite, BuslogicWriteW, BuslogicWriteL, Buslogic);
|
||||
}
|
||||
switch(Buslogic->CmdBuf[0])
|
||||
{
|
||||
case 0:
|
||||
Buslogic->Base = 0x330;
|
||||
break;
|
||||
case 1:
|
||||
Buslogic->Base = 0x334;
|
||||
break;
|
||||
case 2:
|
||||
Buslogic->Base = 0x230;
|
||||
break;
|
||||
case 3:
|
||||
Buslogic->Base = 0x234;
|
||||
break;
|
||||
case 4:
|
||||
Buslogic->Base = 0x130;
|
||||
break;
|
||||
case 5:
|
||||
Buslogic->Base = 0x134;
|
||||
break;
|
||||
default:
|
||||
Buslogic->Base = 0;
|
||||
break;
|
||||
}
|
||||
if (Buslogic->Base != 0)
|
||||
{
|
||||
io_sethandler(Buslogic->Base, 0x0004, BuslogicRead, BuslogicReadW, BuslogicReadL, BuslogicWrite, BuslogicWriteW, BuslogicWriteL, Buslogic);
|
||||
}
|
||||
Buslogic->DataReplyLeft = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
Buslogic->DataReplyLeft = 0;
|
||||
Buslogic->Status |= STAT_INVCMD;
|
||||
}
|
||||
break;
|
||||
|
||||
case 0x96:
|
||||
if (scsi_model)
|
||||
{
|
||||
@@ -1597,14 +1779,15 @@ void BuslogicWrite(uint16_t Port, uint8_t Val, void *p)
|
||||
|
||||
Buslogic->DataReplyLeft = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
Buslogic->DataReplyLeft = 0;
|
||||
Buslogic->Status |= STAT_INVCMD;
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
case 0x22: //undocumented
|
||||
// case 0x28: //only for the Adaptec 154xC series
|
||||
// case 0x29: //only for the Adaptec 154xC series
|
||||
case 0x86: //PCI only, not ISA
|
||||
case 0x95: //PCI only, not ISA
|
||||
Buslogic->DataReplyLeft = 0;
|
||||
Buslogic->Status |= STAT_INVCMD;
|
||||
break;
|
||||
@@ -1629,6 +1812,16 @@ void BuslogicWrite(uint16_t Port, uint8_t Val, void *p)
|
||||
}
|
||||
}
|
||||
|
||||
void BuslogicWriteW(uint16_t Port, uint16_t Val, void *p)
|
||||
{
|
||||
BuslogicWrite(Port, Val & 0xFF, p);
|
||||
}
|
||||
|
||||
void BuslogicWriteL(uint16_t Port, uint32_t Val, void *p)
|
||||
{
|
||||
BuslogicWrite(Port, Val & 0xFF, p);
|
||||
}
|
||||
|
||||
static uint8_t BuslogicConvertSenseLength(uint8_t RequestSenseLength)
|
||||
{
|
||||
BuslogicLog("Unconverted Request Sense length %i\n", RequestSenseLength);
|
||||
@@ -2004,6 +2197,195 @@ void BuslogicCommandCallback(void *p)
|
||||
BuslogicCallback += 50 * SCSI_TIME;
|
||||
}
|
||||
|
||||
uint8_t mem_read_null(uint32_t addr, void *priv)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
uint16_t mem_read_nullw(uint32_t addr, void *priv)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
uint32_t mem_read_nulll(uint32_t addr, void *priv)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
typedef union
|
||||
{
|
||||
uint32_t addr;
|
||||
uint8_t addr_regs[4];
|
||||
} bar_t;
|
||||
|
||||
uint8_t buslogic_pci_regs[256];
|
||||
|
||||
bar_t buslogic_pci_bar[3];
|
||||
|
||||
uint8_t BuslogicPCIRead(int func, int addr, void *p)
|
||||
{
|
||||
Buslogic_t *Buslogic = (Buslogic_t *)p;
|
||||
|
||||
// BuslogicLog("BusLogic PCI read %08X\n", addr);
|
||||
switch (addr)
|
||||
{
|
||||
case 0x00:
|
||||
return 0x4b;
|
||||
case 0x01:
|
||||
return 0x10;
|
||||
|
||||
case 0x02:
|
||||
return 0x40;
|
||||
case 0x03:
|
||||
return 0x10;
|
||||
|
||||
case 0x2C:
|
||||
return 0x4b;
|
||||
case 0x2D:
|
||||
return 0x10;
|
||||
case 0x2E:
|
||||
return 0x40;
|
||||
case 0x2F:
|
||||
return 0x10;
|
||||
|
||||
case 0x04:
|
||||
return buslogic_pci_regs[0x04]; /*Respond to IO and memory accesses*/
|
||||
case 0x05:
|
||||
return buslogic_pci_regs[0x05];
|
||||
|
||||
case 0x07:
|
||||
return 2;
|
||||
|
||||
case 0x08:
|
||||
return 1; /*Revision ID*/
|
||||
case 0x09:
|
||||
return 0; /*Programming interface*/
|
||||
case 0x0A:
|
||||
return 0; /*Subclass*/
|
||||
case 0x0B:
|
||||
return 1; /* Class code*/
|
||||
|
||||
case 0x10:
|
||||
return (buslogic_pci_bar[0].addr_regs[0] & 0xe0) | 1; /*I/O space*/
|
||||
case 0x11:
|
||||
return buslogic_pci_bar[0].addr_regs[1];
|
||||
case 0x12:
|
||||
return buslogic_pci_bar[0].addr_regs[2];
|
||||
case 0x13:
|
||||
return buslogic_pci_bar[0].addr_regs[3];
|
||||
|
||||
case 0x14:
|
||||
return (buslogic_pci_bar[1].addr_regs[0] & 0xe0); /*Memory space*/
|
||||
case 0x15:
|
||||
return buslogic_pci_bar[1].addr_regs[1];
|
||||
case 0x16:
|
||||
return buslogic_pci_bar[1].addr_regs[2];
|
||||
case 0x17:
|
||||
return buslogic_pci_bar[1].addr_regs[3];
|
||||
|
||||
case 0x30:
|
||||
return buslogic_pci_bar[2].addr_regs[0] & 0x01; /*BIOS ROM address*/
|
||||
case 0x31:
|
||||
return buslogic_pci_bar[2].addr_regs[1] | 0x18;
|
||||
case 0x32:
|
||||
return buslogic_pci_bar[2].addr_regs[2];
|
||||
case 0x33:
|
||||
return buslogic_pci_bar[2].addr_regs[3];
|
||||
|
||||
case 0x3C:
|
||||
return Buslogic->Irq;
|
||||
case 0x3D:
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
void BuslogicPCIWrite(int func, int addr, uint8_t val, void *p)
|
||||
{
|
||||
Buslogic_t *Buslogic = (Buslogic_t *)p;
|
||||
|
||||
switch (addr)
|
||||
{
|
||||
case 0x04:
|
||||
io_removehandler(Buslogic->PCIBase, 0x0004, BuslogicRead, BuslogicReadW, BuslogicReadL, BuslogicWrite, BuslogicWriteW, BuslogicWriteL, Buslogic);
|
||||
mem_mapping_disable(&Buslogic->mmio_mapping);
|
||||
if (val & PCI_COMMAND_IO)
|
||||
{
|
||||
if (Buslogic->PCIBase != 0)
|
||||
{
|
||||
io_sethandler(Buslogic->PCIBase, 0x0020, BuslogicRead, BuslogicReadW, BuslogicReadL, BuslogicWrite, BuslogicWriteW, BuslogicWriteL, Buslogic);
|
||||
}
|
||||
}
|
||||
if (val & PCI_COMMAND_MEM)
|
||||
{
|
||||
if (Buslogic->PCIBase != 0)
|
||||
{
|
||||
mem_mapping_set_addr(&Buslogic->mmio_mapping, Buslogic->MMIOBase, 0x20);
|
||||
}
|
||||
}
|
||||
buslogic_pci_regs[addr] = val;
|
||||
break;
|
||||
|
||||
case 0x10:
|
||||
val &= 0xe0;
|
||||
val |= 1;
|
||||
case 0x11: case 0x12: case 0x13:
|
||||
/* I/O Base set. */
|
||||
/* First, remove the old I/O. */
|
||||
io_removehandler(Buslogic->PCIBase, 0x0020, BuslogicRead, BuslogicReadW, BuslogicReadL, BuslogicWrite, BuslogicWriteW, BuslogicWriteL, Buslogic);
|
||||
/* Then let's set the PCI regs. */
|
||||
buslogic_pci_bar[0].addr_regs[addr & 3] = val;
|
||||
/* Then let's calculate the new I/O base. */
|
||||
Buslogic->PCIBase = buslogic_pci_bar[0].addr & 0xffe0;
|
||||
/* Log the new base. */
|
||||
BuslogicLog("BusLogic PCI: New I/O base is %04X\n" , Buslogic->PCIBase);
|
||||
/* We're done, so get out of the here. */
|
||||
if (buslogic_pci_regs[4] & PCI_COMMAND_IO)
|
||||
{
|
||||
if (Buslogic->PCIBase != 0)
|
||||
{
|
||||
io_sethandler(Buslogic->PCIBase, 0x0020, BuslogicRead, BuslogicReadW, BuslogicReadL, BuslogicWrite, BuslogicWriteW, BuslogicWriteL, Buslogic);
|
||||
}
|
||||
}
|
||||
return;
|
||||
|
||||
case 0x14:
|
||||
val &= 0xe0;
|
||||
case 0x15: case 0x16: case 0x17:
|
||||
/* I/O Base set. */
|
||||
/* First, remove the old I/O. */
|
||||
mem_mapping_disable(&Buslogic->mmio_mapping);
|
||||
/* Then let's set the PCI regs. */
|
||||
buslogic_pci_bar[1].addr_regs[addr & 3] = val;
|
||||
/* Then let's calculate the new I/O base. */
|
||||
Buslogic->MMIOBase = buslogic_pci_bar[1].addr & 0xffffffe0;
|
||||
/* Log the new base. */
|
||||
BuslogicLog("BusLogic PCI: New MMIO base is %04X\n" , Buslogic->MMIOBase);
|
||||
/* We're done, so get out of the here. */
|
||||
if (buslogic_pci_regs[4] & PCI_COMMAND_MEM)
|
||||
{
|
||||
if (Buslogic->PCIBase != 0)
|
||||
{
|
||||
mem_mapping_set_addr(&Buslogic->mmio_mapping, Buslogic->MMIOBase, 0x20);
|
||||
}
|
||||
}
|
||||
return;
|
||||
|
||||
/* Commented out until an APIC controller is emulated for the PIIX3,
|
||||
otherwise the BT-958 will not get an IRQ on boards using the PIIX3. */
|
||||
#if 0
|
||||
case 0x3C:
|
||||
buslogic_pci_regs[addr] = val;
|
||||
if (val != 0xFF)
|
||||
{
|
||||
buslogic_log("BusLogic IRQ now: %i\n", val);
|
||||
Buslogic->Irq = val;
|
||||
}
|
||||
return;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
void *BuslogicInit()
|
||||
{
|
||||
int i = 0;
|
||||
@@ -2011,10 +2393,23 @@ void *BuslogicInit()
|
||||
Buslogic_t *Buslogic = malloc(sizeof(Buslogic_t));
|
||||
memset(Buslogic, 0, sizeof(Buslogic_t));
|
||||
|
||||
Buslogic->Irq = scsi_irq;
|
||||
Buslogic->DmaChannel = scsi_dma;
|
||||
scsi_model = device_get_config_int("model");
|
||||
Buslogic->Base = device_get_config_int("addr");
|
||||
Buslogic->PCIBase = 0;
|
||||
Buslogic->MMIOBase = 0;
|
||||
Buslogic->Irq = device_get_config_int("irq");
|
||||
Buslogic->DmaChannel = device_get_config_int("dma");
|
||||
|
||||
io_sethandler(scsi_base, 0x0004, BuslogicRead, NULL, NULL, BuslogicWrite, NULL, NULL, Buslogic);
|
||||
if (Buslogic->Base != 0)
|
||||
{
|
||||
if (BuslogicIsPCI())
|
||||
{
|
||||
}
|
||||
else
|
||||
{
|
||||
io_sethandler(Buslogic->Base, 0x0004, BuslogicRead, BuslogicReadW, BuslogicReadL, BuslogicWrite, BuslogicWriteW, BuslogicWriteL, Buslogic);
|
||||
}
|
||||
}
|
||||
|
||||
BuslogicLog("Building CD-ROM map...\n");
|
||||
build_scsi_cdrom_map();
|
||||
@@ -2028,8 +2423,26 @@ void *BuslogicInit()
|
||||
}
|
||||
|
||||
timer_add(BuslogicCommandCallback, &BuslogicCallback, &BuslogicCallback, Buslogic);
|
||||
|
||||
if (BuslogicIsPCI())
|
||||
{
|
||||
pci_add(BuslogicPCIRead, BuslogicPCIWrite, Buslogic);
|
||||
|
||||
buslogic_pci_bar[0].addr_regs[0] = 1;
|
||||
buslogic_pci_bar[1].addr_regs[0] = 0;
|
||||
|
||||
buslogic_pci_regs[0x04] = 1;
|
||||
buslogic_pci_regs[0x05] = 0;
|
||||
|
||||
buslogic_pci_regs[0x07] = 2;
|
||||
|
||||
buslogic_pci_bar[2].addr = 0;
|
||||
|
||||
mem_mapping_add(&Buslogic->mmio_mapping, 0xfffd0000, 0x20, mem_read_null, mem_read_nullw, mem_read_nulll, mem_write_null, mem_write_nullw, mem_write_nulll, NULL, MEM_MAPPING_EXTERNAL, Buslogic);
|
||||
mem_mapping_disable(&Buslogic->mmio_mapping);
|
||||
}
|
||||
|
||||
BuslogicLog("Buslogic on port 0x%04X\n", scsi_base);
|
||||
BuslogicLog("Buslogic on port 0x%04X\n", Buslogic->Base);
|
||||
|
||||
BuslogicResetControl(Buslogic, CTRL_HRST);
|
||||
|
||||
@@ -2042,6 +2455,139 @@ void BuslogicClose(void *p)
|
||||
free(Buslogic);
|
||||
}
|
||||
|
||||
static device_config_t BuslogicConfig[] =
|
||||
{
|
||||
{
|
||||
.name = "model",
|
||||
.description = "Model",
|
||||
.type = CONFIG_BINARY,
|
||||
.type = CONFIG_SELECTION,
|
||||
.selection =
|
||||
{
|
||||
{
|
||||
.description = "Adaptec AHA-154XB ISA",
|
||||
.value = 0
|
||||
},
|
||||
{
|
||||
.description = "BusLogic BT-542B ISA",
|
||||
.value = 1
|
||||
},
|
||||
{
|
||||
.description = "BusLogic BT-958 PCI",
|
||||
.value = 2
|
||||
},
|
||||
{
|
||||
.description = ""
|
||||
}
|
||||
},
|
||||
.default_int = 0
|
||||
},
|
||||
{
|
||||
.name = "addr",
|
||||
.description = "Address",
|
||||
.type = CONFIG_BINARY,
|
||||
.type = CONFIG_SELECTION,
|
||||
.selection =
|
||||
{
|
||||
{
|
||||
.description = "None",
|
||||
.value = 0
|
||||
},
|
||||
{
|
||||
.description = "0x330",
|
||||
.value = 0x330
|
||||
},
|
||||
{
|
||||
.description = "0x334",
|
||||
.value = 0x334
|
||||
},
|
||||
{
|
||||
.description = "0x230",
|
||||
.value = 0x230
|
||||
},
|
||||
{
|
||||
.description = "0x234",
|
||||
.value = 0x234
|
||||
},
|
||||
{
|
||||
.description = "0x130",
|
||||
.value = 0x130
|
||||
},
|
||||
{
|
||||
.description = "0x134",
|
||||
.value = 0x134
|
||||
},
|
||||
{
|
||||
.description = ""
|
||||
}
|
||||
},
|
||||
.default_int = 0x334
|
||||
},
|
||||
{
|
||||
.name = "irq",
|
||||
.description = "IRQ",
|
||||
.type = CONFIG_SELECTION,
|
||||
.selection =
|
||||
{
|
||||
{
|
||||
.description = "IRQ 9",
|
||||
.value = 9
|
||||
},
|
||||
{
|
||||
.description = "IRQ 10",
|
||||
.value = 10
|
||||
},
|
||||
{
|
||||
.description = "IRQ 11",
|
||||
.value = 11
|
||||
},
|
||||
{
|
||||
.description = "IRQ 12",
|
||||
.value = 12
|
||||
},
|
||||
{
|
||||
.description = "IRQ 14",
|
||||
.value = 14
|
||||
},
|
||||
{
|
||||
.description = "IRQ 15",
|
||||
.value = 15
|
||||
},
|
||||
{
|
||||
.description = ""
|
||||
}
|
||||
},
|
||||
.default_int = 9
|
||||
},
|
||||
{
|
||||
.name = "dma",
|
||||
.description = "DMA channel",
|
||||
.type = CONFIG_SELECTION,
|
||||
.selection =
|
||||
{
|
||||
{
|
||||
.description = "DMA 5",
|
||||
.value = 5
|
||||
},
|
||||
{
|
||||
.description = "DMA 6",
|
||||
.value = 6
|
||||
},
|
||||
{
|
||||
.description = "DMA 7",
|
||||
.value = 7
|
||||
},
|
||||
{
|
||||
.description = ""
|
||||
}
|
||||
},
|
||||
.default_int = 6
|
||||
},
|
||||
{
|
||||
.type = -1
|
||||
}
|
||||
};
|
||||
|
||||
device_t BuslogicDevice =
|
||||
{
|
||||
"Adaptec/Buslogic",
|
||||
@@ -2051,5 +2597,6 @@ device_t BuslogicDevice =
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL
|
||||
NULL,
|
||||
BuslogicConfig
|
||||
};
|
||||
|
||||
@@ -599,8 +599,6 @@ int mem_a20_state;
|
||||
|
||||
void fatal(const char *format, ...);
|
||||
|
||||
extern int scsi_model, scsi_base, scsi_irq, scsi_dma;
|
||||
|
||||
#ifdef ENABLE_LOG_TOGGLES
|
||||
extern int buslogic_do_log;
|
||||
extern int cdrom_do_log;
|
||||
|
||||
10
src/pc.c
10
src/pc.c
@@ -686,11 +686,6 @@ void loadconfig(char *fn)
|
||||
voodoo_enabled = config_get_int(NULL, "voodoo", 0);
|
||||
buslogic_enabled = config_get_int(NULL, "buslogic", 0);
|
||||
|
||||
scsi_model = config_get_int(NULL, "scsi_model", 1);
|
||||
scsi_base = config_get_int(NULL, "scsi_base", 0x330);
|
||||
scsi_irq = config_get_int(NULL, "scsi_irq", 11);
|
||||
scsi_dma = config_get_int(NULL, "scsi_dma", 6);
|
||||
|
||||
//network
|
||||
ethif = config_get_int(NULL, "netinterface", 1);
|
||||
if (ethif >= inum)
|
||||
@@ -932,11 +927,6 @@ void saveconfig()
|
||||
config_set_int(NULL, "voodoo", voodoo_enabled);
|
||||
config_set_int(NULL, "buslogic", buslogic_enabled);
|
||||
|
||||
config_set_int(NULL, "scsi_model", scsi_model);
|
||||
config_set_int(NULL, "scsi_base", scsi_base);
|
||||
config_set_int(NULL, "scsi_irq", scsi_irq);
|
||||
config_set_int(NULL, "scsi_dma", scsi_dma);
|
||||
|
||||
config_set_int(NULL, "netinterface", ethif);
|
||||
config_set_int(NULL, "netcard", network_card_current);
|
||||
|
||||
|
||||
37
src/pc.rc
37
src/pc.rc
@@ -275,39 +275,6 @@ BEGIN
|
||||
MENUITEM "1&5",IDM_IDE_QUA_IRQ15
|
||||
END
|
||||
END
|
||||
POPUP "&SCSI controller"
|
||||
BEGIN
|
||||
MENUITEM "&Enabled",IDM_SCSI_ENABLED
|
||||
POPUP "&Model"
|
||||
BEGIN
|
||||
MENUITEM "&Adaptec AHA-154x",IDM_SCSI_MODEL0
|
||||
MENUITEM "&BusLogic BT-542B",IDM_SCSI_MODEL1
|
||||
END
|
||||
POPUP "&Base address"
|
||||
BEGIN
|
||||
MENUITEM "0x&130",IDM_SCSI_BASE130
|
||||
MENUITEM "0x13&4",IDM_SCSI_BASE134
|
||||
MENUITEM "0x&230",IDM_SCSI_BASE230
|
||||
MENUITEM "0&x234",IDM_SCSI_BASE234
|
||||
MENUITEM "0x33&0",IDM_SCSI_BASE330
|
||||
MENUITEM "&0x334",IDM_SCSI_BASE334
|
||||
END
|
||||
POPUP "&IRQ"
|
||||
BEGIN
|
||||
MENUITEM "&9",IDM_SCSI_IRQ9
|
||||
MENUITEM "1&0",IDM_SCSI_IRQ10
|
||||
MENUITEM "1&1",IDM_SCSI_IRQ11
|
||||
MENUITEM "1&2",IDM_SCSI_IRQ12
|
||||
MENUITEM "1&4",IDM_SCSI_IRQ14
|
||||
MENUITEM "1&5",IDM_SCSI_IRQ15
|
||||
END
|
||||
POPUP "&DMA channel"
|
||||
BEGIN
|
||||
MENUITEM "&5",IDM_SCSI_DMA5
|
||||
MENUITEM "&6",IDM_SCSI_DMA6
|
||||
MENUITEM "&7",IDM_SCSI_DMA7
|
||||
END
|
||||
END
|
||||
END
|
||||
POPUP "&Settings"
|
||||
BEGIN
|
||||
@@ -427,8 +394,10 @@ BEGIN
|
||||
CONTROL "Gravis Ultrasound",IDC_CHECKGUS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,14,208,102,10
|
||||
|
||||
CONTROL "Innovation SSI-2001",IDC_CHECKSSI,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,118,192,102,10
|
||||
CONTROL "Enable time sync",IDC_CHECKSYNC,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,118,208,102,10
|
||||
CONTROL "SCSI Controller",IDC_CHECKBUSLOGIC,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,118,208,102,10
|
||||
PUSHBUTTON "Configure", IDC_CONFIGUREBUSLOGIC, 224, 208, 40, 14, WS_TABSTOP
|
||||
|
||||
CONTROL "Enable time sync",IDC_CHECKSYNC,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,14,224,102,10
|
||||
CONTROL "Voodoo Graphics",IDC_CHECKVOODOO,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,118,224,102,10
|
||||
PUSHBUTTON "Configure", IDC_CONFIGUREVOODOO, 224, 224, 40, 14, WS_TABSTOP
|
||||
|
||||
|
||||
@@ -202,24 +202,6 @@
|
||||
#define IDM_IDE_QUA_IRQ12 44032
|
||||
#define IDM_IDE_QUA_IRQ14 44033
|
||||
#define IDM_IDE_QUA_IRQ15 44035
|
||||
#define IDM_SCSI_ENABLED 45000
|
||||
#define IDM_SCSI_MODEL0 45100
|
||||
#define IDM_SCSI_MODEL1 45101
|
||||
#define IDM_SCSI_BASE130 45200 + 0x130
|
||||
#define IDM_SCSI_BASE134 45200 + 0x134
|
||||
#define IDM_SCSI_BASE230 45200 + 0x230
|
||||
#define IDM_SCSI_BASE234 45200 + 0x234
|
||||
#define IDM_SCSI_BASE330 45200 + 0x330
|
||||
#define IDM_SCSI_BASE334 45200 + 0x334
|
||||
#define IDM_SCSI_IRQ9 45309
|
||||
#define IDM_SCSI_IRQ10 45310
|
||||
#define IDM_SCSI_IRQ11 45311
|
||||
#define IDM_SCSI_IRQ12 45312
|
||||
#define IDM_SCSI_IRQ14 45314
|
||||
#define IDM_SCSI_IRQ15 45315
|
||||
#define IDM_SCSI_DMA5 45405
|
||||
#define IDM_SCSI_DMA6 45406
|
||||
#define IDM_SCSI_DMA7 45407
|
||||
#ifdef ENABLE_LOG_TOGGLES
|
||||
#ifdef ENABLE_BUSLOGIC_LOG
|
||||
#define IDM_LOG_BUSLOGIC 51200
|
||||
@@ -269,6 +251,7 @@
|
||||
#define IDC_CHECKSSI 1014
|
||||
#define IDC_CHECKVOODOO 1015
|
||||
#define IDC_CHECKDYNAREC 1016
|
||||
#define IDC_CHECKBUSLOGIC 1017
|
||||
#define IDC_STATIC 1020
|
||||
#define IDC_CHECKSYNC 1024
|
||||
#define IDC_EDIT1 1030
|
||||
@@ -379,6 +362,7 @@
|
||||
#define IDC_CONFIGUREVOODOO 1202
|
||||
#define IDC_CONFIGUREMOD 1203
|
||||
#define IDC_CONFIGURENET 1204
|
||||
#define IDC_CONFIGUREBUSLOGIC 1205
|
||||
#define IDC_JOY1 1210
|
||||
#define IDC_JOY2 1211
|
||||
#define IDC_JOY3 1212
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
#include "ide.h"
|
||||
#include "cpu.h"
|
||||
#include "device.h"
|
||||
#include "buslogic.h"
|
||||
#include "fdd.h"
|
||||
#include "gameport.h"
|
||||
#include "model.h"
|
||||
@@ -48,7 +49,7 @@ static BOOL CALLBACK config_dlgproc(HWND hdlg, UINT message, WPARAM wParam, LPAR
|
||||
int c, d;
|
||||
int rom, gfx, mem, fpu;
|
||||
int temp_cpu, temp_cpu_m, temp_model;
|
||||
int temp_GAMEBLASTER, temp_GUS, temp_SSI2001, temp_voodoo, temp_sound_card_current;
|
||||
int temp_GAMEBLASTER, temp_GUS, temp_SSI2001, temp_voodoo, temp_buslogic, temp_sound_card_current;
|
||||
int temp_dynarec;
|
||||
int cpu_flags;
|
||||
int temp_fd1_type, temp_fd2_type, temp_fd3_type, temp_fd4_type;
|
||||
@@ -189,6 +190,9 @@ static BOOL CALLBACK config_dlgproc(HWND hdlg, UINT message, WPARAM wParam, LPAR
|
||||
h=GetDlgItem(hdlg, IDC_CHECKVOODOO);
|
||||
SendMessage(h, BM_SETCHECK, voodoo_enabled, 0);
|
||||
|
||||
h=GetDlgItem(hdlg, IDC_CHECKBUSLOGIC);
|
||||
SendMessage(h, BM_SETCHECK, buslogic_enabled, 0);
|
||||
|
||||
cpu_flags = models[romstomodel[romset]].cpu[cpu_manufacturer].cpus[cpu].cpu_flags;
|
||||
h=GetDlgItem(hdlg, IDC_CHECKDYNAREC);
|
||||
if (!(cpu_flags & CPU_SUPPORTS_DYNAREC) || (cpu_flags & CPU_REQUIRES_DYNAREC))
|
||||
@@ -401,6 +405,9 @@ static BOOL CALLBACK config_dlgproc(HWND hdlg, UINT message, WPARAM wParam, LPAR
|
||||
h = GetDlgItem(hdlg, IDC_CHECKVOODOO);
|
||||
temp_voodoo = SendMessage(h, BM_GETCHECK, 0, 0);
|
||||
|
||||
h = GetDlgItem(hdlg, IDC_CHECKBUSLOGIC);
|
||||
temp_buslogic = SendMessage(h, BM_GETCHECK, 0, 0);
|
||||
|
||||
h = GetDlgItem(hdlg, IDC_COMBOSND);
|
||||
temp_sound_card_current = settings_list_to_sound[SendMessage(h, CB_GETCURSEL, 0, 0)];
|
||||
|
||||
@@ -427,7 +434,7 @@ static BOOL CALLBACK config_dlgproc(HWND hdlg, UINT message, WPARAM wParam, LPAR
|
||||
if (temp_model != model || gfx != gfxcard || mem != mem_size || temp_cpu != cpu || temp_cpu_m != cpu_manufacturer ||
|
||||
fpu != hasfpu || temp_GAMEBLASTER != GAMEBLASTER || temp_GUS != GUS ||
|
||||
temp_SSI2001 != SSI2001 || temp_sound_card_current != sound_card_current ||
|
||||
temp_voodoo != voodoo_enabled || temp_dynarec != cpu_use_dynarec || temp_mouse_type != mouse_type ||
|
||||
temp_voodoo != voodoo_enabled || temp_buslogic != buslogic_enabled || temp_dynarec != cpu_use_dynarec || temp_mouse_type != mouse_type ||
|
||||
temp_fd1_type != fdd_get_type(0) || temp_fd2_type != fdd_get_type(1) || temp_fd3_type != fdd_get_type(2) || temp_fd4_type != fdd_get_type(3) || temp_network_card_current != network_card_current)
|
||||
{
|
||||
if (MessageBox(NULL,"This will reset 86Box!\nOkay to continue?","86Box",MB_OKCANCEL)==IDOK)
|
||||
@@ -444,6 +451,7 @@ static BOOL CALLBACK config_dlgproc(HWND hdlg, UINT message, WPARAM wParam, LPAR
|
||||
SSI2001 = temp_SSI2001;
|
||||
sound_card_current = temp_sound_card_current;
|
||||
voodoo_enabled = temp_voodoo;
|
||||
buslogic_enabled = temp_buslogic;
|
||||
cpu_use_dynarec = temp_dynarec;
|
||||
mouse_type = temp_mouse_type;
|
||||
|
||||
@@ -757,6 +765,10 @@ static BOOL CALLBACK config_dlgproc(HWND hdlg, UINT message, WPARAM wParam, LPAR
|
||||
deviceconfig_open(hdlg, (void *)&voodoo_device);
|
||||
break;
|
||||
|
||||
case IDC_CONFIGUREBUSLOGIC:
|
||||
deviceconfig_open(hdlg, (void *)&BuslogicDevice);
|
||||
break;
|
||||
|
||||
case IDC_COMBOJOY:
|
||||
if (HIWORD(wParam) == CBN_SELCHANGE)
|
||||
{
|
||||
|
||||
209
src/win.c
209
src/win.c
@@ -722,36 +722,6 @@ int WINAPI WinMain (HINSTANCE hThisInstance,
|
||||
|
||||
CheckMenuItem(menu, IDM_IDE_QUA_IRQ9 - 9 + ide_irq[3], MF_CHECKED);
|
||||
|
||||
if (buslogic_enabled)
|
||||
CheckMenuItem(menu, IDM_SCSI_ENABLED, MF_CHECKED);
|
||||
|
||||
if (!find_in_array(valid_models, scsi_model, 2, IDM_SCSI_MODEL0))
|
||||
{
|
||||
fatal("SCSI controller: Invalid model\n");
|
||||
}
|
||||
|
||||
CheckMenuItem(menu, IDM_SCSI_MODEL0 + scsi_model, MF_CHECKED);
|
||||
|
||||
if (!find_in_array(valid_bases, scsi_base, 6, IDM_SCSI_BASE130 - 0x130))
|
||||
{
|
||||
fatal("SCSI controller: Invalid base address\n");
|
||||
}
|
||||
|
||||
CheckMenuItem(menu, IDM_SCSI_BASE130 - 0x130 + scsi_base, MF_CHECKED);
|
||||
|
||||
if (!find_in_array(valid_irqs, scsi_irq, 6, IDM_SCSI_IRQ9 - 9))
|
||||
{
|
||||
fatal("SCSI controller: Invalid IRQ\n");
|
||||
}
|
||||
CheckMenuItem(menu, IDM_SCSI_IRQ9 - 9 + scsi_irq, MF_CHECKED);
|
||||
|
||||
if (!find_in_array(valid_dma_channels, scsi_dma, 3, IDM_SCSI_DMA5 - 5))
|
||||
{
|
||||
fatal("SCSI controller: Invalid DMA channel\n");
|
||||
}
|
||||
|
||||
CheckMenuItem(menu, IDM_SCSI_DMA5 - 5 + scsi_dma, MF_CHECKED);
|
||||
|
||||
#ifdef ENABLE_LOG_TOGGLES
|
||||
#ifdef ENABLE_BUSLOGIC_LOG
|
||||
CheckMenuItem(menu, IDM_LOG_BUSLOGIC, buslogic_do_log ? MF_CHECKED : MF_UNCHECKED);
|
||||
@@ -1157,103 +1127,6 @@ int ide_qua_set_irq(HMENU hmenu, int irq, int id)
|
||||
return 1;
|
||||
}
|
||||
|
||||
int scsi_set_model(HMENU hmenu, int model, int id)
|
||||
{
|
||||
if (scsi_model == model)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
if (MessageBox(NULL,"This will reset 86Box!\nOkay to continue?","86Box",MB_OKCANCEL) != IDOK)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
pause = 1;
|
||||
Sleep(100);
|
||||
scsi_model = model;
|
||||
CheckMenuItem(hmenu, IDM_SCSI_MODEL0, MF_UNCHECKED);
|
||||
CheckMenuItem(hmenu, IDM_SCSI_MODEL1, MF_UNCHECKED);
|
||||
CheckMenuItem(hmenu, id, MF_CHECKED);
|
||||
saveconfig();
|
||||
resetpchard();
|
||||
pause = 0;
|
||||
return 1;
|
||||
}
|
||||
|
||||
int scsi_set_base(HMENU hmenu, int base, int id)
|
||||
{
|
||||
if (scsi_base == base)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
if (MessageBox(NULL,"This will reset 86Box!\nOkay to continue?","86Box",MB_OKCANCEL) != IDOK)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
pause = 1;
|
||||
Sleep(100);
|
||||
scsi_base = base;
|
||||
CheckMenuItem(hmenu, IDM_SCSI_BASE130, MF_UNCHECKED);
|
||||
CheckMenuItem(hmenu, IDM_SCSI_BASE134, MF_UNCHECKED);
|
||||
CheckMenuItem(hmenu, IDM_SCSI_BASE230, MF_UNCHECKED);
|
||||
CheckMenuItem(hmenu, IDM_SCSI_BASE234, MF_UNCHECKED);
|
||||
CheckMenuItem(hmenu, IDM_SCSI_BASE330, MF_UNCHECKED);
|
||||
CheckMenuItem(hmenu, IDM_SCSI_BASE334, MF_UNCHECKED);
|
||||
CheckMenuItem(hmenu, id, MF_CHECKED);
|
||||
saveconfig();
|
||||
resetpchard();
|
||||
pause = 0;
|
||||
return 1;
|
||||
}
|
||||
|
||||
int scsi_set_irq(HMENU hmenu, int irq, int id)
|
||||
{
|
||||
if (scsi_irq == irq)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
if (MessageBox(NULL,"This will reset 86Box!\nOkay to continue?","86Box",MB_OKCANCEL) != IDOK)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
pause = 1;
|
||||
Sleep(100);
|
||||
scsi_irq = irq;
|
||||
CheckMenuItem(hmenu, IDM_SCSI_IRQ9, MF_UNCHECKED);
|
||||
CheckMenuItem(hmenu, IDM_SCSI_IRQ10, MF_UNCHECKED);
|
||||
CheckMenuItem(hmenu, IDM_SCSI_IRQ11, MF_UNCHECKED);
|
||||
CheckMenuItem(hmenu, IDM_SCSI_IRQ12, MF_UNCHECKED);
|
||||
CheckMenuItem(hmenu, IDM_SCSI_IRQ14, MF_UNCHECKED);
|
||||
CheckMenuItem(hmenu, IDM_SCSI_IRQ15, MF_UNCHECKED);
|
||||
CheckMenuItem(hmenu, id, MF_CHECKED);
|
||||
saveconfig();
|
||||
resetpchard();
|
||||
pause = 0;
|
||||
return 1;
|
||||
}
|
||||
|
||||
int scsi_set_dma(HMENU hmenu, int dma, int id)
|
||||
{
|
||||
if (scsi_dma == dma)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
if (MessageBox(NULL,"This will reset 86Box!\nOkay to continue?","86Box",MB_OKCANCEL) != IDOK)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
pause = 1;
|
||||
Sleep(100);
|
||||
scsi_dma = dma;
|
||||
CheckMenuItem(hmenu, IDM_SCSI_DMA5, MF_UNCHECKED);
|
||||
CheckMenuItem(hmenu, IDM_SCSI_DMA6, MF_UNCHECKED);
|
||||
CheckMenuItem(hmenu, IDM_SCSI_DMA7, MF_UNCHECKED);
|
||||
CheckMenuItem(hmenu, id, MF_CHECKED);
|
||||
saveconfig();
|
||||
resetpchard();
|
||||
pause = 0;
|
||||
return 1;
|
||||
}
|
||||
|
||||
void video_toggle_option(HMENU hmenu, int *val, int id)
|
||||
{
|
||||
*val ^= 1;
|
||||
@@ -1814,88 +1687,6 @@ LRESULT CALLBACK WindowProcedure (HWND hwnd, UINT message, WPARAM wParam, LPARAM
|
||||
ide_qua_set_irq(hmenu, 15, IDM_IDE_QUA_IRQ15);
|
||||
break;
|
||||
|
||||
case IDM_SCSI_ENABLED:
|
||||
if (MessageBox(NULL,"This will reset 86Box!\nOkay to continue?","86Box",MB_OKCANCEL) != IDOK)
|
||||
{
|
||||
break;
|
||||
}
|
||||
pause = 1;
|
||||
Sleep(100);
|
||||
buslogic_enabled ^= 1;
|
||||
CheckMenuItem(hmenu, IDM_SCSI_ENABLED, buslogic_enabled ? MF_CHECKED : MF_UNCHECKED);
|
||||
saveconfig();
|
||||
resetpchard();
|
||||
pause = 0;
|
||||
break;
|
||||
|
||||
case IDM_SCSI_MODEL0:
|
||||
scsi_set_model(hmenu, 0, IDM_SCSI_MODEL0);
|
||||
break;
|
||||
|
||||
case IDM_SCSI_MODEL1:
|
||||
scsi_set_model(hmenu, 1, IDM_SCSI_MODEL1);
|
||||
break;
|
||||
|
||||
case IDM_SCSI_BASE130:
|
||||
scsi_set_base(hmenu, 0x130, IDM_SCSI_BASE130);
|
||||
break;
|
||||
|
||||
case IDM_SCSI_BASE134:
|
||||
scsi_set_base(hmenu, 0x134, IDM_SCSI_BASE134);
|
||||
break;
|
||||
|
||||
case IDM_SCSI_BASE230:
|
||||
scsi_set_base(hmenu, 0x230, IDM_SCSI_BASE230);
|
||||
break;
|
||||
|
||||
case IDM_SCSI_BASE234:
|
||||
scsi_set_base(hmenu, 0x234, IDM_SCSI_BASE234);
|
||||
break;
|
||||
|
||||
case IDM_SCSI_BASE330:
|
||||
scsi_set_base(hmenu, 0x330, IDM_SCSI_BASE330);
|
||||
break;
|
||||
|
||||
case IDM_SCSI_BASE334:
|
||||
scsi_set_base(hmenu, 0x334, IDM_SCSI_BASE334);
|
||||
break;
|
||||
|
||||
case IDM_SCSI_IRQ9:
|
||||
scsi_set_irq(hmenu, 9, IDM_SCSI_IRQ9);
|
||||
break;
|
||||
|
||||
case IDM_SCSI_IRQ10:
|
||||
scsi_set_irq(hmenu, 10, IDM_SCSI_IRQ10);
|
||||
break;
|
||||
|
||||
case IDM_SCSI_IRQ11:
|
||||
scsi_set_irq(hmenu, 11, IDM_SCSI_IRQ11);
|
||||
break;
|
||||
|
||||
case IDM_SCSI_IRQ12:
|
||||
scsi_set_irq(hmenu, 12, IDM_SCSI_IRQ12);
|
||||
break;
|
||||
|
||||
case IDM_SCSI_IRQ14:
|
||||
scsi_set_irq(hmenu, 14, IDM_SCSI_IRQ14);
|
||||
break;
|
||||
|
||||
case IDM_SCSI_IRQ15:
|
||||
scsi_set_irq(hmenu, 15, IDM_SCSI_IRQ15);
|
||||
break;
|
||||
|
||||
case IDM_SCSI_DMA5:
|
||||
scsi_set_dma(hmenu, 5, IDM_SCSI_DMA5);
|
||||
break;
|
||||
|
||||
case IDM_SCSI_DMA6:
|
||||
scsi_set_dma(hmenu, 6, IDM_SCSI_DMA6);
|
||||
break;
|
||||
|
||||
case IDM_SCSI_DMA7:
|
||||
scsi_set_dma(hmenu, 7, IDM_SCSI_DMA7);
|
||||
break;
|
||||
|
||||
case IDM_CDROM_1_EMPTY:
|
||||
case IDM_CDROM_2_EMPTY:
|
||||
case IDM_CDROM_3_EMPTY:
|
||||
|
||||
Reference in New Issue
Block a user