blob: b01a292411b0c625b5f19ef8babe6ebe3e96fd97 [file] [log] [blame]
Josef Kellermannbfa7ee52011-05-11 07:47:43 +00001/*
2 * This file is part of the coreboot project.
3 *
4 * Copyright (C) 2009 coresystems GmbH
5 * Copyright (C) 2009 Libra Li <libra.li@technexion.com>
6 * Copyright (C) 2010 Siemens AG, Inc.
7 * (Written by Josef Kellermann <joseph.kellermann@heitec.de> for Siemens AG, Inc.)
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
13 *
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
Josef Kellermannbfa7ee52011-05-11 07:47:43 +000018 */
Stefan Reinauer5ff7c132011-10-31 12:56:45 -070019
Josef Kellermannbfa7ee52011-05-11 07:47:43 +000020#include <stdint.h>
21#include <stdlib.h>
22#include <console/console.h>
23#include <arch/interrupt.h>
Patrick Georgi199b09c2012-11-22 12:46:12 +010024#include <x86emu/regs.h>
Josef Kellermannbfa7ee52011-05-11 07:47:43 +000025#include "int15_func.h"
26
Patrick Georgi199b09c2012-11-22 12:46:12 +010027int sbios_INT15_handler(void);
Josef Kellermannbfa7ee52011-05-11 07:47:43 +000028/*extern*/ unsigned long vgainfo_addr;
29
30static INT15_function_extensions __int15_func;
31
32/* System BIOS int15 function */
Patrick Georgi199b09c2012-11-22 12:46:12 +010033int sbios_INT15_handler(void)
Josef Kellermannbfa7ee52011-05-11 07:47:43 +000034{
Elyes HAOUASffcc07d2016-10-01 20:41:59 +020035 int res = -1;
Josef Kellermannbfa7ee52011-05-11 07:47:43 +000036
Elyes HAOUASffcc07d2016-10-01 20:41:59 +020037 printk(BIOS_DEBUG, "System BIOS INT 15h\n");
Josef Kellermannbfa7ee52011-05-11 07:47:43 +000038
Elyes HAOUASffcc07d2016-10-01 20:41:59 +020039 switch (X86_EAX & 0xffff) {
Josef Kellermannbfa7ee52011-05-11 07:47:43 +000040#define BOOT_DISPLAY_DEFAULT 0
41#define BOOT_DISPLAY_CRT (1 << 0)
42#define BOOT_DISPLAY_TV (1 << 1)
43#define BOOT_DISPLAY_EFP (1 << 2)
44#define BOOT_DISPLAY_LCD (1 << 3)
45#define BOOT_DISPLAY_CRT2 (1 << 4)
46#define BOOT_DISPLAY_TV2 (1 << 5)
47#define BOOT_DISPLAY_EFP2 (1 << 6)
48#define BOOT_DISPLAY_LCD2 (1 << 7)
49 case 0x5f35:
Patrick Georgi199b09c2012-11-22 12:46:12 +010050 X86_EAX = 0x5f;
51 X86_ECX = BOOT_DISPLAY_DEFAULT;
Josef Kellermannbfa7ee52011-05-11 07:47:43 +000052 res = 0;
53 break;
54 case 0x5f40:
Patrick Georgi199b09c2012-11-22 12:46:12 +010055 X86_EAX = 0x5f;
56 X86_ECX = 3; // This is mainboard specific
57 printk(BIOS_DEBUG, "DISPLAY=%x\n", X86_ECX);
Josef Kellermannbfa7ee52011-05-11 07:47:43 +000058 res = 0;
59 break;
Elyes HAOUASffcc07d2016-10-01 20:41:59 +020060 case 0x4e08:
61 switch (X86_EBX & 0xff) {
62 case 0x00:
63 X86_EAX &= ~(0xff);
64 X86_EBX = (X86_EBX & ~(0xff)) | __int15_func.regs.func00_LCD_panel_id;
65 printk(BIOS_DEBUG, "DISPLAY = %x\n", X86_EBX & 0xff);
66 res = 0;
67 break;
68 case 0x02:
69 break;
70 case 0x05:
71 X86_EAX &= ~(0xff);
72 X86_EBX = (X86_EBX & ~(0xff)) | __int15_func.regs.func05_TV_standard;
73 printk(BIOS_DEBUG, "TV = %x\n", X86_EBX & 0xff);
74 res = 0;
75 break;
76 case 0x80:
77 X86_EAX &= ~(0xff);
78 X86_EBX &= ~(0xff);
79 printk(BIOS_DEBUG, "Integrated System Information = %x:%x\n", X86_EDX, X86_EDI);
80 vgainfo_addr = (X86_EDX * 16) + X86_EDI;
81 res = 0;
82 break;
83 case 0x89:
84 X86_EAX &= ~(0xff);
85 X86_EBX &= ~(0xff);
86 printk(BIOS_DEBUG, "Get supported display device information\n");
87 res = 0;
88 break;
89 default:
90 break;
91 }
92 break;
Josef Kellermannbfa7ee52011-05-11 07:47:43 +000093 default:
Elyes HAOUASffcc07d2016-10-01 20:41:59 +020094 printk(BIOS_DEBUG, "Unknown INT15 function %04x!\n", X86_EAX & 0xffff);
Josef Kellermannbfa7ee52011-05-11 07:47:43 +000095 break;
Elyes HAOUASffcc07d2016-10-01 20:41:59 +020096 }
Josef Kellermannbfa7ee52011-05-11 07:47:43 +000097
Elyes HAOUASffcc07d2016-10-01 20:41:59 +020098 return res;
Josef Kellermannbfa7ee52011-05-11 07:47:43 +000099}
100
101/* Initialization VBIOS function extensions */
102void install_INT15_function_extensions(INT15_function_extensions *int15_func)
103{
104 printk(BIOS_DEBUG, "Initialize function extensions for Callback function number 04E08h ..\n");
105 __int15_func.regs.func00_LCD_panel_id = int15_func->regs.func00_LCD_panel_id;
106 __int15_func.regs.func05_TV_standard = int15_func->regs.func05_TV_standard;
107 mainboard_interrupt_handlers(0x15, &sbios_INT15_handler);
108}