mb/amb/birman*/gpio: remove configuration for VDD_MEM_VID[0,1]
[coreboot2.git] / src / mainboard / kontron / ktqm77 / mainboard.c
blob27aa3b532868042105fdd6a0ff20e225eb818886
1 /* SPDX-License-Identifier: GPL-2.0-only */
3 #include <types.h>
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>
9 #endif
10 #include <option.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)
17 int res = 0;
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) {
23 case 0x5f34:
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;
32 X86_EAX |= 0x005f;
33 X86_ECX &= 0xffffff00;
34 X86_ECX |= 0x00; /* Use video BIOS default */
35 res = 1;
36 break;
37 case 0x5f35:
39 * Boot Display Device Hook:
40 * bit 0 = CRT
41 * bit 1 = TV (eDP)
42 * bit 2 = EFP
43 * bit 3 = LFP
44 * bit 4 = CRT2
45 * bit 5 = TV2 (eDP)
46 * bit 6 = EFP2
47 * bit 7 = LFP2
49 X86_EAX &= 0xffff0000;
50 X86_EAX |= 0x005f;
51 X86_ECX &= 0xffff0000;
52 X86_ECX |= 0x0000; /* Use video BIOS default */
53 res = 1;
54 break;
55 case 0x5f51:
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;
64 X86_EAX |= 0x005f;
65 X86_ECX &= 0xffff0000;
66 X86_ECX |= 0x0000; /* TODO: Make this configurable in NVRAM? */
67 res = 1;
68 break;
69 case 0x5f40:
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;
77 X86_EAX |= 0x015f;
78 res = 1;
79 } else if (1 == (X86_EBX & 0xff)) {
80 X86_EAX &= 0xffff0000;
81 X86_EAX |= 0x015f;
82 res = 1;
83 } else {
84 printk(BIOS_DEBUG,
85 "Unknown panel index %u "
86 "in INT15 function %04x!\n",
87 X86_EBX & 0xff, X86_EAX & 0xffff);
89 break;
90 case 0x5f52:
92 * Panel Color Depth:
93 * 00h = 18 bit
94 * 01h = 24 bit
96 X86_EAX &= 0xffff0000;
97 X86_EAX |= 0x005f;
98 X86_ECX &= 0xffff0000;
99 X86_ECX |= 0x0001;
100 res = 1;
101 break;
102 case 0x5f14:
103 if ((X86_EBX & 0xffff) == 0x78f) {
105 * Get Miscellaneous Status Hook:
106 * bit 2: AC power active?
107 * bit 1: lid closed?
108 * bit 0: docked?
110 X86_EAX &= 0xffff0000;
111 X86_EAX |= 0x015f;
112 res = 1;
113 } else {
114 printk(BIOS_DEBUG,
115 "Unknown BX 0x%04x in INT15 function %04x!\n",
116 X86_EBX & 0xffff, X86_EAX & 0xffff);
118 break;
119 case 0x5f49:
121 * Get Inverter Type and Polarity:
122 * EBX: backlight control brightness: 0..255
123 * ECX:
124 * 0 = Enable PWM inverted, 2 = Enable PWM
125 * 1 = Enable I2C inverted, 3 = Enable I2C
127 X86_EAX &= 0xffff0000;
128 X86_EAX |= 0x015f;
129 res = 1;
130 break;
131 default:
132 printk(BIOS_DEBUG, "Unknown INT15 function %04x!\n",
133 X86_EAX & 0xffff);
134 break;
136 return res;
138 #endif
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);
147 #endif
148 unsigned int disable = get_uint_option("ethernet1", 0);
149 if (disable) {
150 struct device *nic = pcidev_on_root(0x1c, 2);
151 if (nic) {
152 printk(BIOS_DEBUG, "DISABLE FIRST NIC!\n");
153 nic->enabled = 0;
156 disable = get_uint_option("ethernet2", 0);
157 if (disable) {
158 struct device *nic = pcidev_on_root(0x1c, 3);
159 if (nic) {
160 printk(BIOS_DEBUG, "DISABLE SECOND NIC!\n");
161 nic->enabled = 0;
166 struct chip_operations mainboard_ops = {
167 .enable_dev = mainboard_enable,