ref: 301148756eae8c9821ae0321cfe30a3a75b67a68
parent: 4c8d2b0ebf1fd3fe5b96e227da23a82f669a82fa
author: cinap_lenrek <[email protected]>
date: Sat Jun 6 12:44:14 EDT 2020
aux/vga: use 64-bit physical addresses for pci membar
--- a/sys/src/cmd/aux/vga/3dfx.c
+++ b/sys/src/cmd/aux/vga/3dfx.c
@@ -81,7 +81,8 @@
vga->n[1] = 256;
vga->p[1] = 4;
- if((v = (tdfx->pci->mem[2].bar & ~0x3)) == 0)
+ v = tdfx->pci->mem[2].bar & ~0x3;
+ if(v == 0)
error("%s: I/O not mapped\n", ctlr->name);
tdfx->io = v;
--- a/sys/src/cmd/aux/vga/i81x.c
+++ b/sys/src/cmd/aux/vga/i81x.c
@@ -403,10 +403,10 @@
p = i81x->pci;
printitem(name, "mem[0]");
- Bprint(&stdout, "base %lux size %d\n", p->mem[0].bar & ~0x0F, p->mem[0].size);
+ Bprint(&stdout, "base %llux size %d\n", p->mem[0].bar & ~0x0F, p->mem[0].size);
printitem(name, "mem[1]");
- Bprint(&stdout, "base %lux size %d\n", p->mem[1].bar & ~0x0F, p->mem[1].size);
+ Bprint(&stdout, "base %llux size %d\n", p->mem[1].bar & ~0x0F, p->mem[1].size);
}
--- a/sys/src/cmd/aux/vga/mach64xx.c
+++ b/sys/src/cmd/aux/vga/mach64xx.c
@@ -379,7 +379,8 @@
mp->iow32 = portiow32;
mp->pci = pcimatch(0, 0x1002, 0);
if (mp->pci) {
- if(v = mp->pci->mem[1].bar & ~0x3) {
+ v = mp->pci->mem[1].bar & ~0x3;
+ if(v != 0) {
mp->io = v;
mp->ior32 = pciior32;
mp->iow32 = pciiow32;
--- a/sys/src/cmd/aux/vga/main.c
+++ b/sys/src/cmd/aux/vga/main.c
@@ -131,12 +131,12 @@
* new: addr p 0x12345678 v 0x82345678 size 0x123
*/
if(buf[0]=='p' && buf[1]==' '){
- vga->vmb = strtoul(buf+2, 0, 0);
+ vga->vmb = strtoull(buf+2, 0, 0);
p = strstr(buf, "size");
if(p)
vga->apz = strtoul(p+4, 0, 0);
}else
- vga->vmb = strtoul(buf, 0, 0);
+ vga->vmb = strtoull(buf, 0, 0);
}
else
vgactlw("linear", "0");
--- a/sys/src/cmd/aux/vga/pci.c
+++ b/sys/src/cmd/aux/vga/pci.c
@@ -70,9 +70,9 @@
j = strtol(s+1, &s, 10);
if(j < 0 || j >= nelem(p->mem))
break;
- p->mem[j].bar = strtoul(s+1, &s, 16);
+ p->mem[j].bar = strtoull(s+1, &s, 16);
p->mem[j].size = strtoul(s+1, &s, 10);
- trace("\tmem[%d] = %lux %d\n", j, p->mem[j].bar, p->mem[j].size);
+ trace("\tmem[%d] = %llux %d\n", j, p->mem[j].bar, p->mem[j].size);
}
if(pcilist != nil)
--- a/sys/src/cmd/aux/vga/pci.h
+++ b/sys/src/cmd/aux/vga/pci.h
@@ -92,7 +92,7 @@
uchar rid; /* revision ID */
struct {
- ulong bar; /* base address */
+ uvlong bar; /* base address */
int size;
} mem[6];
--- a/sys/src/cmd/aux/vga/vga.c
+++ b/sys/src/cmd/aux/vga/vga.c
@@ -459,7 +459,7 @@
if(vga->vma || vga->vmb){
printitem(ctlr->name, "vm a b");
- Bprint(&stdout, "%9lud %8lud\n", vga->vma, vga->vmb);
+ Bprint(&stdout, "%9lud %8llud\n", vga->vma, vga->vmb);
}
if(vga->vmz){
printitem(ctlr->name, "vmz");
--- a/sys/src/cmd/aux/vga/vga.h
+++ b/sys/src/cmd/aux/vga/vga.h
@@ -197,7 +197,7 @@
ulong r[2];
ulong vma; /* video memory linear-address alignment */
- ulong vmb; /* video memory linear-address base */
+ uvlong vmb; /* video memory linear-address base */
ulong apz; /* aperture size */
ulong vmz; /* video memory size */