Module Name: src Committed By: matt Date: Thu Sep 27 00:39:47 UTC 2012
Modified Files: src/sys/dev/ic: ahcisata_core.c Log Message: Add some more debugging messages. To generate a diff of this commit: cvs rdiff -u -r1.43 -r1.44 src/sys/dev/ic/ahcisata_core.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sys/dev/ic/ahcisata_core.c diff -u src/sys/dev/ic/ahcisata_core.c:1.43 src/sys/dev/ic/ahcisata_core.c:1.44 --- src/sys/dev/ic/ahcisata_core.c:1.43 Mon Aug 20 12:48:47 2012 +++ src/sys/dev/ic/ahcisata_core.c Thu Sep 27 00:39:47 2012 @@ -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.44 2012/09/27 00:39:47 matt 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.44 2012/09/27 00:39:47 matt Exp $"); #include <sys/types.h> #include <sys/malloc.h> @@ -50,7 +50,6 @@ __KERNEL_RCSID(0, "$NetBSD: ahcisata_cor #include "atapibus.h" -#define AHCI_DEBUG #ifdef AHCI_DEBUG int ahcidebug_mask = 0; #endif @@ -839,11 +838,12 @@ ahci_probe_drive(struct ata_channel *chp } /* clear port interrupt register */ AHCI_WRITE(sc, AHCI_P_IS(chp->ch_channel), 0xffffffff); + /* and enable interrupts */ AHCI_WRITE(sc, AHCI_P_IE(chp->ch_channel), AHCI_P_IX_TFES | AHCI_P_IX_HBFS | AHCI_P_IX_IFS | AHCI_P_IX_OFS | AHCI_P_IX_DPS | AHCI_P_IX_UFS | - AHCI_P_IX_DHRS); + AHCI_P_IX_PSS | AHCI_P_IX_DHRS); /* wait 500ms before actually starting operations */ tsleep(&sc, PRIBIO, "ahciprb", mstohz(500)); break; @@ -922,8 +922,9 @@ ahci_cmd_start(struct ata_channel *chp, int i; int channel = chp->ch_channel; - AHCIDEBUG_PRINT(("ahci_cmd_start CI 0x%x\n", - AHCI_READ(sc, AHCI_P_CI(chp->ch_channel))), DEBUG_XFERS); + AHCIDEBUG_PRINT(("ahci_cmd_start CI 0x%x timo %d\n", + AHCI_READ(sc, AHCI_P_CI(chp->ch_channel)), ata_c->timeout), + DEBUG_XFERS); cmd_tbl = achp->ahcic_cmd_tbl[slot]; AHCIDEBUG_PRINT(("%s port %d tbl %p\n", AHCINAME(sc), chp->ch_channel, @@ -1066,18 +1067,18 @@ ahci_cmd_done(struct ata_channel *chp, s uint16_t *idwordbuf; int i; - AHCIDEBUG_PRINT(("ahci_cmd_done channel %d\n", chp->ch_channel), - DEBUG_FUNCS); + AHCIDEBUG_PRINT(("ahci_cmd_done channel %d (status %#x) flags %#x/%#x\n", + chp->ch_channel, chp->ch_status, xfer->c_flags, ata_c->flags), DEBUG_FUNCS); /* this comamnd is not active any more */ achp->ahcic_cmds_active &= ~(1 << slot); if (ata_c->flags & (AT_READ|AT_WRITE) && ata_c->bcount > 0) { - bus_dmamap_sync(sc->sc_dmat, achp->ahcic_datad[slot], 0, - achp->ahcic_datad[slot]->dm_mapsize, + bus_dmamap_t map = achp->ahcic_datad[slot]; + bus_dmamap_sync(sc->sc_dmat, map, 0, map->dm_mapsize, (ata_c->flags & AT_READ) ? BUS_DMASYNC_POSTREAD : BUS_DMASYNC_POSTWRITE); - bus_dmamap_unload(sc->sc_dmat, achp->ahcic_datad[slot]); + bus_dmamap_unload(sc->sc_dmat, map); } AHCI_CMDH_SYNC(sc, achp, slot, @@ -1375,8 +1376,12 @@ ahci_timeout(void *v) { struct ata_channel *chp = (struct ata_channel *)v; struct ata_xfer *xfer = chp->ch_queue->active_xfer; +#ifdef AHCI_DEBUG + struct ahci_softc *sc = (struct ahci_softc *)chp->ch_atac; +#endif int s = splbio(); - AHCIDEBUG_PRINT(("ahci_timeout xfer %p\n", xfer), DEBUG_INTR); + AHCIDEBUG_PRINT(("ahci_timeout xfer %p intr %#x\n", xfer, AHCI_READ(sc, AHCI_P_IS(chp->ch_channel))), DEBUG_INTR); + if ((chp->ch_flags & ATACH_IRQ_WAIT) != 0) { xfer->c_flags |= C_TIMEOU; xfer->c_intr(chp, xfer, 0);