diff options
author | cinap_lenrek <cinap_lenrek@felloff.net> | 2015-01-10 03:07:29 +0100 |
---|---|---|
committer | cinap_lenrek <cinap_lenrek@felloff.net> | 2015-01-10 03:07:29 +0100 |
commit | 6e67b04a1fa9da8591abccb3c03859b50e3679d8 (patch) | |
tree | ada6dd3364d1d6fd6a9c30023b58bcc0e8e6d67f /sys/src/cmd/aux/vga | |
parent | 7c3736a16aafe0ca1fe385e86950edf22cf6fe4d (diff) |
igfx: use mmio to access registers instead of pio, fix wrong igfxmmio segment size
initially, pio was used to access registers so i didnt need
a kernel driver for initial testing.
pio does not work under efi, so use mmio to access registers.
Diffstat (limited to 'sys/src/cmd/aux/vga')
-rw-r--r-- | sys/src/cmd/aux/vga/igfx.c | 23 |
1 files changed, 18 insertions, 5 deletions
diff --git a/sys/src/cmd/aux/vga/igfx.c b/sys/src/cmd/aux/vga/igfx.c index 11c08a442..c5c7e0713 100644 --- a/sys/src/cmd/aux/vga/igfx.c +++ b/sys/src/cmd/aux/vga/igfx.c @@ -119,6 +119,7 @@ struct Igfx { Pcidev *pci; u32int pio; + u32int *mmio; int type; @@ -157,6 +158,8 @@ rr(Igfx *igfx, u32int a) if(a == 0) return 0; assert((a & 3) == 0); + if(igfx->mmio != nil) + return igfx->mmio[a/4]; outportl(igfx->pio, a); return inportl(igfx->pio + 4); } @@ -165,8 +168,11 @@ wr(Igfx *igfx, u32int a, u32int v) { if(a == 0) /* invalid */ return; - assert((a & 3) == 0); + if(igfx->mmio != nil){ + igfx->mmio[a/4] = v; + return; + } outportl(igfx->pio, a); outportl(igfx->pio + 4, v); } @@ -319,11 +325,18 @@ snarf(Vga* vga, Ctlr* ctlr) error("%s: unrecognized device\n", ctlr->name); return; } - if((igfx->pci->mem[4].bar & 1) == 0){ - error("%s: no pio bar\n", ctlr->name); - return; + vgactlpci(igfx->pci); + if(1){ + vgactlw("type", ctlr->name); + igfx->mmio = segattach(0, "igfxmmio", 0, igfx->pci->mem[0].size); + if(igfx->mmio == (u32int*)-1) + error("%s: segattach mmio failed: %r\n", ctlr->name); + } else { + if((igfx->pci->mem[4].bar & 1) == 0) + error("%s: no pio bar\n", ctlr->name); + igfx->pio = igfx->pci->mem[4].bar & ~1; + igfx->mmio = nil; } - igfx->pio = igfx->pci->mem[4].bar & ~1; vga->private = igfx; } |