summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorcinap_lenrek <cinap_lenrek@felloff.net>2020-06-06 16:16:03 +0200
committercinap_lenrek <cinap_lenrek@felloff.net>2020-06-06 16:16:03 +0200
commit8003f4f00f0645426a0694b0e5e915d26b7c7153 (patch)
treebab574973c4cc7b7f1da50da5a3b69cf3455d876
parent15e90cedc17dd2501708428da62c7e54086cf3b1 (diff)
downloadplan9front-8003f4f00f0645426a0694b0e5e915d26b7c7153.tar.xz
sdmv50xx: use 64-bit physical addresses and check pci membar type
-rw-r--r--sys/src/9/pc/sdmv50xx.c19
1 files changed, 10 insertions, 9 deletions
diff --git a/sys/src/9/pc/sdmv50xx.c b/sys/src/9/pc/sdmv50xx.c
index 5ebb6d6fd..a48264d89 100644
--- a/sys/src/9/pc/sdmv50xx.c
+++ b/sys/src/9/pc/sdmv50xx.c
@@ -1131,8 +1131,9 @@ static SDev*
mv50pnp(void)
{
int i, nunit;
+ ulong n, *mem;
uchar *base;
- ulong io, n, *mem;
+ uvlong io;
Ctlr *ctlr;
Drive *d;
Pcidev *p;
@@ -1148,6 +1149,8 @@ mv50pnp(void)
while((p = pcimatch(p, 0x11ab, 0)) != nil){
if(p->ccrb != Pcibcstore || p->ccru + p->ccrp || p->did&0x0f00)
continue;
+ if(p->mem[0].size == 0 || (p->mem[0].bar & 1) != 0)
+ continue;
switch(p->did){
case 0x5040:
case 0x5041:
@@ -1169,20 +1172,18 @@ mv50pnp(void)
'E' + ctlrno, (ushort)p->did, nunit,
((p->did&0xf000)==0x6000? "II": "I"),
(p->did&1? "": "out"));
+ io = p->mem[0].bar & ~0xF;
+ mem = (ulong*)vmap(io, p->mem[0].size);
+ if(mem == nil){
+ print("sdmv50xx: can't map %llux\n", io);
+ continue;
+ }
if((sdev = malloc(sizeof *sdev)) == nil)
continue;
if((ctlr = malloc(sizeof *ctlr)) == nil){
free(sdev);
continue;
}
- io = p->mem[0].bar & ~0x0F;
- mem = (ulong*)vmap(io, p->mem[0].size);
- if(mem == 0){
- print("sdmv50xx: address 0x%luX in use\n", io);
- free(sdev);
- free(ctlr);
- continue;
- }
ctlr->rid = p->rid;
/* avert thine eyes! (what does this do?) */