x86 realmode: Use x86emu register file + defines

By using the (global) register file as defined by x86emu,
we can use the same register access for YABEL and realmode
interrupt handlers.

- the x86 realmode interrupt handlers changed in signature
- to access registers, use X86_$REGNAME now (eg. X86_EAX)
- x86_exception_handler still uses struct eregs *regs to
  avoid spilling the x86emu register file stuff everywhere

Coccinelle script that handled most of this commit:
  @ inthandler @
  identifier FUNC, regs;
  @@
  int FUNC(
  -struct eregs *regs
  +void
   )
  { ... }

  @ depends on inthandler @
  identifier regs;
  @@
  -regs->eax
  +X86_EAX

  @ depends on inthandler @
  identifier regs;
  @@
  -regs->ebx
  +X86_EBX

  @ depends on inthandler @
  identifier regs;
  @@
  -regs->ecx
  +X86_ECX

  @ depends on inthandler @
  identifier regs;
  @@
  -regs->edx
  +X86_EDX

  @ depends on inthandler @
  identifier regs;
  @@
  -regs->esi
  +X86_ESI

  @ depends on inthandler @
  identifier regs;
  @@
  -regs->edi
  +X86_EDI

  @ depends on inthandler @
  identifier regs;
  @@
  -regs->eflags
  +X86_EFLAGS

  @ depends on inthandler @
  identifier regs;
  @@
  -regs->vector
  +M.x86.intno

Change-Id: I60cc2c36646fe4b7f97457b1e297e3df086daa36
Signed-off-by: Patrick Georgi <patrick.georgi@secunet.com>
Reviewed-on: http://review.coreboot.org/1891
Tested-by: build bot (Jenkins)
Reviewed-by: Stefan Reinauer <stefan.reinauer@coreboot.org>
This commit is contained in:
Patrick Georgi 2012-11-22 12:46:12 +01:00 committed by Stefan Reinauer
parent 503af721a1
commit 199b09cb7a
15 changed files with 333 additions and 305 deletions

View File

@ -31,6 +31,11 @@
#include "x86.h" #include "x86.h"
#include "vbe.h" #include "vbe.h"
#include <lib/jpeg.h> #include <lib/jpeg.h>
/* we use x86emu's register file representation */
#include <x86emu/regs.h>
/* to have a common register file for interrupt handlers */
X86EMU_sysEnv _X86EMU_env;
void (*realmode_call)(u32 addr, u32 eax, u32 ebx, u32 ecx, u32 edx, void (*realmode_call)(u32 addr, u32 eax, u32 ebx, u32 ecx, u32 edx,
u32 esi, u32 edi) __attribute__((regparm(0))) = u32 esi, u32 edi) __attribute__((regparm(0))) =
@ -52,10 +57,28 @@ static void setup_rombios(void)
write8(0xffffe, 0xfc); write8(0xffffe, 0xfc);
} }
int (*intXX_handler[256])(struct eregs *regs) = { NULL }; static int (*intXX_handler[256])(void) = { NULL };
static int intXX_exception_handler(struct eregs *regs) static int intXX_exception_handler(void)
{ {
/* compatibility shim */
struct eregs reg_info = {
.eax=X86_EAX,
.ecx=X86_ECX,
.edx=X86_EDX,
.ebx=X86_EBX,
.esp=X86_ESP,
.ebp=X86_EBP,
.esi=X86_ESI,
.edi=X86_EDI,
.vector=M.x86.intno,
.error_code=0, // FIXME: fill in
.eip=X86_EIP,
.cs=X86_CS,
.eflags=X86_EFLAGS
};
struct eregs *regs = &reg_info;
printk(BIOS_INFO, "Oops, exception %d while executing option rom\n", printk(BIOS_INFO, "Oops, exception %d while executing option rom\n",
regs->vector); regs->vector);
x86_exception(regs); // Call coreboot exception handler x86_exception(regs); // Call coreboot exception handler
@ -63,10 +86,10 @@ static int intXX_exception_handler(struct eregs *regs)
return 0; // Never really returns return 0; // Never really returns
} }
static int intXX_unknown_handler(struct eregs *regs) static int intXX_unknown_handler(void)
{ {
printk(BIOS_INFO, "Unsupported software interrupt #0x%x eax 0x%x\n", printk(BIOS_INFO, "Unsupported software interrupt #0x%x eax 0x%x\n",
regs->vector, regs->eax); M.x86.intno, X86_EAX);
return -1; return -1;
} }
@ -403,7 +426,6 @@ int __attribute__((regparm(0))) interrupt_handler(u32 intnumber,
u32 cs; u32 cs;
u32 flags; u32 flags;
int ret = 0; int ret = 0;
struct eregs reg_info;
ip = cs_ip & 0xffff; ip = cs_ip & 0xffff;
cs = cs_ip >> 16; cs = cs_ip >> 16;
@ -419,27 +441,24 @@ int __attribute__((regparm(0))) interrupt_handler(u32 intnumber,
ip, cs, flags); ip, cs, flags);
#endif #endif
// Fetch arguments from the stack and put them into // Fetch arguments from the stack and put them to a place
// a structure that we want to pass on to our sub interrupt // suitable for the interrupt handlers
// handlers. X86_EAX = eax;
reg_info = (struct eregs) { X86_ECX = ecx;
.eax=eax, X86_EDX = edx;
.ecx=ecx, X86_EBX = ebx;
.edx=edx, X86_ESP = esp;
.ebx=ebx, X86_EBP = ebp;
.esp=esp, X86_ESI = esi;
.ebp=ebp, X86_EDI = edi;
.esi=esi, M.x86.intno = intnumber;
.edi=edi, /* TODO: error_code must be stored somewhere */
.vector=intnumber, X86_EIP = ip;
.error_code=0, // ?? X86_CS = cs;
.eip=ip, X86_EFLAGS = flags;
.cs=cs,
.eflags=flags // ??
};
// Call the interrupt handler for this int# // Call the interrupt handler for this int#
ret = intXX_handler[intnumber](&reg_info); ret = intXX_handler[intnumber]();
// Put registers back on the stack. The assembler code // Put registers back on the stack. The assembler code
// will later pop them. // will later pop them.
@ -447,13 +466,13 @@ int __attribute__((regparm(0))) interrupt_handler(u32 intnumber,
// the values of the parameters of this function. We do this // the values of the parameters of this function. We do this
// because we know that they stay alive on the stack after // because we know that they stay alive on the stack after
// we leave this function. Don't say this is bollocks. // we leave this function. Don't say this is bollocks.
*(volatile u32 *)&eax = reg_info.eax; *(volatile u32 *)&eax = X86_EAX;
*(volatile u32 *)&ecx = reg_info.ecx; *(volatile u32 *)&ecx = X86_ECX;
*(volatile u32 *)&edx = reg_info.edx; *(volatile u32 *)&edx = X86_EDX;
*(volatile u32 *)&ebx = reg_info.ebx; *(volatile u32 *)&ebx = X86_EBX;
*(volatile u32 *)&esi = reg_info.esi; *(volatile u32 *)&esi = X86_ESI;
*(volatile u32 *)&edi = reg_info.edi; *(volatile u32 *)&edi = X86_EDI;
flags = reg_info.eflags; flags = X86_EFLAGS;
/* Pass success or error back to our caller via the CARRY flag */ /* Pass success or error back to our caller via the CARRY flag */
if (ret) { if (ret) {

View File

@ -42,8 +42,8 @@ extern void (*realmode_interrupt)(u32 intno, u32 eax, u32 ebx, u32 ecx, u32 edx,
#define INITIAL_EBDA_SEGMENT 0xF600 #define INITIAL_EBDA_SEGMENT 0xF600
#define INITIAL_EBDA_SIZE 0x400 #define INITIAL_EBDA_SIZE 0x400
int int10_handler(struct eregs *regs); int int10_handler(void);
int int12_handler(struct eregs *regs); int int12_handler(void);
int int16_handler(struct eregs *regs); int int16_handler(void);
int int1a_handler(struct eregs *regs); int int1a_handler(void);

View File

@ -27,6 +27,8 @@
#include <arch/io.h> #include <arch/io.h>
#include <arch/registers.h> #include <arch/registers.h>
#include "x86.h" #include "x86.h"
/* we use x86emu's register file representation */
#include <x86emu/regs.h>
// errors go in AH. Just set these up so that word assigns // errors go in AH. Just set these up so that word assigns
// will work. KISS. // will work. KISS.
@ -38,27 +40,27 @@ enum {
PCIBIOS_BADREG = 0x8700 PCIBIOS_BADREG = 0x8700
}; };
int int10_handler(struct eregs *regs) int int10_handler(void)
{ {
int res=0; int res=0;
static u8 cursor_row=0, cursor_col=0; static u8 cursor_row=0, cursor_col=0;
switch((regs->eax & 0xff00)>>8) { switch((X86_EAX & 0xff00)>>8) {
case 0x01: // Set cursor shape case 0x01: // Set cursor shape
res = 1; res = 1;
break; break;
case 0x02: // Set cursor position case 0x02: // Set cursor position
if (cursor_row != ((regs->edx >> 8) & 0xff) || if (cursor_row != ((X86_EDX >> 8) & 0xff) ||
cursor_col >= (regs->edx & 0xff)) { cursor_col >= (X86_EDX & 0xff)) {
printk(BIOS_INFO, "\n"); printk(BIOS_INFO, "\n");
} }
cursor_row = (regs->edx >> 8) & 0xff; cursor_row = (X86_EDX >> 8) & 0xff;
cursor_col = regs->edx & 0xff; cursor_col = X86_EDX & 0xff;
res = 1; res = 1;
break; break;
case 0x03: // Get cursor position case 0x03: // Get cursor position
regs->eax &= 0x00ff; X86_EAX &= 0x00ff;
regs->ecx = 0x0607; X86_ECX = 0x0607;
regs->edx = (cursor_row << 8) | cursor_col; X86_EDX = (cursor_row << 8) | cursor_col;
res = 1; res = 1;
break; break;
case 0x06: // Scroll up case 0x06: // Scroll up
@ -66,48 +68,48 @@ int int10_handler(struct eregs *regs)
res = 1; res = 1;
break; break;
case 0x08: // Get Character and Mode at Cursor Position case 0x08: // Get Character and Mode at Cursor Position
regs->eax = 0x0f00 | 'A'; // White on black 'A' X86_EAX = 0x0f00 | 'A'; // White on black 'A'
res = 1; res = 1;
break; break;
case 0x09: // Write Character and attribute case 0x09: // Write Character and attribute
case 0x0e: // Write Character case 0x0e: // Write Character
printk(BIOS_INFO, "%c", regs->eax & 0xff); printk(BIOS_INFO, "%c", X86_EAX & 0xff);
res = 1; res = 1;
break; break;
case 0x0f: // Get video mode case 0x0f: // Get video mode
regs->eax = 0x5002; //80x25 X86_EAX = 0x5002; //80x25
regs->ebx &= 0x00ff; X86_EBX &= 0x00ff;
res = 1; res = 1;
break; break;
default: default:
printk(BIOS_WARNING, "Unknown INT10 function %04x!\n", printk(BIOS_WARNING, "Unknown INT10 function %04x!\n",
regs->eax & 0xffff); X86_EAX & 0xffff);
break; break;
} }
return res; return res;
} }
int int12_handler(struct eregs *regs) int int12_handler(void)
{ {
regs->eax = 64 * 1024; X86_EAX = 64 * 1024;
return 1; return 1;
} }
int int16_handler(struct eregs *regs) int int16_handler(void)
{ {
int res=0; int res=0;
switch((regs->eax & 0xff00)>>8) { switch((X86_EAX & 0xff00)>>8) {
case 0x00: // Check for Keystroke case 0x00: // Check for Keystroke
regs->eax = 0x6120; // Space Bar, Space X86_EAX = 0x6120; // Space Bar, Space
res = 1; res = 1;
break; break;
case 0x01: // Check for Keystroke case 0x01: // Check for Keystroke
regs->eflags |= 1<<6; // Zero Flag set (no key available) X86_EFLAGS |= 1<<6; // Zero Flag set (no key available)
res = 1; res = 1;
break; break;
default: default:
printk(BIOS_WARNING, "Unknown INT16 function %04x!\n", printk(BIOS_WARNING, "Unknown INT16 function %04x!\n",
regs->eax & 0xffff); X86_EAX & 0xffff);
break; break;
} }
return res; return res;
@ -116,9 +118,9 @@ int int16_handler(struct eregs *regs)
#define PCI_CONFIG_SPACE_TYPE1 (1 << 0) #define PCI_CONFIG_SPACE_TYPE1 (1 << 0)
#define PCI_SPECIAL_CYCLE_TYPE1 (1 << 4) #define PCI_SPECIAL_CYCLE_TYPE1 (1 << 4)
int int1a_handler(struct eregs *regs) int int1a_handler(void)
{ {
unsigned short func = (unsigned short)regs->eax; unsigned short func = (unsigned short)X86_EAX;
int retval = 1; int retval = 1;
unsigned short devid, vendorid, devfn; unsigned short devid, vendorid, devfn;
/* Use short to get rid of gabage in upper half of 32-bit register */ /* Use short to get rid of gabage in upper half of 32-bit register */
@ -131,19 +133,19 @@ int int1a_handler(struct eregs *regs)
switch (func) { switch (func) {
case 0xb101: /* PCIBIOS Check */ case 0xb101: /* PCIBIOS Check */
regs->edx = 0x20494350; /* ' ICP' */ X86_EDX = 0x20494350; /* ' ICP' */
regs->eax &= 0xffff0000; /* Clear AH / AL */ X86_EAX &= 0xffff0000; /* Clear AH / AL */
regs->eax |= PCI_CONFIG_SPACE_TYPE1 | PCI_SPECIAL_CYCLE_TYPE1; X86_EAX |= PCI_CONFIG_SPACE_TYPE1 | PCI_SPECIAL_CYCLE_TYPE1;
// last bus in the system. Hard code to 255 for now. // last bus in the system. Hard code to 255 for now.
// dev_enumerate() does not seem to tell us (publically) // dev_enumerate() does not seem to tell us (publically)
regs->ecx = 0xff; X86_ECX = 0xff;
regs->edi = 0x00000000; /* protected mode entry */ X86_EDI = 0x00000000; /* protected mode entry */
retval = 1; retval = 1;
break; break;
case 0xb102: /* Find Device */ case 0xb102: /* Find Device */
devid = regs->ecx; devid = X86_ECX;
vendorid = regs->edx; vendorid = X86_EDX;
devindex = regs->esi; devindex = X86_ESI;
dev = 0; dev = 0;
while ((dev = dev_find_device(vendorid, devid, dev))) { while ((dev = dev_find_device(vendorid, devid, dev))) {
if (devindex <= 0) if (devindex <= 0)
@ -152,18 +154,18 @@ int int1a_handler(struct eregs *regs)
} }
if (dev) { if (dev) {
unsigned short busdevfn; unsigned short busdevfn;
regs->eax &= 0xffff00ff; /* Clear AH */ X86_EAX &= 0xffff00ff; /* Clear AH */
regs->eax |= PCIBIOS_SUCCESSFUL; X86_EAX |= PCIBIOS_SUCCESSFUL;
// busnum is an unsigned char; // busnum is an unsigned char;
// devfn is an int, so we mask it off. // devfn is an int, so we mask it off.
busdevfn = (dev->bus->secondary << 8) busdevfn = (dev->bus->secondary << 8)
| (dev->path.pci.devfn & 0xff); | (dev->path.pci.devfn & 0xff);
printk(BIOS_DEBUG, "0x%x: return 0x%x\n", func, busdevfn); printk(BIOS_DEBUG, "0x%x: return 0x%x\n", func, busdevfn);
regs->ebx = busdevfn; X86_EBX = busdevfn;
retval = 1; retval = 1;
} else { } else {
regs->eax &= 0xffff00ff; /* Clear AH */ X86_EAX &= 0xffff00ff; /* Clear AH */
regs->eax |= PCIBIOS_NODEV; X86_EAX |= PCIBIOS_NODEV;
retval = 0; retval = 0;
} }
break; break;
@ -173,57 +175,57 @@ int int1a_handler(struct eregs *regs)
case 0xb10d: /* Write Config Dword */ case 0xb10d: /* Write Config Dword */
case 0xb10c: /* Write Config Word */ case 0xb10c: /* Write Config Word */
case 0xb10b: /* Write Config Byte */ case 0xb10b: /* Write Config Byte */
devfn = regs->ebx & 0xff; devfn = X86_EBX & 0xff;
bus = regs->ebx >> 8; bus = X86_EBX >> 8;
reg = regs->edi; reg = X86_EDI;
dev = dev_find_slot(bus, devfn); dev = dev_find_slot(bus, devfn);
if (!dev) { if (!dev) {
printk(BIOS_DEBUG, "0x%x: BAD DEVICE bus %d devfn 0x%x\n", func, bus, devfn); printk(BIOS_DEBUG, "0x%x: BAD DEVICE bus %d devfn 0x%x\n", func, bus, devfn);
// Or are we supposed to return PCIBIOS_NODEV? // Or are we supposed to return PCIBIOS_NODEV?
regs->eax &= 0xffff00ff; /* Clear AH */ X86_EAX &= 0xffff00ff; /* Clear AH */
regs->eax |= PCIBIOS_BADREG; X86_EAX |= PCIBIOS_BADREG;
retval = 0; retval = 0;
return retval; return retval;
} }
switch (func) { switch (func) {
case 0xb108: /* Read Config Byte */ case 0xb108: /* Read Config Byte */
byte = pci_read_config8(dev, reg); byte = pci_read_config8(dev, reg);
regs->ecx = byte; X86_ECX = byte;
break; break;
case 0xb109: /* Read Config Word */ case 0xb109: /* Read Config Word */
word = pci_read_config16(dev, reg); word = pci_read_config16(dev, reg);
regs->ecx = word; X86_ECX = word;
break; break;
case 0xb10a: /* Read Config Dword */ case 0xb10a: /* Read Config Dword */
dword = pci_read_config32(dev, reg); dword = pci_read_config32(dev, reg);
regs->ecx = dword; X86_ECX = dword;
break; break;
case 0xb10b: /* Write Config Byte */ case 0xb10b: /* Write Config Byte */
byte = regs->ecx; byte = X86_ECX;
pci_write_config8(dev, reg, byte); pci_write_config8(dev, reg, byte);
break; break;
case 0xb10c: /* Write Config Word */ case 0xb10c: /* Write Config Word */
word = regs->ecx; word = X86_ECX;
pci_write_config16(dev, reg, word); pci_write_config16(dev, reg, word);
break; break;
case 0xb10d: /* Write Config Dword */ case 0xb10d: /* Write Config Dword */
dword = regs->ecx; dword = X86_ECX;
pci_write_config32(dev, reg, dword); pci_write_config32(dev, reg, dword);
break; break;
} }
#if CONFIG_REALMODE_DEBUG #if CONFIG_REALMODE_DEBUG
printk(BIOS_DEBUG, "0x%x: bus %d devfn 0x%x reg 0x%x val 0x%x\n", printk(BIOS_DEBUG, "0x%x: bus %d devfn 0x%x reg 0x%x val 0x%x\n",
func, bus, devfn, reg, regs->ecx); func, bus, devfn, reg, X86_ECX);
#endif #endif
regs->eax &= 0xffff00ff; /* Clear AH */ X86_EAX &= 0xffff00ff; /* Clear AH */
regs->eax |= PCIBIOS_SUCCESSFUL; X86_EAX |= PCIBIOS_SUCCESSFUL;
retval = 1; retval = 1;
break; break;
default: default:
printk(BIOS_ERR, "UNSUPPORTED PCIBIOS FUNCTION 0x%x\n", func); printk(BIOS_ERR, "UNSUPPORTED PCIBIOS FUNCTION 0x%x\n", func);
regs->eax &= 0xffff00ff; /* Clear AH */ X86_EAX &= 0xffff00ff; /* Clear AH */
regs->eax |= PCIBIOS_UNSUPPORTED; X86_EAX |= PCIBIOS_UNSUPPORTED;
retval = 0; retval = 0;
break; break;
} }

View File

@ -25,7 +25,7 @@
#include <device/pci_def.h> #include <device/pci_def.h>
#include <device/pci_ops.h> #include <device/pci_ops.h>
#include <console/console.h> #include <console/console.h>
#if defined(CONFIG_PCI_OPTION_ROM_RUN_YABEL) && CONFIG_PCI_OPTION_ROM_RUN_YABEL #if CONFIG_PCI_ROM_RUN || CONFIG_VGA_ROM_RUN
#include <x86emu/x86emu.h> #include <x86emu/x86emu.h>
#endif #endif
#include <pc80/mc146818rtc.h> #include <pc80/mc146818rtc.h>
@ -43,14 +43,14 @@ void mainboard_suspend_resume(void)
} }
#if defined(CONFIG_PCI_OPTION_ROM_RUN_REALMODE) && CONFIG_PCI_OPTION_ROM_RUN_REALMODE #if defined(CONFIG_PCI_OPTION_ROM_RUN_REALMODE) && CONFIG_PCI_OPTION_ROM_RUN_REALMODE
static int int15_handler(struct eregs *regs) static int int15_handler(void)
{ {
int res=0; int res=0;
printk(BIOS_DEBUG, "%s: INT15 function %04x!\n", printk(BIOS_DEBUG, "%s: INT15 function %04x!\n",
__func__, regs->eax & 0xffff); __func__, X86_EAX & 0xffff);
switch(regs->eax & 0xffff) { switch(X86_EAX & 0xffff) {
case 0x5f34: case 0x5f34:
/* /*
* Set Panel Fitting Hook: * Set Panel Fitting Hook:
@ -59,10 +59,10 @@ static int int15_handler(struct eregs *regs)
* bit 0 = Centering (do not set with bit1 or bit2) * bit 0 = Centering (do not set with bit1 or bit2)
* 0 = video bios default * 0 = video bios default
*/ */
regs->eax &= 0xffff0000; X86_EAX &= 0xffff0000;
regs->eax |= 0x005f; X86_EAX |= 0x005f;
regs->ecx &= 0xffffff00; X86_ECX &= 0xffffff00;
regs->ecx |= 0x01; X86_ECX |= 0x01;
res = 1; res = 1;
break; break;
case 0x5f35: case 0x5f35:
@ -77,10 +77,10 @@ static int int15_handler(struct eregs *regs)
* bit 6 = EFP2 * * bit 6 = EFP2 *
* bit 7 = LFP2 * bit 7 = LFP2
*/ */
regs->eax &= 0xffff0000; X86_EAX &= 0xffff0000;
regs->eax |= 0x005f; X86_EAX |= 0x005f;
regs->ecx &= 0xffff0000; X86_ECX &= 0xffff0000;
regs->ecx |= 0x0000; X86_ECX |= 0x0000;
res = 1; res = 1;
break; break;
case 0x5f51: case 0x5f51:
@ -91,49 +91,49 @@ static int int15_handler(struct eregs *regs)
* 02h = SVDO-LVDS, LFP driven by SVDO decoder * 02h = SVDO-LVDS, LFP driven by SVDO decoder
* 03h = eDP, LFP Driven by Int-DisplayPort encoder * 03h = eDP, LFP Driven by Int-DisplayPort encoder
*/ */
regs->eax &= 0xffff0000; X86_EAX &= 0xffff0000;
regs->eax |= 0x005f; X86_EAX |= 0x005f;
regs->ecx &= 0xffff0000; X86_ECX &= 0xffff0000;
regs->ecx |= 0x0003; X86_ECX |= 0x0003;
res = 1; res = 1;
break; break;
case 0x5f70: case 0x5f70:
switch ((regs->ecx >> 8) & 0xff) { switch ((X86_ECX >> 8) & 0xff) {
case 0: case 0:
/* Get Mux */ /* Get Mux */
regs->eax &= 0xffff0000; X86_EAX &= 0xffff0000;
regs->eax |= 0x005f; X86_EAX |= 0x005f;
regs->ecx &= 0xffff0000; X86_ECX &= 0xffff0000;
regs->ecx |= 0x0000; X86_ECX |= 0x0000;
res = 1; res = 1;
break; break;
case 1: case 1:
/* Set Mux */ /* Set Mux */
regs->eax &= 0xffff0000; X86_EAX &= 0xffff0000;
regs->eax |= 0x005f; X86_EAX |= 0x005f;
regs->ecx &= 0xffff0000; X86_ECX &= 0xffff0000;
regs->ecx |= 0x0000; X86_ECX |= 0x0000;
res = 1; res = 1;
break; break;
case 2: case 2:
/* Get SG/Non-SG mode */ /* Get SG/Non-SG mode */
regs->eax &= 0xffff0000; X86_EAX &= 0xffff0000;
regs->eax |= 0x005f; X86_EAX |= 0x005f;
regs->ecx &= 0xffff0000; X86_ECX &= 0xffff0000;
regs->ecx |= 0x0000; X86_ECX |= 0x0000;
res = 1; res = 1;
break; break;
default: default:
/* FIXME: Interrupt was not handled, but return success? */ /* FIXME: Interrupt was not handled, but return success? */
printk(BIOS_DEBUG, "Unknown INT15 5f70 function: 0x%02x\n", printk(BIOS_DEBUG, "Unknown INT15 5f70 function: 0x%02x\n",
((regs->ecx >> 8) & 0xff)); ((X86_ECX >> 8) & 0xff));
return 1; return 1;
} }
break; break;
default: default:
printk(BIOS_DEBUG, "Unknown INT15 function %04x!\n", printk(BIOS_DEBUG, "Unknown INT15 function %04x!\n",
regs->eax & 0xffff); X86_EAX & 0xffff);
break; break;
} }
return res; return res;

View File

@ -20,7 +20,7 @@
#include <types.h> #include <types.h>
#include <device/device.h> #include <device/device.h>
#include <console/console.h> #include <console/console.h>
#if CONFIG_PCI_OPTION_ROM_RUN_YABEL #if CONFIG_PCI_ROM_RUN || CONFIG_VGA_ROM_RUN
#include <x86emu/x86emu.h> #include <x86emu/x86emu.h>
#endif #endif
#include <pc80/mc146818rtc.h> #include <pc80/mc146818rtc.h>
@ -64,7 +64,7 @@ static int int15_handler(void)
#endif #endif
#if defined(CONFIG_PCI_OPTION_ROM_RUN_REALMODE) && CONFIG_PCI_OPTION_ROM_RUN_REALMODE #if defined(CONFIG_PCI_OPTION_ROM_RUN_REALMODE) && CONFIG_PCI_OPTION_ROM_RUN_REALMODE
static int int15_handler(struct eregs *regs) static int int15_handler(void)
{ {
int res = 0; int res = 0;
@ -73,7 +73,7 @@ static int int15_handler(struct eregs *regs)
* the mainboard or northbridge code. * the mainboard or northbridge code.
* TODO: completely move to mainboards / chipsets. * TODO: completely move to mainboards / chipsets.
*/ */
switch (regs->eax & 0xffff) { switch (X86_EAX & 0xffff) {
/* And now Intel IGD code */ /* And now Intel IGD code */
#define BOOT_DISPLAY_DEFAULT 0 #define BOOT_DISPLAY_DEFAULT 0
#define BOOT_DISPLAY_CRT (1 << 0) #define BOOT_DISPLAY_CRT (1 << 0)
@ -85,19 +85,19 @@ static int int15_handler(struct eregs *regs)
#define BOOT_DISPLAY_EFP2 (1 << 6) #define BOOT_DISPLAY_EFP2 (1 << 6)
#define BOOT_DISPLAY_LCD2 (1 << 7) #define BOOT_DISPLAY_LCD2 (1 << 7)
case 0x5f35: case 0x5f35:
regs->eax = 0x5f; X86_EAX = 0x5f;
regs->ecx = BOOT_DISPLAY_DEFAULT; X86_ECX = BOOT_DISPLAY_DEFAULT;
res = 1; res = 1;
break; break;
case 0x5f40: case 0x5f40:
regs->eax = 0x5f; X86_EAX = 0x5f;
regs->ecx = 3; // This is mainboard specific X86_ECX = 3; // This is mainboard specific
printk(BIOS_DEBUG, "DISPLAY=%x\n", regs->ecx); printk(BIOS_DEBUG, "DISPLAY=%x\n", X86_ECX);
res = 1; res = 1;
break; break;
default: default:
printk(BIOS_DEBUG, "Unknown INT15 function %04x!\n", printk(BIOS_DEBUG, "Unknown INT15 function %04x!\n",
regs->eax & 0xffff); X86_EAX & 0xffff);
} }
return res; return res;

View File

@ -24,7 +24,7 @@
#include <arch/io.h> #include <arch/io.h>
#include <arch/interrupt.h> #include <arch/interrupt.h>
#include <delay.h> #include <delay.h>
#if CONFIG_PCI_OPTION_ROM_RUN_YABEL #if CONFIG_PCI_ROM_RUN || CONFIG_VGA_ROM_RUN
#include <x86emu/x86emu.h> #include <x86emu/x86emu.h>
#endif #endif
@ -91,7 +91,7 @@ static int int15_handler(void)
#endif #endif
#if CONFIG_PCI_OPTION_ROM_RUN_REALMODE #if CONFIG_PCI_OPTION_ROM_RUN_REALMODE
static int int15_handler(struct eregs *regs) static int int15_handler(void)
{ {
int res = 0; int res = 0;
@ -100,7 +100,7 @@ static int int15_handler(struct eregs *regs)
* the mainboard or northbridge code. * the mainboard or northbridge code.
* TODO: completely move to mainboards / chipsets. * TODO: completely move to mainboards / chipsets.
*/ */
switch (regs->eax & 0xffff) { switch (X86_EAX & 0xffff) {
/* And now Intel IGD code */ /* And now Intel IGD code */
#define BOOT_DISPLAY_DEFAULT 0 #define BOOT_DISPLAY_DEFAULT 0
#define BOOT_DISPLAY_CRT (1 << 0) #define BOOT_DISPLAY_CRT (1 << 0)
@ -112,19 +112,19 @@ static int int15_handler(struct eregs *regs)
#define BOOT_DISPLAY_EFP2 (1 << 6) #define BOOT_DISPLAY_EFP2 (1 << 6)
#define BOOT_DISPLAY_LCD2 (1 << 7) #define BOOT_DISPLAY_LCD2 (1 << 7)
case 0x5f35: case 0x5f35:
regs->eax = 0x5f; X86_EAX = 0x5f;
regs->ecx = BOOT_DISPLAY_DEFAULT; X86_ECX = BOOT_DISPLAY_DEFAULT;
res = 1; res = 1;
break; break;
case 0x5f40: case 0x5f40:
regs->eax = 0x5f; X86_EAX = 0x5f;
regs->ecx = 3; // This is mainboard specific X86_ECX = 3; // This is mainboard specific
printk(BIOS_DEBUG, "DISPLAY=%x\n", regs->ecx); printk(BIOS_DEBUG, "DISPLAY=%x\n", X86_ECX);
res = 1; res = 1;
break; break;
default: default:
printk(BIOS_DEBUG, "Unknown INT15 function %04x!\n", printk(BIOS_DEBUG, "Unknown INT15 function %04x!\n",
regs->eax & 0xffff); X86_EAX & 0xffff);
} }
return res; return res;

View File

@ -24,7 +24,7 @@
#include <device/pci_def.h> #include <device/pci_def.h>
#include <device/pci_ops.h> #include <device/pci_ops.h>
#include <console/console.h> #include <console/console.h>
#if defined(CONFIG_PCI_OPTION_ROM_RUN_YABEL) && CONFIG_PCI_OPTION_ROM_RUN_YABEL #if CONFIG_PCI_ROM_RUN || CONFIG_VGA_ROM_RUN
#include <x86emu/x86emu.h> #include <x86emu/x86emu.h>
#endif #endif
#include <pc80/mc146818rtc.h> #include <pc80/mc146818rtc.h>
@ -50,14 +50,14 @@ void mainboard_suspend_resume(void)
} }
#if defined(CONFIG_PCI_OPTION_ROM_RUN_REALMODE) && CONFIG_PCI_OPTION_ROM_RUN_REALMODE #if defined(CONFIG_PCI_OPTION_ROM_RUN_REALMODE) && CONFIG_PCI_OPTION_ROM_RUN_REALMODE
static int int15_handler(struct eregs *regs) static int int15_handler(void)
{ {
int res=0; int res=0;
printk(BIOS_DEBUG, "%s: INT15 function %04x!\n", printk(BIOS_DEBUG, "%s: INT15 function %04x!\n",
__func__, regs->eax & 0xffff); __func__, X86_EAX & 0xffff);
switch(regs->eax & 0xffff) { switch(X86_EAX & 0xffff) {
case 0x5f34: case 0x5f34:
/* /*
* Set Panel Fitting Hook: * Set Panel Fitting Hook:
@ -66,10 +66,10 @@ static int int15_handler(struct eregs *regs)
* bit 0 = Centering (do not set with bit1 or bit2) * bit 0 = Centering (do not set with bit1 or bit2)
* 0 = video bios default * 0 = video bios default
*/ */
regs->eax &= 0xffff0000; X86_EAX &= 0xffff0000;
regs->eax |= 0x005f; X86_EAX |= 0x005f;
regs->ecx &= 0xffffff00; X86_ECX &= 0xffffff00;
regs->ecx |= 0x00; X86_ECX |= 0x00;
res = 1; res = 1;
break; break;
case 0x5f35: case 0x5f35:
@ -84,10 +84,10 @@ static int int15_handler(struct eregs *regs)
* bit 6 = EFP2 * * bit 6 = EFP2 *
* bit 7 = LFP2 * bit 7 = LFP2
*/ */
regs->eax &= 0xffff0000; X86_EAX &= 0xffff0000;
regs->eax |= 0x005f; X86_EAX |= 0x005f;
regs->ecx &= 0xffff0000; X86_ECX &= 0xffff0000;
regs->ecx |= 0x0000; X86_ECX |= 0x0000;
res = 1; res = 1;
break; break;
case 0x5f51: case 0x5f51:
@ -98,49 +98,49 @@ static int int15_handler(struct eregs *regs)
* 02h = SVDO-LVDS, LFP driven by SVDO decoder * 02h = SVDO-LVDS, LFP driven by SVDO decoder
* 03h = eDP, LFP Driven by Int-DisplayPort encoder * 03h = eDP, LFP Driven by Int-DisplayPort encoder
*/ */
regs->eax &= 0xffff0000; X86_EAX &= 0xffff0000;
regs->eax |= 0x005f; X86_EAX |= 0x005f;
regs->ecx &= 0xffff0000; X86_ECX &= 0xffff0000;
regs->ecx |= 0x0001; X86_ECX |= 0x0001;
res = 1; res = 1;
break; break;
case 0x5f70: case 0x5f70:
switch ((regs->ecx >> 8) & 0xff) { switch ((X86_ECX >> 8) & 0xff) {
case 0: case 0:
/* Get Mux */ /* Get Mux */
regs->eax &= 0xffff0000; X86_EAX &= 0xffff0000;
regs->eax |= 0x005f; X86_EAX |= 0x005f;
regs->ecx &= 0xffff0000; X86_ECX &= 0xffff0000;
regs->ecx |= 0x0000; X86_ECX |= 0x0000;
res = 1; res = 1;
break; break;
case 1: case 1:
/* Set Mux */ /* Set Mux */
regs->eax &= 0xffff0000; X86_EAX &= 0xffff0000;
regs->eax |= 0x005f; X86_EAX |= 0x005f;
regs->ecx &= 0xffff0000; X86_ECX &= 0xffff0000;
regs->ecx |= 0x0000; X86_ECX |= 0x0000;
res = 1; res = 1;
break; break;
case 2: case 2:
/* Get SG/Non-SG mode */ /* Get SG/Non-SG mode */
regs->eax &= 0xffff0000; X86_EAX &= 0xffff0000;
regs->eax |= 0x005f; X86_EAX |= 0x005f;
regs->ecx &= 0xffff0000; X86_ECX &= 0xffff0000;
regs->ecx |= 0x0000; X86_ECX |= 0x0000;
res = 1; res = 1;
break; break;
default: default:
/* FIXME: Interrupt was not handled, but return success? */ /* FIXME: Interrupt was not handled, but return success? */
printk(BIOS_DEBUG, "Unknown INT15 5f70 function: 0x%02x\n", printk(BIOS_DEBUG, "Unknown INT15 5f70 function: 0x%02x\n",
((regs->ecx >> 8) & 0xff)); ((X86_ECX >> 8) & 0xff));
return 1; return 1;
} }
break; break;
default: default:
printk(BIOS_DEBUG, "Unknown INT15 function %04x!\n", printk(BIOS_DEBUG, "Unknown INT15 function %04x!\n",
regs->eax & 0xffff); X86_EAX & 0xffff);
break; break;
} }
return res; return res;

View File

@ -25,7 +25,7 @@
#include <device/pci_def.h> #include <device/pci_def.h>
#include <device/pci_ops.h> #include <device/pci_ops.h>
#include <console/console.h> #include <console/console.h>
#if defined(CONFIG_PCI_OPTION_ROM_RUN_YABEL) && CONFIG_PCI_OPTION_ROM_RUN_YABEL #if CONFIG_PCI_ROM_RUN || CONFIG_VGA_ROM_RUN
#include <x86emu/x86emu.h> #include <x86emu/x86emu.h>
#endif #endif
#include <pc80/mc146818rtc.h> #include <pc80/mc146818rtc.h>
@ -43,14 +43,14 @@ void mainboard_suspend_resume(void)
} }
#if defined(CONFIG_PCI_OPTION_ROM_RUN_REALMODE) && CONFIG_PCI_OPTION_ROM_RUN_REALMODE #if defined(CONFIG_PCI_OPTION_ROM_RUN_REALMODE) && CONFIG_PCI_OPTION_ROM_RUN_REALMODE
static int int15_handler(struct eregs *regs) static int int15_handler(void)
{ {
int res=0; int res=0;
printk(BIOS_DEBUG, "%s: INT15 function %04x!\n", printk(BIOS_DEBUG, "%s: INT15 function %04x!\n",
__func__, regs->eax & 0xffff); __func__, X86_EAX & 0xffff);
switch(regs->eax & 0xffff) { switch(X86_EAX & 0xffff) {
case 0x5f34: case 0x5f34:
/* /*
* Set Panel Fitting Hook: * Set Panel Fitting Hook:
@ -59,10 +59,10 @@ static int int15_handler(struct eregs *regs)
* bit 0 = Centering (do not set with bit1 or bit2) * bit 0 = Centering (do not set with bit1 or bit2)
* 0 = video bios default * 0 = video bios default
*/ */
regs->eax &= 0xffff0000; X86_EAX &= 0xffff0000;
regs->eax |= 0x005f; X86_EAX |= 0x005f;
regs->ecx &= 0xffffff00; X86_ECX &= 0xffffff00;
regs->ecx |= 0x01; X86_ECX |= 0x01;
res = 1; res = 1;
break; break;
case 0x5f35: case 0x5f35:
@ -77,10 +77,10 @@ static int int15_handler(struct eregs *regs)
* bit 6 = EFP2 * * bit 6 = EFP2 *
* bit 7 = LFP2 * bit 7 = LFP2
*/ */
regs->eax &= 0xffff0000; X86_EAX &= 0xffff0000;
regs->eax |= 0x005f; X86_EAX |= 0x005f;
regs->ecx &= 0xffff0000; X86_ECX &= 0xffff0000;
regs->ecx |= 0x0000; X86_ECX |= 0x0000;
res = 1; res = 1;
break; break;
case 0x5f51: case 0x5f51:
@ -91,49 +91,49 @@ static int int15_handler(struct eregs *regs)
* 02h = SVDO-LVDS, LFP driven by SVDO decoder * 02h = SVDO-LVDS, LFP driven by SVDO decoder
* 03h = eDP, LFP Driven by Int-DisplayPort encoder * 03h = eDP, LFP Driven by Int-DisplayPort encoder
*/ */
regs->eax &= 0xffff0000; X86_EAX &= 0xffff0000;
regs->eax |= 0x005f; X86_EAX |= 0x005f;
regs->ecx &= 0xffff0000; X86_ECX &= 0xffff0000;
regs->ecx |= 0x0003; X86_ECX |= 0x0003;
res = 1; res = 1;
break; break;
case 0x5f70: case 0x5f70:
switch ((regs->ecx >> 8) & 0xff) { switch ((X86_ECX >> 8) & 0xff) {
case 0: case 0:
/* Get Mux */ /* Get Mux */
regs->eax &= 0xffff0000; X86_EAX &= 0xffff0000;
regs->eax |= 0x005f; X86_EAX |= 0x005f;
regs->ecx &= 0xffff0000; X86_ECX &= 0xffff0000;
regs->ecx |= 0x0000; X86_ECX |= 0x0000;
res = 1; res = 1;
break; break;
case 1: case 1:
/* Set Mux */ /* Set Mux */
regs->eax &= 0xffff0000; X86_EAX &= 0xffff0000;
regs->eax |= 0x005f; X86_EAX |= 0x005f;
regs->ecx &= 0xffff0000; X86_ECX &= 0xffff0000;
regs->ecx |= 0x0000; X86_ECX |= 0x0000;
res = 1; res = 1;
break; break;
case 2: case 2:
/* Get SG/Non-SG mode */ /* Get SG/Non-SG mode */
regs->eax &= 0xffff0000; X86_EAX &= 0xffff0000;
regs->eax |= 0x005f; X86_EAX |= 0x005f;
regs->ecx &= 0xffff0000; X86_ECX &= 0xffff0000;
regs->ecx |= 0x0000; X86_ECX |= 0x0000;
res = 1; res = 1;
break; break;
default: default:
/* FIXME: Interrupt was not handled, but return sucess? */ /* FIXME: Interrupt was not handled, but return sucess? */
printk(BIOS_DEBUG, "Unknown INT15 5f70 function: 0x%02x\n", printk(BIOS_DEBUG, "Unknown INT15 5f70 function: 0x%02x\n",
((regs->ecx >> 8) & 0xff)); ((X86_ECX >> 8) & 0xff));
return 1; return 1;
} }
break; break;
default: default:
printk(BIOS_DEBUG, "Unknown INT15 function %04x!\n", printk(BIOS_DEBUG, "Unknown INT15 function %04x!\n",
regs->eax & 0xffff); X86_EAX & 0xffff);
break; break;
} }
return res; return res;

View File

@ -25,21 +25,22 @@
#include <stdlib.h> #include <stdlib.h>
#include <console/console.h> #include <console/console.h>
#include <arch/interrupt.h> #include <arch/interrupt.h>
#include <x86emu/regs.h>
#include "int15_func.h" #include "int15_func.h"
int sbios_INT15_handler(struct eregs *); int sbios_INT15_handler(void);
/*extern*/ unsigned long vgainfo_addr; /*extern*/ unsigned long vgainfo_addr;
static INT15_function_extensions __int15_func; static INT15_function_extensions __int15_func;
/* System BIOS int15 function */ /* System BIOS int15 function */
int sbios_INT15_handler(struct eregs *regs) int sbios_INT15_handler(void)
{ {
int res = -1; int res = -1;
printk(BIOS_DEBUG, "System BIOS INT 15h\n"); printk(BIOS_DEBUG, "System BIOS INT 15h\n");
switch (regs->eax & 0xffff) { switch (X86_EAX & 0xffff) {
#define BOOT_DISPLAY_DEFAULT 0 #define BOOT_DISPLAY_DEFAULT 0
#define BOOT_DISPLAY_CRT (1 << 0) #define BOOT_DISPLAY_CRT (1 << 0)
#define BOOT_DISPLAY_TV (1 << 1) #define BOOT_DISPLAY_TV (1 << 1)
@ -50,42 +51,42 @@ int sbios_INT15_handler(struct eregs *regs)
#define BOOT_DISPLAY_EFP2 (1 << 6) #define BOOT_DISPLAY_EFP2 (1 << 6)
#define BOOT_DISPLAY_LCD2 (1 << 7) #define BOOT_DISPLAY_LCD2 (1 << 7)
case 0x5f35: case 0x5f35:
regs->eax = 0x5f; X86_EAX = 0x5f;
regs->ecx = BOOT_DISPLAY_DEFAULT; X86_ECX = BOOT_DISPLAY_DEFAULT;
res = 0; res = 0;
break; break;
case 0x5f40: case 0x5f40:
regs->eax = 0x5f; X86_EAX = 0x5f;
regs->ecx = 3; // This is mainboard specific X86_ECX = 3; // This is mainboard specific
printk(BIOS_DEBUG, "DISPLAY=%x\n", regs->ecx); printk(BIOS_DEBUG, "DISPLAY=%x\n", X86_ECX);
res = 0; res = 0;
break; break;
case 0x4e08: case 0x4e08:
switch (regs->ebx & 0xff) { switch (X86_EBX & 0xff) {
case 0x00: case 0x00:
regs->eax &= ~(0xff); X86_EAX &= ~(0xff);
regs->ebx = (regs->ebx & ~(0xff)) | __int15_func.regs.func00_LCD_panel_id; X86_EBX = (X86_EBX & ~(0xff)) | __int15_func.regs.func00_LCD_panel_id;
printk(BIOS_DEBUG, "DISPLAY = %x\n", regs->ebx & 0xff); printk(BIOS_DEBUG, "DISPLAY = %x\n", X86_EBX & 0xff);
res = 0; res = 0;
break; break;
case 0x02: case 0x02:
break; break;
case 0x05: case 0x05:
regs->eax &= ~(0xff); X86_EAX &= ~(0xff);
regs->ebx = (regs->ebx & ~(0xff)) | __int15_func.regs.func05_TV_standard; X86_EBX = (X86_EBX & ~(0xff)) | __int15_func.regs.func05_TV_standard;
printk(BIOS_DEBUG, "TV = %x\n", regs->ebx & 0xff); printk(BIOS_DEBUG, "TV = %x\n", X86_EBX & 0xff);
res = 0; res = 0;
break; break;
case 0x80: case 0x80:
regs->eax &= ~(0xff); X86_EAX &= ~(0xff);
regs->ebx &= ~(0xff); X86_EBX &= ~(0xff);
printk(BIOS_DEBUG, "Integrated System Information = %x:%x\n", regs->edx, regs->edi); printk(BIOS_DEBUG, "Integrated System Information = %x:%x\n", X86_EDX, X86_EDI);
vgainfo_addr = (regs->edx * 16) + regs->edi; vgainfo_addr = (X86_EDX * 16) + X86_EDI;
res = 0; res = 0;
break; break;
case 0x89: case 0x89:
regs->eax &= ~(0xff); X86_EAX &= ~(0xff);
regs->ebx &= ~(0xff); X86_EBX &= ~(0xff);
printk(BIOS_DEBUG, "Get supported display device information\n"); printk(BIOS_DEBUG, "Get supported display device information\n");
res = 0; res = 0;
break; break;
@ -94,7 +95,7 @@ int sbios_INT15_handler(struct eregs *regs)
} }
break; break;
default: default:
printk(BIOS_DEBUG, "Unknown INT15 function %04x!\n", regs->eax & 0xffff); printk(BIOS_DEBUG, "Unknown INT15 function %04x!\n", X86_EAX & 0xffff);
break; break;
} }

View File

@ -24,9 +24,10 @@
#include <console/console.h> #include <console/console.h>
#include <arch/interrupt.h> #include <arch/interrupt.h>
#include "vgabios.h" #include "vgabios.h"
#include <x86emu/regs.h>
int tim5690_int15_handler(struct eregs *regs); int tim5690_int15_handler(void);
static rs690_vbios_regs vbios_regs_local; static rs690_vbios_regs vbios_regs_local;
@ -38,30 +39,30 @@ static void vbios_fun_init(rs690_vbios_regs *vbios_regs)
} }
/* BIOS int15 function */ /* BIOS int15 function */
int tim5690_int15_handler(struct eregs *regs) int tim5690_int15_handler(void)
{ {
int res = 0; int res = 0;
printk(BIOS_DEBUG, "tim5690_int15_handler\n"); printk(BIOS_DEBUG, "tim5690_int15_handler\n");
switch (regs->eax & 0xffff) { switch (X86_EAX & 0xffff) {
case AMD_RS690_INT15: case AMD_RS690_INT15:
switch (regs->ebx & 0xff) { switch (X86_EBX & 0xff) {
case 0x00: case 0x00:
regs->eax &= ~(0xff); X86_EAX &= ~(0xff);
regs->ebx = (regs->ebx & ~(0xff)) | vbios_regs_local.int15_regs.fun00_panel_id; X86_EBX = (X86_EBX & ~(0xff)) | vbios_regs_local.int15_regs.fun00_panel_id;
res = 1; res = 1;
break; break;
case 0x05: case 0x05:
regs->eax &= ~(0xff); X86_EAX &= ~(0xff);
regs->ebx = (regs->ebx & ~(0xff)) | vbios_regs_local.int15_regs.fun05_tv_standard; X86_EBX = (X86_EBX & ~(0xff)) | vbios_regs_local.int15_regs.fun05_tv_standard;
res = 1; res = 1;
break; break;
} }
break; break;
default: default:
printk(BIOS_DEBUG, "Unknown INT15 function %04x!\n", printk(BIOS_DEBUG, "Unknown INT15 function %04x!\n",
regs->eax & 0xffff); X86_EAX & 0xffff);
break; break;
} }

View File

@ -36,41 +36,42 @@
#include <arch/interrupt.h> #include <arch/interrupt.h>
#include "northbridge.h" #include "northbridge.h"
#include "cn400.h" #include "cn400.h"
#include <x86emu/regs.h>
static int via_cn400_int15_handler(struct eregs *regs) static int via_cn400_int15_handler(void)
{ {
int res=0; int res=0;
printk(BIOS_DEBUG, "via_cn400_int15_handler\n"); printk(BIOS_DEBUG, "via_cn400_int15_handler\n");
switch(regs->eax & 0xffff) { switch(X86_EAX & 0xffff) {
case 0x5f19: case 0x5f19:
break; break;
case 0x5f18: case 0x5f18:
regs->eax=0x5f; X86_EAX=0x5f;
regs->ebx=0x545; // MCLK = 133, 32M frame buffer, 256 M main memory X86_EBX=0x545; // MCLK = 133, 32M frame buffer, 256 M main memory
regs->ecx=0x060; X86_ECX=0x060;
res=1; res=1;
break; break;
case 0x5f00: case 0x5f00:
regs->eax = 0x8600; X86_EAX = 0x8600;
break; break;
case 0x5f01: case 0x5f01:
regs->eax = 0x5f; X86_EAX = 0x5f;
regs->ecx = (regs->ecx & 0xffffff00 ) | 2; // panel type = 2 = 1024 * 768 X86_ECX = (X86_ECX & 0xffffff00 ) | 2; // panel type = 2 = 1024 * 768
res = 1; res = 1;
break; break;
case 0x5f02: case 0x5f02:
regs->eax=0x5f; X86_EAX=0x5f;
regs->ebx= (regs->ebx & 0xffff0000) | 2; X86_EBX= (X86_EBX & 0xffff0000) | 2;
regs->ecx= (regs->ecx & 0xffff0000) | 0x401; // PAL + crt only X86_ECX= (X86_ECX & 0xffff0000) | 0x401; // PAL + crt only
regs->edx= (regs->edx & 0xffff0000) | 0; // TV Layout - default X86_EDX= (X86_EDX & 0xffff0000) | 0; // TV Layout - default
res=1; res=1;
break; break;
case 0x5f0f: case 0x5f0f:
regs->eax=0x860f; X86_EAX=0x860f;
break; break;
default: default:
printk(BIOS_DEBUG, "Unknown INT15 function %04x!\n", printk(BIOS_DEBUG, "Unknown INT15 function %04x!\n",
regs->eax & 0xffff); X86_EAX & 0xffff);
break; break;
} }
return res; return res;

View File

@ -36,41 +36,42 @@
#include <arch/interrupt.h> #include <arch/interrupt.h>
#include "northbridge.h" #include "northbridge.h"
#include "cn700.h" #include "cn700.h"
#include <x86emu/regs.h>
static int via_cn700_int15_handler(struct eregs *regs) static int via_cn700_int15_handler(void)
{ {
int res=0; int res=0;
printk(BIOS_DEBUG, "via_cn700_int15_handler\n"); printk(BIOS_DEBUG, "via_cn700_int15_handler\n");
switch(regs->eax & 0xffff) { switch(X86_EAX & 0xffff) {
case 0x5f19: case 0x5f19:
break; break;
case 0x5f18: case 0x5f18:
regs->eax=0x5f; X86_EAX=0x5f;
regs->ebx=0x545; // MCLK = 133, 32M frame buffer, 256 M main memory X86_EBX=0x545; // MCLK = 133, 32M frame buffer, 256 M main memory
regs->ecx=0x060; X86_ECX=0x060;
res=1; res=1;
break; break;
case 0x5f00: case 0x5f00:
regs->eax = 0x8600; X86_EAX = 0x8600;
break; break;
case 0x5f01: case 0x5f01:
regs->eax = 0x5f; X86_EAX = 0x5f;
regs->ecx = (regs->ecx & 0xffffff00 ) | 2; // panel type = 2 = 1024 * 768 X86_ECX = (X86_ECX & 0xffffff00 ) | 2; // panel type = 2 = 1024 * 768
res = 1; res = 1;
break; break;
case 0x5f02: case 0x5f02:
regs->eax=0x5f; X86_EAX=0x5f;
regs->ebx= (regs->ebx & 0xffff0000) | 2; X86_EBX= (X86_EBX & 0xffff0000) | 2;
regs->ecx= (regs->ecx & 0xffff0000) | 0x401; // PAL + crt only X86_ECX= (X86_ECX & 0xffff0000) | 0x401; // PAL + crt only
regs->edx= (regs->edx & 0xffff0000) | 0; // TV Layout - default X86_EDX= (X86_EDX & 0xffff0000) | 0; // TV Layout - default
res=1; res=1;
break; break;
case 0x5f0f: case 0x5f0f:
regs->eax=0x860f; X86_EAX=0x860f;
break; break;
default: default:
printk(BIOS_DEBUG, "Unknown INT15 function %04x!\n", printk(BIOS_DEBUG, "Unknown INT15 function %04x!\n",
regs->eax & 0xffff); X86_EAX & 0xffff);
break; break;
} }
return res; return res;

View File

@ -31,6 +31,7 @@
#include <cpu/x86/msr.h> #include <cpu/x86/msr.h>
#include <arch/interrupt.h> #include <arch/interrupt.h>
#include "registers.h" #include "registers.h"
#include <x86emu/regs.h>
#if CONFIG_PCI_OPTION_ROM_RUN_REALMODE #if CONFIG_PCI_OPTION_ROM_RUN_REALMODE
#include <devices/oprom/realmode/x86.h> #include <devices/oprom/realmode/x86.h>
#endif #endif
@ -44,7 +45,7 @@
#define CRTC_INDEX 0x3d4 #define CRTC_INDEX 0x3d4
#define CRTC_DATA 0x3d5 #define CRTC_DATA 0x3d5
static int via_cx700_int15_handler(struct eregs *regs) static int via_cx700_int15_handler(void)
{ {
int res=0; int res=0;
u8 mem_speed; u8 mem_speed;
@ -67,62 +68,62 @@ static int via_cx700_int15_handler(struct eregs *regs)
printk(BIOS_DEBUG, "via_cx700_int15_handler\n"); printk(BIOS_DEBUG, "via_cx700_int15_handler\n");
switch(regs->eax & 0xffff) { switch(X86_EAX & 0xffff) {
case 0x5f00: /* VGA POST Initialization Signal */ case 0x5f00: /* VGA POST Initialization Signal */
regs->eax = (regs->eax & 0xffff0000 ) | 0x5f; X86_EAX = (X86_EAX & 0xffff0000 ) | 0x5f;
res = 1; res = 1;
break; break;
case 0x5f01: /* Software Panel Type Configuration */ case 0x5f01: /* Software Panel Type Configuration */
regs->eax = (regs->eax & 0xffff0000 ) | 0x5f; X86_EAX = (X86_EAX & 0xffff0000 ) | 0x5f;
// panel type = 2 = 1024 * 768 // panel type = 2 = 1024 * 768
regs->ecx = (regs->ecx & 0xffffff00 ) | 2; X86_ECX = (X86_ECX & 0xffffff00 ) | 2;
res = 1; res = 1;
break; break;
case 0x5f27: /* Boot Device Selection */ case 0x5f27: /* Boot Device Selection */
regs->eax = (regs->eax & 0xffff0000 ) | 0x5f; X86_EAX = (X86_EAX & 0xffff0000 ) | 0x5f;
regs->ebx = 0x00000000; // 0 -> default X86_EBX = 0x00000000; // 0 -> default
regs->ecx = 0x00000000; // 0 -> default X86_ECX = 0x00000000; // 0 -> default
// TV Layout - default // TV Layout - default
regs->edx = (regs->edx & 0xffffff00) | 0; X86_EDX = (X86_EDX & 0xffffff00) | 0;
res=1; res=1;
break; break;
case 0x5f0b: /* Get Expansion Setting */ case 0x5f0b: /* Get Expansion Setting */
regs->eax = (regs->eax & 0xffff0000 ) | 0x5f; X86_EAX = (X86_EAX & 0xffff0000 ) | 0x5f;
regs->ecx = regs->ecx & 0xffffff00; // non-expansion X86_ECX = X86_ECX & 0xffffff00; // non-expansion
// regs->ecx = regs->ecx & 0xffffff00 | 1; // expansion // regs->ecx = regs->ecx & 0xffffff00 | 1; // expansion
res=1; res=1;
break; break;
case 0x5f0f: /* VGA Post Completion */ case 0x5f0f: /* VGA Post Completion */
regs->eax = (regs->eax & 0xffff0000 ) | 0x5f; X86_EAX = (X86_EAX & 0xffff0000 ) | 0x5f;
res=1; res=1;
break; break;
case 0x5f18: case 0x5f18:
regs->eax = (regs->eax & 0xffff0000 ) | 0x5f; X86_EAX = (X86_EAX & 0xffff0000 ) | 0x5f;
#define UMA_SIZE_8MB (3 << 0) #define UMA_SIZE_8MB (3 << 0)
#define UMA_SIZE_16MB (4 << 0) #define UMA_SIZE_16MB (4 << 0)
#define UMA_SIZE_32MB (5 << 0) #define UMA_SIZE_32MB (5 << 0)
regs->ebx = (regs->ebx & 0xffff0000 ) | MEMORY_SPEED_533MHZ | UMA_SIZE_32MB; X86_EBX = (X86_EBX & 0xffff0000 ) | MEMORY_SPEED_533MHZ | UMA_SIZE_32MB;
mem_speed = pci_read_config8(dev_find_slot(0, PCI_DEVFN(0, 4)), SCRATCH_DRAM_FREQ); mem_speed = pci_read_config8(dev_find_slot(0, PCI_DEVFN(0, 4)), SCRATCH_DRAM_FREQ);
if (mem_speed > 5) if (mem_speed > 5)
mem_speed = 5; mem_speed = 5;
regs->ebx |= memory_mapping[mem_speed]; X86_EBX |= memory_mapping[mem_speed];
res=1; res=1;
break; break;
default: default:
printk(BIOS_DEBUG, "Unknown INT15 function %04x!\n", printk(BIOS_DEBUG, "Unknown INT15 function %04x!\n",
regs->eax & 0xffff); X86_EAX & 0xffff);
break; break;
} }
return res; return res;

View File

@ -30,44 +30,45 @@
#include <cpu/x86/mtrr.h> #include <cpu/x86/mtrr.h>
#include <cpu/x86/msr.h> #include <cpu/x86/msr.h>
#include <arch/interrupt.h> #include <arch/interrupt.h>
#include <x86emu/regs.h>
#if CONFIG_PCI_OPTION_ROM_RUN_REALMODE #if CONFIG_PCI_OPTION_ROM_RUN_REALMODE
#include <devices/oprom/realmode/x86.h> #include <devices/oprom/realmode/x86.h>
#endif #endif
static int via_vt8623_int15_handler(struct eregs *regs) static int via_vt8623_int15_handler(void)
{ {
int res=0; int res=0;
printk(BIOS_DEBUG, "via_vt8623_int15_handler\n"); printk(BIOS_DEBUG, "via_vt8623_int15_handler\n");
switch(regs->eax & 0xffff) { switch(X86_EAX & 0xffff) {
case 0x5f19: case 0x5f19:
break; break;
case 0x5f18: case 0x5f18:
regs->eax=0x5f; X86_EAX=0x5f;
regs->ebx=0x545; // MCLK = 133, 32M frame buffer, 256 M main memory X86_EBX=0x545; // MCLK = 133, 32M frame buffer, 256 M main memory
regs->ecx=0x060; X86_ECX=0x060;
res=1; res=1;
break; break;
case 0x5f00: case 0x5f00:
regs->eax = 0x8600; X86_EAX = 0x8600;
break; break;
case 0x5f01: case 0x5f01:
regs->eax = 0x5f; X86_EAX = 0x5f;
regs->ecx = (regs->ecx & 0xffffff00 ) | 2; // panel type = 2 = 1024 * 768 X86_ECX = (X86_ECX & 0xffffff00 ) | 2; // panel type = 2 = 1024 * 768
res = 1; res = 1;
break; break;
case 0x5f02: case 0x5f02:
regs->eax=0x5f; X86_EAX=0x5f;
regs->ebx= (regs->ebx & 0xffff0000) | 2; X86_EBX= (X86_EBX & 0xffff0000) | 2;
regs->ecx= (regs->ecx & 0xffff0000) | 0x401; // PAL + crt only X86_ECX= (X86_ECX & 0xffff0000) | 0x401; // PAL + crt only
regs->edx= (regs->edx & 0xffff0000) | 0; // TV Layout - default X86_EDX= (X86_EDX & 0xffff0000) | 0; // TV Layout - default
res=1; res=1;
break; break;
case 0x5f0f: case 0x5f0f:
regs->eax=0x860f; X86_EAX=0x860f;
break; break;
default: default:
printk(BIOS_DEBUG, "Unknown INT15 function %04x!\n", printk(BIOS_DEBUG, "Unknown INT15 function %04x!\n",
regs->eax & 0xffff); X86_EAX & 0xffff);
break; break;
} }
return res; return res;

View File

@ -33,6 +33,7 @@
#include <cpu/x86/mtrr.h> #include <cpu/x86/mtrr.h>
#include <cpu/x86/msr.h> #include <cpu/x86/msr.h>
#include <arch/interrupt.h> #include <arch/interrupt.h>
#include <x86emu/regs.h>
#if CONFIG_PCI_OPTION_ROM_RUN_REALMODE #if CONFIG_PCI_OPTION_ROM_RUN_REALMODE
#include <devices/oprom/realmode/x86.h> #include <devices/oprom/realmode/x86.h>
#endif #endif
@ -50,14 +51,14 @@
#define VIACONFIG_VGA_PCI_10 0xf8000008 #define VIACONFIG_VGA_PCI_10 0xf8000008
#define VIACONFIG_VGA_PCI_14 0xfc000000 #define VIACONFIG_VGA_PCI_14 0xfc000000
static int via_vx800_int15_handler(struct eregs *regs) static int via_vx800_int15_handler(void)
{ {
int res=0; int res=0;
printk(BIOS_DEBUG, "via_vx800_int15_handler\n"); printk(BIOS_DEBUG, "via_vx800_int15_handler\n");
switch(regs->eax & 0xffff) { switch(X86_EAX & 0xffff) {
case 0x5f19: case 0x5f19:
regs->eax=0x5f; X86_EAX=0x5f;
regs->ecx=0x03; X86_ECX=0x03;
res=1; res=1;
break; break;
case 0x5f18: case 0x5f18:
@ -84,44 +85,44 @@ static int via_vx800_int15_handler(struct eregs *regs)
i = (i & 0x70); i = (i & 0x70);
i = i >> 4; i = i >> 4;
if (i == 0) { if (i == 0) {
regs->eax = 0x00; //not support 5f18 X86_EAX = 0x00; //not support 5f18
break; break;
} }
i = i + 2; i = i + 2;
regs->ebx = (u32) i; X86_EBX = (u32) i;
i = pci_read_config8(dev, 0x90); i = pci_read_config8(dev, 0x90);
i = (i & 0x07); i = (i & 0x07);
i = i + 3; i = i + 3;
i = i << 4; i = i << 4;
regs->ebx = regs->ebx + ((u32) i); X86_EBX = X86_EBX + ((u32) i);
regs->eax = 0x5f; X86_EAX = 0x5f;
res = 1; res = 1;
break; break;
} }
case 0x5f00: case 0x5f00:
regs->eax = 0x005f; X86_EAX = 0x005f;
res = 1; res = 1;
break; break;
case 0x5f01: case 0x5f01:
regs->eax = 0x5f; X86_EAX = 0x5f;
regs->ecx = (regs->ecx & 0xffffff00 ) | 2; // panel type = 2 = 1024 * 768 X86_ECX = (X86_ECX & 0xffffff00 ) | 2; // panel type = 2 = 1024 * 768
res = 1; res = 1;
break; break;
case 0x5f02: case 0x5f02:
regs->eax=0x5f; X86_EAX=0x5f;
regs->ebx= (regs->ebx & 0xffff0000) | 2; X86_EBX= (X86_EBX & 0xffff0000) | 2;
regs->ecx= (regs->ecx & 0xffff0000) | 0x401; // PAL + crt only X86_ECX= (X86_ECX & 0xffff0000) | 0x401; // PAL + crt only
regs->edx= (regs->edx & 0xffff0000) | 0; // TV Layout - default X86_EDX= (X86_EDX & 0xffff0000) | 0; // TV Layout - default
res=1; res=1;
break; break;
case 0x5f0f: case 0x5f0f:
regs->eax = 0x005f; X86_EAX = 0x005f;
res = 1; res = 1;
break; break;
default: default:
printk(BIOS_DEBUG, "Unknown INT15 function %04x!\n", printk(BIOS_DEBUG, "Unknown INT15 function %04x!\n",
regs->eax & 0xffff); X86_EAX & 0xffff);
regs->eax = 0; X86_EAX = 0;
break; break;
} }
return res; return res;