Vladimir Serbinenko (phcoder@gmail.com) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/6820
-gerrit
commit ceeffc0d22e722512bd06420181519ac4558416b Author: Vladimir Serbinenko phcoder@gmail.com Date: Mon Sep 1 01:41:37 2014 +0200
Consolidate intel vga int15 hooks
Change-Id: I9366dded98bf15f6da44ce893dd10698ba09fd55 Signed-off-by: Vladimir Serbinenko phcoder@gmail.com --- src/drivers/intel/gma/Kconfig | 4 + src/drivers/intel/gma/Makefile.inc | 4 +- src/mainboard/apple/macbook21/Kconfig | 1 + src/mainboard/apple/macbook21/mainboard.c | 38 +-------- src/mainboard/google/bolt/Kconfig | 1 + src/mainboard/google/bolt/mainboard.c | 95 +--------------------- src/mainboard/google/butterfly/Kconfig | 1 + src/mainboard/google/butterfly/mainboard.c | 94 +--------------------- src/mainboard/google/falco/Kconfig | 1 + src/mainboard/google/falco/mainboard.c | 95 +--------------------- src/mainboard/google/panther/Kconfig | 1 + src/mainboard/google/panther/mainboard.c | 92 +-------------------- src/mainboard/google/parrot/Kconfig | 1 + src/mainboard/google/parrot/mainboard.c | 94 +--------------------- src/mainboard/google/peppy/Kconfig | 1 + src/mainboard/google/peppy/mainboard.c | 95 +--------------------- src/mainboard/google/samus/Kconfig | 1 + src/mainboard/google/samus/mainboard.c | 95 +--------------------- src/mainboard/google/slippy/Kconfig | 1 + src/mainboard/google/slippy/mainboard.c | 95 +--------------------- src/mainboard/google/stout/Kconfig | 1 + src/mainboard/google/stout/mainboard.c | 94 +--------------------- src/mainboard/ibase/mb899/Kconfig | 1 + src/mainboard/ibase/mb899/mainboard.c | 45 +---------- src/mainboard/intel/baskingridge/Kconfig | 1 + src/mainboard/intel/baskingridge/mainboard.c | 95 +--------------------- src/mainboard/intel/cougar_canyon2/Kconfig | 1 + src/mainboard/intel/cougar_canyon2/mainboard.c | 105 +----------------------- src/mainboard/intel/emeraldlake2/Kconfig | 1 + src/mainboard/intel/emeraldlake2/mainboard.c | 107 +------------------------ src/mainboard/intel/wtm2/mainboard.c | 95 +--------------------- src/mainboard/kontron/986lcd-m/Kconfig | 1 + src/mainboard/kontron/986lcd-m/mainboard.c | 52 +----------- src/mainboard/lenovo/t520/Kconfig | 1 + src/mainboard/lenovo/t520/mainboard.c | 94 +--------------------- src/mainboard/lenovo/t530/Kconfig | 1 + src/mainboard/lenovo/t530/mainboard.c | 94 +--------------------- src/mainboard/lenovo/t60/Kconfig | 1 + src/mainboard/lenovo/t60/mainboard.c | 38 +-------- src/mainboard/lenovo/x200/Kconfig | 1 + src/mainboard/lenovo/x200/mainboard.c | 74 +---------------- src/mainboard/lenovo/x201/Kconfig | 1 + src/mainboard/lenovo/x201/mainboard.c | 35 +------- src/mainboard/lenovo/x220/Kconfig | 1 + src/mainboard/lenovo/x220/mainboard.c | 94 +--------------------- src/mainboard/lenovo/x230/Kconfig | 1 + src/mainboard/lenovo/x230/mainboard.c | 94 +--------------------- src/mainboard/lenovo/x60/Kconfig | 1 + src/mainboard/lenovo/x60/mainboard.c | 38 +-------- src/mainboard/packardbell/ms2290/Kconfig | 1 + src/mainboard/packardbell/ms2290/mainboard.c | 35 +------- src/mainboard/roda/rk886ex/Kconfig | 1 + src/mainboard/roda/rk886ex/mainboard.c | 60 ++------------ src/mainboard/roda/rk9/mainboard.c | 77 ++---------------- src/mainboard/samsung/lumpy/Kconfig | 1 + src/mainboard/samsung/lumpy/mainboard.c | 94 +--------------------- src/mainboard/samsung/stumpy/Kconfig | 1 + src/mainboard/samsung/stumpy/mainboard.c | 94 +--------------------- src/mainboard/thomson/ip1000/Kconfig | 1 + src/mainboard/thomson/ip1000/mainboard.c | 56 +------------ 60 files changed, 100 insertions(+), 2299 deletions(-)
diff --git a/src/drivers/intel/gma/Kconfig b/src/drivers/intel/gma/Kconfig index e26c297..6657224 100644 --- a/src/drivers/intel/gma/Kconfig +++ b/src/drivers/intel/gma/Kconfig @@ -32,3 +32,7 @@ config INTEL_DDI config INTEL_EDID bool default n + +config INTEL_INT15 + bool + default n diff --git a/src/drivers/intel/gma/Makefile.inc b/src/drivers/intel/gma/Makefile.inc index 3c0a126..af599e3 100644 --- a/src/drivers/intel/gma/Makefile.inc +++ b/src/drivers/intel/gma/Makefile.inc @@ -20,4 +20,6 @@ ramstage-$(CONFIG_INTEL_DP) += intel_dp.c drm_dp_helper.c display.c ramstage-$(CONFIG_INTEL_DDI) += intel_ddi.c ramstage-$(CONFIG_INTEL_EDID) += edid.c vbt.c - +ifeq ($(CONFIG_VGA_ROM_RUN),y) +ramstage-$(CONFIG_INTEL_INT15) += int15.c +endif \ No newline at end of file diff --git a/src/mainboard/apple/macbook21/Kconfig b/src/mainboard/apple/macbook21/Kconfig index 871c16c..a01d6b1 100644 --- a/src/mainboard/apple/macbook21/Kconfig +++ b/src/mainboard/apple/macbook21/Kconfig @@ -13,6 +13,7 @@ config BOARD_SPECIFIC_OPTIONS # dummy select HAVE_MP_TABLE select BOARD_ROMSIZE_KB_2048 select CHANNEL_XOR_RANDOMIZATION + select INTEL_INT15 select HAVE_ACPI_TABLES select HAVE_ACPI_RESUME select USE_OPTION_TABLE diff --git a/src/mainboard/apple/macbook21/mainboard.c b/src/mainboard/apple/macbook21/mainboard.c index b537f78..846914c 100644 --- a/src/mainboard/apple/macbook21/mainboard.c +++ b/src/mainboard/apple/macbook21/mainboard.c @@ -33,42 +33,11 @@ #include <pc80/mc146818rtc.h> #include <arch/x86/include/arch/acpigen.h> #include <smbios.h> -#include <x86emu/x86emu.h> +#include <drivers/intel/gma/int15.h> #include <device/azalia_device.h> #include "hda_verb.h" #define PANEL INT15_5F35_CL_DISPLAY_DEFAULT
-#if CONFIG_PCI_OPTION_ROM_RUN_YABEL || CONFIG_PCI_OPTION_ROM_RUN_REALMODE -static int int15_handler(void) -{ - /* The right way to do this is to move this handler code into - * the mainboard or northbridge code. - * TODO: completely move to mainboards / chipsets. - */ - 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 = PANEL; - break; - case 0x5f40: /* Boot Panel Type */ - X86_AX = 0x005f; // Success - X86_CL = 3; - 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) { return 0; @@ -76,10 +45,7 @@ int get_cst_entries(acpi_cstate_t **entries)
static void mainboard_init(device_t dev) { -#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 + install_intel_vga_int15_handler(GMA_INT15_ACTIVE_LFP_INT_LVDS, GMA_INT15_PANEL_FIT_DEFAULT, PANEL, 3); }
static void mainboard_enable(device_t dev) diff --git a/src/mainboard/google/bolt/Kconfig b/src/mainboard/google/bolt/Kconfig index 25c85d0..7a756cc 100644 --- a/src/mainboard/google/bolt/Kconfig +++ b/src/mainboard/google/bolt/Kconfig @@ -18,6 +18,7 @@ config BOARD_SPECIFIC_OPTIONS # dummy select MAINBOARD_HAS_CHROMEOS select EXTERNAL_MRC_BLOB select MONOTONIC_TIMER_MSR + select INTEL_INT15
config VBOOT_RAMSTAGE_INDEX hex diff --git a/src/mainboard/google/bolt/mainboard.c b/src/mainboard/google/bolt/mainboard.c index dd5dc03..961f58d 100644 --- a/src/mainboard/google/bolt/mainboard.c +++ b/src/mainboard/google/bolt/mainboard.c @@ -26,9 +26,7 @@ #include <device/pci_def.h> #include <device/pci_ops.h> #include <console/console.h> -#if CONFIG_VGA_ROM_RUN -#include <x86emu/x86emu.h> -#endif +#include <drivers/intel/gma/int15.h> #include <pc80/mc146818rtc.h> #include <arch/acpi.h> #include <arch/io.h> @@ -46,92 +44,6 @@ void mainboard_suspend_resume(void) outb(0xcb, 0xb2); }
-#if CONFIG_VGA_ROM_RUN -static int int15_handler(void) -{ - int res = 0; - - 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 0x5f34: - /* - * Set Panel Fitting Hook: - * bit 2 = Graphics Stretching - * bit 1 = Text Stretching - * bit 0 = Centering (do not set with bit1 or bit2) - * 0 = video bios default - */ - X86_AX = 0x005f; - X86_CX = 0x0001; - res = 1; - break; - case 0x5f35: - /* - * Boot Display Device Hook: - * bit 0 = CRT - * bit 1 = TV (eDP) * - * bit 2 = EFP * - * bit 3 = LFP - * bit 4 = CRT2 - * bit 5 = TV2 (eDP) * - * bit 6 = EFP2 * - * bit 7 = LFP2 - */ - X86_AX = 0x005f; - X86_CX = 0x0000; - res = 1; - break; - case 0x5f51: - /* - * Hook to select active LFP configuration: - * 00h = No LVDS, VBIOS does not enable LVDS - * 01h = Int-LVDS, LFP driven by integrated LVDS decoder - * 02h = SVDO-LVDS, LFP driven by SVDO decoder - * 03h = eDP, LFP Driven by Int-DisplayPort encoder - */ - X86_AX = 0x005f; - X86_CX = 0x0003; - res = 1; - break; - case 0x5f70: - switch ((X86_CX >> 8) & 0xff) { - case 0: - /* Get Mux */ - X86_AX = 0x005f; - X86_CX = 0x0000; - res = 1; - break; - case 1: - /* Set Mux */ - X86_AX = 0x005f; - X86_CX = 0x0000; - res = 1; - break; - case 2: - /* Get SG/Non-SG mode */ - X86_AX = 0x005f; - X86_CX = 0x0000; - res = 1; - break; - default: - /* Interrupt was not handled */ - printk(BIOS_DEBUG, - "Unknown INT15 5f70 function: 0x%02x\n", - ((X86_CX >> 8) & 0xff)); - break; - } - break; - - default: - printk(BIOS_DEBUG, "Unknown INT15 function %04x!\n", X86_AX); - break; - } - return res; -} -#endif - /* Audio Setup */
static void verb_setup(void) @@ -187,10 +99,7 @@ static void mainboard_enable(device_t dev) { dev->ops->init = mainboard_init; dev->ops->get_smbios_data = mainboard_smbios_data; -#if CONFIG_VGA_ROM_RUN - /* Install custom int15 handler for VGA OPROM */ - mainboard_interrupt_handlers(0x15, &int15_handler); -#endif + install_intel_vga_int15_handler(GMA_INT15_ACTIVE_LFP_EDP, GMA_INT15_PANEL_FIT_CENTERING, GMA_INT15_BOOT_DISPLAY_DEFAULT, 0); verb_setup(); }
diff --git a/src/mainboard/google/butterfly/Kconfig b/src/mainboard/google/butterfly/Kconfig index dda4e7c2..08870fa 100644 --- a/src/mainboard/google/butterfly/Kconfig +++ b/src/mainboard/google/butterfly/Kconfig @@ -13,6 +13,7 @@ config BOARD_SPECIFIC_OPTIONS # dummy select HAVE_ACPI_RESUME select HAVE_SMI_HANDLER select MAINBOARD_HAS_CHROMEOS + select INTEL_INT15
# Workaround for EC/KBC IRQ1. select SERIRQ_CONTINUOUS_MODE diff --git a/src/mainboard/google/butterfly/mainboard.c b/src/mainboard/google/butterfly/mainboard.c index 85b86cb..1cc079d 100644 --- a/src/mainboard/google/butterfly/mainboard.c +++ b/src/mainboard/google/butterfly/mainboard.c @@ -24,9 +24,7 @@ #include <device/pci_def.h> #include <device/pci_ops.h> #include <console/console.h> -#if CONFIG_VGA_ROM_RUN -#include <x86emu/x86emu.h> -#endif +#include <drivers/intel/gma/int15.h> #include <pc80/mc146818rtc.h> #include <arch/acpi.h> #include <arch/io.h> @@ -196,91 +194,6 @@ void mainboard_suspend_resume(void) outb(0xcb, 0xb2); }
-#if CONFIG_VGA_ROM_RUN -static int int15_handler(void) -{ - int res = 0; - - printk(BIOS_DEBUG, "%s: INT15 function %04x!\n", - __func__, X86_AX); - - switch (X86_AX) { - case 0x5f34: - /* - * Set Panel Fitting Hook: - * bit 2 = Graphics Stretching - * bit 1 = Text Stretching - * bit 0 = Centering (do not set with bit1 or bit2) - * 0 = video bios default - */ - X86_AX = 0x005f; - X86_CL = 0x00; /* Use video bios default */ - res = 1; - break; - case 0x5f35: - /* - * Boot Display Device Hook: - * bit 0 = CRT - * bit 1 = TV (eDP) - * bit 2 = EFP - * bit 3 = LFP - * bit 4 = CRT2 - * bit 5 = TV2 (eDP) - * bit 6 = EFP2 - * bit 7 = LFP2 - */ - X86_AX = 0x005f; - X86_CX = 0x0000; /* Use video bios default */ - res = 1; - break; - case 0x5f51: - /* - * Hook to select active LFP configuration: - * 00h = No LVDS, VBIOS does not enable LVDS - * 01h = Int-LVDS, LFP driven by integrated LVDS decoder - * 02h = SVDO-LVDS, LFP driven by SVDO decoder - * 03h = eDP, LFP Driven by Int-DisplayPort encoder - */ - X86_AX = 0x005f; - X86_CX = 0x0001; /* Int-LVDS */ - res = 1; - break; - case 0x5f70: - switch (X86_CH) { - case 0: - /* Get Mux */ - X86_AX = 0x005f; - X86_CX = 0x0000; - res = 1; - break; - case 1: - /* Set Mux */ - X86_AX = 0x005f; - X86_CX = 0x0000; - res = 1; - break; - case 2: - /* Get SG/Non-SG mode */ - X86_AX = 0x005f; - X86_CX = 0x0000; - res = 1; - break; - default: - /* Interrupt was not handled */ - printk(BIOS_DEBUG, "Unknown INT15 5f70 function: 0x%02x\n", - X86_CH); - break; - } - break; - - default: - printk(BIOS_DEBUG, "Unknown INT15 function %04x!\n", X86_AX); - break; - } - return res; -} -#endif - /* Audio Setup */
static void verb_setup(void) @@ -380,10 +293,7 @@ static void mainboard_enable(device_t dev) { dev->ops->init = mainboard_init; dev->ops->get_smbios_data = butterfly_onboard_smbios_data; -#if CONFIG_VGA_ROM_RUN - /* Install custom int15 handler for VGA OPROM */ - mainboard_interrupt_handlers(0x15, &int15_handler); -#endif + install_intel_vga_int15_handler(GMA_INT15_ACTIVE_LFP_INT_LVDS, GMA_INT15_PANEL_FIT_DEFAULT, GMA_INT15_BOOT_DISPLAY_DEFAULT, 0); verb_setup(); }
diff --git a/src/mainboard/google/falco/Kconfig b/src/mainboard/google/falco/Kconfig index 9a62efa..3323fc2 100644 --- a/src/mainboard/google/falco/Kconfig +++ b/src/mainboard/google/falco/Kconfig @@ -19,6 +19,7 @@ config BOARD_SPECIFIC_OPTIONS # dummy select EXTERNAL_MRC_BLOB select MONOTONIC_TIMER_MSR select MAINBOARD_HAS_NATIVE_VGA_INIT + select INTEL_INT15
config VBOOT_RAMSTAGE_INDEX hex diff --git a/src/mainboard/google/falco/mainboard.c b/src/mainboard/google/falco/mainboard.c index 38edb5c..939368b 100644 --- a/src/mainboard/google/falco/mainboard.c +++ b/src/mainboard/google/falco/mainboard.c @@ -26,9 +26,7 @@ #include <device/pci_def.h> #include <device/pci_ops.h> #include <console/console.h> -#if CONFIG_VGA_ROM_RUN -#include <x86emu/x86emu.h> -#endif +#include <drivers/intel/gma/int15.h> #include <pc80/mc146818rtc.h> #include <arch/acpi.h> #include <arch/io.h> @@ -46,92 +44,6 @@ void mainboard_suspend_resume(void) outb(0xcb, 0xb2); }
-#if CONFIG_VGA_ROM_RUN -static int int15_handler(void) -{ - int res = 0; - - 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 0x5f34: - /* - * Set Panel Fitting Hook: - * bit 2 = Graphics Stretching - * bit 1 = Text Stretching - * bit 0 = Centering (do not set with bit1 or bit2) - * 0 = video bios default - */ - X86_AX = 0x005f; - X86_CX = 0x0001; - res = 1; - break; - case 0x5f35: - /* - * Boot Display Device Hook: - * bit 0 = CRT - * bit 1 = TV (eDP) * - * bit 2 = EFP * - * bit 3 = LFP - * bit 4 = CRT2 - * bit 5 = TV2 (eDP) * - * bit 6 = EFP2 * - * bit 7 = LFP2 - */ - X86_AX = 0x005f; - X86_CX = 0x0000; - res = 1; - break; - case 0x5f51: - /* - * Hook to select active LFP configuration: - * 00h = No LVDS, VBIOS does not enable LVDS - * 01h = Int-LVDS, LFP driven by integrated LVDS decoder - * 02h = SVDO-LVDS, LFP driven by SVDO decoder - * 03h = eDP, LFP Driven by Int-DisplayPort encoder - */ - X86_AX = 0x005f; - X86_CX = 0x0003; - res = 1; - break; - case 0x5f70: - switch ((X86_CX >> 8) & 0xff) { - case 0: - /* Get Mux */ - X86_AX = 0x005f; - X86_CX = 0x0000; - res = 1; - break; - case 1: - /* Set Mux */ - X86_AX = 0x005f; - X86_CX = 0x0000; - res = 1; - break; - case 2: - /* Get SG/Non-SG mode */ - X86_AX = 0x005f; - X86_CX = 0x0000; - res = 1; - break; - default: - /* Interrupt was not handled */ - printk(BIOS_DEBUG, - "Unknown INT15 5f70 function: 0x%02x\n", - ((X86_CX >> 8) & 0xff)); - break; - } - break; - - default: - printk(BIOS_DEBUG, "Unknown INT15 function %04x!\n", X86_AX); - break; - } - return res; -} -#endif - /* Audio Setup */
static void verb_setup(void) @@ -190,10 +102,7 @@ static void mainboard_enable(device_t dev) { dev->ops->init = mainboard_init; dev->ops->get_smbios_data = mainboard_smbios_data; -#if CONFIG_VGA_ROM_RUN - /* Install custom int15 handler for VGA OPROM */ - mainboard_interrupt_handlers(0x15, &int15_handler); -#endif + install_intel_vga_int15_handler(GMA_INT15_ACTIVE_LFP_EDP, GMA_INT15_PANEL_FIT_CENTERING, GMA_INT15_BOOT_DISPLAY_DEFAULT, 0); verb_setup(); }
diff --git a/src/mainboard/google/panther/Kconfig b/src/mainboard/google/panther/Kconfig index db44396..e96746f 100644 --- a/src/mainboard/google/panther/Kconfig +++ b/src/mainboard/google/panther/Kconfig @@ -17,6 +17,7 @@ config BOARD_SPECIFIC_OPTIONS # dummy select MAINBOARD_HAS_CHROMEOS select EXTERNAL_MRC_BLOB select MONOTONIC_TIMER_MSR + select INTEL_INT15
config VBOOT_RAMSTAGE_INDEX hex diff --git a/src/mainboard/google/panther/mainboard.c b/src/mainboard/google/panther/mainboard.c index e4fd95b..092ede8 100644 --- a/src/mainboard/google/panther/mainboard.c +++ b/src/mainboard/google/panther/mainboard.c @@ -32,7 +32,6 @@ #include <device/pci_ops.h> #include <pc80/mc146818rtc.h> #include <southbridge/intel/lynxpoint/pch.h> -#include <x86emu/x86emu.h> #include <device/azalia_device.h> #include "hda_verb.h" #include "onboard.h" @@ -44,92 +43,6 @@ void mainboard_suspend_resume(void) outb(0xcb, 0xb2); }
-#if CONFIG_VGA_ROM_RUN -static int int15_handler(void) -{ - int res = 0; - - 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 0x5f34: - /* - * Set Panel Fitting Hook: - * bit 2 = Graphics Stretching - * bit 1 = Text Stretching - * bit 0 = Centering (do not set with bit1 or bit2) - * 0 = video bios default - */ - X86_AX = 0x005f; - X86_CX = 0x0001; - res = 1; - break; - case 0x5f35: - /* - * Boot Display Device Hook: - * bit 0 = CRT - * bit 1 = TV (eDP) * - * bit 2 = EFP * - * bit 3 = LFP - * bit 4 = CRT2 - * bit 5 = TV2 (eDP) * - * bit 6 = EFP2 * - * bit 7 = LFP2 - */ - X86_AX = 0x005f; - X86_CX = 0x0000; - res = 1; - break; - case 0x5f51: - /* - * Hook to select active LFP configuration: - * 00h = No LVDS, VBIOS does not enable LVDS - * 01h = Int-LVDS, LFP driven by integrated LVDS decoder - * 02h = SVDO-LVDS, LFP driven by SVDO decoder - * 03h = eDP, LFP Driven by Int-DisplayPort encoder - */ - X86_AX = 0x005f; - X86_CX = 0x0003; - res = 1; - break; - case 0x5f70: - switch ((X86_CX >> 8) & 0xff) { - case 0: - /* Get Mux */ - X86_AX = 0x005f; - X86_CX = 0x0000; - res = 1; - break; - case 1: - /* Set Mux */ - X86_AX = 0x005f; - X86_CX = 0x0000; - res = 1; - break; - case 2: - /* Get SG/Non-SG mode */ - X86_AX = 0x005f; - X86_CX = 0x0000; - res = 1; - break; - default: - /* Interrupt was not handled */ - printk(BIOS_DEBUG, - "Unknown INT15 5f70 function: 0x%02x\n", - ((X86_CX >> 8) & 0xff)); - break; - } - break; - - default: - printk(BIOS_DEBUG, "Unknown INT15 function %04x!\n", X86_AX); - break; - } - return res; -} -#endif /* CONFIG_VGA_ROM_RUN */ - /* Audio Setup */
static void verb_setup(void) @@ -152,10 +65,7 @@ static void mainboard_init(device_t dev) static void mainboard_enable(device_t dev) { dev->ops->init = mainboard_init; -#if CONFIG_VGA_ROM_RUN - /* Install custom int15 handler for VGA OPROM */ - mainboard_interrupt_handlers(0x15, &int15_handler); -#endif + install_intel_vga_int15_handler(GMA_INT15_ACTIVE_LFP_EDP, GMA_INT15_PANEL_FIT_CENTERING, GMA_INT15_BOOT_DISPLAY_DEFAULT, 0); verb_setup(); }
diff --git a/src/mainboard/google/parrot/Kconfig b/src/mainboard/google/parrot/Kconfig index cd7faa0..ad8c620 100644 --- a/src/mainboard/google/parrot/Kconfig +++ b/src/mainboard/google/parrot/Kconfig @@ -12,6 +12,7 @@ config BOARD_SPECIFIC_OPTIONS # dummy select HAVE_ACPI_RESUME select HAVE_SMI_HANDLER select MAINBOARD_HAS_CHROMEOS + select INTEL_INT15
# Workaround for EC/KBC IRQ1. select SERIRQ_CONTINUOUS_MODE diff --git a/src/mainboard/google/parrot/mainboard.c b/src/mainboard/google/parrot/mainboard.c index 6aa3fca..96fca43 100644 --- a/src/mainboard/google/parrot/mainboard.c +++ b/src/mainboard/google/parrot/mainboard.c @@ -24,9 +24,7 @@ #include <device/pci_def.h> #include <device/pci_ops.h> #include <console/console.h> -#if CONFIG_VGA_ROM_RUN -#include <x86emu/x86emu.h> -#endif +#include <drivers/intel/gma/int15.h> #include <pc80/mc146818rtc.h> #include <arch/acpi.h> #include <arch/io.h> @@ -50,91 +48,6 @@ void mainboard_suspend_resume(void) outb(0xe1, 0xb2); }
-#if CONFIG_VGA_ROM_RUN -static int int15_handler(void) -{ - int res = 0; - - printk(BIOS_DEBUG, "%s: INT15 function %04x!\n", - __func__, X86_AX); - - switch(X86_AX) { - case 0x5f34: - /* - * Set Panel Fitting Hook: - * bit 2 = Graphics Stretching - * bit 1 = Text Stretching - * bit 0 = Centering (do not set with bit1 or bit2) - * 0 = video bios default - */ - X86_AX = 0x005f; - X86_CL = 0x00; /* Use video bios default */ - res = 1; - break; - case 0x5f35: - /* - * Boot Display Device Hook: - * bit 0 = CRT - * bit 1 = TV (eDP) - * bit 2 = EFP - * bit 3 = LFP - * bit 4 = CRT2 - * bit 5 = TV2 (eDP) - * bit 6 = EFP2 - * bit 7 = LFP2 - */ - X86_AX = 0x005f; - X86_CX = 0x0000; /* Use video bios default */ - res = 1; - break; - case 0x5f51: - /* - * Hook to select active LFP configuration: - * 00h = No LVDS, VBIOS does not enable LVDS - * 01h = Int-LVDS, LFP driven by integrated LVDS decoder - * 02h = SVDO-LVDS, LFP driven by SVDO decoder - * 03h = eDP, LFP Driven by Int-DisplayPort encoder - */ - X86_AX = 0x005f; - X86_CX = 0x0003; /* eDP */ - res = 1; - break; - case 0x5f70: - switch (X86_CH) { - case 0: - /* Get Mux */ - X86_AX = 0x005f; - X86_CX = 0x0000; - res = 1; - break; - case 1: - /* Set Mux */ - X86_AX = 0x005f; - X86_CX = 0x0000; - res = 1; - break; - case 2: - /* Get SG/Non-SG mode */ - X86_AX = 0x005f; - X86_CX = 0x0000; - res = 1; - break; - default: - /* Interrupt was not handled */ - printk(BIOS_DEBUG, "Unknown INT15 5f70 function: 0x%02x\n", - X86_CH); - break; - } - break; - - default: - printk(BIOS_DEBUG, "Unknown INT15 function %04x!\n", X86_AX); - break; - } - return res; -} -#endif - /* Audio Setup */
static void verb_setup(void) @@ -187,10 +100,7 @@ static void mainboard_enable(device_t dev) { dev->ops->init = mainboard_init; dev->ops->get_smbios_data = parrot_onboard_smbios_data; -#if CONFIG_VGA_ROM_RUN - /* Install custom int15 handler for VGA OPROM */ - mainboard_interrupt_handlers(0x15, &int15_handler); -#endif + install_intel_vga_int15_handler(GMA_INT15_ACTIVE_LFP_EDP, GMA_INT15_PANEL_FIT_DEFAULT, GMA_INT15_BOOT_DISPLAY_DEFAULT, 0); verb_setup(); }
diff --git a/src/mainboard/google/peppy/Kconfig b/src/mainboard/google/peppy/Kconfig index 548cd17..2343b8d 100644 --- a/src/mainboard/google/peppy/Kconfig +++ b/src/mainboard/google/peppy/Kconfig @@ -21,6 +21,7 @@ config BOARD_SPECIFIC_OPTIONS # dummy select MAINBOARD_HAS_NATIVE_VGA_INIT select INTEL_DP select INTEL_DDI + select INTEL_INT15
config VBOOT_RAMSTAGE_INDEX hex diff --git a/src/mainboard/google/peppy/mainboard.c b/src/mainboard/google/peppy/mainboard.c index 38edb5c..939368b 100644 --- a/src/mainboard/google/peppy/mainboard.c +++ b/src/mainboard/google/peppy/mainboard.c @@ -26,9 +26,7 @@ #include <device/pci_def.h> #include <device/pci_ops.h> #include <console/console.h> -#if CONFIG_VGA_ROM_RUN -#include <x86emu/x86emu.h> -#endif +#include <drivers/intel/gma/int15.h> #include <pc80/mc146818rtc.h> #include <arch/acpi.h> #include <arch/io.h> @@ -46,92 +44,6 @@ void mainboard_suspend_resume(void) outb(0xcb, 0xb2); }
-#if CONFIG_VGA_ROM_RUN -static int int15_handler(void) -{ - int res = 0; - - 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 0x5f34: - /* - * Set Panel Fitting Hook: - * bit 2 = Graphics Stretching - * bit 1 = Text Stretching - * bit 0 = Centering (do not set with bit1 or bit2) - * 0 = video bios default - */ - X86_AX = 0x005f; - X86_CX = 0x0001; - res = 1; - break; - case 0x5f35: - /* - * Boot Display Device Hook: - * bit 0 = CRT - * bit 1 = TV (eDP) * - * bit 2 = EFP * - * bit 3 = LFP - * bit 4 = CRT2 - * bit 5 = TV2 (eDP) * - * bit 6 = EFP2 * - * bit 7 = LFP2 - */ - X86_AX = 0x005f; - X86_CX = 0x0000; - res = 1; - break; - case 0x5f51: - /* - * Hook to select active LFP configuration: - * 00h = No LVDS, VBIOS does not enable LVDS - * 01h = Int-LVDS, LFP driven by integrated LVDS decoder - * 02h = SVDO-LVDS, LFP driven by SVDO decoder - * 03h = eDP, LFP Driven by Int-DisplayPort encoder - */ - X86_AX = 0x005f; - X86_CX = 0x0003; - res = 1; - break; - case 0x5f70: - switch ((X86_CX >> 8) & 0xff) { - case 0: - /* Get Mux */ - X86_AX = 0x005f; - X86_CX = 0x0000; - res = 1; - break; - case 1: - /* Set Mux */ - X86_AX = 0x005f; - X86_CX = 0x0000; - res = 1; - break; - case 2: - /* Get SG/Non-SG mode */ - X86_AX = 0x005f; - X86_CX = 0x0000; - res = 1; - break; - default: - /* Interrupt was not handled */ - printk(BIOS_DEBUG, - "Unknown INT15 5f70 function: 0x%02x\n", - ((X86_CX >> 8) & 0xff)); - break; - } - break; - - default: - printk(BIOS_DEBUG, "Unknown INT15 function %04x!\n", X86_AX); - break; - } - return res; -} -#endif - /* Audio Setup */
static void verb_setup(void) @@ -190,10 +102,7 @@ static void mainboard_enable(device_t dev) { dev->ops->init = mainboard_init; dev->ops->get_smbios_data = mainboard_smbios_data; -#if CONFIG_VGA_ROM_RUN - /* Install custom int15 handler for VGA OPROM */ - mainboard_interrupt_handlers(0x15, &int15_handler); -#endif + install_intel_vga_int15_handler(GMA_INT15_ACTIVE_LFP_EDP, GMA_INT15_PANEL_FIT_CENTERING, GMA_INT15_BOOT_DISPLAY_DEFAULT, 0); verb_setup(); }
diff --git a/src/mainboard/google/samus/Kconfig b/src/mainboard/google/samus/Kconfig index 2483a56..c6cbd18 100644 --- a/src/mainboard/google/samus/Kconfig +++ b/src/mainboard/google/samus/Kconfig @@ -19,6 +19,7 @@ config BOARD_SPECIFIC_OPTIONS # dummy select EXTERNAL_MRC_BLOB select MONOTONIC_TIMER_MSR select MAINBOARD_HAS_NATIVE_VGA_INIT + select INTEL_INT15
config VBOOT_RAMSTAGE_INDEX hex diff --git a/src/mainboard/google/samus/mainboard.c b/src/mainboard/google/samus/mainboard.c index 641d331..e595632 100644 --- a/src/mainboard/google/samus/mainboard.c +++ b/src/mainboard/google/samus/mainboard.c @@ -26,9 +26,7 @@ #include <device/pci_def.h> #include <device/pci_ops.h> #include <console/console.h> -#if CONFIG_VGA_ROM_RUN -#include <x86emu/x86emu.h> -#endif +#include <drivers/intel/gma/int15.h> #include <pc80/mc146818rtc.h> #include <arch/acpi.h> #include <arch/io.h> @@ -44,92 +42,6 @@ void mainboard_suspend_resume(void) outb(0xcb, 0xb2); }
-#if CONFIG_VGA_ROM_RUN -static int int15_handler(void) -{ - int res = 0; - - 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 0x5f34: - /* - * Set Panel Fitting Hook: - * bit 2 = Graphics Stretching - * bit 1 = Text Stretching - * bit 0 = Centering (do not set with bit1 or bit2) - * 0 = video bios default - */ - X86_AX = 0x005f; - X86_CX = 0x0001; - res = 1; - break; - case 0x5f35: - /* - * Boot Display Device Hook: - * bit 0 = CRT - * bit 1 = TV (eDP) * - * bit 2 = EFP * - * bit 3 = LFP - * bit 4 = CRT2 - * bit 5 = TV2 (eDP) * - * bit 6 = EFP2 * - * bit 7 = LFP2 - */ - X86_AX = 0x005f; - X86_CX = 0x0000; - res = 1; - break; - case 0x5f51: - /* - * Hook to select active LFP configuration: - * 00h = No LVDS, VBIOS does not enable LVDS - * 01h = Int-LVDS, LFP driven by integrated LVDS decoder - * 02h = SVDO-LVDS, LFP driven by SVDO decoder - * 03h = eDP, LFP Driven by Int-DisplayPort encoder - */ - X86_AX = 0x005f; - X86_CX = 0x0003; - res = 1; - break; - case 0x5f70: - switch ((X86_CX >> 8) & 0xff) { - case 0: - /* Get Mux */ - X86_AX = 0x005f; - X86_CX = 0x0000; - res = 1; - break; - case 1: - /* Set Mux */ - X86_AX = 0x005f; - X86_CX = 0x0000; - res = 1; - break; - case 2: - /* Get SG/Non-SG mode */ - X86_AX = 0x005f; - X86_CX = 0x0000; - res = 1; - break; - default: - /* Interrupt was not handled */ - printk(BIOS_DEBUG, - "Unknown INT15 5f70 function: 0x%02x\n", - ((X86_CX >> 8) & 0xff)); - break; - } - break; - - default: - printk(BIOS_DEBUG, "Unknown INT15 function %04x!\n", X86_AX); - break; - } - return res; -} -#endif - static void mainboard_init(device_t dev) { mainboard_ec_init(); @@ -168,10 +80,7 @@ static void mainboard_enable(device_t dev) { dev->ops->init = mainboard_init; dev->ops->get_smbios_data = mainboard_smbios_data; -#if CONFIG_VGA_ROM_RUN - /* Install custom int15 handler for VGA OPROM */ - mainboard_interrupt_handlers(0x15, &int15_handler); -#endif + install_intel_vga_int15_handler(GMA_INT15_ACTIVE_LFP_EDP, GMA_INT15_PANEL_FIT_CENTERING, GMA_INT15_BOOT_DISPLAY_DEFAULT, 0); }
struct chip_operations mainboard_ops = { diff --git a/src/mainboard/google/slippy/Kconfig b/src/mainboard/google/slippy/Kconfig index 2536eaf..341e5bf 100644 --- a/src/mainboard/google/slippy/Kconfig +++ b/src/mainboard/google/slippy/Kconfig @@ -22,6 +22,7 @@ config BOARD_SPECIFIC_OPTIONS # dummy select MAINBOARD_DO_NATIVE_VGA_INIT select INTEL_DP select INTEL_DDI + select INTEL_INT15
config VBOOT_RAMSTAGE_INDEX hex diff --git a/src/mainboard/google/slippy/mainboard.c b/src/mainboard/google/slippy/mainboard.c index 022c1e8..9760035 100644 --- a/src/mainboard/google/slippy/mainboard.c +++ b/src/mainboard/google/slippy/mainboard.c @@ -26,9 +26,7 @@ #include <device/pci_def.h> #include <device/pci_ops.h> #include <console/console.h> -#if CONFIG_VGA_ROM_RUN -#include <x86emu/x86emu.h> -#endif +#include <drivers/intel/gma/int15.h> #include <pc80/mc146818rtc.h> #include <arch/acpi.h> #include <arch/io.h> @@ -46,92 +44,6 @@ void mainboard_suspend_resume(void) outb(0xcb, 0xb2); }
-#if CONFIG_VGA_ROM_RUN -static int int15_handler(void) -{ - int res = 0; - - 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 0x5f34: - /* - * Set Panel Fitting Hook: - * bit 2 = Graphics Stretching - * bit 1 = Text Stretching - * bit 0 = Centering (do not set with bit1 or bit2) - * 0 = video bios default - */ - X86_AX = 0x005f; - X86_CX = 0x0001; - res = 1; - break; - case 0x5f35: - /* - * Boot Display Device Hook: - * bit 0 = CRT - * bit 1 = TV (eDP) * - * bit 2 = EFP * - * bit 3 = LFP - * bit 4 = CRT2 - * bit 5 = TV2 (eDP) * - * bit 6 = EFP2 * - * bit 7 = LFP2 - */ - X86_AX = 0x005f; - X86_CX = 0x0000; - res = 1; - break; - case 0x5f51: - /* - * Hook to select active LFP configuration: - * 00h = No LVDS, VBIOS does not enable LVDS - * 01h = Int-LVDS, LFP driven by integrated LVDS decoder - * 02h = SVDO-LVDS, LFP driven by SVDO decoder - * 03h = eDP, LFP Driven by Int-DisplayPort encoder - */ - X86_AX = 0x005f; - X86_CX = 0x0003; - res = 1; - break; - case 0x5f70: - switch ((X86_CX >> 8) & 0xff) { - case 0: - /* Get Mux */ - X86_AX = 0x005f; - X86_CX = 0x0000; - res = 1; - break; - case 1: - /* Set Mux */ - X86_AX = 0x005f; - X86_CX = 0x0000; - res = 1; - break; - case 2: - /* Get SG/Non-SG mode */ - X86_AX = 0x005f; - X86_CX = 0x0000; - res = 1; - break; - default: - /* Interrupt was not handled */ - printk(BIOS_DEBUG, - "Unknown INT15 5f70 function: 0x%02x\n", - ((X86_CX >> 8) & 0xff)); - break; - } - break; - - default: - printk(BIOS_DEBUG, "Unknown INT15 function %04x!\n", X86_AX); - break; - } - return res; -} -#endif - /* Audio Setup */
static void verb_setup(void) @@ -190,10 +102,7 @@ static void mainboard_enable(device_t dev) { dev->ops->init = mainboard_init; dev->ops->get_smbios_data = mainboard_smbios_data; -#if CONFIG_VGA_ROM_RUN - /* Install custom int15 handler for VGA OPROM */ - mainboard_interrupt_handlers(0x15, &int15_handler); -#endif + install_intel_vga_int15_handler(GMA_INT15_ACTIVE_LFP_EDP, GMA_INT15_PANEL_FIT_CENTERING, GMA_INT15_BOOT_DISPLAY_DEFAULT, 0); verb_setup(); }
diff --git a/src/mainboard/google/stout/Kconfig b/src/mainboard/google/stout/Kconfig index cd12b85..863a632 100644 --- a/src/mainboard/google/stout/Kconfig +++ b/src/mainboard/google/stout/Kconfig @@ -13,6 +13,7 @@ config BOARD_SPECIFIC_OPTIONS # dummy select HAVE_ACPI_RESUME select HAVE_SMI_HANDLER select MAINBOARD_HAS_CHROMEOS + select INTEL_INT15 select VGA select INTEL_EDID select MAINBOARD_HAS_NATIVE_VGA_INIT diff --git a/src/mainboard/google/stout/mainboard.c b/src/mainboard/google/stout/mainboard.c index b0ed3c1..1e6210b 100644 --- a/src/mainboard/google/stout/mainboard.c +++ b/src/mainboard/google/stout/mainboard.c @@ -24,9 +24,7 @@ #include <device/pci_def.h> #include <device/pci_ops.h> #include <console/console.h> -#if CONFIG_VGA_ROM_RUN -#include <x86emu/x86emu.h> -#endif +#include <drivers/intel/gma/int15.h> #include <pc80/mc146818rtc.h> #include <arch/acpi.h> #include <arch/io.h> @@ -50,91 +48,6 @@ void mainboard_suspend_resume(void) ec_write_cmd(EC_CMD_NOTIFY_ACPI_ENTER); }
-#if CONFIG_VGA_ROM_RUN -static int int15_handler(void) -{ - int res = 0; - - printk(BIOS_DEBUG, "%s: INT15 function %04x!\n", - __func__, X86_AX); - - switch(X86_AX) { - case 0x5f34: - /* - * Set Panel Fitting Hook: - * bit 2 = Graphics Stretching - * bit 1 = Text Stretching - * bit 0 = Centering (do not set with bit1 or bit2) - * 0 = video bios default - */ - X86_AX = 0x005f; - X86_CL = 0x00; /* Use video bios default */ - res = 1; - break; - case 0x5f35: - /* - * Boot Display Device Hook: - * bit 0 = CRT - * bit 1 = TV (eDP) - * bit 2 = EFP - * bit 3 = LFP - * bit 4 = CRT2 - * bit 5 = TV2 (eDP) - * bit 6 = EFP2 - * bit 7 = LFP2 - */ - X86_AX = 0x005f; - X86_CX = 0x0000; /* Use video bios default */ - res = 1; - break; - case 0x5f51: - /* - * Hook to select active LFP configuration: - * 00h = No LVDS, VBIOS does not enable LVDS - * 01h = Int-LVDS, LFP driven by integrated LVDS decoder - * 02h = SVDO-LVDS, LFP driven by SVDO decoder - * 03h = eDP, LFP Driven by Int-DisplayPort encoder - */ - X86_AX = 0x005f; - X86_CX = 0x0001; - res = 1; - break; - case 0x5f70: - switch (X86_CH) { - case 0: - /* Get Mux */ - X86_AX = 0x005f; - X86_CX = 0x0000; - res = 1; - break; - case 1: - /* Set Mux */ - X86_AX = 0x005f; - X86_CX = 0x0000; - res = 1; - break; - case 2: - /* Get SG/Non-SG mode */ - X86_AX = 0x005f; - X86_CX = 0x0000; - res = 1; - break; - default: - /* Interrupt was not handled */ - printk(BIOS_DEBUG, "Unknown INT15 5f70 function: 0x%02x\n", - X86_CH); - break; - } - break; - - default: - printk(BIOS_DEBUG, "Unknown INT15 function %04x!\n", X86_AX); - break; - } - return res; -} -#endif - /* Audio Setup */
static void verb_setup(void) @@ -170,10 +83,7 @@ static void mainboard_init(device_t dev) static void mainboard_enable(device_t dev) { dev->ops->init = mainboard_init; -#if CONFIG_VGA_ROM_RUN - /* Install custom int15 handler for VGA OPROM */ - mainboard_interrupt_handlers(0x15, &int15_handler); -#endif + install_intel_vga_int15_handler(GMA_INT15_ACTIVE_LFP_INT_LVDS, GMA_INT15_PANEL_FIT_DEFAULT, GMA_INT15_BOOT_DISPLAY_DEFAULT, 0); verb_setup(); }
diff --git a/src/mainboard/ibase/mb899/Kconfig b/src/mainboard/ibase/mb899/Kconfig index 0c939ef..4f646ac 100644 --- a/src/mainboard/ibase/mb899/Kconfig +++ b/src/mainboard/ibase/mb899/Kconfig @@ -15,6 +15,7 @@ config BOARD_SPECIFIC_OPTIONS # dummy select HAVE_ACPI_RESUME select BOARD_ROMSIZE_KB_512 select CHANNEL_XOR_RANDOMIZATION + select INTEL_INT15
config MAINBOARD_DIR string diff --git a/src/mainboard/ibase/mb899/mainboard.c b/src/mainboard/ibase/mb899/mainboard.c index f78a118..6c80b42 100644 --- a/src/mainboard/ibase/mb899/mainboard.c +++ b/src/mainboard/ibase/mb899/mainboard.c @@ -20,51 +20,13 @@ #include <types.h> #include <device/device.h> #include <console/console.h> -#if CONFIG_VGA_ROM_RUN -#include <x86emu/x86emu.h> -#endif +#include <drivers/intel/gma/int15.h> #include <pc80/mc146818rtc.h> #include <arch/io.h> #include <arch/interrupt.h> #include <device/azalia_device.h> #include "superio_hwm.h"
-#if CONFIG_VGA_ROM_RUN -static int int15_handler(void) -{ -#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) - - 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 */ - // M.x86.R_AX = 0x015f; // Supported but failed - X86_AX = 0x005f; // Success - X86_CL = 3; // Display ID - break; - default: - /* Interrupt was not handled */ - return 0; - } - - /* Interrupt handled */ - return 1; -} -#endif - /* Audio Setup */
static void verb_setup(void) @@ -79,10 +41,7 @@ static void verb_setup(void)
static void mainboard_enable(device_t dev) { -#if CONFIG_VGA_ROM_RUN - /* Install custom int15 handler for VGA OPROM */ - mainboard_interrupt_handlers(0x15, &int15_handler); -#endif + install_intel_vga_int15_handler(GMA_INT15_ACTIVE_LFP_INT_LVDS, GMA_INT15_PANEL_FIT_DEFAULT, GMA_INT15_BOOT_DISPLAY_DEFAULT, 3); verb_setup(); hwm_setup(); } diff --git a/src/mainboard/intel/baskingridge/Kconfig b/src/mainboard/intel/baskingridge/Kconfig index 8d32c5a..512591e 100644 --- a/src/mainboard/intel/baskingridge/Kconfig +++ b/src/mainboard/intel/baskingridge/Kconfig @@ -12,6 +12,7 @@ config BOARD_SPECIFIC_OPTIONS # dummy select HAVE_SMI_HANDLER select MAINBOARD_HAS_CHROMEOS select MONOTONIC_TIMER_MSR + select INTEL_INT15
config MAINBOARD_DIR string diff --git a/src/mainboard/intel/baskingridge/mainboard.c b/src/mainboard/intel/baskingridge/mainboard.c index 61ba4af..ab75323 100644 --- a/src/mainboard/intel/baskingridge/mainboard.c +++ b/src/mainboard/intel/baskingridge/mainboard.c @@ -25,9 +25,7 @@ #include <device/pci_def.h> #include <device/pci_ops.h> #include <console/console.h> -#if CONFIG_VGA_ROM_RUN -#include <x86emu/x86emu.h> -#endif +#include <drivers/intel/gma/int15.h> #include <pc80/mc146818rtc.h> #include <arch/acpi.h> #include <arch/io.h> @@ -43,92 +41,6 @@ void mainboard_suspend_resume(void) outb(0xcb, 0xb2); }
-#if CONFIG_VGA_ROM_RUN -static int int15_handler(void) -{ - int res = 0; - - 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 0x5f34: - /* - * Set Panel Fitting Hook: - * bit 2 = Graphics Stretching - * bit 1 = Text Stretching - * bit 0 = Centering (do not set with bit1 or bit2) - * 0 = video bios default - */ - X86_AX = 0x005f; - X86_CX = 0x0001; - res = 1; - break; - case 0x5f35: - /* - * Boot Display Device Hook: - * bit 0 = CRT - * bit 1 = TV (eDP) * - * bit 2 = EFP * - * bit 3 = LFP - * bit 4 = CRT2 - * bit 5 = TV2 (eDP) * - * bit 6 = EFP2 * - * bit 7 = LFP2 - */ - X86_AX = 0x005f; - X86_CX = 0x0000; - res = 1; - break; - case 0x5f51: - /* - * Hook to select active LFP configuration: - * 00h = No LVDS, VBIOS does not enable LVDS - * 01h = Int-LVDS, LFP driven by integrated LVDS decoder - * 02h = SVDO-LVDS, LFP driven by SVDO decoder - * 03h = eDP, LFP Driven by Int-DisplayPort encoder - */ - X86_AX = 0x005f; - X86_CX = 0x0003; - res = 1; - break; - case 0x5f70: - switch ((X86_CX >> 8) & 0xff) { - case 0: - /* Get Mux */ - X86_AX = 0x005f; - X86_CX = 0x0000; - res = 1; - break; - case 1: - /* Set Mux */ - X86_AX = 0x005f; - X86_CX = 0x0000; - res = 1; - break; - case 2: - /* Get SG/Non-SG mode */ - X86_AX = 0x005f; - X86_CX = 0x0000; - res = 1; - break; - default: - /* Interrupt was not handled */ - printk(BIOS_DEBUG, - "Unknown INT15 5f70 function: 0x%02x\n", - ((X86_CX >> 8) & 0xff)); - break; - } - break; - - default: - printk(BIOS_DEBUG, "Unknown INT15 function %04x!\n", X86_AX); - break; - } - return res; -} -#endif - /* Audio Setup */
static void verb_setup(void) @@ -142,10 +54,7 @@ static void verb_setup(void)
static void mainboard_enable(device_t dev) { -#if CONFIG_VGA_ROM_RUN - /* Install custom int15 handler for VGA OPROM */ - mainboard_interrupt_handlers(0x15, &int15_handler); -#endif + install_intel_vga_int15_handler(GMA_INT15_ACTIVE_LFP_EDP, GMA_INT15_PANEL_FIT_CENTERING, GMA_INT15_BOOT_DISPLAY_DEFAULT, 0); verb_setup(); }
diff --git a/src/mainboard/intel/cougar_canyon2/Kconfig b/src/mainboard/intel/cougar_canyon2/Kconfig index 389a13c..3b25161 100644 --- a/src/mainboard/intel/cougar_canyon2/Kconfig +++ b/src/mainboard/intel/cougar_canyon2/Kconfig @@ -13,6 +13,7 @@ config BOARD_SPECIFIC_OPTIONS # dummy select ENABLE_VMX select EARLY_CBMEM_INIT select BROKEN_CAR_MIGRATE + select INTEL_INT15 select VGA
config MAINBOARD_DIR diff --git a/src/mainboard/intel/cougar_canyon2/mainboard.c b/src/mainboard/intel/cougar_canyon2/mainboard.c index 1a29992..d875fe7 100644 --- a/src/mainboard/intel/cougar_canyon2/mainboard.c +++ b/src/mainboard/intel/cougar_canyon2/mainboard.c @@ -25,7 +25,7 @@ #include <device/pci_def.h> #include <device/pci_ops.h> #include <console/console.h> -#include <x86emu/x86emu.h> +#include <drivers/intel/gma/int15.h> #include <pc80/mc146818rtc.h> #include <arch/acpi.h> #include <arch/io.h> @@ -43,104 +43,6 @@ void mainboard_suspend_resume(void) } #endif
-#if CONFIG_VGA_ROM_RUN -static int int15_handler(void) -{ - int res=0; - - printk(BIOS_DEBUG, "%s: AX=%04x BX=%04x CX=%04x DX=%04x\n", - __func__, X86_AX, X86_BX, X86_CX, X86_DX); - - switch(X86_EAX & 0xffff) { - case 0x5f34: - /* - * Set Panel Fitting Hook: - * bit 2 = Graphics Stretching - * bit 1 = Text Stretching - * bit 0 = Centering (do not set with bit1 or bit2) - * 0 = video bios default - */ - X86_EAX &= 0xffff0000; - X86_EAX |= 0x005f; - X86_ECX &= 0xffffff00; - X86_ECX |= 0x01; - res = 1; - break; - case 0x5f35: - /* - * Boot Display Device Hook: - * bit 0 = CRT - * bit 1 = TV (eDP) * - * bit 2 = EFP * - * bit 3 = LFP - * bit 4 = CRT2 - * bit 5 = TV2 (eDP) * - * bit 6 = EFP2 * - * bit 7 = LFP2 - */ - X86_EAX &= 0xffff0000; - X86_EAX |= 0x005f; - X86_ECX &= 0xffff0000; - X86_ECX |= 0x0000; - res = 1; - break; - case 0x5f51: - /* - * Hook to select active LFP configuration: - * 00h = No LVDS, VBIOS does not enable LVDS - * 01h = Int-LVDS, LFP driven by integrated LVDS decoder - * 02h = SVDO-LVDS, LFP driven by SVDO decoder - * 03h = eDP, LFP Driven by Int-DisplayPort encoder - */ - X86_EAX &= 0xffff0000; - X86_EAX |= 0x005f; - X86_ECX &= 0xffff0000; - X86_ECX |= 0x0003; - res = 1; - break; - case 0x5f70: - switch ((X86_ECX >> 8) & 0xff) { - case 0: - /* Get Mux */ - X86_EAX &= 0xffff0000; - X86_EAX |= 0x005f; - X86_ECX &= 0xffff0000; - X86_ECX |= 0x0000; - res = 1; - break; - case 1: - /* Set Mux */ - X86_EAX &= 0xffff0000; - X86_EAX |= 0x005f; - X86_ECX &= 0xffff0000; - X86_ECX |= 0x0000; - res = 1; - break; - case 2: - /* Get SG/Non-SG mode */ - X86_EAX &= 0xffff0000; - X86_EAX |= 0x005f; - X86_ECX &= 0xffff0000; - X86_ECX |= 0x0000; - res = 1; - break; - default: - /* FIXME: Interrupt was not handled, but return success? */ - printk(BIOS_DEBUG, "Unknown INT15 5f70 function: 0x%02x\n", - ((X86_ECX >> 8) & 0xff)); - return 1; - } - break; - - default: - printk(BIOS_DEBUG, "Unknown INT15 function %04x!\n", - X86_EAX & 0xffff); - break; - } - return res; -} -#endif - /* Audio Setup */
static void verb_setup(void) @@ -154,10 +56,7 @@ static void verb_setup(void)
static void mainboard_enable(device_t dev) { -#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 + install_intel_vga_int15_handler(GMA_INT15_ACTIVE_LFP_EDP, GMA_INT15_PANEL_FIT_CENTERING, GMA_INT15_BOOT_DISPLAY_DEFAULT, 0); verb_setup(); }
diff --git a/src/mainboard/intel/emeraldlake2/Kconfig b/src/mainboard/intel/emeraldlake2/Kconfig index d6928f4..dc04631 100644 --- a/src/mainboard/intel/emeraldlake2/Kconfig +++ b/src/mainboard/intel/emeraldlake2/Kconfig @@ -10,6 +10,7 @@ config BOARD_SPECIFIC_OPTIONS # dummy select HAVE_ACPI_TABLES select HAVE_OPTION_TABLE select HAVE_ACPI_RESUME + select INTEL_INT15 #select MAINBOARD_HAS_CHROMEOS
config MAINBOARD_DIR diff --git a/src/mainboard/intel/emeraldlake2/mainboard.c b/src/mainboard/intel/emeraldlake2/mainboard.c index 3c93e05..2dfe289 100644 --- a/src/mainboard/intel/emeraldlake2/mainboard.c +++ b/src/mainboard/intel/emeraldlake2/mainboard.c @@ -25,9 +25,7 @@ #include <device/pci_def.h> #include <device/pci_ops.h> #include <console/console.h> -#if CONFIG_VGA_ROM_RUN -#include <x86emu/x86emu.h> -#endif +#include <drivers/intel/gma/int15.h> #include <pc80/mc146818rtc.h> #include <arch/acpi.h> #include <arch/io.h> @@ -43,104 +41,6 @@ void mainboard_suspend_resume(void) outb(0xcb, 0xb2); }
-#if CONFIG_VGA_ROM_RUN -static int int15_handler(void) -{ - int res=0; - - printk(BIOS_DEBUG, "%s: AX=%04x BX=%04x CX=%04x DX=%04x\n", - __func__, X86_AX, X86_BX, X86_CX, X86_DX); - - switch(X86_EAX & 0xffff) { - case 0x5f34: - /* - * Set Panel Fitting Hook: - * bit 2 = Graphics Stretching - * bit 1 = Text Stretching - * bit 0 = Centering (do not set with bit1 or bit2) - * 0 = video bios default - */ - X86_EAX &= 0xffff0000; - X86_EAX |= 0x005f; - X86_ECX &= 0xffffff00; - X86_ECX |= 0x01; - res = 1; - break; - case 0x5f35: - /* - * Boot Display Device Hook: - * bit 0 = CRT - * bit 1 = TV (eDP) * - * bit 2 = EFP * - * bit 3 = LFP - * bit 4 = CRT2 - * bit 5 = TV2 (eDP) * - * bit 6 = EFP2 * - * bit 7 = LFP2 - */ - X86_EAX &= 0xffff0000; - X86_EAX |= 0x005f; - X86_ECX &= 0xffff0000; - X86_ECX |= 0x0000; - res = 1; - break; - case 0x5f51: - /* - * Hook to select active LFP configuration: - * 00h = No LVDS, VBIOS does not enable LVDS - * 01h = Int-LVDS, LFP driven by integrated LVDS decoder - * 02h = SVDO-LVDS, LFP driven by SVDO decoder - * 03h = eDP, LFP Driven by Int-DisplayPort encoder - */ - X86_EAX &= 0xffff0000; - X86_EAX |= 0x005f; - X86_ECX &= 0xffff0000; - X86_ECX |= 0x0003; - res = 1; - break; - case 0x5f70: - switch ((X86_ECX >> 8) & 0xff) { - case 0: - /* Get Mux */ - X86_EAX &= 0xffff0000; - X86_EAX |= 0x005f; - X86_ECX &= 0xffff0000; - X86_ECX |= 0x0000; - res = 1; - break; - case 1: - /* Set Mux */ - X86_EAX &= 0xffff0000; - X86_EAX |= 0x005f; - X86_ECX &= 0xffff0000; - X86_ECX |= 0x0000; - res = 1; - break; - case 2: - /* Get SG/Non-SG mode */ - X86_EAX &= 0xffff0000; - X86_EAX |= 0x005f; - X86_ECX &= 0xffff0000; - X86_ECX |= 0x0000; - res = 1; - break; - default: - /* FIXME: Interrupt was not handled, but return success? */ - printk(BIOS_DEBUG, "Unknown INT15 5f70 function: 0x%02x\n", - ((X86_ECX >> 8) & 0xff)); - return 1; - } - break; - - default: - printk(BIOS_DEBUG, "Unknown INT15 function %04x!\n", - X86_EAX & 0xffff); - break; - } - return res; -} -#endif - /* Audio Setup */
static void verb_setup(void) @@ -154,10 +54,7 @@ static void verb_setup(void)
static void mainboard_enable(device_t dev) { -#if CONFIG_VGA_ROM_RUN - /* Install custom int15 handler for VGA OPROM */ - mainboard_interrupt_handlers(0x15, &int15_handler); -#endif + install_intel_vga_int15_handler(GMA_INT15_ACTIVE_LFP_EDP, GMA_INT15_PANEL_FIT_CENTERING, GMA_INT15_BOOT_DISPLAY_DEFAULT, 0); verb_setup(); }
diff --git a/src/mainboard/intel/wtm2/mainboard.c b/src/mainboard/intel/wtm2/mainboard.c index 6f6e464..ab75323 100644 --- a/src/mainboard/intel/wtm2/mainboard.c +++ b/src/mainboard/intel/wtm2/mainboard.c @@ -25,9 +25,7 @@ #include <device/pci_def.h> #include <device/pci_ops.h> #include <console/console.h> -#if CONFIG_VGA_ROM_RUN -#include <x86emu/x86emu.h> -#endif +#include <drivers/intel/gma/int15.h> #include <pc80/mc146818rtc.h> #include <arch/acpi.h> #include <arch/io.h> @@ -43,92 +41,6 @@ void mainboard_suspend_resume(void) outb(0xcb, 0xb2); }
-#if CONFIG_VGA_ROM_RUN -static int int15_handler(void) -{ - int res = 1; - - 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 0x5f34: - /* - * Set Panel Fitting Hook: - * bit 2 = Graphics Stretching - * bit 1 = Text Stretching - * bit 0 = Centering (do not set with bit1 or bit2) - * 0 = video bios default - */ - X86_AX = 0x005f; - X86_CX = 0x0001; - res = 1; - break; - case 0x5f35: - /* - * Boot Display Device Hook: - * bit 0 = CRT - * bit 1 = TV (eDP) * - * bit 2 = EFP * - * bit 3 = LFP - * bit 4 = CRT2 - * bit 5 = TV2 (eDP) * - * bit 6 = EFP2 * - * bit 7 = LFP2 - */ - X86_AX = 0x005f; - X86_CX = 0x0000; - res = 1; - break; - case 0x5f51: - /* - * Hook to select active LFP configuration: - * 00h = No LVDS, VBIOS does not enable LVDS - * 01h = Int-LVDS, LFP driven by integrated LVDS decoder - * 02h = SVDO-LVDS, LFP driven by SVDO decoder - * 03h = eDP, LFP Driven by Int-DisplayPort encoder - */ - X86_AX = 0x005f; - X86_CX = 0x0003; - res = 1; - break; - case 0x5f70: - switch ((X86_CX >> 8) & 0xff) { - case 0: - /* Get Mux */ - X86_AX = 0x005f; - X86_CX = 0x0000; - res = 1; - break; - case 1: - /* Set Mux */ - X86_AX = 0x005f; - X86_CX = 0x0000; - res = 1; - break; - case 2: - /* Get SG/Non-SG mode */ - X86_AX = 0x005f; - X86_CX = 0x0000; - res = 1; - break; - default: - /* Interrupt was not handled */ - printk(BIOS_DEBUG, - "Unknown INT15 5f70 function: 0x%02x\n", - ((X86_CX >> 8) & 0xff)); - break; - } - break; - - default: - printk(BIOS_DEBUG, "Unknown INT15 function %04x!\n", X86_AX); - break; - } - return res; -} -#endif - /* Audio Setup */
static void verb_setup(void) @@ -142,10 +54,7 @@ static void verb_setup(void)
static void mainboard_enable(device_t dev) { -#if CONFIG_VGA_ROM_RUN - /* Install custom int15 handler for VGA OPROM */ - mainboard_interrupt_handlers(0x15, &int15_handler); -#endif + install_intel_vga_int15_handler(GMA_INT15_ACTIVE_LFP_EDP, GMA_INT15_PANEL_FIT_CENTERING, GMA_INT15_BOOT_DISPLAY_DEFAULT, 0); verb_setup(); }
diff --git a/src/mainboard/kontron/986lcd-m/Kconfig b/src/mainboard/kontron/986lcd-m/Kconfig index 6d880e5..2a3cfe2 100644 --- a/src/mainboard/kontron/986lcd-m/Kconfig +++ b/src/mainboard/kontron/986lcd-m/Kconfig @@ -15,6 +15,7 @@ config BOARD_SPECIFIC_OPTIONS # dummy select HAVE_ACPI_RESUME select BOARD_ROMSIZE_KB_1024 select CHANNEL_XOR_RANDOMIZATION + select INTEL_INT15 select OVERRIDE_CLOCK_DISABLE
config MAINBOARD_DIR diff --git a/src/mainboard/kontron/986lcd-m/mainboard.c b/src/mainboard/kontron/986lcd-m/mainboard.c index 346546a..10bba69 100644 --- a/src/mainboard/kontron/986lcd-m/mainboard.c +++ b/src/mainboard/kontron/986lcd-m/mainboard.c @@ -20,57 +20,12 @@ #include <types.h> #include <device/device.h> #include <console/console.h> -#if CONFIG_VGA_ROM_RUN -#include <x86emu/x86emu.h> -#endif +#include <drivers/intel/gma/int15.h> #include <pc80/mc146818rtc.h> #include <arch/io.h> #include <arch/interrupt.h> #include <device/azalia_device.h>
-#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. - */ - 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_CRT; - break; - case 0x5f40: /* Boot Panel Type */ - // X86_AX = 0x015f; // Supported but failed - X86_AX = 0x005f; // Success - X86_CL = 3; // 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 - /* Hardware Monitor */
static u16 hwm_base = 0xa00; @@ -219,10 +174,7 @@ static void verb_setup(void)
static void mainboard_enable(device_t dev) { -#if CONFIG_VGA_ROM_RUN - /* Install custom int15 handler for VGA OPROM */ - mainboard_interrupt_handlers(0x15, &int15_handler); -#endif + install_intel_vga_int15_handler(GMA_INT15_ACTIVE_LFP_INT_LVDS, GMA_INT15_PANEL_FIT_DEFAULT, GMA_INT15_BOOT_DISPLAY_DEFAULT, 3); verb_setup(); hwm_setup(); } diff --git a/src/mainboard/lenovo/t520/Kconfig b/src/mainboard/lenovo/t520/Kconfig index b6c9e05..aa4f0a4 100644 --- a/src/mainboard/lenovo/t520/Kconfig +++ b/src/mainboard/lenovo/t520/Kconfig @@ -13,6 +13,7 @@ config BOARD_SPECIFIC_OPTIONS # dummy select HAVE_CMOS_DEFAULT select HAVE_ACPI_RESUME select HAVE_SMI_HANDLER + select INTEL_INT15
# Workaround for EC/KBC IRQ1. select SERIRQ_CONTINUOUS_MODE diff --git a/src/mainboard/lenovo/t520/mainboard.c b/src/mainboard/lenovo/t520/mainboard.c index f89001a..231f4ca 100644 --- a/src/mainboard/lenovo/t520/mainboard.c +++ b/src/mainboard/lenovo/t520/mainboard.c @@ -25,9 +25,7 @@ #include <device/pci_def.h> #include <device/pci_ops.h> #include <console/console.h> -#if CONFIG_VGA_ROM_RUN -#include <x86emu/x86emu.h> -#endif +#include <drivers/intel/gma/int15.h> #include <pc80/mc146818rtc.h> #include <arch/acpi.h> #include <arch/io.h> @@ -48,91 +46,6 @@ void mainboard_suspend_resume(void) outb(0xcb, 0xb2); }
-#if CONFIG_VGA_ROM_RUN -static int int15_handler(void) -{ - int res = 0; - - printk(BIOS_DEBUG, "%s: INT15 function %04x!\n", - __func__, X86_AX); - - switch (X86_AX) { - case 0x5f34: - /* - * Set Panel Fitting Hook: - * bit 2 = Graphics Stretching - * bit 1 = Text Stretching - * bit 0 = Centering (do not set with bit1 or bit2) - * 0 = video bios default - */ - X86_AX = 0x005f; - X86_CL = 0x00; /* Use video bios default */ - res = 1; - break; - case 0x5f35: - /* - * Boot Display Device Hook: - * bit 0 = CRT - * bit 1 = TV (eDP) - * bit 2 = EFP - * bit 3 = LFP - * bit 4 = CRT2 - * bit 5 = TV2 (eDP) - * bit 6 = EFP2 - * bit 7 = LFP2 - */ - X86_AX = 0x005f; - X86_CX = 0x0000; /* Use video bios default */ - res = 1; - break; - case 0x5f51: - /* - * Hook to select active LFP configuration: - * 00h = No LVDS, VBIOS does not enable LVDS - * 01h = Int-LVDS, LFP driven by integrated LVDS decoder - * 02h = SVDO-LVDS, LFP driven by SVDO decoder - * 03h = eDP, LFP Driven by Int-DisplayPort encoder - */ - X86_AX = 0x005f; - X86_CX = 0x0001; /* Int-LVDS */ - res = 1; - break; - case 0x5f70: - switch (X86_CH) { - case 0: - /* Get Mux */ - X86_AX = 0x005f; - X86_CX = 0x0000; - res = 1; - break; - case 1: - /* Set Mux */ - X86_AX = 0x005f; - X86_CX = 0x0000; - res = 1; - break; - case 2: - /* Get SG/Non-SG mode */ - X86_AX = 0x005f; - X86_CX = 0x0000; - res = 1; - break; - default: - /* Interrupt was not handled */ - printk(BIOS_DEBUG, "Unknown INT15 5f70 function: 0x%02x\n", - X86_CH); - break; - } - break; - - default: - printk(BIOS_DEBUG, "Unknown INT15 function %04x!\n", X86_AX); - break; - } - return res; -} -#endif - /* Audio Setup */
static void verb_setup(void) @@ -166,10 +79,7 @@ enumerate_buses(). */ static void mainboard_enable(device_t dev) { dev->ops->init = mainboard_init; -#if CONFIG_VGA_ROM_RUN - /* Install custom int15 handler for VGA OPROM */ - mainboard_interrupt_handlers(0x15, &int15_handler); -#endif + install_intel_vga_int15_handler(GMA_INT15_ACTIVE_LFP_INT_LVDS, GMA_INT15_PANEL_FIT_DEFAULT, GMA_INT15_BOOT_DISPLAY_DEFAULT, 0); verb_setup(); }
diff --git a/src/mainboard/lenovo/t530/Kconfig b/src/mainboard/lenovo/t530/Kconfig index a850e11..1a68a6f 100644 --- a/src/mainboard/lenovo/t530/Kconfig +++ b/src/mainboard/lenovo/t530/Kconfig @@ -13,6 +13,7 @@ config BOARD_SPECIFIC_OPTIONS # dummy select HAVE_CMOS_DEFAULT select HAVE_ACPI_RESUME select HAVE_SMI_HANDLER + select INTEL_INT15
# Workaround for EC/KBC IRQ1. select SERIRQ_CONTINUOUS_MODE diff --git a/src/mainboard/lenovo/t530/mainboard.c b/src/mainboard/lenovo/t530/mainboard.c index c3425b3..59710f5 100644 --- a/src/mainboard/lenovo/t530/mainboard.c +++ b/src/mainboard/lenovo/t530/mainboard.c @@ -25,9 +25,7 @@ #include <device/pci_def.h> #include <device/pci_ops.h> #include <console/console.h> -#if CONFIG_VGA_ROM_RUN -#include <x86emu/x86emu.h> -#endif +#include <drivers/intel/gma/int15.h> #include <pc80/mc146818rtc.h> #include <arch/acpi.h> #include <arch/io.h> @@ -48,91 +46,6 @@ void mainboard_suspend_resume(void) outb(0xcb, 0xb2); }
-#if CONFIG_VGA_ROM_RUN -static int int15_handler(void) -{ - int res = 0; - - printk(BIOS_DEBUG, "%s: INT15 function %04x!\n", - __func__, X86_AX); - - switch (X86_AX) { - case 0x5f34: - /* - * Set Panel Fitting Hook: - * bit 2 = Graphics Stretching - * bit 1 = Text Stretching - * bit 0 = Centering (do not set with bit1 or bit2) - * 0 = video bios default - */ - X86_AX = 0x005f; - X86_CL = 0x00; /* Use video bios default */ - res = 1; - break; - case 0x5f35: - /* - * Boot Display Device Hook: - * bit 0 = CRT - * bit 1 = TV (eDP) - * bit 2 = EFP - * bit 3 = LFP - * bit 4 = CRT2 - * bit 5 = TV2 (eDP) - * bit 6 = EFP2 - * bit 7 = LFP2 - */ - X86_AX = 0x005f; - X86_CX = 0x0000; /* Use video bios default */ - res = 1; - break; - case 0x5f51: - /* - * Hook to select active LFP configuration: - * 00h = No LVDS, VBIOS does not enable LVDS - * 01h = Int-LVDS, LFP driven by integrated LVDS decoder - * 02h = SVDO-LVDS, LFP driven by SVDO decoder - * 03h = eDP, LFP Driven by Int-DisplayPort encoder - */ - X86_AX = 0x005f; - X86_CX = 0x0001; /* Int-LVDS */ - res = 1; - break; - case 0x5f70: - switch (X86_CH) { - case 0: - /* Get Mux */ - X86_AX = 0x005f; - X86_CX = 0x0000; - res = 1; - break; - case 1: - /* Set Mux */ - X86_AX = 0x005f; - X86_CX = 0x0000; - res = 1; - break; - case 2: - /* Get SG/Non-SG mode */ - X86_AX = 0x005f; - X86_CX = 0x0000; - res = 1; - break; - default: - /* Interrupt was not handled */ - printk(BIOS_DEBUG, "Unknown INT15 5f70 function: 0x%02x\n", - X86_CH); - break; - } - break; - - default: - printk(BIOS_DEBUG, "Unknown INT15 function %04x!\n", X86_AX); - break; - } - return res; -} -#endif - /* Audio Setup */
static void verb_setup(void) @@ -171,10 +84,7 @@ static void mainboard_enable(device_t dev) { dev->ops->init = mainboard_init;
-#if CONFIG_VGA_ROM_RUN - /* Install custom int15 handler for VGA OPROM */ - mainboard_interrupt_handlers(0x15, &int15_handler); -#endif + install_intel_vga_int15_handler(GMA_INT15_ACTIVE_LFP_INT_LVDS, GMA_INT15_PANEL_FIT_DEFAULT, GMA_INT15_BOOT_DISPLAY_DEFAULT, 0); verb_setup(); }
diff --git a/src/mainboard/lenovo/t60/Kconfig b/src/mainboard/lenovo/t60/Kconfig index a42699d..c868e22 100644 --- a/src/mainboard/lenovo/t60/Kconfig +++ b/src/mainboard/lenovo/t60/Kconfig @@ -13,6 +13,7 @@ config BOARD_SPECIFIC_OPTIONS # dummy select EC_LENOVO_H8 select DRIVERS_ICS_954309 select HAVE_OPTION_TABLE + select INTEL_INT15 select HAVE_PIRQ_TABLE select HAVE_MP_TABLE select BOARD_ROMSIZE_KB_2048 diff --git a/src/mainboard/lenovo/t60/mainboard.c b/src/mainboard/lenovo/t60/mainboard.c index 9c6a30a..79b3da8 100644 --- a/src/mainboard/lenovo/t60/mainboard.c +++ b/src/mainboard/lenovo/t60/mainboard.c @@ -37,7 +37,7 @@ #include <arch/interrupt.h> #include <smbios.h> #include <build.h> -#include <x86emu/x86emu.h> +#include <drivers/intel/gma/int15.h> #define PANEL INT15_5F35_CL_DISPLAY_DEFAULT
static acpi_cstate_t cst_entries[] = { @@ -46,37 +46,6 @@ static acpi_cstate_t cst_entries[] = { { 2, 17, 250, { 0x01, 8, 0, { 0 }, DEFAULT_PMBASE + LV3, 0 } }, };
-#if CONFIG_PCI_OPTION_ROM_RUN_YABEL || CONFIG_PCI_OPTION_ROM_RUN_REALMODE -static int int15_handler(void) -{ - /* The right way to do this is to move this handler code into - * the mainboard or northbridge code. - * TODO: completely move to mainboards / chipsets. - */ - 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 = PANEL; - break; - case 0x5f40: /* Boot Panel Type */ - X86_AX = 0x005f; // Success - X86_CL = 3; - 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; @@ -97,10 +66,7 @@ static void mainboard_init(device_t dev) struct southbridge_intel_i82801gx_config *config; device_t dev0, idedev;
-#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 + install_intel_vga_int15_handler(GMA_INT15_ACTIVE_LFP_INT_LVDS, GMA_INT15_PANEL_FIT_DEFAULT, PANEL, 3);
/* If we're resuming from suspend, blink suspend LED */ dev0 = dev_find_slot(0, PCI_DEVFN(0,0)); diff --git a/src/mainboard/lenovo/x200/Kconfig b/src/mainboard/lenovo/x200/Kconfig index 5f7f87a..73ed75f 100644 --- a/src/mainboard/lenovo/x200/Kconfig +++ b/src/mainboard/lenovo/x200/Kconfig @@ -19,6 +19,7 @@ config BOARD_SPECIFIC_OPTIONS # dummy select HAVE_ACPI_RESUME select MAINBOARD_HAS_NATIVE_VGA_INIT select MAINBOARD_HAS_NATIVE_VGA_INIT_TEXTMODECFG + select INTEL_INT15
config MAINBOARD_DIR string diff --git a/src/mainboard/lenovo/x200/mainboard.c b/src/mainboard/lenovo/x200/mainboard.c index c83ad70..6c13eed 100644 --- a/src/mainboard/lenovo/x200/mainboard.c +++ b/src/mainboard/lenovo/x200/mainboard.c @@ -23,10 +23,7 @@ //#include <pc80/mc146818rtc.h> #include <device/device.h> #include <console/console.h> -#if CONFIG_VGA_ROM_RUN -#include <arch/interrupt.h> -#include <x86emu/x86emu.h> -#endif +#include <drivers/intel/gma/int15.h> #include <pc80/keyboard.h> #include <ec/acpi/ec.h> #include <smbios.h> @@ -44,70 +41,6 @@ the overloaded weak function in there. */ #endif
- -#if CONFIG_VGA_ROM_RUN -static int int15_handler(void) -{ - enum { - BOOT_DISPLAY_DEFAULT = 0, - BOOT_DISPLAY_CRT = (1 << 0), - BOOT_DISPLAY_TV = (1 << 1), - BOOT_DISPLAY_EFP = (1 << 2), - BOOT_DISPLAY_LFP = (1 << 3), - BOOT_DISPLAY_CRT2 = (1 << 4), - BOOT_DISPLAY_TV2 = (1 << 5), - BOOT_DISPLAY_EFP2 = (1 << 6), - BOOT_DISPLAY_LFP2 = (1 << 7), - }; - enum { - PANEL_FIT_DEFAULT = 0, - PANEL_FIT_CENTERING = (1 << 0), - PANEL_FIT_TXT_STRETCH = (1 << 1), - PANEL_FIT_GFX_STRETCH = (1 << 2), - }; - - switch (X86_AX) { - case 0x5f34: - /* Set Panel Fitting Hook */ - X86_AX = 0x005f; - X86_CX = PANEL_FIT_CENTERING; - break; - case 0x5f35: - /* Boot Display Device Hook */ - X86_AX = 0x005f; - X86_CX = BOOT_DISPLAY_DEFAULT; /* Select automatically. */ - break; - case 0x5f40: - /* Boot Panel Type Hook */ - /* Contrary to what EMGD's user's guide says, - this _alters_ the behavior of the Video BIOS. */ - /* LCD panel type is SIO GPIO40-43. - It's controlled by a DIP switch but was always - set to 4 while only values of 5 and 6 worked. */ - X86_AX = 0x005f; - X86_CX = 0x2; - break; - case 0x5f70: - /* Sandybridge boards return 0 here. */ - case 0x5f14: - case 0x5f21: - case 0x5f22: - case 0x5f49: - /* No documentation found. */ - default: - /* Interrupt was not handled. */ - printk(BIOS_DEBUG, - "%s: AX=%04x BX=%04x CX=%04x DX=%04x\n", __func__, - X86_AX, X86_BX, X86_CX, X86_DX); - return 0; - } - - /* Interrupt handled. */ - return 1; -} - -#endif - static void verb_setup(void) { cim_verb_data = mainboard_cim_verb_data; @@ -136,10 +69,7 @@ static void mainboard_init(device_t dev) static void mainboard_enable(device_t dev) { verb_setup(); -#if CONFIG_VGA_ROM_RUN - /* Install custom int15 handler for VGA OPROM */ - mainboard_interrupt_handlers(0x15, &int15_handler); -#endif + install_intel_vga_int15_handler(GMA_INT15_ACTIVE_LFP_INT_LVDS, GMA_INT15_PANEL_FIT_CENTERING, GMA_INT15_BOOT_DISPLAY_DEFAULT, 2);
dev->ops->init = mainboard_init; } diff --git a/src/mainboard/lenovo/x201/Kconfig b/src/mainboard/lenovo/x201/Kconfig index c82971f..571f35e 100644 --- a/src/mainboard/lenovo/x201/Kconfig +++ b/src/mainboard/lenovo/x201/Kconfig @@ -13,6 +13,7 @@ config BOARD_SPECIFIC_OPTIONS # dummy select HAVE_MP_TABLE select BOARD_ROMSIZE_KB_8192 select HAVE_ACPI_TABLES + select INTEL_INT15 select HAVE_ACPI_RESUME select MAINBOARD_HAS_NATIVE_VGA_INIT select MAINBOARD_HAS_NATIVE_VGA_INIT_TEXTMODECFG diff --git a/src/mainboard/lenovo/x201/mainboard.c b/src/mainboard/lenovo/x201/mainboard.c index 519baef..fb8c1d5 100644 --- a/src/mainboard/lenovo/x201/mainboard.c +++ b/src/mainboard/lenovo/x201/mainboard.c @@ -41,7 +41,7 @@ #include "dock.h" #include "hda_verb.h" #include <arch/x86/include/arch/acpigen.h> -#include <x86emu/regs.h> +#include <drivers/intel/gma/int15.h> #include <arch/interrupt.h> #include <pc80/keyboard.h> #include <cpu/x86/lapic.h> @@ -62,34 +62,6 @@ int get_cst_entries(acpi_cstate_t ** entries) return ARRAY_SIZE(cst_entries); }
-#if CONFIG_PCI_OPTION_ROM_RUN_YABEL || CONFIG_PCI_OPTION_ROM_RUN_REALMODE - -static int int15_handler(void) -{ - switch ((X86_EAX & 0xffff)) { - /* Get boot display. */ - case 0x5f35: - X86_EAX = 0x5f; - /* The flags are: - 1 - VGA - 4 - DisplayPort - 8 - LCD - */ - X86_ECX = 0x8; - - return 1; - case 0x5f40: - X86_EAX = 0x5f; - X86_ECX = 0x2; - return 1; - default: - printk(BIOS_WARNING, "Unknown INT15 function %04x!\n", - X86_EAX & 0xffff); - return 0; - } -} -#endif - const char *smbios_mainboard_bios_version(void) { /* Satisfy thinkpad_acpi. */ @@ -181,10 +153,7 @@ static void mainboard_enable(device_t dev) if (dev0 && pci_read_config32(dev0, SKPAD) == SKPAD_ACPI_S3_MAGIC) ec_write(0x0c, 0xc7);
-#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 + install_intel_vga_int15_handler(GMA_INT15_ACTIVE_LFP_INT_LVDS, GMA_INT15_PANEL_FIT_DEFAULT, GMA_INT15_BOOT_DISPLAY_LFP, 2);
verb_setup(); } diff --git a/src/mainboard/lenovo/x220/Kconfig b/src/mainboard/lenovo/x220/Kconfig index 3ce4a47..4a05f50 100644 --- a/src/mainboard/lenovo/x220/Kconfig +++ b/src/mainboard/lenovo/x220/Kconfig @@ -13,6 +13,7 @@ config BOARD_SPECIFIC_OPTIONS # dummy select HAVE_CMOS_DEFAULT select HAVE_ACPI_RESUME select HAVE_SMI_HANDLER + select INTEL_INT15 select EARLY_CBMEM_INIT select VGA select INTEL_EDID diff --git a/src/mainboard/lenovo/x220/mainboard.c b/src/mainboard/lenovo/x220/mainboard.c index 7a0b4a9..757e09d 100644 --- a/src/mainboard/lenovo/x220/mainboard.c +++ b/src/mainboard/lenovo/x220/mainboard.c @@ -25,9 +25,7 @@ #include <device/pci_def.h> #include <device/pci_ops.h> #include <console/console.h> -#if CONFIG_VGA_ROM_RUN -#include <x86emu/x86emu.h> -#endif +#include <drivers/intel/gma/int15.h> #include <pc80/mc146818rtc.h> #include <arch/acpi.h> #include <arch/io.h> @@ -50,91 +48,6 @@ void mainboard_suspend_resume(void) outb(0xcb, 0xb2); }
-#if CONFIG_VGA_ROM_RUN -static int int15_handler(void) -{ - int res = 0; - - printk(BIOS_DEBUG, "%s: INT15 function %04x!\n", - __func__, X86_AX); - - switch (X86_AX) { - case 0x5f34: - /* - * Set Panel Fitting Hook: - * bit 2 = Graphics Stretching - * bit 1 = Text Stretching - * bit 0 = Centering (do not set with bit1 or bit2) - * 0 = video bios default - */ - X86_AX = 0x005f; - X86_CL = 0x00; /* Use video bios default */ - res = 1; - break; - case 0x5f35: - /* - * Boot Display Device Hook: - * bit 0 = CRT - * bit 1 = TV (eDP) - * bit 2 = EFP - * bit 3 = LFP - * bit 4 = CRT2 - * bit 5 = TV2 (eDP) - * bit 6 = EFP2 - * bit 7 = LFP2 - */ - X86_AX = 0x005f; - X86_CX = 0x0000; /* Use video bios default */ - res = 1; - break; - case 0x5f51: - /* - * Hook to select active LFP configuration: - * 00h = No LVDS, VBIOS does not enable LVDS - * 01h = Int-LVDS, LFP driven by integrated LVDS decoder - * 02h = SVDO-LVDS, LFP driven by SVDO decoder - * 03h = eDP, LFP Driven by Int-DisplayPort encoder - */ - X86_AX = 0x005f; - X86_CX = 0x0001; /* Int-LVDS */ - res = 1; - break; - case 0x5f70: - switch (X86_CH) { - case 0: - /* Get Mux */ - X86_AX = 0x005f; - X86_CX = 0x0000; - res = 1; - break; - case 1: - /* Set Mux */ - X86_AX = 0x005f; - X86_CX = 0x0000; - res = 1; - break; - case 2: - /* Get SG/Non-SG mode */ - X86_AX = 0x005f; - X86_CX = 0x0000; - res = 1; - break; - default: - /* Interrupt was not handled */ - printk(BIOS_DEBUG, "Unknown INT15 5f70 function: 0x%02x\n", - X86_CH); - break; - } - break; - - default: - printk(BIOS_DEBUG, "Unknown INT15 function %04x!\n", X86_AX); - break; - } - return res; -} -#endif - const char *smbios_mainboard_bios_version(void) { /* Satisfy thinkpad_acpi. */ @@ -182,10 +95,7 @@ static void mainboard_enable(device_t dev) { dev->ops->init = mainboard_init;
-#if CONFIG_VGA_ROM_RUN - /* Install custom int15 handler for VGA OPROM */ - mainboard_interrupt_handlers(0x15, &int15_handler); -#endif + install_intel_vga_int15_handler(GMA_INT15_ACTIVE_LFP_INT_LVDS, GMA_INT15_PANEL_FIT_DEFAULT, GMA_INT15_BOOT_DISPLAY_DEFAULT, 0); verb_setup(); }
diff --git a/src/mainboard/lenovo/x230/Kconfig b/src/mainboard/lenovo/x230/Kconfig index f835ab4..388a1ad 100644 --- a/src/mainboard/lenovo/x230/Kconfig +++ b/src/mainboard/lenovo/x230/Kconfig @@ -13,6 +13,7 @@ config BOARD_SPECIFIC_OPTIONS # dummy select HAVE_CMOS_DEFAULT select HAVE_ACPI_RESUME select HAVE_SMI_HANDLER + select INTEL_INT15 select EARLY_CBMEM_INIT select VGA select INTEL_EDID diff --git a/src/mainboard/lenovo/x230/mainboard.c b/src/mainboard/lenovo/x230/mainboard.c index c017712..6f97976 100644 --- a/src/mainboard/lenovo/x230/mainboard.c +++ b/src/mainboard/lenovo/x230/mainboard.c @@ -25,9 +25,7 @@ #include <device/pci_def.h> #include <device/pci_ops.h> #include <console/console.h> -#if CONFIG_VGA_ROM_RUN -#include <x86emu/x86emu.h> -#endif +#include <drivers/intel/gma/int15.h> #include <pc80/mc146818rtc.h> #include <arch/acpi.h> #include <arch/io.h> @@ -49,91 +47,6 @@ void mainboard_suspend_resume(void) outb(0xcb, 0xb2); }
-#if CONFIG_VGA_ROM_RUN -static int int15_handler(void) -{ - int res = 0; - - printk(BIOS_DEBUG, "%s: INT15 function %04x!\n", - __func__, X86_AX); - - switch (X86_AX) { - case 0x5f34: - /* - * Set Panel Fitting Hook: - * bit 2 = Graphics Stretching - * bit 1 = Text Stretching - * bit 0 = Centering (do not set with bit1 or bit2) - * 0 = video bios default - */ - X86_AX = 0x005f; - X86_CL = 0x00; /* Use video bios default */ - res = 1; - break; - case 0x5f35: - /* - * Boot Display Device Hook: - * bit 0 = CRT - * bit 1 = TV (eDP) - * bit 2 = EFP - * bit 3 = LFP - * bit 4 = CRT2 - * bit 5 = TV2 (eDP) - * bit 6 = EFP2 - * bit 7 = LFP2 - */ - X86_AX = 0x005f; - X86_CX = 0x0000; /* Use video bios default */ - res = 1; - break; - case 0x5f51: - /* - * Hook to select active LFP configuration: - * 00h = No LVDS, VBIOS does not enable LVDS - * 01h = Int-LVDS, LFP driven by integrated LVDS decoder - * 02h = SVDO-LVDS, LFP driven by SVDO decoder - * 03h = eDP, LFP Driven by Int-DisplayPort encoder - */ - X86_AX = 0x005f; - X86_CX = 0x0001; /* Int-LVDS */ - res = 1; - break; - case 0x5f70: - switch (X86_CH) { - case 0: - /* Get Mux */ - X86_AX = 0x005f; - X86_CX = 0x0000; - res = 1; - break; - case 1: - /* Set Mux */ - X86_AX = 0x005f; - X86_CX = 0x0000; - res = 1; - break; - case 2: - /* Get SG/Non-SG mode */ - X86_AX = 0x005f; - X86_CX = 0x0000; - res = 1; - break; - default: - /* Interrupt was not handled */ - printk(BIOS_DEBUG, "Unknown INT15 5f70 function: 0x%02x\n", - X86_CH); - break; - } - break; - - default: - printk(BIOS_DEBUG, "Unknown INT15 function %04x!\n", X86_AX); - break; - } - return res; -} -#endif - const char *smbios_mainboard_bios_version(void) { /* Satisfy thinkpad_acpi. */ @@ -181,10 +94,7 @@ static void mainboard_enable(device_t dev) { dev->ops->init = mainboard_init;
-#if CONFIG_VGA_ROM_RUN - /* Install custom int15 handler for VGA OPROM */ - mainboard_interrupt_handlers(0x15, &int15_handler); -#endif + install_intel_vga_int15_handler(GMA_INT15_ACTIVE_LFP_INT_LVDS, GMA_INT15_PANEL_FIT_DEFAULT, GMA_INT15_BOOT_DISPLAY_DEFAULT, 0); verb_setup(); }
diff --git a/src/mainboard/lenovo/x60/Kconfig b/src/mainboard/lenovo/x60/Kconfig index c27cad8..1757327 100644 --- a/src/mainboard/lenovo/x60/Kconfig +++ b/src/mainboard/lenovo/x60/Kconfig @@ -13,6 +13,7 @@ config BOARD_SPECIFIC_OPTIONS # dummy select EC_LENOVO_H8 select DRIVERS_ICS_954309 select HAVE_OPTION_TABLE + select INTEL_INT15 select HAVE_CMOS_DEFAULT select HAVE_PIRQ_TABLE select HAVE_MP_TABLE diff --git a/src/mainboard/lenovo/x60/mainboard.c b/src/mainboard/lenovo/x60/mainboard.c index 3cbb49f..1f258b4 100644 --- a/src/mainboard/lenovo/x60/mainboard.c +++ b/src/mainboard/lenovo/x60/mainboard.c @@ -39,7 +39,7 @@ #include <arch/x86/include/arch/acpigen.h> #include <smbios.h> #include <build.h> -#include <x86emu/x86emu.h> +#include <drivers/intel/gma/int15.h> #include "drivers/lenovo/lenovo.h"
#define PANEL INT15_5F35_CL_DISPLAY_DEFAULT @@ -50,37 +50,6 @@ static acpi_cstate_t cst_entries[] = { { 2, 17, 250, { 0x01, 8, 0, { 0 }, DEFAULT_PMBASE + LV3, 0 } }, };
-#if CONFIG_PCI_OPTION_ROM_RUN_YABEL || CONFIG_PCI_OPTION_ROM_RUN_REALMODE -static int int15_handler(void) -{ - /* The right way to do this is to move this handler code into - * the mainboard or northbridge code. - * TODO: completely move to mainboards / chipsets. - */ - 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 = PANEL; - break; - case 0x5f40: /* Boot Panel Type */ - X86_AX = 0x005f; // Success - X86_CL = 3; - 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; @@ -98,10 +67,7 @@ static void mainboard_init(device_t dev) 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 + install_intel_vga_int15_handler(GMA_INT15_ACTIVE_LFP_INT_LVDS, GMA_INT15_PANEL_FIT_DEFAULT, PANEL, 3);
/* If we're resuming from suspend, blink suspend LED */ dev0 = dev_find_slot(0, PCI_DEVFN(0,0)); diff --git a/src/mainboard/packardbell/ms2290/Kconfig b/src/mainboard/packardbell/ms2290/Kconfig index 20768d8..f0b7538 100644 --- a/src/mainboard/packardbell/ms2290/Kconfig +++ b/src/mainboard/packardbell/ms2290/Kconfig @@ -13,6 +13,7 @@ config BOARD_SPECIFIC_OPTIONS # dummy select HAVE_ACPI_TABLES select HAVE_ACPI_RESUME select MAINBOARD_HAS_NATIVE_VGA_INIT + select INTEL_INT15 select EC_ACPI select MAINBOARD_HAS_NATIVE_VGA_INIT_TEXTMODECFG
diff --git a/src/mainboard/packardbell/ms2290/mainboard.c b/src/mainboard/packardbell/ms2290/mainboard.c index aca221a..756d0c3 100644 --- a/src/mainboard/packardbell/ms2290/mainboard.c +++ b/src/mainboard/packardbell/ms2290/mainboard.c @@ -37,7 +37,7 @@ #include "hda_verb.h" #include <arch/x86/include/arch/acpigen.h> #if CONFIG_PCI_OPTION_ROM_RUN_YABEL || CONFIG_PCI_OPTION_ROM_RUN_REALMODE -#include <x86emu/regs.h> +#include <drivers/intel/gma/int15.h> #include <arch/interrupt.h> #endif #include <pc80/keyboard.h> @@ -58,34 +58,6 @@ int get_cst_entries(acpi_cstate_t ** entries) return ARRAY_SIZE(cst_entries); }
-#if CONFIG_PCI_OPTION_ROM_RUN_YABEL || CONFIG_PCI_OPTION_ROM_RUN_REALMODE - -static int int15_handler(void) -{ - switch ((X86_EAX & 0xffff)) { - /* Get boot display. */ - case 0x5f35: - X86_EAX = 0x5f; - /* The flags are: - 1 - VGA - 4 - DisplayPort - 8 - LCD - */ - X86_ECX = 0x8; - - return 1; - case 0x5f40: - X86_EAX = 0x5f; - X86_ECX = 0x2; - return 1; - default: - printk(BIOS_WARNING, "Unknown INT15 function %04x!\n", - X86_EAX & 0xffff); - return 0; - } -} -#endif - /* Audio Setup */
static void verb_setup(void) @@ -160,10 +132,7 @@ static void mainboard_enable(device_t dev) pci_write_config8(dev_find_slot(0, PCI_DEVFN(0x1f, 0)), GPIO_CNTL, 0x10);
-#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 + install_intel_vga_int15_handler(GMA_INT15_ACTIVE_LFP_INT_LVDS, GMA_INT15_PANEL_FIT_DEFAULT, GMA_INT15_BOOT_DISPLAY_LFP, 2);
/* This sneaked in here, because EasyNote has no SuperIO chip. */ diff --git a/src/mainboard/roda/rk886ex/Kconfig b/src/mainboard/roda/rk886ex/Kconfig index 7f2b5b9..bbb5d9b 100644 --- a/src/mainboard/roda/rk886ex/Kconfig +++ b/src/mainboard/roda/rk886ex/Kconfig @@ -17,6 +17,7 @@ config BOARD_SPECIFIC_OPTIONS # dummy select HAVE_ACPI_RESUME select BOARD_ROMSIZE_KB_1024 select CHANNEL_XOR_RANDOMIZATION + select INTEL_INT15
config MAINBOARD_DIR string diff --git a/src/mainboard/roda/rk886ex/mainboard.c b/src/mainboard/roda/rk886ex/mainboard.c index 7158dca..ba7ed23 100644 --- a/src/mainboard/roda/rk886ex/mainboard.c +++ b/src/mainboard/roda/rk886ex/mainboard.c @@ -24,9 +24,7 @@ #include <arch/io.h> #include <arch/interrupt.h> #include <delay.h> -#if CONFIG_VGA_ROM_RUN -#include <x86emu/x86emu.h> -#endif +#include <drivers/intel/gma/int15.h>
#include <ec/acpi/ec.h> #include "m3885.h" @@ -50,54 +48,6 @@ static void backlight_enable(void) printk(BIOS_DEBUG, "Display I/O: 0x%02x\n", inb(0x60f)); }
-#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 - #if DUMP_RUNTIME_REGISTERS static void dump_runtime_registers(void) { @@ -124,10 +74,10 @@ static void mainboard_enable(device_t dev) /* Disable Dummy DCC -> GP45 = 1 */ outb(inb(0x60f) | (1 << 5), 0x60f);
-#if CONFIG_VGA_ROM_RUN - /* Install custom int15 handler for VGA OPROM */ - mainboard_interrupt_handlers(0x15, &int15_handler); -#endif + /* LCD panel type is SIO GPIO40-43 */ + // display_id = inb(0x60f) & 0x0f; + install_intel_vga_int15_handler(GMA_INT15_ACTIVE_LFP_INT_LVDS, GMA_INT15_PANEL_FIT_DEFAULT, GMA_INT15_BOOT_DISPLAY_DEFAULT, 3); + #if DUMP_RUNTIME_REGISTERS dump_runtime_registers(); #endif diff --git a/src/mainboard/roda/rk9/mainboard.c b/src/mainboard/roda/rk9/mainboard.c index 4744415..49db15f 100644 --- a/src/mainboard/roda/rk9/mainboard.c +++ b/src/mainboard/roda/rk9/mainboard.c @@ -23,10 +23,7 @@ //#include <pc80/mc146818rtc.h> #include <device/device.h> #include <console/console.h> -#if CONFIG_VGA_ROM_RUN -#include <arch/interrupt.h> -#include <x86emu/x86emu.h> -#endif +#include <drivers/intel/gma/int15.h> #include <pc80/keyboard.h> #include <ec/acpi/ec.h> #include <device/azalia_device.h> @@ -37,70 +34,6 @@ the overloaded weak function in there. */ #endif
- -#if CONFIG_VGA_ROM_RUN -static int int15_handler(void) -{ - enum { - BOOT_DISPLAY_DEFAULT = 0, - BOOT_DISPLAY_CRT = (1 << 0), - BOOT_DISPLAY_TV = (1 << 1), - BOOT_DISPLAY_EFP = (1 << 2), - BOOT_DISPLAY_LFP = (1 << 3), - BOOT_DISPLAY_CRT2 = (1 << 4), - BOOT_DISPLAY_TV2 = (1 << 5), - BOOT_DISPLAY_EFP2 = (1 << 6), - BOOT_DISPLAY_LFP2 = (1 << 7), - }; - enum { - PANEL_FIT_DEFAULT = 0, - PANEL_FIT_CENTERING = (1 << 0), - PANEL_FIT_TXT_STRETCH = (1 << 1), - PANEL_FIT_GFX_STRETCH = (1 << 2), - }; - - switch (X86_AX) { - case 0x5f34: - /* Set Panel Fitting Hook */ - X86_AX = 0x005f; - X86_CX = PANEL_FIT_CENTERING; - break; - case 0x5f35: - /* Boot Display Device Hook */ - X86_AX = 0x005f; - X86_CX = BOOT_DISPLAY_DEFAULT; /* Select automatically. */ - break; - case 0x5f40: - /* Boot Panel Type Hook */ - /* Contrary to what EMGD's user's guide says, - this _alters_ the behavior of the Video BIOS. */ - /* LCD panel type is SIO GPIO40-43. - It's controlled by a DIP switch but was always - set to 4 while only values of 5 and 6 worked. */ - X86_AX = 0x005f; - X86_CX = (inb(0x60f) & 0x0f) + 1; - break; - case 0x5f70: - /* Sandybridge boards return 0 here. */ - case 0x5f14: - case 0x5f21: - case 0x5f22: - case 0x5f49: - /* No documentation found. */ - default: - /* Interrupt was not handled. */ - printk(BIOS_DEBUG, - "%s: AX=%04x BX=%04x CX=%04x DX=%04x\n", __func__, - X86_AX, X86_BX, X86_CX, X86_DX); - return 0; - } - - /* Interrupt handled. */ - return 1; -} - -#endif - static void verb_setup(void) { cim_verb_data = mainboard_cim_verb_data; @@ -127,10 +60,10 @@ static void mainboard_enable(device_t dev) { ec_setup(); verb_setup(); -#if CONFIG_VGA_ROM_RUN - /* Install custom int15 handler for VGA OPROM */ - mainboard_interrupt_handlers(0x15, &int15_handler); -#endif + /* LCD panel type is SIO GPIO40-43. + It's controlled by a DIP switch but was always + set to 4 while only values of 5 and 6 worked. */ + install_intel_vga_int15_handler(GMA_INT15_ACTIVE_LFP_INT_LVDS, GMA_INT15_PANEL_FIT_CENTERING, GMA_INT15_BOOT_DISPLAY_DEFAULT, (inb(0x60f) & 0x0f) + 1);
/* We have no driver for the embedded controller since the firmware does most of the job. Hence, initialize keyboards here. */ diff --git a/src/mainboard/samsung/lumpy/Kconfig b/src/mainboard/samsung/lumpy/Kconfig index 63c78d3..68f3058 100644 --- a/src/mainboard/samsung/lumpy/Kconfig +++ b/src/mainboard/samsung/lumpy/Kconfig @@ -13,6 +13,7 @@ config BOARD_SPECIFIC_OPTIONS # dummy select SOUTHBRIDGE_INTEL_BD82X6X select SUPERIO_SMSC_MEC1308 select DRIVERS_GENERIC_IOAPIC + select INTEL_INT15 select HAVE_MRC
config MAINBOARD_DIR diff --git a/src/mainboard/samsung/lumpy/mainboard.c b/src/mainboard/samsung/lumpy/mainboard.c index ee6728f..bdce948 100644 --- a/src/mainboard/samsung/lumpy/mainboard.c +++ b/src/mainboard/samsung/lumpy/mainboard.c @@ -24,9 +24,7 @@ #include <device/pci_def.h> #include <device/pci_ops.h> #include <console/console.h> -#if CONFIG_VGA_ROM_RUN -#include <x86emu/x86emu.h> -#endif +#include <drivers/intel/gma/int15.h> #include <pc80/mc146818rtc.h> #include <arch/acpi.h> #include <arch/io.h> @@ -50,91 +48,6 @@ void mainboard_suspend_resume(void) send_ec_command(EC_ACPI_ENABLE); }
-#if CONFIG_VGA_ROM_RUN -static int int15_handler(void) -{ - int res=0; - - printk(BIOS_DEBUG, "%s: INT15 function %04x!\n", - __func__, X86_AX); - - switch(X86_AX) { - case 0x5f34: - /* - * Set Panel Fitting Hook: - * bit 2 = Graphics Stretching - * bit 1 = Text Stretching - * bit 0 = Centering (do not set with bit1 or bit2) - * 0 = video bios default - */ - X86_AX = 0x005f; - X86_CL = 0x00; - res = 1; - break; - case 0x5f35: - /* - * Boot Display Device Hook: - * bit 0 = CRT - * bit 1 = TV - * bit 2 = EFP * - * bit 3 = LFP - * bit 4 = CRT2 - * bit 5 = TV2 - * bit 6 = EFP2 * - * bit 7 = LFP2 - */ - X86_AX = 0x005f; - X86_CX = 0x0000; - res = 1; - break; - case 0x5f51: - /* - * Hook to select active LFP configuration: - * 00h = No LVDS, VBIOS does not enable LVDS - * 01h = Int-LVDS, LFP driven by integrated LVDS decoder - * 02h = SVDO-LVDS, LFP driven by SVDO decoder - * 03h = eDP, LFP Driven by Int-DisplayPort encoder - */ - X86_AX = 0x005f; - X86_CX = 0x0001; - res = 1; - break; - case 0x5f70: - switch (X86_CH) { - case 0: - /* Get Mux */ - X86_AX = 0x005f; - X86_CX = 0x0000; - res = 1; - break; - case 1: - /* Set Mux */ - X86_EAX = 0x005f; - X86_ECX = 0x0000; - res = 1; - break; - case 2: - /* Get SG/Non-SG mode */ - X86_AX = 0x005f; - X86_CX = 0x0000; - res = 1; - break; - default: - /* FIXME: Interrupt was not handled, but return success? */ - printk(BIOS_DEBUG, "Unknown INT15 5f70 function: 0x%02x\n", - X86_CH); - return 1; - } - break; - - default: - printk(BIOS_DEBUG, "Unknown INT15 function %04x!\n", X86_AX); - break; - } - return res; -} -#endif - /* Audio Setup */
static void verb_setup(void) @@ -202,10 +115,7 @@ static void mainboard_enable(device_t dev) { dev->ops->init = mainboard_init; dev->ops->get_smbios_data = lumpy_onboard_smbios_data; -#if CONFIG_VGA_ROM_RUN - /* Install custom int15 handler for VGA OPROM */ - mainboard_interrupt_handlers(0x15, &int15_handler); -#endif + install_intel_vga_int15_handler(GMA_INT15_ACTIVE_LFP_INT_LVDS, GMA_INT15_PANEL_FIT_DEFAULT, GMA_INT15_BOOT_DISPLAY_DEFAULT, 0); verb_setup(); }
diff --git a/src/mainboard/samsung/stumpy/Kconfig b/src/mainboard/samsung/stumpy/Kconfig index 1ec107f..eee3755 100644 --- a/src/mainboard/samsung/stumpy/Kconfig +++ b/src/mainboard/samsung/stumpy/Kconfig @@ -13,6 +13,7 @@ config BOARD_SPECIFIC_OPTIONS # dummy select SUPERIO_ITE_IT8772F select HAVE_MRC
+ select INTEL_INT15 config MAINBOARD_DIR string default samsung/stumpy diff --git a/src/mainboard/samsung/stumpy/mainboard.c b/src/mainboard/samsung/stumpy/mainboard.c index 99fe725..7fd8a1f 100644 --- a/src/mainboard/samsung/stumpy/mainboard.c +++ b/src/mainboard/samsung/stumpy/mainboard.c @@ -25,9 +25,7 @@ #include <device/pci_def.h> #include <device/pci_ops.h> #include <console/console.h> -#if CONFIG_VGA_ROM_RUN -#include <x86emu/x86emu.h> -#endif +#include <drivers/intel/gma/int15.h> #include <pc80/mc146818rtc.h> #include <arch/acpi.h> #include <arch/io.h> @@ -43,91 +41,6 @@ void mainboard_suspend_resume(void) outb(0xcb, 0xb2); }
-#if CONFIG_VGA_ROM_RUN -static int int15_handler(void) -{ - int res=0; - - printk(BIOS_DEBUG, "%s: INT15 function %04x!\n", - __func__, X86_AX); - - switch(X86_AX) { - case 0x5f34: - /* - * Set Panel Fitting Hook: - * bit 2 = Graphics Stretching - * bit 1 = Text Stretching - * bit 0 = Centering (do not set with bit1 or bit2) - * 0 = video bios default - */ - X86_AX = 0x005f; - X86_CL = 0x01; - res = 1; - break; - case 0x5f35: - /* - * Boot Display Device Hook: - * bit 0 = CRT - * bit 1 = TV (eDP) * - * bit 2 = EFP * - * bit 3 = LFP - * bit 4 = CRT2 - * bit 5 = TV2 (eDP) * - * bit 6 = EFP2 * - * bit 7 = LFP2 - */ - X86_AX = 0x005f; - X86_CX = 0x0000; - res = 1; - break; - case 0x5f51: - /* - * Hook to select active LFP configuration: - * 00h = No LVDS, VBIOS does not enable LVDS - * 01h = Int-LVDS, LFP driven by integrated LVDS decoder - * 02h = SVDO-LVDS, LFP driven by SVDO decoder - * 03h = eDP, LFP Driven by Int-DisplayPort encoder - */ - X86_AX = 0x005f; - X86_CX = 0x0003; - res = 1; - break; - case 0x5f70: - switch (X86_CH) { - case 0: - /* Get Mux */ - X86_AX = 0x005f; - X86_CX = 0x0000; - res = 1; - break; - case 1: - /* Set Mux */ - X86_AX = 0x005f; - X86_CX = 0x0000; - res = 1; - break; - case 2: - /* Get SG/Non-SG mode */ - X86_AX = 0x005f; - X86_CX = 0x0000; - res = 1; - break; - default: - /* FIXME: Interrupt was not handled, but return sucess? */ - printk(BIOS_DEBUG, "Unknown INT15 5f70 function: 0x%02x\n", - X86_CH); - return 1; - } - break; - - default: - printk(BIOS_DEBUG, "Unknown INT15 function %04x!\n", X86_AX); - break; - } - return res; -} -#endif - /* Audio Setup */
static void verb_setup(void) @@ -143,10 +56,7 @@ static void verb_setup(void)
static void mainboard_enable(device_t dev) { -#if CONFIG_VGA_ROM_RUN - /* Install custom int15 handler for VGA OPROM */ - mainboard_interrupt_handlers(0x15, &int15_handler); -#endif + install_intel_vga_int15_handler(GMA_INT15_ACTIVE_LFP_EDP, GMA_INT15_PANEL_FIT_CENTERING, GMA_INT15_BOOT_DISPLAY_DEFAULT, 0); verb_setup(); }
diff --git a/src/mainboard/thomson/ip1000/Kconfig b/src/mainboard/thomson/ip1000/Kconfig index a68c72a..80d365c 100644 --- a/src/mainboard/thomson/ip1000/Kconfig +++ b/src/mainboard/thomson/ip1000/Kconfig @@ -9,6 +9,7 @@ config BOARD_SPECIFIC_OPTIONS # dummy select HAVE_PIRQ_TABLE select UDELAY_TSC select BOARD_ROMSIZE_KB_512 + select INTEL_INT15
config MAINBOARD_DIR string diff --git a/src/mainboard/thomson/ip1000/mainboard.c b/src/mainboard/thomson/ip1000/mainboard.c index 705c427..7267696 100644 --- a/src/mainboard/thomson/ip1000/mainboard.c +++ b/src/mainboard/thomson/ip1000/mainboard.c @@ -21,9 +21,7 @@ #include <console/console.h> #include <device/device.h> #include <delay.h> -#if CONFIG_VGA_ROM_RUN -#include <x86emu/x86emu.h> -#endif +#include <drivers/intel/gma/int15.h> #include <arch/io.h> #include <arch/interrupt.h>
@@ -86,53 +84,6 @@ static void flash_gpios(void) } }
- -#if CONFIG_VGA_ROM_RUN -static int int15_handler(void) -{ -#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) - - 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 - //M.x86.R_CL = BOOT_DISPLAY_TV2; - X86_CL = BOOT_DISPLAY_DEFAULT; - break; - case 0x5f36: /* Boot TV Format Hook */ - printk(BIOS_DEBUG, "Boot TV Format Hook. TODO\n"); - /* Interrupt was not handled */ - return 0; - case 0x5f31: /* Post Completion Hook */ - case 0x5f33: /* Hook After Mode Set */ - case 0x5f34: /* Set Panel Fitting Hook */ - case 0x5f38: /* Hook Before Mode Set */ - case 0x5f45: /* Hook Before VESA VBE/DDC */ - case 0x5f46: /* Hook Before VESA VBE/PM */ - case 0x5f47: /* Notif Display Switch Hook */ - case 0x5f65: /* Local Memory Initialization Hook */ - /* Interrupt was not handled */ - return 0; - default: - /* Interrupt was not handled */ - return 0; - } - - /* Interrupt handled */ - return 1; -} -#endif - static void mainboard_init(device_t dev) { parport_gpios(); @@ -142,10 +93,7 @@ static void mainboard_init(device_t dev) static void mainboard_enable(device_t dev) { dev->ops->init = mainboard_init; -#if CONFIG_VGA_ROM_RUN - /* Install custom int15 handler for VGA OPROM */ - mainboard_interrupt_handlers(0x15, &int15_handler); -#endif + install_intel_vga_int15_handler(GMA_INT15_ACTIVE_LFP_INT_LVDS, GMA_INT15_PANEL_FIT_DEFAULT, GMA_INT15_BOOT_DISPLAY_DEFAULT, 0); }
struct chip_operations mainboard_ops = {