seabios.git
12 years agovgabios: Use stored total memory in cirrus code instead of recalculating.
Kevin O'Connor [Sat, 21 Jan 2012 15:43:30 +0000 (10:43 -0500)]
vgabios: Use stored total memory in cirrus code instead of recalculating.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
12 years agovgabios: Check that the PCI BDF passed in is valid before using.
Kevin O'Connor [Tue, 17 Jan 2012 00:05:27 +0000 (19:05 -0500)]
vgabios: Check that the PCI BDF passed in is valid before using.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
12 years agovgabios: Simplify planar4 vgafb code.
Kevin O'Connor [Mon, 16 Jan 2012 23:48:26 +0000 (18:48 -0500)]
vgabios: Simplify planar4 vgafb code.

Don't bother programming the vga registers to manipulate the
framebuffer when in planar4 mode.  Instead, just switch between the
four planes and do the manipulation with regular reads and writes.
This makes the code simpler to understand (the vga hardware
manipulations are arcane and complex).

Note, this could make text scrolling in planar4 mode slower and more
likely to result in tearing.  However, it's unlikely anything
important uses the vgabios in planar4 mode.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
12 years agovgabios: Use regular pci_config_readl func in geode code.
Kevin O'Connor [Sun, 15 Jan 2012 05:06:33 +0000 (00:06 -0500)]
vgabios: Use regular pci_config_readl func in geode code.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
12 years agovgabios: Don't have geode code peak into stdvga mode struct.
Kevin O'Connor [Sun, 15 Jan 2012 04:25:24 +0000 (23:25 -0500)]
vgabios: Don't have geode code peak into stdvga mode struct.

Create a wrapper (stdvga_override_crtc) so the Geode code doesn't need
to access the stdvga mode tables directly.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
12 years agovgabios: Make VBE code depend on a config setting.
Kevin O'Connor [Sun, 15 Jan 2012 07:43:19 +0000 (02:43 -0500)]
vgabios: Make VBE code depend on a config setting.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
12 years agovgabios: Move vgabios Kconfig definitions to vgasrc/Kconfig.
Kevin O'Connor [Sun, 15 Jan 2012 07:01:24 +0000 (02:01 -0500)]
vgabios: Move vgabios Kconfig definitions to vgasrc/Kconfig.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
12 years agovgabios: Build vgabios by default if enabled in Kconfig.
Kevin O'Connor [Sun, 15 Jan 2012 06:52:27 +0000 (01:52 -0500)]
vgabios: Build vgabios by default if enabled in Kconfig.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
12 years agovgabios: Improve vgabios Kconfig menu.
Kevin O'Connor [Sun, 15 Jan 2012 06:12:20 +0000 (01:12 -0500)]
vgabios: Improve vgabios Kconfig menu.

Place driver types in a "choice" selection - only one driver type
makes sense.

Only prompt the user for PCI Vendor/Device ids if they wish to
override the default choices.  Otherwise, Kconfig wont know to use the
proper defaults when building autoconf.h.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
12 years agovgabios: Rename vgatables.c to stdvgamodes.c.
Kevin O'Connor [Sun, 15 Jan 2012 04:20:05 +0000 (23:20 -0500)]
vgabios: Rename vgatables.c to stdvgamodes.c.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
12 years agovgabios: Move video_param_table definition to vgabios.c.
Kevin O'Connor [Sun, 15 Jan 2012 04:15:40 +0000 (23:15 -0500)]
vgabios: Move video_param_table definition to vgabios.c.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
12 years agovgabios: Move static_functionality[] from vgatables.c to vgabios.c.
Kevin O'Connor [Sun, 15 Jan 2012 03:55:11 +0000 (22:55 -0500)]
vgabios: Move static_functionality[] from vgatables.c to vgabios.c.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
12 years agovgabios: Use standard VGA IO wrappers in geodevga.c.
Kevin O'Connor [Sun, 15 Jan 2012 03:18:18 +0000 (22:18 -0500)]
vgabios: Use standard VGA IO wrappers in geodevga.c.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
12 years agovgabios: Use standard VGA IO wrappers in clext.c.
Kevin O'Connor [Sun, 15 Jan 2012 03:18:02 +0000 (22:18 -0500)]
vgabios: Use standard VGA IO wrappers in clext.c.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
12 years agovgabios: Use standard VGA IO wrapper functions in bochsvga.
Kevin O'Connor [Sun, 15 Jan 2012 03:17:43 +0000 (22:17 -0500)]
vgabios: Use standard VGA IO wrapper functions in bochsvga.

Also, this alters some of the IO port settings in bochsvga_set_mode to
fix what looks like errors during the asm to C conversion.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
12 years agovgabios: Use standard VGA IO wrapper functions in stdvga.c.
Kevin O'Connor [Sun, 15 Jan 2012 03:17:07 +0000 (22:17 -0500)]
vgabios: Use standard VGA IO wrapper functions in stdvga.c.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
12 years agovgabios: Add wrapper functions for accessing standard VGA registers.
Kevin O'Connor [Sun, 15 Jan 2012 00:02:43 +0000 (19:02 -0500)]
vgabios: Add wrapper functions for accessing standard VGA registers.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
12 years agovgabios: Add cirrus linear framebuffer detection; enable VBE in cirrus.
Kevin O'Connor [Sat, 14 Jan 2012 21:59:21 +0000 (16:59 -0500)]
vgabios: Add cirrus linear framebuffer detection; enable VBE in cirrus.

Extract Cirrus framebuffer address from PCI config space.

Enable VBE code for Cirrus cards.

Also, rework bochsvga code to use direct PCI accesses instead of
calling into the BIOS.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
12 years agovgabios: Hook up Cirrus extended bios functions.
Kevin O'Connor [Sat, 14 Jan 2012 21:30:49 +0000 (16:30 -0500)]
vgabios: Hook up Cirrus extended bios functions.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
12 years agovgabios: Make cirrus line lengths standard.
Kevin O'Connor [Sat, 14 Jan 2012 19:52:01 +0000 (14:52 -0500)]
vgabios: Make cirrus line lengths standard.

Only two modes don't match their expected line length.  One looks like
a bug (it has a virtual line length of 1280 for a screen of 1600
bytes) and one looks like an optimization (2048 vs 1920).  Change the
mode line lengths to exactly match the expected line lengths so that
the VBE code is correct.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
12 years agovgabios: Unify cirrus and vbe vesa functions.
Kevin O'Connor [Sat, 14 Jan 2012 03:08:52 +0000 (22:08 -0500)]
vgabios: Unify cirrus and vbe vesa functions.

Unify the code for the Cirrus and VBE vesa functions 00-03.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
12 years agovgabios: Make VBE code independent of bochsvga.
Kevin O'Connor [Sat, 14 Jan 2012 01:00:35 +0000 (20:00 -0500)]
vgabios: Make VBE code independent of bochsvga.

Introduce new global variables (VBE_enabled, VBE_total_memory,
VBE_capabilities, VBE_framebuffer) to replace the need for function
calls that were specific to bochsvga.

Replace info received from bochsvga_mode_info with info found in
vgahw_find_mode.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
12 years agovgabios: Unify code to generate the vbe mode list.
Kevin O'Connor [Tue, 10 Jan 2012 01:55:31 +0000 (20:55 -0500)]
vgabios: Unify code to generate the vbe mode list.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
12 years agovgabios: Use vgamode_s in cirrus and bochsvga mode tables.
Kevin O'Connor [Tue, 10 Jan 2012 01:21:31 +0000 (20:21 -0500)]
vgabios: Use vgamode_s in cirrus and bochsvga mode tables.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
12 years agovgabios: Extract out common parts of struct vgamode_s.
Kevin O'Connor [Tue, 10 Jan 2012 00:19:44 +0000 (19:19 -0500)]
vgabios: Extract out common parts of struct vgamode_s.

Extract out the fields in 'struct vgamode_s' that are used in the main
code.  The remaining fields are specific to the standard vga hardware
driver.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
12 years agovgabios: Unify page size calculations; remove page size from vgamode_s.
Kevin O'Connor [Sat, 7 Jan 2012 23:27:19 +0000 (18:27 -0500)]
vgabios: Unify page size calculations; remove page size from vgamode_s.

The previous code could obtain the page size in different ways - from
vmode_g->sslength, from SCREEN_MEM_START, or by manually multiplying
cols and rows.  Add a new func (calc_page_size) and use that in areas
that need to calculate the page size.

Convert readers of the page size to read it from the "video_pagesize"
entry in the BDA instead of recalculating it.

Remove the page size from struct vgamode_s (slength) as it is now
calculated dynamically.  The new calculated versions are different
from the existing values exported in video_param_table.  However, the
existing values (for CGA) did not look correct - I compared the values
to those exported by two other VGA BIOS manufacturers and used the
values that look more standard.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
12 years agovgabios: Add memmodel field to bochsvga mode list.
Kevin O'Connor [Mon, 2 Jan 2012 16:32:11 +0000 (11:32 -0500)]
vgabios: Add memmodel field to bochsvga mode list.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
12 years agovgabios: Make struct vgamode_s more similar to bochs/cirrus mode tables.
Kevin O'Connor [Mon, 2 Jan 2012 16:13:14 +0000 (11:13 -0500)]
vgabios: Make struct vgamode_s more similar to bochs/cirrus mode tables.

For graphics modes, store pixel width/height instead of text
width/height.  Add explicit char width field.  Where needed, calculate
text width/height from pixel width/height by dividing pixel count by
character size.

Rename some fields and change field sizes to match cirrus/bochs
definitions.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
12 years agovgabios: Remove dummy 0xfe mode from list of cirrus modes.
Kevin O'Connor [Mon, 2 Jan 2012 15:51:26 +0000 (10:51 -0500)]
vgabios: Remove dummy 0xfe mode from list of cirrus modes.

The 0xfe mode isn't a real mode, it's a place holder for settings
needed to switch back to non-cirrus modes.  Handle it that way.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
12 years agovgabios: Add char width to stdvga mode table.
Kevin O'Connor [Mon, 2 Jan 2012 07:35:07 +0000 (02:35 -0500)]
vgabios: Add char width to stdvga mode table.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
12 years agovgabios: Use standard naming for cirrus memmodel.
Kevin O'Connor [Mon, 2 Jan 2012 07:23:17 +0000 (02:23 -0500)]
vgabios: Use standard naming for cirrus memmodel.

The cirrus mode array stores memmodel as vesacolortype - rename it to
'memmodel' and use common field names.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
12 years agovgabios: Use vesa style memory model flags in stdvga code.
Kevin O'Connor [Sun, 1 Jan 2012 17:32:53 +0000 (12:32 -0500)]
vgabios: Use vesa style memory model flags in stdvga code.

Replace the custom flags with the flags defined in the VBE spec.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
12 years agoBCVs should inherrit the legacy harddrive priority.
Kevin O'Connor [Sat, 14 Jan 2012 16:58:14 +0000 (11:58 -0500)]
BCVs should inherrit the legacy harddrive priority.

A BCV will (almost assuredly) be a hard drive, so it makes sense to
prioritize them the same as builtin hard drives when only the legacy
priority system is used.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
12 years agoPermit multiple BEV and BEV/BCV combinations in a single option rom.
Kevin O'Connor [Sat, 14 Jan 2012 16:55:35 +0000 (11:55 -0500)]
Permit multiple BEV and BEV/BCV combinations in a single option rom.

The BBS spec is unclear on multiple BEV entry points for a rom.
However, the LSI scsi rom has been seen to register a BEV followed by
multiple BCV entry points.  Add support for it, as there's no harm in
it.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
12 years agovgabios: Actually remove vgasrc/geodelx.[ch] - fixup of patch apply.
Kevin O'Connor [Sat, 14 Jan 2012 17:57:03 +0000 (12:57 -0500)]
vgabios: Actually remove vgasrc/geodelx.[ch] - fixup of patch apply.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
12 years agovgabios: Add the geode GX2 functionality.
Nils [Sat, 14 Jan 2012 17:15:14 +0000 (12:15 -0500)]
vgabios: Add the geode GX2 functionality.

Signed-off-by: Nils Jacobs <njacobs8 at adsltotaal.nl>
12 years agovgabios: Some little geode cleanup.
Nils [Sat, 14 Jan 2012 17:13:34 +0000 (12:13 -0500)]
vgabios: Some little geode cleanup.

Signed-off-by: Nils Jacobs <njacobs8 at adsltotaal.nl>
12 years agovgabios: Make the naming in the LX code generic to Geode.
Nils [Sat, 14 Jan 2012 17:11:41 +0000 (12:11 -0500)]
vgabios: Make the naming in the LX code generic to Geode.

Signed-off-by: Nils Jacobs <njacobs8 at adsltotaal.nl>
12 years agovgabios: Add scrolling for linear (packed pixel) graphics mode.
Kevin O'Connor [Sun, 1 Jan 2012 16:04:42 +0000 (11:04 -0500)]
vgabios: Add scrolling for linear (packed pixel) graphics mode.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
12 years agovgabios: Minor - make FB scroll functions look similar.
Kevin O'Connor [Sun, 1 Jan 2012 15:54:19 +0000 (10:54 -0500)]
vgabios: Minor - make FB scroll functions look similar.

All three scroll function variants have the same format, but those
that have an implicit character width or height of 1 have those
multiplications omitted.  Add those multiplications back in (the
compiler will optimize them away) so all the variants look similar.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
12 years agovgabios: Framebuffer fixes for CGA and planar graphics modes.
Kevin O'Connor [Sun, 1 Jan 2012 15:33:51 +0000 (10:33 -0500)]
vgabios: Framebuffer fixes for CGA and planar graphics modes.

Fix missing divide by 2 in CGA mode scroll.  Consistently use
cheight/2 for all uses.

Planar graphics character write has a read to video memory with a side
effect - mark that as volatile so the compiler doesn't optimize it
away.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
12 years agovgabios: Unify X_init() functions.
Kevin O'Connor [Sun, 1 Jan 2012 00:42:21 +0000 (19:42 -0500)]
vgabios: Unify X_init() functions.

Use the same function signature for cirrus, bochsvga, geodelx, and
stdvga init code.

Have each hardware type explicitly call stdvga_init when needed.

To unify bochsvga_init() signature, store the device BDF passed into
the optionrom init code in a global variable (VgaBDF).

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
12 years agovgabios: Unify X_set_mode() functions.
Kevin O'Connor [Sun, 1 Jan 2012 00:13:45 +0000 (19:13 -0500)]
vgabios: Unify X_set_mode() functions.

Use the same function signature for cirrus, bochsvga, and stdvga
set_mode code.

Make both the int1000 interface and the VBE 104f02 interface use the
same set_mode function.

Where clext and bochsvga need to fallback to the standard vga mode
switching, have them call vgastd_mode_switch directly.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
12 years agovgabios: Create clext.h and use "clext_" as prefix for exported funcs.
Kevin O'Connor [Sat, 31 Dec 2011 23:39:59 +0000 (18:39 -0500)]
vgabios: Create clext.h and use "clext_" as prefix for exported funcs.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
12 years agovgabios: Refactor vga_set_mode and stdvga_set_mode.
Kevin O'Connor [Sat, 31 Dec 2011 23:19:22 +0000 (18:19 -0500)]
vgabios: Refactor vga_set_mode and stdvga_set_mode.

Split out the BDA setup part of vga_set_mode to new function
modeswitch_set_bda.  Move the remaining parts (palette loading, screen
clearing, font loading) of vga_set_mode into stdvga_set_mode.

Add new mode switching flags and pass them to stdvga_set_mode, so it
does not need to inspect modeset_ctl directly.

Move code needed by stdvga_set_mode (perform_gray_scale_summing,
clear_screen) to stdvga.c.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
12 years agovgabios: Change vga_set_mode() to directly setup BDA.
Kevin O'Connor [Sat, 31 Dec 2011 22:24:11 +0000 (17:24 -0500)]
vgabios: Change vga_set_mode() to directly setup BDA.

The calls to set_cursor_shape, set_cursor_pos, and set_active_page
have no impact other than to set the BDA variables, because the
standard vga mode switch already programed the registers these
functions set.  So, just setup the BDA directly.

The stdvga_set_text_block_specifier call is unnecessary - it sets
a register which is already programmed that way.

Call stdvga_get_crtc() to obtain the crtc address instead of inferring
it from the memory model.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
12 years agovgabios: Don't call int10 during mode switch.
Kevin O'Connor [Sat, 31 Dec 2011 21:22:35 +0000 (16:22 -0500)]
vgabios: Don't call int10 during mode switch.

Don't call int10 to load the fonts - instead call the font loading
functions directly.

Theoretically, this could change behavior if an external program has
captured int10 and redirects the font loading calls.  However, there
does not seem to be any indication that an external app could expect
that to work.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
12 years agovgabios: Introduce stdvga_get_crtc() and use it consistently.
Kevin O'Connor [Sat, 31 Dec 2011 21:00:54 +0000 (16:00 -0500)]
vgabios: Introduce stdvga_get_crtc() and use it consistently.

The low level VGA code shouldn't depend on the crtc address stored in
the BDA - it can find the address on its own.

The cirrus_get_crtc() function is the same - replace it with
stdvga_get_crtc().

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
12 years agovgabios: Fix typo in release_font_access() - inb instead of inw.
Kevin O'Connor [Sat, 31 Dec 2011 20:52:22 +0000 (15:52 -0500)]
vgabios: Fix typo in release_font_access() - inb instead of inw.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
12 years agovgabios: Move vgafb_load_font to stdvga.c.
Kevin O'Connor [Sat, 31 Dec 2011 09:31:16 +0000 (04:31 -0500)]
vgabios: Move vgafb_load_font to stdvga.c.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
12 years agovgabios: Rename vgahw_* functions to stdvga_*.
Kevin O'Connor [Sat, 31 Dec 2011 09:24:20 +0000 (04:24 -0500)]
vgabios: Rename vgahw_* functions to stdvga_*.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
12 years agovgabios: Rename vgaio.c to stdvga.c.
Kevin O'Connor [Sat, 31 Dec 2011 09:15:12 +0000 (04:15 -0500)]
vgabios: Rename vgaio.c to stdvga.c.

Also, introduce stdvga.h.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
12 years agovgabios: Move vbe code from vgabios.c to new file vbe.c.
Kevin O'Connor [Sat, 31 Dec 2011 08:43:12 +0000 (03:43 -0500)]
vgabios: Move vbe code from vgabios.c to new file vbe.c.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
12 years agovgabios: Rename vga.c to vgabios.c.
Kevin O'Connor [Sat, 31 Dec 2011 08:30:40 +0000 (03:30 -0500)]
vgabios: Rename vga.c to vgabios.c.

Also, rename vgatables.h to vgabios.h.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
12 years agovgabios: Use bochsvga_ prefix for bochs vga functions.
Kevin O'Connor [Sat, 31 Dec 2011 08:18:18 +0000 (03:18 -0500)]
vgabios: Use bochsvga_ prefix for bochs vga functions.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
12 years agovgabios: Rename vbe.c to bochsvga.c.
Kevin O'Connor [Sat, 31 Dec 2011 08:09:55 +0000 (03:09 -0500)]
vgabios: Rename vbe.c to bochsvga.c.

The code is specific to the Bochs "dispi" interface, not the vesa
video bios extensions spec.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
12 years agovgabios: Continue port of clext.c.
Kevin O'Connor [Sat, 31 Dec 2011 08:00:59 +0000 (03:00 -0500)]
vgabios: Continue port of clext.c.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
12 years agovgabios: Minor fixes to struct vbe_info definition.
Kevin O'Connor [Fri, 30 Dec 2011 21:37:20 +0000 (16:37 -0500)]
vgabios: Minor fixes to struct vbe_info definition.

Although the VBE3 spec says there is 189 bytes of pad at the end of
the vbe_info struct, the spec also says the total struct size should
be 256 bytes.  The VBE2 spec uses sufficient pad to get to 256 bytes.
So, assume the spec was off by one and make the pad 190 bytes.

Also, use u32 for capabilities and 'struct segoff_s' for
win_func_ptr.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
12 years agoDon't leave upper bits of 64bit BARs unitialized during pci init.
Kevin O'Connor [Fri, 30 Dec 2011 21:36:16 +0000 (16:36 -0500)]
Don't leave upper bits of 64bit BARs unitialized during pci init.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
12 years agovgabios: Merge support for GeodeLX vga bios.
Kevin O'Connor [Sat, 24 Dec 2011 05:44:07 +0000 (00:44 -0500)]
vgabios: Merge support for GeodeLX vga bios.

GeodeLX support based on a patch sent by Chris Kindt on 20090825.  The
patch provides basic support for running the vga bios on a Geode
device.

The original patch has been updated with the following:
  * Updates to merge with the current code,
  * geode specific timings are loaded at init time
  * PCI code was dropped as the current code now supports pci
  * Updates for Kconfig
  * dropped redundant lxdprintf
  * dropped geode_demo screen writing

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
12 years agovgabios: Place a signature at offset 0x1e of the rom.
Kevin O'Connor [Sat, 24 Dec 2011 04:01:48 +0000 (23:01 -0500)]
vgabios: Place a signature at offset 0x1e of the rom.

It appears some emulators look for a signature at offset 0x1e of the
option rom.  So, port the signature from the LGPL bios.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
12 years agovgabios: Generate video_param_table at runtime.
Kevin O'Connor [Sat, 24 Dec 2011 03:41:08 +0000 (22:41 -0500)]
vgabios: Generate video_param_table at runtime.

Now that all the mode info is available in vga_modes, generate the
externally visible video_param_table data from it.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
12 years agovgabios: Use vgamode_s instead of video_param_table in code.
Kevin O'Connor [Sat, 24 Dec 2011 02:40:34 +0000 (21:40 -0500)]
vgabios: Use vgamode_s instead of video_param_table in code.

Now that all the info in video_param_table is also in vgamode_s, use
the info in vgamode_s throughout the code.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
12 years agovgabios: Extend information in internal vgamode_s struct.
Kevin O'Connor [Sat, 24 Dec 2011 02:20:09 +0000 (21:20 -0500)]
vgabios: Extend information in internal vgamode_s struct.

Copy all the data in video_param_table to vga_modes.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
12 years agovgabios: Minor - use segoff_s for static_functionality ptr.
Kevin O'Connor [Sat, 24 Dec 2011 02:18:49 +0000 (21:18 -0500)]
vgabios: Minor - use segoff_s for static_functionality ptr.

12 years agovgabios: Define video_save_pointer_table layout.
Kevin O'Connor [Wed, 21 Dec 2011 14:05:32 +0000 (09:05 -0500)]
vgabios: Define video_save_pointer_table layout.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
12 years agovgabios: Fix compile error due to missing include in clext.c.
Kevin O'Connor [Wed, 28 Dec 2011 02:34:33 +0000 (21:34 -0500)]
vgabios: Fix compile error due to missing include in clext.c.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
12 years agoUpdates to vgabios cirrus code.
Kevin O'Connor [Wed, 21 Dec 2011 04:56:14 +0000 (23:56 -0500)]
Updates to vgabios cirrus code.

Work in progress updates to cirrus vgabios code.

12 years agoPreliminary DISPI VBE driver implementation
Julian Pidancet [Mon, 19 Dec 2011 05:08:01 +0000 (05:08 +0000)]
Preliminary DISPI VBE driver implementation

It allowed me to boot Windows 7 with Qemu BOCHS VGA emulation and it
seemed to work fine. It probably needs some further testing though.

Signed-off-by: Julian Pidancet <julian.pidancet@gmail.com>
12 years agoPartially implement VBE interface, create VBE driver skeleton
Julian Pidancet [Mon, 19 Dec 2011 05:08:00 +0000 (05:08 +0000)]
Partially implement VBE interface, create VBE driver skeleton

Signed-off-by: Julian Pidancet <julian.pidancet@gmail.com>
12 years agoMerge bootsplash and VGA ROM vbe structure definitions
Julian Pidancet [Mon, 19 Dec 2011 05:07:59 +0000 (05:07 +0000)]
Merge bootsplash and VGA ROM vbe structure definitions

Signed-off-by: Julian Pidancet <julian.pidancet@gmail.com>
12 years agoAdd vbe_flag field in BDA
Julian Pidancet [Mon, 19 Dec 2011 05:07:58 +0000 (05:07 +0000)]
Add vbe_flag field in BDA

Signed-off-by: Julian Pidancet <julian.pidancet@gmail.com>
12 years agobuildrom.py: Handle image size in PCI header
Julian Pidancet [Mon, 19 Dec 2011 05:07:57 +0000 (05:07 +0000)]
buildrom.py: Handle image size in PCI header

This patch makes buildrom.py check if a PCI is present in the ROM,
and fills in the image size field.

Signed-off-by: Julian Pidancet <julian.pidancet@gmail.com>
12 years agoAdd configuration menu for the VGA ROM
Julian Pidancet [Mon, 19 Dec 2011 05:07:56 +0000 (05:07 +0000)]
Add configuration menu for the VGA ROM

This patch adds a configuration menu for the VGA ROM, it also allow
the creation of a PCI header so the ROM can be extracted from a PCI
device.

V2: Default Device IDs and Vendor IDs values for Cirrus and Bochs are now set
    by Kconfig.

Signed-off-by: Julian Pidancet <julian.pidancet@gmail.com>
12 years agoAdd a PCI header to the VGA ROM if needed
Julian Pidancet [Mon, 19 Dec 2011 05:07:55 +0000 (05:07 +0000)]
Add a PCI header to the VGA ROM if needed

Allows the ROM to be extracted from a PCI device.

V2: * Declare the PCI header in C
    * Replace #ifdef CONFIG_VGA_PCI with #if CONFIG_VGA_PCI == 1

Signed-off-by: Julian Pidancet <julian.pidancet@gmail.com>
12 years agoMove optionroms definitions into a separate header
Julian Pidancet [Mon, 19 Dec 2011 05:07:54 +0000 (05:07 +0000)]
Move optionroms definitions into a separate header

Create optionroms.h so the VGA rom can reuse the definitions.

Signed-off-by: Julian Pidancet <julian.pidancet@gmail.com>
12 years agoRename CONFIG_VBE in CONFIG_VGA_BOCHS and CONFIG_CIRRUS in CONFIG_VGA_CIRRUS
Julian Pidancet [Mon, 19 Dec 2011 05:07:53 +0000 (05:07 +0000)]
Rename CONFIG_VBE in CONFIG_VGA_BOCHS and CONFIG_CIRRUS in CONFIG_VGA_CIRRUS

Signed-off-by: Julian Pidancet <julian.pidancet@gmail.com>
12 years agoDon't use -fomit-frame-pointer when building VGA bios.
Kevin O'Connor [Sun, 18 Dec 2011 15:51:19 +0000 (10:51 -0500)]
Don't use -fomit-frame-pointer when building VGA bios.

The real-mode emulator that Windows 7 uses to execute the vga bios rom
becomes very confused when the code tries to dereference the stack
pointer instead of using the frame pointer, leading to corruption of
parameters passed on the stack from one function to another.

Signed-off-by: Julian Pidancet <julian.pidancet@gmail.com>
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
12 years agoMinor - change indent of continued lines in Makefile.
Kevin O'Connor [Sun, 18 Dec 2011 15:48:44 +0000 (10:48 -0500)]
Minor - change indent of continued lines in Makefile.

12 years agoFix broken _DIS and _SRS methods in ACPI AML irq routing.
Kevin O'Connor [Sat, 17 Dec 2011 15:26:17 +0000 (10:26 -0500)]
Fix broken _DIS and _SRS methods in ACPI AML irq routing.

The RefOf() operator doesn't do what was expected (at least on Linux)
- issuing "Store(1, RefOf(PRQ0))" doesn't write to the PRQ0 Field
defined on the OperationRegion.  Instead, it seems to redefine PRQ0 to
be an integer.

Fix this by defining the _DIS and _SRS methods as pre-processor
macros.  This way the RefOf() operator isn't needed.

12 years agofix make help
Sebastian Herbszt [Thu, 24 Nov 2011 16:20:36 +0000 (17:20 +0100)]
fix make help

Add help target to top-level makefile.

Signed-off-by: Sebastian Herbszt <herbszt@gmx.de>
12 years agoacpi: remove _RMV
Michael S. Tsirkin [Sun, 20 Nov 2011 17:57:12 +0000 (19:57 +0200)]
acpi: remove _RMV

The macro gen_pci_device is used to add _RMV
method to a slot device so it is no longer needed:
presence of _EJ0 now indicates that the slot is ejectable.
It is also placing two devices with the same _ADR
on the same bus, which isn't defined by the ACPI spec.
So let's remove it.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
12 years agoacpi: EJ0 method name patching
Michael S. Tsirkin [Sun, 20 Nov 2011 17:57:05 +0000 (19:57 +0200)]
acpi: EJ0 method name patching

Modify ACPI to only supply _EJ0 methods for PCI slots that support hotplug.

This is done by runtime patching:
- Instrument SSDT ASL code with ACPI_EXTRACT directives
  tagging _EJ0 and _ADR fields.
- At compile time, tools/acpi_extract.py looks for these methods
  in ASL source finds the matching AML, and stores the offsets
  of these methods in tables named aml_ej0_name and aml_adr_dword.
- At run time, go over aml_ej0_name, use aml_adr_dword
  to get slot information and check which slots support hotplug.

  If hotplug is disabled, we patch the _EJ0 NameString in ACPI table,
  replacing _EJ0 with EJ0_.

  Note that this has the same checksum, but is ignored by OSPM.

Note: the method used is robust in that we don't need
to change any offsets manually in case of ASL code changes.
As all parsing is done at compile time, any unexpected input causes
build failure, not a runtime failure.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
12 years agoacpi: add ssdt for pci hotplug
Michael S. Tsirkin [Sun, 20 Nov 2011 17:56:59 +0000 (19:56 +0200)]
acpi: add ssdt for pci hotplug

The point of this split is to make runtime patching easier.

DSDT is required to supply: PCI0 - PCI root device object;
PCEJ - Method object to eject a PCI slot.
Additionally, SSDT is required to supply PCNT - Method object to notify
OSPM of a PCI slot event.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
12 years agovirtio-pci: include pci.h and pci_regs.h
Sebastian Herbszt [Mon, 21 Nov 2011 11:23:20 +0000 (12:23 +0100)]
virtio-pci: include pci.h and pci_regs.h

Include pci.h and pci_regs.h.

Signed-off-by: Sebastian Herbszt <herbszt@gmx.de>
12 years agousb: fix boot paths
Paolo Bonzini [Fri, 18 Nov 2011 14:59:24 +0000 (15:59 +0100)]
usb: fix boot paths

The fw paths for USB devices that SeaBIOS computes are off-by-one,
because QEMU builds those paths with a numbering that starts from one
(see usb_fill_port and usb_hub_initfn in QEMU).  Fix that so that
the numbering agrees.

12 years agousb-ehci: Fix races with controller on updates to QH.
Kevin O'Connor [Sat, 19 Nov 2011 19:21:51 +0000 (14:21 -0500)]
usb-ehci: Fix races with controller on updates to QH.

The EHCI controller writes to the TD after writing to the QH, so the
driver must wait for all the TDs to be complete before considering the
transfer completed.  (The previous implementation was particularly bad
as it only checked that the last TD was in progress before considering
the transfer complete.)

Also, avoid writing to the qh.token field when starting a transfer to
eliminate a potential race.  Place the qh.token in an available state
by default - that way only the qtd_next field needs to be updated to
start the transfer.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
12 years agousb-uhci: Be sure to wrap pipe->iobase in GET_FLATPTR().
Kevin O'Connor [Fri, 18 Nov 2011 03:05:53 +0000 (22:05 -0500)]
usb-uhci: Be sure to wrap pipe->iobase in GET_FLATPTR().

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
12 years agovirtio-pci: allocate vq in vp_find_vq
Paolo Bonzini [Wed, 16 Nov 2011 12:02:57 +0000 (13:02 +0100)]
virtio-pci: allocate vq in vp_find_vq

Another common bit that can be made generic.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
12 years agovirtio-pci: introduce vp_init_simple
Paolo Bonzini [Wed, 16 Nov 2011 12:02:56 +0000 (13:02 +0100)]
virtio-pci: introduce vp_init_simple

Put together the common parts of all virtio device initialization.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
12 years agoalways specify virtio-blk rather than virtio
Paolo Bonzini [Wed, 16 Nov 2011 12:02:55 +0000 (13:02 +0100)]
always specify virtio-blk rather than virtio

Avoid ambiguity when virtio-scsi will be introduced.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
12 years agoscsi: get physical chs geometry from mode page 0x04
Paolo Bonzini [Wed, 16 Nov 2011 12:02:54 +0000 (13:02 +0100)]
scsi: get physical chs geometry from mode page 0x04

The mode page is marked as obsolete, but QEMU can provide the information.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
12 years agousb-msc: move cdb dispatch to block.c
Paolo Bonzini [Wed, 16 Nov 2011 12:02:53 +0000 (13:02 +0100)]
usb-msc: move cdb dispatch to block.c

virtio-scsi's low-level dispatch code is exactly the same as USB's,
since in the end both are actually SCSI HBAs.  Move it to common code.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
12 years agousb-msc: move common scsi code to blockcmd.c
Paolo Bonzini [Thu, 17 Nov 2011 09:23:02 +0000 (10:23 +0100)]
usb-msc: move common scsi code to blockcmd.c

Finally move the INQUIRY/TEST UNIT READY/READ CAPACITY sequence to
generic code, so that virtio-scsi will be able to use it.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
12 years agousb-msc: go through TEST UNIT READY for hard disks.
Paolo Bonzini [Wed, 16 Nov 2011 12:02:51 +0000 (13:02 +0100)]
usb-msc: go through TEST UNIT READY for hard disks.

Add the wait loop that CDs are already using to usb-msc in the HD
case, to cope with a NOT READY or UNIT ATTENTION condition.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
12 years agousb-msc: rename INQUIRY types
Paolo Bonzini [Wed, 16 Nov 2011 12:02:50 +0000 (13:02 +0100)]
usb-msc: rename INQUIRY types

They are generic SCSI constants, rename them as such.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
12 years agousb-msc: pass drive to setup_drive_*
Paolo Bonzini [Wed, 16 Nov 2011 12:02:49 +0000 (13:02 +0100)]
usb-msc: pass drive to setup_drive_*

The two functions do not need anymore a disk_op_s.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
12 years agousb-msc: move READ CAPACITY to usb_msc_init, fix off-by-one
Paolo Bonzini [Wed, 16 Nov 2011 12:02:48 +0000 (13:02 +0100)]
usb-msc: move READ CAPACITY to usb_msc_init, fix off-by-one

Only leave the bootprio code in setup_drive_hd, like in setup_drive_cdrom.
This is a preparatory step; later, the SCSI code in usb_msc_init will
become entirely generic.

Also, the returned number of sectors is off by one.  This will become
more important when CHS translation is added later.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
12 years agousb-msc: support WRITE commands
Paolo Bonzini [Wed, 16 Nov 2011 12:02:47 +0000 (13:02 +0100)]
usb-msc: support WRITE commands

Writes only require building the CDB and some care with the direction
in the USB packet.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
12 years agousb-msc: add usb_msc_send
Paolo Bonzini [Wed, 16 Nov 2011 12:02:46 +0000 (13:02 +0100)]
usb-msc: add usb_msc_send

This makes it a bit nicer to later introduce writes.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>