aboutsummaryrefslogtreecommitdiff
path: root/src/hw
AgeCommit message (Collapse)AuthorFilesLines
2015-07-14ahci: Handle AHCI ATAPI drives directly via 'struct disk_op_s' requestsKevin O'Connor3-13/+8
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2015-07-14ata: Handle ATA ATAPI drives directly via 'struct disk_op_s' requestsKevin O'Connor3-5/+9
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2015-07-14blockcmd: Introduce scsi_fill_cmd()Kevin O'Connor2-30/+24
Introduce scsi_fill_cmd() which creates a scsi style "command data block" from a "struct disk_op_s" disk request. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2015-07-14block: Route scsi style commands through 'struct disk_op_s'Kevin O'Connor1-5/+22
Support sending scsi style "command data block" commands (cdbcmd) through the 'struct disk_op_s' command request structure. And change the blockcmd.c and cdrom.c code to route these commands through the process_op() code. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2015-07-14block: Introduce default_process_op() with common command handling codesKevin O'Connor6-39/+6
Most disk drivers only implement a couple of the available bios commands. Unify the common fallback handling code into a new function default_process_op() to reduce boiler-plate code. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2015-07-14block: Split process_op() command dispatch up into multiple functionsKevin O'Connor4-4/+4
Introduce process_op_32(), process_op_16(), and process_op_both() and split the disk driver command dispatch by its runtime mode requirements. This makes it more clear which modes each driver runs in. It also reduces the call32() boiler-plate code. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2015-07-04Make sure all code checks for malloc failuresKevin O'Connor5-4/+25
This is the result of an audit of callers of the malloc_XXX() and memalign_XXX() calls. All callers need to check if these functions return NULL. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2015-07-01virtio-pci: use high memory for ringsGerd Hoffmann1-1/+1
That way we should be able to manage *alot* more devices. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2015-07-01virtio-ring: 32bit cleanupGerd Hoffmann1-31/+30
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2015-07-01virtio-scsi: 32bit cleanupGerd Hoffmann1-6/+6
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2015-07-01virtio-blk: 32bit cleanupGerd Hoffmann1-4/+4
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2015-07-01virtio: legacy cleanupGerd Hoffmann2-33/+1
Now that all code is switched over to use vp_read/write we can drop the ioaddr field from vp_device and the offset #defines. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2015-07-01virtio: also probe version 1.0 pci idsGerd Hoffmann3-6/+12
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2015-07-01virtio: use version 1.0 if available (flip the big switch)Gerd Hoffmann1-7/+10
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2015-07-01virtio-blk: fix initialization for version 1.0Gerd Hoffmann2-28/+75
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2015-07-01virtio-scsi: fix initialization for version 1.0Gerd Hoffmann1-2/+23
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2015-07-01virtio: add version 1.0 support to vp_find_vqGerd Hoffmann1-15/+43
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2015-07-01virtio: remove unused vp_del_vqGerd Hoffmann1-11/+0
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2015-07-01virtio: add version 1.0 support to vp_notifyGerd Hoffmann4-7/+25
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2015-07-01virtio: add version 1.0 support to vp_resetGerd Hoffmann2-8/+12
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2015-07-01virtio: add version 1.0 support to vp_get_isrGerd Hoffmann2-5/+10
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2015-07-01virtio: add version 1.0 support to vp_{get,set}_statusGerd Hoffmann2-11/+22
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2015-07-01virtio: make features 64bit, support version 1.0 featuresGerd Hoffmann3-10/+37
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2015-07-01virtio: add read/write functions and macrosGerd Hoffmann1-0/+86
Add macros to read/write virtio registers. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2015-07-01virtio: create vp_cap struct for legacy barGerd Hoffmann2-2/+5
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2015-07-01virtio: find version 1.0 virtio capabilitiesGerd Hoffmann2-0/+64
virtio 1.0 specifies the location of the various virtio regions using pci capabilities. Look them up and store the results. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2015-07-01virtio: add version 0.9.5 structGerd Hoffmann1-0/+14
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2015-07-01virtio: add version 1.0 structs and #definesGerd Hoffmann2-0/+66
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2015-07-01virtio: pass struct pci_device to vp_init_simpleGerd Hoffmann4-6/+7
... instead of the bdf only. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2015-07-01virtio: add struct vp_deviceGerd Hoffmann6-53/+68
For virtio 1.0 support we will need more state than just the (legacy mode) ioaddr for each virtio-pci device. Prepare for that by adding a new struct for it. For now it carries the ioaddr only. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2015-07-01virtio: run drivers in 32bit modeGerd Hoffmann2-3/+4
virtio version 1.0 registers can (and actually do in the qemu implementation) live in mmio space. So we must run the blk and scsi virtio drivers in 32bit mode, otherwise we can't access them. This also allows to drop a bunch of GET_LOWFLAT calls from the virtio code in the following patches. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2015-06-30pci: allow to loop over capabilitiesGerd Hoffmann2-4/+9
Add a parameter to pci_find_capability, to specify the start point. This allows to find multiple capabilities of the same type, by calling pci_find_capability again with the offset of the last capability found. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2015-06-03Don't forward declare functions with "inline" in headersKevin O'Connor1-4/+4
Don't mark function definitions in headers with "inline" - it causes compile warnings on gcc v5. Signed-off-by: Kevin O'Connor <kevin@koconnor.net> Acked-by: Paul Menzel <paulepanter@sourceforge.net>
2015-05-21Implementation of the TCG BIOS extensionsStefan Berger1-0/+33
This patch implements the main part of the TCG BIOS extensions. It provides the following functionality: - initialization of the TCPA ACPI table used for logging of measurements - initialization of the TPM by sending a sequence of commands to it - proper setup of the TPM before the BIOS hands over control to the bootloader - support for S3 resume; BIOS sends TPM_Startup(ST_STATE) to TPM - enable configuration of SeaBIOS to be built with TCGBIOS extensions All TCG BIOS extensions are activated with CONFIG_TCGBIOS. Structures that are needed in subsequent patches are also included in tcgbios.h at this point. The effect of this patch is that it initialized the TPM upon VM start and S3 resume. Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
2015-05-21Add an implementation of a TPM TIS driverStefan Berger2-0/+348
This patch adds an implementation of a TPM TIS driver for the TPM TIS emulation supported by QEMU. The driver is broken up into several small functions that have to be called in proper sequence. The driver is cleanly separated from the rest of the code through an interface holding pointers to the driver's functions. A client using this driver first probes whether the TPM TIS interface is available (probe function) and then invokes the interface function to initialze the interface and send requests and receive responses. Possible future extensions *could* include a virtio interface for the TPM with a corresponding driver here. Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
2015-05-21ahci: 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>
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>