Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/jdolecek-ncq]: src/sys/dev/ata introduce ATA_BSIZE and use it instead of...
details: https://anonhg.NetBSD.org/src/rev/b220d24b838d
branches: jdolecek-ncq
changeset: 352792:b220d24b838d
user: jdolecek <jdolecek%NetBSD.org@localhost>
date: Fri Sep 29 20:05:07 2017 +0000
description:
introduce ATA_BSIZE and use it instead of DEV_BSIZE for get params and
recovery, where they are by spec 512 bytes and not negotiable
diffstat:
sys/dev/ata/TODO.ncq | 4 ----
sys/dev/ata/ata.c | 16 ++++++++--------
sys/dev/ata/atavar.h | 6 ++++--
3 files changed, 12 insertions(+), 14 deletions(-)
diffs (113 lines):
diff -r 08aa2ccb38f9 -r b220d24b838d sys/dev/ata/TODO.ncq
--- a/sys/dev/ata/TODO.ncq Thu Sep 28 20:34:23 2017 +0000
+++ b/sys/dev/ata/TODO.ncq Fri Sep 29 20:05:07 2017 +0000
@@ -2,10 +2,6 @@
----
test wd* at umass?, confirm the ata_channel kludge works
-stop using DEV_BSIZE when really meaning ATA sector size and revert
-<sys/param.h> inclusion in:
-cvs rdiff -u -r1.2.30.1 -r1.2.30.2 src/sys/arch/amiga/dev/wdc_xsurf.c
-
Other random notes (do outside the NCQ branch):
-----------------------------------------------------
do biodone() in wddone() starting the dump to not leak bufs when dumping from
diff -r 08aa2ccb38f9 -r b220d24b838d sys/dev/ata/ata.c
--- a/sys/dev/ata/ata.c Thu Sep 28 20:34:23 2017 +0000
+++ b/sys/dev/ata/ata.c Fri Sep 29 20:05:07 2017 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ata.c,v 1.132.8.38 2017/09/27 19:05:57 jdolecek Exp $ */
+/* $NetBSD: ata.c,v 1.132.8.39 2017/09/29 20:05:07 jdolecek Exp $ */
/*
* Copyright (c) 1998, 2001 Manuel Bouyer. All rights reserved.
@@ -25,7 +25,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ata.c,v 1.132.8.38 2017/09/27 19:05:57 jdolecek Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ata.c,v 1.132.8.39 2017/09/29 20:05:07 jdolecek Exp $");
#include "opt_ata.h"
@@ -961,7 +961,7 @@
return CMD_AGAIN;
}
- tb = kmem_zalloc(DEV_BSIZE, KM_SLEEP);
+ tb = kmem_zalloc(ATA_BSIZE, KM_SLEEP);
memset(prms, 0, sizeof(struct ataparams));
if (drvp->drive_type == ATA_DRIVET_ATA) {
@@ -982,7 +982,7 @@
}
xfer->c_ata_c.flags = AT_READ | flags;
xfer->c_ata_c.data = tb;
- xfer->c_ata_c.bcount = DEV_BSIZE;
+ xfer->c_ata_c.bcount = ATA_BSIZE;
if ((*atac->atac_bustype_ata->ata_exec_command)(drvp,
xfer) != ATACMD_COMPLETE) {
ATADEBUG_PRINT(("ata_get_parms: wdc_exec_command failed\n"),
@@ -1044,7 +1044,7 @@
rv = CMD_OK;
out:
- kmem_free(tb, DEV_BSIZE);
+ kmem_free(tb, ATA_BSIZE);
ata_free_xfer(chp, xfer);
return rv;
}
@@ -1110,7 +1110,7 @@
xfer = ata_get_xfer_ext(chp, C_RECOVERY, 0);
tb = drvp->recovery_blk;
- memset(tb, 0, DEV_BSIZE);
+ memset(tb, 0, sizeof(drvp->recovery_blk));
/*
* We could use READ LOG DMA EXT if drive supports it (i.e.
@@ -1128,7 +1128,7 @@
xfer->c_ata_c.flags = AT_READ | AT_LBA | AT_LBA48 | flags;
xfer->c_ata_c.timeout = 1000; /* 1s */
xfer->c_ata_c.data = tb;
- xfer->c_ata_c.bcount = DEV_BSIZE;
+ xfer->c_ata_c.bcount = sizeof(drvp->recovery_blk);
if ((*atac->atac_bustype_ata->ata_exec_command)(drvp,
xfer) != ATACMD_COMPLETE) {
@@ -1141,7 +1141,7 @@
}
cksum = 0;
- for (int i = 0; i < DEV_BSIZE; i++)
+ for (int i = 0; i < sizeof(drvp->recovery_blk); i++)
cksum += tb[i];
if (cksum != 0) {
aprint_error_dev(drvp->drv_softc,
diff -r 08aa2ccb38f9 -r b220d24b838d sys/dev/ata/atavar.h
--- a/sys/dev/ata/atavar.h Thu Sep 28 20:34:23 2017 +0000
+++ b/sys/dev/ata/atavar.h Fri Sep 29 20:05:07 2017 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: atavar.h,v 1.92.8.28 2017/09/27 19:05:57 jdolecek Exp $ */
+/* $NetBSD: atavar.h,v 1.92.8.29 2017/09/29 20:05:07 jdolecek Exp $ */
/*
* Copyright (c) 1998, 2001 Manuel Bouyer.
@@ -207,6 +207,8 @@
#define ATA_MAX_OPENINGS 32
#define ATA_REAL_OPENINGS(op) ((op) > 1 ? (op) - 1 : 1)
+#define ATA_BSIZE 512 /* Standard ATA block size (bytes) */
+
/* Per-channel queue of ata_xfers */
#ifndef ATABUS_PRIVATE
struct ata_queue;
@@ -329,7 +331,7 @@
daddr_t badsect[127]; /* 126 plus trailing -1 marker */
/* Recovery buffer */
- uint8_t recovery_blk[DEV_BSIZE];
+ uint8_t recovery_blk[ATA_BSIZE];
};
/* User config flags that force (or disable) the use of a mode */
Home |
Main Index |
Thread Index |
Old Index