From owner-svn-src-head@FreeBSD.ORG Wed Jan 21 20:08:25 2015 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 7E0A9DD3; Wed, 21 Jan 2015 20:08:25 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 6A6487EC; Wed, 21 Jan 2015 20:08:25 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t0LK8PjL001310; Wed, 21 Jan 2015 20:08:25 GMT (envelope-from will@FreeBSD.org) Received: (from will@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t0LK8PhR001309; Wed, 21 Jan 2015 20:08:25 GMT (envelope-from will@FreeBSD.org) Message-Id: <201501212008.t0LK8PhR001309@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: will set sender to will@FreeBSD.org using -f From: Will Andrews Date: Wed, 21 Jan 2015 20:08:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r277511 - head/sys/dev/firewire 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.18-1 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, 21 Jan 2015 20:08:25 -0000 Author: will Date: Wed Jan 21 20:08:24 2015 New Revision: 277511 URL: https://svnweb.freebsd.org/changeset/base/277511 Log: Fix remote DMA based firewire debugging when targeting systems with more than 4GB of physical memory. To remotely debug the system 'stealthy' which has a kernel with this change installed and firewire properly configured: % fwcontrol -m stealthy (or stealthy's firewire EUI64) % kgdb kernel /dev/fwmem0.0 sys/dev/firewire/fwohci.c: Rather than hard code the upper limit for hw based automatic responses to remote DMA requests at 4GB, program the hardware using Maxmem, the page number one higher than the highest physical page detected in the system. While here, garbage collect more useless splfw() calls. Submitted by: gibbs MFC after: 1 week Sponsored by: Spectra Logic MFSpectraBSD: 1110994 on 2015/01/06 Modified: head/sys/dev/firewire/fwohci.c Modified: head/sys/dev/firewire/fwohci.c ============================================================================== --- head/sys/dev/firewire/fwohci.c Wed Jan 21 20:06:25 2015 (r277510) +++ head/sys/dev/firewire/fwohci.c Wed Jan 21 20:08:24 2015 (r277511) @@ -48,6 +48,7 @@ #include #include +#include #include #include @@ -188,6 +189,7 @@ static void fwohci_task_dma(void *, int) #define OHCI_PREQLO 0x118 #define OHCI_PREQLOCLR 0x11c #define OHCI_PREQUPPER 0x120 +#define OHCI_PREQUPPER_MAX 0xffff0000 #define OHCI_SID_BUF 0x64 #define OHCI_SID_CNT 0x68 @@ -854,7 +856,7 @@ fwohci_execute_db2(void *arg, bus_dma_se static void fwohci_start(struct fwohci_softc *sc, struct fwohci_dbch *dbch) { - int i, s; + int i; int tcode, hdr_len, pl_off; int fsegment = -1; uint32_t off; @@ -880,7 +882,6 @@ fwohci_start(struct fwohci_softc *sc, st if (dbch->flags & FWOHCI_DBCH_FULL) return; - s = splfw(); db_tr = dbch->top; txloop: xfer = STAILQ_FIRST(&dbch->xferq.q); @@ -1030,7 +1031,6 @@ kick: } dbch->top = db_tr; - splx(s); return; } @@ -1821,6 +1821,7 @@ static void fwohci_intr_core(struct fwohci_softc *sc, uint32_t stat, int count) { struct firewire_comm *fc = (struct firewire_comm *)sc; + uintmax_t prequpper; uint32_t node_id, plen; FW_GLOCK_ASSERT(fc); @@ -1852,8 +1853,17 @@ fwohci_intr_core(struct fwohci_softc *sc /* allow from all nodes */ OWRITE(sc, OHCI_PREQHI, 0x7fffffff); OWRITE(sc, OHCI_PREQLO, 0xffffffff); - /* 0 to 4GB region */ - OWRITE(sc, OHCI_PREQUPPER, 0x10000); + prequpper = ((uintmax_t)Maxmem << PAGE_SHIFT) >> 16; + if (prequpper > OHCI_PREQUPPER_MAX) { + device_printf(fc->dev, + "Physical memory size of 0x%jx exceeds " + "fire wire address space. Limiting dma " + "to memory below 0x%jx\n", + (uintmax_t)Maxmem << PAGE_SHIFT, + (uintmax_t)OHCI_PREQUPPER_MAX << 16); + prequpper = OHCI_PREQUPPER_MAX; + } + OWRITE(sc, OHCI_PREQUPPER, prequpper & 0xffffffff); } /* Set ATRetries register */ OWRITE(sc, OHCI_ATRETRY, 1<<(13 + 16) | 0xfff); @@ -2171,7 +2181,7 @@ fwohci_rbuf_update(struct fwohci_softc * struct fw_bulkxfer *chunk; struct fw_xferq *ir; uint32_t stat; - int s, w = 0, ldesc; + int w = 0, ldesc; ir = fc->ir[dmach]; ldesc = sc->ir[dmach].ndesc - 1; @@ -2179,7 +2189,6 @@ fwohci_rbuf_update(struct fwohci_softc * #if 0 dump_db(sc, dmach); #endif - s = splfw(); if ((ir->flag & FWXFERQ_HANDLER) == 0) FW_GLOCK(fc); fwdma_sync_multiseg_all(sc->ir[dmach].am, BUS_DMASYNC_POSTREAD); @@ -2218,7 +2227,6 @@ fwohci_rbuf_update(struct fwohci_softc * } if ((ir->flag & FWXFERQ_HANDLER) == 0) FW_GUNLOCK(fc); - splx(s); if (w == 0) return;