Xen: Use VGA Hooks to make VGA passthrough work on certain devices
authorJulian Pidancet <julian.pidancet@gmail.com>
Sun, 5 Feb 2012 04:51:06 +0000 (04:51 +0000)
committerKevin O'Connor <kevin@koconnor.net>
Sun, 5 Feb 2012 18:25:50 +0000 (13:25 -0500)
The Intel gfx VGA option ROM on certain platforms requires the 155f50 BIOS
function to be implemented (even if it does nothing), to work properly.

v2: Ignore the case where Option ROMs are pre-deployed.
    Make vgahook_setup independent of wether the CB* variables are set.
    VGA hooks can be enabled on non-coreboot and non-Xen configurations.

Signed-off-by: Julian Pidancet <julian.pidancet@gmail.com>
src/Kconfig
src/coreboot.c
src/vgahooks.c

index cf0bff09b7d5140cae1a7ecb8a4890686686b0f8..250663aad01fa9bfbadfa23b7393a85908463471 100644 (file)
@@ -283,7 +283,6 @@ menu "BIOS interfaces"
             Support S3 resume handler.
 
     config VGAHOOKS
-        depends on COREBOOT
         bool "Hardware specific VGA helpers"
         default y
         help
index ee9dd8b4b4d91171440f949673e062574c2f504f..e328c15acfb53f9d6cfb6b2b173d61163a89142a 100644 (file)
@@ -117,7 +117,7 @@ find_cb_subtable(struct cb_header *cbh, u32 tag)
 }
 
 static struct cb_memory *CBMemTable;
-const char *CBvendor, *CBpart;
+const char *CBvendor = "", *CBpart = "";
 
 // Populate max ram and e820 map info by scanning for a coreboot table.
 static void
index a8f667ca4e309234ba17a0bda16a6a0be2bab7fb..20a2e2e2947bd7f48ac822b5adac0322f23d2a3c 100644 (file)
@@ -185,12 +185,21 @@ intel_155f40(struct bregs *regs)
     set_success(regs);
 }
 
+static void
+intel_155f50(struct bregs *regs)
+{
+    /* Mandatory hook on some Dell laptops */
+    regs->ax = 0x005f;
+    set_success(regs);
+}
+
 static void
 intel_155f(struct bregs *regs)
 {
     switch (regs->al) {
     case 0x35: intel_155f35(regs); break;
     case 0x40: intel_155f40(regs); break;
+    case 0x50: intel_155f50(regs); break;
     default:   handle_155fXX(regs); break;
     }
 }
@@ -205,6 +214,15 @@ intel_155f(struct bregs *regs)
 #define BOOT_DISPLAY_EFP2       (1 << 6)
 #define BOOT_DISPLAY_LCD2       (1 << 7)
 
+static void
+intel_setup(struct pci_device *pci)
+{
+    VGAHookHandlerType = VH_INTEL;
+
+    IntelDisplayType = BOOT_DISPLAY_DEFAULT;
+    IntelDisplayId = 3;
+}
+
 static void
 roda_setup(struct pci_device *pci)
 {
@@ -254,7 +272,7 @@ handle_155f(struct bregs *regs)
 void
 vgahook_setup(struct pci_device *pci)
 {
-    if (!CONFIG_VGAHOOKS || !CBvendor || !CBpart)
+    if (!CONFIG_VGAHOOKS)
         return;
 
     if (strcmp(CBvendor, "KONTRON") == 0 && strcmp(CBpart, "986LCD-M") == 0)
@@ -265,4 +283,6 @@ vgahook_setup(struct pci_device *pci)
         roda_setup(pci);
     else if (pci->vendor == PCI_VENDOR_ID_VIA)
         via_setup(pci);
+    else if (pci->vendor == PCI_VENDOR_ID_INTEL)
+        intel_setup(pci);
 }