Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/jdolecek-ncqfixes]: src/sys/dev move ATAPI-only members of ata_xfer to a...
details: https://anonhg.NetBSD.org/src/rev/6a5cd3159111
branches: jdolecek-ncqfixes
changeset: 1025075:6a5cd3159111
user: jdolecek <jdolecek%NetBSD.org@localhost>
date: Mon Sep 17 19:30:25 2018 +0000
description:
move ATAPI-only members of ata_xfer to an union struct to further save space
diffstat:
sys/dev/ata/atavar.h | 13 ++++++++-----
sys/dev/ic/ahcisata_core.c | 8 ++++----
sys/dev/ic/mvsata.c | 21 +++++++++++----------
sys/dev/ic/siisata.c | 8 ++++----
sys/dev/scsipi/atapi_wdc.c | 26 +++++++++++++-------------
5 files changed, 40 insertions(+), 36 deletions(-)
diffs (286 lines):
diff -r 48ff88b31977 -r 6a5cd3159111 sys/dev/ata/atavar.h
--- a/sys/dev/ata/atavar.h Mon Sep 17 19:00:43 2018 +0000
+++ b/sys/dev/ata/atavar.h Mon Sep 17 19:30:25 2018 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: atavar.h,v 1.99.2.3 2018/09/17 19:00:43 jdolecek Exp $ */
+/* $NetBSD: atavar.h,v 1.99.2.4 2018/09/17 19:30:25 jdolecek Exp $ */
/*
* Copyright (c) 1998, 2001 Manuel Bouyer.
@@ -144,8 +144,6 @@
void *c_databuf; /* pointer to data buffer */
int c_bcount; /* byte count left */
int c_skip; /* bytes already transferred */
- int c_dscpoll; /* counter for dsc polling (ATAPI) */
- int c_lenoff; /* offset to c_bcount (ATAPI) */
#define ATACH_ERR_ST(error, status) ((error) << 8 | (status))
#define ATACH_ERR(val) (((val) >> 8) & 0xff)
#define ATACH_ST(val) (((val) >> 0) & 0xff)
@@ -153,11 +151,16 @@
union {
struct ata_bio c_bio; /* ATA transfer */
struct ata_command c_ata_c; /* ATA command */
- struct scsipi_xfer *c_scsipi; /* SCSI transfer */
+ struct {
+ struct scsipi_xfer *c_scsipi; /* SCSI transfer */
+ int c_dscpoll; /* counter for dsc polling (ATAPI) */
+ int c_lenoff; /* offset to c_bcount (ATAPI) */
+ } atapi;
} u;
#define c_bio u.c_bio
#define c_ata_c u.c_ata_c
-#define c_scsipi u.c_scsipi
+#define c_atapi u.atapi
+#define c_scsipi c_atapi.c_scsipi
/* Link on the command queue. */
SIMPLEQ_ENTRY(ata_xfer) c_xferchain;
diff -r 48ff88b31977 -r 6a5cd3159111 sys/dev/ic/ahcisata_core.c
--- a/sys/dev/ic/ahcisata_core.c Mon Sep 17 19:00:43 2018 +0000
+++ b/sys/dev/ic/ahcisata_core.c Mon Sep 17 19:30:25 2018 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ahcisata_core.c,v 1.62.2.3 2018/09/17 18:36:13 jdolecek Exp $ */
+/* $NetBSD: ahcisata_core.c,v 1.62.2.4 2018/09/17 19:30:25 jdolecek Exp $ */
/*
* Copyright (c) 2006 Manuel Bouyer.
@@ -26,7 +26,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ahcisata_core.c,v 1.62.2.3 2018/09/17 18:36:13 jdolecek Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ahcisata_core.c,v 1.62.2.4 2018/09/17 19:30:25 jdolecek Exp $");
#include <sys/types.h>
#include <sys/malloc.h>
@@ -1877,11 +1877,11 @@
xfer->c_flags |= C_POLL;
xfer->c_drive = drive;
xfer->c_flags |= C_ATAPI;
- xfer->c_scsipi = sc_xfer;
xfer->c_databuf = sc_xfer->data;
xfer->c_bcount = sc_xfer->datalen;
xfer->ops = &ahci_atapi_xfer_ops;
- xfer->c_dscpoll = 0;
+ xfer->c_scsipi = sc_xfer;
+ xfer->c_atapi.c_dscpoll = 0;
s = splbio();
ata_exec_xfer(atac->atac_channels[channel], xfer);
#ifdef DIAGNOSTIC
diff -r 48ff88b31977 -r 6a5cd3159111 sys/dev/ic/mvsata.c
--- a/sys/dev/ic/mvsata.c Mon Sep 17 19:00:43 2018 +0000
+++ b/sys/dev/ic/mvsata.c Mon Sep 17 19:30:25 2018 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: mvsata.c,v 1.41.2.2 2018/09/17 18:36:14 jdolecek Exp $ */
+/* $NetBSD: mvsata.c,v 1.41.2.3 2018/09/17 19:30:25 jdolecek Exp $ */
/*
* Copyright (c) 2008 KIYOHARA Takashi
* All rights reserved.
@@ -26,7 +26,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: mvsata.c,v 1.41.2.2 2018/09/17 18:36:14 jdolecek Exp $");
+__KERNEL_RCSID(0, "$NetBSD: mvsata.c,v 1.41.2.3 2018/09/17 19:30:25 jdolecek Exp $");
#include "opt_mvsata.h"
@@ -2092,11 +2092,11 @@
xfer->c_flags |= C_POLL;
xfer->c_drive = drive;
xfer->c_flags |= C_ATAPI;
- xfer->c_scsipi = sc_xfer;
xfer->c_databuf = sc_xfer->data;
xfer->c_bcount = sc_xfer->datalen;
xfer->ops = &mvsata_atapi_xfer_ops;
- xfer->c_dscpoll = 0;
+ xfer->c_scsipi = sc_xfer;
+ xfer->c_atapi.c_dscpoll = 0;
s = splbio();
ata_exec_xfer(chp, xfer);
#ifdef DIAGNOSTIC
@@ -2444,7 +2444,7 @@
mvsata_atapi_reset(chp, xfer);
return 1;
}
- xfer->c_lenoff = len - xfer->c_bcount;
+ xfer->c_atapi.c_lenoff = len - xfer->c_bcount;
if (xfer->c_bcount < len) {
aprint_error_dev(atac->atac_dev, "channel %d drive %d:"
" warning: write only %d of %d requested bytes\n",
@@ -2456,7 +2456,7 @@
wdc->dataout_pio(chp, drvp->drive_flags,
(char *)xfer->c_databuf + xfer->c_skip, len);
- for (i = xfer->c_lenoff; i > 0; i -= 2)
+ for (i = xfer->c_atapi.c_lenoff; i > 0; i -= 2)
MVSATA_WDC_WRITE_2(mvport, SRB_PIOD, 0);
xfer->c_skip += len;
@@ -2480,7 +2480,7 @@
mvsata_atapi_reset(chp, xfer);
return 1;
}
- xfer->c_lenoff = len - xfer->c_bcount;
+ xfer->c_atapi.c_lenoff = len - xfer->c_bcount;
if (xfer->c_bcount < len) {
aprint_error_dev(atac->atac_dev, "channel %d drive %d:"
" warning: reading only %d of %d bytes\n",
@@ -2492,7 +2492,7 @@
wdc->datain_pio(chp, drvp->drive_flags,
(char *)xfer->c_databuf + xfer->c_skip, len);
- if (xfer->c_lenoff > 0)
+ if (xfer->c_atapi.c_lenoff > 0)
wdcbit_bucket(chp, len - xfer->c_bcount);
xfer->c_skip += len;
@@ -2625,14 +2625,15 @@
DPRINTF(DEBUG_XFERS,
("%s:%d:%d: mvsata_atapi_phase_complete: polldsc %d\n",
device_xname(atac->atac_dev), chp->ch_channel,
- xfer->c_drive, xfer->c_dscpoll));
+ xfer->c_drive, xfer->c_atapi.c_dscpoll));
if (cold)
panic("mvsata_atapi_phase_complete: cold");
if (wdcwait(chp, WDCS_DSC, WDCS_DSC, 10, AT_POLL, &tfd) ==
WDCWAIT_TOUT) {
/* 10ms not enough, try again in 1 tick */
- if (xfer->c_dscpoll++ > mstohz(sc_xfer->timeout)) {
+ if (xfer->c_atapi.c_dscpoll++ >
+ mstohz(sc_xfer->timeout)) {
aprint_error_dev(atac->atac_dev,
"channel %d: wait_for_dsc failed\n",
chp->ch_channel);
diff -r 48ff88b31977 -r 6a5cd3159111 sys/dev/ic/siisata.c
--- a/sys/dev/ic/siisata.c Mon Sep 17 19:00:43 2018 +0000
+++ b/sys/dev/ic/siisata.c Mon Sep 17 19:30:25 2018 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: siisata.c,v 1.35.6.3 2018/09/17 18:36:14 jdolecek Exp $ */
+/* $NetBSD: siisata.c,v 1.35.6.4 2018/09/17 19:30:26 jdolecek Exp $ */
/* from ahcisata_core.c */
@@ -79,7 +79,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: siisata.c,v 1.35.6.3 2018/09/17 18:36:14 jdolecek Exp $");
+__KERNEL_RCSID(0, "$NetBSD: siisata.c,v 1.35.6.4 2018/09/17 19:30:26 jdolecek Exp $");
#include <sys/types.h>
#include <sys/param.h>
@@ -1837,11 +1837,11 @@
xfer->c_flags |= C_POLL;
xfer->c_drive = drive;
xfer->c_flags |= C_ATAPI;
- xfer->c_scsipi = sc_xfer;
xfer->c_databuf = sc_xfer->data;
xfer->c_bcount = sc_xfer->datalen;
xfer->ops = &siisata_atapi_xfer_ops;
- xfer->c_dscpoll = 0;
+ xfer->c_scsipi = sc_xfer;
+ xfer->c_atapi.c_dscpoll = 0;
s = splbio();
ata_exec_xfer(atac->atac_channels[channel], xfer);
#ifdef DIAGNOSTIC
diff -r 48ff88b31977 -r 6a5cd3159111 sys/dev/scsipi/atapi_wdc.c
--- a/sys/dev/scsipi/atapi_wdc.c Mon Sep 17 19:00:43 2018 +0000
+++ b/sys/dev/scsipi/atapi_wdc.c Mon Sep 17 19:30:25 2018 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: atapi_wdc.c,v 1.129.6.2 2018/09/17 18:36:14 jdolecek Exp $ */
+/* $NetBSD: atapi_wdc.c,v 1.129.6.3 2018/09/17 19:30:26 jdolecek Exp $ */
/*
* Copyright (c) 1998, 2001 Manuel Bouyer.
@@ -25,7 +25,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: atapi_wdc.c,v 1.129.6.2 2018/09/17 18:36:14 jdolecek Exp $");
+__KERNEL_RCSID(0, "$NetBSD: atapi_wdc.c,v 1.129.6.3 2018/09/17 19:30:26 jdolecek Exp $");
#ifndef ATADEBUG
#define ATADEBUG
@@ -457,11 +457,11 @@
xfer->c_flags &= ~C_DMA;
#endif /* NATA_DMA */
- xfer->c_scsipi = sc_xfer;
xfer->c_databuf = sc_xfer->data;
xfer->c_bcount = sc_xfer->datalen;
xfer->ops = &wdc_atapi_xfer_ops;
- xfer->c_dscpoll = 0;
+ xfer->c_scsipi = sc_xfer;
+ xfer->c_atapi.c_dscpoll = 0;
s = splbio();
ata_exec_xfer(atac->atac_channels[channel], xfer);
#ifdef DIAGNOSTIC
@@ -781,8 +781,8 @@
/* restore transfer length */
len = xfer->c_bcount;
- if (xfer->c_lenoff < 0)
- len += xfer->c_lenoff;
+ if (xfer->c_atapi.c_lenoff < 0)
+ len += xfer->c_atapi.c_lenoff;
if (sc_xfer->xs_control & XS_CTL_DATA_IN)
goto end_piobm_datain;
@@ -915,7 +915,7 @@
return 1;
}
#endif
- xfer->c_lenoff = len - xfer->c_bcount;
+ xfer->c_atapi.c_lenoff = len - xfer->c_bcount;
if (xfer->c_bcount < len) {
printf("wdc_atapi_intr: warning: write only "
"%d of %d requested bytes\n", xfer->c_bcount, len);
@@ -940,7 +940,7 @@
#if NATA_PIOBM
end_piobm_dataout:
#endif
- for (i = xfer->c_lenoff; i > 0; i -= 2)
+ for (i = xfer->c_atapi.c_lenoff; i > 0; i -= 2)
bus_space_write_2(wdr->cmd_iot,
wdr->cmd_iohs[wd_data], 0, 0);
@@ -969,7 +969,7 @@
return 1;
}
#endif
- xfer->c_lenoff = len - xfer->c_bcount;
+ xfer->c_atapi.c_lenoff = len - xfer->c_bcount;
if (xfer->c_bcount < len) {
printf("wdc_atapi_intr: warning: reading only "
"%d of %d bytes\n", xfer->c_bcount, len);
@@ -994,8 +994,8 @@
#if NATA_PIOBM
end_piobm_datain:
#endif
- if (xfer->c_lenoff > 0)
- wdcbit_bucket(chp, xfer->c_lenoff);
+ if (xfer->c_atapi.c_lenoff > 0)
+ wdcbit_bucket(chp, xfer->c_atapi.c_lenoff);
xfer->c_skip += len;
xfer->c_bcount -= len;
@@ -1073,7 +1073,7 @@
ATADEBUG_PRINT(("wdc_atapi_phase_complete(%s:%d:%d) "
"polldsc %d\n", device_xname(atac->atac_dev),
chp->ch_channel,
- xfer->c_drive, xfer->c_dscpoll), DEBUG_XFERS);
+ xfer->c_drive, xfer->c_atapi.c_dscpoll), DEBUG_XFERS);
#if 1
if (cold)
panic("wdc_atapi_phase_complete: cold");
@@ -1081,7 +1081,7 @@
if (wdcwait(chp, WDCS_DSC, WDCS_DSC, 10,
AT_POLL, &tfd) == WDCWAIT_TOUT) {
/* 10ms not enough, try again in 1 tick */
- if (xfer->c_dscpoll++ >
+ if (xfer->c_atapi.c_dscpoll++ >
mstohz(sc_xfer->timeout)) {
printf("%s:%d:%d: wait_for_dsc "
"failed\n",
Home |
Main Index |
Thread Index |
Old Index