summaryrefslogtreecommitdiffstats
path: root/sys/i386/isa
diff options
context:
space:
mode:
authordyson <dyson@FreeBSD.org>1996-08-23 02:52:44 +0000
committerdyson <dyson@FreeBSD.org>1996-08-23 02:52:44 +0000
commite966f6932489f7ec6229d6994af7ffe5d52279c8 (patch)
tree13f35cc045b77a17a841e26dbfe5049fee5e187e /sys/i386/isa
parenta951e1ba652fefc491fbf6283cb7e0a430b41708 (diff)
downloadFreeBSD-src-e966f6932489f7ec6229d6994af7ffe5d52279c8.zip
FreeBSD-src-e966f6932489f7ec6229d6994af7ffe5d52279c8.tar.gz
Another attempt at making multi-sector mode work.
Diffstat (limited to 'sys/i386/isa')
-rw-r--r--sys/i386/isa/wd.c51
1 files changed, 35 insertions, 16 deletions
diff --git a/sys/i386/isa/wd.c b/sys/i386/isa/wd.c
index 1175a31..fe0e8d3 100644
--- a/sys/i386/isa/wd.c
+++ b/sys/i386/isa/wd.c
@@ -34,7 +34,7 @@
* SUCH DAMAGE.
*
* from: @(#)wd.c 7.2 (Berkeley) 5/9/91
- * $Id: wd.c,v 1.113 1996/07/27 19:01:10 dyson Exp $
+ * $Id: wd.c,v 1.114 1996/08/12 00:53:02 wpaul Exp $
*/
/* TODO:
@@ -1402,6 +1402,30 @@ wdcommand(struct disk *du, u_int cylinder, u_int head, u_int sector,
return (0);
}
+static void
+wdsetmulti(struct disk *du)
+{
+ /*
+ * The config option flags low 8 bits define the maximum multi-block
+ * transfer size. If the user wants the maximum that the drive
+ * is capable of, just set the low bits of the config option to
+ * 0x00ff.
+ */
+ if ((du->cfg_flags & WDOPT_MULTIMASK) != 0 && (du->dk_multi > 1)) {
+ int configval = du->cfg_flags & WDOPT_MULTIMASK;
+ du->dk_multi = min(du->dk_multi, configval);
+ if (wdcommand(du, 0, 0, 0, du->dk_multi, WDCC_SET_MULTI)) {
+ du->dk_multi = 1;
+ } else {
+ if (wdwait(du, WDCS_READY, TIMEOUT) < 0) {
+ du->dk_multi = 1;
+ }
+ }
+ } else {
+ du->dk_multi = 1;
+ }
+}
+
/*
* issue IDC to drive to tell it just what geometry it is to be.
*/
@@ -1449,26 +1473,15 @@ wdsetctlr(struct disk *du)
return (1);
}
- /*
- * The config option flags low 8 bits define the maximum multi-block
- * transfer size. If the user wants the maximum that the drive
- * is capable of, just set the low bits of the config option to
- * 0x00ff.
- */
- if ((du->cfg_flags & WDOPT_MULTIMASK) != 0 && (du->dk_multi > 1)) {
- if (du->dk_multi > (du->cfg_flags & WDOPT_MULTIMASK))
- du->dk_multi = du->cfg_flags & WDOPT_MULTIMASK;
- if (wdcommand(du, 0, 0, 0, du->dk_multi, WDCC_SET_MULTI)) {
- du->dk_multi = 1;
- }
- } else {
- du->dk_multi = 1;
- }
+ wdsetmulti(du);
#ifdef NOTYET
/* set read caching and write caching */
wdcommand(du, 0, 0, 0, WDFEA_RCACHE, WDCC_FEATURES);
+ wdwait(du, WDCS_READY, TIMEOUT);
+
wdcommand(du, 0, 0, 0, WDFEA_WCACHE, WDCC_FEATURES);
+ wdwait(du, WDCS_READY, TIMEOUT);
#endif
return (0);
@@ -1642,6 +1655,12 @@ failed:
wp->wdp_model[i] = '\0';
}
+ /*
+ * find out the drives maximum multi-block transfer capability
+ */
+ du->dk_multi = wp->wdp_nsecperint & 0xff;
+ wdsetmulti(du);
+
#ifdef WDDEBUG
printf(
"\nwd(%d,%d): wdgetctlr: gc %x cyl %d trk %d sec %d type %d sz %d model %s\n",
OpenPOWER on IntegriCloud