summaryrefslogtreecommitdiffstats
path: root/sys
diff options
context:
space:
mode:
authorimp <imp@FreeBSD.org>2004-04-12 20:56:34 +0000
committerimp <imp@FreeBSD.org>2004-04-12 20:56:34 +0000
commit67c5859522541670ab38af4e06edf745ae350759 (patch)
tree8e0f75faa50b712acc561da8c9b3259c9f67b047 /sys
parent9d988416166cf2f0711666ddf7a3373864188400 (diff)
downloadFreeBSD-src-67c5859522541670ab38af4e06edf745ae350759.zip
FreeBSD-src-67c5859522541670ab38af4e06edf745ae350759.tar.gz
Improve reading of CIS cards:
(1) Align to 64k for the CIS. Some cards don't like it when we aren't aligned to a 64k boundary. I can't find anything in the standard that requires this, but I have 1/2 dozen cards that won't work at all unless I enable this. (2) Sleep 1s before scanning the CIS. This may be a nop, but has little harm. (3) The CIS can be up to 4k in some weird, odd-ball edge cases. Since we have limiters for when that's not the case, it does no harm to increase it to 4k. #1 was submitted, in a different form, by Carlos Velasco.
Diffstat (limited to 'sys')
-rw-r--r--sys/dev/pccard/pccard_cis.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/sys/dev/pccard/pccard_cis.c b/sys/dev/pccard/pccard_cis.c
index 9c2307f..99ec427 100644
--- a/sys/dev/pccard/pccard_cis.c
+++ b/sys/dev/pccard/pccard_cis.c
@@ -60,7 +60,7 @@ extern int pccard_cis_debug;
#define DEVPRINTF(arg)
#endif
-#define PCCARD_CIS_SIZE 1024
+#define PCCARD_CIS_SIZE 4096
struct cis_state {
int count;
@@ -96,6 +96,7 @@ pccard_read_cis(struct pccard_softc *sc)
state.pf = NULL;
+ tsleep(&state, 0, "pccard", hz);
if (pccard_scan_cis(sc->dev, pccard_parse_cis_tuple,
&state) == -1)
state.card->error++;
@@ -126,9 +127,15 @@ pccard_scan_cis(device_t dev, int (*fct)(struct pccard_tuple *, void *),
/* 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;
OpenPOWER on IntegriCloud