From owner-freebsd-current@FreeBSD.ORG Mon Sep 12 14:37:12 2011 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 452CA1065670; Mon, 12 Sep 2011 14:37:12 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from cyrus.watson.org (cyrus.watson.org [65.122.17.42]) by mx1.freebsd.org (Postfix) with ESMTP id 1A9A48FC13; Mon, 12 Sep 2011 14:37:12 +0000 (UTC) Received: from bigwig.baldwin.cx (66.111.2.69.static.nyinternet.net [66.111.2.69]) by cyrus.watson.org (Postfix) with ESMTPSA id BDEE746B38; Mon, 12 Sep 2011 10:37:11 -0400 (EDT) Received: from jhbbsd.localnet (unknown [209.249.190.124]) by bigwig.baldwin.cx (Postfix) with ESMTPSA id 6B43C8A037; Mon, 12 Sep 2011 10:37:11 -0400 (EDT) From: John Baldwin To: Daniel Eischen Date: Mon, 12 Sep 2011 10:33:38 -0400 User-Agent: KMail/1.13.5 (FreeBSD/8.2-CBSD-20110617; KDE/4.5.5; amd64; ; ) References: <054D42C8-E7CD-4F4A-88CB-40841CF972EE@bsdimp.com> In-Reply-To: MIME-Version: 1.0 Content-Type: Text/Plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Message-Id: <201109121033.39072.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.6 (bigwig.baldwin.cx); Mon, 12 Sep 2011 10:37:11 -0400 (EDT) Cc: adrian@freebsd.org, freebsd-current@freebsd.org, Warner Losh , Warner Losh Subject: Re: ath0 no longer attaches, cardbus problems? X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 12 Sep 2011 14:37:12 -0000 On Saturday, September 10, 2011 8:13:23 am Daniel Eischen wrote: > On Fri, 9 Sep 2011, Warner Losh wrote: > > > > > On Sep 9, 2011, at 1:22 PM, Daniel Eischen wrote: > > > >> I found the commit that broke ath for me, r222753, > >> specifically, the change to /dev/cardbus/cardbus_cis.c. > >> > >> To be sure, I updated to head using svn, and applied > >> the patch included below. ath attaches and works. Without > >> the patch, ath does not attach. > >> > >> On another note, I've no idea why updating from a local > >> CVS repo lead me down a wrong path. It seems wrong that > >> a 'cvs update -P -d -A -D "31 Mar 2011"' works and > >> a 'cvs update -P -d -A -D "1 Apr 2011"' does not work. > >> r222753 did not occur until much later (June 6). > >> Once John asked me to try r220195, I switched to using > >> svn. When that worked, it seemed strange to me because > >> nothing else committed after that on Mar 31 should have > >> broke ath. > >> > >> Anyway, culprit found. Now what is the correct fix? > > > > Do you need both chunks? The second one seems redundant given the definition of bus_alloc_reosurce_any does exactly that. > > I tried it separately with the 2 chunks, and only the first > chunk is needed. To be pedantic, this was the change that > made ath work again. > > Index: sys/dev/cardbus/cardbus_cis.c > =================================================================== > --- sys/dev/cardbus/cardbus_cis.c (revision 225463) > +++ sys/dev/cardbus/cardbus_cis.c (working copy) > @@ -441,6 +441,7 @@ > { > if (res != CIS_CONFIG_SPACE) { > bus_release_resource(child, SYS_RES_MEMORY, rid, res); > + bus_delete_resource(child, SYS_RES_MEMORY, rid); > } > } > > While debugging the problem a couple of weeks ago, I did > seem to notice ath was trying to attach twice. I seem to > recall it was at different addresses. Could this possibly > cause the problem without the above patch? No, but your patch is confusing to me. Can a BAR change to a different size after we read the CIS? Or perhaps it should now be prefetchable when it wasn't before? Hmm, the bus_delete_resource() doesn't make us re-probe the BAR (perhaps it should?). I'm still not sure how exactly this fixes it. However, I do think this probably is more correct. -- John Baldwin