|
|
@@ -11,6 +11,7 @@
|
|
|
extern "C" {
|
|
|
|
|
|
const char *g_azplatform_name = PLATFORM_NAME;
|
|
|
+static bool g_enable_apple_quirks = false;
|
|
|
|
|
|
/*************************/
|
|
|
/* Timing functions */
|
|
|
@@ -195,6 +196,12 @@ void azplatform_late_init()
|
|
|
g_azlog_debug = false;
|
|
|
}
|
|
|
|
|
|
+ if (gpio_input_bit_get(DIP_PORT, DIPSW1_PIN))
|
|
|
+ {
|
|
|
+ azlog("DIPSW1 is ON: enabling Apple quirks by default");
|
|
|
+ g_enable_apple_quirks = true;
|
|
|
+ }
|
|
|
+
|
|
|
greenpak_load_firmware();
|
|
|
}
|
|
|
|
|
|
@@ -434,6 +441,67 @@ void azplatform_boot_to_main_firmware()
|
|
|
"r" (mainprogram_start[1]) : "memory");
|
|
|
}
|
|
|
|
|
|
+/**************************************/
|
|
|
+/* SCSI configuration based on DIPSW1 */
|
|
|
+/**************************************/
|
|
|
+
|
|
|
+void azplatform_config_hook(S2S_TargetCfg *config)
|
|
|
+{
|
|
|
+ if (g_enable_apple_quirks)
|
|
|
+ {
|
|
|
+ if (config->quirks == S2S_CFG_QUIRKS_NONE)
|
|
|
+ {
|
|
|
+ config->quirks = S2S_CFG_QUIRKS_APPLE;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (config->quirks == S2S_CFG_QUIRKS_APPLE)
|
|
|
+ {
|
|
|
+ static const char *driveinfo_fixed[4] = APPLE_DRIVEINFO_FIXED;
|
|
|
+ static const char *driveinfo_removable[4] = APPLE_DRIVEINFO_REMOVABLE;
|
|
|
+ static const char *driveinfo_optical[4] = APPLE_DRIVEINFO_OPTICAL;
|
|
|
+ static const char *driveinfo_floppy[4] = APPLE_DRIVEINFO_FLOPPY;
|
|
|
+ static const char *driveinfo_magopt[4] = APPLE_DRIVEINFO_MAGOPT;
|
|
|
+ static const char *driveinfo_tape[4] = APPLE_DRIVEINFO_TAPE;
|
|
|
+ const char **driveinfo = NULL;
|
|
|
+
|
|
|
+ switch (config->deviceType)
|
|
|
+ {
|
|
|
+ case S2S_CFG_FIXED: driveinfo = driveinfo_fixed; break;
|
|
|
+ case S2S_CFG_REMOVEABLE: driveinfo = driveinfo_removable; break;
|
|
|
+ case S2S_CFG_OPTICAL: driveinfo = driveinfo_optical; break;
|
|
|
+ case S2S_CFG_FLOPPY_14MB: driveinfo = driveinfo_floppy; break;
|
|
|
+ case S2S_CFG_MO: driveinfo = driveinfo_magopt; break;
|
|
|
+ case S2S_CFG_SEQUENTIAL: driveinfo = driveinfo_tape; break;
|
|
|
+ default: driveinfo = driveinfo_fixed; break;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (config->vendor[0] == '\0')
|
|
|
+ {
|
|
|
+ memset(config->vendor, 0, sizeof(config->vendor));
|
|
|
+ strncpy(config->vendor, driveinfo[0], sizeof(config->vendor));
|
|
|
+ }
|
|
|
+
|
|
|
+ if (config->prodId[0] == '\0')
|
|
|
+ {
|
|
|
+ memset(config->prodId, 0, sizeof(config->prodId));
|
|
|
+ strncpy(config->prodId, driveinfo[1], sizeof(config->prodId));
|
|
|
+ }
|
|
|
+
|
|
|
+ if (config->revision[0] == '\0')
|
|
|
+ {
|
|
|
+ memset(config->revision, 0, sizeof(config->revision));
|
|
|
+ strncpy(config->revision, driveinfo[2], sizeof(config->revision));
|
|
|
+ }
|
|
|
+
|
|
|
+ if (config->serial[0] == '\0')
|
|
|
+ {
|
|
|
+ memset(config->serial, 0, sizeof(config->serial));
|
|
|
+ strncpy(config->serial, driveinfo[3], sizeof(config->serial));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
/**********************************************/
|
|
|
/* Mapping from data bytes to GPIO BOP values */
|
|
|
/**********************************************/
|