mirror of
https://github.com/fail0verflow/switch-coreboot.git
synced 2025-05-04 01:39:18 -04:00
fixes from SONE
This commit is contained in:
parent
b0cf00a9f8
commit
e39b70bc2b
2 changed files with 59 additions and 13 deletions
|
@ -132,6 +132,9 @@ pcibios(
|
||||||
unsigned long *pflags
|
unsigned long *pflags
|
||||||
);
|
);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
extern void vga_exit(void);
|
||||||
|
|
||||||
int
|
int
|
||||||
biosint(
|
biosint(
|
||||||
unsigned long intnumber,
|
unsigned long intnumber,
|
||||||
|
@ -143,19 +146,16 @@ biosint(
|
||||||
unsigned long edx,
|
unsigned long edx,
|
||||||
unsigned long ecx,
|
unsigned long ecx,
|
||||||
unsigned long eax,
|
unsigned long eax,
|
||||||
// these came in from 16-bit land
|
unsigned long cs_ip,
|
||||||
// but gcc does something weird we have to undo.
|
unsigned short stackflags
|
||||||
unsigned short stackip,
|
|
||||||
unsigned short stackflags,
|
|
||||||
unsigned short stackcs
|
|
||||||
) {
|
) {
|
||||||
unsigned long ip;
|
unsigned long ip;
|
||||||
unsigned long cs;
|
unsigned long cs;
|
||||||
unsigned long flags;
|
unsigned long flags;
|
||||||
int ret = -1;
|
int ret = -1;
|
||||||
|
|
||||||
ip = stackip;
|
ip = cs_ip & 0xffff;
|
||||||
cs = stackcs;
|
cs = cs_ip >> 16;
|
||||||
flags = stackflags;
|
flags = stackflags;
|
||||||
|
|
||||||
printk_debug("biosint: # 0x%lx, eax 0x%lx ebx 0x%lx ecx 0x%lx edx 0x%lx\n",
|
printk_debug("biosint: # 0x%lx, eax 0x%lx ebx 0x%lx ecx 0x%lx edx 0x%lx\n",
|
||||||
|
@ -164,6 +164,21 @@ biosint(
|
||||||
printk_debug("biosint: ip 0x%x cs 0x%x flags 0x%x\n", ip, cs, flags);
|
printk_debug("biosint: ip 0x%x cs 0x%x flags 0x%x\n", ip, cs, flags);
|
||||||
// cases in a good compiler are just as good as your own tables.
|
// cases in a good compiler are just as good as your own tables.
|
||||||
switch (intnumber) {
|
switch (intnumber) {
|
||||||
|
case 0 ... 15:
|
||||||
|
// These are not BIOS service, but the CPU-generated exceptions
|
||||||
|
printk_info("biosint: Oops, exception %u\n", intnumber);
|
||||||
|
if (esp < 0x1000) {
|
||||||
|
printk_debug("Stack contents: ");
|
||||||
|
while (esp < 0x1000) {
|
||||||
|
printk_debug("0x%04x ", *(unsigned short *) esp);
|
||||||
|
esp += 2;
|
||||||
|
}
|
||||||
|
printk_debug("\n");
|
||||||
|
}
|
||||||
|
printk_debug("biosint: Bailing out\n");
|
||||||
|
// "longjmp"
|
||||||
|
vga_exit();
|
||||||
|
break;
|
||||||
#ifdef CONFIG_PCIBIOS
|
#ifdef CONFIG_PCIBIOS
|
||||||
case PCIBIOS:
|
case PCIBIOS:
|
||||||
ret = pcibios( &edi, &esi, &ebp, &esp,
|
ret = pcibios( &edi, &esi, &ebp, &esp,
|
||||||
|
@ -208,11 +223,21 @@ setup_realmode_idt(void) {
|
||||||
// and get it that way. But that's really disgusting.
|
// and get it that way. But that's really disgusting.
|
||||||
for (i = 0; i < 256; i++) {
|
for (i = 0; i < 256; i++) {
|
||||||
idts[i].cs = 0;
|
idts[i].cs = 0;
|
||||||
codeptr = 1024 + i * codesize;
|
codeptr = (char*) 4096 + i * codesize;
|
||||||
idts[i].offset = codeptr;
|
idts[i].offset = (unsigned) codeptr;
|
||||||
memcpy((void *) codeptr, &idthandle, codesize);
|
memcpy(codeptr, &idthandle, codesize);
|
||||||
intbyte = codeptr + 3;
|
intbyte = codeptr + 3;
|
||||||
*intbyte = i;
|
*intbyte = i;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// fixed entry points
|
||||||
|
|
||||||
|
// VGA BIOSes tend to hardcode f000:f065 as the previous handler of
|
||||||
|
// int10.
|
||||||
|
// calling convention here is the same as INTs, we can reuse
|
||||||
|
// the int entry code.
|
||||||
|
codeptr = (char*) 0xff065;
|
||||||
|
memcpy(codeptr, &idthandle, codesize);
|
||||||
|
intbyte = codeptr + 3;
|
||||||
|
*intbyte = 0x42; /* int42 is the relocated int10 */
|
||||||
}
|
}
|
||||||
|
|
|
@ -69,15 +69,21 @@ static char rcsid[] = "$Id$";
|
||||||
|
|
||||||
|
|
||||||
/* The address arguments to this function are PHYSICAL ADDRESSES */
|
/* The address arguments to this function are PHYSICAL ADDRESSES */
|
||||||
static void real_mode_switch_call_vga(void)
|
static void real_mode_switch_call_vga(unsigned long devfn)
|
||||||
{
|
{
|
||||||
__asm__ __volatile__
|
__asm__ __volatile__
|
||||||
(
|
(
|
||||||
|
// paranoia -- does ecx get saved? not sure. This is
|
||||||
|
// the easiest safe thing to do.
|
||||||
|
"pushal\n"
|
||||||
/* save the stack */
|
/* save the stack */
|
||||||
"mov %esp, __stack\n"
|
"mov %esp, __stack\n"
|
||||||
"jmp 1f\n"
|
"jmp 1f\n"
|
||||||
"__stack: .long 0\n"
|
"__stack: .long 0\n"
|
||||||
"1:\n"
|
"1:\n"
|
||||||
|
/* get devfn into %ecx */
|
||||||
|
"movl %esp, %ebp\n"
|
||||||
|
"movl 8(%ebp), %ecx\n"
|
||||||
/* This configures CS properly for real mode. */
|
/* This configures CS properly for real mode. */
|
||||||
" ljmp $0x28, $__rms_16bit\n"
|
" ljmp $0x28, $__rms_16bit\n"
|
||||||
"__rms_16bit: \n"
|
"__rms_16bit: \n"
|
||||||
|
@ -110,7 +116,7 @@ static void real_mode_switch_call_vga(void)
|
||||||
" mov %ax, %ss \n"
|
" mov %ax, %ss \n"
|
||||||
" movl $0x1000, %eax \n"
|
" movl $0x1000, %eax \n"
|
||||||
" movl %eax, %esp \n"
|
" movl %eax, %esp \n"
|
||||||
/* ebugging for RGM */
|
/* debugging for RGM */
|
||||||
" mov $0x11, %al \n"
|
" mov $0x11, %al \n"
|
||||||
" outb %al, $0x80\n"
|
" outb %al, $0x80\n"
|
||||||
|
|
||||||
|
@ -120,6 +126,7 @@ static void real_mode_switch_call_vga(void)
|
||||||
" mov %ax, %es \n"
|
" mov %ax, %es \n"
|
||||||
" mov %ax, %fs \n"
|
" mov %ax, %fs \n"
|
||||||
" mov %ax, %gs \n"
|
" mov %ax, %gs \n"
|
||||||
|
" mov %cx, %ax \n"
|
||||||
" .byte 0x9a, 0x03, 0, 0, 0xc0 \n"
|
" .byte 0x9a, 0x03, 0, 0, 0xc0 \n"
|
||||||
" movb $0x55, %al\noutb %al, $0x80\n"
|
" movb $0x55, %al\noutb %al, $0x80\n"
|
||||||
/* if we got here, just about done.
|
/* if we got here, just about done.
|
||||||
|
@ -139,7 +146,10 @@ static void real_mode_switch_call_vga(void)
|
||||||
" mov %ax, %fs \n"
|
" mov %ax, %fs \n"
|
||||||
" mov %ax, %gs \n"
|
" mov %ax, %gs \n"
|
||||||
" mov %ax, %ss \n"
|
" mov %ax, %ss \n"
|
||||||
|
".globl vga_exit\n"
|
||||||
|
"vga_exit:\n"
|
||||||
" mov __stack, %esp\n"
|
" mov __stack, %esp\n"
|
||||||
|
" popal\n"
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
__asm__ (".text\n""real_mode_switch_end:\n");
|
__asm__ (".text\n""real_mode_switch_end:\n");
|
||||||
|
@ -149,11 +159,21 @@ void
|
||||||
do_vgabios(void)
|
do_vgabios(void)
|
||||||
{
|
{
|
||||||
struct pci_dev *dev;
|
struct pci_dev *dev;
|
||||||
|
unsigned long busdevfn;
|
||||||
unsigned int rom = 0;
|
unsigned int rom = 0;
|
||||||
unsigned char *buf;
|
unsigned char *buf;
|
||||||
unsigned int size = 64*1024;
|
unsigned int size = 64*1024;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
|
for (i=0x400; i<0x500; i++) {
|
||||||
|
printk_debug("%02x%c", *(unsigned char *)i, i%16==15 ? '\n' : ' ');
|
||||||
|
*(unsigned char *) i = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (i=0x400; i<0x500; i++) {
|
||||||
|
printk_debug("%02x%c", *(unsigned char *)i, i%16==15 ? '\n' : ' ');
|
||||||
|
}
|
||||||
|
|
||||||
dev = pci_find_class(PCI_CLASS_DISPLAY_VGA <<8, NULL);
|
dev = pci_find_class(PCI_CLASS_DISPLAY_VGA <<8, NULL);
|
||||||
|
|
||||||
if (! dev) {
|
if (! dev) {
|
||||||
|
@ -179,7 +199,8 @@ do_vgabios(void)
|
||||||
for(i = 0; i < 16; i++)
|
for(i = 0; i < 16; i++)
|
||||||
printk_debug("0x%x ", buf[i]);
|
printk_debug("0x%x ", buf[i]);
|
||||||
// check signature here later!
|
// check signature here later!
|
||||||
real_mode_switch_call_vga();
|
busdevfn = (dev->bus->secondary << 8) | dev->devfn;
|
||||||
|
real_mode_switch_call_vga(busdevfn);
|
||||||
} else
|
} else
|
||||||
printk_debug("BAD SIGNATURE 0x%x 0x%x\n", buf[0], buf[1]);
|
printk_debug("BAD SIGNATURE 0x%x 0x%x\n", buf[0], buf[1]);
|
||||||
#ifndef VGABIOS_START
|
#ifndef VGABIOS_START
|
||||||
|
|
Loading…
Add table
Reference in a new issue