mb/google/brya: Create rull variant
[coreboot2.git] / src / drivers / intel / gma / int15.c
bloba7f3fdc18a4ce68ed1b9eb1593bdd8b293f27de2
1 /* SPDX-License-Identifier: GPL-2.0-only */
3 #include <x86emu/x86emu.h>
4 #include <arch/interrupt.h>
5 #include <console/console.h>
7 #include "int15.h"
9 static int active_lfp, pfit, display, panel_type;
11 int intel_vga_int15_handler(void)
13 int res = 0;
15 printk(BIOS_DEBUG, "%s: AX=%04x BX=%04x CX=%04x DX=%04x\n",
16 __func__, X86_AX, X86_BX, X86_CX, X86_DX);
18 switch (X86_AX) {
19 case 0x5f34:
21 * Set Panel Fitting Hook:
22 * bit 2 = Graphics Stretching
23 * bit 1 = Text Stretching
24 * bit 0 = Centering (do not set with bit1 or bit2)
25 * 0 = video BIOS default
27 X86_AX = 0x005f;
28 X86_CX = pfit;
29 res = 1;
30 break;
31 case 0x5f35:
33 * Boot Display Device Hook:
34 * bit 0 = CRT
35 * bit 1 = TV (eDP) *
36 * bit 2 = EFP *
37 * bit 3 = LFP
38 * bit 4 = CRT2
39 * bit 5 = TV2 (eDP) *
40 * bit 6 = EFP2 *
41 * bit 7 = LFP2
43 X86_AX = 0x005f;
44 X86_CX = display;
45 res = 1;
46 break;
47 case 0x5f40: /* Boot Panel Type */
48 X86_AX = 0x005f; // Success
49 X86_CL = panel_type;
50 printk(BIOS_DEBUG, "DISPLAY=%x\n", X86_CL);
51 res = 1;
52 break;
53 case 0x5f51:
55 * Hook to select active LFP configuration:
56 * 00h = No LVDS, VBIOS does not enable LVDS
57 * 01h = Int-LVDS, LFP driven by integrated LVDS decoder
58 * 02h = SVDO-LVDS, LFP driven by SVDO decoder
59 * 03h = eDP, LFP Driven by Int-DisplayPort encoder
61 X86_AX = 0x005f;
62 X86_CX = active_lfp;
63 res = 1;
64 break;
65 case 0x5f70:
66 switch ((X86_CX >> 8) & 0xff) {
67 case 0:
68 /* Get Mux */
69 X86_AX = 0x005f;
70 X86_CX = 0x0000;
71 res = 1;
72 break;
73 case 1:
74 /* Set Mux */
75 X86_AX = 0x005f;
76 X86_CX = 0x0000;
77 res = 1;
78 break;
79 case 2:
80 /* Get SG/Non-SG mode */
81 X86_AX = 0x005f;
82 X86_CX = 0x0000;
83 res = 1;
84 break;
85 default:
86 /* Interrupt was not handled */
87 printk(BIOS_DEBUG,
88 "Unknown INT15 5f70 function: 0x%02x\n",
89 ((X86_CX >> 8) & 0xff));
90 break;
92 break;
94 default:
95 printk(BIOS_DEBUG, "Unknown INT15 function %04x!\n", X86_AX);
96 break;
98 return res;
101 void install_intel_vga_int15_handler(int active_lfp_, int pfit_, int display_, int panel_type_)
103 active_lfp = active_lfp_;
104 pfit = pfit_;
105 display = display_;
106 panel_type = panel_type_;
107 mainboard_interrupt_handlers(0x15, &intel_vga_int15_handler);