Submitter | Stefan Reinauer |
---|---|
Date | 2009-10-24 22:47:47 |
Message ID | <4AE38413.5020102@coresystems.de> |
Download | mbox | patch |
Permalink | /patch/478/ |
State | Accepted |
Commit | r4852 |
Headers | show |
Comments
Stefan Reinauer wrote: > Option ROM init x86/x86emu update > > - use default display in int 15 5f35 > - move REALMODE_BASE to 0x600, 0x500 can be BDA > - add regparm for assembler functions > - use memset instead of own implementation > - YABEL: copy back the IVT, BDA and VBIOS. Some Xorg drivers require this. Which drivers? Please try to avoid this type of ambiguousness. (Also for the ACPI patch.) It's a real headache for someone who doesn't know which drivers (like me) to figure out if this is the source of some of my problems, or not. > - YABEL: use hardware timer instead of emulated timer, because the emulated > timer's base is never initialized (leading to division by zero if the > timer is really used) > > Signed-off-by: Stefan Reinauer <stepan@coresystems.de> Acked-by: Peter Stuge <peter@stuge.se>
Peter Stuge wrote: > Stefan Reinauer wrote: > >> Option ROM init x86/x86emu update >> >> - use default display in int 15 5f35 >> - move REALMODE_BASE to 0x600, 0x500 can be BDA >> - add regparm for assembler functions >> - use memset instead of own implementation >> - YABEL: copy back the IVT, BDA and VBIOS. Some Xorg drivers require this. >> > > Which drivers? Please try to avoid this type of ambiguousness. (Also > for the ACPI patch.) It's a real headache for someone who doesn't > know which drivers (like me) to figure out if this is the source of > some of my problems, or not. > Well, you can always try if this solved your problem ... What problems are you seeing in particular with your hardware? As you might imagine I did not test this on the majority of boards, so I can't give a full list of Xorg drivers with the problem, neither chipsets nor versions. >> - YABEL: use hardware timer instead of emulated timer, because the emulated >> timer's base is never initialized (leading to division by zero if the >> timer is really used) >> >> Signed-off-by: Stefan Reinauer <stepan@coresystems.de> >> > > Acked-by: Peter Stuge <peter@stuge.se> > > r4852.
Stefan Reinauer wrote: > >> - YABEL: copy back the IVT, BDA and VBIOS. Some Xorg drivers > >> require this. > > > > Which drivers? > > As you might imagine I did not test this on the majority of boards, > so I can't give a full list of Xorg drivers with the problem, Ah, no, of course not, but it would be great to just list the ones you know about. //Peter
Peter Stuge wrote: > Stefan Reinauer wrote: > >>>> - YABEL: copy back the IVT, BDA and VBIOS. Some Xorg drivers >>>> require this. >>>> >>> Which drivers? >>> >> As you might imagine I did not test this on the majority of boards, >> so I can't give a full list of Xorg drivers with the problem, >> > > Ah, no, of course not, but it would be great to just list the ones > you know about. > Basically, what happens is that some drivers seem to do BIOS callbacks to set the display modes. On x86-64 the VGA option rom is executed in x86emu mode, so strictly speaking only a vga option rom is needed at 0xc0000. On x86(-32) systems vm86 is used by Xorg, and the card is (afaik) not (always) re-initialized, so in addition to that the IVT has to be intact. With seabios that is always the case, but with x86emu/yabel and FILO the copying is needed in order to be able to start X. Otherwise the X server will end itself after unsuccessfully attempting to set a mode. For the record, this happened to me on a i945 system with onboard graphics and a not-so-recent debian derivative. Things might be different with newer Xorgs and kernel mode setting, but I don't know for sure. Yet, assuming that the VGA option rom and IVT stays intact is probably fair on an x86 system. Stefan
On Mon, 26 Oct 2009 12:53:27 +0100, Stefan Reinauer <stepan@coresystems.de> wrote: > Peter Stuge wrote: >> Stefan Reinauer wrote: >> >>>>> - YABEL: copy back the IVT, BDA and VBIOS. Some Xorg drivers >>>>> require this. >>>>> >>>> Which drivers? >>>> >>> As you might imagine I did not test this on the majority of boards, >>> so I can't give a full list of Xorg drivers with the problem, >>> >> >> Ah, no, of course not, but it would be great to just list the ones >> you know about. >> > Basically, what happens is that some drivers seem to do BIOS callbacks > to set the display modes. > > On x86-64 the VGA option rom is executed in x86emu mode, so strictly > speaking only a vga option rom is needed at 0xc0000. > > On x86(-32) systems vm86 is used by Xorg, and the card is (afaik) not > (always) re-initialized, so in addition to that the IVT has to be > intact. With seabios that is always the case, but with x86emu/yabel and > FILO the copying is needed in order to be able to start X. Otherwise the > X server will end itself after unsuccessfully attempting to set a mode. > > For the record, this happened to me on a i945 system with onboard > graphics and a not-so-recent debian derivative. Things might be > different with newer Xorgs and kernel mode setting, but I don't know for > sure. Yet, assuming that the VGA option rom and IVT stays intact is > probably fair on an x86 system. > Now that you mention it, this does sound familiar Stefan
Patch
Index: util/x86emu/x86_interrupts.c =================================================================== --- util/x86emu/x86_interrupts.c (revision 4842) +++ util/x86emu/x86_interrupts.c (working copy) @@ -206,6 +206,7 @@ regs->eax = 0x860f; break; /* And now Intel IGD code */ +#define BOOT_DISPLAY_DEFAULT 0 #define BOOT_DISPLAY_CRT (1 << 0) #define BOOT_DISPLAY_TV (1 << 1) #define BOOT_DISPLAY_EFP (1 << 2) @@ -217,7 +218,7 @@ case 0x5f35: regs->eax = 0x5f; - regs->ecx = BOOT_DISPLAY_LCD|BOOT_DISPLAY_CRT; + regs->ecx = BOOT_DISPLAY_DEFAULT; res = 0; break; case 0x5f40: Index: util/x86emu/x86.c =================================================================== --- util/x86emu/x86.c (revision 4842) +++ util/x86emu/x86.c (working copy) @@ -29,7 +29,7 @@ #include <console.h> #endif -#define REALMODE_BASE ((void *)0x500) +#define REALMODE_BASE ((void *)0x600) struct realmode_idt { u16 offset, cs; @@ -41,8 +41,8 @@ extern unsigned char __realmode_code, __realmode_code_size; extern unsigned char __run_optionrom, __run_interrupt; -void (*run_optionrom)(u32 devfn) = (void *)&__run_optionrom; -void (*vga_enable_console)(void) = (void *)&__run_interrupt; +void (*run_optionrom)(u32 devfn) __attribute__((regparm(0))) = (void *)&__run_optionrom; +void (*vga_enable_console)(void) __attribute__((regparm(0))) = (void *)&__run_interrupt; int (*intXX_handler[256])(struct eregs *regs) = { NULL }; @@ -127,9 +127,7 @@ int i; /* clear vga bios data area */ - for (i = 0x400; i < 0x500; i++) { - *(unsigned char *) i = 0; - } + memset(0x400, 0, 0x200); /* Set up C interrupt handlers */ setup_interrupt_handlers(); Index: util/x86emu/x86_asm.S =================================================================== --- util/x86emu/x86_asm.S (revision 4842) +++ util/x86emu/x86_asm.S (working copy) @@ -17,7 +17,7 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ -#define REALMODE_BASE 0x500 +#define REALMODE_BASE 0x600 #define RELOCATED(x) (x - __realmode_code + REALMODE_BASE) /* CR0 bits */ Index: util/x86emu/yabel/compat/functions.c =================================================================== --- util/x86emu/yabel/compat/functions.c (revision 4842) +++ util/x86emu/yabel/compat/functions.c (working copy) @@ -17,6 +17,7 @@ #ifndef CONFIG_COREBOOT_V2 #include <config.h> #endif +#include <string.h> #include <device/device.h> #define VMEM_SIZE 1024 *1024 /* 1 MB */ @@ -33,6 +34,9 @@ void run_bios(struct device * dev, unsigned long addr) { biosemu(vmem, VMEM_SIZE, dev, addr); + memcpy(0x0, vmem + 0x0, 0x400); + memcpy(0x400, vmem + 0x400, 0x100); + memcpy(0xc0000, vmem + 0xc0000, 0x10000); } u64 get_time(void) Index: util/x86emu/yabel/io.c =================================================================== --- util/x86emu/yabel/io.c (revision 4842) +++ util/x86emu/yabel/io.c (working copy) @@ -36,6 +36,9 @@ //defined in net-snk/kernel/timer.c extern u64 get_time(void); +#ifdef COREBOOT_V2 +#include <arch/io.h> +#else // these are not used, only needed for linking, must be overridden using X86emu_setupPioFuncs // with the functions and struct below void @@ -82,7 +85,7 @@ HALT_SYS(); return 0; } - +#endif u32 pci_cfg_read(X86EMU_pioAddr addr, u8 size); void pci_cfg_write(X86EMU_pioAddr addr, u32 val, u8 size); u8 handle_port_61h(void); @@ -106,7 +109,8 @@ switch (addr) { case 0x61: //8254 KB Controller / Timer Port - rval = handle_port_61h(); + // rval = handle_port_61h(); + rval = inb(0x61); //DEBUG_PRINTF_IO("%s(%04x) KB / Timer Port B --> %02x\n", __func__, addr, rval); return rval; break;