aboutsummaryrefslogtreecommitdiffstats
path: root/src
Commit message (Collapse)AuthorAgeFilesLines
* ehci: Export ehci_realloc_pipe() instead of ehci_alloc_pipe()Kevin O'Connor2014-10-163-5/+9
| | | | | | Support alloc, update, and free from the single exported function. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* ohci: Export ohci_realloc_pipe() instead of ohci_alloc_pipe()Kevin O'Connor2014-10-163-5/+9
| | | | | | Support alloc, update, and free from the single exported function. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* uhci: Export uhci_realloc_pipe() instead of uhci_alloc_pipe()Kevin O'Connor2014-10-163-5/+9
| | | | | | Support alloc, update, and free from the single exported function. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* xhci: Change xhci_update_pipe() to xhci_realloc_pipe() and use for alloc tooKevin O'Connor2014-10-163-12/+14
| | | | | | | | Instead of exporting both xhci_alloc_pipe() and xhci_update_pipe(), export only xhci_realloc_pipe() and support alloc, update, and free from it. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* usb: Clarify usb freelist manipulationsKevin O'Connor2014-10-165-12/+29
| | | | | | | Rename usb_getFreePipe() to usb_get_freelist(). Add usb_is_freelist() and usb_add_freelist() functions. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* usb: Rename free_pipe() to usb_free_pipe()Kevin O'Connor2014-10-164-11/+11
| | | | | | Also, pass in usbdev to usb_free_pipe(). Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* usb: Rename send_default_control() to usb_send_default_control()Kevin O'Connor2014-10-165-16/+16
| | | | | | This is just function renaming - no code implementation changes. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* usb: Rename findEndPointDesc() to usb_find_desc()Kevin O'Connor2014-10-164-7/+7
| | | | | | This is just function renaming - no code implementation changes. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* usb: Rename usb_getFrameExp() to usb_get_period()Kevin O'Connor2014-10-166-8/+8
| | | | | | This is just function renaming - no code implementation changes. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* usb: Rename ?hci_control() to ?hci_send_control()Kevin O'Connor2014-10-169-24/+24
| | | | | | This is just function renaming - no code implementation changes. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* Backup and restore a20 on call32_sloppy()Kevin O'Connor2014-10-151-0/+7
| | | | | | | | 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>
* Move a20 code from system.c and ps2port.h to x86.hKevin O'Connor2014-10-154-31/+19
| | | | | | | | 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>
* Implement call32 mechanism using SMIs.Kevin O'Connor2014-10-154-1/+192
| | | | | | | | | | | | | 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>
* Fully restore 16bit state during call16_sloppy()Kevin O'Connor2014-10-111-30/+63
| | | | | | | | 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>
* Break up call32() into call32() and call32_sloppy()Kevin O'Connor2014-10-111-39/+47
| | | | | | | 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>
* Move call16() functions from romlayout.S to inline assembler in stacks.cKevin O'Connor2014-10-112-54/+69
| | | | | | | | | | | 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>
* build: Support declaring 32bit C functions that must reside in the f-segmentKevin O'Connor2014-10-111-0/+4
| | | | | | | | 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>
* Update reset() to use call16_back()Kevin O'Connor2014-10-111-2/+2
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* Simplify farcall16 codeKevin O'Connor2014-10-112-17/+15
| | | | | | | | | | | | 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>
* Track when entering via call32() and use the same mode for stack_hop_back()Kevin O'Connor2014-10-111-1/+28
| | | | | | | | 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>
* Update stack_hop_back() to jump to 16bit mode if called in 32bit mode.Kevin O'Connor2014-09-303-21/+20
| | | | | | Also, update callers to rely on this feature. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* Update invoke_mouse_handler() to use need_hop_back()Kevin O'Connor2014-09-301-2/+7
| | | | | | | 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>
* Add need_hop_back() call that determines if stack_hop_back is neededKevin O'Connor2014-09-302-4/+14
| | | | | | | 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>
* Move stack hop code below call32/call16 code in stacks.cKevin O'Connor2014-09-302-83/+83
| | | | | | This change is a just code movement. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* pmm: Fix entry point to support non-zero %ssKevin O'Connor2014-09-301-2/+3
| | | | | | | | | 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>
* Revert "Use the extra stack for 16bit USB and PS2 keyboard/mouse commands."Kevin O'Connor2014-09-302-6/+6
| | | | | | | | | | | | | 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>
* ehci: Fix bug in hub port assignmentKevin O'Connor2014-09-161-1/+1
| | | | | | | 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>
* usb: Perform device detect polling on all usb controllers.Kevin O'Connor2014-09-167-60/+35
| | | | | | | | | | | | | | | | | | | | 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>
* ehci: Stall uhci/ohci init only until default port routing is done.Kevin O'Connor2014-09-161-18/+13
| | | | | | | | | | | 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>
* ohci: Repeatedly poll for device detect for 100ms.Kevin O'Connor2014-09-161-4/+11
| | | | | | | | 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>
* uhci: Repeatedly poll for device detect for 100ms.Kevin O'Connor2014-09-161-4/+11
| | | | | | | | | | | | 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>
* xhci: Change xhci_hub_detect() to use connect status instead of link state.Kevin O'Connor2014-09-101-9/+1
| | | | | | | | | 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>
* usb-hub: Enable power to all ports prior to calling usb_enumerate().Kevin O'Connor2014-09-102-11/+12
| | | | | | | | | 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>
* ehci: Move port power up from ehci_hub_detect() to check_ehci_ports().Kevin O'Connor2014-09-101-13/+12
| | | | | | | | | 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>
* xhci: Add xhci_check_ports() and xhci_free_pipes() functions.Kevin O'Connor2014-09-101-10/+27
| | | | | | | | 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>
* xhci: Move root hub and setup code to top of file.Kevin O'Connor2014-09-101-285/+290
| | | | | | | | | | Move the setup code to the top of the file so that like code is together and to make the code layout more similar to the other usb controllers. This change is purely code movement. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* xhci: Use high memory instead of low memory for internal storage.Kevin O'Connor2014-09-101-3/+3
| | | | | | | Now that the driver runs exclusively in 32bit mode, avoid using the scarce low memory resource. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* xhci: Remove 16bit code wrappers.Kevin O'Connor2014-09-101-70/+48
| | | | | | | The usb-xhci.c file is only compiled in 32bit mode now, so remove all the 16bit macros. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* xhci: Call usb_desc2pipe() on xhci_update_pipe().Kevin O'Connor2014-09-091-17/+20
| | | | | | | Make sure to call usb_desc2pipe() when updating a pipe settings. This ensures that pipe->devaddr is properly updated. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* usb: Fix usb_xfer_time() to work when called in 16bit mode.Kevin O'Connor2014-09-091-1/+1
| | | | | | | | | 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>
* Minor - remove stray tab from src/fw/smm.c.Kevin O'Connor2014-08-231-2/+1
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* acpi: use specified macro instead of magic-numberzhanghailiang2014-08-222-6/+35
| | | | | | Instead of magic numbers, use specified macros for FADT Fixed Feature Flags. Signed-off-by: zhanghailiang <zhang.zhanghailiang@huawei.com>
* boot: Change ":rom%d" boot order rom instance to ":rom%x"Kevin O'Connor2014-08-151-2/+2
| | | | | | | | | | | 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>
* boot: Fix boot order for SCSI target, lun > 9Markus Armbruster2014-08-151-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | 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. RHBZ: https://bugzilla.redhat.com/show_bug.cgi?id=1096560 [*] Open Firmware Recommended Practice: SCSI-3 Parallel Interface, Version 1, Section 3.1 Physical Address Formats and Representations http://www.openfirmware.org/1275/practice/spi/spi1_0.ps IEEE Standard for Boot (Initialization Configuration) Firmware: Core Requirements and Practices, IEEE Std 1275-1994, Annex E SCSI host adapter package class, section E.2.1 Physical address formats and representations Signed-off-by: Markus Armbruster <armbru@redhat.com>
* hw/pci: reserve IO and mem for pci express downstream ports with no devices ↵Marcel Apfelbaum2014-07-011-2/+32
| | | | | | | | | | | | | attached Commit c6e298e1f12e0f4ca02b6da5e42919ae055f6830 hw/pci: reserve IO and mem for pci-2-pci bridges with no devices attached introduced support for hot-plugging devices behind pci-2-pci bridges. Extend hotplug support also for pci express downstream ports. Signed-off-by: Marcel Apfelbaum <marcel.a@redhat.com> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
* romlayout: Use "rep ; nop" not "rep nop".Ian Campbell2014-07-011-1/+1
| | | | | | | | | | | Fixes: Compiling (16bit) out/romlayout.o src/romlayout.S: Assembler messages: src/romlayout.S:285: Error: expecting string instruction after `rep' make: *** [out/romlayout.o] Error 1 Reviewed-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
* ohci: Update usb command timeouts to use usb_xfer_time()Kevin O'Connor2014-06-141-4/+3
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* uhci: Update usb command timeouts to use usb_xfer_time()Kevin O'Connor2014-06-141-7/+6
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* ehci: Update usb command timeouts to use usb_xfer_time()Kevin O'Connor2014-06-141-5/+6
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* xhci: Update the times for usb command timeouts.Kevin O'Connor2014-06-143-2/+20
| | | | | | | | | | | | | | | 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>