2017-06-14 03:03:29 +02:00
|
|
|
/*
|
|
|
|
|
* 86Box A hypervisor and IBM PC system emulator that specializes in
|
|
|
|
|
* running old operating systems and software designed for IBM
|
|
|
|
|
* PC systems and compatibles from 1981 through fairly recent
|
|
|
|
|
* system designs based on the PCI bus.
|
|
|
|
|
*
|
|
|
|
|
* This file is part of the 86Box distribution.
|
|
|
|
|
*
|
|
|
|
|
* Handling of the SCSI controllers.
|
|
|
|
|
*
|
2018-11-08 19:21:55 +01:00
|
|
|
* Version: @(#)scsi.c 1.0.25 2018/10/31
|
2017-06-14 03:03:29 +02:00
|
|
|
*
|
2017-12-15 00:46:37 -05:00
|
|
|
* Authors: Miran Grca, <mgrca8@gmail.com>
|
2017-08-22 21:28:22 +02:00
|
|
|
* Fred N. van Kempen, <decwiz@yahoo.com>
|
2017-12-15 00:46:37 -05:00
|
|
|
* TheCollector1995, <mariogplayer@gmail.com>
|
2017-10-14 20:04:21 -04:00
|
|
|
*
|
2018-01-26 22:17:09 +01:00
|
|
|
* Copyright 2016-2018 Miran Grca.
|
|
|
|
|
* Copyright 2017,2018 Fred N. van Kempen.
|
2017-06-14 03:03:29 +02:00
|
|
|
*/
|
2018-05-21 19:04:05 +02:00
|
|
|
#include <stdarg.h>
|
2017-09-25 04:31:20 -04:00
|
|
|
#include <stdint.h>
|
2018-05-21 19:04:05 +02:00
|
|
|
#include <stdio.h>
|
2016-11-12 15:06:38 +01:00
|
|
|
#include <string.h>
|
2017-09-25 04:31:20 -04:00
|
|
|
#include <stdlib.h>
|
|
|
|
|
#include <wchar.h>
|
2018-05-21 19:04:05 +02:00
|
|
|
#define HAVE_STDARG_H
|
2017-08-27 00:58:44 +02:00
|
|
|
#include "../86box.h"
|
|
|
|
|
#include "../device.h"
|
2017-10-02 02:15:35 -04:00
|
|
|
#include "../disk/hdc.h"
|
2018-07-15 01:41:53 +02:00
|
|
|
#include "../disk/hdd.h"
|
2017-10-14 07:03:19 +02:00
|
|
|
#include "../plat.h"
|
2016-11-12 15:06:38 +01:00
|
|
|
#include "scsi.h"
|
2018-10-02 22:54:28 +02:00
|
|
|
#include "scsi_device.h"
|
2018-04-25 23:51:13 +02:00
|
|
|
#include "../cdrom/cdrom.h"
|
2018-07-15 01:41:53 +02:00
|
|
|
#include "../disk/zip.h"
|
|
|
|
|
#include "scsi_disk.h"
|
2017-05-07 23:42:05 -04:00
|
|
|
#include "scsi_aha154x.h"
|
2017-05-05 01:49:42 +02:00
|
|
|
#include "scsi_buslogic.h"
|
2017-10-08 05:04:38 +02:00
|
|
|
#include "scsi_ncr5380.h"
|
2018-10-30 13:32:25 +01:00
|
|
|
#include "scsi_ncr53c8xx.h"
|
2017-12-15 01:04:01 -05:00
|
|
|
#ifdef WALTJE
|
|
|
|
|
# include "scsi_wd33c93.h"
|
|
|
|
|
#endif
|
2017-05-05 01:49:42 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
int scsi_card_current = 0;
|
|
|
|
|
int scsi_card_last = 0;
|
|
|
|
|
|
|
|
|
|
|
2018-03-19 01:02:04 +01:00
|
|
|
typedef const struct {
|
|
|
|
|
const char *name;
|
|
|
|
|
const char *internal_name;
|
|
|
|
|
const device_t *device;
|
2017-05-05 01:49:42 +02:00
|
|
|
} SCSI_CARD;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static SCSI_CARD scsi_cards[] = {
|
2018-11-08 19:21:55 +01:00
|
|
|
{ "None", "none", NULL, },
|
|
|
|
|
{ "[ISA] Adaptec AHA-1540B", "aha1540b", &aha1540b_device, },
|
|
|
|
|
{ "[ISA] Adaptec AHA-1542C", "aha1542c", &aha1542c_device, },
|
|
|
|
|
{ "[ISA] Adaptec AHA-1542CF", "aha1542cf", &aha1542cf_device, },
|
|
|
|
|
{ "[ISA] BusLogic BT-542BH", "bt542bh", &buslogic_device, },
|
|
|
|
|
{ "[ISA] BusLogic BT-545S", "bt545s", &buslogic_545s_device, },
|
|
|
|
|
{ "[ISA] Longshine LCS-6821N", "lcs6821n", &scsi_lcs6821n_device, },
|
|
|
|
|
{ "[ISA] Ranco RT1000B", "rt1000b", &scsi_rt1000b_device, },
|
|
|
|
|
{ "[ISA] Trantor T130B", "t130b", &scsi_t130b_device, },
|
|
|
|
|
{ "[ISA] Sumo SCSI-AT", "scsiat", &scsi_scsiat_device, },
|
2017-12-15 00:46:37 -05:00
|
|
|
#ifdef WALTJE
|
2018-11-08 19:21:55 +01:00
|
|
|
{ "[ISA] Generic WDC33C93", "wd33c93", &scsi_wd33c93_device, },
|
2017-12-15 00:46:37 -05:00
|
|
|
#endif
|
2018-11-08 19:21:55 +01:00
|
|
|
{ "[MCA] Adaptec AHA-1640", "aha1640", &aha1640_device, },
|
|
|
|
|
{ "[MCA] BusLogic BT-640A", "bt640a", &buslogic_640a_device, },
|
|
|
|
|
{ "[PCI] BusLogic BT-958D", "bt958d", &buslogic_pci_device, },
|
|
|
|
|
{ "[PCI] NCR 53C810", "ncr53c810", &ncr53c810_pci_device, },
|
|
|
|
|
{ "[PCI] NCR 53C825A", "ncr53c825a", &ncr53c825a_pci_device, },
|
|
|
|
|
{ "[PCI] NCR 53C875", "ncr53c875", &ncr53c875_pci_device, },
|
|
|
|
|
{ "[VLB] BusLogic BT-445S", "bt445s", &buslogic_445s_device, },
|
|
|
|
|
{ "", "", NULL, },
|
2017-05-05 01:49:42 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int scsi_card_available(int card)
|
|
|
|
|
{
|
|
|
|
|
if (scsi_cards[card].device)
|
|
|
|
|
return(device_available(scsi_cards[card].device));
|
|
|
|
|
|
|
|
|
|
return(1);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
char *scsi_card_getname(int card)
|
|
|
|
|
{
|
2018-02-18 10:32:51 +01:00
|
|
|
return((char *) scsi_cards[card].name);
|
2017-05-05 01:49:42 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2018-03-19 01:02:04 +01:00
|
|
|
const device_t *scsi_card_getdevice(int card)
|
2017-05-05 01:49:42 +02:00
|
|
|
{
|
|
|
|
|
return(scsi_cards[card].device);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int scsi_card_has_config(int card)
|
|
|
|
|
{
|
|
|
|
|
if (! scsi_cards[card].device) return(0);
|
|
|
|
|
|
|
|
|
|
return(scsi_cards[card].device->config ? 1 : 0);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
char *scsi_card_get_internal_name(int card)
|
|
|
|
|
{
|
2018-02-18 10:32:51 +01:00
|
|
|
return((char *) scsi_cards[card].internal_name);
|
2017-05-05 01:49:42 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int scsi_card_get_from_internal_name(char *s)
|
|
|
|
|
{
|
|
|
|
|
int c = 0;
|
|
|
|
|
|
2018-02-18 10:32:51 +01:00
|
|
|
while (strlen((char *) scsi_cards[c].internal_name)) {
|
|
|
|
|
if (!strcmp((char *) scsi_cards[c].internal_name, s))
|
2017-05-05 01:49:42 +02:00
|
|
|
return(c);
|
|
|
|
|
c++;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return(0);
|
|
|
|
|
}
|
|
|
|
|
|
2016-12-23 17:11:59 +01:00
|
|
|
|
2017-08-24 01:14:39 -04:00
|
|
|
void scsi_card_init(void)
|
2017-05-05 01:49:42 +02:00
|
|
|
{
|
2018-07-15 01:41:53 +02:00
|
|
|
int i;
|
2018-10-30 13:32:25 +01:00
|
|
|
scsi_device_t *dev;
|
2017-08-22 21:28:22 +02:00
|
|
|
|
2018-04-25 23:51:13 +02:00
|
|
|
if (!scsi_cards[scsi_card_current].device)
|
|
|
|
|
return;
|
|
|
|
|
|
2018-10-10 22:33:24 +02:00
|
|
|
for (i = 0; i < SCSI_ID_MAX; i++) {
|
2018-10-30 13:32:25 +01:00
|
|
|
dev = &(scsi_devices[i]);
|
2018-10-10 22:33:24 +02:00
|
|
|
|
2018-10-30 13:32:25 +01:00
|
|
|
memset(dev, 0, sizeof(scsi_device_t));
|
|
|
|
|
dev->type = SCSI_NONE;
|
2017-08-22 21:28:22 +02:00
|
|
|
}
|
|
|
|
|
|
2018-04-25 23:51:13 +02:00
|
|
|
device_add(scsi_cards[scsi_card_current].device);
|
2017-05-05 01:49:42 +02:00
|
|
|
|
|
|
|
|
scsi_card_last = scsi_card_current;
|
|
|
|
|
}
|