Commit fb26029e authored by Russell King's avatar Russell King

[PCMCIA] Fix bug in PCMCIA resource management memory probing

This prevents us from probing past the memory areas which cardmgr
passes us, and also allows us to correctly remove areas which we
decide are not available for PCMCIA use.
parent ec7ee636
...@@ -491,7 +491,7 @@ static u_long inv_probe(resource_map_t *m, struct pcmcia_socket *s) ...@@ -491,7 +491,7 @@ static u_long inv_probe(resource_map_t *m, struct pcmcia_socket *s)
void validate_mem(struct pcmcia_socket *s) void validate_mem(struct pcmcia_socket *s)
{ {
resource_map_t *m, *n; resource_map_t *m, mm;
static u_char order[] = { 0xd0, 0xe0, 0xc0, 0xf0 }; static u_char order[] = { 0xd0, 0xe0, 0xc0, 0xf0 };
static int hi = 0, lo = 0; static int hi = 0, lo = 0;
u_long b, i, ok = 0; u_long b, i, ok = 0;
...@@ -510,18 +510,18 @@ void validate_mem(struct pcmcia_socket *s) ...@@ -510,18 +510,18 @@ void validate_mem(struct pcmcia_socket *s)
} }
if (lo++) if (lo++)
goto out; goto out;
for (m = mem_db.next; m != &mem_db; m = n) { for (m = mem_db.next; m != &mem_db; m = mm.next) {
n = m->next; mm = *m;
/* Only probe < 1 MB */ /* Only probe < 1 MB */
if (m->base >= 0x100000) continue; if (mm.base >= 0x100000) continue;
if ((m->base | m->num) & 0xffff) { if ((mm.base | mm.num) & 0xffff) {
ok += do_mem_probe(m->base, m->num, s); ok += do_mem_probe(mm.base, mm.num, s);
continue; continue;
} }
/* Special probe for 64K-aligned block */ /* Special probe for 64K-aligned block */
for (i = 0; i < 4; i++) { for (i = 0; i < 4; i++) {
b = order[i] << 12; b = order[i] << 12;
if ((b >= m->base) && (b+0x10000 <= m->base+m->num)) { if ((b >= mm.base) && (b+0x10000 <= mm.base+mm.num)) {
if (ok >= mem_limit) if (ok >= mem_limit)
sub_interval(&mem_db, b, 0x10000); sub_interval(&mem_db, b, 0x10000);
else else
...@@ -537,14 +537,14 @@ void validate_mem(struct pcmcia_socket *s) ...@@ -537,14 +537,14 @@ void validate_mem(struct pcmcia_socket *s)
void validate_mem(struct pcmcia_socket *s) void validate_mem(struct pcmcia_socket *s)
{ {
resource_map_t *m, *n; resource_map_t *m, mm;
static int done = 0; static int done = 0;
if (probe_mem && done++ == 0) { if (probe_mem && done++ == 0) {
down(&rsrc_sem); down(&rsrc_sem);
for (m = mem_db.next; m != &mem_db; m = n) { for (m = mem_db.next; m != &mem_db; m = mm.next) {
n = m->next; mm = *m;
if (do_mem_probe(m->base, m->num, s)) if (do_mem_probe(mm.base, mm.num, s))
break; break;
} }
up(&rsrc_sem); up(&rsrc_sem);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment