From owner-freebsd-current@FreeBSD.ORG Wed Apr 7 08:24:40 2004 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 4DE1A16A4CE; Wed, 7 Apr 2004 08:24:40 -0700 (PDT) Received: from harmony.village.org (rover.bsdimp.com [204.144.255.66]) by mx1.FreeBSD.org (Postfix) with ESMTP id A0D9943D2F; Wed, 7 Apr 2004 08:24:39 -0700 (PDT) (envelope-from imp@bsdimp.com) Received: from localhost (warner@rover2.village.org [10.0.0.1]) by harmony.village.org (8.12.10/8.12.9) with ESMTP id i37FL5kj006958; Wed, 7 Apr 2004 09:21:05 -0600 (MDT) (envelope-from imp@bsdimp.com) Date: Wed, 07 Apr 2004 09:21:46 -0600 (MDT) Message-Id: <20040407.092146.40772577.imp@bsdimp.com> To: freebsd@newipnet.com From: "M. Warner Losh" In-Reply-To: <200404071245040782.0D909C4C@192.168.128.16> References: <20040406.162834.02299817.imp@bsdimp.com> <20040406.231324.131273745.imp@bsdimp.com> <200404071245040782.0D909C4C@192.168.128.16> X-Mailer: Mew version 3.3 on Emacs 21.3 / Mule 5.0 (SAKAKI) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit cc: jon@freebsd.org cc: marc@mit.edu cc: freebsd-current@freebsd.org cc: freebsd-mobile@freebsd.org Subject: Re: pccbb pccard rman - Something is very wrong somewhere X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.1 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: Wed, 07 Apr 2004 15:24:40 -0000 In message: <200404071245040782.0D909C4C@192.168.128.16> "Carlos Velasco" writes: : On 06/04/2004 at 23:13 M. Warner Losh wrote: : : >: There's code that fails to properly align requests larger than 4k to : >: the appropriate boundary. Upping things to 64k just papers over that : >: problem, and tends to be somewhat wasteful of resources. : > : >Hmmm, I should make the CIS mapping be on a 64k boundary and try a : >bunch of the 'problem children' cards. That might fix a lot of : >problems... : : That's that my patch does (or pretend): : cbb0: PCI Memory allocated: 88000000 : cbb1: PCI Memory allocated: 88001000 : cis mem map 0xdc538000 (resource: 0x88010000) : pccard0: ccr_res == 88010000-880103ff, base=ff80 Cool! There's some unintended effects of doing this for ALL memory allocations on the CardBus cards. However, it is relatively easy to fix in a slightly different way. Here's the diffs I have in my tree. Do they also solve the problems for you? I've run with a 4k allocation boundary locally, but that only helps slightly. Warner --- /dell/imp/FreeBSD/src/sys/dev/pccard/pccard_cis.c Sun Oct 19 11:32:23 2003 +++ ./pccard_cis.c Wed Apr 7 09:18:42 2004 @@ -126,9 +127,15 @@ /* allocate some memory */ + /* + * Some reports from the field suggest that a 64k memory boundary + * helps card CIS being able to be read. Try it here and see what + * the results actually are. I'm not sure I understand why this + * would make cards work better, but it is easy enough to test. + */ rid = 0; - res = bus_alloc_resource(dev, SYS_RES_MEMORY, &rid, 0, ~0, - PCCARD_CIS_SIZE, RF_ACTIVE); + res = bus_alloc_resource(dev, SYS_RES_MEMORY, &rid, 0, ~0, + PCCARD_CIS_SIZE, RF_ACTIVE | rman_make_alignment_flags(64*1024)); if (res == NULL) { device_printf(dev, "can't alloc memory to read attributes\n"); return -1;