Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch/mac68k/obio We do not match machines whose SWIM doe...
details: https://anonhg.NetBSD.org/src/rev/330db784bdf4
branches: trunk
changeset: 379136:330db784bdf4
user: hauke <hauke%NetBSD.org@localhost>
date: Thu May 13 08:47:21 2021 +0000
description:
We do not match machines whose SWIM does not support the IWM register
set used by this driver (SWIM II/III, SWIM behind IOP, AV models' DMA
based controllers). Unfortunately, this distinction does not run
cleanly along MACH_CLASS* lines, and we have to look at MACH_MAC{model} tags.
diffstat:
sys/arch/mac68k/obio/iwm_fd.c | 136 ++++++++++++++++++++---------------------
1 files changed, 66 insertions(+), 70 deletions(-)
diffs (209 lines):
diff -r a856023d0d80 -r 330db784bdf4 sys/arch/mac68k/obio/iwm_fd.c
--- a/sys/arch/mac68k/obio/iwm_fd.c Thu May 13 06:15:41 2021 +0000
+++ b/sys/arch/mac68k/obio/iwm_fd.c Thu May 13 08:47:21 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: iwm_fd.c,v 1.59 2021/04/24 23:36:41 thorpej Exp $ */
+/* $NetBSD: iwm_fd.c,v 1.60 2021/05/13 08:47:21 hauke Exp $ */
/*
* Copyright (c) 1997, 1998 Hauke Fath. All rights reserved.
@@ -32,7 +32,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: iwm_fd.c,v 1.59 2021/04/24 23:36:41 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: iwm_fd.c,v 1.60 2021/05/13 08:47:21 hauke Exp $");
#include "locators.h"
@@ -65,11 +65,6 @@
#include <mac68k/obio/iwmreg.h>
#include <mac68k/obio/iwm_fdvar.h>
-/**
- ** Private functions
- **/
-static int map_iwm_base(vm_offset_t);
-
/* Autoconfig */
int iwm_match(device_t, cfdata_t, void *);
void iwm_attach(device_t, device_t, void *);
@@ -78,6 +73,10 @@ int fd_match(device_t, cfdata_t, void *)
void fd_attach(device_t, device_t, void *);
int fd_print(void *, const char *);
+/**
+ ** Private functions
+ **/
+
/* Disklabel stuff */
static void fdGetDiskLabel(fd_softc_t *, dev_t);
static void fdPrintDiskLabel(struct disklabel *);
@@ -164,7 +163,7 @@ int iwmDebugging = 0 /* | M_TRACE_OP
** Module-global Variables
**/
-/* The IWM base address */
+/* The controller base address */
u_long IWMBase;
/*
@@ -273,30 +272,71 @@ struct dkdriver fd_dkDriver = {
* to match against. After all, that's what the obio concept is
* about: Onboard components that are present depending (only)
* on machine type.
+ *
+ * While here, map the machine-dependent physical IO address of IWM
+ * to VM address.
+ *
+ * We do not match, nor return an IWMBase address for machines whose
+ * SWIM does not support the IWM register set used by this driver
+ * (SWIM II/III, SWIM behind IOP, AV models' DMA based controllers).
+ * Unfortunately, this distinction does not run cleanly along
+ * MACH_CLASS* lines, and we will have to look at MACH_MAC{model} tags.
+ *
+ * See also "What chips are in what Macs?" at
+ * <http://bitsavers.org/pdf/apple/mac/mess/Mac_Technical_Notes.html>,
*/
int
iwm_match(device_t parent, cfdata_t match, void *aux)
{
- int matched;
+ int matched = 0;
extern u_long IOBase; /* from mac68k/machdep.c */
extern u_long IWMBase;
-
- if (0 == map_iwm_base(IOBase)) {
- /*
- * Unknown machine HW:
- * The SWIM II/III chips that are present in post-Q700
- * '040 Macs have dropped the IWM register structure.
- * We know next to nothing about the SWIM.
- */
+
+ IWMBase = 0L;
+
+ switch (current_mac_model->class) {
+ case MACH_CLASSPB: /* Not: 5x0, 190x */
+ if (current_mac_model->machineid == MACH_MACPB500 ||
+ current_mac_model->machineid == MACH_MACPB190 ||
+ current_mac_model->machineid == MACH_MACPB190CS)
+ break;
+ /* FALLTHROUGH */
+ case MACH_CLASSLC: /* Only: LC II, Classic II */
+ if (current_mac_model->machineid != MACH_MACLCII &&
+ current_mac_model->machineid != MACH_MACCLASSICII)
+ break;
+ /* FALLTHROUGH */
+ case MACH_CLASSII: /* All */
+ case MACH_CLASSIIci: /* All */
+ case MACH_CLASSIIsi: /* All */
+ case MACH_CLASSIIvx: /* All */
+ case MACH_CLASSDUO: /* All */
+ IWMBase = IOBase + 0x16000;
+ matched = 1;
+ break;
+ case MACH_CLASSQ: /* Only: 700 */
+ if (current_mac_model->machineid == MACH_MACQ700) {
+ IWMBase = IOBase + 0x1E000;
+ matched = 1;
+ break;
+ }
+ /* FALLTHROUGH */
+ case MACH_CLASSQ2: /* None */
+ case MACH_CLASSP580: /* None */
+ case MACH_CLASSIIfx: /* None */
+ case MACH_CLASSAV: /* None */
+ default:
+ IWMBase = 0L;
matched = 0;
- if (TRACE_CONFIG)
- printf("IWM or SWIM not found: Unknown location (SWIM II?).\n");
- } else {
- matched = 1;
- if (TRACE_CONFIG) {
- printf("iwm: IWMBase mapped to 0x%lx in VM.\n",
+ break;
+ }
+
+ if (TRACE_CONFIG) {
+ if (matched == 0)
+ printf("IWM or original SWIM not found.\n");
+ else
+ printf("IWMBase mapped to VM addr 0x%lx.\n",
IWMBase);
- }
}
return matched;
}
@@ -337,7 +377,7 @@ iwm_attach(device_t parent, device_t sel
if (TRACE_CONFIG)
printf("iwm: Initialization completed.\n");
} else {
- printf("iwm: Chip revision not supported (%d)\n", iwmErr);
+ printf("iwm: Initialization failed (%d)\n", iwmErr);
}
}
@@ -356,50 +396,6 @@ iwm_print(void *aux, const char *control
}
-/*
- * map_iwm_base
- *
- * Map physical IO address of IWM to VM address
- */
-static int
-map_iwm_base(vm_offset_t base)
-{
- int known;
- extern u_long IWMBase;
-
- switch (current_mac_model->class) {
- case MACH_CLASSQ:
- case MACH_CLASSQ2:
- case MACH_CLASSP580:
- IWMBase = base + 0x1E000;
- known = 1;
- break;
- case MACH_CLASSII:
- case MACH_CLASSPB:
- case MACH_CLASSDUO:
- case MACH_CLASSIIci:
- case MACH_CLASSIIsi:
- case MACH_CLASSIIvx:
- case MACH_CLASSLC:
- IWMBase = base + 0x16000;
- known = 1;
- break;
- case MACH_CLASSIIfx:
- case MACH_CLASSAV:
- default:
- /*
- * Neither IIfx/Q9[05]0 style IOP controllers nor
- * Q[68]40AV DMA based controllers are supported.
- */
- if (TRACE_CONFIG)
- printf("Unknown floppy controller chip.\n");
- IWMBase = 0L;
- known = 0;
- break;
- }
- return known;
-}
-
/*** Configure Sony disk drive(s) ***/
@@ -1504,9 +1500,9 @@ remap_geometry(daddr_t block, int heads,
int zone, spt;
extern diskZone_t diskZones[];
- spt = 0; /* XXX Shut up egcs warning */
loc->oldTrack = loc->track;
loc->track = 0;
+ spt = 0;
for (zone = 0; zone < IWM_GCR_DISK_ZONES; zone++) {
if (block >= heads * (diskZones[zone].lastBlock + 1)) {
Home |
Main Index |
Thread Index |
Old Index