[SeaBIOS] Geode vga pci code

Kevin O'Connor kevin at koconnor.net
Sun Jan 15 06:28:58 CET 2012


Hi Nils,

I noticed that the Geode VGA code seems to be doing manual PCI reads -
which is kinda odd.  Does the patch below work for you?

You'll need to register the rom in cbfs as "pci100b,0030.rom", you'll
need to make sure coreboot is enabling the vga memory ranges, and
you'll need to make sure out/autoconf.h really has CONFIG_VGA_DID/VID
defined corectly - but otherwise it should work.

-Kevin


--- a/vgasrc/geodevga.c
+++ b/vgasrc/geodevga.c
@@ -7,12 +7,13 @@
 // This file may be distributed under the terms of the GNU LGPLv3 license.
 
 #include "geodevga.h" // geodevga_init
-#include "ioport.h" // outb
 #include "farptr.h" // SET_FARVAR
 #include "biosvar.h" // GET_BDA
 #include "vgabios.h" // VGAREG_*
 #include "util.h" // memset
 #include "stdvga.h" // stdvga_crtc_write
+#include "pci.h" // pci_config_readl
+#include "pci_regs.h" // PCI_BASE_ADDRESS_0
 
 
 /****************************************************************
@@ -226,8 +227,7 @@ static int dc_setup(void)
 
     /* read fb-bar from pci, then point dc to the fb base */
     dc_fb = dc_read(seg,DC_GLIU0_MEM_OFFSET);
-    outl(GEODE_PCI_FB,PORT_PCI_CMD);
-    fb = inl(PORT_PCI_DATA);
+    fb = pci_config_readl(GET_GLOBAL(VgaBDF), PCI_BASE_ADDRESS_0);
     if (fb!=dc_fb) {
         dc_write(seg,DC_GLIU0_MEM_OFFSET,fb);
     }
@@ -254,13 +254,12 @@ int vp_setup(void)
     dprintf(2,"VP_SETUP\n");
     /* set output to crt and RGB/YUV */
     if (CONFIG_VGA_GEODEGX2)
-    geode_msrWrite(VP_MSR_CONFIG_GX2,~0 ,~0xf8,0,0);
+        geode_msrWrite(VP_MSR_CONFIG_GX2, ~0, ~0xf8, 0, 0);
     else
-    geode_msrWrite(VP_MSR_CONFIG_LX,~0 ,~0xf8,0,0);
+        geode_msrWrite(VP_MSR_CONFIG_LX, ~0, ~0xf8, 0, 0);
 
     /* get vp register base from pci */
-    outl(GEODE_PCI_VP,PORT_PCI_CMD);
-    vp = inl(PORT_PCI_DATA);
+    vp = pci_config_readl(GET_GLOBAL(VgaBDF), PCI_BASE_ADDRESS_3);
 
     /* Set mmio registers
     * there may be some timing issues here, the reads seem
diff --git a/vgasrc/geodevga.h b/vgasrc/geodevga.h
index ec019a4..fd7ce43 100644
--- a/vgasrc/geodevga.h
+++ b/vgasrc/geodevga.h
@@ -26,12 +26,6 @@
 #define OEM_BAR2                        0x58
 #define OEM_BAR3                        0x5C
 
-#define GEODE_PCI_ADDR                  0x80000900
-#define GEODE_PCI_CMD                   (GEODE_PCI_ADDR + 0x04)
-#define GEODE_PCI_FB                    (GEODE_PCI_ADDR + 0x10)
-#define GEODE_PCI_DC                    (GEODE_PCI_ADDR + 0x18)
-#define GEODE_PCI_VP                    (GEODE_PCI_ADDR + 0x1c)
-
 #define DC_LOCK_LOCK                    0x00000000
 #define DC_LOCK_UNLOCK                  0x00004758
 



More information about the SeaBIOS mailing list