SeaBIOS

SeaBIOS Git Change Log

Age Message
9 days 15 hours Backup and restore a20 on call32_sloppy()

Previously, the a20 line would always be enabled and left on after
call32_sloppy(). The setting should really be backed up and restored
on each call.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
9 days 15 hours 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>
6 months 9 days 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>
20 days 15 hours 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>
20 days 16 hours Break up call32() into call32() and call32_sloppy()

This separates call32() into two functions. It also moves the
call16_sloppy() code next to the call32_sloppy() code.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
26 days 10 hours 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>
26 days 12 hours 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>
21 days 4 hours Update reset() to use call16_back()

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
21 days 4 hours 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>
21 days 4 hours 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>
21 days 9 hours Update stack_hop_back() to jump to 16bit mode if called in 32bit mode.

Also, update callers to rely on this feature.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
21 days 9 hours Update invoke_mouse_handler() to use need_hop_back()

Make the mouse handler stack_hop_back() code similar to the other
users that use need_stack_hop().

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
21 days 9 hours Add need_hop_back() call that determines if stack_hop_back is needed

Also, use need_hop_back() instead of on_extra_stack() in code that
determines whether or not to call stack_hop_back().

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
21 days 9 hours Move stack hop code below call32/call16 code in stacks.c

This change is a just code movement.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
20 days 19 hours 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>
20 days 19 hours 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.

This reverts commit d488a7683d90bf8fae7ceb8c3ad9e95fbbd92079.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
1 month 8 days ehci: Fix bug in hub port assignment

The usbdev->port field is zero indexed, while the USB spec expects the
port values to start at one.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
1 month 10 days 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>
1 month 10 days 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>
1 month 10 days 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>
1 month 10 days 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>
1 month 10 days 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>
1 month 10 days 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>
1 month 10 days 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>
1 month 10 days 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>