Source-Changes-HG archive

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

[src/netbsd-9]: src/sys/arch/hp300 Pull up following revision(s) (requested b...



details:   https://anonhg.NetBSD.org/src/rev/850006d75069
branches:  netbsd-9
changeset: 372546:850006d75069
user:      martin <martin%NetBSD.org@localhost>
date:      Tue Dec 06 19:26:06 2022 +0000

description:
Pull up following revision(s) (requested by tsutsui in ticket #1552):

        sys/arch/hp300/dev/rd.c: revision 1.120
        sys/arch/hp300/dev/rd.c: revision 1.121
        sys/arch/hp300/dev/rd.c: revision 1.122
        sys/arch/hp300/dev/rd.c: revision 1.123
        sys/arch/hp300/dev/rd.c: revision 1.124
        sys/arch/hp300/dev/rdreg.h: revision 1.19
        sys/arch/hp300/dev/rd.c: revision 1.111
        sys/arch/hp300/dev/rd.c: revision 1.112
        sys/arch/hp300/dev/rd.c: revision 1.113
        sys/arch/hp300/stand/common/rd.c: revision 1.12
        sys/arch/hp300/dev/rd.c: revision 1.114
        sys/arch/hp300/stand/common/rd.c: revision 1.13
        sys/arch/hp300/dev/rd.c: revision 1.115
        sys/arch/hp300/stand/common/rd.c: revision 1.14
        sys/arch/hp300/dev/rd.c: revision 1.116
        sys/arch/hp300/stand/common/rd.c: revision 1.15
        sys/arch/hp300/dev/rd.c: revision 1.117
        sys/arch/hp300/dev/rd.c: revision 1.118
        sys/arch/hp300/dev/rd.c: revision 1.119
        sys/arch/hp300/dev/rdvar.h: revision 1.27
        sys/arch/hp300/dev/rdreg.h: revision 1.20

Sync a list of HP-IB disk IDs with kernel's one.
Now bootloader can boot from 2202A, 7908A, 7911A, and 7941A.
Tested on 425t and HPDisk.

Make local variables static and read only ones const.

Use common macro for numbers of cylinders and blocks for HP-IB disks.
No binary changes.

Fix "rd(4) at punits not configured on HPDisk are misprobed" problem.
- check not only stat value returned by C_QSTAT command against
  each punit but also desc.d_name returned by C_DESC command
  because it looks HPDisk responds to commands against punits supported
  but not-configured punits at 1-3
- prepare rdreset_unit() function to manage reset punit ops during
  probe without valid softc

The stragety is taken from OpenBSD with several modification.
Tested on 425t with real 9122D and HPDisk emulating two 7937H drives.
Should be pulled up to netbsd-9.

Remove now unused buffer members from softc prepared only for rdreset().

Use proper integer types for HP-IB xfer parameters.
No visible regression on 425t and HPDisk.

Sync with rdreg.h integer type changes.

Remove unnecessary declarations.

Check bounds of RAW_PART by bounds_check_with_mediasize() as other drivers.
With this check, dd(1) without a count value against a raw partition
is terminated properly at the end of media.  Tested on 425t and HPDisk.
Should be pulled up to netbsd-9.

Check bounds of each partition by MI bounds_check_with_label(9).
The previous implementation was committed in rev 1.26 about 26 years ago
and it looks there is no quirk to use the old MD one.

Pass a correct dev_t arg to disk_ioctl().
Probably harmless.

Remove a duplicated static function declaration.

Set disk_geom parameters required by DIOCGPARTINFO in disk_ioctl().
With this change raid(4) no longer complains before mountroot:
RAIDframe: can't get disk size for dev rd0 (22)
Should be pulled up to netbsd-9.

Use proper RAW_PART macro rather than a magic number.

Remove more duplicated static function declarations.

Misc KNF and cosmetics.

Add empty DIOCCACHESYNC ioctl(2) for rd(4).
Without this raid(4) always complains on various raidctl(8) ops:
raid0: cache flush[0] to component 0 failed (22)
RAID1 configured by raid(4) just works HP-IB disks on hp300.

Explicitly include <sys/kernel.h> for hz(9) as man pages says.
XXX: it looks sys/param.h r1.615 and later also has extern int hz

diffstat:

 sys/arch/hp300/dev/rd.c          |  434 +++++++++++++++++++-------------------
 sys/arch/hp300/dev/rdreg.h       |  138 ++++++++---
 sys/arch/hp300/dev/rdvar.h       |    5 +-
 sys/arch/hp300/stand/common/rd.c |   68 +++--
 4 files changed, 354 insertions(+), 291 deletions(-)

diffs (truncated from 1336 to 300 lines):

diff -r b300059ecc59 -r 850006d75069 sys/arch/hp300/dev/rd.c
--- a/sys/arch/hp300/dev/rd.c   Tue Dec 06 19:19:26 2022 +0000
+++ b/sys/arch/hp300/dev/rd.c   Tue Dec 06 19:26:06 2022 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: rd.c,v 1.101.22.1 2021/07/14 18:04:04 martin Exp $     */
+/*     $NetBSD: rd.c,v 1.101.22.2 2022/12/06 19:26:06 martin Exp $     */
 
 /*-
  * Copyright (c) 1996, 1997 The NetBSD Foundation, Inc.
@@ -72,12 +72,13 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: rd.c,v 1.101.22.1 2021/07/14 18:04:04 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rd.c,v 1.101.22.2 2022/12/06 19:26:06 martin Exp $");
 
 #include "opt_useleds.h"
 
 #include <sys/param.h>
 #include <sys/systm.h>
+#include <sys/kernel.h>
 #include <sys/buf.h>
 #include <sys/bufq.h>
 #include <sys/conf.h>
@@ -102,7 +103,7 @@
 
 #include "ioconf.h"
 
-int    rderrthresh = RDRETRY-1;        /* when to start reporting errors */
+int    rderrthresh = RDRETRY - 1;      /* when to start reporting errors */
 
 #ifdef DEBUG
 /* error message tables */
@@ -191,8 +192,8 @@
                .ri_desc = "7945A",
                .ri_nbpt = NRD7945ABPT,
                .ri_ntpc = NRD7945ATRK,
-               .ri_ncyl = 968,
-               .ri_nblocks = 108416
+               .ri_ncyl = NRD7945ACYL,
+               .ri_nblocks = NRD7945ABLK
        },
 
        [RD9134D] = {
@@ -200,8 +201,8 @@
                .ri_desc = "9134D",
                .ri_nbpt = NRD9134DBPT,
                .ri_ntpc = NRD9134DTRK,
-               .ri_ncyl = 303,
-               .ri_nblocks = 29088
+               .ri_ncyl = NRD9134DCYL,
+               .ri_nblocks = NRD9134DBLK
        },
 
        [RD9122S] = {
@@ -209,8 +210,8 @@
                .ri_desc = "9122S",
                .ri_nbpt = NRD9122SBPT,
                .ri_ntpc = NRD9122STRK,
-               .ri_ncyl = 77,
-               .ri_nblocks = 1232
+               .ri_ncyl = NRD9122SCYL,
+               .ri_nblocks = NRD9122SBLK
        },
 
        [RD7912P] = {
@@ -218,8 +219,8 @@
                .ri_desc = "7912P",
                .ri_nbpt = NRD7912PBPT,
                .ri_ntpc = NRD7912PTRK,
-               .ri_ncyl = 572,
-               .ri_nblocks = 128128
+               .ri_ncyl = NRD7912PCYL,
+               .ri_nblocks = NRD7912PBLK
        },
 
        [RD7914P] = {
@@ -227,8 +228,8 @@
                .ri_desc = "7914P",
                .ri_nbpt = NRD7914PBPT,
                .ri_ntpc = NRD7914PTRK,
-               .ri_ncyl = 1152,
-               .ri_nblocks = 258048
+               .ri_ncyl = NRD7914PCYL,
+               .ri_nblocks = NRD7914PBLK
        },
 
        [RD7958A] = {
@@ -236,8 +237,8 @@
                .ri_desc = "7958A",
                .ri_nbpt = NRD7958ABPT,
                .ri_ntpc = NRD7958ATRK,
-               .ri_ncyl = 1013,
-               .ri_nblocks = 255276
+               .ri_ncyl = NRD7958ACYL,
+               .ri_nblocks = NRD7958ABLK
        },
 
        [RD7957A] = {
@@ -245,8 +246,8 @@
                .ri_desc = "7957A",
                .ri_nbpt = NRD7957ABPT,
                .ri_ntpc = NRD7957ATRK,
-               .ri_ncyl = 1036,
-               .ri_nblocks = 159544
+               .ri_ncyl = NRD7957ACYL,
+               .ri_nblocks = NRD7957ABLK
        },
 
        [RD7933H] = {
@@ -254,8 +255,8 @@
                .ri_desc = "7933H",
                .ri_nbpt = NRD7933HBPT,
                .ri_ntpc = NRD7933HTRK,
-               .ri_ncyl = 1321,
-               .ri_nblocks = 789958
+               .ri_ncyl = NRD7933HCYL,
+               .ri_nblocks = NRD7933HBLK
        },
 
        [RD9134L] = {
@@ -263,8 +264,8 @@
                .ri_desc = "9134L",
                .ri_nbpt = NRD9134LBPT,
                .ri_ntpc = NRD9134LTRK,
-               .ri_ncyl = 973,
-               .ri_nblocks = 77840
+               .ri_ncyl = NRD9134LCYL,
+               .ri_nblocks = NRD9134LBLK
        },
 
        [RD7936H] = {
@@ -272,8 +273,8 @@
                .ri_desc = "7936H",
                .ri_nbpt = NRD7936HBPT,
                .ri_ntpc = NRD7936HTRK,
-               .ri_ncyl = 698,
-               .ri_nblocks = 600978
+               .ri_ncyl = NRD7936HCYL,
+               .ri_nblocks = NRD7936HBLK
        },
 
        [RD7937H] = {
@@ -281,8 +282,8 @@
                .ri_desc = "7937H",
                .ri_nbpt = NRD7937HBPT,
                .ri_ntpc = NRD7937HTRK,
-               .ri_ncyl = 698,
-               .ri_nblocks = 1116102
+               .ri_ncyl = NRD7937HCYL,
+               .ri_nblocks = NRD7937HBLK
        },
 
        [RD7914CT] = {
@@ -290,8 +291,8 @@
                .ri_desc = "7914CT",
                .ri_nbpt = NRD7914PBPT,
                .ri_ntpc = NRD7914PTRK,
-               .ri_ncyl = 1152,
-               .ri_nblocks = 258048
+               .ri_ncyl = NRD7914PCYL,
+               .ri_nblocks = NRD7914PBLK
        },
 
        [RD7946A] = {
@@ -299,8 +300,8 @@
                .ri_desc = "7946A",
                .ri_nbpt = NRD7945ABPT,
                .ri_ntpc = NRD7945ATRK,
-               .ri_ncyl = 968,
-               .ri_nblocks = 108416
+               .ri_ncyl = NRD7945ACYL,
+               .ri_nblocks = NRD7945ABLK
        },
 
        [RD9122D] = {
@@ -308,8 +309,8 @@
                .ri_desc = "9122D",
                .ri_nbpt = NRD9122SBPT,
                .ri_ntpc = NRD9122STRK,
-               .ri_ncyl = 77,
-               .ri_nblocks = 1232
+               .ri_ncyl = NRD9122SCYL,
+               .ri_nblocks = NRD9122SBLK
        },
 
        [RD7957B] = {
@@ -317,8 +318,8 @@
                .ri_desc = "7957B",
                .ri_nbpt = NRD7957BBPT,
                .ri_ntpc = NRD7957BTRK,
-               .ri_ncyl = 1269,
-               .ri_nblocks = 159894
+               .ri_ncyl = NRD7957BCYL,
+               .ri_nblocks = NRD7957BBLK
        },
 
        [RD7958B] = {
@@ -326,8 +327,8 @@
                .ri_desc = "7958B",
                .ri_nbpt = NRD7958BBPT,
                .ri_ntpc = NRD7958BTRK,
-               .ri_ncyl = 786,
-               .ri_nblocks = 297108
+               .ri_ncyl = NRD7958BCYL,
+               .ri_nblocks = NRD7958BBLK
        },
 
        [RD7959B] = {
@@ -335,8 +336,8 @@
                .ri_desc = "7959B",
                .ri_nbpt = NRD7959BBPT,
                .ri_ntpc = NRD7959BTRK,
-               .ri_ncyl = 1572,
-               .ri_nblocks = 594216
+               .ri_ncyl = NRD7959BCYL,
+               .ri_nblocks = NRD7959BBLK
        },
 
        [RD2200A] = {
@@ -344,8 +345,8 @@
                .ri_desc = "2200A",
                .ri_nbpt = NRD2200ABPT,
                .ri_ntpc = NRD2200ATRK,
-               .ri_ncyl = 1449,
-               .ri_nblocks = 654948
+               .ri_ncyl = NRD2200ACYL,
+               .ri_nblocks = NRD2200ABLK
        },
 
        [RD2203A] = {
@@ -353,8 +354,8 @@
                .ri_desc = "2203A",
                .ri_nbpt = NRD2203ABPT,
                .ri_ntpc = NRD2203ATRK,
-               .ri_ncyl = 1449,
-               .ri_nblocks = 1309896
+               .ri_ncyl = NRD2203ACYL,
+               .ri_nblocks = NRD2203ABLK
        },
 
        [RD2202A] = {
@@ -362,8 +363,8 @@
                .ri_desc = "2202A",
                .ri_nbpt = NRD2202ABPT,
                .ri_ntpc = NRD2202ATRK,
-               .ri_ncyl = 1449,
-               .ri_nblocks = 1309896
+               .ri_ncyl = NRD2202ACYL,
+               .ri_nblocks = NRD2202ABLK
        },
 
        [RD7908A] = {
@@ -371,8 +372,8 @@
                .ri_desc = "7908A",
                .ri_nbpt = NRD7908ABPT,
                .ri_ntpc = NRD7908ATRK,
-               .ri_ncyl = 185,
-               .ri_nblocks = 32375
+               .ri_ncyl = NRD7908ACYL,
+               .ri_nblocks = NRD7908ABLK
        },
 
        [RD7911A] = {
@@ -380,8 +381,8 @@
                .ri_desc = "7911A",
                .ri_nbpt = NRD7911ABPT,
                .ri_ntpc = NRD7911ATRK,
-               .ri_ncyl = 572,
-               .ri_nblocks = 54912
+               .ri_ncyl = NRD7911ACYL,
+               .ri_nblocks = NRD7911ABLK
        },
 
        [RD7941A] = {
@@ -389,8 +390,8 @@
                .ri_desc = "7941A",
                .ri_nbpt = NRD7941ABPT,
                .ri_ntpc = NRD7941ATRK,
-               .ri_ncyl = 968,
-               .ri_nblocks = 46464
+               .ri_ncyl = NRD7941ACYL,
+               .ri_nblocks = NRD7941ABLK
        }
 };
 static const int numrdidentinfo = __arraycount(rdidentinfo);
@@ -427,10 +428,9 @@
 static int     rdident(device_t, struct rd_softc *,
                    struct hpibbus_attach_args *);
 static void    rdreset(struct rd_softc *);
-static void    rdustart(struct rd_softc *);
+static void    rdreset_unit(int, int, int);
+static void    rd_set_geom(struct rd_softc *);
 static int     rdgetinfo(dev_t);
-static void    rdrestart(void *);
-static struct buf *rdfinish(struct rd_softc *, struct buf *);
 
 static void    rdgetdefaultlabel(struct rd_softc *, struct disklabel *);
 static void    rdrestart(void *);
@@ -490,36 +490,8 @@



Home | Main Index | Thread Index | Old Index