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.
This commit is contained in:
Warner Losh 2004-04-12 20:56:34 +00:00
parent a8b76c8fd7
commit 8f54c15baf
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=128169

View File

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