blob: 62abbc11a6cbf3376bf8211b5dae26c48d6f04f5 [file] [log] [blame]
Angel Pons4cedb8c2021-05-17 18:46:41 +02001/* SPDX-License-Identifier: GPL-2.0-only */
2
3#include <arch/interrupt.h>
4#include <console/console.h>
5#include <soc/int15.h>
6#include <x86emu/x86emu.h>
7
8static int int15_handler(void)
9{
10 int res = 1;
11
12 printk(BIOS_DEBUG, "%s: AX=%04x BX=%04x CX=%04x DX=%04x\n",
13 __func__, X86_AX, X86_BX, X86_CX, X86_DX);
14
15 switch (X86_AX) {
16 case 0x5f34:
17 /*
18 * Set Panel Fitting Hook:
19 * bit 2 = Graphics Stretching
20 * bit 1 = Text Stretching
21 * bit 0 = Centering (do not set with bit1 or bit2)
22 * 0 = video BIOS default
23 */
24 X86_AX = 0x005f;
25 X86_CX = 0x0001;
26 res = 1;
27 break;
28 case 0x5f35:
29 /*
30 * Boot Display Device Hook:
31 * bit 0 = CRT
32 * bit 1 = TV
33 * bit 2 = EFP (HDMI)
34 * bit 3 = LFP (eDP)*
35 * bit 4 = CRT2
36 * bit 5 = TV2
37 * bit 6 = EFP2
38 * bit 7 = LFP2
39 */
40 X86_AX = 0x005f;
41 X86_CX = 0x0008;
42 res = 1;
43 break;
44 case 0x5f51:
45 /*
46 * Hook to select active LFP configuration:
47 * 00h = No LVDS, VBIOS does not enable LVDS
48 * 01h = Int-LVDS, LFP driven by integrated LVDS decoder
49 * 02h = SVDO-LVDS, LFP driven by SVDO decoder
50 * 03h = eDP, LFP Driven by Int-DisplayPort encoder
51 */
52 X86_AX = 0x005f;
53 X86_CX = 0x0003;
54 res = 1;
55 break;
56 case 0x5f70:
57 switch ((X86_CX >> 8) & 0xff) {
58 case 0:
59 /* Get Mux */
60 X86_AX = 0x005f;
61 X86_CX = 0x0000;
62 res = 1;
63 break;
64 case 1:
65 /* Set Mux */
66 X86_AX = 0x005f;
67 X86_CX = 0x0000;
68 res = 1;
69 break;
70 case 2:
71 /* Get SG/Non-SG mode */
72 X86_AX = 0x005f;
73 X86_CX = 0x0000;
74 res = 1;
75 break;
76 default:
77 /* Interrupt was not handled */
78 printk(BIOS_DEBUG,
79 "Unknown INT15 5f70 function: 0x%02x\n",
80 ((X86_CX >> 8) & 0xff));
81 break;
82 }
83 break;
84
85 default:
86 printk(BIOS_DEBUG, "Unknown INT15 function %04x!\n", X86_AX);
87 break;
88 }
89 return res;
90}
91
92void install_baytrail_vga_int15_handler(void)
93{
94 mainboard_interrupt_handlers(0x15, &int15_handler);
95}