Re: pccbb pccard rman - Something is very wrong somewhere

From: M. Warner Losh <imp_at_bsdimp.com>
Date: Wed, 07 Apr 2004 09:21:46 -0600 (MDT)
In message: <200404071245040782.0D909C4C_at_192.168.128.16>
            "Carlos Velasco" <freebsd_at_newipnet.com> 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
_at__at_ -126,9 +127,15 _at__at_
 
 	/* 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;
Received on Wed Apr 07 2004 - 06:24:40 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:37:50 UTC