Author: stepan
Date: Sun Apr 11 22:04:50 2010
New Revision: 5408
URL: https://tracker.coreboot.org/trac/coreboot/changeset/5408

Log:
add int15  handler for thomson ip1000
fix mbi length detection, this will remove what looked like an endless loop
during vga init in some cases.
Signed-off-by: Stefan Reinauer <[email protected]>
Acked-by: Stefan Reinauer <[email protected]>

Modified:
   trunk/src/mainboard/thomson/ip1000/mainboard.c
   trunk/src/northbridge/intel/i82830/i82830_smihandler.c
   trunk/src/northbridge/intel/i82830/vga.c

Modified: trunk/src/mainboard/thomson/ip1000/mainboard.c
==============================================================================
--- trunk/src/mainboard/thomson/ip1000/mainboard.c      Sun Apr 11 22:02:47 
2010        (r5407)
+++ trunk/src/mainboard/thomson/ip1000/mainboard.c      Sun Apr 11 22:04:50 
2010        (r5408)
@@ -22,6 +22,9 @@
 #include <device/device.h>
 #include <boot/tables.h>
 #include <delay.h>
+#if CONFIG_PCI_OPTION_ROM_RUN_YABEL
+#include <x86emu/x86emu.h>
+#endif
 #include <arch/coreboot_tables.h>
 #include <arch/io.h>
 #include "chip.h"
@@ -102,6 +105,61 @@
        }
 }
 
+
+#if CONFIG_PCI_OPTION_ROM_RUN_YABEL
+static int int15_handler(void)
+{
+       u8 display_id;
+#define BOOT_DISPLAY_DEFAULT   0
+#define BOOT_DISPLAY_CRT       (1 << 0)
+#define BOOT_DISPLAY_TV                (1 << 1)
+#define BOOT_DISPLAY_EFP       (1 << 2)
+#define BOOT_DISPLAY_LCD       (1 << 3)
+#define BOOT_DISPLAY_CRT2      (1 << 4)
+#define BOOT_DISPLAY_TV2       (1 << 5)
+#define BOOT_DISPLAY_EFP2      (1 << 6)
+#define BOOT_DISPLAY_LCD2      (1 << 7)
+
+       printk(BIOS_DEBUG, "%s: AX=%04x BX=%04x CX=%04x DX=%04x\n",
+                         __func__, M.x86.R_AX, M.x86.R_BX, M.x86.R_CX, 
M.x86.R_DX);
+
+       switch (M.x86.R_AX) {
+       case 0x5f35: /* Boot Display */
+               M.x86.R_AX = 0x005f; // Success
+               // M.x86.R_CL = BOOT_DISPLAY_TV;
+               M.x86.R_CL = BOOT_DISPLAY_DEFAULT;
+               break;
+       case 0x5f36: /* Boot TV Format Hook */
+               printk(BIOS_DEBUG, "Boot TV Format Hook. TODO\n");
+               /* Interrupt was not handled */
+               return 0;
+       case 0x5f31: /* Post Completion Hook */
+       case 0x5f33: /* Hook After Mode Set */
+       case 0x5f34: /* Set Panel Fitting Hook */
+       case 0x5f38: /* Hook Before Mode Set */
+       case 0x5f45: /* Hook Before VESA VBE/DDC */
+       case 0x5f46: /* Hook Before VESA VBE/PM */
+       case 0x5f47: /* Notif Display Switch Hook */
+       case 0x5f65: /* Local Memory Initialization Hook */
+               /* Interrupt was not handled */
+               return 0;
+       default:
+               /* Interrupt was not handled */
+               return 0;
+       }
+
+       /* Interrupt handled */
+       return 1;
+}
+
+static void int15_install(void)
+{
+       typedef int (* yabel_handleIntFunc)(void);
+       extern yabel_handleIntFunc yabel_intFuncArray[256];
+       yabel_intFuncArray[0x15] = int15_handler;
+}
+#endif
+
 static void mainboard_init(device_t dev)
 {
        parport_gpios();
@@ -111,6 +169,10 @@
 static void mainboard_enable(device_t dev)
 {
        dev->ops->init = mainboard_init;
+#if CONFIG_PCI_OPTION_ROM_RUN_YABEL
+       /* Install custom int15 handler for VGA OPROM */
+       int15_install();
+#endif
 }
 
 struct chip_operations mainboard_ops = {

Modified: trunk/src/northbridge/intel/i82830/i82830_smihandler.c
==============================================================================
--- trunk/src/northbridge/intel/i82830/i82830_smihandler.c      Sun Apr 11 
22:02:47 2010        (r5407)
+++ trunk/src/northbridge/intel/i82830/i82830_smihandler.c      Sun Apr 11 
22:04:50 2010        (r5408)
@@ -187,7 +187,7 @@
                int i, count=0;
                obj_header->banner.retsts = MSH_IF_NOT_FOUND;
 
-               for (i=0; i< mbi_len;) {
+               for (i=0; i<mbi_len;) {
                        int len;
 
                        if (!(mbi[i] == 0xf0 && mbi [i+1] == 0xf6)) {
@@ -199,6 +199,12 @@
                        len = ALIGN((mbi_header->size * 16) + 
sizeof(mbi_header) + mbi_header->name_len, 16);
                        
                        if (obj_header->objnum == count) {
+#ifdef DEBUG_SMI_I82830
+                               if (mbi_header->name_len == 0xff) {
+                                       printk(BIOS_DEBUG, "|  |- corrupt.\n");
+                                       break;
+                               }
+#endif
                                int headerlen = ALIGN(sizeof(mbi_header) + 
mbi_header->name_len + 15, 16);
 #ifdef DEBUG_SMI_I82830
                                printk(BIOS_DEBUG, "|  |- headerlen = %d\n", 
headerlen);

Modified: trunk/src/northbridge/intel/i82830/vga.c
==============================================================================
--- trunk/src/northbridge/intel/i82830/vga.c    Sun Apr 11 22:02:47 2010        
(r5407)
+++ trunk/src/northbridge/intel/i82830/vga.c    Sun Apr 11 22:04:50 2010        
(r5408)
@@ -42,7 +42,7 @@
                               "type %x\n", file->type, CBFS_TYPE_MBI);
                } else {
                        mbi = (void *) CBFS_SUBHEADER(file);
-                       mbi_len = file->len;
+                       mbi_len = ntohl(file->len);
                }
        } else {
                printk(BIOS_INFO,  "Could not find MBI.\n");

-- 
coreboot mailing list: [email protected]
http://www.coreboot.org/mailman/listinfo/coreboot

Reply via email to