From owner-p4-projects@FreeBSD.ORG Thu Oct 15 13:42:31 2009 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 1BE251065696; Thu, 15 Oct 2009 13:42:31 +0000 (UTC) Delivered-To: perforce@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D405F106568D for ; Thu, 15 Oct 2009 13:42:30 +0000 (UTC) (envelope-from mav@freebsd.org) Received: from repoman.freebsd.org (repoman.freebsd.org [IPv6:2001:4f8:fff6::29]) by mx1.freebsd.org (Postfix) with ESMTP id C14588FC20 for ; Thu, 15 Oct 2009 13:42:30 +0000 (UTC) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.14.3/8.14.3) with ESMTP id n9FDgUMr023284 for ; Thu, 15 Oct 2009 13:42:30 GMT (envelope-from mav@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.14.3/8.14.3/Submit) id n9FDgUNw023282 for perforce@freebsd.org; Thu, 15 Oct 2009 13:42:30 GMT (envelope-from mav@freebsd.org) Date: Thu, 15 Oct 2009 13:42:30 GMT Message-Id: <200910151342.n9FDgUNw023282@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to mav@freebsd.org using -f From: Alexander Motin To: Perforce Change Reviews Precedence: bulk Cc: Subject: PERFORCE change 169517 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 15 Oct 2009 13:42:31 -0000 http://p4web.freebsd.org/chv.cgi?CH=169517 Change 169517 by mav@mav_mavtest on 2009/10/15 13:41:46 Make PMP to freeze child devices while resetting/scanning. Affected files ... .. //depot/projects/scottl-camlock/src/sys/cam/ata/ata_pmp.c#8 edit Differences ... ==== //depot/projects/scottl-camlock/src/sys/cam/ata/ata_pmp.c#8 (text+ko) ==== @@ -93,6 +93,7 @@ int pm_step; int pm_try; int found; + int frozen; union ccb saved_ccb; struct task sysctl_task; struct sysctl_ctx_list sysctl_ctx; @@ -158,6 +159,49 @@ } static void +pmpfreeze(struct cam_periph *periph, int mask) +{ + struct pmp_softc *softc = (struct pmp_softc *)periph->softc; + struct cam_path *dpath; + int i; + + for (i = 0; i < 15; i++) { + if ((mask & (1 << i)) == 0) + continue; + if (xpt_create_path(&dpath, periph, + xpt_path_path_id(periph->path), + i, 0) == CAM_REQ_CMP) { +printf("PMP freeze: %d\n", i); + softc->frozen |= (1 << i); + cam_freeze_devq(dpath); + xpt_free_path(dpath); + } + } +} + +static void +pmprelease(struct cam_periph *periph, int mask) +{ + struct pmp_softc *softc = (struct pmp_softc *)periph->softc; + struct cam_path *dpath; + int i; + + mask &= softc->frozen; + for (i = 0; i < 15; i++) { + if ((mask & (1 << i)) == 0) + continue; + if (xpt_create_path(&dpath, periph, + xpt_path_path_id(periph->path), + i, 0) == CAM_REQ_CMP) { +printf("PMP release: %d\n", i); + softc->frozen &= ~(1 << i); + cam_release_devq(dpath, 0, 0, 0, FALSE); + xpt_free_path(dpath); + } + } +} + +static void pmponinvalidate(struct cam_periph *periph) { struct pmp_softc *softc; @@ -249,6 +293,7 @@ cam_periph_async(periph, code, path, arg); if (softc->state != PMP_STATE_NORMAL) break; + pmpfreeze(periph, softc->found); if (code == AC_SENT_BDR || code == AC_BUS_RESET) softc->found = 0; /* We have to reset everything. */ softc->state = PMP_STATE_PORTS; @@ -677,11 +722,13 @@ work_ccb->ccb_h.ppriv_ptr0 = done_ccb; work_ccb->crcn.flags = done_ccb->crcn.flags; xpt_action(work_ccb); + pmprelease(periph, 1 << softc->pm_step); return; default: break; } softc->state = PMP_STATE_NORMAL; + pmprelease(periph, -1); cam_periph_release_locked(periph); }