SCSI controller is now once again reset on soft reset, but this time this is handled in a more appropriate way;

Fixed some copyright headers.
This commit is contained in:
OBattler
2017-06-14 03:03:29 +02:00
parent eb02faea83
commit eb8b8e3766
11 changed files with 115 additions and 40 deletions

View File

@@ -34,6 +34,7 @@
#include "../mem.h"
#include "../nmi.h"
#include "../pic.h"
#include "../scsi.h"
#include "../timer.h"
int xt_cpu_multi;
@@ -599,6 +600,7 @@ void resetx86()
codegen_reset();
x86_was_reset = 1;
port_92_clear_reset();
scsi_card_reset();
}
void softresetx86()
@@ -618,6 +620,7 @@ void softresetx86()
x86seg_reset();
x86_was_reset = 1;
port_92_clear_reset();
scsi_card_reset();
}
static void setznp8(uint8_t val)

View File

@@ -1,4 +1,4 @@
/* Copyright holders: The DOSBox Team, SA1988
/* Copyright holders: Sarah Walker, SA1988
see COPYING for more details
*/
#include "dbopl.h"

View File

@@ -1,4 +1,4 @@
/* Copyright holders: The DOSBox Team, SA1988
/* Copyright holders: Sarah Walker, SA1988
see COPYING for more details
*/
#ifdef __cplusplus

View File

@@ -73,6 +73,22 @@ void device_close_all()
}
}
void *device_get_priv(device_t *d)
{
int c;
for (c = 0; c < 256; c++)
{
if (devices[c] != NULL)
{
if (devices[c] == d)
return device_priv[c];
}
}
return NULL;
}
int device_available(device_t *d)
{
#ifdef RELEASE_BUILD

View File

@@ -72,6 +72,7 @@ typedef struct device_t
extern void device_init(void);
extern void device_add(device_t *d);
extern void device_close_all(void);
extern void *device_get_priv(device_t *d);
extern int device_available(device_t *d);
extern void device_speed_changed(void);
extern void device_force_redraw(void);

View File

@@ -1,7 +1,21 @@
/* Copyright holders: SA1988, Tenshi
see COPYING for more details
*/
/*SCSI layer emulation*/
/*
* 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.
*
* NOTE: THIS IS CURRENTLY A MESS, but will be cleaned up as I go.
*
* Version: @(#)scsi.c 1.0.0 2017/06/14
*
* Authors: Fred N. van Kempen, <decwiz@yahoo.com>
* Original Buslogic version by SA1988 and Miran Grca.
* Copyright 2017 Fred N. van Kempen.
*/
#include <stdlib.h>
#include <string.h>
#include "86box.h"
@@ -28,17 +42,18 @@ typedef struct {
char name[64];
char internal_name[32];
device_t *device;
void (*reset)(void *p);
} SCSI_CARD;
static SCSI_CARD scsi_cards[] = {
{ "None", "none", NULL },
{ "Adaptec AHA-1540B", "aha1540b", &aha1540b_device },
{ "Adaptec AHA-1542CF", "aha1542cf", &aha1542cf_device },
{ "Adaptec AHA-1640", "aha1640", &aha1640_device },
{ "BusLogic BT-542B", "bt542b", &buslogic_device },
{ "BusLogic BT-958D PCI", "bt958d", &buslogic_pci_device },
{ "", "", NULL }
{ "None", "none", NULL, NULL },
{ "Adaptec AHA-1540B", "aha1540b", &aha1540b_device, aha_device_reset },
{ "Adaptec AHA-1542CF", "aha1542cf", &aha1542cf_device, aha_device_reset },
{ "Adaptec AHA-1640", "aha1640", &aha1640_device, aha_device_reset },
{ "BusLogic BT-542B", "bt542b", &buslogic_device, BuslogicDeviceReset },
{ "BusLogic BT-958D PCI", "bt958d", &buslogic_pci_device, BuslogicDeviceReset },
{ "", "", NULL, NULL },
};
@@ -100,6 +115,24 @@ void scsi_card_init()
}
void scsi_card_reset(void)
{
void *p = NULL;
if (scsi_cards[scsi_card_current].device)
{
p = device_get_priv(scsi_cards[scsi_card_current].device);
if (p)
{
if (scsi_cards[scsi_card_current].reset)
{
scsi_cards[scsi_card_current].reset(p);
}
}
}
}
/* Initialization function for the SCSI layer */
void SCSIReset(uint8_t id, uint8_t lun)
{

View File

@@ -260,6 +260,7 @@ int scsi_card_has_config(int card);
char *scsi_card_get_internal_name(int card);
int scsi_card_get_from_internal_name(char *s);
void scsi_card_init();
void scsi_card_reset(void);
extern uint8_t scsi_hard_disks[16][8];

View File

@@ -12,7 +12,7 @@
*
* NOTE: THIS IS CURRENTLY A MESS, but will be cleaned up as I go.
*
* Version: @(#)scsi_aha154x.c 1.0.6 2017/05/06
* Version: @(#)scsi_aha154x.c 1.0.7 2017/06/14
*
* Authors: Fred N. van Kempen, <decwiz@yahoo.com>
* Original Buslogic version by SA1988 and Miran Grca.
@@ -179,6 +179,32 @@ static uint16_t aha_ports[] = {
0x0130, 0x0134, 0x0000, 0x0000
};
#ifdef WALTJE
int aha_do_log = 1;
# define ENABLE_AHA154X_LOG
#else
int aha_do_log = 0;
#endif
static void
aha_log(const char *format, ...)
{
#ifdef ENABLE_AHA154X_LOG
va_list ap;
if (aha_do_log) {
va_start(ap, format);
vprintf(format, ap);
va_end(ap);
fflush(stdout);
}
#endif
}
#define pclog aha_log
/*
* Write data to the BIOS space.
*
@@ -839,31 +865,6 @@ enum {
};
#ifdef WALTJE
int aha_do_log = 1;
# define ENABLE_AHA154X_LOG
#else
int aha_do_log = 0;
#endif
static void
aha_log(const char *format, ...)
{
#ifdef ENABLE_AHA154X_LOG
va_list ap;
if (aha_do_log) {
va_start(ap, format);
vprintf(format, ap);
va_end(ap);
fflush(stdout);
}
#endif
}
#define pclog aha_log
static void
ClearIntr(aha_t *dev)
{
@@ -2168,6 +2169,14 @@ void aha_mca_write(int port, uint8_t val, void *p)
}
void
aha_device_reset(void *p)
{
aha_t *dev = (aha_t *) p;
aha_reset_ctrl(dev, 1);
}
static void *
aha_init(int chip, int has_bios)
{

View File

@@ -13,6 +13,8 @@ typedef struct {
extern device_t aha1540b_device;
extern device_t aha1542cf_device;
extern device_t aha1640_device;
extern void aha_device_reset(void *p);
#endif /*SCSI_AHA154X_H*/

View File

@@ -10,7 +10,7 @@
* 0 - BT-542B ISA;
* 1 - BT-958 PCI (but BT-542B ISA on non-PCI machines)
*
* Version: @(#)scsi_buslogic.c 1.0.3 2017/06/03
* Version: @(#)scsi_buslogic.c 1.0.4 2017/06/14
*
* Authors: TheCollector1995, <mariogplayer@gmail.com>
* Miran Grca, <mgrca8@gmail.com>
@@ -2226,6 +2226,14 @@ BuslogicPCIWrite(int func, int addr, uint8_t val, void *p)
}
void
BuslogicDeviceReset(void *p)
{
Buslogic_t *dev = (Buslogic_t *) p;
BuslogicResetControl(dev, 1);
}
static void *
BuslogicInit(int chip)
{

View File

@@ -23,6 +23,8 @@
extern device_t buslogic_device;
extern device_t buslogic_pci_device;
extern void BuslogicDeviceReset(void *p);
#endif /*SCSI_BUSLOGIC_H*/