From fc625d2effe55974080df68b65af4e5bedba1b58 Mon Sep 17 00:00:00 2001 From: fvdl Date: Thu, 21 Jun 2007 11:32:54 +0000 Subject: [PATCH] * Add bus_dmamap_sync calls for cmd structure. * During initialization, use the right port index when setting up the physical pointers for a port. Fixes issue with non-contigous ports. Reviewed by Manuel. --- sys/dev/ic/ahcisata_core.c | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/sys/dev/ic/ahcisata_core.c b/sys/dev/ic/ahcisata_core.c index 9b8b162e8a49..3132846bb9d1 100644 --- a/sys/dev/ic/ahcisata_core.c +++ b/sys/dev/ic/ahcisata_core.c @@ -1,4 +1,4 @@ -/* $NetBSD: ahcisata_core.c,v 1.1 2007/05/12 11:04:58 bouyer Exp $ */ +/* $NetBSD: ahcisata_core.c,v 1.2 2007/06/21 11:32:54 fvdl Exp $ */ /* * Copyright (c) 2006 Manuel Bouyer. @@ -31,7 +31,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: ahcisata_core.c,v 1.1 2007/05/12 11:04:58 bouyer Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ahcisata_core.c,v 1.2 2007/06/21 11:32:54 fvdl Exp $"); #include #include @@ -276,10 +276,10 @@ ahci_attach(struct ahci_softc *sc) goto end; } } - AHCI_WRITE(sc, AHCI_P_CLB(port), achp->ahcic_bus_cmdh); - AHCI_WRITE(sc, AHCI_P_CLBU(port), 0); - AHCI_WRITE(sc, AHCI_P_FB(port), achp->ahcic_bus_rfis); - AHCI_WRITE(sc, AHCI_P_FBU(port), 0); + AHCI_WRITE(sc, AHCI_P_CLB(i), achp->ahcic_bus_cmdh); + AHCI_WRITE(sc, AHCI_P_CLBU(i), 0); + AHCI_WRITE(sc, AHCI_P_FB(i), achp->ahcic_bus_rfis); + AHCI_WRITE(sc, AHCI_P_FBU(i), 0); chp->ch_ndrive = 1; if (bus_space_subregion(sc->sc_ahcit, sc->sc_ahcih, AHCI_P_SSTS(i), 1, &achp->ahcic_sstatus) != 0) { @@ -738,6 +738,9 @@ ahci_cmd_done(struct ata_channel *chp, struct ata_xfer *xfer, int slot) bus_dmamap_unload(sc->sc_dmat, achp->ahcic_datad[slot]); } + AHCI_CMDH_SYNC(sc, achp, slot, + BUS_DMASYNC_POSTREAD | BUS_DMASYNC_POSTWRITE); + ata_c->flags |= AT_DONE; if (achp->ahcic_cmdh[slot].cmdh_prdbc) ata_c->flags |= AT_XFDONE; @@ -850,7 +853,8 @@ ahci_bio_start(struct ata_channel *chp, struct ata_xfer *xfer) ((ata_bio->flags & ATA_READ) ? 0 : AHCI_CMDH_F_WR) | 20 /* fis lenght */ / 4); cmd_h->cmdh_prdbc = 0; - AHCI_CMDH_SYNC(sc, achp, slot, BUS_DMASYNC_PREWRITE); + AHCI_CMDH_SYNC(sc, achp, slot, + BUS_DMASYNC_PREREAD | BUS_DMASYNC_PREWRITE); if (xfer->c_flags & C_POLL) { /* polled command, disable interrupts */