Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/arch/atari Determine the default floppy type on the TT/F...



details:   https://anonhg.NetBSD.org/src/rev/477618dafb44
branches:  trunk
changeset: 480195:477618dafb44
user:      leo <leo%NetBSD.org@localhost>
date:      Thu Jan 06 12:14:33 2000 +0000

description:
Determine the default floppy type on the TT/Falcon by reading the config
switches. (Thanks to Michael Schwingen for the missing bits of information!).

diffstat:

 sys/arch/atari/dev/fd.c        |  45 +++++++++++++++++++++++++++++++++++++++--
 sys/arch/atari/include/iomap.h |   4 +-
 2 files changed, 44 insertions(+), 5 deletions(-)

diffs (95 lines):

diff -r 648af5356a20 -r 477618dafb44 sys/arch/atari/dev/fd.c
--- a/sys/arch/atari/dev/fd.c   Thu Jan 06 12:03:31 2000 +0000
+++ b/sys/arch/atari/dev/fd.c   Thu Jan 06 12:14:33 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: fd.c,v 1.29 1999/08/06 08:27:30 leo Exp $      */
+/*     $NetBSD: fd.c,v 1.30 2000/01/06 12:14:33 leo Exp $      */
 
 /*
  * Copyright (c) 1995 Leo Weppelman.
@@ -174,8 +174,19 @@
                { 2, 18, 2880 , FLP_HD , "1.44MB" },    /* 1.44 Mb      */
 };
 
+#define        FLP_TYPE_360    0               /* XXX: Please keep these in    */
+#define        FLP_TYPE_720    1               /* sync with the numbering in   */
+#define        FLP_TYPE_144    2               /* 'fdtypes' right above!       */
+
+/*
+ * This is set only once at attach time. The value is determined by reading
+ * the configuration switches and is one of the FLP_TYPE_*'s. 
+ * This is simular to the way Atari handles the _FLP cookie.
+ */
+static short   def_type = 0;           /* Reflects config-switches     */
+
 #define        FLP_DEFTYPE     1               /* 720Kb, reasonable default    */
-#define        FLP_TYPE(dev)   ( DISKPART(dev) == 0 ? FLP_DEFTYPE : DISKPART(dev) - 1 )
+#define        FLP_TYPE(dev)   ( DISKPART(dev) == 0 ? def_type : DISKPART(dev) - 1 )
 
 typedef void   (*FPV) __P((void *));
 
@@ -231,6 +242,25 @@
 }
 
 /*
+ * Config switch stuff. Used only for the floppy type for now. That's
+ * why it's here...
+ * XXX: If needed in more places, it should be moved to it's own include file.
+ * Note: This location _must_ be read as an u_short. Failure to do so
+ *       will return garbage!
+ */
+static u_short rd_cfg_switch __P((void));
+static u_short rd_cfg_switch(void)
+{
+       return(*((u_short*)AD_CFG_SWITCH));
+}
+
+/*
+ * Switch definitions.
+ * Note: ON reads as a zero bit!
+ */
+#define        CFG_SWITCH_NOHD 0x4000
+
+/*
  * Autoconfig stuff....
  */
 extern struct cfdriver fd_cd;
@@ -341,10 +371,19 @@
 void           *auxp;
 {
        struct fd_softc *sc;
-       struct fd_types *type = &fdtypes[FLP_DEFTYPE]; /* XXX: switches??? */
+       struct fd_types *type;
+       u_short         swtch;
 
        sc = (struct fd_softc *)dp;
 
+       /*
+        * Find out if an Ajax chip might be installed. Set the default
+        * floppy type accordingly.
+        */
+       swtch    = rd_cfg_switch();
+       def_type = (swtch & CFG_SWITCH_NOHD) ? FLP_TYPE_720 : FLP_TYPE_144;
+       type     = &fdtypes[def_type];
+
        printf(": %s %d cyl, %d head, %d sec\n", type->descr,
                type->nblocks / (type->nsectors * type->nheads), type->nheads,
                type->nsectors);
diff -r 648af5356a20 -r 477618dafb44 sys/arch/atari/include/iomap.h
--- a/sys/arch/atari/include/iomap.h    Thu Jan 06 12:03:31 2000 +0000
+++ b/sys/arch/atari/include/iomap.h    Thu Jan 06 12:14:33 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: iomap.h,v 1.7 1999/12/06 16:06:41 leo Exp $    */
+/*     $NetBSD: iomap.h,v 1.8 2000/01/06 12:15:04 leo Exp $    */
 
 /*
  * Copyright (c) 1995 Leo Weppelman.
@@ -89,7 +89,7 @@
 #define        AD_RTC          (AD_STIO + 0x0960)      /* TT realtime clock    */
 #define        AD_SCC          (AD_STIO + 0x0C80)      /* SCC 8530             */
 #define        AD_SCU          (AD_STIO + 0x0E00)      /* System Control Unit  */
-
+#define        AD_CFG_SWITCH   (AD_STIO + 0x1200)      /* Config switches      */
 #define        AD_MFP          (AD_STIO + 0x7A00)      /* 68901                */
 #define        AD_MFP2         (AD_STIO + 0x7A80)      /* 68901-TT             */
 #define        AD_ACIA         (AD_STIO + 0x7C00)      /* 2 * 6850             */



Home | Main Index | Thread Index | Old Index