[coreboot-gerrit] New patch to review for coreboot: 36dd261 Lenovo X60: Add int15 handler

Denis Carikli (GNUtoo@no-log.org) gerrit at coreboot.org
Tue May 21 03:23:38 CEST 2013


Denis Carikli (GNUtoo at no-log.org) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/3265

-gerrit

commit 36dd26103939e6d2a731d58e94d4e9a58b368895
Author: Denis 'GNUtoo' Carikli <GNUtoo at no-log.org>
Date:   Tue May 21 03:13:46 2013 +0200

    Lenovo X60: Add int15 handler
    
    Without that commit, with CONFIG_PCI_OPTION_ROM_RUN_YABEL,
      The VGA option rom doesn't init the right display,
      and we see nothing either on the external display.
    
    This commit is based on the code of mainboard.c in
      src/mainboard/roda/rk886ex.
    
    Change-Id: I8457aaf0503e0efdf0fcba9ff5e8a07ac04c5ca6
    Signed-off-by: Denis 'GNUtoo' Carikli <GNUtoo at no-log.org>
---
 src/mainboard/lenovo/x60/mainboard.c | 61 ++++++++++++++++++++++++++++++++++++
 1 file changed, 61 insertions(+)

diff --git a/src/mainboard/lenovo/x60/mainboard.c b/src/mainboard/lenovo/x60/mainboard.c
index 3cb28ff..7d29bc1 100644
--- a/src/mainboard/lenovo/x60/mainboard.c
+++ b/src/mainboard/lenovo/x60/mainboard.c
@@ -36,6 +36,11 @@
 #include "dock.h"
 #include <arch/x86/include/arch/acpigen.h>
 
+#if CONFIG_PCI_ROM_RUN || CONFIG_VGA_ROM_RUN
+#include <arch/interrupt.h>
+#include <x86emu/x86emu.h>
+#endif
+
 int i915lightup(unsigned int physbase, unsigned int iobase, unsigned int mmio,
         unsigned int gfx);
 
@@ -45,6 +50,56 @@ static acpi_cstate_t cst_entries[] = {
 	{ 2, 17,  250, { 0x01, 8, 0, { 0 }, DEFAULT_PMBASE + LV3, 0 } },
 };
 
+#define BOOT_DISPLAY_DEFAULT    0
+#define BOOT_DISPLAY_CRT        (1 << 0)
+#define BOOT_DISPLAY_TV         (1 << 1)
+#define BOOT_DISPLAY_EFP        (1 << 2)
+#define BOOT_DISPLAY_LCD        (1 << 3)
+#define BOOT_DISPLAY_CRT2       (1 << 4)
+#define BOOT_DISPLAY_TV2        (1 << 5)
+#define BOOT_DISPLAY_EFP2       (1 << 6)
+#define BOOT_DISPLAY_LCD2       (1 << 7)
+
+#if CONFIG_VGA_ROM_RUN
+static int int15_handler(void)
+{
+	/* This int15 handler is Intel IGD. specific. Other chipsets need other
+	 * handlers. The right way to do this is to move this handler code into
+	 * the mainboard or northbridge code.
+	 * TODO: completely move to mainboards / chipsets.
+	 */
+	u8 display_id;
+
+	printk(BIOS_DEBUG, "%s: AX=%04x BX=%04x CX=%04x DX=%04x\n",
+	       __func__, X86_AX, X86_BX, X86_CX, X86_DX);
+
+	switch (X86_AX) {
+	case 0x5f35: /* Boot Display */
+		X86_AX = 0x005f; // Success
+		X86_CL = BOOT_DISPLAY_DEFAULT;
+		break;
+	case 0x5f40: /* Boot Panel Type */
+		/* LCD panel type is SIO GPIO40-43 */
+		// display_id = inb(0x60f) & 0x0f;
+		display_id = 3;
+		// M.x86.R_AX = 0x015f; // Supported but failed
+		X86_AX = 0x005f; // Success
+		X86_CL = display_id;
+		printk(BIOS_DEBUG, "DISPLAY=%x\n", X86_CL);
+		break;
+	default:
+		/* Interrupt was not handled */
+		printk(BIOS_DEBUG, "Unknown INT15 function %04x!\n", X86_AX);
+		return 0;
+	}
+
+	/* Interrupt handled */
+	return 1;
+}
+#endif
+
+
+
 int get_cst_entries(acpi_cstate_t **entries)
 {
 	*entries = cst_entries;
@@ -62,6 +117,12 @@ static void mainboard_enable(device_t dev)
 		ec_set_bit(0x03, 2);
 		ec_write(0x0c, 0x88);
 	}
+
+#if CONFIG_PCI_OPTION_ROM_RUN_YABEL || CONFIG_PCI_OPTION_ROM_RUN_REALMODE
+	/* Install custom int15 handler for VGA OPROM */
+	mainboard_interrupt_handlers(0x15, &int15_handler);
+#endif
+
 	/* If we're resuming from suspend, blink suspend LED */
 	dev0 = dev_find_slot(0, PCI_DEVFN(0,0));
 	if (dev0 && pci_read_config32(dev0, SKPAD) == SKPAD_ACPI_S3_MAGIC)



More information about the coreboot-gerrit mailing list