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

@@ -25,7 +25,7 @@
#include <device/pci_def.h>
#include <device/pci_ops.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>
#endif
#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
static int int15_handler(struct eregs *regs)
static int int15_handler(void)
{
int res=0;
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:
/*
* 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)
* 0 = video bios default
*/
regs->eax &= 0xffff0000;
regs->eax |= 0x005f;
regs->ecx &= 0xffffff00;
regs->ecx |= 0x01;
X86_EAX &= 0xffff0000;
X86_EAX |= 0x005f;
X86_ECX &= 0xffffff00;
X86_ECX |= 0x01;
res = 1;
break;
case 0x5f35:
@@ -77,10 +77,10 @@ static int int15_handler(struct eregs *regs)
* bit 6 = EFP2 *
* bit 7 = LFP2
*/
regs->eax &= 0xffff0000;
regs->eax |= 0x005f;
regs->ecx &= 0xffff0000;
regs->ecx |= 0x0000;
X86_EAX &= 0xffff0000;
X86_EAX |= 0x005f;
X86_ECX &= 0xffff0000;
X86_ECX |= 0x0000;
res = 1;
break;
case 0x5f51:
@@ -91,49 +91,49 @@ static int int15_handler(struct eregs *regs)
* 02h = SVDO-LVDS, LFP driven by SVDO decoder
* 03h = eDP, LFP Driven by Int-DisplayPort encoder
*/
regs->eax &= 0xffff0000;
regs->eax |= 0x005f;
regs->ecx &= 0xffff0000;
regs->ecx |= 0x0003;
X86_EAX &= 0xffff0000;
X86_EAX |= 0x005f;
X86_ECX &= 0xffff0000;
X86_ECX |= 0x0003;
res = 1;
break;
case 0x5f70:
switch ((regs->ecx >> 8) & 0xff) {
switch ((X86_ECX >> 8) & 0xff) {
case 0:
/* Get Mux */
regs->eax &= 0xffff0000;
regs->eax |= 0x005f;
regs->ecx &= 0xffff0000;
regs->ecx |= 0x0000;
X86_EAX &= 0xffff0000;
X86_EAX |= 0x005f;
X86_ECX &= 0xffff0000;
X86_ECX |= 0x0000;
res = 1;
break;
case 1:
/* Set Mux */
regs->eax &= 0xffff0000;
regs->eax |= 0x005f;
regs->ecx &= 0xffff0000;
regs->ecx |= 0x0000;
X86_EAX &= 0xffff0000;
X86_EAX |= 0x005f;
X86_ECX &= 0xffff0000;
X86_ECX |= 0x0000;
res = 1;
break;
case 2:
/* Get SG/Non-SG mode */
regs->eax &= 0xffff0000;
regs->eax |= 0x005f;
regs->ecx &= 0xffff0000;
regs->ecx |= 0x0000;
X86_EAX &= 0xffff0000;
X86_EAX |= 0x005f;
X86_ECX &= 0xffff0000;
X86_ECX |= 0x0000;
res = 1;
break;
default:
/* FIXME: Interrupt was not handled, but return success? */
printk(BIOS_DEBUG, "Unknown INT15 5f70 function: 0x%02x\n",
((regs->ecx >> 8) & 0xff));
((X86_ECX >> 8) & 0xff));
return 1;
}
break;
default:
printk(BIOS_DEBUG, "Unknown INT15 function %04x!\n",
regs->eax & 0xffff);
X86_EAX & 0xffff);
break;
}
return res;