blob: c6531913ae6c8ac695973fe099a4fb8470ba6a38 [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.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
22 */
Stefan Reinauer5ff7c132011-10-31 12:56:45 -070023
Josef Kellermannbfa7ee52011-05-11 07:47:43 +000024#include <stdint.h>
25#include <stdlib.h>
26#include <console/console.h>
27#include <arch/interrupt.h>
28#include "int15_func.h"
29
30int sbios_INT15_handler(struct eregs *);
31/*extern*/ unsigned long vgainfo_addr;
32
33static INT15_function_extensions __int15_func;
34
35/* System BIOS int15 function */
36int sbios_INT15_handler(struct eregs *regs)
37{
38 int res = -1;
39
40 printk(BIOS_DEBUG, "System BIOS INT 15h\n");
41
42 switch (regs->eax & 0xffff) {
43#define BOOT_DISPLAY_DEFAULT 0
44#define BOOT_DISPLAY_CRT (1 << 0)
45#define BOOT_DISPLAY_TV (1 << 1)
46#define BOOT_DISPLAY_EFP (1 << 2)
47#define BOOT_DISPLAY_LCD (1 << 3)
48#define BOOT_DISPLAY_CRT2 (1 << 4)
49#define BOOT_DISPLAY_TV2 (1 << 5)
50#define BOOT_DISPLAY_EFP2 (1 << 6)
51#define BOOT_DISPLAY_LCD2 (1 << 7)
52 case 0x5f35:
53 regs->eax = 0x5f;
54 regs->ecx = BOOT_DISPLAY_DEFAULT;
55 res = 0;
56 break;
57 case 0x5f40:
58 regs->eax = 0x5f;
59 regs->ecx = 3; // This is mainboard specific
60 printk(BIOS_DEBUG, "DISPLAY=%x\n", regs->ecx);
61 res = 0;
62 break;
63 case 0x4e08:
64 switch (regs->ebx & 0xff) {
65 case 0x00:
66 regs->eax &= ~(0xff);
67 regs->ebx = (regs->ebx & ~(0xff)) | __int15_func.regs.func00_LCD_panel_id;
68 printk(BIOS_DEBUG, "DISPLAY = %x\n", regs->ebx & 0xff);
69 res = 0;
70 break;
71 case 0x02:
72 break;
73 case 0x05:
74 regs->eax &= ~(0xff);
75 regs->ebx = (regs->ebx & ~(0xff)) | __int15_func.regs.func05_TV_standard;
76 printk(BIOS_DEBUG, "TV = %x\n", regs->ebx & 0xff);
77 res = 0;
78 break;
79 case 0x80:
80 regs->eax &= ~(0xff);
81 regs->ebx &= ~(0xff);
82 printk(BIOS_DEBUG, "Integrated System Information = %x:%x\n", regs->edx, regs->edi);
Stefan Reinauer5ff7c132011-10-31 12:56:45 -070083 vgainfo_addr = (regs->edx * 16) + regs->edi;
Josef Kellermannbfa7ee52011-05-11 07:47:43 +000084 res = 0;
85 break;
86 case 0x89:
87 regs->eax &= ~(0xff);
88 regs->ebx &= ~(0xff);
89 printk(BIOS_DEBUG, "Get supported display device information\n");
90 res = 0;
91 break;
92 default:
93 break;
94 }
95 break;
96 default:
97 printk(BIOS_DEBUG, "Unknown INT15 function %04x!\n", regs->eax & 0xffff);
98 break;
99 }
100
101 return res;
102}
103
104/* Initialization VBIOS function extensions */
105void install_INT15_function_extensions(INT15_function_extensions *int15_func)
106{
107 printk(BIOS_DEBUG, "Initialize function extensions for Callback function number 04E08h ..\n");
108 __int15_func.regs.func00_LCD_panel_id = int15_func->regs.func00_LCD_panel_id;
109 __int15_func.regs.func05_TV_standard = int15_func->regs.func05_TV_standard;
110 mainboard_interrupt_handlers(0x15, &sbios_INT15_handler);
111}