Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 03 Sep 2001 22:12:23 +0900
From:      non@ever.sanda.gr.jp
To:        stable@FreeBSD.ORG
Subject:   Re: PC Card memory window 
Message-ID:  <20010903221223U.non@ever.sanda.gr.jp>
In-Reply-To: <200109030428.f834Sxh23190@harmony.village.org>
References:  <20010825090731N.non@ever.sanda.gr.jp> <20010902165357Q.non@ever.sanda.gr.jp> <200109030428.f834Sxh23190@harmony.village.org>

next in thread | previous in thread | raw e-mail | index | archive | help
From: Warner Losh <imp@harmony.village.org>
Date: Sun, 02 Sep 2001 22:28:59 -0600
> Try the following patch:

Yes, it worked for the iomem window. Thank you. 

But nsp needs 16 bits access, so also needed the change for cardd.c
(which I sent recently and attached below). Are there any reason for 8
bits access ?

> For pccard, the size '1' means use the default, as assigned by
> pccardd.  The exact size means just allocate it.  One could argue this 
> too is a bug...  I think that it is.  1 should mean "Ask the bus" and
> a non-1 value should mean "make sure that it is at least this big"
> (well, those two are the same thing, if you think about it).

I think it's a bug too. It is confusing.

> The trouble here comes in with some drivers.  They need to allocate
> memory that isn't listed in the CIS.  The ones that I'm aware of need
> to map card attribute memory for some reason.  The xe driver has a
> crude CIS parser in it to find out what the make/model of the card
> is.  The ray driver does unholy things that I never can recall.  Other 
> drivers may do things too, but I can't recall at the moment.

It might be a good idea to treat them in cardd.c like "ed" quirk so
that driver use only the space allocated by the bus, if possible.

> So if we were to change this behavior, we'd need to change the xe and
> ray drivers.  If not, then we need to change the nsp and ncv drivers.
> Since the changes for the nsp and ncv drivers are smaller and easier
> to verify, I think the right answer might be to change nsp and ncv for
> 4.4-RELEASE and do a more complete fix after the release.

I agree to change ncv, nsp and stg. There will no change in behavior
of them. Since the nsp is just using the default value, ncv and nsp
don't use iomem. The code is there just to reserve the space if it is
allocated. 

Could you review and commit changes below ?

// Noriaki Mitsunaga //

Index: sys/dev/ncv/ncr53c500_pccard.c
===================================================================
RCS file: /home2/FreeBSD/ncvs/src/sys/dev/ncv/ncr53c500_pccard.c,v
retrieving revision 1.8
diff -u -r1.8 ncr53c500_pccard.c
--- sys/dev/ncv/ncr53c500_pccard.c	2001/07/14 00:38:50	1.8
+++ sys/dev/ncv/ncr53c500_pccard.c	2001/09/03 13:02:12
@@ -198,7 +198,7 @@
 
 	sc->mem_rid = 0;
 	sc->mem_res = bus_alloc_resource(dev, SYS_RES_MEMORY, &sc->mem_rid,
-					 0, ~0, msize, RF_ACTIVE);
+					 0, ~0, 1, RF_ACTIVE);
 	if (sc->mem_res == NULL) {
 		ncv_release_resource(dev);
 		return(ENOMEM);
Index: sys/dev/nsp/nsp_pccard.c
===================================================================
RCS file: /home2/FreeBSD/ncvs/src/sys/dev/nsp/nsp_pccard.c,v
retrieving revision 1.9
diff -u -r1.9 nsp_pccard.c
--- sys/dev/nsp/nsp_pccard.c	2001/09/02 06:42:40	1.9
+++ sys/dev/nsp/nsp_pccard.c	2001/09/03 13:02:12
@@ -175,7 +175,7 @@
 
 	sc->mem_rid = 0;
 	sc->mem_res = bus_alloc_resource(dev, SYS_RES_MEMORY, &sc->mem_rid,
-					 0, ~0, msize, RF_ACTIVE);
+					 0, ~0, 1, RF_ACTIVE);
 	if (sc->mem_res == NULL) {
 		nsp_release_resource(dev);
 		return(ENOMEM);
Index: sys/dev/stg/tmc18c30_isa.c
===================================================================
RCS file: /home2/FreeBSD/ncvs/src/sys/dev/stg/tmc18c30_isa.c,v
retrieving revision 1.5
diff -u -r1.5 tmc18c30_isa.c
--- sys/dev/stg/tmc18c30_isa.c	2001/07/14 00:38:51	1.5
+++ sys/dev/stg/tmc18c30_isa.c	2001/09/03 13:02:12
@@ -149,7 +149,7 @@
 
 	sc->mem_rid = 0;
 	sc->mem_res = bus_alloc_resource(dev, SYS_RES_MEMORY, &sc->mem_rid,
-					 0, ~0, msize, RF_ACTIVE);
+					 0, ~0, 1, RF_ACTIVE);
 	if (sc->mem_res == NULL) {
 		stg_release_resource(dev);
 		return(ENOMEM);
Index: sys/dev/stg/tmc18c30_pccard.c
===================================================================
RCS file: /home2/FreeBSD/ncvs/src/sys/dev/stg/tmc18c30_pccard.c,v
retrieving revision 1.9
diff -u -r1.9 tmc18c30_pccard.c
--- sys/dev/stg/tmc18c30_pccard.c	2001/09/02 06:42:40	1.9
+++ sys/dev/stg/tmc18c30_pccard.c	2001/09/03 13:02:12
@@ -174,7 +174,7 @@
 
 	sc->mem_rid = 0;
 	sc->mem_res = bus_alloc_resource(dev, SYS_RES_MEMORY, &sc->mem_rid,
-					 0, ~0, msize, RF_ACTIVE);
+					 0, ~0, 1, RF_ACTIVE);
 	if (sc->mem_res == NULL) {
 		stg_release_resource(dev);
 		return(ENOMEM);
Index: usr.sbin/pccard/pccardd/cardd.c
===================================================================
RCS file: /home2/FreeBSD/ncvs/src/usr.sbin/pccard/pccardd/cardd.c,v
retrieving revision 1.72
diff -u -r1.72 cardd.c
--- usr.sbin/pccard/pccardd/cardd.c	2001/08/19 19:16:26	1.72
+++ usr.sbin/pccard/pccardd/cardd.c	2001/09/03 13:02:12
@@ -706,7 +706,7 @@
 			sp->mem.cardaddr = 0x4000;
 			sp->mem.flags = MDF_ACTIVE | MDF_16BITS;
 		} else {
-			sp->mem.flags = MDF_ACTIVE;
+			sp->mem.flags = MDF_ACTIVE | MDF_16BITS;
 		}
 
 		if (sp->mem.flags & MDF_ACTIVE)

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-stable" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20010903221223U.non>