From 9591feebc4ea6f5469027f26ef0759c91e42cafe Mon Sep 17 00:00:00 2001 From: "H. Peter Anvin" Date: Tue, 16 Feb 2010 20:12:57 -0800 Subject: i915resolution: use libpci to access PCI config space Use libpci to access PCI config space. This *hopefully* will make it less likely that some old machine hangs when failing to set the requested video mode. Signed-off-by: H. Peter Anvin --- com32/lib/sys/vesa/i915resolution.c | 30 +++++++++++------------------- 1 file changed, 11 insertions(+), 19 deletions(-) diff --git a/com32/lib/sys/vesa/i915resolution.c b/com32/lib/sys/vesa/i915resolution.c index a9b28cc2..6ebb04d3 100644 --- a/com32/lib/sys/vesa/i915resolution.c +++ b/com32/lib/sys/vesa/i915resolution.c @@ -52,6 +52,7 @@ #include #include #include +#include #include #include #include @@ -206,8 +207,7 @@ static inline void status(const char *fmt, ...) { (void)fmt; } #endif static unsigned int get_chipset_id(void) { - outl(0x80000000, 0xcf8); - return inl(0xcfc); + return pci_readl(0x80000000); } static chipset_type get_chipset(unsigned int id) { @@ -465,11 +465,8 @@ static void unlock_vbios(vbios_map * map) break; case CT_830: case CT_855GM: - outl(0x8000005a, 0xcf8); - map->b1 = inb(0xcfe); - - outl(0x8000005a, 0xcf8); - outb(0x33, 0xcfe); + map->b1 = pci_readb(0x8000005a); + pci_writeb(0x33, 0x8000005a); break; case CT_845G: case CT_865G: @@ -481,13 +478,10 @@ static void unlock_vbios(vbios_map * map) case CT_946GZ: case CT_G965: case CT_Q965: - outl(0x80000090, 0xcf8); - map->b1 = inb(0xcfd); - map->b2 = inb(0xcfe); - - outl(0x80000090, 0xcf8); - outb(0x33, 0xcfd); - outb(0x33, 0xcfe); + map->b1 = pci_readb(0x80000091); + map->b2 = pci_readb(0x80000092); + pci_writeb(0x33, 0x80000091); + pci_writeb(0x33, 0x80000092); break; } @@ -510,8 +504,7 @@ static void relock_vbios(vbios_map * map) break; case CT_830: case CT_855GM: - outl(0x8000005a, 0xcf8); - outb(map->b1, 0xcfe); + pci_writeb(map->b1, 0x8000005a); break; case CT_845G: case CT_865G: @@ -523,9 +516,8 @@ static void relock_vbios(vbios_map * map) case CT_946GZ: case CT_G965: case CT_Q965: - outl(0x80000090, 0xcf8); - outb(map->b1, 0xcfd); - outb(map->b2, 0xcfe); + pci_writeb(map->b1, 0x80000091); + pci_writeb(map->b2, 0x80000092); break; } -- cgit v1.2.1