Use one function (X_alloc_pipe) as the main entry point for usb pipe
allocation in the controller code. The determination of
interrupt/bulk/control can be done within the controller.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Kevin O'Connor [Thu, 8 Mar 2012 13:44:32 +0000 (08:44 -0500)]
usb: Pass usbdevice_s to alloc_async_pipe.
Build the control pipe information in alloc_async_pipe directly from
the usbdevice and usb_endpoint_descriptor information. This
simplifies the callers as they now only need to allocate/free the
devices, and do not need to peek into the pipe structure.
Replace alloc_bulk_pipe with alloc_async_pipe as they both perform the
same action now.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Kevin O'Connor [Mon, 20 Feb 2012 17:54:49 +0000 (12:54 -0500)]
Batch free USB pipes on EHCI controllers.
Instead of unregistering each control "endpoint descriptor" after it
is used, keep them around for later users. Free all unused
descriptors in one batch at the end of initialization. This should
slightly optimize boot time, and it requires less overall interaction
with the controller.
This also merges the code that allocates the control and bulk pipes,
as they were quite similar before.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Kevin O'Connor [Mon, 20 Feb 2012 17:54:49 +0000 (12:54 -0500)]
Batch free USB pipes on UHCI controllers.
Instead of unregistering each control "endpoint descriptor" after it
is used, keep them around for later users. Free all unused
descriptors in one batch at the end of initialization. This should
slightly optimize boot time, and it requires less overall interaction
with the controller.
This also merges the code that allocates the control and bulk pipes,
as they were quite similar before.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Kevin O'Connor [Mon, 20 Feb 2012 17:54:49 +0000 (12:54 -0500)]
Batch free USB pipes on OHCI controllers.
Instead of unregistering each control "endpoint descriptor" after it
is used, keep them around for later users. Free all unused
descriptors in one batch at the end of initialization. This should
slightly optimize boot time, and it requires less overall interaction
with the controller.
This also makes the descriptor free code more compliant with the spec.
The descriptor lists will only be modified after the list processing
has been disabled on the controller.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Paolo Bonzini [Mon, 5 Mar 2012 11:29:12 +0000 (12:29 +0100)]
scsi: do not send MODE SENSE except to QEMU disks
This is the simplest way to avoid breaking boot on USB sticks that
stall when asked for the MODE SENSE page 4. Some old sticks do
not support the MODE SENSE command at all and just return a
"medium may have changed" unit attention condition when SeaBIOS
sends it!
Reported-by: Dave Frodin <dave@camp.se-eng.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Julian Pidancet [Mon, 5 Mar 2012 14:20:45 +0000 (14:20 +0000)]
vgabios: Fetch _rom_header_size from the global segment when computing the ROM's checksum
Otherwise, checksum_far is getting called with zero as the length
parameter, and the ROM checksum in the header end up beeing zero
after vga_post() is called.
Kevin O'Connor [Sat, 18 Feb 2012 16:02:27 +0000 (11:02 -0500)]
Register drives directly in scsi_init_drive().
The scsi_init_drive() function has enough information to directly
register the drive there, so do the registration there. This
simplifies the calling code.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Gleb Natapov [Mon, 13 Feb 2012 11:01:07 +0000 (13:01 +0200)]
Running vgabios during resume from S3 on QEMU by default
Run vgabios during resume from S3 by default on QEMU. QEMU
still able to modify SeaBIOS behavior if it wishes so by providing
etc/s3-resume-vga-init file. With QEMU emulated vga cards this behaviour
is desirable otherwise console becomes unusable with Linux guests after
resume. Since we control vgabios source we can be sure that running it
on resume from S3 is safe.
Kevin O'Connor [Tue, 14 Feb 2012 01:09:02 +0000 (20:09 -0500)]
vgabios: Some tweaks to optimize stack space.
Gcc seems to handle passing structs by value if they are 4 bytes in
size instead of 3 bytes. So, add a pad byte to struct carattr and
struct cursorpos.
Reorganize set_cursor_pos(), verify_scroll(), and handle_1013() so
there are less live variables.
Don't inline the VBE functions into the main handler code. Code
calling VBE functions are newer and are more likely to provide
adequate stack space - inlining can cause more stack usage for older
functions (which may be stack constrained).
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Kevin O'Connor [Sat, 11 Feb 2012 15:49:45 +0000 (10:49 -0500)]
Direct compile 16bit C code instead of including via .S files.
Create a ".code16gcc" directive in src/code16gcc.s and use
-Wa,src/code16gcc.s to tell gcc to compile directly to 16bit code.
This eliminates the need to compile the C code to assembler and
include in romlayout.S and vgaentry.S. This also allows those two
assembler files to be compiled with debugging (-g) enabled.
Also, includes some Makefile cleanups.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Kevin O'Connor [Sat, 11 Feb 2012 14:38:44 +0000 (09:38 -0500)]
disk: handle LBA I/O with zero sector count
Unlike basic_access, extended_access does not check for a zero
sector count. However, this is a problem because for example
it would be interpreted as 256 when processing an ATA request.
Based on patch from: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Commit 1e749c85 removed the definition of process_usb_op(); let's remove
the declaration too.
The same commit added process_scsi_op(). The function has no declaration
that is also not a definition, and its only call site is in the same file
as the definition. Give the function internal linkage.
Julian Pidancet [Sun, 5 Feb 2012 04:51:06 +0000 (04:51 +0000)]
Xen: Use VGA Hooks to make VGA passthrough work on certain devices
The Intel gfx VGA option ROM on certain platforms requires the 155f50 BIOS
function to be implemented (even if it does nothing), to work properly.
v2: Ignore the case where Option ROMs are pre-deployed.
Make vgahook_setup independent of wether the CB* variables are set.
VGA hooks can be enabled on non-coreboot and non-Xen configurations.
Kevin O'Connor [Fri, 3 Feb 2012 03:52:17 +0000 (22:52 -0500)]
vgabios: Handle VGA option rom being re-run.
Check for the case where the option rom is executed a second time - in
that case re-init the hardware, but do not set any variables. This
should make the rom better behaving when run from S3 resume.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Gleb Natapov [Tue, 24 Jan 2012 12:33:42 +0000 (14:33 +0200)]
mask interrupts on S3 resume
i8259 clears interrupt mask on reset. Interrupt need to be
masked again before enabling interrupts on CPU. Since option
roms are called with interrupts enabled, resume should mask
interrupts in i8259 before calling vgabios.
Signed-off-by: Gleb Natapov <gleb@redhat.com> Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Kevin O'Connor [Sun, 29 Jan 2012 16:53:59 +0000 (11:53 -0500)]
vgabios: handle vmware vga in bochsvga.
The vmware vga emulated by qemu has a I/O region in pci bar 0.
The framebuffer is in pci bar 1. Handle that by checking the
type of bar 0 in case it is a I/O bar use bar 1 instead.
Also make bochsbios report lfb size in debug output.
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
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>
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>
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 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 [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: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>