Module Name: src Committed By: riz Date: Sat Nov 20 18:20:49 UTC 2010
Modified Files: src/sys/dev/ic [netbsd-5]: esiop.c siop.c Log Message: Pull up following revision(s) (requested by mhitch in ticket #1390): sys/dev/ic/siop.c: revision 1.95 sys/dev/ic/esiop.c: revision 1.52 Improve error paths in (e)siop_scsipi_request(): - When terminating the adapter request after the cmd has been removed from the free list, put that cmd back on the free list before returing. - Correctly indicate which bus_dma_load() failed. Analysis and fix from Michael L. Hitch in PR/42844. To generate a diff of this commit: cvs rdiff -u -r1.42 -r1.42.14.1 src/sys/dev/ic/esiop.c cvs rdiff -u -r1.87 -r1.87.14.1 src/sys/dev/ic/siop.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/esiop.c diff -u src/sys/dev/ic/esiop.c:1.42 src/sys/dev/ic/esiop.c:1.42.14.1 --- src/sys/dev/ic/esiop.c:1.42 Tue Apr 8 12:07:26 2008 +++ src/sys/dev/ic/esiop.c Sat Nov 20 18:20:49 2010 @@ -1,4 +1,4 @@ -/* $NetBSD: esiop.c,v 1.42 2008/04/08 12:07:26 cegger Exp $ */ +/* $NetBSD: esiop.c,v 1.42.14.1 2010/11/20 18:20:49 riz Exp $ */ /* * Copyright (c) 2002 Manuel Bouyer. @@ -33,7 +33,7 @@ /* SYM53c7/8xx PCI-SCSI I/O Processors driver */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: esiop.c,v 1.42 2008/04/08 12:07:26 cegger Exp $"); +__KERNEL_RCSID(0, "$NetBSD: esiop.c,v 1.42.14.1 2010/11/20 18:20:49 riz Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -1556,6 +1556,8 @@ "target %d\n", target); xs->error = XS_RESOURCE_SHORTAGE; scsipi_done(xs); + TAILQ_INSERT_TAIL(&sc->free_list, + esiop_cmd, next); splx(s); return; } @@ -1582,6 +1584,8 @@ target, lun); xs->error = XS_RESOURCE_SHORTAGE; scsipi_done(xs); + TAILQ_INSERT_TAIL(&sc->free_list, + esiop_cmd, next); splx(s); return; } @@ -1598,8 +1602,11 @@ if (error) { aprint_error_dev(&sc->sc_c.sc_dev, "unable to load cmd DMA map: %d\n", error); - xs->error = XS_DRIVER_STUFFUP; + xs->error = (error == EAGAIN) ? + XS_RESOURCE_SHORTAGE : XS_DRIVER_STUFFUP; scsipi_done(xs); + esiop_cmd->cmd_c.status = CMDST_FREE; + TAILQ_INSERT_TAIL(&sc->free_list, esiop_cmd, next); splx(s); return; } @@ -1610,12 +1617,17 @@ ((xs->xs_control & XS_CTL_DATA_IN) ? BUS_DMA_READ : BUS_DMA_WRITE)); if (error) { - aprint_error_dev(&sc->sc_c.sc_dev, "unable to load cmd DMA map: %d", + aprint_error_dev(sc->sc_c.sc_dev, + "unable to load data DMA map: %d", error); - xs->error = XS_DRIVER_STUFFUP; + xs->error = (error == EAGAIN) ? + XS_RESOURCE_SHORTAGE : XS_DRIVER_STUFFUP; scsipi_done(xs); bus_dmamap_unload(sc->sc_c.sc_dmat, esiop_cmd->cmd_c.dmamap_cmd); + esiop_cmd->cmd_c.status = CMDST_FREE; + TAILQ_INSERT_TAIL(&sc->free_list, + esiop_cmd, next); splx(s); return; } Index: src/sys/dev/ic/siop.c diff -u src/sys/dev/ic/siop.c:1.87 src/sys/dev/ic/siop.c:1.87.14.1 --- src/sys/dev/ic/siop.c:1.87 Tue Apr 8 12:07:27 2008 +++ src/sys/dev/ic/siop.c Sat Nov 20 18:20:49 2010 @@ -1,4 +1,4 @@ -/* $NetBSD: siop.c,v 1.87 2008/04/08 12:07:27 cegger Exp $ */ +/* $NetBSD: siop.c,v 1.87.14.1 2010/11/20 18:20:49 riz Exp $ */ /* * Copyright (c) 2000 Manuel Bouyer. @@ -33,7 +33,7 @@ /* SYM53c7/8xx PCI-SCSI I/O Processors driver */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: siop.c,v 1.87 2008/04/08 12:07:27 cegger Exp $"); +__KERNEL_RCSID(0, "$NetBSD: siop.c,v 1.87.14.1 2010/11/20 18:20:49 riz Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -1282,6 +1282,8 @@ "target %d\n", target); xs->error = XS_RESOURCE_SHORTAGE; scsipi_done(xs); + TAILQ_INSERT_TAIL(&sc->free_list, + siop_cmd, next); splx(s); return; } @@ -1301,6 +1303,8 @@ target); xs->error = XS_RESOURCE_SHORTAGE; scsipi_done(xs); + TAILQ_INSERT_TAIL(&sc->free_list, + siop_cmd, next); splx(s); return; } @@ -1318,6 +1322,8 @@ target, lun); xs->error = XS_RESOURCE_SHORTAGE; scsipi_done(xs); + TAILQ_INSERT_TAIL(&sc->free_list, + siop_cmd, next); splx(s); return; } @@ -1334,8 +1340,11 @@ if (error) { aprint_error_dev(&sc->sc_c.sc_dev, "unable to load cmd DMA map: %d\n", error); - xs->error = XS_DRIVER_STUFFUP; + xs->error = (error == EAGAIN) ? + XS_RESOURCE_SHORTAGE : XS_DRIVER_STUFFUP; scsipi_done(xs); + siop_cmd->cmd_c.status = CMDST_FREE; + TAILQ_INSERT_TAIL(&sc->free_list, siop_cmd, next); splx(s); return; } @@ -1346,12 +1355,17 @@ ((xs->xs_control & XS_CTL_DATA_IN) ? BUS_DMA_READ : BUS_DMA_WRITE)); if (error) { - aprint_error_dev(&sc->sc_c.sc_dev, "unable to load cmd DMA map: %d", + aprint_error_dev(sc->sc_c.sc_dev, + "unable to load data DMA map: %d", error); - xs->error = XS_DRIVER_STUFFUP; + xs->error = (error == EAGAIN) ? + XS_RESOURCE_SHORTAGE : XS_DRIVER_STUFFUP; scsipi_done(xs); bus_dmamap_unload(sc->sc_c.sc_dmat, siop_cmd->cmd_c.dmamap_cmd); + siop_cmd->cmd_c.status = CMDST_FREE; + TAILQ_INSERT_TAIL(&sc->free_list, + siop_cmd, next); splx(s); return; }