From owner-svn-src-head@FreeBSD.ORG Wed Apr 3 18:30:09 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id C9CC4677; Wed, 3 Apr 2013 18:30:09 +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 BCCC86B0; Wed, 3 Apr 2013 18:30:09 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r33IU9HR029441; Wed, 3 Apr 2013 18:30:09 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r33IU9Fs029436; Wed, 3 Apr 2013 18:30:09 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201304031830.r33IU9Fs029436@svn.freebsd.org> From: Alexander Motin Date: Wed, 3 Apr 2013 18:30:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r249062 - in head/sys/dev/ata: . chipsets X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 03 Apr 2013 18:30:09 -0000 Author: mav Date: Wed Apr 3 18:30:09 2013 New Revision: 249062 URL: http://svnweb.freebsd.org/changeset/base/249062 Log: 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. MFC after: 1 week Modified: head/sys/dev/ata/ata-cbus.c head/sys/dev/ata/chipsets/ata-acard.c Modified: head/sys/dev/ata/ata-cbus.c ============================================================================== --- head/sys/dev/ata/ata-cbus.c Wed Apr 3 17:19:26 2013 (r249061) +++ head/sys/dev/ata/ata-cbus.c Wed Apr 3 18:30:09 2013 (r249062) @@ -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: head/sys/dev/ata/chipsets/ata-acard.c ============================================================================== --- head/sys/dev/ata/chipsets/ata-acard.c Wed Apr 3 17:19:26 2013 (r249061) +++ head/sys/dev/ata/chipsets/ata-acard.c Wed Apr 3 18:30:09 2013 (r249062) @@ -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