From owner-svn-src-all@FreeBSD.ORG Thu Apr 21 09:02:20 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0B741106566C; Thu, 21 Apr 2011 09:02:20 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id E3B8E8FC16; Thu, 21 Apr 2011 09:02:19 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id p3L92JMn088414; Thu, 21 Apr 2011 09:02:19 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id p3L92JwO088412; Thu, 21 Apr 2011 09:02:19 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201104210902.p3L92JwO088412@svn.freebsd.org> From: Alexander Motin Date: Thu, 21 Apr 2011 09:02:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r220917 - head/sys/dev/ata X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Apr 2011 09:02:20 -0000 Author: mav Date: Thu Apr 21 09:02:19 2011 New Revision: 220917 URL: http://svn.freebsd.org/changeset/base/220917 Log: Use periodic status polling added at r214671 only in ATA_CAM mode. Legacy mode won't receive much benefit from it due to its hot-plug limitations. Modified: head/sys/dev/ata/ata-all.c Modified: head/sys/dev/ata/ata-all.c ============================================================================== --- head/sys/dev/ata/ata-all.c Thu Apr 21 09:01:43 2011 (r220916) +++ head/sys/dev/ata/ata-all.c Thu Apr 21 09:02:19 2011 (r220917) @@ -83,7 +83,9 @@ static void bswap(int8_t *, int); static void btrim(int8_t *, int); static void bpack(int8_t *, int8_t *, int); static void ata_interrupt_locked(void *data); +#ifdef ATA_CAM static void ata_periodic_poll(void *data); +#endif /* global vars */ MALLOC_DEFINE(M_ATA, "ata_generic", "ATA driver generic layer"); @@ -178,8 +180,8 @@ ata_attach(device_t dev) if (ch->pm_level > 1) ch->user[i].caps |= CTS_SATA_CAPS_D_PMREQ; } -#endif callout_init(&ch->poll_callout, 1); +#endif /* reset the controller HW, the channel and device(s) */ while (ATA_LOCKING(dev, ATA_LF_LOCK) != ch->unit) @@ -207,8 +209,6 @@ ata_attach(device_t dev) device_printf(dev, "unable to setup interrupt\n"); return error; } - if (ch->flags & ATA_PERIODIC_POLL) - callout_reset(&ch->poll_callout, hz, ata_periodic_poll, ch); #ifndef ATA_CAM /* probe and attach devices on this channel unless we are in early boot */ @@ -216,6 +216,8 @@ ata_attach(device_t dev) ata_identify(dev); return (0); #else + if (ch->flags & ATA_PERIODIC_POLL) + callout_reset(&ch->poll_callout, hz, ata_periodic_poll, ch); mtx_lock(&ch->state_mtx); /* Create the device queue for our SIM. */ devq = cam_simq_alloc(1); @@ -278,8 +280,10 @@ ata_detach(device_t dev) mtx_lock(&ch->state_mtx); ch->state |= ATA_STALL_QUEUE; mtx_unlock(&ch->state_mtx); +#ifdef ATA_CAM if (ch->flags & ATA_PERIODIC_POLL) callout_drain(&ch->poll_callout); +#endif #ifndef ATA_CAM /* detach & delete all children */ @@ -467,9 +471,9 @@ ata_suspend(device_t dev) if (!dev || !(ch = device_get_softc(dev))) return ENXIO; - if (ch->flags & ATA_PERIODIC_POLL) - callout_drain(&ch->poll_callout); #ifdef ATA_CAM + if (ch->flags & ATA_PERIODIC_POLL) + callout_drain(&ch->poll_callout); mtx_lock(&ch->state_mtx); xpt_freeze_simq(ch->sim, 1); while (ch->state != ATA_IDLE) @@ -507,14 +511,14 @@ ata_resume(device_t dev) error = ata_reinit(dev); xpt_release_simq(ch->sim, TRUE); mtx_unlock(&ch->state_mtx); + if (ch->flags & ATA_PERIODIC_POLL) + callout_reset(&ch->poll_callout, hz, ata_periodic_poll, ch); #else /* reinit the devices, we dont know what mode/state they are in */ error = ata_reinit(dev); /* kick off requests on the queue */ ata_start(dev); #endif - if (ch->flags & ATA_PERIODIC_POLL) - callout_reset(&ch->poll_callout, hz, ata_periodic_poll, ch); return error; } @@ -581,6 +585,7 @@ ata_interrupt_locked(void *data) #endif } +#ifdef ATA_CAM static void ata_periodic_poll(void *data) { @@ -589,6 +594,7 @@ ata_periodic_poll(void *data) callout_reset(&ch->poll_callout, hz, ata_periodic_poll, ch); ata_interrupt(ch); } +#endif void ata_print_cable(device_t dev, u_int8_t *who)