Date: Sun, 25 Oct 2009 11:16:35 GMT From: Alexander Motin <mav@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 169788 for review Message-ID: <200910251116.n9PBGZpb095371@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://p4web.freebsd.org/chv.cgi?CH=169788 Change 169788 by mav@mav_mavtest on 2009/10/25 11:15:37 Restart initialization if bus reset hapens while working. Affected files ... .. //depot/projects/scottl-camlock/src/sys/cam/ata/ata_pmp.c#13 edit Differences ... ==== //depot/projects/scottl-camlock/src/sys/cam/ata/ata_pmp.c#13 (text+ko) ==== @@ -94,6 +94,7 @@ int pm_try; int found; int frozen; + int restart; union ccb saved_ccb; struct task sysctl_task; struct sysctl_ctx_list sysctl_ctx; @@ -292,14 +293,21 @@ case AC_BUS_RESET: softc = (struct pmp_softc *)periph->softc; cam_periph_async(periph, code, path, arg); - if (softc->state != PMP_STATE_NORMAL) + if (code == AC_SCSI_AEN && softc->state != PMP_STATE_NORMAL && + softc->state != PMP_STATE_SCAN) break; - pmpfreeze(periph, softc->found); + if (softc->state != PMP_STATE_SCAN) + pmpfreeze(periph, softc->found); + else + pmpfreeze(periph, softc->found & ~(1 << softc->pm_step)); if (code == AC_SENT_BDR || code == AC_BUS_RESET) softc->found = 0; /* We have to reset everything. */ - softc->state = PMP_STATE_PORTS; - cam_periph_acquire(periph); - xpt_schedule(periph, CAM_PRIORITY_BUS); + if (softc->state == PMP_STATE_NORMAL) { + softc->state = PMP_STATE_PORTS; + cam_periph_acquire(periph); + xpt_schedule(periph, CAM_PRIORITY_BUS); + } else + softc->restart = 1; break; default: cam_periph_async(periph, code, path, arg); @@ -408,6 +416,11 @@ softc = (struct pmp_softc *)periph->softc; ataio = &start_ccb->ataio; + + if (softc->restart) { + softc->restart = 0; + softc->state = PMP_STATE_PORTS; + } switch (softc->state) { case PMP_STATE_PORTS: @@ -516,6 +529,22 @@ goto done; } + if (softc->restart) { + softc->restart = 0; + if (softc->state == PMP_STATE_SCAN) { + pmpfreeze(periph, 1 << softc->pm_step); + work_ccb = done_ccb; + done_ccb = (union ccb*)work_ccb->ccb_h.ppriv_ptr0; + /* Free the current request path- we're done with it. */ + xpt_free_path(work_ccb->ccb_h.path); + xpt_free_ccb(work_ccb); + } + xpt_release_ccb(done_ccb); + softc->state = PMP_STATE_PORTS; + xpt_schedule(periph, priority); + return; + } + switch (softc->state) { case PMP_STATE_PORTS: softc->pm_ports = (done_ccb->ataio.res.lba_high << 24) +
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200910251116.n9PBGZpb095371>