From: Toni Wilen Date: Sat, 30 Aug 2014 12:34:05 +0000 (+0300) Subject: SCSI cleanups. X-Git-Tag: 3000~68 X-Git-Url: https://git.unchartedbackwaters.co.uk/w/?a=commitdiff_plain;h=686df906c80d566eea363e8a86fab1523fd40245;p=francis%2Fwinuae.git SCSI cleanups. --- diff --git a/cpuboard.cpp b/cpuboard.cpp index 84ad3d5b..4ea595c8 100644 --- a/cpuboard.cpp +++ b/cpuboard.cpp @@ -1473,6 +1473,7 @@ bool cpuboard_08000000(struct uae_prefs *p) case BOARD_CSMK3: case BOARD_CSPPC: case BOARD_WARPENGINE_A4000: + case BOARD_TEKMAGIC: return true; } return false; diff --git a/filesys.cpp b/filesys.cpp index 6df34119..4b008153 100644 --- a/filesys.cpp +++ b/filesys.cpp @@ -771,7 +771,7 @@ static void allocuci (struct uae_prefs *p, int nr, int idx) allocuci (p, nr, idx, -1); } -static bool add_cpuboard_scsi(int unit, struct uaedev_config_info *uci) +static bool add_cpuboard_scsi_unit(int unit, struct uaedev_config_info *uci) { bool added = false; #ifdef NCR @@ -799,6 +799,93 @@ static bool add_cpuboard_scsi(int unit, struct uaedev_config_info *uci) return added; } +static bool add_scsi_unit(int type, int unit, struct uaedev_config_info *uci) +{ + bool added = false; + if (type == HD_CONTROLLER_TYPE_SCSI_A2091) { +#ifdef A2091 + if (cfgfile_board_enabled(&currprefs.a2091rom)) { + a2091_add_scsi_unit (unit, uci, 0); + added = true; + } +#endif + } else if (type == HD_CONTROLLER_TYPE_SCSI_A2091_2) { +#ifdef A2091 + if (cfgfile_board_enabled(&currprefs.a2091rom)) { + a2091_add_scsi_unit (unit, uci, 1); + added = true; + } +#endif + } else if (type == HD_CONTROLLER_TYPE_SCSI_A3000) { +#ifdef A2091 + if (currprefs.cs_mbdmac == 1) { + a3000_add_scsi_unit (unit, uci); + added = true; + } +#endif + } else if (type == HD_CONTROLLER_TYPE_SCSI_A4091) { +#ifdef NCR + if (cfgfile_board_enabled(&currprefs.a4091rom)) { + a4091_add_scsi_unit (unit, uci, 0); + added = true; + } +#endif + } else if (type == HD_CONTROLLER_TYPE_SCSI_A4091_2) { +#ifdef NCR + if (cfgfile_board_enabled(&currprefs.a4091rom)) { + a4091_add_scsi_unit (unit, uci, 1); + added = true; + } +#endif + } else if (type == HD_CONTROLLER_TYPE_SCSI_FASTLANE) { +#ifdef NCR + if (cfgfile_board_enabled(&currprefs.fastlanerom)) { + fastlane_add_scsi_unit (unit, uci, 0); + added = true; + } +#endif + } else if (type == HD_CONTROLLER_TYPE_SCSI_FASTLANE_2) { +#ifdef NCR + if (cfgfile_board_enabled(&currprefs.fastlanerom)) { + fastlane_add_scsi_unit (unit, uci, 1); + added = true; + } +#endif + } else if (type == HD_CONTROLLER_TYPE_SCSI_OKTAGON) { +#ifdef NCR + if (cfgfile_board_enabled(&currprefs.oktagonrom)) { + oktagon_add_scsi_unit (unit, uci, 0); + added = true; + } +#endif + } else if (type == HD_CONTROLLER_TYPE_SCSI_OKTAGON_2) { +#ifdef NCR + if (cfgfile_board_enabled(&currprefs.oktagonrom)) { + oktagon_add_scsi_unit (unit, uci, 1); + added = true; + } +#endif + } else if (type == HD_CONTROLLER_TYPE_SCSI_CPUBOARD) { + added = add_cpuboard_scsi_unit(unit, uci); + } else if (type == HD_CONTROLLER_TYPE_SCSI_A4000T) { +#ifdef NCR + if (currprefs.cs_mbdmac == 2) { + a4000t_add_scsi_unit (unit, uci); + added = true; + } +#endif + } else if (type == HD_CONTROLLER_TYPE_SCSI_CDTV) { +#ifdef CDTV + if (currprefs.cs_cdtvscsi) { + cdtv_add_scsi_hd_unit (unit, uci); + added = true; + } +#endif + } + return added; +} + + static void initialize_mountinfo (void) { int nr; @@ -864,116 +951,13 @@ static void initialize_mountinfo (void) } else if (type >= HD_CONTROLLER_TYPE_IDE_FIRST && type <= HD_CONTROLLER_TYPE_IDE_LAST) { gayle_add_ide_unit (unit, uci); added = true; - } else if (type == HD_CONTROLLER_TYPE_SCSI_A2091) { -#ifdef A2091 - if (cfgfile_board_enabled(&currprefs.a2091rom)) { - a2091_add_scsi_unit (unit, uci, 0); - added = true; - } -#endif - } else if (type == HD_CONTROLLER_TYPE_SCSI_A2091_2) { -#ifdef A2091 - if (cfgfile_board_enabled(&currprefs.a2091rom)) { - a2091_add_scsi_unit (unit, uci, 1); - added = true; - } -#endif - } else if (type == HD_CONTROLLER_TYPE_SCSI_A3000) { -#ifdef A2091 - if (currprefs.cs_mbdmac == 1) { - a3000_add_scsi_unit (unit, uci); - added = true; - } -#endif - } else if (type == HD_CONTROLLER_TYPE_SCSI_A4091) { -#ifdef NCR - if (cfgfile_board_enabled(&currprefs.a4091rom)) { - a4091_add_scsi_unit (unit, uci, 0); - added = true; - } -#endif - } else if (type == HD_CONTROLLER_TYPE_SCSI_A4091_2) { -#ifdef NCR - if (cfgfile_board_enabled(&currprefs.a4091rom)) { - a4091_add_scsi_unit (unit, uci, 1); - added = true; - } -#endif - } else if (type == HD_CONTROLLER_TYPE_SCSI_FASTLANE) { -#ifdef NCR - if (cfgfile_board_enabled(&currprefs.fastlanerom)) { - fastlane_add_scsi_unit (unit, uci, 0); - added = true; - } -#endif - } else if (type == HD_CONTROLLER_TYPE_SCSI_FASTLANE_2) { -#ifdef NCR - if (cfgfile_board_enabled(&currprefs.fastlanerom)) { - fastlane_add_scsi_unit (unit, uci, 1); - added = true; - } -#endif - } else if (type == HD_CONTROLLER_TYPE_SCSI_OKTAGON) { -#ifdef NCR - if (cfgfile_board_enabled(&currprefs.oktagonrom)) { - oktagon_add_scsi_unit (unit, uci, 0); - added = true; - } -#endif - } else if (type == HD_CONTROLLER_TYPE_SCSI_OKTAGON_2) { -#ifdef NCR - if (cfgfile_board_enabled(&currprefs.oktagonrom)) { - oktagon_add_scsi_unit (unit, uci, 1); - added = true; - } -#endif - } else if (type == HD_CONTROLLER_TYPE_SCSI_CPUBOARD) { - - added = add_cpuboard_scsi(unit, uci); - - } else if (type == HD_CONTROLLER_TYPE_SCSI_A4000T) { -#ifdef NCR - if (currprefs.cs_mbdmac == 2) { - a4000t_add_scsi_unit (unit, uci); - added = true; - } -#endif - } else if (type == HD_CONTROLLER_TYPE_SCSI_CDTV) { -#ifdef CDTV - if (currprefs.cs_cdtvscsi) { - cdtv_add_scsi_hd_unit (unit, uci); - added = true; - } -#endif + } else if (type != HD_CONTROLLER_TYPE_SCSI_AUTO && type >= HD_CONTROLLER_TYPE_SCSI_FIRST && type <= HD_CONTROLLER_TYPE_SCSI_LAST) { + added = add_scsi_unit(type, unit, uci); } else if (type == HD_CONTROLLER_TYPE_SCSI_AUTO) { - if (currprefs.cs_mbdmac == 1) { -#ifdef A2091 - a3000_add_scsi_unit (unit, uci); - added = true; -#endif - } else if (currprefs.cs_mbdmac == 2) { -#ifdef NCR - a4000t_add_scsi_unit (unit, uci); - added = true; -#endif - } else if (cfgfile_board_enabled(&currprefs.a2091rom)) { -#ifdef A2091 - a2091_add_scsi_unit (unit, uci, 0); - added = true; -#endif - } else if (cfgfile_board_enabled(&currprefs.a4091rom)) { -#ifdef NCR - a4091_add_scsi_unit (unit, uci, 0); - added = true; -#endif - } else if (currprefs.cs_cdtvscsi) { -#ifdef CDTV - cdtv_add_scsi_hd_unit (unit, uci); - added = true; -#endif - } else if (currprefs.cpuboard_type) { - - added = add_cpuboard_scsi(unit, uci); + for (int st = HD_CONTROLLER_TYPE_SCSI_FIRST; st <= HD_CONTROLLER_TYPE_SCSI_LAST; st++) { + added = add_scsi_unit(st, unit, uci); + if (added) + break; } } else if (type == HD_CONTROLLER_TYPE_PCMCIA_SRAM) { gayle_add_pcmcia_sram_unit (uci->rootdir, uci->readonly); diff --git a/ncr9x_scsi.cpp b/ncr9x_scsi.cpp index 9a0e2361..155dbcc4 100644 --- a/ncr9x_scsi.cpp +++ b/ncr9x_scsi.cpp @@ -1127,36 +1127,29 @@ static int add_ncr_scsi_tape(struct ncr9x_state *ncr, int ch, const TCHAR *tape_ return ncr->scsid[ch] ? 1 : 0; } -int cpuboard_ncr9x_add_scsi_unit(int ch, struct uaedev_config_info *ci) +static int ncr9x_add_scsi_unit(struct ncr9x_state *ncr, int ch, struct uaedev_config_info *ci) { if (ci->type == UAEDEV_CD) - return add_ncr_scsi_cd(&ncr_blizzard_scsi, ch, ci->device_emu_unit); + return add_ncr_scsi_cd (ncr, ch, ci->device_emu_unit); else if (ci->type == UAEDEV_TAPE) - return add_ncr_scsi_tape(&ncr_blizzard_scsi, ch, ci->rootdir, ci->readonly); + return add_ncr_scsi_tape (ncr, ch, ci->rootdir, ci->readonly); else - return add_ncr_scsi_hd(&ncr_blizzard_scsi, ch, NULL, ci, 1); + return add_ncr_scsi_hd (ncr, ch, NULL, ci, 1); +} + +int cpuboard_ncr9x_add_scsi_unit(int ch, struct uaedev_config_info *ci) +{ + return ncr9x_add_scsi_unit(&ncr_blizzard_scsi, ch, ci); } int fastlane_add_scsi_unit (int ch, struct uaedev_config_info *ci, int devnum) { - struct ncr9x_state *ncr = &ncr_fastlane_scsi[devnum]; - if (ci->type == UAEDEV_CD) - return add_ncr_scsi_cd (ncr, ch, ci->device_emu_unit); - else if (ci->type == UAEDEV_TAPE) - return add_ncr_scsi_tape (ncr, ch, ci->rootdir, ci->readonly); - else - return add_ncr_scsi_hd (ncr, ch, NULL, ci, 1); + return ncr9x_add_scsi_unit(&ncr_fastlane_scsi[devnum], ch, ci); } int oktagon_add_scsi_unit (int ch, struct uaedev_config_info *ci, int devnum) { - struct ncr9x_state *ncr = &ncr_oktagon2008_scsi[devnum]; - if (ci->type == UAEDEV_CD) - return add_ncr_scsi_cd (ncr, ch, ci->device_emu_unit); - else if (ci->type == UAEDEV_TAPE) - return add_ncr_scsi_tape (ncr, ch, ci->rootdir, ci->readonly); - else - return add_ncr_scsi_hd (ncr, ch, NULL, ci, 1); + return ncr9x_add_scsi_unit(&ncr_oktagon2008_scsi[devnum], ch, ci); } #endif