Date: Sat, 25 Jul 2009 15:05:37 GMT From: Alexander Motin <mav@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 166557 for review Message-ID: <200907251505.n6PF5bof015081@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=166557 Change 166557 by mav@mav_mavbook on 2009/07/25 15:04:48 Add PMP async notification support for doing automatic PMP rescan on device hot-plug. Affected files ... .. //depot/projects/scottl-camlock/src/sys/cam/ata/ata_pmp.c#3 edit Differences ... ==== //depot/projects/scottl-camlock/src/sys/cam/ata/ata_pmp.c#3 (text+ko) ==== @@ -63,6 +63,7 @@ typedef enum { PMP_STATE_NORMAL, PMP_STATE_PORTS, + PMP_STATE_CONFIG, PMP_STATE_RESET, PMP_STATE_CONNECT, PMP_STATE_CHECK, @@ -265,13 +266,15 @@ "due to status 0x%x\n", status); break; } + case AC_SCSI_AEN: case AC_SENT_BDR: case AC_BUS_RESET: softc = (struct pmp_softc *)periph->softc; cam_periph_async(periph, code, path, arg); - softc->found = 0; /* We have to reset everything. */ - case AC_SCSI_AEN: - softc = (struct pmp_softc *)periph->softc; + if (code == AC_SENT_BDR || code == AC_BUS_RESET) + softc->found = 0; /* We have to reset everything. */ + else if (softc->state != PMP_STATE_NORMAL) + break; softc->state = PMP_STATE_PORTS; xpt_schedule(periph, CAM_PRIORITY_BUS); break; @@ -413,6 +416,17 @@ 10 * 1000); ata_pm_read_cmd(ataio, 2, 15); break; + case PMP_STATE_CONFIG: + cam_fill_ataio(ataio, + 1, + pmpdone, + /*flags*/CAM_DIR_NONE, + 0, + /*data_ptr*/NULL, + /*dxfer_len*/0, + 10 * 1000); + ata_pm_write_cmd(ataio, 0x60, 15, 0xf); + break; case PMP_STATE_RESET: cam_fill_ataio(ataio, 1, @@ -503,6 +517,24 @@ if (softc->pm_pid == 0x47261095 && softc->pm_ports == 7) softc->pm_ports = 5; printf("PM ports: %d\n", softc->pm_ports); + softc->state = PMP_STATE_CONFIG; + xpt_release_ccb(done_ccb); + xpt_schedule(periph, priority); + return; + } else if (cam_periph_error(done_ccb, 0, 0, + &softc->saved_ccb) == ERESTART) { + return; + } else if ((done_ccb->ccb_h.status & CAM_DEV_QFRZN) != 0) { + cam_release_devq(done_ccb->ccb_h.path, + /*relsim_flags*/0, + /*reduction*/0, + /*timeout*/0, + /*getcount_only*/0); + } + xpt_release_ccb(done_ccb); + break; + case PMP_STATE_CONFIG: + if ((done_ccb->ccb_h.status & CAM_STATUS_MASK) == CAM_REQ_CMP) { softc->pm_step = 0; softc->state = PMP_STATE_RESET; xpt_release_ccb(done_ccb); @@ -686,10 +718,11 @@ work_ccb->ccb_h.ppriv_ptr0 = done_ccb; work_ccb->crcn.flags = done_ccb->crcn.flags; xpt_action(work_ccb); - break; + return; default: break; } + softc->state = PMP_STATE_NORMAL; } #endif /* _KERNEL */
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200907251505.n6PF5bof015081>