Hi Rudolf , I work out some code to make seabios run vgabios when resuming from S3 (follow your advice on IRC, again :) ). And it is unbelievable easy, only 2 step:
Setp 1: In acpi.c
void acpi_jump_to_wakeup(void *vector) { /* just restore the SMP trampoline and continue with wakeup on assembly level */ memcpy(lowmem_backup_ptr, lowmem_backup, lowmem_backup_size); -// acpi_jmp_to_realm_wakeup((u32) vector);
// seabios at entry_post:(in romlayout.S) will check cmos[0x8f] it as a S3 resuming flag. + outb(0x0f, RTC_BASE_PORT + 0); + outb(0xfe, RTC_BASE_PORT + 1);
+ //these two lines has same effect with the above two lines, and I don know 8f or 0f which is better. cmos_read/write in coreboot do not set bit 7. +// outb(0x8f, RTC_BASE_PORT + 0); +// outb(0xfe, RTC_BASE_PORT + 1); + acpi_jmp_to_realm_wakeup(0xffff0); }
Step 2: in seabios->resume.c->s3_resume() smm_init(); + vga_setup(); make_bios_readonly(); u32 s3_resume_vector = find_resume_vector();
And my suggest is to rename acpi_jmp_to_realm_wakeup() to jmp_to_realm_and_back(), and change wakeup.S to be more general by supporting realmode code that running at >1M address.
-jasonzhao
On Fri, Jul 03, 2009 at 03:53:58PM +0800, JasonZhao@viatech.com.cn wrote:
I work out some code to make seabios run vgabios when resuming from S3 (follow your advice on IRC, again :) ). And it is unbelievable easy, only 2 step:
Great!
Setp 1: In acpi.c
[...]
- //these two lines has same effect with the above two lines, and
I don know 8f or 0f which is better. cmos_read/write in coreboot do not set bit 7.
SeaBIOS sets bit 7 in order to disable the NMI - it shouldn't hurt to always set bit 7.
Step 2: in seabios->resume.c->s3_resume() smm_init();
- vga_setup(); make_bios_readonly(); u32 s3_resume_vector = find_resume_vector();
That should work, but it will recopy the rom - adding something like the following to optionroms.c is probably safer:
void s3_resume_vga_init() { if (!CONFIG_S3_RESUME_VGA_INIT) return; struct rom_header *rom = (void*)OPTION_ROM_START; if (! is_valid_rom(rom)) return; callrom(rom, OPTION_ROM_INITVECTOR, 0); }
-Kevin
Kevin O'Connor wrote:
void s3_resume_vga_init() { if (!CONFIG_S3_RESUME_VGA_INIT) return; struct rom_header *rom = (void*)OPTION_ROM_START; if (! is_valid_rom(rom)) return; callrom(rom, OPTION_ROM_INITVECTOR, 0); }
Would this remove the need for the acpi=s3_bios kernel parameter?
I guess this is doing the same thing?
//Peter
On Sat, Jul 04, 2009 at 02:09:28PM +0200, Peter Stuge wrote:
Kevin O'Connor wrote:
void s3_resume_vga_init() { if (!CONFIG_S3_RESUME_VGA_INIT) return; struct rom_header *rom = (void*)OPTION_ROM_START; if (! is_valid_rom(rom)) return; callrom(rom, OPTION_ROM_INITVECTOR, 0); }
Would this remove the need for the acpi=s3_bios kernel parameter?
I guess this is doing the same thing?
I think it is doing the same thing. I committed the above code to seabios, but I left it disabled by default.
Jason, if you use "acpi=s3_bios" does it work without running the rom from seabios?
-Kevin
-----Original Message----- From: Kevin O'Connor [mailto:kevin@koconnor.net] Sent: Saturday, July 04, 2009 11:48 PM To: coreboot@coreboot.org; Jason Zhao Subject: Re: [coreboot] Share my code of running vgabios(in CBFS)
inseabios
when rusume from s3.
On Sat, Jul 04, 2009 at 02:09:28PM +0200, Peter Stuge wrote:
Kevin O'Connor wrote:
void s3_resume_vga_init() { if (!CONFIG_S3_RESUME_VGA_INIT) return; struct rom_header *rom = (void*)OPTION_ROM_START; if (! is_valid_rom(rom)) return; callrom(rom, OPTION_ROM_INITVECTOR, 0); }
Would this remove the need for the acpi=s3_bios kernel parameter?
I guess this is doing the same thing?
I think it is doing the same thing. I committed the above code to seabios, but I left it disabled by default.
Your s3_resume_vga_init() work on my board.
Jason, if you use "acpi=s3_bios" does it work without running the rom from seabios?
"acpi=s3_bios" (or acpi_sleep=s3_bios) do not work on my board. Ubuntu do not call vgabios at 0xc0000 until I press ctrl+alt+f7. And after I press ctrl+alt+f7, tty7 show GUI normal, but tty1~tty5 still have wrong color and lines.
And according to the description of linuxkernel/Documentation/power/video.txt, "(2) systems where it is possible to call the video BIOS during S3 resume. Unfortunately, it is not correct to call the video BIOS at that point, but it happens to work on some machines. Use acpi_sleep=s3_bios."
So calling vgabios in coreboot/seabios should be different with using "acpi=s3_bios".
-Kevin