Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/tls-maxphys]: src/sys/dev Support transfers of up to MACHINE_MAXPHYS in ...
details: https://anonhg.NetBSD.org/src/rev/de5a2079f36d
branches: tls-maxphys
changeset: 852924:de5a2079f36d
user: bouyer <bouyer%NetBSD.org@localhost>
date: Tue Oct 09 13:36:04 2012 +0000
description:
Support transfers of up to MACHINE_MAXPHYS in all pciide variants, and ahci.
wd(4) limits its maxphys depending on the drives's capability (64k sectors
for LBA48, 256 sectors for LBA and 128 sectors for older devices).
I assumed all pciide controllers could do MACHINE_MAXPHYS transfers, but
this may not be true. The capabilities of each controller variants should be
looked at more closely.
diffstat:
sys/dev/ata/atareg.h | 7 ++++++-
sys/dev/ata/wd.c | 30 ++++++++++++++++++++----------
sys/dev/ic/ahcisata_core.c | 11 ++++++-----
sys/dev/ic/ahcisatareg.h | 4 ++--
sys/dev/pci/acardide.c | 6 ++++--
sys/dev/pci/aceride.c | 6 ++++--
sys/dev/pci/ahcisata_pci.c | 6 ++++--
sys/dev/pci/artsata.c | 6 ++++--
sys/dev/pci/cmdide.c | 6 ++++--
sys/dev/pci/cypide.c | 6 ++++--
sys/dev/pci/geodeide.c | 6 ++++--
sys/dev/pci/hptide.c | 6 ++++--
sys/dev/pci/iteide.c | 6 ++++--
sys/dev/pci/ixpide.c | 6 ++++--
sys/dev/pci/jmide.c | 8 ++++++--
sys/dev/pci/nside.c | 6 ++++--
sys/dev/pci/optiide.c | 6 ++++--
sys/dev/pci/pciide.c | 7 +++----
sys/dev/pci/pciide_common.c | 10 ++++++----
sys/dev/pci/pdcide.c | 6 ++++--
sys/dev/pci/pdcsata.c | 6 ++++--
sys/dev/pci/piixide.c | 6 ++++--
sys/dev/pci/rccide.c | 6 ++++--
sys/dev/pci/rdcide.c | 6 ++++--
sys/dev/pci/schide.c | 6 ++++--
sys/dev/pci/siside.c | 6 ++++--
sys/dev/pci/slide.c | 6 ++++--
sys/dev/pci/stpcide.c | 6 ++++--
sys/dev/pci/svwsata.c | 6 ++++--
sys/dev/pci/toshide.c | 6 ++++--
sys/dev/pci/viaide.c | 6 ++++--
31 files changed, 145 insertions(+), 76 deletions(-)
diffs (truncated from 927 to 300 lines):
diff -r 762c416c35cb -r de5a2079f36d sys/dev/ata/atareg.h
--- a/sys/dev/ata/atareg.h Sun Oct 07 23:46:59 2012 +0000
+++ b/sys/dev/ata/atareg.h Tue Oct 09 13:36:04 2012 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: atareg.h,v 1.40 2011/10/24 20:52:34 jakllsch Exp $ */
+/* $NetBSD: atareg.h,v 1.40.12.1 2012/10/09 13:36:04 bouyer Exp $ */
/*
* Copyright (c) 1998, 2001 Manuel Bouyer.
@@ -138,6 +138,11 @@
#define WDCC_READDMA_EXT 0x25 /* read 48-bit addressing with DMA */
#define WDCC_WRITEDMA_EXT 0x35 /* write 48-bit addressing with DMA */
+/* max transfer size for READ and WRITE commands */
+#define WDC_SECCNT_MAX (1 << 7)
+#define WDC_SECCNT_MAX_LBA (1 << 8)
+#define WDC_SECCNT_MAX_LBAEXT (1 << 16)
+
#if defined(_KERNEL) || defined(_STANDALONE)
#include <dev/ata/ataconf.h>
diff -r 762c416c35cb -r de5a2079f36d sys/dev/ata/wd.c
--- a/sys/dev/ata/wd.c Sun Oct 07 23:46:59 2012 +0000
+++ b/sys/dev/ata/wd.c Tue Oct 09 13:36:04 2012 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: wd.c,v 1.400 2012/07/31 15:50:34 bouyer Exp $ */
+/* $NetBSD: wd.c,v 1.400.2.1 2012/10/09 13:36:04 bouyer Exp $ */
/*
* Copyright (c) 1998, 2001 Manuel Bouyer. All rights reserved.
@@ -54,7 +54,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: wd.c,v 1.400 2012/07/31 15:50:34 bouyer Exp $");
+__KERNEL_RCSID(0, "$NetBSD: wd.c,v 1.400.2.1 2012/10/09 13:36:04 bouyer Exp $");
#include "opt_ata.h"
@@ -356,17 +356,24 @@
wd->sc_capacity28 =
(wd->sc_params.atap_capacity[1] << 16) |
wd->sc_params.atap_capacity[0];
+ wd->sc_dev->dv_maxphys =
+ min(WDC_SECCNT_MAX_LBAEXT * DEV_BSIZE, parent->dv_maxphys);
+
} else if ((wd->sc_flags & WDF_LBA) != 0) {
aprint_verbose(" LBA addressing\n");
wd->sc_capacity28 = wd->sc_capacity =
(wd->sc_params.atap_capacity[1] << 16) |
wd->sc_params.atap_capacity[0];
+ wd->sc_dev->dv_maxphys =
+ min(WDC_SECCNT_MAX_LBA * DEV_BSIZE, parent->dv_maxphys);
} else {
aprint_verbose(" chs addressing\n");
wd->sc_capacity28 = wd->sc_capacity =
wd->sc_params.atap_cylinders *
wd->sc_params.atap_heads *
wd->sc_params.atap_sectors;
+ wd->sc_dev->dv_maxphys =
+ min(WDC_SECCNT_MAX * DEV_BSIZE, parent->dv_maxphys);
}
format_bytes(pbuf, sizeof(pbuf), wd->sc_capacity * DEV_BSIZE);
aprint_normal_dev(self, "%s, %d cyl, %d head, %d sec, "
@@ -488,7 +495,7 @@
/* Valid request? */
if (bp->b_blkno < 0 ||
(bp->b_bcount % lp->d_secsize) != 0 ||
- (bp->b_bcount / lp->d_secsize) >= (1 << NBBY)) {
+ bp->b_bcount > wd->sc_dev->dv_maxphys) {
bp->b_error = EINVAL;
goto done;
}
@@ -719,9 +726,11 @@
else
wd->sc_wdc_bio.flags = 0;
if (wd->sc_flags & WDF_LBA48 &&
- (wd->sc_wdc_bio.blkno +
+ ((wd->sc_wdc_bio.blkno +
wd->sc_wdc_bio.bcount / wd->sc_dk.dk_label->d_secsize) >
- wd->sc_capacity28)
+ wd->sc_capacity28 ||
+ (wd->sc_wdc_bio.bcount / wd->sc_dk.dk_label->d_secsize) >
+ WDC_SECCNT_MAX_LBA))
wd->sc_wdc_bio.flags |= ATA_LBA48;
if (wd->sc_flags & WDF_LBA)
wd->sc_wdc_bio.flags |= ATA_LBA;
@@ -862,9 +871,10 @@
static void
wdminphys(struct buf *bp)
{
+ device_t wddev = device_lookup(&wd_cd, WDUNIT(bp->b_dev));
- if (bp->b_bcount > (512 * 128)) {
- bp->b_bcount = (512 * 128);
+ if (bp->b_bcount > wddev->dv_maxphys) {
+ bp->b_bcount = wddev->dv_maxphys;
}
minphys(bp);
}
@@ -1625,7 +1635,8 @@
wd->sc_wdc_bio.blkno = blkno;
wd->sc_wdc_bio.flags = ATA_POLL;
if (wd->sc_flags & WDF_LBA48 &&
- (wd->sc_wdc_bio.blkno + nblks) > wd->sc_capacity28)
+ ((wd->sc_wdc_bio.blkno + nblks) > wd->sc_capacity28 ||
+ nblks > WDC_SECCNT_MAX_LBA))
wd->sc_wdc_bio.flags |= ATA_LBA48;
if (wd->sc_flags & WDF_LBA)
wd->sc_wdc_bio.flags |= ATA_LBA;
@@ -2056,8 +2067,7 @@
*/
if ((bp->b_bcount % wi->wi_softc->sc_dk.dk_label->d_secsize) != 0 ||
- (bp->b_bcount / wi->wi_softc->sc_dk.dk_label->d_secsize) >=
- (1 << NBBY)) {
+ bp->b_bcount > wi->wi_softc->sc_dev->dv_maxphys) {
error = EINVAL;
goto bad;
}
diff -r 762c416c35cb -r de5a2079f36d sys/dev/ic/ahcisata_core.c
--- a/sys/dev/ic/ahcisata_core.c Sun Oct 07 23:46:59 2012 +0000
+++ b/sys/dev/ic/ahcisata_core.c Tue Oct 09 13:36:04 2012 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ahcisata_core.c,v 1.43 2012/08/20 12:48:47 bouyer Exp $ */
+/* $NetBSD: ahcisata_core.c,v 1.43.2.1 2012/10/09 13:36:04 bouyer Exp $ */
/*
* Copyright (c) 2006 Manuel Bouyer.
@@ -26,7 +26,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ahcisata_core.c,v 1.43 2012/08/20 12:48:47 bouyer Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ahcisata_core.c,v 1.43.2.1 2012/10/09 13:36:04 bouyer Exp $");
#include <sys/types.h>
#include <sys/malloc.h>
@@ -393,7 +393,8 @@
achp->ahcic_cmd_tbl[j],
(uint64_t)achp->ahcic_bus_cmd_tbl[j]), DEBUG_PROBE);
/* The xfer DMA map */
- error = bus_dmamap_create(sc->sc_dmat, MAXPHYS,
+ error = bus_dmamap_create(sc->sc_dmat,
+ sc->sc_atac.atac_dev->dv_maxphys,
AHCI_NPRD, 0x400000 /* 4MB */, 0,
BUS_DMA_NOWAIT | BUS_DMA_ALLOCNOW,
&achp->ahcic_datad[j]);
@@ -1462,8 +1463,8 @@
static void
ahci_atapi_minphys(struct buf *bp)
{
- if (bp->b_bcount > MAXPHYS)
- bp->b_bcount = MAXPHYS;
+ if (bp->b_bcount > MACHINE_MAXPHYS)
+ bp->b_bcount = MACHINE_MAXPHYS;
minphys(bp);
}
diff -r 762c416c35cb -r de5a2079f36d sys/dev/ic/ahcisatareg.h
--- a/sys/dev/ic/ahcisatareg.h Sun Oct 07 23:46:59 2012 +0000
+++ b/sys/dev/ic/ahcisatareg.h Tue Oct 09 13:36:04 2012 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ahcisatareg.h,v 1.11 2011/11/02 16:54:50 jakllsch Exp $ */
+/* $NetBSD: ahcisatareg.h,v 1.11.12.1 2012/10/09 13:36:04 bouyer Exp $ */
/*
* Copyright (c) 2006 Manuel Bouyer.
@@ -41,7 +41,7 @@
#define AHCI_PRD_DBC_IPC 0x80000000 /* interrupt on completion */
} __packed __aligned(8);
-#define AHCI_NPRD ((MAXPHYS/PAGE_SIZE) + 1)
+#define AHCI_NPRD ((MACHINE_MAXPHYS/PAGE_SIZE) + 1)
/* command table: describe a command to send to drive */
struct ahci_cmd_tbl {
diff -r 762c416c35cb -r de5a2079f36d sys/dev/pci/acardide.c
--- a/sys/dev/pci/acardide.c Sun Oct 07 23:46:59 2012 +0000
+++ b/sys/dev/pci/acardide.c Tue Oct 09 13:36:04 2012 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: acardide.c,v 1.30 2012/07/31 15:50:35 bouyer Exp $ */
+/* $NetBSD: acardide.c,v 1.30.2.1 2012/10/09 13:36:04 bouyer Exp $ */
/*-
* Copyright (c) 2001 Izumi Tsutsui. All rights reserved.
@@ -25,7 +25,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: acardide.c,v 1.30 2012/07/31 15:50:35 bouyer Exp $");
+__KERNEL_RCSID(0, "$NetBSD: acardide.c,v 1.30.2.1 2012/10/09 13:36:04 bouyer Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -99,6 +99,8 @@
struct pci_attach_args *pa = aux;
struct pciide_softc *sc = device_private(self);
+ self->dv_maxphys = MIN(parent->dv_maxphys, MACHINE_MAXPHYS);
+
sc->sc_wdcdev.sc_atac.atac_dev = self;
pciide_common_attach(sc, pa,
diff -r 762c416c35cb -r de5a2079f36d sys/dev/pci/aceride.c
--- a/sys/dev/pci/aceride.c Sun Oct 07 23:46:59 2012 +0000
+++ b/sys/dev/pci/aceride.c Tue Oct 09 13:36:04 2012 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: aceride.c,v 1.35 2012/07/31 15:50:35 bouyer Exp $ */
+/* $NetBSD: aceride.c,v 1.35.2.1 2012/10/09 13:36:05 bouyer Exp $ */
/*
* Copyright (c) 1999, 2000, 2001 Manuel Bouyer.
@@ -25,7 +25,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: aceride.c,v 1.35 2012/07/31 15:50:35 bouyer Exp $");
+__KERNEL_RCSID(0, "$NetBSD: aceride.c,v 1.35.2.1 2012/10/09 13:36:05 bouyer Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -87,6 +87,8 @@
struct pci_attach_args *pa = aux;
struct pciide_softc *sc = device_private(self);
+ self->dv_maxphys = MIN(parent->dv_maxphys, MACHINE_MAXPHYS);
+
sc->sc_wdcdev.sc_atac.atac_dev = self;
pciide_common_attach(sc, pa,
diff -r 762c416c35cb -r de5a2079f36d sys/dev/pci/ahcisata_pci.c
--- a/sys/dev/pci/ahcisata_pci.c Sun Oct 07 23:46:59 2012 +0000
+++ b/sys/dev/pci/ahcisata_pci.c Tue Oct 09 13:36:04 2012 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ahcisata_pci.c,v 1.30 2012/08/20 12:48:47 bouyer Exp $ */
+/* $NetBSD: ahcisata_pci.c,v 1.30.2.1 2012/10/09 13:36:05 bouyer Exp $ */
/*
* Copyright (c) 2006 Manuel Bouyer.
@@ -26,7 +26,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ahcisata_pci.c,v 1.30 2012/08/20 12:48:47 bouyer Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ahcisata_pci.c,v 1.30.2.1 2012/10/09 13:36:05 bouyer Exp $");
#include <sys/types.h>
#include <sys/malloc.h>
@@ -264,6 +264,8 @@
bool ahci_bad_64bit;
pci_intr_handle_t intrhandle;
+ self->dv_maxphys = MIN(parent->dv_maxphys, MACHINE_MAXPHYS);
+
sc->sc_atac.atac_dev = self;
if (pci_mapreg_map(pa, AHCI_PCI_ABAR,
diff -r 762c416c35cb -r de5a2079f36d sys/dev/pci/artsata.c
--- a/sys/dev/pci/artsata.c Sun Oct 07 23:46:59 2012 +0000
+++ b/sys/dev/pci/artsata.c Tue Oct 09 13:36:04 2012 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: artsata.c,v 1.24 2012/07/31 15:50:36 bouyer Exp $ */
+/* $NetBSD: artsata.c,v 1.24.2.1 2012/10/09 13:36:05 bouyer Exp $ */
/*-
* Copyright (c) 2003 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: artsata.c,v 1.24 2012/07/31 15:50:36 bouyer Exp $");
+__KERNEL_RCSID(0, "$NetBSD: artsata.c,v 1.24.2.1 2012/10/09 13:36:05 bouyer Exp $");
#include "opt_pciide.h"
@@ -111,6 +111,8 @@
struct pci_attach_args *pa = aux;
struct pciide_softc *sc = device_private(self);
+ self->dv_maxphys = MIN(parent->dv_maxphys, MACHINE_MAXPHYS);
+
sc->sc_wdcdev.sc_atac.atac_dev = self;
pciide_common_attach(sc, pa,
diff -r 762c416c35cb -r de5a2079f36d sys/dev/pci/cmdide.c
--- a/sys/dev/pci/cmdide.c Sun Oct 07 23:46:59 2012 +0000
+++ b/sys/dev/pci/cmdide.c Tue Oct 09 13:36:04 2012 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: cmdide.c,v 1.38 2012/09/03 15:38:17 kiyohara Exp $ */
+/* $NetBSD: cmdide.c,v 1.38.2.1 2012/10/09 13:36:05 bouyer Exp $ */
/*
* Copyright (c) 1999, 2000, 2001 Manuel Bouyer.
@@ -25,7 +25,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: cmdide.c,v 1.38 2012/09/03 15:38:17 kiyohara Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cmdide.c,v 1.38.2.1 2012/10/09 13:36:05 bouyer Exp $");
Home |
Main Index |
Thread Index |
Old Index