Module Name: src
Committed By: jdolecek
Date: Fri Sep 29 20:05:07 UTC 2017
Modified Files:
src/sys/dev/ata [jdolecek-ncq]: TODO.ncq ata.c atavar.h
Log Message:
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
To generate a diff of this commit:
cvs rdiff -u -r1.1.2.46 -r1.1.2.47 src/sys/dev/ata/TODO.ncq
cvs rdiff -u -r1.132.8.38 -r1.132.8.39 src/sys/dev/ata/ata.c
cvs rdiff -u -r1.92.8.28 -r1.92.8.29 src/sys/dev/ata/atavar.h
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sys/dev/ata/TODO.ncq
diff -u src/sys/dev/ata/TODO.ncq:1.1.2.46 src/sys/dev/ata/TODO.ncq:1.1.2.47
--- src/sys/dev/ata/TODO.ncq:1.1.2.46 Thu Sep 28 20:34:23 2017
+++ src/sys/dev/ata/TODO.ncq Fri Sep 29 20:05:07 2017
@@ -2,10 +2,6 @@ Bugs
----
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
Index: src/sys/dev/ata/ata.c
diff -u src/sys/dev/ata/ata.c:1.132.8.38 src/sys/dev/ata/ata.c:1.132.8.39
--- src/sys/dev/ata/ata.c:1.132.8.38 Wed Sep 27 19:05:57 2017
+++ src/sys/dev/ata/ata.c Fri Sep 29 20:05:07 2017
@@ -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 @@ ata_get_params(struct ata_drive_datas *d
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 @@ ata_get_params(struct ata_drive_datas *d
}
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 @@ ata_get_params(struct ata_drive_datas *d
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 @@ ata_read_log_ext_ncq(struct ata_drive_da
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 @@ ata_read_log_ext_ncq(struct ata_drive_da
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 @@ ata_read_log_ext_ncq(struct ata_drive_da
}
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,
Index: src/sys/dev/ata/atavar.h
diff -u src/sys/dev/ata/atavar.h:1.92.8.28 src/sys/dev/ata/atavar.h:1.92.8.29
--- src/sys/dev/ata/atavar.h:1.92.8.28 Wed Sep 27 19:05:57 2017
+++ src/sys/dev/ata/atavar.h Fri Sep 29 20:05:07 2017
@@ -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 @@ struct ata_xfer {
#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 @@ struct ata_drive_datas {
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 */