I have recently put together a basic implementation of a vgabios for use with displays that are initialized by coreboot.
The idea is pretty simple - coreboot initializes the vga hardware and maps a framebuffer into an address in system memory. Then SeaVGABIOS implements the various legacy vga bios functions, but all it does with them is translate them to framebuffer updates. SeaVGABIOS doesn't try to initialize the display, change modes, or modify the vga registers.
This might be useful for those wishing to run fewer third-party blobs, for those where a vgabios isn't available at all, and for those wanting a faster boot (I've found proprietary vga bioses to be very slow).
I've run some basic tests on this version of SeaVGABIOS on my hardware. However, I don't have one of the boards where coreboot supports native vga init. It would be great if someone with the hardware (looks like stout, x60, and maybe others) could run tests.
To build this version of SeaVGABIOS, checkout the testing code from:
https://github.com/KevinOConnor/seabios/tree/testing
Then run "make menuconfig", turn on building for coreboot (CONFIG_COREBOOT), serial debugging (CONFIG_DEBUG_SERIAL), and enable the coreboot vgabios build (CONFIG_VGA_COREBOOT). The resulting vgabios will be in "out/vgabios.bin" - this file should be placed in CBFS in the file "vgaroms/vgabios.bin". Then launch coreboot with seabios as the payload (one can use the repo above to build seabios also, or use the normal coreboot method of building seabios). Ideally, the seabios menu should appear on the screen and basic OS boot loaders will work. But if not, the debugging info should help track down any problems.
-Kevin
Dear Kevin,
Am Mittwoch, den 12.02.2014, 12:58 -0500 schrieb Kevin O'Connor:
I have recently put together a basic implementation of a vgabios for use with displays that are initialized by coreboot.
awesome news!
I've run some basic tests on this version of SeaVGABIOS on my hardware. However, I don't have one of the boards where coreboot supports native vga init. It would be great if someone with the hardware (looks like stout, x60, and maybe others) could run tests.
Thanks to Luc, the VIA K8x890 based boards like Asus M2V-MX SE have had native graphics init for a long time.
commit aeb6c9870f0b1af8c0b55b2034f881da6757c4a4 Author: Luc Verhaegen libv@skynet.be Date: Thu Jul 23 16:04:58 2009 +0000
sb/via/k8t890: add vga textmode code for k8m890 chrome igp.
Add initialisation for the VIA Chrome 9 IGP on the k8m890 through native code and through the general vga infrastructure i committed a month or two ago. Add videoram_size option for k8m890 and the Asus M2V-MX SE.
Looking through the output of
$ git grep k8t890 src/mainboard/
the boards Asus A8V-E Deluxe, Asus A8V-E SE, Asus K8V-X, Asus M2V-MX SE and Asus M2V should theoretically support that.
I’ll try to test it on the Asus M2V-MX SE. Hopefully some other owner is quicker than me.
[…]
Thanks,
Paul
On Wed, Feb 12, 2014 at 10:35:08PM +0100, Paul Menzel wrote:
Am Mittwoch, den 12.02.2014, 12:58 -0500 schrieb Kevin O'Connor:
I have recently put together a basic implementation of a vgabios for use with displays that are initialized by coreboot.
awesome news!
I've run some basic tests on this version of SeaVGABIOS on my hardware. However, I don't have one of the boards where coreboot supports native vga init. It would be great if someone with the hardware (looks like stout, x60, and maybe others) could run tests.
Thanks to Luc, the VIA K8x890 based boards like Asus M2V-MX SE have had native graphics init for a long time.
commit aeb6c9870f0b1af8c0b55b2034f881da6757c4a4 Author: Luc Verhaegen <libv@skynet.be> Date: Thu Jul 23 16:04:58 2009 +0000 sb/via/k8t890: add vga textmode code for k8m890 chrome igp. Add initialisation for the VIA Chrome 9 IGP on the k8m890 through native code and through the general vga infrastructure i committed a month or two ago. Add videoram_size option for k8m890 and the Asus M2V-MX SE.
Looking through the output of
$ git grep k8t890 src/mainboard/
the boards Asus A8V-E Deluxe, Asus A8V-E SE, Asus K8V-X, Asus M2V-MX SE and Asus M2V should theoretically support that.
Okay. The SeaVGABIOS implementation is expecting a coreboot table (LB_TAG_FRAMEBUFFER). So, as long as that is present it should work.
I’ll try to test it on the Asus M2V-MX SE. Hopefully some other owner is quicker than me.
Thanks.
-Kevin
On 13.02.2014 01:23, Kevin O'Connor wrote:
Looking through the output of
$ git grep k8t890 src/mainboard/
the boards Asus A8V-E Deluxe, Asus A8V-E SE, Asus K8V-X, Asus M2V-MX SE and Asus M2V should theoretically support that.
Okay. The SeaVGABIOS implementation is expecting a coreboot table (LB_TAG_FRAMEBUFFER). So, as long as that is present it should work.
LB_TAG_FRAMEBUFFER is present only if display is placed in graphics mode, otherwise EGA text mode is assumed. EGA text mode is much easier to make use of (including for oprom) and more compatible than graphics counterpart. Lenovo X201 init makes use of EGA text mode as well.
On Thu, Feb 13, 2014 at 10:24:21AM +0100, Vladimir 'φ-coder/phcoder' Serbinenko wrote:
On 13.02.2014 01:23, Kevin O'Connor wrote:
Looking through the output of
$ git grep k8t890 src/mainboard/
the boards Asus A8V-E Deluxe, Asus A8V-E SE, Asus K8V-X, Asus M2V-MX SE and Asus M2V should theoretically support that.
Okay. The SeaVGABIOS implementation is expecting a coreboot table (LB_TAG_FRAMEBUFFER). So, as long as that is present it should work.
LB_TAG_FRAMEBUFFER is present only if display is placed in graphics mode, otherwise EGA text mode is assumed. EGA text mode is much easier to make use of (including for oprom) and more compatible than graphics counterpart. Lenovo X201 init makes use of EGA text mode as well.
The SeaVGABIOS code I published is looking for a graphics framebuffer.
-Kevin
On Wed, Feb 12, 2014 at 07:23:14PM -0500, Kevin O'Connor wrote:
On Wed, Feb 12, 2014 at 10:35:08PM +0100, Paul Menzel wrote:
Am Mittwoch, den 12.02.2014, 12:58 -0500 schrieb Kevin O'Connor:
I've run some basic tests on this version of SeaVGABIOS on my hardware. However, I don't have one of the boards where coreboot supports native vga init. It would be great if someone with the hardware (looks like stout, x60, and maybe others) could run tests.
Thanks to Luc, the VIA K8x890 based boards like Asus M2V-MX SE have had native graphics init for a long time.
commit aeb6c9870f0b1af8c0b55b2034f881da6757c4a4 Author: Luc Verhaegen <libv@skynet.be> Date: Thu Jul 23 16:04:58 2009 +0000 sb/via/k8t890: add vga textmode code for k8m890 chrome igp. Add initialisation for the VIA Chrome 9 IGP on the k8m890 through native code and through the general vga infrastructure i committed a month or two ago. Add videoram_size option for k8m890 and the Asus M2V-MX SE.
Looking through the output of
$ git grep k8t890 src/mainboard/
the boards Asus A8V-E Deluxe, Asus A8V-E SE, Asus K8V-X, Asus M2V-MX SE and Asus M2V should theoretically support that.
Okay. The SeaVGABIOS implementation is expecting a coreboot table (LB_TAG_FRAMEBUFFER). So, as long as that is present it should work.
FYI, I updated the test vgabios code to also support "EGA style" text buffers. If the LB_TAG_FRAMEBUFFER table isn't found, then SeaVGABIOS will assume there is an EGA style text buffer.
If anyone wants to give one of the above boards a try, the updated code is at:
https://github.com/KevinOConnor/seabios/tree/testing
Please see my previous email in this thread for directions on how to compile and use this branch.
-Kevin
Subject: [PATCH] vgabios: Add support for native coreboot EGA style text consoles. To: seabios@seabios.org
If a CB_TAG_FRAMEBUFFER coreboot table isn't found, assume there is a standard text mode console mapped at 0xB8000.
Signed-off-by: Kevin O'Connor kevin@koconnor.net --- vgasrc/Kconfig | 3 ++- vgasrc/cbvga.c | 50 ++++++++++++++++++++++++++++++++++---------------- 2 files changed, 36 insertions(+), 17 deletions(-)
diff --git a/vgasrc/Kconfig b/vgasrc/Kconfig index 20ac2ce..00c5000 100644 --- a/vgasrc/Kconfig +++ b/vgasrc/Kconfig @@ -55,6 +55,7 @@ menu "VGA ROM" config VGA_COREBOOT depends on COREBOOT bool "coreboot linear framebuffer" + select VGA_STDVGA_FRAMEBUFFER select VGA_HIGH_FRAMEBUFFER help Build support for a vgabios wrapper around video @@ -116,7 +117,7 @@ menu "VGA ROM" Support VBE.
config VGA_PCI - depends on BUILD_VGABIOS + depends on BUILD_VGABIOS && !VGA_COREBOOT bool "PCI ROM Headers" default y help diff --git a/vgasrc/cbvga.c b/vgasrc/cbvga.c index d3dc2a4..305c798 100644 --- a/vgasrc/cbvga.c +++ b/vgasrc/cbvga.c @@ -7,19 +7,19 @@ #include "biosvar.h" // GET_BDA #include "cbvga.h" // cbvga_setup #include "output.h" // dprintf +#include "stdvga.h" // SEG_CTEXT +#include "string.h" // memset16_far #include "util.h" // find_cb_table #include "vgabios.h" // VGAREG_*
-#define CBMODENUM 0x140 -static struct vgamode_s CBmode VAR16 = { - MM_DIRECT, 0, 0, 0, 8, 16, 0 -}; +static int CBmode VAR16; +static struct vgamode_s CBmodeinfo VAR16; static u32 CBlinelength VAR16;
struct vgamode_s *cbvga_find_mode(int mode) { - if (mode == CBMODENUM) - return &CBmode; + if (mode == GET_GLOBAL(CBmode)) + return &CBmodeinfo; return NULL; }
@@ -27,7 +27,7 @@ void cbvga_list_modes(u16 seg, u16 *dest, u16 *last) { if (dest<last) { - SET_FARVAR(seg, *dest, CBMODENUM); + SET_FARVAR(seg, *dest, GET_GLOBAL(CBmode)); dest++; } SET_FARVAR(seg, *dest, 0xffff); @@ -93,7 +93,11 @@ int cbvga_set_mode(struct vgamode_s *vmode_g, int flags) { if (!(flags & MF_NOCLEARMEM)) { - int i, lines = GET_GLOBAL(CBmode.height); + if (GET_GLOBAL(CBmodeinfo.memmodel) == MM_TEXT) { + memset16_far(SEG_CTEXT, (void*)0, 0x0720, 80*25*2); + return 0; + } + int i, lines = GET_GLOBAL(CBmodeinfo.height); u32 stride = GET_GLOBAL(CBlinelength); void *dest = (void*)GET_GLOBAL(VBE_framebuffer); for (i=0; i<lines; i++, dest+=stride) @@ -137,8 +141,18 @@ cbvga_setup(void) } struct cb_framebuffer *cbfb = find_cb_subtable(cbh, CB_TAG_FRAMEBUFFER); if (!cbfb) { - dprintf(1, "Unable to find coreboot framebuffer table\n"); - return -1; + // Assume there is an EGA text framebuffer. + dprintf(1, "Did not find coreboot framebuffer - assuming EGA text\n"); + SET_VGA(CBmode, 0x03); + SET_VGA(CBlinelength, 80*2); + SET_VGA(CBmodeinfo.memmodel, MM_TEXT); + SET_VGA(CBmodeinfo.width, 80); + SET_VGA(CBmodeinfo.height, 25); + SET_VGA(CBmodeinfo.depth, 4); + SET_VGA(CBmodeinfo.cwidth, 9); + SET_VGA(CBmodeinfo.cheight, 16); + SET_VGA(CBmodeinfo.sstart, SEG_CTEXT); + return 0; }
u64 addr = GET_FARVAR(0, cbfb->physical_address); @@ -155,15 +169,19 @@ cbvga_setup(void) return -1; }
+ SET_VGA(CBmode, 0x140); SET_VGA(VBE_framebuffer, addr); SET_VGA(VBE_total_memory, linelength * ylines); SET_VGA(CBlinelength, linelength); - SET_VGA(CBmode.width, xlines); - SET_VGA(CBmode.height, ylines); - SET_VGA(CBmode.depth, bpp); - - // Setup BDA - vga_set_mode(CBMODENUM, MF_NOCLEARMEM); + SET_VGA(CBmodeinfo.memmodel, MM_DIRECT); + SET_VGA(CBmodeinfo.width, xlines); + SET_VGA(CBmodeinfo.height, ylines); + SET_VGA(CBmodeinfo.depth, bpp); + SET_VGA(CBmodeinfo.cwidth, 8); + SET_VGA(CBmodeinfo.cheight, 16); + + // Setup BDA and clear screen. + vga_set_mode(GET_GLOBAL(CBmode), MF_NOCLEARMEM);
return 0; }
Am Montag, den 17.02.2014, 02:54 -0500 schrieb Kevin O'Connor:
On Wed, Feb 12, 2014 at 07:23:14PM -0500, Kevin O'Connor wrote:
On Wed, Feb 12, 2014 at 10:35:08PM +0100, Paul Menzel wrote:
Am Mittwoch, den 12.02.2014, 12:58 -0500 schrieb Kevin O'Connor:
I've run some basic tests on this version of SeaVGABIOS on my hardware. However, I don't have one of the boards where coreboot supports native vga init. It would be great if someone with the hardware (looks like stout, x60, and maybe others) could run tests.
Thanks to Luc, the VIA K8x890 based boards like Asus M2V-MX SE have had native graphics init for a long time.
commit aeb6c9870f0b1af8c0b55b2034f881da6757c4a4 Author: Luc Verhaegen <libv@skynet.be> Date: Thu Jul 23 16:04:58 2009 +0000 sb/via/k8t890: add vga textmode code for k8m890 chrome igp. Add initialisation for the VIA Chrome 9 IGP on the k8m890 through native code and through the general vga infrastructure i committed a month or two ago. Add videoram_size option for k8m890 and the Asus M2V-MX SE.
Looking through the output of
$ git grep k8t890 src/mainboard/
the boards Asus A8V-E Deluxe, Asus A8V-E SE, Asus K8V-X, Asus M2V-MX SE and Asus M2V should theoretically support that.
Okay. The SeaVGABIOS implementation is expecting a coreboot table (LB_TAG_FRAMEBUFFER). So, as long as that is present it should work.
FYI, I updated the test vgabios code to also support "EGA style" text buffers. If the LB_TAG_FRAMEBUFFER table isn't found, then SeaVGABIOS will assume there is an EGA style text buffer.
If anyone wants to give one of the above boards a try, the updated code is at:
https://github.com/KevinOConnor/seabios/tree/testing
Please see my previous email in this thread for directions on how to compile and use this branch.
Thank you for the update and the detailed instructions. As already reported in the IRC channel #coreboot [1], I successfully tested this patch on the Asus M2V-MX SE with GRUB on the hard drive. Please find the serial log attached.
Tested-by: Paul Menzel paulepanter@users.sourceforge.net
Thanks,
Paul
On Wed, 12 Feb 2014 12:58:11 -0500 Kevin O'Connor kevin@koconnor.net wrote:
I have recently put together a basic implementation of a vgabios for use with displays that are initialized by coreboot.
Sorry, I've a huge mail backlog.
To build this version of SeaVGABIOS, checkout the testing code from:
I've tested it like that: * I've added it to my branch where I rebased the lenovo x60 native GPU init patches left, and the rest that I want and that isn't in coreboot yet. * by default it boots under grub as a payload, so I added seabios in payloads/seabios in cbfs, so my cbfs looks like that:
cmos_layout.bin 0x0 cmos_layout 1828 cmos.default 0x780 cmos_default 256 fallback/romstage 0x8c0 stage 52356 fallback/coreboot_ram 0xd580 stage 82524 fallback/payload 0x21840 payload 296852 etc/grub.cfg 0x6a040 raw 2885 config 0x6abc0 raw 4870 payloads/seabios 0x6bf00 payload 105960 vgaroms/sgabios.bin 0x85d40 raw 24064 etc/ps2-keyboard-spinup 0x8bb80 raw 8
Then It booted in grub as usual, which used the framebuffer inited by coreboot, so at that point I did: set root=cbfsdisk chainloader /payloads/seabios # the command started with chain I don't remember its name well, but it's something like that clear # we'll see why later boot
Then seabios started, and I saw the press F12 on the screen which overwrote the previous already-there and not-cleared grub stuff (that's why I used clear before). Since I had etc/ps2-keyboard-spinup, the keyboard worked and the AHCI disk was listed after pressing F12 Then I told it to boot on it, and it loaded the older grub that was in it The version should be that one from parabola (a 100% free software GNU/Linux distribution based on arch):
libre/grub 1:2.02.beta2-1.1 [installed]
That displayed me a prompt, since I didn't setup a grub.cfg, and I could interact with it too.
The coreboot branch I used can be obtained that way: git clone git://gitorious.org/gnutoo-for-coreboot/coreboot.git coreboot-x60 git checkout origin/production+v7_untested -b production+v7
I'll try to boot some live-usb soon.
Thanks a lot!!! I wanted that feature so badly that I looked at it and started trying to do that more than 6 months ago, but then I got no time anymore to work on that.
PS: note that this branch broke the 3D acceleration, I should try to fix it when time permits.
Denis.
On Sun, Feb 16, 2014 at 07:30:30PM +0100, Denis 'GNUtoo' Carikli wrote:
Then seabios started, and I saw the press F12 on the screen which overwrote the previous already-there and not-cleared grub stuff (that's why I used clear before).
Yeah, the clearing can probably be fixed up in the vgabios (see below). There's also no cursor, which can probably be enhanced as well.
Since I had etc/ps2-keyboard-spinup, the keyboard worked and the AHCI disk was listed after pressing F12
I'm surprised you need ps2-keyboard-spinup if you chain load seabios.
Then I told it to boot on it, and it loaded the older grub that was in it The version should be that one from parabola (a 100% free software GNU/Linux distribution based on arch):
libre/grub 1:2.02.beta2-1.1 [installed]
That displayed me a prompt, since I didn't setup a grub.cfg, and I could interact with it too.
Thats great! Thanks for testing.
-Kevin
--- a/vgasrc/cbvga.c +++ b/vgasrc/cbvga.c @@ -162,8 +162,8 @@ cbvga_setup(void) SET_VGA(CBmode.height, ylines); SET_VGA(CBmode.depth, bpp);
- // Setup BDA - vga_set_mode(CBMODENUM, MF_NOCLEARMEM); + // Setup BDA and clear screen. + vga_set_mode(CBMODENUM, 0);
return 0; }
On Sun, 16 Feb 2014 14:51:47 -0500 Kevin O'Connor kevin@koconnor.net wrote:
There's also no cursor, which can probably be enhanced as well.
Yes, I tested more, with seabios directly as a payload, for giving my old Lenovo x60 to someone and spending less time right now to explain him how to configure well grub to be used as a payload. And I saw the cursor issue, that's the most annoying issue because the grub( ran in BIOS platform mode ) that is loaded from disk doesn't show a cursor when editing the menu contents with 'e'
I'm surprised you need ps2-keyboard-spinup if you chain load seabios.
I'll retest soon.
--- a/vgasrc/cbvga.c +++ b/vgasrc/cbvga.c @@ -162,8 +162,8 @@ cbvga_setup(void) SET_VGA(CBmode.height, ylines); SET_VGA(CBmode.depth, bpp);
- // Setup BDA
- vga_set_mode(CBMODENUM, MF_NOCLEARMEM);
// Setup BDA and clear screen.
vga_set_mode(CBMODENUM, 0);
return 0;
}
Thanks a lot, I'll try that as soon as possible, but it's like 23:30 now here, so it'll be for another day.
Denis.
Denis 'GNUtoo' Carikli wrote:
I've tested it like that:
- I've added it to my branch where I rebased the lenovo x60 native GPU init patches left, and the rest that I want and that isn't in coreboot yet.
The commits from your branch which you pushed with me as author and which four other developers reviewed and finally submitted, without spotting bugs present in some commits and with talking to me, will be reverted because they're nowhere near ready for inclusion in the repository.
There is a lot more work required for us to have a maintainable implementation of native graphics init for i945 platforms.
We'll get there eventually, but the code that many people consider "works" is an incredibly fragile proof of concept at very best.
//Peter
On Sunday, February 16, 2014 11:42:57 PM Peter Stuge wrote:
Denis 'GNUtoo' Carikli wrote:
[...]
The commits from your branch which you pushed with me as author and which four other developers reviewed and finally submitted, without spotting bugs present in some commits and with talking to me, will be reverted because they're nowhere near ready for inclusion in the repository.
Well, the patches to revert those commits have been up on gerrit for over a month. Why you chose to not merge them is beyond me.
Alex
Hi,
I've run some basic tests on this version of SeaVGABIOS on my hardware. However, I don't have one of the boards where coreboot supports native vga init. It would be great if someone with the hardware (looks like stout, x60, and maybe others) could run tests.
qemu has native vga init support too.
You probably want boot your VM without vgabios in the pci rom bar though, otherwise seabios will load and run it:
qemu -device VGA,romfile=
cheers, Gerd
On Mon, Feb 17, 2014 at 11:31:29AM +0100, Gerd Hoffmann wrote:
Hi,
I've run some basic tests on this version of SeaVGABIOS on my hardware. However, I don't have one of the boards where coreboot supports native vga init. It would be great if someone with the hardware (looks like stout, x60, and maybe others) could run tests.
qemu has native vga init support too.
You mean with vga pass-through? Is there value in supporting a vgabios for qemu in this situation?
-Kevin
You probably want boot your VM without vgabios in the pci rom bar though, otherwise seabios will load and run it:
qemu -device VGA,romfile=
cheers, Gerd
On Mo, 2014-02-17 at 10:28 -0500, Kevin O'Connor wrote:
On Mon, Feb 17, 2014 at 11:31:29AM +0100, Gerd Hoffmann wrote:
Hi,
I've run some basic tests on this version of SeaVGABIOS on my hardware. However, I don't have one of the boards where coreboot supports native vga init. It would be great if someone with the hardware (looks like stout, x60, and maybe others) could run tests.
qemu has native vga init support too.
You mean with vga pass-through?
No. I mean coreboot has drivers for the qemu emulated vga cards, so there is a coreboot framebuffer when running coreboot as qemu firmware. i.e. you can test this in qemu.
cheers, Gerd