From owner-svn-src-all@FreeBSD.ORG Mon Dec 28 14:16:40 2009 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 7D39E106566B; Mon, 28 Dec 2009 14:16:40 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 6259B8FC12; Mon, 28 Dec 2009 14:16:40 +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 nBSEGepN092470; Mon, 28 Dec 2009 14:16:40 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id nBSEGeUR092468; Mon, 28 Dec 2009 14:16:40 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <200912281416.nBSEGeUR092468@svn.freebsd.org> From: Marius Strobl Date: Mon, 28 Dec 2009 14:16:40 +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: r201126 - head/sys/sparc64/pci 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: Mon, 28 Dec 2009 14:16:40 -0000 Author: marius Date: Mon Dec 28 14:16:40 2009 New Revision: 201126 URL: http://svn.freebsd.org/changeset/base/201126 Log: Account for firmware versions which include the CDMA interrupts in the OFW device tree. MFC after: 3 days Modified: head/sys/sparc64/pci/schizo.c Modified: head/sys/sparc64/pci/schizo.c ============================================================================== --- head/sys/sparc64/pci/schizo.c Mon Dec 28 14:09:46 2009 (r201125) +++ head/sys/sparc64/pci/schizo.c Mon Dec 28 14:16:40 2009 (r201126) @@ -628,31 +628,44 @@ schizo_attach(device_t dev) /* * According to the Schizo Errata I-13, consistent DMA flushing/ * syncing is FUBAR in version < 5 (i.e. revision < 2.3) bridges, - * so we can't use it and need to live with the consequences. - * With Schizo version >= 5, CDMA flushing/syncing is usable - * but requires the the workaround described in Schizo Errata - * I-23. With Tomatillo and XMITS, CDMA flushing/syncing works - * as expected, Tomatillo version <= 4 (i.e. revision <= 2.3) - * bridges additionally require a block store after a write to - * TOMXMS_PCI_DMA_SYNC_PEND though. + * so we can't use it and need to live with the consequences. With + * Schizo version >= 5, CDMA flushing/syncing is usable but requires + * the workaround described in Schizo Errata I-23. With Tomatillo + * and XMITS, CDMA flushing/syncing works as expected, Tomatillo + * version <= 4 (i.e. revision <= 2.3) bridges additionally require + * a block store after a write to TOMXMS_PCI_DMA_SYNC_PEND though. */ if ((sc->sc_mode == SCHIZO_MODE_SCZ && sc->sc_ver >= 5) || sc->sc_mode == SCHIZO_MODE_TOM || sc->sc_mode == SCHIZO_MODE_XMS) { sc->sc_flags |= SCHIZO_FLAGS_CDMA; if (sc->sc_mode == SCHIZO_MODE_SCZ) { - n = STX_CDMA_A_INO + sc->sc_half; - if (bus_set_resource(dev, SYS_RES_IRQ, 5, - INTMAP_VEC(sc->sc_ign, n), 1) != 0) - panic("%s: failed to add CDMA interrupt", - __func__); - i = schizo_intr_register(sc, n); - if (i != 0) - panic("%s: could not register interrupt " - "controller for CDMA (%d)", __func__, i); - (void)schizo_get_intrmap(sc, n, NULL, - &sc->sc_cdma_clr); sc->sc_cdma_state = SCHIZO_CDMA_STATE_DONE; - schizo_set_intr(sc, 5, n, schizo_cdma); + /* + * Some firmware versions include the CDMA interrupt + * at RID 4 but most don't. With the latter we add + * it ourselves at the spare RID 5. + */ + n = INTINO(bus_get_resource_start(dev, SYS_RES_IRQ, + 4)); + if (n == STX_CDMA_A_INO || n == STX_CDMA_B_INO) { + (void)schizo_get_intrmap(sc, n, NULL, + &sc->sc_cdma_clr); + schizo_set_intr(sc, 4, n, schizo_cdma); + } else { + n = STX_CDMA_A_INO + sc->sc_half; + if (bus_set_resource(dev, SYS_RES_IRQ, 5, + INTMAP_VEC(sc->sc_ign, n), 1) != 0) + panic("%s: failed to add CDMA " + "interrupt", __func__); + i = schizo_intr_register(sc, n); + if (i != 0) + panic("%s: could not register " + "interrupt controller for CDMA " + "(%d)", __func__, i); + (void)schizo_get_intrmap(sc, n, NULL, + &sc->sc_cdma_clr); + schizo_set_intr(sc, 5, n, schizo_cdma); + } } if (sc->sc_mode == SCHIZO_MODE_TOM && sc->sc_ver <= 4) sc->sc_flags |= SCHIZO_FLAGS_BSWAR;