Change to logging - when logging is disabled, the logging functions are now #define'd to nothing, so the compiler ignores the lines that call them completely, seems to slightly speed up the emulator; note that the logging in vid_table.c has not been changed yet, because this file on my local tree currently contains other WIP changes.

This commit is contained in:
OBattler
2018-10-19 00:39:32 +02:00
parent d56df03a53
commit cfc626f111
78 changed files with 658 additions and 590 deletions

View File

@@ -10,7 +10,7 @@
* made by Adaptec, Inc. These controllers were designed for
* the ISA bus.
*
* Version: @(#)scsi_aha154x.c 1.0.43 2018/10/02
* Version: @(#)scsi_aha154x.c 1.0.44 2018/10/18
*
* Authors: Fred N. van Kempen, <decwiz@yahoo.com>
* Original Buslogic version by SA1988 and Miran Grca.
@@ -82,13 +82,11 @@ typedef struct {
#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) {
@@ -96,8 +94,10 @@ aha_log(const char *fmt, ...)
pclog_ex(fmt, ap);
va_end(ap);
}
#endif
}
#else
#define aha_log(fmt, ...)
#endif
/*

View File

@@ -11,7 +11,7 @@
* 1 - BT-545S ISA;
* 2 - BT-958D PCI
*
* Version: @(#)scsi_buslogic.c 1.0.40 2018/10/09
* Version: @(#)scsi_buslogic.c 1.0.41 2018/10/18
*
* Authors: TheCollector1995, <mariogplayer@gmail.com>
* Miran Grca, <mgrca8@gmail.com>
@@ -240,13 +240,11 @@ 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) {
@@ -254,8 +252,10 @@ buslogic_log(const char *fmt, ...)
pclog_ex(fmt, ap);
va_end(ap);
}
#endif
}
#else
#define buslogic_log(fmt, ...)
#endif
static wchar_t *
@@ -590,7 +590,9 @@ BuslogicSCSIBIOSRequestSetup(x54x_t *dev, uint8_t *CmdBuf, uint8_t *DataInBuf, u
uint32_t i;
uint8_t temp_cdb[12];
int target_cdb_len = 12;
#ifdef ENABLE_BUSLOGIC_LOG
uint8_t target_id = 0;
#endif
int phase;
scsi_device_t *sd = &scsi_devices[ESCSICmd->TargetId];
@@ -1112,7 +1114,9 @@ static uint8_t
BuslogicPCIRead(int func, int addr, void *p)
{
x54x_t *dev = (x54x_t *)p;
#ifdef ENABLE_BUSLOGIC_LOG
buslogic_data_t *bl = (buslogic_data_t *) dev->ven_data;
#endif
buslogic_log("BT-958D: Reading register %02X\n", addr & 0xff);

View File

@@ -6,7 +6,7 @@
*
* Emulation of SCSI fixed disks.
*
* Version: @(#)scsi_disk.c 1.0.24 2018/10/09
* Version: @(#)scsi_disk.c 1.0.25 2018/10/18
*
* Author: Miran Grca, <mgrca8@gmail.com>
*
@@ -145,13 +145,11 @@ static void scsi_disk_callback(void *p);
#ifdef ENABLE_SCSI_DISK_LOG
int scsi_disk_do_log = ENABLE_SCSI_DISK_LOG;
#endif
static void
scsi_disk_log(const char *fmt, ...)
{
#ifdef ENABLE_SCSI_DISK_LOG
va_list ap;
if (scsi_disk_do_log) {
@@ -159,8 +157,10 @@ scsi_disk_log(const char *fmt, ...)
pclog_ex(fmt, ap);
va_end(ap);
}
#endif
}
#else
#define scsi_disk_log(fmt, ...)
#endif
/* Translates ATAPI status (ERR_STAT flag) to SCSI status. */
@@ -555,7 +555,9 @@ static void
scsi_disk_command(void *p, uint8_t *cdb)
{
scsi_disk_t *dev = (scsi_disk_t *) p;
#ifdef ENABLE_SCSI_DISK_LOG
uint8_t *hdbufferb;
#endif
int32_t *BufLen;
int32_t len, max_len, alloc_length;
int pos = 0;
@@ -566,7 +568,9 @@ scsi_disk_command(void *p, uint8_t *cdb)
char device_identify_ex[15] = { '8', '6', 'B', '_', 'H', 'D', '0', '0', ' ', 'v', '1', '.', '0', '0', 0 };
int block_desc = 0;
#ifdef ENABLE_SCSI_DISK_LOG
hdbufferb = scsi_devices[dev->drv->scsi_id].cmd_buffer;
#endif
BufLen = &scsi_devices[dev->drv->scsi_id].buffer_length;
last_sector = hdd_image_get_last_sector(dev->id);

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.22 2018/10/09
* Version: @(#)scsi_ncr5380.c 1.0.23 2018/10/18
*
* Authors: Sarah Walker, <http://pcem-emulator.co.uk/>
* TheCollector1995, <mariogplayer@gmail.com>
@@ -170,13 +170,11 @@ static int cmd_len[8] = {6, 10, 10, 6, 16, 12, 6, 6};
#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) {
@@ -184,8 +182,11 @@ ncr_log(const char *fmt, ...)
pclog_ex(fmt, ap);
va_end(ap);
}
#endif
}
#else
#define ncr_log(fmt, ...)
#endif
#define SET_BUS_STATE(ncr, state) ncr->cur_bus = (ncr->cur_bus & ~(SCSI_PHASE_MESSAGE_IN)) | (state & (SCSI_PHASE_MESSAGE_IN))

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.15 2018/10/09
* Version: @(#)scsi_ncr53c810.c 1.0.16 2018/10/18
*
* Authors: Paul Brook (QEMU)
* Artyom Tarasenko (QEMU)
@@ -282,13 +282,11 @@ typedef struct {
#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) {
@@ -296,8 +294,10 @@ ncr53c810_log(const char *fmt, ...)
pclog_ex(fmt, ap);
va_end(ap);
}
#endif
}
#else
#define ncr53c810_log(fmt, ...)
#endif
static uint8_t ncr53c810_reg_readb(ncr53c810_t *dev, uint32_t offset);
@@ -829,12 +829,16 @@ ncr53c810_do_msgout(ncr53c810_t *dev, uint8_t id)
{
uint8_t msg;
int len;
#ifdef ENABLE_NCR53C810_LOG
uint32_t current_tag;
#endif
scsi_device_t *sd;
sd = &scsi_devices[id];
#ifdef ENABLE_NCR53C810_LOG
current_tag = id;
#endif
ncr53c810_log("MSG out len=%d\n", dev->dbc);
while (dev->dbc) {
@@ -952,7 +956,10 @@ ncr53c810_process_script(ncr53c810_t *dev)
uint32_t insn, addr, id, buf[2], dest;
int opcode, insn_processed = 0, reg, operator, cond, jmp, n, i, c;
int32_t offset;
uint8_t op0, op1, data8, mask, data[7], *pp;
uint8_t op0, op1, data8, mask, data[7];
#ifdef ENABLE_NCR53C810_LOG
uint8_t *pp;
#endif
dev->sstop = 0;
again:
@@ -1278,7 +1285,9 @@ again:
dev->dsp += 4;
ncr53c810_memcpy(dev, dest, addr, insn & 0xffffff);
} else {
#ifdef ENABLE_NCR53C810_LOG
pp = data;
#endif
if (insn & (1 << 28))
addr = dev->dsa + sextract32(addr, 0, 24);

View File

@@ -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.24 2018/10/11
* Version: @(#)scsi_x54x.c 1.0.25 2018/10/18
*
* Authors: TheCollector1995, <mariogplayer@gmail.com>
* Miran Grca, <mgrca8@gmail.com>
@@ -57,13 +57,11 @@ x54x_t *x54x_dev;
#ifdef ENABLE_X54X_LOG
int x54x_do_log = ENABLE_X54X_LOG;
#endif
static void
x54x_log(const char *fmt, ...)
{
#ifdef ENABLE_X54X_LOG
va_list ap;
if (x54x_do_log) {
@@ -72,8 +70,10 @@ x54x_log(const char *fmt, ...)
pclog_ex(fmt, ap);
va_end(ap);
}
#endif
}
#else
#define x54x_log(fmt, ...)
#endif
static void
@@ -952,7 +952,10 @@ static void
x54x_scsi_cmd(x54x_t *dev)
{
Req_t *req = &dev->Req;
uint8_t id, lun, phase, bit24 = !!req->Is24bit;
uint8_t id, phase, bit24 = !!req->Is24bit;
#ifdef ENABLE_X54X_LOG
uint8_t lun;
#endif
uint8_t temp_cdb[12];
uint32_t i, SenseBufferAddress;
int target_data_len, target_cdb_len = 12;
@@ -962,7 +965,9 @@ x54x_scsi_cmd(x54x_t *dev)
id = req->TargetID;
sd = &scsi_devices[id];
#ifdef ENABLE_X54X_LOG
lun = req->LUN;
#endif
target_cdb_len = 12;
target_data_len = x54x_get_length(req, bit24);