From owner-p4-projects@FreeBSD.ORG Sun Jan 17 16:31:05 2010 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 11C23106568B; Sun, 17 Jan 2010 16:31:05 +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 B24861065670 for ; Sun, 17 Jan 2010 16:31:04 +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 9764A8FC08 for ; Sun, 17 Jan 2010 16:31:04 +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 o0HGV45k075411 for ; Sun, 17 Jan 2010 16:31:04 GMT (envelope-from mav@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.14.3/8.14.3/Submit) id o0HGV4cp075409 for perforce@freebsd.org; Sun, 17 Jan 2010 16:31:04 GMT (envelope-from mav@freebsd.org) Date: Sun, 17 Jan 2010 16:31:04 GMT Message-Id: <201001171631.o0HGV4cp075409@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 173273 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: Sun, 17 Jan 2010 16:31:05 -0000 http://p4web.freebsd.org/chv.cgi?CH=173273 Change 173273 by mav@mav_mavtest on 2010/01/17 16:30:57 Make ahci, siis and ata initiate bus rescan on SATA physical events. Affected files ... .. //depot/projects/scottl-camlock/src/sys/dev/ahci/ahci.c#94 edit .. //depot/projects/scottl-camlock/src/sys/dev/ata/ata-all.c#47 edit .. //depot/projects/scottl-camlock/src/sys/dev/siis/siis.c#34 edit Differences ... ==== //depot/projects/scottl-camlock/src/sys/dev/ahci/ahci.c#94 (text+ko) ==== @@ -1117,6 +1117,8 @@ if ((serr & ATA_SE_PHY_CHANGED) && (ch->pm_level == 0)) { u_int32_t status = ATA_INL(ch->r_mem, AHCI_P_SSTS); + union ccb *ccb; + if (((status & ATA_SS_DET_MASK) == ATA_SS_DET_PHY_ONLINE) && ((status & ATA_SS_SPD_MASK) != ATA_SS_SPD_NO_SPEED) && ((status & ATA_SS_IPM_MASK) == ATA_SS_IPM_ACTIVE)) { @@ -1128,6 +1130,15 @@ device_printf(dev, "DISCONNECT requested\n"); ch->devices = 0; } + if ((ccb = xpt_alloc_ccb_nowait()) == NULL) + return; + if (xpt_create_path(&ccb->ccb_h.path, NULL, + cam_sim_path(ch->sim), + CAM_TARGET_WILDCARD, CAM_LUN_WILDCARD) != CAM_REQ_CMP) { + xpt_free_ccb(ccb); + return; + } + xpt_rescan(ccb); } } ==== //depot/projects/scottl-camlock/src/sys/dev/ata/ata-all.c#47 (text+ko) ==== @@ -55,7 +55,6 @@ #include #include #include -#include #include #endif @@ -289,12 +288,26 @@ static void ata_conn_event(void *context, int dummy) { - device_t dev = (device_t)context; - struct ata_channel *ch = device_get_softc(dev); + device_t dev = (device_t)context; + struct ata_channel *ch = device_get_softc(dev); +#ifdef ATA_CAM + union ccb *ccb; +#endif - mtx_lock(&ch->state_mtx); - ata_reinit(dev); - mtx_unlock(&ch->state_mtx); + mtx_lock(&ch->state_mtx); + ata_reinit(dev); + mtx_unlock(&ch->state_mtx); +#ifdef ATA_CAM + if ((ccb = xpt_alloc_ccb()) == NULL) + return; + if (xpt_create_path(&ccb->ccb_h.path, NULL, + cam_sim_path(ch->sim), + CAM_TARGET_WILDCARD, CAM_LUN_WILDCARD) != CAM_REQ_CMP) { + xpt_free_ccb(ccb); + return; + } + xpt_rescan(ccb); +#endif } int ==== //depot/projects/scottl-camlock/src/sys/dev/siis/siis.c#34 (text+ko) ==== @@ -739,6 +739,8 @@ /* If we have a connection event, deal with it */ if (ch->pm_level == 0) { u_int32_t status = ATA_INL(ch->r_mem, SIIS_P_SSTS); + union ccb *ccb; + if (((status & ATA_SS_DET_MASK) == ATA_SS_DET_PHY_ONLINE) && ((status & ATA_SS_SPD_MASK) != ATA_SS_SPD_NO_SPEED) && ((status & ATA_SS_IPM_MASK) == ATA_SS_IPM_ACTIVE)) { @@ -750,6 +752,15 @@ device_printf(dev, "DISCONNECT requested\n"); ch->devices = 0; } + if ((ccb = xpt_alloc_ccb_nowait()) == NULL) + return; + if (xpt_create_path(&ccb->ccb_h.path, NULL, + cam_sim_path(ch->sim), + CAM_TARGET_WILDCARD, CAM_LUN_WILDCARD) != CAM_REQ_CMP) { + xpt_free_ccb(ccb); + return; + } + xpt_rescan(ccb); } }