Cleanup of the logging options. Logging menu is now submenu of Tools.

Other minor changes and cleanups, as needed.
This commit is contained in:
waltje
2018-04-03 03:34:42 -04:00
parent dfda1677d7
commit d7fe41de69
39 changed files with 1935 additions and 1205 deletions

View File

@@ -8,7 +8,7 @@
*
* Handling of the SCSI controllers.
*
* Version: @(#)scsi.c 1.0.4 2018/03/19
* Version: @(#)scsi.c 1.0.5 2018/04/02
*
* Authors: Fred N. van Kempen, <decwiz@yahoo.com>
* Miran Grca, <mgrca8@gmail.com>
@@ -39,7 +39,9 @@
#include <stdint.h>
#include <string.h>
#include <stdlib.h>
#include <stdarg.h>
#include <wchar.h>
#define HAVE_STDARG_H
#include "../emu.h"
#include "../mem.h"
#include "../rom.h"
@@ -60,6 +62,9 @@
#include "scsi_x54x.h"
#ifdef ENABLE_SCSI_DEV_LOG
int scsi_dev_do_log = ENABLE_SCSI_DEV_LOG;
#endif
scsi_device_t SCSIDevices[SCSI_ID_MAX][SCSI_LUN_MAX];
#if 0
uint8_t SCSIPhase = 0xff;
@@ -107,6 +112,21 @@ static SCSI_CARD scsi_cards[] = {
};
void
scsi_dev_log(const char *fmt, ...)
{
#ifdef ENABLE_SCSI_DEV_LOG
va_list ap;
if (scsi_dev_do_log) {
va_start(ap, fmt);
pclog_ex(fmt, ap);
va_end(ap);
}
#endif
}
int
scsi_card_available(int card)
{

View File

@@ -8,7 +8,7 @@
*
* SCSI controller handler header.
*
* Version: @(#)scsi.h 1.0.4 2018/03/21
* Version: @(#)scsi.h 1.0.5 2018/04/02
*
* Authors: Fred N. van Kempen, <decwiz@yahoo.com>
* Miran Grca, <mgrca8@gmail.com>
@@ -39,7 +39,7 @@
#define EMU_SCSI_H
#define SCSI_TIME (5 * 100 * (1 << TIMER_SHIFT))
#define SCSI_TIME (5 * 100 * (1 << TIMER_SHIFT))
/* Configuration. */
@@ -308,29 +308,31 @@ extern int mode_select_terminate(int force);
extern int mode_select_write(uint8_t val);
extern int scsi_card_current;
extern uint8_t scsi_disks[16][8];
extern int scsi_card_available(int card);
extern char *scsi_card_getname(int card);
extern void scsi_dev_log(const char *fmt, ...);
extern int scsi_card_available(int card);
extern char *scsi_card_getname(int card);
#ifdef EMU_DEVICE_H
extern const device_t *scsi_card_getdevice(int card);
#endif
extern int scsi_card_has_config(int card);
extern char *scsi_card_get_internal_name(int card);
extern int scsi_card_get_from_internal_name(char *s);
extern void scsi_mutex(uint8_t start);
extern void scsi_card_init(void);
extern void scsi_card_reset(void);
extern int scsi_card_has_config(int card);
extern char *scsi_card_get_internal_name(int card);
extern int scsi_card_get_from_internal_name(char *s);
extern void scsi_mutex(uint8_t start);
extern void scsi_mutex_wait(uint8_t wait);
extern void scsi_card_init(void);
extern void scsi_card_reset(void);
extern uint8_t scsi_disks[16][8];
extern int scsi_hd_err_stat_to_scsi(uint8_t id);
extern int scsi_hd_phase_to_scsi(uint8_t id);
extern int find_hdc_for_scsi_id(uint8_t scsi_id, uint8_t scsi_lun);
extern void build_scsi_hd_map(void);
extern void scsi_hd_reset(uint8_t id);
extern void scsi_hd_request_sense_for_scsi(uint8_t id, uint8_t *buffer, uint8_t alloc_length);
extern void scsi_hd_command(uint8_t id, uint8_t *cdb);
extern void scsi_hd_callback(uint8_t id);
extern int scsi_hd_err_stat_to_scsi(uint8_t id);
extern int scsi_hd_phase_to_scsi(uint8_t id);
extern int find_hdc_for_scsi_id(uint8_t scsi_id, uint8_t scsi_lun);
extern void build_scsi_hd_map(void);
extern void scsi_hd_reset(uint8_t id);
extern void scsi_hd_request_sense_for_scsi(uint8_t id, uint8_t *buffer, uint8_t alloc_length);
extern void scsi_hd_command(uint8_t id, uint8_t *cdb);
extern void scsi_hd_callback(uint8_t id);
#pragma pack(push,1)
@@ -381,7 +383,4 @@ typedef struct {
#define MODE_SELECT_PHASE_PAGE 4
extern void scsi_mutex_wait(uint8_t wait);
#endif /*EMU_SCSI_H*/

View File

@@ -10,7 +10,7 @@
* made by Adaptec, Inc. These controllers were designed for
* the ISA bus.
*
* Version: @(#)scsi_aha154x.c 1.0.6 2018/03/31
* Version: @(#)scsi_aha154x.c 1.0.7 2018/04/02
*
* Based on original code from TheCollector1995 and Miran Grca.
*
@@ -43,9 +43,7 @@
#include <stdint.h>
#include <string.h>
#include <stdlib.h>
#include <stdarg.h>
#include <wchar.h>
#define HAVE_STDARG_H
#include "../emu.h"
#include "../io.h"
#include "../mca.h"
@@ -63,6 +61,8 @@
#include "scsi_x54x.h"
#define aha_log scsi_dev_log
#define AHA1540B_330_BIOS_PATH L"scsi/adaptec/aha1540b320_330.bin"
#define AHA1540B_334_BIOS_PATH L"scsi/adaptec/aha1540b320_334.bin"
#define AHA1540C_BIOS_PATH L"scsi/adaptec/aha1542c102.bin"
@@ -109,26 +109,6 @@ typedef struct {
#pragma pack(pop)
#ifdef ENABLE_AHA154X_LOG
int aha_do_log = ENABLE_AHA154X_LOG;
#endif
static void
aha_log(const char *fmt, ...)
{
#ifdef ENABLE_AHA154X_LOG
va_list ap;
if (aha_do_log) {
va_start(ap, fmt);
pclog_ex(fmt, ap);
va_end(ap);
}
#endif
}
/*
* Write data to the BIOS space.
*

View File

@@ -13,7 +13,7 @@
* 1 - BT-545S ISA;
* 2 - BT-958D PCI
*
* Version: @(#)scsi_buslogic.c 1.0.8 2018/03/31
* Version: @(#)scsi_buslogic.c 1.0.9 2018/04/02
*
* Authors: Fred N. van Kempen, <decwiz@yahoo.com>
* Miran Grca, <mgrca8@gmail.com>
@@ -44,9 +44,7 @@
#include <stdint.h>
#include <string.h>
#include <stdlib.h>
#include <stdarg.h>
#include <wchar.h>
#define HAVE_STDARG_H
#include "../emu.h"
#include "../io.h"
#include "../mca.h"
@@ -66,6 +64,8 @@
#include "scsi_x54x.h"
#define buslogic_log scsi_dev_log
#define BT542_BIOS_PATH L"scsi/buslogic/bt-542bh_bios.rom"
#define BT545_BIOS_PATH L"scsi/buslogic/bt-545s_bios.rom"
#define BT545_AUTO_BIOS_PATH L"scsi/buslogic/bt-545s_autoscsi.rom"
@@ -259,26 +259,6 @@ enum {
};
#ifdef ENABLE_BUSLOGIC_LOG
int buslogic_do_log = ENABLE_BUSLOGIC_LOG;
#endif
static void
buslogic_log(const char *fmt, ...)
{
#ifdef ENABLE_BUSLOGIC_LOG
va_list ap;
if (buslogic_do_log) {
va_start(ap, fmt);
pclog_ex(fmt, ap);
va_end(ap);
}
#endif
}
static wchar_t *
GetNVRFileName(buslogic_data_t *bl)
{

View File

@@ -9,7 +9,7 @@
* Implementation of the NCR 5380 series of SCSI Host Adapters
* made by NCR. These controllers were designed for the ISA bus.
*
* Version: @(#)scsi_ncr5380.c 1.0.5 2018/03/31
* Version: @(#)scsi_ncr5380.c 1.0.6 2018/04/02
*
* Authors: Fred N. van Kempen, <decwiz@yahoo.com>
* Miran Grca, <mgrca8@gmail.com>
@@ -42,9 +42,7 @@
#include <stdint.h>
#include <string.h>
#include <stdlib.h>
#include <stdarg.h>
#include <wchar.h>
#define HAVE_STDARG_H
#include "../emu.h"
#include "../cpu/cpu.h"
#include "../io.h"
@@ -62,6 +60,8 @@
#include "scsi_ncr5380.h"
#define ncr_log scsi_dev_log
#define LCS6821N_ROM L"scsi/ncr5380/longshine lcs-6821n - bios version 1.04.bin"
#define RT1000B_ROM L"scsi/ncr5380/rancho_rt1000_rtbios_version_8.10r.bin"
#define T130B_ROM L"scsi/ncr5380/trantor_t130b_bios_v2.14.bin"
@@ -176,26 +176,6 @@ enum {
};
#ifdef ENABLE_NCR5380_LOG
int ncr5380_do_log = ENABLE_NCR5380_LOG;
#endif
static void
ncr_log(const char *fmt, ...)
{
#ifdef ENABLE_NCR5380_LOG
va_list ap;
if (ncr5380_do_log) {
va_start(ap, fmt);
pclog_ex(fmt, ap);
va_end(ap);
}
#endif
}
static void
dma_changed(void *priv, int mode, int enable)
{
@@ -251,7 +231,7 @@ ncr_write(uint16_t port, uint8_t val, void *priv)
ncr5380_t *ncr = &scsi->ncr;
int bus_host = 0;
#if ENABLE_NCR5380_LOG
#ifdef ENABLE_SCSI_DEV_LOG
ncr_log("NCR5380 write(%04x,%02x) @%04X:%04X\n",port,val,CS,cpu_state.pc);
#endif
switch (port & 7) {
@@ -394,7 +374,7 @@ ncr_read(uint16_t port, void *priv)
break;
}
#if ENABLE_NCR5380_LOG
#ifdef ENABLE_SCSI_DEV_LOG
ncr_log("NCR5380 read(%04x)=%02x @%04X:%04X\n", port, ret, CS,cpu_state.pc);
#endif
return(ret);
@@ -537,7 +517,7 @@ memio_read(uint32_t addr, void *priv)
uint8_t ret = 0xff;
addr &= 0x3fff;
#if ENABLE_NCR5380_LOG
#ifdef ENABLE_SCSI_DEV_LOG
ncr_log("memio_read %08x\n", addr);
#endif
@@ -549,21 +529,21 @@ memio_read(uint32_t addr, void *priv)
ret = scsi->ext_ram[addr - 0x3a00];
else switch (addr & 0x3f80) {
case 0x3800:
#if ENABLE_NCR5380_LOG
#ifdef ENABLE_SCSI_DEV_LOG
ncr_log("Read intRAM %02x %02x\n", addr & 0x3f, scsi->int_ram[addr & 0x3f]);
#endif
ret = scsi->int_ram[addr & 0x3f];
break;
case 0x3880:
#if ENABLE_NCR5380_LOG
#ifdef ENABLE_SCSI_DEV_LOG
ncr_log("Read 53c80 %04x\n", addr);
#endif
ret = ncr_read(addr, scsi);
break;
case 0x3900:
#if ENABLE_NCR5380_LOG
#ifdef ENABLE_SCSI_DEV_LOG
ncr_log(" Read 3900 %i %02x\n", scsi->buffer_host_pos, scsi->status_ctrl);
#endif
if (scsi->buffer_host_pos >= 128 || !(scsi->status_ctrl & CTRL_DATA_DIR))
@@ -599,7 +579,7 @@ memio_read(uint32_t addr, void *priv)
break;
}
#if ENABLE_NCR5380_LOG
#ifdef ENABLE_SCSI_DEV_LOG
if (addr >= 0x3880)
ncr_log("memio_read(%08x)=%02x\n", addr, ret);
#endif
@@ -616,7 +596,7 @@ memio_write(uint32_t addr, uint8_t val, void *priv)
addr &= 0x3fff;
#if ENABLE_NCR5380_LOG
#ifdef ENABLE_SCSI_DEV_LOG
ncr_log("memio_write(%08x,%02x) @%04X:%04X %i %02x\n", addr, val, CS,cpu_state.pc, scsi->buffer_host_pos, scsi->status_ctrl);
#endif
@@ -631,7 +611,7 @@ memio_write(uint32_t addr, uint8_t val, void *priv)
break;
case 0x3880:
#if ENABLE_NCR5380_LOG
#ifdef ENABLE_SCSI_DEV_LOG
ncr_log("Write 53c80 %04x %02x\n", addr, val);
#endif
ncr_write(addr, val, scsi);

View File

@@ -10,7 +10,7 @@
* NCR and later Symbios and LSI. This controller was designed
* for the PCI bus.
*
* Version: @(#)scsi_ncr53c810.c 1.0.5 2018/03/15
* Version: @(#)scsi_ncr53c810.c 1.0.7 2018/04/02
*
* Authors: Fred N. van Kempen, <decwiz@yahoo.com>
* Miran Grca, <mgrca8@gmail.com>
@@ -45,7 +45,6 @@
#include <stdint.h>
#include <string.h>
#include <stdlib.h>
#include <stdarg.h>
#include <wchar.h>
#include "../emu.h"
#include "../io.h"
@@ -63,6 +62,8 @@
#include "scsi_ncr53c810.h"
#define ncr53c810_log scsi_dev_log
#define NCR_SCNTL0_TRG 0x01
#define NCR_SCNTL0_AAP 0x02
#define NCR_SCNTL0_EPC 0x08
@@ -295,26 +296,6 @@ typedef struct {
} ncr53c810_t;
#ifdef ENABLE_NCR53C810_LOG
int ncr53c810_do_log = ENABLE_NCR53C810_LOG;
#endif
static void
ncr53c810_log(const char *fmt, ...)
{
#ifdef ENABLE_NCR53C810_LOG
va_list ap;
if (ncr53c810_do_log) {
va_start(ap, fmt);
pclog_ex(fmt, ap);
va_end(ap);
}
#endif
}
static uint8_t ncr53c810_reg_readb(ncr53c810_t *dev, uint32_t offset);
static void ncr53c810_reg_writeb(ncr53c810_t *dev, uint32_t offset, uint8_t val);

View File

@@ -12,7 +12,7 @@
*
* These controllers were designed for various buses.
*
* Version: @(#)scsi_x54x.c 1.0.8 2018/03/15
* Version: @(#)scsi_x54x.c 1.0.9 2018/04/02
*
* Authors: Fred N. van Kempen, <decwiz@yahoo.com>
* Miran Grca, <mgrca8@gmail.com>
@@ -68,23 +68,23 @@
#define X54X_RESET_DURATION_US UINT64_C(50000)
static void x54x_cmd_callback(void *priv);
static x54x_t *x54x_dev;
#ifdef ENABLE_X54X_LOG
int x54x_do_log = ENABLE_X54X_LOG;
#ifdef ENABLE_SCSI_X54X_LOG
int scsi_x54x_do_log = ENABLE_SCSI_X54X_LOG;
#endif
static void x54x_cmd_callback(void *priv);
static x54x_t *x54x_dev;
static void
x54x_log(const char *fmt, ...)
{
#ifdef ENABLE_X54X_LOG
#ifdef ENABLE_SCSI_X54X_LOG
va_list ap;
if (x54x_do_log) {
if (scsi_x54x_do_log) {
// for debug, temporary
pclog("In %s mode: ",(msw&1)?((eflags&VM_FLAG)?"V86":"protected"):"real");
va_start(ap, fmt);