aboutsummaryrefslogtreecommitdiff
path: root/src/hw
AgeCommit message (Collapse)AuthorFilesLines
2015-06-12ahci: Ignore max_ports.Vladimir Serbinenko1-1/+1
At least AHCI on Intel on some machines claim to support only 6 ports while in fact higher port numbers are present and work. This is needed to access CD-ROM on PackardBell MS2290. Both GRUB and Linux have a similar workaround. Signed-off-by: Vladimir Serbinenko <phcoder@gmail.com> (cherry picked from commit 40dfc0ee947c35f31e935ec290622e7780bb52b8)
2015-01-07usb: Minor - properly free memory on get_device_config() error pathKevin O'Connor1-1/+3
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2015-01-07usb: Control transfers always have an 8 byte command sizeKevin O'Connor10-22/+25
There is no need to pass 'cmdsize' to the usb drivers as the cmdsize is always 8 bytes. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2015-01-07xhci: Merge some xhci_xfer_x() functions into xhci_send_pipe()Kevin O'Connor1-62/+18
The xhci_xfer_setup, xhci_xfer_data, xhci_xfer_status, and xhci_xfer_normal functions are very similar - enhance xhci_xfer_queue to reduce the boiler plate in the above functions. Merge the resulting setup, data, and status code into the only function that uses them - xhci_send_pipe(). Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2015-01-07xhci: Move xhci_xfer_x() functions togetherKevin O'Connor1-81/+81
This is purely code movement - no code changes. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2015-01-07usb: Use usb_send_pipe() now that all drivers have x_send_pipe()Kevin O'Connor1-25/+15
Now that all drivers have unified control and bulk transmit functions, unify the driver calling code in usb.c as well. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2015-01-07xhci: Merge xhci_send_control with xhci_send_bulkKevin O'Connor3-35/+19
Merge both the control and bulk pipe sending functions into one new function: xhci_send_pipe(). This makes the xhci interface similar to the other usb drivers. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2015-01-07uhci: Merge uhci_send_control with uhci_send_bulkKevin O'Connor3-66/+39
Merge both the control and bulk pipe sending functions into one new function: uhci_send_pipe(). The two existing functions were similar, and by merging them the resulting code supports more flexible control transfers. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2015-01-07ohci: Merge ohci_send_control with ohci_send_bulkKevin O'Connor3-65/+34
Merge both the control and bulk pipe sending functions into one new function: ohci_send_pipe(). The two existing functions were similar, and by merging them the resulting code supports more flexible control transfers. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2015-01-07ehci: Merge ehci_send_control with ehci_send_bulkKevin O'Connor3-71/+34
Merge both the control and bulk pipe sending functions into one new function: ehci_send_pipe(). The two existing functions were similar, and by merging them the resulting code supports more flexible control transfers. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2015-01-07ehci: Simplify fillTDbuffer() and renameKevin O'Connor1-28/+17
Simplify the calculation of the maximum transfer size per qtd, simplify the fillTDbuffer() function so that it only fills the buffer pointers, and rename fillTDbuffer() to ehci_fill_tdbuf(). Also, don't modify 'data' or 'datasize' so that usb_xfer_time() can use 'datasize' at the end of the function. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2015-01-07ehci: No need to support td array wrappingKevin O'Connor1-15/+13
The maximum bulk transfer is 64K and 4 QTDs can always transfer 64K. So, there is no need to support a transfer with more than 4 QTDs. Build the entire transaction and then submit it in one operation to simplify the code. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2015-01-01uhci: Increase bulk transfer STACKTDS to 16Kevin O'Connor1-2/+2
Increase the number of simultaneous transfer descriptors that the driver will build for uhci. The old value of 4 was a leftover from when SeaBIOS had a tiny 512 byte extra stack - now that there is a 2K extra stack there is plenty of space for additional descriptors. Using a value of 16 should allow for an entire 1ms frame of bulk transfer content to be setup in advance (assuming the max packet size is 64 bytes). Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2015-01-01uhci: Enable "depth" tree traversal for bulk transfersKevin O'Connor1-3/+3
Set the "depth" flag on bulk transactions. Since SeaBIOS doesn't use bandwidth reclamation, without the depth flag the uhci controller will only transfer one bulk packet per 1 ms frame. This results in a maximum of 64 bytes per millisecond, which severely limits the transfer rate. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2015-01-01usb: Add support for OHCI bulk transfersKevin O'Connor3-18/+76
Support bulk transfers (usb drives) on OHCI USB controllers. Now that there is support for 32bit only drive controllers, it is not that hard to support disks on OHCI controllers, and it may be useful for some old hardware. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2014-12-29scsi: Don't export cdb_* functionsKevin O'Connor2-16/+7
The low-level cdb_* functions are now only used from within cmdblock.c, so don't export them. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2014-12-29scsi: Move process_scsi_op() to hw/blockcmd.c and renameKevin O'Connor2-0/+20
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2014-12-29scsi: Move cdb_* functions above scsi_* functionsKevin O'Connor1-88/+98
This is just code movement - no code changes. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2014-12-29sdcard: Initial support for SD cards on PCI SDHCI controllers on QEMUKevin O'Connor1-0/+321
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>
2014-12-15usb: Update USB hub code to support super speed hubsKevin O'Connor2-3/+39
Super speed hubs (usb3 spec) have specific initialization requirements. Add the code necessary to detect and initialize these hubs. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2014-12-03floppy: Make sure to yield() during floppy PIOKevin O'Connor1-0/+2
The floppy Programmed IO code really should yield while the controller is busy. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2014-11-12Minor - move PORT_PS2_CTRLB from hw/ps2port.h to hw/timer.cKevin O'Connor2-2/+1
The PORT_PS2_CTRLB port is only used by timers - it's just a historical artifact that it was part of the original ps2 controller. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2014-11-10megasas: read addional PCI I/O barHannes Reinecke1-0/+4
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>
2014-10-16usb: Use usb_realloc_pipe for pipe alloc, update, and free.Kevin O'Connor2-36/+30
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>
2014-10-16ehci: Export ehci_realloc_pipe() instead of ehci_alloc_pipe()Kevin O'Connor3-5/+9
Support alloc, update, and free from the single exported function. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2014-10-16ohci: Export ohci_realloc_pipe() instead of ohci_alloc_pipe()Kevin O'Connor3-5/+9
Support alloc, update, and free from the single exported function. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2014-10-16uhci: Export uhci_realloc_pipe() instead of uhci_alloc_pipe()Kevin O'Connor3-5/+9
Support alloc, update, and free from the single exported function. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2014-10-16xhci: Change xhci_update_pipe() to xhci_realloc_pipe() and use for alloc tooKevin O'Connor3-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>
2014-10-16usb: Clarify usb freelist manipulationsKevin O'Connor5-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>
2014-10-16usb: Rename free_pipe() to usb_free_pipe()Kevin O'Connor4-11/+11
Also, pass in usbdev to usb_free_pipe(). Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2014-10-16usb: Rename send_default_control() to usb_send_default_control()Kevin O'Connor5-16/+16
This is just function renaming - no code implementation changes. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2014-10-16usb: Rename findEndPointDesc() to usb_find_desc()Kevin O'Connor4-7/+7
This is just function renaming - no code implementation changes. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2014-10-16usb: Rename usb_getFrameExp() to usb_get_period()Kevin O'Connor6-8/+8
This is just function renaming - no code implementation changes. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2014-10-16usb: Rename ?hci_control() to ?hci_send_control()Kevin O'Connor9-24/+24
This is just function renaming - no code implementation changes. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2014-10-15Move a20 code from system.c and ps2port.h to x86.hKevin O'Connor1-11/+3
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>
2014-09-16ehci: Fix bug in hub port assignmentKevin O'Connor1-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>
2014-09-16usb: Perform device detect polling on all usb controllers.Kevin O'Connor7-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>
2014-09-16ehci: Stall uhci/ohci init only until default port routing is done.Kevin O'Connor1-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>
2014-09-16ohci: Repeatedly poll for device detect for 100ms.Kevin O'Connor1-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>
2014-09-16uhci: Repeatedly poll for device detect for 100ms.Kevin O'Connor1-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>
2014-09-10xhci: Change xhci_hub_detect() to use connect status instead of link state.Kevin O'Connor1-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>
2014-09-10usb-hub: Enable power to all ports prior to calling usb_enumerate().Kevin O'Connor2-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>
2014-09-10ehci: Move port power up from ehci_hub_detect() to check_ehci_ports().Kevin O'Connor1-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>
2014-09-10xhci: Add xhci_check_ports() and xhci_free_pipes() functions.Kevin O'Connor1-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>
2014-09-10xhci: Move root hub and setup code to top of file.Kevin O'Connor1-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>
2014-09-10xhci: Use high memory instead of low memory for internal storage.Kevin O'Connor1-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>
2014-09-10xhci: Remove 16bit code wrappers.Kevin O'Connor1-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>
2014-09-09xhci: Call usb_desc2pipe() on xhci_update_pipe().Kevin O'Connor1-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>
2014-09-09usb: Fix usb_xfer_time() to work when called in 16bit mode.Kevin O'Connor1-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>
2014-06-14ohci: Update usb command timeouts to use usb_xfer_time()Kevin O'Connor1-4/+3
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>