From 8f54c15baf92bb5fc35d141065abfee53697de39 Mon Sep 17 00:00:00 2001 From: Warner Losh Date: Mon, 12 Apr 2004 20:56:34 +0000 Subject: 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. --- sys/dev/pccard/pccard_cis.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'sys/dev') diff --git a/sys/dev/pccard/pccard_cis.c b/sys/dev/pccard/pccard_cis.c index 9c2307f5355b9..99ec427805034 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; -- cgit v1.3