From owner-svn-src-stable-8@FreeBSD.ORG Sun Mar 6 11:51:39 2011 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 797C9106566B; Sun, 6 Mar 2011 11:51:39 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 663BC8FC12; Sun, 6 Mar 2011 11:51:39 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id p26BpdY5097150; Sun, 6 Mar 2011 11:51:39 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id p26Bpd12097140; Sun, 6 Mar 2011 11:51:39 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201103061151.p26Bpd12097140@svn.freebsd.org> From: Marius Strobl Date: Sun, 6 Mar 2011 11:51:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r219333 - in stable/8/sys: dev/ata dev/ata/chipsets powerpc/powermac X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 06 Mar 2011 11:51:39 -0000 Author: marius Date: Sun Mar 6 11:51:39 2011 New Revision: 219333 URL: http://svn.freebsd.org/changeset/base/219333 Log: MFC: r216013, r216083 Several chipset drivers alter parameters relevant for the DMA tag creation, i.e. alignment, max_address, max_iosize and segsize (only max_address is thought to have an negative impact regarding this issue though), after calling ata_dmainit() either directly or indirectly so these values have no effect or at least no effect on the DMA tags and the defaults are used for the latter instead. So change the drivers to set these parameters up-front and ata_dmainit() to honor them. Reviewd by: mav Modified: stable/8/sys/dev/ata/ata-dma.c stable/8/sys/dev/ata/chipsets/ata-ahci.c stable/8/sys/dev/ata/chipsets/ata-cyrix.c stable/8/sys/dev/ata/chipsets/ata-marvell.c stable/8/sys/dev/ata/chipsets/ata-national.c stable/8/sys/dev/ata/chipsets/ata-promise.c stable/8/sys/dev/ata/chipsets/ata-serverworks.c stable/8/sys/dev/ata/chipsets/ata-siliconimage.c stable/8/sys/powerpc/powermac/ata_dbdma.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) Modified: stable/8/sys/dev/ata/ata-dma.c ============================================================================== --- stable/8/sys/dev/ata/ata-dma.c Sun Mar 6 11:43:02 2011 (r219332) +++ stable/8/sys/dev/ata/ata-dma.c Sun Mar 6 11:51:39 2011 (r219333) @@ -68,17 +68,28 @@ ata_dmainit(device_t dev) struct ata_channel *ch = device_get_softc(dev); struct ata_dc_cb_args dcba; - ch->dma.alloc = ata_dmaalloc; - ch->dma.free = ata_dmafree; - ch->dma.setprd = ata_dmasetprd; - ch->dma.load = ata_dmaload; - ch->dma.unload = ata_dmaunload; - ch->dma.alignment = 2; - ch->dma.boundary = 65536; - ch->dma.segsize = 65536; - ch->dma.max_iosize = MIN((ATA_DMA_ENTRIES - 1) * PAGE_SIZE, MAXPHYS); - ch->dma.max_address = BUS_SPACE_MAXADDR_32BIT; - ch->dma.dma_slots = 1; + if (ch->dma.alloc == NULL) + ch->dma.alloc = ata_dmaalloc; + if (ch->dma.free == NULL) + ch->dma.free = ata_dmafree; + if (ch->dma.setprd == NULL) + ch->dma.setprd = ata_dmasetprd; + if (ch->dma.load == NULL) + ch->dma.load = ata_dmaload; + if (ch->dma.unload == NULL) + ch->dma.unload = ata_dmaunload; + if (ch->dma.alignment == 0) + ch->dma.alignment = 2; + if (ch->dma.boundary == 0) + ch->dma.boundary = 65536; + if (ch->dma.segsize == 0) + ch->dma.segsize = 65536; + if (ch->dma.max_iosize == 0) + ch->dma.max_iosize = MIN((ATA_DMA_ENTRIES - 1) * PAGE_SIZE, MAXPHYS); + if (ch->dma.max_address == 0) + ch->dma.max_address = BUS_SPACE_MAXADDR_32BIT; + if (ch->dma.dma_slots == 0) + ch->dma.dma_slots = 1; if (bus_dma_tag_create(bus_get_dma_tag(dev), ch->dma.alignment, 0, ch->dma.max_address, BUS_SPACE_MAXADDR, Modified: stable/8/sys/dev/ata/chipsets/ata-ahci.c ============================================================================== --- stable/8/sys/dev/ata/chipsets/ata-ahci.c Sun Mar 6 11:43:02 2011 (r219332) +++ stable/8/sys/dev/ata/chipsets/ata-ahci.c Sun Mar 6 11:51:39 2011 (r219333) @@ -1005,12 +1005,12 @@ ata_ahci_dmainit(device_t dev) struct ata_pci_controller *ctlr = device_get_softc(device_get_parent(dev)); struct ata_channel *ch = device_get_softc(dev); - ata_dmainit(dev); /* note start and stop are not used here */ ch->dma.setprd = ata_ahci_dmasetprd; ch->dma.max_iosize = (ATA_AHCI_DMA_ENTRIES - 1) * PAGE_SIZE; if (ATA_INL(ctlr->r_res2, ATA_AHCI_CAP) & ATA_AHCI_CAP_64BIT) ch->dma.max_address = BUS_SPACE_MAXADDR; + ata_dmainit(dev); } static int Modified: stable/8/sys/dev/ata/chipsets/ata-cyrix.c ============================================================================== --- stable/8/sys/dev/ata/chipsets/ata-cyrix.c Sun Mar 6 11:43:02 2011 (r219332) +++ stable/8/sys/dev/ata/chipsets/ata-cyrix.c Sun Mar 6 11:51:39 2011 (r219333) @@ -56,7 +56,6 @@ static int ata_cyrix_chipinit(device_t d static int ata_cyrix_ch_attach(device_t dev); static int ata_cyrix_setmode(device_t dev, int target, int mode); - /* * Cyrix chipset support functions */ @@ -89,15 +88,12 @@ static int ata_cyrix_ch_attach(device_t dev) { struct ata_channel *ch = device_get_softc(dev); - int error; - error = ata_pci_ch_attach(dev); ch->dma.alignment = 16; ch->dma.max_iosize = 64 * DEV_BSIZE; - return (error); + return (ata_pci_ch_attach(dev)); } - static int ata_cyrix_setmode(device_t dev, int target, int mode) { Modified: stable/8/sys/dev/ata/chipsets/ata-marvell.c ============================================================================== --- stable/8/sys/dev/ata/chipsets/ata-marvell.c Sun Mar 6 11:43:02 2011 (r219332) +++ stable/8/sys/dev/ata/chipsets/ata-marvell.c Sun Mar 6 11:51:39 2011 (r219333) @@ -614,7 +614,6 @@ ata_marvell_edma_dmainit(device_t dev) struct ata_pci_controller *ctlr = device_get_softc(device_get_parent(dev)); struct ata_channel *ch = device_get_softc(dev); - ata_dmainit(dev); /* note start and stop are not used here */ ch->dma.setprd = ata_marvell_edma_dmasetprd; @@ -625,6 +624,7 @@ ata_marvell_edma_dmainit(device_t dev) /* chip does not reliably do 64K DMA transfers */ if (ctlr->chip->cfg2 == MV_50XX || ctlr->chip->cfg2 == MV_60XX) ch->dma.max_iosize = 64 * DEV_BSIZE; + ata_dmainit(dev); } ATA_DECLARE_DRIVER(ata_marvell); Modified: stable/8/sys/dev/ata/chipsets/ata-national.c ============================================================================== --- stable/8/sys/dev/ata/chipsets/ata-national.c Sun Mar 6 11:43:02 2011 (r219332) +++ stable/8/sys/dev/ata/chipsets/ata-national.c Sun Mar 6 11:51:39 2011 (r219333) @@ -90,12 +90,10 @@ static int ata_national_ch_attach(device_t dev) { struct ata_channel *ch = device_get_softc(dev); - int error; - error = ata_pci_ch_attach(dev); ch->dma.alignment = 16; ch->dma.max_iosize = 64 * DEV_BSIZE; - return (error); + return (ata_pci_ch_attach(dev)); } static int Modified: stable/8/sys/dev/ata/chipsets/ata-promise.c ============================================================================== --- stable/8/sys/dev/ata/chipsets/ata-promise.c Sun Mar 6 11:43:02 2011 (r219332) +++ stable/8/sys/dev/ata/chipsets/ata-promise.c Sun Mar 6 11:51:39 2011 (r219333) @@ -979,13 +979,12 @@ ata_promise_mio_dmainit(device_t dev) { struct ata_channel *ch = device_get_softc(dev); - ata_dmainit(dev); /* note start and stop are not used here */ ch->dma.setprd = ata_promise_mio_setprd; ch->dma.max_iosize = 65536; + ata_dmainit(dev); } - #define MAXLASTSGSIZE (32 * sizeof(u_int32_t)) static void ata_promise_mio_setprd(void *xsc, bus_dma_segment_t *segs, int nsegs, int error) Modified: stable/8/sys/dev/ata/chipsets/ata-serverworks.c ============================================================================== --- stable/8/sys/dev/ata/chipsets/ata-serverworks.c Sun Mar 6 11:43:02 2011 (r219332) +++ stable/8/sys/dev/ata/chipsets/ata-serverworks.c Sun Mar 6 11:51:39 2011 (r219333) @@ -182,8 +182,6 @@ ata_serverworks_ch_attach(device_t dev) int ch_offset; int i; - ata_pci_dmainit(dev); - ch_offset = ch->unit * 0x100; for (i = ATA_DATA; i < ATA_MAX_RES; i++) @@ -253,6 +251,8 @@ ata_serverworks_ch_attach(device_t dev) /* chip does not reliably do 64K DMA transfers */ ch->dma.max_iosize = 64 * DEV_BSIZE; + ata_pci_dmainit(dev); + return 0; } Modified: stable/8/sys/dev/ata/chipsets/ata-siliconimage.c ============================================================================== --- stable/8/sys/dev/ata/chipsets/ata-siliconimage.c Sun Mar 6 11:43:02 2011 (r219332) +++ stable/8/sys/dev/ata/chipsets/ata-siliconimage.c Sun Mar 6 11:51:39 2011 (r219333) @@ -289,8 +289,6 @@ ata_sii_ch_attach(device_t dev) int unit01 = (ch->unit & 1), unit10 = (ch->unit & 2); int i; - ata_pci_dmainit(dev); - for (i = ATA_DATA; i <= ATA_COMMAND; i++) { ch->r_io[i].res = ctlr->r_res2; ch->r_io[i].offset = 0x80 + i + (unit01 << 6) + (unit10 << 8); @@ -332,6 +330,9 @@ ata_sii_ch_attach(device_t dev) ch->hw.status = ata_sii_status; if (ctlr->chip->cfg2 & SII_SETCLK) ch->flags |= ATA_CHECKS_CABLE; + + ata_pci_dmainit(dev); + return 0; } @@ -915,11 +916,11 @@ ata_siiprb_dmainit(device_t dev) { struct ata_channel *ch = device_get_softc(dev); - ata_dmainit(dev); /* note start and stop are not used here */ ch->dma.setprd = ata_siiprb_dmasetprd; ch->dma.max_address = BUS_SPACE_MAXADDR; ch->dma.max_iosize = (ATA_SIIPRB_DMA_ENTRIES - 1) * PAGE_SIZE; + ata_dmainit(dev); } ATA_DECLARE_DRIVER(ata_sii); Modified: stable/8/sys/powerpc/powermac/ata_dbdma.c ============================================================================== --- stable/8/sys/powerpc/powermac/ata_dbdma.c Sun Mar 6 11:43:02 2011 (r219332) +++ stable/8/sys/powerpc/powermac/ata_dbdma.c Sun Mar 6 11:51:39 2011 (r219333) @@ -268,7 +268,6 @@ ata_dbdma_dmainit(device_t dev) dbdma_insert_stop(sc->dbdma,0); sc->next_dma_slot=1; - ata_dmainit(dev); sc->sc_ch.dma.start = ata_dbdma_start; sc->sc_ch.dma.stop = ata_dbdma_stop; sc->sc_ch.dma.load = ata_dbdma_load; @@ -279,9 +278,9 @@ ata_dbdma_dmainit(device_t dev) * if we try to do a 64K transfer, so stop short of 64K. */ sc->sc_ch.dma.segsize = 126 * DEV_BSIZE; + ata_dmainit(dev); sc->sc_ch.hw.status = ata_dbdma_status; mtx_init(&sc->dbdma_mtx, "ATA DBDMA", NULL, MTX_DEF); } -