]> git.unchartedbackwaters.co.uk Git - francis/winuae.git/commitdiff
SCSI cleanups.
authorToni Wilen <twilen@winuae.net>
Sat, 30 Aug 2014 12:34:05 +0000 (15:34 +0300)
committerToni Wilen <twilen@winuae.net>
Sat, 30 Aug 2014 12:34:05 +0000 (15:34 +0300)
cpuboard.cpp
filesys.cpp
ncr9x_scsi.cpp

index 84ad3d5bad75a097e20e6bb9e1d28e6a4b172238..4ea595c8b7c0e15c39e4d44171363982d5650034 100644 (file)
@@ -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;
index 6df34119b0666fb3a75f7e4fc7900f5e3f6145cc..4b008153e86e592b2645a2c5646d0582ed011b22 100644 (file)
@@ -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);
index 9a0e23616dc968b52049a77a1254353ed5103bf7..155dbcc456ececec75943b5afe03c229388d4e5a 100644 (file)
@@ -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