pccbb pccard rman - Something is very wrong somewhere

M. Warner Losh imp at bsdimp.com
Wed Apr 7 08:24:40 PDT 2004


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
@@ -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;


More information about the freebsd-mobile mailing list