vgabios: Add cirrus linear framebuffer detection; enable VBE in cirrus.
[seabios.git] / vgasrc / bochsvga.c
index d9858c2061be9b5c8ee7348408228583152a2247..b7b1b05835de6476ff6b9d0abed641b3c6a14602 100644 (file)
@@ -5,6 +5,8 @@
 #include "config.h" // CONFIG_*
 #include "biosvar.h" // SET_BDA
 #include "stdvga.h" // VGAREG_SEQU_ADDRESS
+#include "pci.h" // pci_config_readl
+#include "pci_regs.h" // PCI_BASE_ADDRESS_0
 
 static struct bochsvga_mode
 {
@@ -76,27 +78,6 @@ static struct bochsvga_mode
     { 0x18c, { MM_DIRECT, 2560, 1600, 32 } },
 };
 
-static inline u32 pci_config_readl(u16 bdf, u16 addr)
-{
-    int status;
-    u32 val;
-
-    addr &= ~3;
-
-    asm volatile(
-            "int $0x1a\n"
-            "cli\n"
-            "cld"
-            : "=a"(status), "=c"(val)
-            : "a"(0xb10a), "b"(bdf), "D"(addr)
-            : "cc", "memory");
-
-    if ((status >> 16))
-        return (u32)-1;
-
-    return val;
-}
-
 static u16 dispi_get_max_xres(void)
 {
     u16 en;
@@ -145,7 +126,8 @@ bochsvga_init(void)
 
     u32 lfb_addr;
     if (CONFIG_VGA_PCI)
-        lfb_addr = pci_config_readl(GET_GLOBAL(VgaBDF), 0x10) & ~0xf;
+        lfb_addr = (pci_config_readl(GET_GLOBAL(VgaBDF), PCI_BASE_ADDRESS_0)
+                    & PCI_BASE_ADDRESS_MEM_MASK);
     else
         lfb_addr = VBE_DISPI_LFB_PHYSICAL_ADDRESS;