Source-Changes-HG archive

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

[src/trunk]: src - Add racd* devices for MSCP based CD-ROM drives (RRD40s), a...



details:   https://anonhg.NetBSD.org/src/rev/4d6e6b53c6e7
branches:  trunk
changeset: 779851:4d6e6b53c6e7
user:      abs <abs%NetBSD.org@localhost>
date:      Fri Jun 22 20:42:22 2012 +0000

description:
- Add racd* devices for MSCP based CD-ROM drives (RRD40s), as opposed
  to mixing them in with the ra* disks, modelled loosely on how MSCP
  rx* floppies are handled
- racd* defaults to the same single iso9660 partition as cd*
- Cleanup config option handling slightly so any combination of ra*,
  rx* (and now raccd*) can be defined without build errors.
- Avoid ugly printf when disks have all zero disklabel magic number

diffstat:

 etc/etc.vax/MAKEDEV.conf     |    7 +-
 sys/arch/vax/conf/GENERIC    |    7 +-
 sys/arch/vax/conf/INSTALL    |    3 +-
 sys/arch/vax/conf/VAX780     |    3 +-
 sys/arch/vax/conf/majors.vax |    3 +-
 sys/arch/vax/vax/disksubr.c  |    7 +-
 sys/dev/DEVNAMES             |    3 +-
 sys/dev/mscp/files.mscp      |   12 +-
 sys/dev/mscp/mscp_disk.c     |  279 ++++++++++++++++++++++++++----------------
 sys/dev/mscp/mscp_subr.c     |    8 +-
 10 files changed, 207 insertions(+), 125 deletions(-)

diffs (truncated from 733 to 300 lines):

diff -r 5cf9374701e7 -r 4d6e6b53c6e7 etc/etc.vax/MAKEDEV.conf
--- a/etc/etc.vax/MAKEDEV.conf  Fri Jun 22 20:32:34 2012 +0000
+++ b/etc/etc.vax/MAKEDEV.conf  Fri Jun 22 20:42:22 2012 +0000
@@ -1,9 +1,9 @@
-# $NetBSD: MAKEDEV.conf,v 1.13 2011/10/12 17:03:49 njoly Exp $
+# $NetBSD: MAKEDEV.conf,v 1.14 2012/06/22 20:42:22 abs Exp $
 
 all_md)
        makedev mt0 mt1 ts0 ts1 st0 st1 uk0 ss0 cd0 vt0
        makedev ra0 ra1 ra2 ra3 hp0 hp1 hp2 hp3 sd0 sd1 sd2 sd3 rd0 rd1 rd2
-       makedev dz0 dl0 dhu0 rx0 rx1
+       makedev dz0 dl0 dhu0 racd0 racd1 rx0 rx1
        makedev scsibus0 scsibus1 scsibus2 scsibus3
        makedev ses0 ses1 ses2 ses3
        makedev std_vax
@@ -60,11 +60,12 @@
        esac
        ;;
 
-hp[0-9]*|hk[0-9]*|up[0-9]*|ra[0-9]*|rl[0-9]*|rb[0-9]*|rd[0-9]*|rx[0-9]*)
+hp[0-9]*|hk[0-9]*|up[0-9]*|ra[0-9]*|racd[0-9]*|rl[0-9]*|rb[0-9]*|rd[0-9]*|rx[0-9]*)
        case $i in
        hp*) name=hp;   unit=${i#hp};   blk=0; chr=4;;
        hk*) name=hk;   unit=${i#hk};   blk=3; chr=11;;
        up*) name=up;   unit=${i#up};   blk=2; chr=13;;
+       racd*) name=racd; unit=${i#racd}; blk=28; chr=28;; # before ra*
        ra*) name=ra;   unit=${i#ra};   blk=9;  chr=9;;
        rb*) name=rb;   unit=${i#rb};   blk=11; chr=23;;
        rx*) name=rx;   unit=${i#rx};   blk=12; chr=30;;
diff -r 5cf9374701e7 -r 4d6e6b53c6e7 sys/arch/vax/conf/GENERIC
--- a/sys/arch/vax/conf/GENERIC Fri Jun 22 20:32:34 2012 +0000
+++ b/sys/arch/vax/conf/GENERIC Fri Jun 22 20:42:22 2012 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: GENERIC,v 1.181 2012/06/05 08:41:36 abs Exp $
+# $NetBSD: GENERIC,v 1.182 2012/06/22 20:42:22 abs Exp $
 #
 # GENERIC machine description file
 # 
@@ -22,7 +22,7 @@
 
 options        INCLUDE_CONFIG_FILE     # embed config file in kernel binary
 
-#ident                 "GENERIC-$Revision: 1.181 $"
+#ident                 "GENERIC-$Revision: 1.182 $"
 
 # Here are all different supported CPU types listed.
 #options       VAX8800         # VAX 8500, 8530, 8550, 8700, 8800
@@ -270,7 +270,8 @@
 mscpbus*       at mtc?
 mscpbus*       at kdb?
 
-ra*            at mscpbus? drive?      # MSCP disk
+ra*            at mscpbus? drive?      # MSCP disk 
+racd*          at mscpbus? drive?      # MSCP CD-ROM (RRD40)
 rx*            at mscpbus? drive?      # MSCP floppy
 mt*            at mscpbus? drive?      # MSCP tape
 
diff -r 5cf9374701e7 -r 4d6e6b53c6e7 sys/arch/vax/conf/INSTALL
--- a/sys/arch/vax/conf/INSTALL Fri Jun 22 20:32:34 2012 +0000
+++ b/sys/arch/vax/conf/INSTALL Fri Jun 22 20:42:22 2012 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: INSTALL,v 1.59 2012/03/18 14:12:55 he Exp $
+#      $NetBSD: INSTALL,v 1.60 2012/06/22 20:42:23 abs Exp $
 #
 # INSTALL kernel; all supported devices but nothing fancy.
 #
@@ -160,6 +160,7 @@
 
 # MSCP devices
 ra*            at mscpbus? drive?      # MSCP disk
+racd*          at mscpbus? drive?      # MSCP CD-ROM (RRD40)
 rx*            at mscpbus? drive?      # MSCP floppy
 mt*            at mscpbus? drive?      # MSCP tape
 
diff -r 5cf9374701e7 -r 4d6e6b53c6e7 sys/arch/vax/conf/VAX780
--- a/sys/arch/vax/conf/VAX780  Fri Jun 22 20:32:34 2012 +0000
+++ b/sys/arch/vax/conf/VAX780  Fri Jun 22 20:42:22 2012 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: VAX780,v 1.8 2012/03/10 21:51:57 joerg Exp $
+# $NetBSD: VAX780,v 1.9 2012/06/22 20:42:23 abs Exp $
 #
 # 11/780,750,730 machine description file
 # 
@@ -255,6 +255,7 @@
 #mscpbus*      at kdb?
 
 ra*            at mscpbus? drive?      # MSCP disk
+racd*          at mscpbus? drive?      # MSCP CD-ROM (RRD40)
 rx*            at mscpbus? drive?      # MSCP floppy
 mt*            at mscpbus? drive?      # MSCP tape
 
diff -r 5cf9374701e7 -r 4d6e6b53c6e7 sys/arch/vax/conf/majors.vax
--- a/sys/arch/vax/conf/majors.vax      Fri Jun 22 20:32:34 2012 +0000
+++ b/sys/arch/vax/conf/majors.vax      Fri Jun 22 20:42:22 2012 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: majors.vax,v 1.23 2011/06/30 20:09:38 wiz Exp $
+#      $NetBSD: majors.vax,v 1.24 2012/06/22 20:42:23 abs Exp $
 #
 # Device majors for vax
 #
@@ -36,6 +36,7 @@
                                                        vaxany
 device-major   lpa             char 26                 lpa
 device-major   ps              char 27                 ps
+device-major   racd            char 28  block 28       racd
 device-major   ad              char 29                 ad
 device-major   rx              char 30  block 12       rx
 device-major   ik              char 31                 ik
diff -r 5cf9374701e7 -r 4d6e6b53c6e7 sys/arch/vax/vax/disksubr.c
--- a/sys/arch/vax/vax/disksubr.c       Fri Jun 22 20:32:34 2012 +0000
+++ b/sys/arch/vax/vax/disksubr.c       Fri Jun 22 20:42:22 2012 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: disksubr.c,v 1.52 2010/12/14 23:44:49 matt Exp $       */
+/*     $NetBSD: disksubr.c,v 1.53 2012/06/22 20:42:23 abs Exp $        */
 
 /*
  * Copyright (c) 1982, 1986, 1988 Regents of the University of California.
@@ -32,7 +32,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: disksubr.c,v 1.52 2010/12/14 23:44:49 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: disksubr.c,v 1.53 2012/06/22 20:42:23 abs Exp $");
 
 #include "opt_compat_ultrix.h"
 
@@ -157,7 +157,8 @@
                int part;
 
                if (dlp->magic != DEC_LABEL_MAGIC) {
-                       printf("label: %x\n",dlp->magic);
+                       if (dlp->magic != 0)
+                               printf("label: %x\n",dlp->magic);
                        msg = ((msg != NULL) ? msg: "no disk label");
                        goto done;
                }
diff -r 5cf9374701e7 -r 4d6e6b53c6e7 sys/dev/DEVNAMES
--- a/sys/dev/DEVNAMES  Fri Jun 22 20:32:34 2012 +0000
+++ b/sys/dev/DEVNAMES  Fri Jun 22 20:42:22 2012 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: DEVNAMES,v 1.274 2012/06/03 01:47:26 nonaka Exp $
+#      $NetBSD: DEVNAMES,v 1.275 2012/06/22 20:42:23 abs Exp $
 #
 # This file contains all used device names and defined attributes in
 # alphabetical order. New devices added to the system somewhere should first
@@ -1114,6 +1114,7 @@
 qt                     MI
 qv                     vax
 ra                     MI
+racd                   MI
 radio                  MI
 radio                  MI              Attribute
 rambo                  mipsco
diff -r 5cf9374701e7 -r 4d6e6b53c6e7 sys/dev/mscp/files.mscp
--- a/sys/dev/mscp/files.mscp   Fri Jun 22 20:32:34 2012 +0000
+++ b/sys/dev/mscp/files.mscp   Fri Jun 22 20:42:22 2012 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: files.mscp,v 1.7 1999/06/06 19:16:18 ragge Exp $
+#      $NetBSD: files.mscp,v 1.8 2012/06/22 20:42:24 abs Exp $
 #
 # File and device description for MSCP devices.
 #
@@ -10,12 +10,16 @@
 device mscpbus {drive = -1}
 attach mscpbus at mscp
 
+device ra: disk
+attach ra at mscpbus
+
+device racd: disk
+attach racd at mscpbus
+
 device rx: disk
 attach rx at mscpbus
 
-device ra: disk
-attach ra at mscpbus
-file   dev/mscp/mscp_disk.c    ra | rx needs-flag
+file   dev/mscp/mscp_disk.c    ra | racd | rx needs-flag
 
 device mt: tape
 attach mt at mscpbus
diff -r 5cf9374701e7 -r 4d6e6b53c6e7 sys/dev/mscp/mscp_disk.c
--- a/sys/dev/mscp/mscp_disk.c  Fri Jun 22 20:32:34 2012 +0000
+++ b/sys/dev/mscp/mscp_disk.c  Fri Jun 22 20:42:22 2012 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: mscp_disk.c,v 1.71 2009/09/12 18:01:50 tsutsui Exp $   */
+/*     $NetBSD: mscp_disk.c,v 1.72 2012/06/22 20:42:24 abs Exp $       */
 /*
  * Copyright (c) 1988 Regents of the University of California.
  * All rights reserved.
@@ -73,6 +73,7 @@
 /*
  * RA disk device driver
  * RX MSCP floppy disk device driver
+ * RRD MSCP CD device driver
  */
 
 /*
@@ -81,7 +82,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: mscp_disk.c,v 1.71 2009/09/12 18:01:50 tsutsui Exp $");
+__KERNEL_RCSID(0, "$NetBSD: mscp_disk.c,v 1.72 2012/06/22 20:42:24 abs Exp $");
 
 #include <sys/param.h>
 #include <sys/buf.h>
@@ -125,19 +126,24 @@
 };
 
 #define rx_softc ra_softc
+#define racd_softc ra_softc
 
-void   rxattach(device_t, device_t, void *);
+void   raattach(device_t, device_t, void *);
 int    rx_putonline(struct rx_softc *);
 void   rrmakelabel(struct disklabel *, long);
+int    ra_putonline(dev_t, struct ra_softc *);
+static inline struct ra_softc *mscp_device_lookup(dev_t);
 
 #if NRA
 
 int    ramatch(device_t, cfdata_t, void *);
-void   raattach(device_t, device_t, void *);
-int    ra_putonline(struct ra_softc *);
 
 CFATTACH_DECL(ra, sizeof(struct ra_softc),
-    ramatch, rxattach, NULL, NULL);
+    ramatch, raattach, NULL, NULL);
+
+#endif /* NRA */
+
+#if NRA || NRACD || NRX
 
 dev_type_open(raopen);
 dev_type_close(raclose);
@@ -148,6 +154,8 @@
 dev_type_dump(radump);
 dev_type_size(rasize);
 
+#if NRA
+
 const struct bdevsw ra_bdevsw = {
        raopen, raclose, rastrategy, raioctl, radump, rasize, D_DISK
 };
@@ -177,45 +185,17 @@
            cf->cf_loc[MSCPBUSCF_DRIVE] != mp->mscp_unit)
                return 0;
        /*
-        * Check if this disk is a floppy; then don't configure it.
+        * Check if this disk is a floppy (RX) or cd (RRD)
         * Seems to be a safe way to test it per Chris Torek.
         */
        if (MSCP_MID_ECH(1, mp->mscp_guse.guse_mediaid) == 'X' - '@')
                return 0;
+       if (MSCP_MID_ECH(1, mp->mscp_guse.guse_mediaid) == 'R' - '@')
+               return 0;
        return 1;
 }
 
-/*
- * (Try to) put the drive online. This is done the first time the
- * drive is opened, or if it har fallen offline.
- */
-int
-ra_putonline(struct ra_softc *ra)
-{
-       struct  disklabel *dl;
-       const char *msg;
-       int maj;
-
-       if (rx_putonline(ra) != MSCP_DONE)
-               return MSCP_FAILED;
-
-       dl = ra->ra_disk.dk_label;
-
-       ra->ra_state = DK_RDLABEL;
-       printf("%s", device_xname(&ra->ra_dev));
-       maj = cdevsw_lookup_major(&ra_cdevsw);
-       if ((msg = readdisklabel(MAKEDISKDEV(maj, device_unit(&ra->ra_dev),
-           RAW_PART), rastrategy, dl, NULL)) != NULL)
-               printf(": %s", msg);
-       else {
-               ra->ra_havelabel = 1;
-               ra->ra_state = DK_OPEN;
-       }
-
-       printf(": size %d sectors\n", dl->d_secperunit);
-
-       return MSCP_DONE;
-}
+#endif /* NRA */
 
 /*
  * Open a drive.
@@ -224,13 +204,11 @@
 int
 raopen(dev_t dev, int flag, int fmt, struct lwp *l)
 {



Home | Main Index | Thread Index | Old Index