Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/dev Centralise the geometry fudge.
details: https://anonhg.NetBSD.org/src/rev/95836d6df295
branches: trunk
changeset: 510962:95836d6df295
user: ad <ad%NetBSD.org@localhost>
date: Sun Jun 10 10:48:42 2001 +0000
description:
Centralise the geometry fudge.
diffstat:
sys/dev/i2o/ld_iop.c | 18 +-----------------
sys/dev/ic/ld_cac.c | 9 +++------
sys/dev/ic/ld_mlx.c | 16 +---------------
sys/dev/ld.c | 18 +++++++++++++++++-
sys/dev/ldvar.h | 20 ++++++++++----------
sys/dev/pci/ld_twe.c | 13 +------------
6 files changed, 33 insertions(+), 61 deletions(-)
diffs (187 lines):
diff -r 5cd2039d8798 -r 95836d6df295 sys/dev/i2o/ld_iop.c
--- a/sys/dev/i2o/ld_iop.c Sun Jun 10 10:34:44 2001 +0000
+++ b/sys/dev/i2o/ld_iop.c Sun Jun 10 10:48:42 2001 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ld_iop.c,v 1.6 2001/03/20 13:01:49 ad Exp $ */
+/* $NetBSD: ld_iop.c,v 1.7 2001/06/10 10:48:43 ad Exp $ */
/*-
* Copyright (c) 2000, 2001 The NetBSD Foundation, Inc.
@@ -216,22 +216,6 @@
ld->sc_secperunit = (int)
(le64toh(param.p.bdi.capacity) / ld->sc_secsize);
- /* Build synthetic geometry. */
- if (ld->sc_secperunit <= 528 * 2048) /* 528MB */
- ld->sc_nheads = 16;
- else if (ld->sc_secperunit <= 1024 * 2048) /* 1GB */
- ld->sc_nheads = 32;
- else if (ld->sc_secperunit <= 21504 * 2048) /* 21GB */
- ld->sc_nheads = 64;
- else if (ld->sc_secperunit <= 43008 * 2048) /* 42GB */
- ld->sc_nheads = 128;
- else
- ld->sc_nheads = 255;
-
- ld->sc_nsectors = 63;
- ld->sc_ncylinders = ld->sc_secperunit /
- (ld->sc_nheads * ld->sc_nsectors);
-
switch (param.p.bdi.type) {
case I2O_RBS_TYPE_DIRECT:
typestr = "direct access";
diff -r 5cd2039d8798 -r 95836d6df295 sys/dev/ic/ld_cac.c
--- a/sys/dev/ic/ld_cac.c Sun Jun 10 10:34:44 2001 +0000
+++ b/sys/dev/ic/ld_cac.c Sun Jun 10 10:48:42 2001 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ld_cac.c,v 1.2 2000/12/11 13:19:51 ad Exp $ */
+/* $NetBSD: ld_cac.c,v 1.3 2001/06/10 10:48:43 ad Exp $ */
/*-
* Copyright (c) 2000 The NetBSD Foundation, Inc.
@@ -109,14 +109,11 @@
return;
}
- ld->sc_ncylinders = CAC_GET2(dinfo.ncylinders);
- ld->sc_nheads = CAC_GET1(dinfo.nheads);
- ld->sc_nsectors = CAC_GET1(dinfo.nsectors);
ld->sc_secsize = CAC_GET2(dinfo.secsize);
ld->sc_maxxfer = CAC_MAX_XFER;
ld->sc_maxqueuecnt = CAC_MAX_CCBS / cac->sc_nunits; /* XXX */
- ld->sc_secperunit = ld->sc_ncylinders * ld->sc_nheads *
- ld->sc_nsectors;
+ ld->sc_secperunit = CAC_GET2(dinfo.ncylinders) *
+ CAC_GET1(dinfo.nheads) * CAC_GET1(dinfo.nsectors);
ld->sc_start = ld_cac_start;
ld->sc_dump = ld_cac_dump;
diff -r 5cd2039d8798 -r 95836d6df295 sys/dev/ic/ld_mlx.c
--- a/sys/dev/ic/ld_mlx.c Sun Jun 10 10:34:44 2001 +0000
+++ b/sys/dev/ic/ld_mlx.c Sun Jun 10 10:48:42 2001 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ld_mlx.c,v 1.1 2001/02/04 17:05:12 ad Exp $ */
+/* $NetBSD: ld_mlx.c,v 1.2 2001/06/10 10:48:43 ad Exp $ */
/*-
* Copyright (c) 2001 The NetBSD Foundation, Inc.
@@ -113,22 +113,8 @@
ld->sc_maxqueuecnt = 1;
ld->sc_start = ld_mlx_start;
ld->sc_dump = ld_mlx_dump;
-
- /*
- * Build synthetic geometry.
- */
ld->sc_secperunit = ms->ms_size;
- if (ld->sc_secperunit > 0x200000) {
- ld->sc_nheads = 255;
- ld->sc_nsectors = 63;
- ld->sc_ncylinders = ms->ms_size / (255 * 63);
- } else {
- ld->sc_nheads = 128;
- ld->sc_nsectors = 32;
- ld->sc_ncylinders = ms->ms_size / (128 * 32);
- }
-
/*
* Report on current status, and attach to the ld driver proper.
*/
diff -r 5cd2039d8798 -r 95836d6df295 sys/dev/ld.c
--- a/sys/dev/ld.c Sun Jun 10 10:34:44 2001 +0000
+++ b/sys/dev/ld.c Sun Jun 10 10:48:42 2001 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ld.c,v 1.8 2001/04/30 02:46:06 lukem Exp $ */
+/* $NetBSD: ld.c,v 1.9 2001/06/10 10:48:42 ad Exp $ */
/*-
* Copyright (c) 1998, 2000 The NetBSD Foundation, Inc.
@@ -96,6 +96,22 @@
if (sc->sc_maxxfer > MAXPHYS)
sc->sc_maxxfer = MAXPHYS;
+ /* Build synthetic geometry. */
+ if (sc->sc_secperunit <= 528 * 2048) /* 528MB */
+ sc->sc_nheads = 16;
+ else if (sc->sc_secperunit <= 1024 * 2048) /* 1GB */
+ sc->sc_nheads = 32;
+ else if (sc->sc_secperunit <= 21504 * 2048) /* 21GB */
+ sc->sc_nheads = 64;
+ else if (sc->sc_secperunit <= 43008 * 2048) /* 42GB */
+ sc->sc_nheads = 128;
+ else
+ sc->sc_nheads = 255;
+
+ sc->sc_nsectors = 63;
+ sc->sc_ncylinders = sc->sc_secperunit /
+ (sc->sc_nheads * sc->sc_nsectors);
+
format_bytes(buf, sizeof(buf), (u_int64_t)sc->sc_secperunit *
sc->sc_secsize);
printf("%s: %s, %d cyl, %d head, %d sec, %d bytes/sect x %d sectors\n",
diff -r 5cd2039d8798 -r 95836d6df295 sys/dev/ldvar.h
--- a/sys/dev/ldvar.h Sun Jun 10 10:34:44 2001 +0000
+++ b/sys/dev/ldvar.h Sun Jun 10 10:48:42 2001 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ldvar.h,v 1.4 2001/02/04 17:15:37 ad Exp $ */
+/* $NetBSD: ldvar.h,v 1.5 2001/06/10 10:48:42 ad Exp $ */
/*-
* Copyright (c) 2000 The NetBSD Foundation, Inc.
@@ -46,19 +46,19 @@
#if NRND > 0
rndsource_element_t sc_rnd_source;
#endif
- int sc_queuecnt;
+ int sc_queuecnt; /* current h/w queue depth */
+ int sc_ncylinders; /* # cylinders */
+ int sc_nheads; /* # heads */
+ int sc_nsectors; /* # sectors per track */
/*
* The following are filled by hardware specific attachment code.
*/
- int sc_flags; /* control flags */
- int sc_secperunit; /* # sectors in total */
- int sc_ncylinders; /* # cylinders */
- int sc_nheads; /* # heads */
- int sc_nsectors; /* # sectors per track */
- int sc_secsize; /* sector size in bytes */
- int sc_maxxfer; /* max xfer size in bytes */
- int sc_maxqueuecnt; /* maximum h/w queue count */
+ int sc_flags; /* control flags */
+ int sc_secperunit; /* # sectors in total */
+ int sc_secsize; /* sector size in bytes */
+ int sc_maxxfer; /* max xfer size in bytes */
+ int sc_maxqueuecnt; /* maximum h/w queue depth */
int (*sc_dump)(struct ld_softc *, void *, int, int);
int (*sc_flush)(struct ld_softc *);
diff -r 5cd2039d8798 -r 95836d6df295 sys/dev/pci/ld_twe.c
--- a/sys/dev/pci/ld_twe.c Sun Jun 10 10:34:44 2001 +0000
+++ b/sys/dev/pci/ld_twe.c Sun Jun 10 10:48:42 2001 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ld_twe.c,v 1.6 2001/01/26 19:53:15 ad Exp $ */
+/* $NetBSD: ld_twe.c,v 1.7 2001/06/10 10:48:43 ad Exp $ */
/*-
* Copyright (c) 2000 The NetBSD Foundation, Inc.
@@ -107,17 +107,6 @@
ld->sc_start = ld_twe_start;
ld->sc_dump = ld_twe_dump;
- /* Build synthetic geometry as per controller internal rules. */
- if (ld->sc_secperunit > 0x200000) {
- ld->sc_nheads = 255;
- ld->sc_nsectors = 63;
- } else {
- ld->sc_nheads = 64;
- ld->sc_nsectors = 32;
- }
- ld->sc_ncylinders = ld->sc_secperunit /
- (ld->sc_nheads * ld->sc_nsectors);
-
printf("\n");
ldattach(ld);
}
Home |
Main Index |
Thread Index |
Old Index