From owner-svn-src-stable@FreeBSD.ORG Wed Apr 10 18:13:34 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 47DFAA6D; Wed, 10 Apr 2013 18:13:34 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 38DC1F5C; Wed, 10 Apr 2013 18:13:34 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r3AIDYdE024097; Wed, 10 Apr 2013 18:13:34 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r3AIDXtW024095; Wed, 10 Apr 2013 18:13:33 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201304101813.r3AIDXtW024095@svn.freebsd.org> From: Alexander Motin Date: Wed, 10 Apr 2013 18:13:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r249341 - in stable/9/sys/dev/ata: . chipsets X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 10 Apr 2013 18:13:34 -0000 Author: mav Date: Wed Apr 10 18:13:33 2013 New Revision: 249341 URL: http://svnweb.freebsd.org/changeset/base/249341 Log: MFC r249062: Since ATA_CAM mode has no implemented support for serializing access to the different ATA channels, required for acard and pc98 ATA controllers, block access to second channels of both, hoping that one working channel is better then none. I have an idea how that support could be implemented, but I have no hardware to work on that. Modified: stable/9/sys/dev/ata/ata-cbus.c stable/9/sys/dev/ata/chipsets/ata-acard.c Directory Properties: stable/9/sys/ (props changed) stable/9/sys/dev/ (props changed) Modified: stable/9/sys/dev/ata/ata-cbus.c ============================================================================== --- stable/9/sys/dev/ata/ata-cbus.c Wed Apr 10 18:07:25 2013 (r249340) +++ stable/9/sys/dev/ata/ata-cbus.c Wed Apr 10 18:13:33 2013 (r249341) @@ -53,10 +53,13 @@ struct ata_cbus_controller { struct resource *bankio; struct resource *irq; void *ih; +#ifndef ATA_CAM struct mtx bank_mtx; int locked_bank; int restart_bank; int hardware_bank; +#endif + int channels; struct { void (*function)(void *); void *argument; @@ -65,7 +68,9 @@ struct ata_cbus_controller { /* local prototypes */ static void ata_cbus_intr(void *); +#ifndef ATA_CAM static int ata_cbuschannel_banking(device_t dev, int flags); +#endif static int ata_cbus_probe(device_t dev) @@ -155,12 +160,19 @@ ata_cbus_attach(device_t dev) return ENXIO; } +#ifndef ATA_CAM + ctlr->channels = 2; mtx_init(&ctlr->bank_mtx, "ATA cbus bank lock", NULL, MTX_DEF); ctlr->hardware_bank = -1; ctlr->locked_bank = -1; ctlr->restart_bank = -1; +#else + /* Work around the lack of channel serialization in ATA_CAM. */ + ctlr->channels = 1; + device_printf(dev, "second channel ignored\n"); +#endif - for (unit = 0; unit < 2; unit++) { + for (unit = 0; unit < ctlr->channels; unit++) { child = device_add_child(dev, "ata", unit); if (child == NULL) device_printf(dev, "failed to add ata child device\n"); @@ -229,10 +241,12 @@ ata_cbus_intr(void *data) struct ata_channel *ch; int unit; - for (unit = 0; unit < 2; unit++) { + for (unit = 0; unit < ctlr->channels; unit++) { if (!(ch = ctlr->interrupt[unit].argument)) continue; +#ifndef ATA_CAM if (ata_cbuschannel_banking(ch->dev, ATA_LF_WHICH) == unit) +#endif ctlr->interrupt[unit].function(ch); } } @@ -335,18 +349,16 @@ ata_cbuschannel_resume(device_t dev) return ata_resume(dev); } +#ifndef ATA_CAM static int ata_cbuschannel_banking(device_t dev, int flags) { struct ata_cbus_controller *ctlr = device_get_softc(device_get_parent(dev)); -#ifndef ATA_CAM struct ata_channel *ch = device_get_softc(dev); -#endif int res; mtx_lock(&ctlr->bank_mtx); switch (flags) { -#ifndef ATA_CAM case ATA_LF_LOCK: if (ctlr->locked_bank == -1) ctlr->locked_bank = ch->unit; @@ -371,7 +383,6 @@ ata_cbuschannel_banking(device_t dev, in } } break; -#endif case ATA_LF_WHICH: break; @@ -380,6 +391,7 @@ ata_cbuschannel_banking(device_t dev, in mtx_unlock(&ctlr->bank_mtx); return res; } +#endif static device_method_t ata_cbuschannel_methods[] = { /* device interface */ Modified: stable/9/sys/dev/ata/chipsets/ata-acard.c ============================================================================== --- stable/9/sys/dev/ata/chipsets/ata-acard.c Wed Apr 10 18:07:25 2013 (r249340) +++ stable/9/sys/dev/ata/chipsets/ata-acard.c Wed Apr 10 18:13:33 2013 (r249341) @@ -124,6 +124,10 @@ ata_acard_chipinit(device_t dev) M_ATAPCI, M_WAITOK | M_ZERO); ata_serialize_init(serial); ctlr->chipset_data = serial; +#else + /* Work around the lack of channel serialization in ATA_CAM. */ + ctlr->channels = 1; + device_printf(dev, "second channel ignored\n"); #endif } else