Kevin O'Connor [Tue, 16 Dec 2014 14:55:16 +0000 (09:55 -0500)]
sdcard: Initial support for SD cards on PCI SDHCI controllers on QEMU
This adds basic read/write support for SD cards emulated by QEMU.
This code is not expected to work on real hardware, because the
current controller and card initialization is not robust.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Kevin O'Connor [Tue, 16 Dec 2014 02:44:13 +0000 (21:44 -0500)]
Simplify README files - point to online documentation instead
The README file and README.CSM file have gotten a bit out of date.
Instead of maintaining technical information in the README file, point
new users to the SeaBIOS wiki.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Kevin O'Connor [Wed, 3 Dec 2014 17:53:01 +0000 (12:53 -0500)]
Eliminate FUNCFSEG - only force portions of inline asm to f-segment
The FUNCFSEG macro was introduced to force a C function into the
f-segment. This was needed for some C functions that used inline
assembler that contained some 16bit code. Instead of forcing the
entire C function into the f-segment, just force the small subset of
inline assembler into the f-segment.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Kevin O'Connor [Wed, 12 Nov 2014 22:49:33 +0000 (17:49 -0500)]
Fix build issue on gcc34
Older versions of gcc may not inline on_extra_stack() and thus cause a
link error when compiling in 32bit segmented mode. Test for MODE16
explicitly in stack_hop_back() to prevent the problem.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Kevin O'Connor [Wed, 5 Nov 2014 14:05:36 +0000 (09:05 -0500)]
Use an aligned stack offset when entering on the extra stack
The size of 'struct bregs' is not evenly divisible by four and where
the assembler placed a 'struct bregs' on the extra stack as part of
entering into the C functions it caused the C functions to run with a
non-aligned stack. It's technically not correct to use an unaligned
stack and it is certainly less efficient.
This patch avoids using BREGS_size (the sizeof struct bregs) and
instead introduces PUSHBREGS_size (the size of the general purpose
registers in struct bregs) in the assembler. Where the code actually
did use the %cs:%ip and flags, an extra 8 (instead of 6) bytes are
added to maintain a sane alignment.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Kevin O'Connor [Sat, 18 Oct 2014 02:15:42 +0000 (22:15 -0400)]
vgabios: Add software cursor capability
Add mechanism for drawing a cursor to the framebuffer to implement a
cursor in software. The timer interrupt is "hooked" so that the
cursor can blink. This can be useful for "coreboot native vga".
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Kevin O'Connor [Thu, 30 Oct 2014 16:09:19 +0000 (12:09 -0400)]
vgabios: Support emulating text mode attributes while in graphics mode
Add support for simple text mode attribute emulation while in graphics
mode. This improves text highlighting and background color on some
boot-loaders. Enable it only for CBVGA vgabios and only when a text
mode is requested.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Hannes Reinecke [Thu, 6 Nov 2014 13:31:56 +0000 (14:31 +0100)]
megasas: read addional PCI I/O bar
Some newer cards have the I/O bar at BAR 0, so we need to check
that, too, if we cannot get an address for BAR 2.
Without this patch the new 'megasas-gen2' emulation in qemu
is not detected.
Signed-off-by: Hannes Reinecke <hare@suse.de> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Kevin O'Connor [Thu, 23 Oct 2014 00:27:28 +0000 (20:27 -0400)]
vgabios: Set cursor shape fixes
The "cursor scaling" mode is determined by the first bit of the
video_ctl bda value, not the modeset_ctl value. Also, on a
set_scan_lines() call, the shape should be set to lines-3/lines-2 and
the shape must be set after char_height has been updated.
The existing cursor shape code matches the legacy "lgpl vgabios", but
the behavior doesn't match bios documentation nor observations with an
ati vga bios.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Kevin O'Connor [Sat, 18 Oct 2014 01:47:10 +0000 (21:47 -0400)]
vgabios: Don't pass vmode_g to vgafb_move_chars() / vgafb_clear_chars()
Now that a pointer to the current video mode info struct is cached in
memory, it's not necessary to pass the struct into the vgafb code.
The vgafb code can lookup the struct itself.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Kevin O'Connor [Sat, 18 Oct 2014 01:37:23 +0000 (21:37 -0400)]
vgabios: Cache a pointer to the current mode struct in the BDA
Cache a pointer to the current mode 'vgamode_s' struct in the BDA to
avoid doing a linear scan of all available vga modes when the struct
is needed.
This uses an additional two bytes in the BDA (at offset 0xbc). It's
possible this could conflict with some other software, but that seams
unlikely because that part of the BDA seems reserved for BIOS and
VGABIOS uses. (And neither SeaBIOS nor Bochs BIOS currently make use
of that area.)
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Kevin O'Connor [Sat, 18 Oct 2014 01:17:48 +0000 (21:17 -0400)]
vgabios: Don't declare custom internal BDA storage in std/bda.h
The vgabios uses storage in the BDA at offset 0xb9 for internal custom
storage (the contents do not appear to be part of any bios standard).
Move the description of this custom vgabios area from std/bda.h to
vgasrc/vgabios.h. Add two new macros (GET_BDA_EXT and SET_BDA_EXT).
This should make it more clear that the area is for custom internal
storage.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Kevin O'Connor [Tue, 21 Oct 2014 18:34:06 +0000 (14:34 -0400)]
Do full BREGS backup/restore for pmm, pnp, and irqentry_extrastack
Although these entry points only require backup and restore of the
registers that the C code clobbers, there is no harm in backing up
some additional registers. This allows the BREGS macros to be used
which makes the code a little more readable.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Kevin O'Connor [Tue, 21 Oct 2014 06:23:02 +0000 (02:23 -0400)]
Create assembler macros for saving and restoring 'struct bregs'
Create macros SAVEBREGS_POP_DSEAX and RESTOREBREGS_DSEAX for saving
and restoring the cpu state. These are similar to the existing
PUSHBREGS and POPBREGS macros.
This also fixes a bug in __farcall16 which inadvertently restored %ds
in %es and vice-versa.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Kevin O'Connor [Tue, 21 Oct 2014 03:06:04 +0000 (23:06 -0400)]
Use 32bit memcpy in int1587 when applicable
If the amount of data to be copied is an even number of four, then
copy the data in four byte chunks. This 32bit copy is more efficient,
in particular when copying to/from memory mapped io. This should
improve the performance of framebuffer draws in cbvga SeaVGABIOS.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Kevin O'Connor [Thu, 16 Oct 2014 18:03:39 +0000 (14:03 -0400)]
usb: Use usb_realloc_pipe for pipe alloc, update, and free.
Now that the usb controller drivers all support the realloc method,
use that for all pipe allocations, reallocations, and freeing. This
gives the driver more control over the pipe life cycle.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Kevin O'Connor [Sat, 11 Oct 2014 17:16:12 +0000 (13:16 -0400)]
Move a20 code from system.c and ps2port.h to x86.h
Although the a20 functionality was originally implemented in the ps2
controller, that is just a historical artifact. It's a core feature
of modern x86 cpus and the code is better located in the x86.h header.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Kevin O'Connor [Fri, 11 Apr 2014 15:20:41 +0000 (11:20 -0400)]
Implement call32 mechanism using SMIs.
Add support for jumping into 32bit mode using a System Management Mode
(SMM) handler. When available, this allows SeaBIOS to transition to
32bit mode even when called in vm86 mode. It will also prevent the
clobbering of the segment registers.
Currently, the SMM mode is only supported in QEMU when running in TCG
mode. Also, QEMU v2.1 (or later) is needed for it to work when in
vm86 mode.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Kevin O'Connor [Tue, 30 Sep 2014 16:55:54 +0000 (12:55 -0400)]
Fully restore 16bit state during call16_sloppy()
When transitioning back to 16bit mode from within call32(), restore
the full state (cmos index, gdt, fs/gs) in addition to restoring the
original stack.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Kevin O'Connor [Wed, 24 Sep 2014 21:48:28 +0000 (17:48 -0400)]
Move call16() functions from romlayout.S to inline assembler in stacks.c
Use inline assembler in call16 type functions instead of using
__call16() in romlayout.S.
Since call16() and call16big() are now only called with %ss==0 they do
not need to update the stack pointer. Only call16_sloppy() requires
the stack manipulation code.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Kevin O'Connor [Wed, 24 Sep 2014 19:58:12 +0000 (15:58 -0400)]
build: Support declaring 32bit C functions that must reside in the f-segment
Add support for a FUNCFSEG macro that will force a "32bit flat" C
function to be located in the f-segment. This is useful for 32bit
code with inline assembler that thunks to 16bit mode.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Kevin O'Connor [Tue, 30 Sep 2014 04:11:38 +0000 (00:11 -0400)]
Simplify farcall16 code
With this change, farcall16() is only used for external API calls and
is only invoked from a 32bit mode entered directly via transition32.
farcall16big() is also only used for external API calls and is only
invoked from a 32bit mode entered directly via transition32.
call16_int() now calls _farcall16() directly, and it will use normal
16bit mode or big real mode as required.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Kevin O'Connor [Tue, 30 Sep 2014 03:59:47 +0000 (23:59 -0400)]
Track when entering via call32() and use the same mode for stack_hop_back()
If 32bit mode is entered directly via transition32, then use a simple
call16() when hopping back to 16bit mode. Use only call16big() during
post and when entering 32bit mode via call32().
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Kevin O'Connor [Tue, 30 Sep 2014 13:37:26 +0000 (09:37 -0400)]
pmm: Fix entry point to support non-zero %ss
If the pmm entry point was called with a non-zero stack segment, the
pointer to the arguments on the stack would not be valid once the
code transitioned to 32bit mode. Fix by adding the stack segment
offset into the args pointer.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Kevin O'Connor [Tue, 30 Sep 2014 13:17:14 +0000 (09:17 -0400)]
Revert "Use the extra stack for 16bit USB and PS2 keyboard/mouse commands."
It's not valid to pass a pointer to a stack variable through the
stack_hop() call (because the call changes the stack segment). This
bug was probably not noticed before because by default
(CONFIG_ENTRY_EXTRASTACK) SeaBIOS uses the extra stack on all 16bit
entry points, and the internal stack_hop() with that config option is
effectively a no-op.
Kevin O'Connor [Wed, 10 Sep 2014 15:33:01 +0000 (11:33 -0400)]
usb: Perform device detect polling on all usb controllers.
Move the 100ms (USB_TIME_SIGATT) device detect polling from the
ohci/uhci/usb-hub code to the generic usb_hub_port_setup() code. This
extends the 100ms polling to ehci and xhci controllers. The code in
usb_hub_port_setup() now compares USB_TIME_SIGATT to the start of
usb_enumerate(), which may make boots faster when threads are
disabled.
This patch also changes the meaning of the return code for
hub->op->detect() calls. Now 1 indicates device found, 0 indicates
device not found, and -1 indicates permanent failure.
Also, the xhci controller generic delay of 100ms is replaced with a
20ms root hub power stabilize time. This in combination with the
100ms for USB_TIME_SIGATT should be closer to the USB2 spec (the USB3
spec does not seem to declare an equivalent of USB_TIME_SIGATT).
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Kevin O'Connor [Wed, 10 Sep 2014 15:04:26 +0000 (11:04 -0400)]
ehci: Stall uhci/ohci init only until default port routing is done.
Now that uhci and ohci will continually poll for a device connect, the
ehci controller only needs to ensure that the default routing is setup
properly before allowing uhci and ohci to be initialized.
This also fixes two error paths in configure_ehci() that were not
properly updating PendingEHCIPorts.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Kevin O'Connor [Wed, 10 Sep 2014 14:37:52 +0000 (10:37 -0400)]
ohci: Repeatedly poll for device detect for 100ms.
According to the USB2 specification, a device may take up to 100ms
(USB_TIME_SIGATT) after port power stabilizes to be detected. So,
continually recheck for a device connection event.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Kevin O'Connor [Wed, 10 Sep 2014 14:33:36 +0000 (10:33 -0400)]
uhci: Repeatedly poll for device detect for 100ms.
According to the USB2 specification, a device may take up to 100ms
(USB_TIME_SIGATT) after port power stabilizes to be detected. So,
continually recheck for a device connection event.
Technically, the uhci root hub ports are always powered up, but it's
not possible to know how long the machine has been on, so it's better
to be safe here.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Kevin O'Connor [Wed, 10 Sep 2014 14:24:04 +0000 (10:24 -0400)]
xhci: Change xhci_hub_detect() to use connect status instead of link state.
Use the connect status bit to determine if a device is connected
instead of the port link state state machine status. This makes the
driver more similar to the other drivers and may help diagnose devices
that take longer to boot up.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Kevin O'Connor [Wed, 10 Sep 2014 14:18:02 +0000 (10:18 -0400)]
usb-hub: Enable power to all ports prior to calling usb_enumerate().
Don't perform port power up in the detect code. Instead do it prior
to calling usb_enumerate(). This makes the code more similar to the
usb root hub drivers. It can also reduce the total boot time when
threads are disabled.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Kevin O'Connor [Wed, 10 Sep 2014 14:02:20 +0000 (10:02 -0400)]
ehci: Move port power up from ehci_hub_detect() to check_ehci_ports().
Don't perform port power up in the detect code. Instead do it prior
to calling usb_enumerate(). This makes the code more similar to the
ohci and xhci drivers. It can also reduce the total boot time when
threads are disabled.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Kevin O'Connor [Wed, 10 Sep 2014 13:10:42 +0000 (09:10 -0400)]
xhci: Add xhci_check_ports() and xhci_free_pipes() functions.
Add these two functions so that the xhci code is more similar to the
other USB controllers. Also, store the temporary hub structure on the
stack instead of in struct usb_xhci_s.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Kevin O'Connor [Tue, 9 Sep 2014 22:24:00 +0000 (18:24 -0400)]
usb: Fix usb_xfer_time() to work when called in 16bit mode.
Make sure to wrap accesses to the usb_pipe struct with GET_LOWFLAT so
that it works in 16bit mode. This bug impacts both ehci and uhci usb
controllers (it should not impact ohci and xhci as those never call
the function in 16bit mode).
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Kevin O'Connor [Sun, 24 Aug 2014 02:06:21 +0000 (22:06 -0400)]
build: Update kconfig to version in Linux 3.16.
Update kconfig (from Linux v3.13) to the latest version (Linux v3.16).
This copies kconfig from Linux with only the changes necessary to work
with the SeaBIOS build (the equivalent of the earlier SeaBIOS 0da7bfdf
commit) and the changes necessary to always emit symbols (SeaBIOS b623e7c5 commit).
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Kevin O'Connor [Fri, 15 Aug 2014 13:52:43 +0000 (09:52 -0400)]
boot: Change ":rom%d" boot order rom instance to ":rom%x"
Use hex numbers for the rom instance count in boot order open firmware
device naming. The ":rom" suffix isn't part of a standard and it's
highly unlikely any rom would have 10 or more drives on it, but this
change makes the code more similar to the numbering of other boot
order devices.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net> Reviewed-by: Markus Armbruster <armbru@redhat.com>
We identify devices by their Open Firmware device paths. The path
component for the logical unit on a bus is incorrect:
bootprio_find_scsi_device() and bootprio_find_usb() format target
(a.k.a. SCSI ID) and lun in decimal, while QEMU uses hexadecimal.
Bootorder list entries with target, lun > 9 aren't found (lucky case),
or attributed to the wrong logical unit (unlucky case).
The relevant spec[*] agrees with QEMU (and OVMF, for that matter).
Change %d to %x.
No actual impact on USB, because QEMU only uses LUN 0 there.
Kevin O'Connor [Tue, 1 Jul 2014 13:50:04 +0000 (09:50 -0400)]
vgabios: Fix broken build resulting from e5749978.
The e5749978 commit added -fno-merge-constants to the compile flag.
That option changes the names of ".rodata" sections. Update
vgalayout.lds.S so that the vgabios can continue to build.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Kevin O'Connor [Sat, 14 Jun 2014 16:25:17 +0000 (12:25 -0400)]
xhci: Update the times for usb command timeouts.
The xhci controller had a hardcoded 1 second timeout for both bulk and
control transfers. The 1 second bulk timeout is too small for some
real devices.
Increase both times to 5.1 seconds - according to the USB spec, the
maximum time a command should take is 5 seconds. However, have the
set_address command only wait for 150ms (spec says set_address should
take no more than 50ms).
Introduce usb_xfer_time() to calculate maximum command time.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Kevin O'Connor [Wed, 11 Jun 2014 18:00:21 +0000 (14:00 -0400)]
build: Get fixed address variables from 32bit compile pass (not 16bit)
Update the layoutrom.py build script so that fixed address sections
can come from the 32bit compiled C code. Update the C code so that
all VAR16FIXED variables instead use the new VARFSEGFIXED which is
defined in 32bit mode.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Kevin O'Connor [Tue, 10 Jun 2014 21:59:53 +0000 (17:59 -0400)]
build: Use fileid instead of category to write sections in layoutrom.py.
The 'category' really determines the memory location while the
'fileid' determines which link stage the section is in. So, use
'fileid' when writing the linker scripts.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Kevin O'Connor [Mon, 9 Jun 2014 18:37:23 +0000 (14:37 -0400)]
build: Use customized entry point for each type of build.
Set an appropriate elf entry point (entry_elf, entry_csm,
reset_vector) for each type of build (coreboot, csm, qemu). Use that
entry point when determining which sections to keep.
Also, remove the '.export.' mechanism to keep a section in the final
binary - it is no longer used.
This allows the build to slightly reduce the overall size as entry_elf
is no longer needed on non-coreboot builds and entry_csm is no longer
needed on non-csm builds.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>