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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
Kevin O'Connor [Sat, 24 Dec 2011 02:18:49 +0000 (21:18 -0500)]
vgabios: Minor - use segoff_s for static_functionality ptr.
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>
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>
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.
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
Kevin O'Connor [Sun, 18 Dec 2011 15:48:44 +0000 (10:48 -0500)]
Minor - change indent of continued lines in Makefile.
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.
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>
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>
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>
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>
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>
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.
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
Paolo Bonzini [Thu, 17 Nov 2011 09:23:00 +0000 (10:23 +0100)]
usb-uhci: fix race against host controller
While processing a frame, the host controller will write to the queue
head's element link field. The following sequence could then happen
when two consecutive sends occur to the same pipe.
controller SeaBIOS
---------------------------------------------------------------------
td->link = UHCI_PTR_TERM;
td->ctrl |= TD_CTRL_ACTIVE;
read TD from memory
wait_td(td);
td->ctrl &= ~TD_CTRL_ACTIVE;
write back td->ctrl
exit usb_send_bulk
restart usb_send_bulk
pipe->qh.element = &tds;
pipe->qh.element = td->link; ... go on and set up the first td ...
write back pipe->qh.element
td->ctrl |= TD_CTRL_ACTIVE;
Once the host controller has written UHCI_PTR_TERM to the element link,
subsequent tds would never be processed. This is surprisingly frequent
when the two consecutive sends are in the OUT direction (and just as
surprisingly, it seems like it never happens in the IN direction).
To fix this, at the end of the processing do not wait for each single
TD to become inactive, but for the host controller to invalidate the
element link (which implies it's done with all TDs).
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Paolo Bonzini [Thu, 17 Nov 2011 09:22:59 +0000 (10:22 +0100)]
usb-uhci: reorganize wait_qh into wait_pipe
Four changes:
1) Add explicit GET_FLATPTR/SET_FLATPTR.
2) Pass the whole pipe to wait_qh so that we can get the iobase from there.
3) Clean up the pipe upon timeout, since that is the only sensible
thing to do: tds are on the stack, and leaving pointers to them in
the pipe is not a good idea.
4) Add a variable timeout argument, since bulk transfers might take more
than 500 ms.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Paolo Bonzini [Wed, 16 Nov 2011 12:02:42 +0000 (13:02 +0100)]
cdrom: use TEST UNIT READY to detect ready medium
The READ CAPACITY output is not used except for some debugging messages.
In the future, we will use this code for USB sticks too, but those
already send READ CAPACITY. To avoid code duplication, switch to TEST
UNIT READY for this task.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Paolo Bonzini [Wed, 16 Nov 2011 12:02:45 +0000 (13:02 +0100)]
usb-msc: support commands without payload
This lets the usb-msc driver send TEST UNIT READY commands.
Modified to avoid divide by zero by Kevin O'Connor <kevin@koconnor.net>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Kenji Kaneshige [Mon, 10 Oct 2011 06:06:29 +0000 (14:06 +0800)]
seabios: fix mptable nmi entry
In the current seabios MP table description, NMI is connected only to
BSP's LINT1. But usually NMI is connected to all the CPUs' LINT1 as
indicated in MP specification. This patch changes seabios MP table to
describe NMI is connected to all the CPUs' LINT1.
Signed-off-by: Kenji Kaneshige <kaneshige.kenji@jp.fujitsu.com>
Reviewed-by: Lai Jiangshan <laijs@cn.fujitsu.com>
Kenji Kaneshige [Mon, 10 Oct 2011 06:06:17 +0000 (14:06 +0800)]
seabios: Add Local APIC NMI Structure to ACPI MADT
ACPI NMI Structure describes LINT pin (LINT0 or LINT1) information to
which NMI is connected, and it is needed by OS to initialize local APIC.
Signed-off-by: Kenji Kaneshige <kaneshige.kenji@jp.fujitsu.com>
Reviewed-by: Lai Jiangshan <laijs@cn.fujitsu.com>
Michael S. Tsirkin [Wed, 26 Oct 2011 21:28:02 +0000 (23:28 +0200)]
acpi: extract aml from .lst
Add ACPI_EXTRACT_ALL_CODE directive, to support extracting
AML code from listing into a named array. Use that instead including C
file generated by iasl, this makes it possible to include multiple AML
tables without resorting to preprocessor tricks.
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Isaku Yamahata [Mon, 24 Oct 2011 08:11:08 +0000 (17:11 +0900)]
seabios: acpi: allow qemu to load dsdt as external acpi table.
allow qemu to load dsdt as external acpi table.
Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
Isaku Yamahata [Mon, 24 Oct 2011 08:11:07 +0000 (17:11 +0900)]
util: add le32_to_cpu()
this will be used later.
Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
Kevin O'Connor [Sat, 1 Oct 2011 16:08:57 +0000 (12:08 -0400)]
Simplify pci_bios_init_root_regions().
Add some comments and refactor out some duplicated code.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Kevin O'Connor [Sat, 15 Oct 2011 16:02:14 +0000 (12:02 -0400)]
Move pciinit device init code together.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Kevin O'Connor [Sat, 15 Oct 2011 15:53:38 +0000 (11:53 -0400)]
Locally allocate pciinit busses[] variable.
No need for a global variable - only a few functions use the busses
array.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Kevin O'Connor [Sat, 15 Oct 2011 15:42:48 +0000 (11:42 -0400)]
Replace recursive pci init system with linear passes.
The existing PCI sizing and mapping uses a recursive algorithm to
visit every bus and its devices in order. Replace that with an
algorithm that visits every device and then every bus.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Kevin O'Connor [Sat, 15 Oct 2011 15:07:30 +0000 (11:07 -0400)]
Replace pciinit busses_count with MaxPCIBus.
Use the existing bus count instead of calculating a new one. Also,
the MaxPCIBus is guaranteed to encompass all pci->secondary_bus
references, so no need to check for overruns.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Kevin O'Connor [Sat, 1 Oct 2011 18:52:35 +0000 (14:52 -0400)]
Simplify pci_slot_get_irq().
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Kevin O'Connor [Sat, 1 Oct 2011 17:13:29 +0000 (13:13 -0400)]
Use pci->header_type in pci_bar() to avoid unnecessary pci_config_readb.
Pass a 'struct pci_device' into pci_bar and update all callers.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Kevin O'Connor [Sat, 1 Oct 2011 15:33:31 +0000 (11:33 -0400)]
Separate pciinit.c into clearly delineated sections.
There are four separate phases of the current PCI initialization code:
bus initialization, bus sizing, bar allocation, and misc device init.
Move the code exclusively called in each phase next to each other, and
clearly mark each section.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>