More changes and cleanups to the cdrom/scsi layers.

Several small fixes to the previous commit (IDE works again ;-)
First attempt at "bringing back" the Host CDROM (formerly "ioctl") module.
This commit is contained in:
waltje
2018-10-18 02:20:23 -04:00
parent 8471941cb7
commit 80ca36536d
62 changed files with 2284 additions and 2024 deletions

View File

@@ -8,7 +8,7 @@
*
* Handling of the SCSI controllers.
*
* Version: @(#)scsi.c 1.0.12 2018/10/14
* Version: @(#)scsi.c 1.0.13 2018/10/16
*
* Authors: Fred N. van Kempen, <decwiz@yahoo.com>
* Miran Grca, <mgrca8@gmail.com>
@@ -42,7 +42,7 @@
#include <stdarg.h>
#include <wchar.h>
#define HAVE_STDARG_H
#define dbglog scsi_log
#define dbglog scsi_card_log
#include "../../emu.h"
#include "../../device.h"
#include "../../plat.h"
@@ -61,11 +61,8 @@
#endif
#ifdef ENABLE_SCSI_LOG
int scsi_do_log = ENABLE_SCSI_LOG;
#endif
#ifdef ENABLE_SCSI_DEV_LOG
int scsi_dev_do_log = ENABLE_SCSI_DEV_LOG;
int scsi_card_do_log = ENABLE_SCSI_DEV_LOG;
#endif
@@ -151,27 +148,12 @@ scsi_card_has_config(int card)
void
scsi_log(int level, const char *fmt, ...)
{
#ifdef ENABLE_SCSI_LOG
va_list ap;
if (scsi_do_log >= level) {
va_start(ap, fmt);
pclog_ex(fmt, ap);
va_end(ap);
}
#endif
}
void
scsi_dev_log(int level, const char *fmt, ...)
scsi_card_log(int level, const char *fmt, ...)
{
#ifdef ENABLE_SCSI_DEV_LOG
va_list ap;
if (scsi_dev_do_log >= level) {
if (scsi_card_do_log >= level) {
va_start(ap, fmt);
pclog_ex(fmt, ap);
va_end(ap);

View File

@@ -8,7 +8,7 @@
*
* SCSI module definitions.
*
* Version: @(#)scsi.h 1.0.8 2018/10/05
* Version: @(#)scsi.h 1.0.9 2018/10/16
*
* Authors: Fred N. van Kempen, <decwiz@yahoo.com>
* Miran Grca, <mgrca8@gmail.com>
@@ -39,7 +39,7 @@
#define EMU_SCSI_H
extern void scsi_log(int level, const char *fmt, ...);
extern void scsi_card_log(int level, const char *fmt, ...);
extern int scsi_card_available(int card);
extern const char *scsi_card_getname(int card);

View File

@@ -10,7 +10,7 @@
* made by Adaptec, Inc. These controllers were designed for
* the ISA bus.
*
* Version: @(#)scsi_aha154x.c 1.0.10 2018/10/05
* Version: @(#)scsi_aha154x.c 1.0.11 2018/10/16
*
* Based on original code from TheCollector1995 and Miran Grca.
*
@@ -44,7 +44,7 @@
#include <string.h>
#include <stdlib.h>
#include <wchar.h>
#define dbglog scsi_dev_log
#define dbglog scsi_card_log
#include "../../emu.h"
#include "../../io.h"
#include "../../mem.h"
@@ -56,8 +56,9 @@
#include "../system/dma.h"
#include "../system/pic.h"
#include "../system/mca.h"
#include "scsi_device.h"
#include "scsi.h"
#include "scsi_aha154x.h"
#include "scsi_device.h"
#include "scsi_x54x.h"

View File

@@ -13,7 +13,7 @@
* 1 - BT-545S ISA;
* 2 - BT-958D PCI
*
* Version: @(#)scsi_buslogic.c 1.0.12 2018/10/14
* Version: @(#)scsi_buslogic.c 1.0.13 2018/10/16
*
* Authors: Fred N. van Kempen, <decwiz@yahoo.com>
* Miran Grca, <mgrca8@gmail.com>
@@ -45,7 +45,7 @@
#include <string.h>
#include <stdlib.h>
#include <wchar.h>
#define dbglog scsi_dev_log
#define dbglog scsi_card_log
#include "../../emu.h"
#include "../../io.h"
#include "../../mem.h"

File diff suppressed because it is too large Load Diff

View File

@@ -8,7 +8,7 @@
*
* Definitions for the SCSI CD-ROM module.
*
* Version: @(#)scsi_cdrom.h 1.0.1 2018/10/14
* Version: @(#)scsi_cdrom.h 1.0.2 2018/10/17
*
* Authors: Fred N. van Kempen, <decwiz@yahoo.com>
* Miran Grca, <mgrca8@gmail.com>
@@ -75,21 +75,17 @@ typedef struct {
uint8_t previous_command,
pad3, pad4, pad5;
} scsi_cdrom_t;
extern scsi_cdrom_t *scsi_cdrom[CDROM_NUM];
#endif
#define scsi_cdrom_sense_error dev->sense[0]
#define scsi_cdrom_sense_key dev->sense[2]
#define scsi_cdrom_asc dev->sense[12]
#define scsi_cdrom_ascq dev->sense[13]
#define scsi_cdrom_drive cdrom[id].host_drive
extern void scsi_cdrom_log(int level, const char *fmt, ...);
extern void scsi_cdrom_reset(void *p);
//extern void scsi_cdrom_reset(void *p);
#endif /*EMU_SCSI_CDROM_H*/

View File

@@ -8,7 +8,7 @@
*
* The generic SCSI device command handler.
*
* Version: @(#)scsi_device.c 1.0.9 2018/10/16
* Version: @(#)scsi_device.c 1.0.11 2018/10/16
*
* Authors: Fred N. van Kempen, <decwiz@yahoo.com>
* Miran Grca, <mgrca8@gmail.com>
@@ -38,6 +38,8 @@
#include <stdint.h>
#include <string.h>
#include <wchar.h>
#include <stdarg.h>
#define HAVE_STDARG_H
#define dbglog scsi_log
#include "../../emu.h"
#include "../../device.h"
@@ -46,8 +48,13 @@
#include "scsi_device.h"
#ifdef ENABLE_SCSI_LOG
int scsi_do_log = ENABLE_SCSI_LOG;
#endif
scsi_device_t scsi_devices[SCSI_ID_MAX][SCSI_LUN_MAX];
const uint8_t scsi_null_device_sense[18] = {
static const uint8_t scsi_null_device_sense[18] = {
0x70,0,SENSE_ILLEGAL_REQUEST,0,0,0,0,0,0,0,0,0,ASC_INV_LUN,0,0,0,0,0
};
@@ -193,3 +200,18 @@ scsi_device_get_buf_len(scsi_device_t *dev)
{
return &dev->buffer_length;
}
void
scsi_log(int level, const char *fmt, ...)
{
#ifdef ENABLE_SCSI_LOG
va_list ap;
if (scsi_do_log >= level) {
va_start(ap, fmt);
pclog_ex(fmt, ap);
va_end(ap);
}
#endif
}

View File

@@ -8,7 +8,7 @@
*
* Definitions for the generic SCSI device command handler.
*
* Version: @(#)scsi_device.h 1.0.5 2018/10/16
* Version: @(#)scsi_device.h 1.0.6 2018/10/16
*
* Authors: Fred N. van Kempen, <decwiz@yahoo.com>
* Miran Grca, <mgrca8@gmail.com>
@@ -292,18 +292,6 @@
#define SCSI_REMOVABLE_CDROM 0x8005
#if 0
typedef struct {
uint8_t command[20];
int state, new_state,
clear_req, dev_id,
command_pos, data_pos,
change_state_delay,
new_req_delay;
uint32_t bus_in, bus_out;
} scsi_bus_t;
#endif
typedef struct {
uint8_t id, lun;
uint16_t type;
@@ -362,7 +350,7 @@ typedef struct {
extern scsi_device_t scsi_devices[SCSI_ID_MAX][SCSI_LUN_MAX];
extern void scsi_dev_log(int level, const char *fmt, ...);
extern void scsi_log(int level, const char *fmt, ...);
extern int cdrom_add_error_and_subchannel(uint8_t *b, int real_sector_type);
extern int cdrom_LBAtoMSF_accurate(void);

View File

@@ -11,7 +11,7 @@
*
* NOTE: This code now only supports targets at LUN=0 !!
*
* Version: @(#)scsi_ncr5380.c 1.0.11 2018/10/14
* Version: @(#)scsi_ncr5380.c 1.0.12 2018/10/16
*
* Authors: Fred N. van Kempen, <decwiz@yahoo.com>
* Miran Grca, <mgrca8@gmail.com>
@@ -46,7 +46,7 @@
#include <string.h>
#include <stdlib.h>
#include <wchar.h>
#define dbglog scsi_dev_log
#define dbglog scsi_card_log
#include "../../emu.h"
#include "../../io.h"
#include "../../mem.h"

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.11 2018/10/14
* Version: @(#)scsi_ncr53c810.c 1.0.12 2018/10/16
*
* Authors: Fred N. van Kempen, <decwiz@yahoo.com>
* Miran Grca, <mgrca8@gmail.com>
@@ -46,7 +46,7 @@
#include <string.h>
#include <stdlib.h>
#include <wchar.h>
#define dbglog scsi_dev_log
#define dbglog scsi_card_log
#include "../../emu.h"
#include "../../io.h"
#include "../../mem.h"

View File

@@ -12,7 +12,7 @@
*
* These controllers were designed for various buses.
*
* Version: @(#)scsi_x54x.c 1.0.14 2018/10/16
* Version: @(#)scsi_x54x.c 1.0.15 2018/10/16
*
* Authors: Fred N. van Kempen, <decwiz@yahoo.com>
* Miran Grca, <mgrca8@gmail.com>
@@ -45,7 +45,7 @@
#include <string.h>
#include <stdlib.h>
#include <wchar.h>
#define dbglog scsi_dev_log
#define dbglog scsi_card_log
#include "../../emu.h"
#include "../../io.h"
#include "../../mem.h"