Source-Changes-HG archive

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

[src/trunk]: src Add IDE drive support.



details:   https://anonhg.NetBSD.org/src/rev/eaca4c7d8f3d
branches:  trunk
changeset: 526204:eaca4c7d8f3d
user:      shiba <shiba%NetBSD.org@localhost>
date:      Sat Apr 27 19:29:08 2002 +0000

description:
Add IDE drive support.

Note:
   (1) Character device major number chages to 49 from 48(in my original
       code). So it is necessary to rebuild device files.
   (2) Must use Booter 2.0.0a10 or later.
   (3) Default mode is cpu busy wait. It is defined by flags 0x1000.
       It will be more slow than before.
       No flags means hardware interrupt mode. But it might be able to
       get no interrupts.

Support machines:
   (1) Quadra 630 series
   (2) PowerBook 150

Non tested machine:
   (1) PowerBook 190 series

Approved by: briggs

diffstat:

 etc/etc.mac68k/MAKEDEV            |   10 +-
 sys/arch/mac68k/conf/GENERIC      |    8 +-
 sys/arch/mac68k/conf/GENERICSBC   |    8 +-
 sys/arch/mac68k/conf/INSTALL      |    6 +-
 sys/arch/mac68k/conf/INSTALLSBC   |    6 +-
 sys/arch/mac68k/conf/files.mac68k |   13 +-
 sys/arch/mac68k/mac68k/autoconf.c |   22 ++-
 sys/arch/mac68k/mac68k/conf.c     |    8 +-
 sys/arch/mac68k/mac68k/machdep.c  |   28 +++-
 sys/arch/mac68k/obio/wdc_obio.c   |  276 ++++++++++++++++++++++++++++++++++++++
 10 files changed, 365 insertions(+), 20 deletions(-)

diffs (truncated from 615 to 300 lines):

diff -r 1570262e3721 -r eaca4c7d8f3d etc/etc.mac68k/MAKEDEV
--- a/etc/etc.mac68k/MAKEDEV    Sat Apr 27 19:17:16 2002 +0000
+++ b/etc/etc.mac68k/MAKEDEV    Sat Apr 27 19:29:08 2002 +0000
@@ -20,7 +20,7 @@
 # MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
 #
 #      from: @(#)MAKEDEV       5.2 (Berkeley) 6/22/90
-#      $NetBSD: MAKEDEV,v 1.59 2002/03/13 01:26:58 simonb Exp $
+#      $NetBSD: MAKEDEV,v 1.60 2002/04/27 19:29:08 shiba Exp $
 #
 ###########################################################################
 #
@@ -48,6 +48,7 @@
 #      ccd*    concatenated disk driver
 #      md*     memory pseudo-disk devices
 #      fd*     floppy disk drives (3 1/2")
+#      wd*     "winchester" disk drives (ST506,IDE,ESDI,RLL,...)
 #
 # Terminal ports:
 #      ttye*   ite consoles
@@ -107,7 +108,7 @@
 case $i in
 
 all)
-       makedev std wscons fd sd0 sd1 sd2 sd3 tty0 tty1 pty0
+       makedev std wscons fd sd0 sd1 sd2 sd3 wd0 wd1 wd2 wd3 tty0 tty1 pty0
        makedev st0 st1 ch0 cd0 cd1 fd0 fd1 vnd0 vnd1 vnd2 vnd3
        makedev ccd0 ccd1 ccd2 ccd3 md0 ss0 uk0 uk1
        makedev raid0 raid1 raid2 raid3 raid4 raid5 raid6 raid7
@@ -138,7 +139,7 @@
 
 raminst)
        makedev std
-       makedev sd0 sd1 sd2 sd3 st0 st1 cd0 cd1 md0
+       makedev sd0 sd1 sd2 sd3 wd0 wd1 wd2 wd3 st0 st1 cd0 cd1 md0
        makedev adb grf0 grf1 ttye0
        makedev tty0 tty1 opty
        ;;
@@ -235,12 +236,13 @@
        chmod 640 $name$unit n$name$unit en$name$unit
        ;;
 
-sd*|fd*|vnd*|ccd*|raid*)
+sd*|fd*|wd*|vnd*|ccd*|raid*)
        case $i in
        ccd*) name=ccd; unit=${i#ccd};  blk=9;  chr=20;;
        fd*) name=fd;   unit=${i#fd};   blk=21; chr=43;;
        raid*) name=raid; unit=${i#raid}; blk=20; chr=42;;
        sd*) name=sd;   unit=${i#sd};   blk=4;  chr=13;;
+       wd*) name=wd;   unit=${i#wd};   blk=22; chr=49;;
        vnd*) name=vnd; unit=${i#vnd};  blk=8;  chr=19;;
        esac
        rm -f $name$unit? r$name$unit?
diff -r 1570262e3721 -r eaca4c7d8f3d sys/arch/mac68k/conf/GENERIC
--- a/sys/arch/mac68k/conf/GENERIC      Sat Apr 27 19:17:16 2002 +0000
+++ b/sys/arch/mac68k/conf/GENERIC      Sat Apr 27 19:29:08 2002 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: GENERIC,v 1.125 2002/04/25 15:06:30 atatat Exp $
+# $NetBSD: GENERIC,v 1.126 2002/04/27 19:29:08 shiba Exp $
 #
 # GENERIC machine description file
 # 
@@ -22,7 +22,7 @@
 
 options        INCLUDE_CONFIG_FILE     # embed config file in kernel binary
 
-#ident                 "GENERIC-$Revision: 1.125 $"
+#ident                 "GENERIC-$Revision: 1.126 $"
 
 maxusers       16              # estimated number of users
 
@@ -232,6 +232,10 @@
 ss*    at scsibus? target ? lun ?      # SCSI scanners
 uk*    at scsibus? target ? lun ?      # SCSI unknown
 
+# IDE controller and devices
+wdc*   at obio? flags 0x1000
+wd*    at wdc? channel ? drive ?
+
 
 # Miscellaneous mass storage devices
 
diff -r 1570262e3721 -r eaca4c7d8f3d sys/arch/mac68k/conf/GENERICSBC
--- a/sys/arch/mac68k/conf/GENERICSBC   Sat Apr 27 19:17:16 2002 +0000
+++ b/sys/arch/mac68k/conf/GENERICSBC   Sat Apr 27 19:29:08 2002 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: GENERICSBC,v 1.16 2002/04/25 15:06:30 atatat Exp $
+#      $NetBSD: GENERICSBC,v 1.17 2002/04/27 19:29:08 shiba Exp $
 #
 # GENERICSBC
 
@@ -6,7 +6,7 @@
 
 options        INCLUDE_CONFIG_FILE     # embed config file in kernel binary
 
-#ident                 "GENERICSBC-$Revision: 1.16 $"
+#ident                 "GENERICSBC-$Revision: 1.17 $"
 
 maxusers       16              # estimated number of users
 
@@ -216,6 +216,10 @@
 ss*    at scsibus? target ? lun ?      # SCSI scanners
 uk*    at scsibus? target ? lun ?      # SCSI unknown
 
+# IDE controller and devices
+wdc*   at obio? flags 0x1000
+wd*    at wdc? channel ? drive ?
+
 
 # Miscellaneous mass storage devices
 
diff -r 1570262e3721 -r eaca4c7d8f3d sys/arch/mac68k/conf/INSTALL
--- a/sys/arch/mac68k/conf/INSTALL      Sat Apr 27 19:17:16 2002 +0000
+++ b/sys/arch/mac68k/conf/INSTALL      Sat Apr 27 19:29:08 2002 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: INSTALL,v 1.16 2002/04/25 15:06:30 atatat Exp $
+#      $NetBSD: INSTALL,v 1.17 2002/04/27 19:29:08 shiba Exp $
 #
 # INSTALL
 
@@ -149,6 +149,10 @@
 cd*    at scsibus? target ? lun ?      # SCSI CD-ROM drives
 st*    at scsibus? target ? lun ?      # SCSI tape drives
 
+# IDE controller and devices
+wdc*   at obio? 0x1000
+wd*    at wdc? channel ? drive ?
+
 
 # Miscellaneous mass storage devices
 
diff -r 1570262e3721 -r eaca4c7d8f3d sys/arch/mac68k/conf/INSTALLSBC
--- a/sys/arch/mac68k/conf/INSTALLSBC   Sat Apr 27 19:17:16 2002 +0000
+++ b/sys/arch/mac68k/conf/INSTALLSBC   Sat Apr 27 19:29:08 2002 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: INSTALLSBC,v 1.8 2002/04/25 15:06:30 atatat Exp $
+#      $NetBSD: INSTALLSBC,v 1.9 2002/04/27 19:29:08 shiba Exp $
 #
 # INSTALLSBC
 
@@ -149,6 +149,10 @@
 cd*    at scsibus? target ? lun ?      # SCSI CD-ROM drives
 st*    at scsibus? target ? lun ?      # SCSI tape drives
 
+# IDE controller and devices
+wdc*   at obio? flags 0x1000
+wd*    at wdc? channel ? drive ?
+
 
 # Miscellaneous mass storage devices
 
diff -r 1570262e3721 -r eaca4c7d8f3d sys/arch/mac68k/conf/files.mac68k
--- a/sys/arch/mac68k/conf/files.mac68k Sat Apr 27 19:17:16 2002 +0000
+++ b/sys/arch/mac68k/conf/files.mac68k Sat Apr 27 19:29:08 2002 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: files.mac68k,v 1.104 2002/04/16 20:50:21 thorpej Exp $
+#      $NetBSD: files.mac68k,v 1.105 2002/04/27 19:29:08 shiba Exp $
 
 # mac68k-specific configuration info
 
@@ -122,6 +122,14 @@
 #attach        qsc at nubus
 #file  arch/mac68k/nubus/qsc.c         qsc
 
+#
+# Machine-independent ATA drivers
+#
+include        "dev/ata/files.ata"
+
+attach wdc at obio_norm with wdc_obio
+file   arch/mac68k/obio/wdc_obio.c     wdc_obio
+
 device zsc { channel = -1 }
 attach zsc at obio_norm
 file   arch/mac68k/dev/zs.c            zsc needs-flag
@@ -189,6 +197,9 @@
 # RAIDframe
 major  {raid = 20}
 
+#ATA disk
+major  {wd = 22}
+
 # Compatibility modules
 
 # NetBSD m68k a.out Binary Compatibility (COMPAT_AOUT_M68K)
diff -r 1570262e3721 -r eaca4c7d8f3d sys/arch/mac68k/mac68k/autoconf.c
--- a/sys/arch/mac68k/mac68k/autoconf.c Sat Apr 27 19:17:16 2002 +0000
+++ b/sys/arch/mac68k/mac68k/autoconf.c Sat Apr 27 19:29:08 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: autoconf.c,v 1.55 2001/04/25 17:53:14 bouyer Exp $     */
+/*     $NetBSD: autoconf.c,v 1.56 2002/04/27 19:29:09 shiba Exp $      */
 
 /*
  * Copyright (c) 1992, 1993
@@ -115,7 +115,7 @@
 findbootdev()
 {
        struct device *dv;
-       int major, unit, i;
+       int major, unit, controller, i;
        char buf[32];
 
        booted_device = NULL;
@@ -130,9 +130,21 @@
 
        unit = B_UNIT(bootdev);
 
-       bootdev &= ~(B_UNITMASK << B_UNITSHIFT);
-       unit = target_to_unit(-1, unit, 0);
-       bootdev |= (unit << B_UNITSHIFT);
+       switch (major) {
+       case 4: /* SCSI drive */
+               bootdev &= ~(B_UNITMASK << B_UNITSHIFT); /* XXX */
+               unit = target_to_unit(-1, unit, 0);
+               bootdev |= (unit << B_UNITSHIFT); /* XXX */
+               break;
+       case 22: /* IDE drive */
+               /*
+                * controller(=channel=buses) uses only IDE drive.
+                * Here, controller always is 0.
+                */
+               controller = B_CONTROLLER(bootdev);
+               unit = unit + (controller<<1);
+               break;
+       }
 
        sprintf(buf, "%s%d", dev_name2blk[i].d_name, unit);
        for (dv = alldevs.tqh_first; dv != NULL;
diff -r 1570262e3721 -r eaca4c7d8f3d sys/arch/mac68k/mac68k/conf.c
--- a/sys/arch/mac68k/mac68k/conf.c     Sat Apr 27 19:17:16 2002 +0000
+++ b/sys/arch/mac68k/mac68k/conf.c     Sat Apr 27 19:29:08 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: conf.c,v 1.55 2002/01/12 13:28:49 manu Exp $   */
+/*     $NetBSD: conf.c,v 1.56 2002/04/27 19:29:09 shiba Exp $  */
 
 /*
  * Copyright (c) 1990 The Regents of the University of California.
@@ -58,6 +58,7 @@
 #include "st.h"
 #include "vcoda.h"
 #include "vnd.h"
+#include "wd.h"
 
 /* No cdev for md */
 
@@ -71,6 +72,7 @@
 bdev_decl(st);
 bdev_decl(sw);
 bdev_decl(vnd);
+bdev_decl(wd);
 
 struct bdevsw  bdevsw[] =
 {
@@ -96,6 +98,7 @@
        bdev_lkm_dummy(),               /* 19 */
        bdev_disk_init(NRAID,raid),     /* 20: RAIDframe disk driver */
        bdev_disk_init(NFD, fd),        /* 21: Sony floppy disk */
+       bdev_disk_init(NWD, wd),        /* 22: IDE disk */
 };
 int    nblkdev = sizeof(bdevsw) / sizeof(bdevsw[0]);
 
@@ -163,6 +166,7 @@
 cdev_decl(scsibus);
 cdev_decl(vc_nb_);
 cdev_decl(clockctl);
+cdev_decl(wd);
 
 dev_decl(filedesc,open);
 
@@ -217,6 +221,7 @@
        cdev_wsdisplay_init(NWSDISPLAY,wsdisplay), /* 46: frame buffers, etc. */
        cdev_vc_nb_init(NVCODA,vc_nb_), /* 47: Venus cache driver (Coda) */
        cdev_clockctl_init(NCLOCKCTL, clockctl),/* 48: clockctl pseudo device */
+       cdev_disk_init(NWD, wd),        /* 49: IDE disk */
 };
 int    nchrdev = sizeof(cdevsw) / sizeof(cdevsw[0]);
 
@@ -307,6 +312,7 @@
        /* 46 */        NODEV,
        /* 47 */        NODEV,
        /* 48 */        NODEV,
+       /* 49 */        22,
 };
 
 dev_t
diff -r 1570262e3721 -r eaca4c7d8f3d sys/arch/mac68k/mac68k/machdep.c
--- a/sys/arch/mac68k/mac68k/machdep.c  Sat Apr 27 19:17:16 2002 +0000
+++ b/sys/arch/mac68k/mac68k/machdep.c  Sat Apr 27 19:29:08 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: machdep.c,v 1.271 2002/03/31 02:21:20 shiba Exp $      */
+/*     $NetBSD: machdep.c,v 1.272 2002/04/27 19:29:09 shiba Exp $      */
 
 /*
  * Copyright (c) 1988 University of Utah.
@@ -1064,6 +1064,7 @@
        extern u_long macos_boottime, MacOSROMBase;
        extern long macos_gmtbias;
        int root_scsi_id;
+       u_long root_ata_dev;
 #ifdef __ELF__



Home | Main Index | Thread Index | Old Index