1 /* SPDX-License-Identifier: GPL-2.0-only */
4 #include <device/device.h>
5 #include <device/pci_def.h>
6 #include <console/console.h>
7 #if CONFIG(VGA_ROM_RUN)
8 #include <x86emu/x86emu.h>
11 #include <arch/interrupt.h>
12 #include <southbridge/intel/bd82x6x/pch.h>
14 #if CONFIG(VGA_ROM_RUN)
15 static int int15_handler(void)
19 printk(BIOS_DEBUG
, "%s: AX=%04x BX=%04x CX=%04x DX=%04x\n",
20 __func__
, X86_AX
, X86_BX
, X86_CX
, X86_DX
);
22 switch (X86_EAX
& 0xffff) {
25 * Set Panel Fitting Hook:
26 * bit 2 = Graphics Stretching
27 * bit 1 = Text Stretching
28 * bit 0 = Centering (do not set with bit1 or bit2)
29 * 0 = video BIOS default
31 X86_EAX
&= 0xffff0000;
33 X86_ECX
&= 0xffffff00;
34 X86_ECX
|= 0x00; /* Use video BIOS default */
39 * Boot Display Device Hook:
49 X86_EAX
&= 0xffff0000;
51 X86_ECX
&= 0xffff0000;
52 X86_ECX
|= 0x0000; /* Use video BIOS default */
57 * Hook to select active LFP configuration:
58 * 00h = No LVDS, VBIOS does not enable LVDS
59 * 01h = Int-LVDS, LFP driven by integrated LVDS decoder
60 * 02h = SDVO-LVDS, LFP driven by SDVO decoder
61 * 03h = eDP, LFP Driven by Int-DisplayPort encoder
63 X86_EAX
&= 0xffff0000;
65 X86_ECX
&= 0xffff0000;
66 X86_ECX
|= 0x0000; /* TODO: Make this configurable in NVRAM? */
71 * Boot Panel Type Hook:
72 * BL(in): 00h = LFP, 01h = LFP2
73 * CL(out): panel type id in table: 1..16
75 if (0 == (X86_EBX
& 0xff)) {
76 X86_EAX
&= 0xffff0000;
79 } else if (1 == (X86_EBX
& 0xff)) {
80 X86_EAX
&= 0xffff0000;
85 "Unknown panel index %u "
86 "in INT15 function %04x!\n",
87 X86_EBX
& 0xff, X86_EAX
& 0xffff);
96 X86_EAX
&= 0xffff0000;
98 X86_ECX
&= 0xffff0000;
103 if ((X86_EBX
& 0xffff) == 0x78f) {
105 * Get Miscellaneous Status Hook:
106 * bit 2: AC power active?
110 X86_EAX
&= 0xffff0000;
115 "Unknown BX 0x%04x in INT15 function %04x!\n",
116 X86_EBX
& 0xffff, X86_EAX
& 0xffff);
121 * Get Inverter Type and Polarity:
122 * EBX: backlight control brightness: 0..255
124 * 0 = Enable PWM inverted, 2 = Enable PWM
125 * 1 = Enable I2C inverted, 3 = Enable I2C
127 X86_EAX
&= 0xffff0000;
132 printk(BIOS_DEBUG
, "Unknown INT15 function %04x!\n",
141 static void mainboard_enable(struct device
*dev
)
143 #if CONFIG(PCI_OPTION_ROM_RUN_YABEL) || \
144 CONFIG(PCI_OPTION_ROM_RUN_REALMODE)
145 /* Install custom int15 handler for VGA OPROM */
146 mainboard_interrupt_handlers(0x15, &int15_handler
);
148 unsigned int disable
= get_uint_option("ethernet1", 0);
150 struct device
*nic
= pcidev_on_root(0x1c, 2);
152 printk(BIOS_DEBUG
, "DISABLE FIRST NIC!\n");
156 disable
= get_uint_option("ethernet2", 0);
158 struct device
*nic
= pcidev_on_root(0x1c, 3);
160 printk(BIOS_DEBUG
, "DISABLE SECOND NIC!\n");
166 struct chip_operations mainboard_ops
= {
167 .enable_dev
= mainboard_enable
,