summaryrefslogtreecommitdiff
path: root/sys/src/9/pc/vgamga4xx.c
diff options
context:
space:
mode:
authorcinap_lenrek <cinap_lenrek@felloff.net>2020-06-06 15:58:18 +0200
committercinap_lenrek <cinap_lenrek@felloff.net>2020-06-06 15:58:18 +0200
commit3bebd3f5e278d77b1eb526cd9f924b0777043d2b (patch)
tree2bf7b60c52b67912ccc49a45b6db126186517a3c /sys/src/9/pc/vgamga4xx.c
parenta8f64e53fe2a2a27440dd9441800e8210cb1a00f (diff)
pc/vga*: use 64-bit physical addresses and check pci membar types and sizes
Diffstat (limited to 'sys/src/9/pc/vgamga4xx.c')
-rw-r--r--sys/src/9/pc/vgamga4xx.c15
1 files changed, 10 insertions, 5 deletions
diff --git a/sys/src/9/pc/vgamga4xx.c b/sys/src/9/pc/vgamga4xx.c
index 0bc8019ab..d29d3cfdc 100644
--- a/sys/src/9/pc/vgamga4xx.c
+++ b/sys/src/9/pc/vgamga4xx.c
@@ -119,17 +119,22 @@ mga4xxenable(VGAscr* scr)
if(pci == nil)
return;
+ /* need to map frame buffer here too, so vga can find memory size */
+ if(pci->did == MGA4xx || pci->did == MGA550)
+ size = 32*MB;
+ else
+ size = 8*MB;
+
+ if((pci->mem[0].bar & 1) != 0 || pci->mem[0].size < size
+ || (pci->mem[1].bar & 1) != 0 || pci->mem[1].size < 16*1024)
+ return;
+
scr->mmio = vmap(pci->mem[1].bar&~0x0F, 16*1024);
if(scr->mmio == nil)
return;
addvgaseg("mga4xxmmio", pci->mem[1].bar&~0x0F, pci->mem[1].size);
- /* need to map frame buffer here too, so vga can find memory size */
- if(pci->did == MGA4xx || pci->did == MGA550)
- size = 32*MB;
- else
- size = 8*MB;
vgalinearaddr(scr, pci->mem[0].bar&~0x0F, size);
if(scr->paddr){