ref: 2f88d3c2ab72642bdf82ed713d926e280b766858
parent: 84669fac998ee21091ef85798ab51c97471e03ef
author: cinap_lenrek <cinap_lenrek@felloff.net>
date: Sat Jun 6 12:14:02 EDT 2020
sdodin: use 64-bit physical addresses and check pci membar type
--- a/sys/src/9/pc/sdodin.c
+++ b/sys/src/9/pc/sdodin.c
@@ -2542,10 +2542,9 @@
static uint*
map(Pcidev *p, int bar)
{- uintptr io;
-
- io = p->mem[bar].bar & ~0xf;
- return (uint*)vmap(io, p->mem[bar].size);
+ if(p->mem[bar].size == 0 || (p->mem[bar].bar & 1) != 0)
+ return nil;
+ return (uint*)vmap(p->mem[bar].bar & ~0xf, p->mem[bar].size);
}
/* §5.1.3 */
@@ -2655,8 +2654,8 @@
s = sdevs + nmsctlr;
memset(c, 0, sizeof *c);
memset(s, 0, sizeof *s);
- if((c->reg = map(p, Mebar)) == 0){- print("sdodin: bar %#p in use\n", c->reg);+ if((c->reg = map(p, Mebar)) == nil){+ print("sdodin: can't map registers\n");continue;
}
pcienable(p);
--
⑨