* 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.
This commit is contained in:
fvdl 2007-06-21 11:32:54 +00:00
parent 3a15d3861a
commit fc625d2eff

View File

@ -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 <sys/cdefs.h>
__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 <sys/types.h>
#include <sys/malloc.h>
@ -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 */