[syslinux:master] i915resolution: use libpci to access PCI config space

syslinux-bot for H. Peter Anvin hpa at zytor.com
Tue Feb 16 20:15:14 PST 2010


Commit-ID:  9591feebc4ea6f5469027f26ef0759c91e42cafe
Gitweb:     http://syslinux.zytor.com/commit/9591feebc4ea6f5469027f26ef0759c91e42cafe
Author:     H. Peter Anvin <hpa at zytor.com>
AuthorDate: Tue, 16 Feb 2010 20:12:57 -0800
Committer:  H. Peter Anvin <hpa at zytor.com>
CommitDate: Tue, 16 Feb 2010 20:12:57 -0800

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 <hpa at zytor.com>


---
 com32/lib/sys/vesa/i915resolution.c |   30 +++++++++++-------------------
 1 files changed, 11 insertions(+), 19 deletions(-)

diff --git a/com32/lib/sys/vesa/i915resolution.c b/com32/lib/sys/vesa/i915resolution.c
index a9b28cc..6ebb04d 100644
--- a/com32/lib/sys/vesa/i915resolution.c
+++ b/com32/lib/sys/vesa/i915resolution.c
@@ -52,6 +52,7 @@
 #include <string.h>
 #include <sys/io.h>
 #include <sys/cpu.h>
+#include <sys/pci.h>
 #include <unistd.h>
 #include <assert.h>
 #include <stdbool.h>
@@ -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;
     }
 



More information about the Syslinux-commits mailing list