aboutsummaryrefslogtreecommitdiffstats
path: root/src
Commit message (Collapse)AuthorAgeFilesLines
* ssdt: Fix building of legacy acpi tables on current iasl compilerKevin O'Connor2018-07-152-2/+2
| | | | | | | | | | | | | Recent versions of the iasl compiler raise an error if the table id is longer than 8 characters. Older versions of iasl would silently truncate the table id to 8 characters. Change the ssdt-misc and ssdt-pcihp files to use an 8 character id - this should not directly impact the generated aml code as the table id was already being truncated - but may help those wishing to manually compile the tables. Reported by Michael Tokarev, Vivia Nikolaidou, and several others. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* pmm: use tmp zone on oomGerd Hoffmann2018-06-221-0/+13
| | | | Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
* optionrom: enable non-vga display devicesGerd Hoffmann2018-06-221-1/+28
| | | | | | In case no VGA device was found look for other display devices. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
* tpm: Request access to locality 0Stefan Berger2018-04-121-0/+2
| | | | | | | The CRB driver has to request access to locality 0. Our QEMU CRB model will enforce that as well. Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
* tpm: when CRB is active, select, lock it, and check addressesStefan Berger2018-03-211-3/+1
| | | | | | | | Do not just indicate that the probing for the CRB interface was successful if we find it active. Instead, select it, lock it, and test the addresses for whether they can be used (must be 32 bit). Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
* tpm: revert return values for successful/failed CRB probingStefan Berger2018-03-211-3/+3
| | | | | | | The return values for successful/failed CRB probing were reverted. Fix it. Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
* tpm: Wait for tpmRegValidSts flag on CRB interface before probingStefan Berger2018-03-211-0/+10
| | | | | | | | | | | Wait for the tpmRegValidSts flag on the TPM_LOC_STATE_x register to be set; we expect the locAssigned flag to not be set. Real hardware seems to set the tpmRegValidSts flag without for example requesting access to a locality. Tested-by: Stephen Douthit <stephend@silicom-usa.com> Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
* tpm: Handle unimplemented TIS_REG_IFACE_ID in tis_get_tpm_version()Stephen Douthit2018-03-021-5/+15
| | | | | | | | | | If a device reports 0xf in the InterfaceType field of the TPM_INTERFACE_ID, then the rest of the fields are invalid, and the InterfaceVersion field of the TPM_INTF_CAPABILITY register must be checked instead. Signed-off-by: Stephen Douthit <stephend@silicom-usa.com> Tested-by: Stefan Berger <stefanb@linux.vnet.ibm.com> Reviewed-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
* tpm: Wait for interface startup when probingStephen Douthit2018-03-021-1/+12
| | | | | | | | This is based on wait_startup() from the Linux tpm_tis driver. Signed-off-by: Stephen Douthit <stephend@silicom-usa.com> Tested-by: Stephen Douthit <stephend@silicom-usa.com> Reviewed-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
* tpm: Refactor duplicated wait code in tis_wait_sts() & crb_wait_reg()Stephen Douthit2018-03-021-47/+33
| | | | | | Signed-off-by: Stephen Douthit <stephend@silicom-usa.com> Tested-by: Stephen Douthit <stephend@silicom-usa.com> Reviewed-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
* tpm: add TPM CRB device supportMarc-André Lureau2018-02-272-1/+221
| | | | | | | | | | | | | | | | The CRB device was introduced with TPM 2.0 to be physical-bus agnostic and defined in TCG PC Client Platform TPM Profile (PTP) Specification Family “2.0” Level 00 Revision 01.03 v22 It seems to be required with Windows 10. It is also a simpler device than FIFO/TIS. This patch only support locality 0 since also the CRB device in QEMU only supports this locality. Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Reviewed-by: Stefan Berger <stefanb@linux.vnet.ibm.com> Tested-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
* tpm: use get_tpm_version() callbackMarc-André Lureau2018-02-271-1/+2
| | | | | | | | As originally intended. Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Reviewed-by: Stefan Berger <stefanb@linux.vnet.ibm.com> Tested-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
* tpm: generalize init_timeout()Marc-André Lureau2018-02-271-10/+15
| | | | | | | | | It seems both TIS & CRB devices share the same timeout. Make initialization function generic now. Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Reviewed-by: Stefan Berger <stefanb@linux.vnet.ibm.com> Tested-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
* x86: add readq()Marc-André Lureau2018-02-271-0/+5
| | | | | | Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Reviewed-by: Stefan Berger <stefanb@linux.vnet.ibm.com> Tested-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
* shadow: Don't invoke a shutdown on reboot unless in a reboot loopKevin O'Connor2018-02-221-11/+16
| | | | | | | | | | | | | | | Old versions of KVM would map the same writable copy of the BIOS at both 0x000f0000 and 0xffff0000. As a result, a reboot on these machines would result in a reboot loop. So, the code attempts to check for that situation and invoke a shutdown instead. Commit b837e68d changed the check to run prior to the first reboot. However, this broke reboots on the QEMU isapc machine type. Change the reboot loop check to only be invoked after at least one reboot has been attempted. Reported-by: Daniel P. Berrangé <berrange@redhat.com> Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* floppy: Send 4 sense interrupt commands during controller initializationNikolay Nikolov2018-02-151-1/+14
| | | | | | | | | | | During initialization, real floppy controllers need 4 sense interrupt commands to clear the interrupt status (this represents the transition from "not ready" to "ready" for each of the four virtual floppy drives), instead of just one. This is described in detail in section 7.4 - Drive Polling of the Intel 82077AA datasheet. Signed-off-by: Nikolay Nikolov <nickysn@users.sourceforge.net>
* floppy: Wait for the floppy motor to reach a stable speed, after startingNikolay Nikolov2018-02-151-2/+11
| | | | | | | | | | When starting up the floppy motor, wait for a certain amount of time, so that it can spin up and reach a stable speed. This delay is skipped, if the motor was already running (which can happen, since the floppy motor is intentionally kept spinning for 2 seconds after the previous floppy operation completes). Signed-off-by: Nikolay Nikolov <nickysn@users.sourceforge.net>
* floppy: Support up to 4 floppy drives when turning on the floppy motorNikolay Nikolov2018-02-151-1/+1
| | | | | | The previous version allowed for only two floppies. Signed-off-by: Nikolay Nikolov <nickysn@users.sourceforge.net>
* floppy: Execute a SPECIFY command after sensing the media typeNikolay Nikolov2018-02-151-2/+20
| | | | | | | The SPECIFY command sets the Step Rate Time, Head Load Time, Head Unload Time and the DMA enable/disable bit. Signed-off-by: Nikolay Nikolov <nickysn@users.sourceforge.net>
* floppy: hold the DOR reset bit low for 4 microseconds, when resettingNikolay Nikolov2018-02-151-0/+2
| | | | Signed-off-by: Nikolay Nikolov <nickysn@users.sourceforge.net>
* floppy: Use timer_check() in floppy_wait_irq()Nikolay Nikolov2018-02-071-4/+5
| | | | | | | | | | | | | | | | | | | | | | | | Use timer_check() instead of using floppy_motor_counter in BDA for the timeout check in floppy_wait_irq(). The problem with using floppy_motor_counter was that, after it reaches 0, it immediately stops the floppy motors, which is not what is supposed to happen on real hardware. Instead, after a timeout (like in the end of every floppy operation, regardless of the result - success, timeout or error), the floppy motors must be kept spinning for additional 2 seconds (the FLOPPY_MOTOR_TICKS). So, now the floppy_motor_counter is initialized to 255 (the max value) in the beginning of the floppy operation. For IRQ timeouts, a different timeout is used, specified by the new FLOPPY_IRQ_TIMEOUT constant (currently set to 5 seconds - a fairly conservative value, but should work reliably on most floppies). After the floppy operation, floppy_drive_pio() resets the floppy_motor_counter to 2 seconds (FLOPPY_MOTOR_TICKS). This is also consistent with what other PC BIOSes do. Signed-off-by: Nikolay Nikolov <nickysn@users.sourceforge.net>
* floppy: Reset the floppy motor count in floppy_drive_pio()Nikolay Nikolov2018-02-071-0/+1
| | | | | | | Reset the floppy motor count, so the motor keeps spinning 2 seconds after a floppy operation, performed by floppy_drive_pio(). Signed-off-by: Nikolay Nikolov <nickysn@users.sourceforge.net>
* floppy: Preserve motor and drive sel bits when resetting the floppy controllerNikolay Nikolov2018-02-071-3/+6
| | | | | | | | | | | | | | | | | | In case of read or write errors, the floppy system is usually reset and the operation is retried. In that case, the floppy motor state must be preserved in order to avoid creating jitter and keep the floppy motor spinning smoothly at a constant speed. Additionally, the drive select bits should probably also be preserved, because some systems might need a small delay after selecting a new drive. In that case, the operation would be retried, without changing the currently selected drive. In floppy_enable_controller(), the IRQ bit is now enabled first, before the reset bit is set. I'm not completely sure whether this is necessary. It is done just in case some hardware introduces a delay between setting this bit and actually enabling the IRQ, which would cause us to miss the IRQ, sent by the controller immediately after reset. Signed-off-by: Nikolay Nikolov <nickysn@users.sourceforge.net>
* floppy: Introduce FLOPPY_DOR_XXX constantsNikolay Nikolov2018-02-071-4/+13
| | | | Signed-off-by: Nikolay Nikolov <nickysn@users.sourceforge.net>
* floppy: Introduce floppy_dor_mask()Nikolay Nikolov2018-02-071-1/+7
| | | | Signed-off-by: Nikolay Nikolov <nickysn@users.sourceforge.net>
* floppy: Introduce the floppy_dor_read() functionNikolay Nikolov2018-02-071-2/+8
| | | | Signed-off-by: Nikolay Nikolov <nickysn@users.sourceforge.net>
* pci: fix 'io hints' capability for RedHat PCI bridgesMarcel Apfelbaum2018-01-161-9/+5
| | | | | | | | | | | | | | | | | | | | Commit ec6cb17f (pci: enable RedHat PCI bridges to reserve additional resources on PCI init) added a new vendor specific PCI capability for RedHat PCI bridges allowing them to reserve additional buses and/or IO/MEM space. When adding the IO hints PCI capability to the pcie-root-port without specifying a value for bus reservation, the subordinate bus computation is wrong and the guest kernel gets messed up. Fix it by returning to prev code if the value for bus reservation is not set. Removed also a wrong debug print "PCI: invalid QEMU resource reserve cap offset" which appears if the 'IO hints' capability is not present. Acked-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Marcel Apfelbaum <marcel@redhat.com>
* tpm: Add support for TPM2 ACPI tableStefan Berger2017-11-152-11/+54
| | | | | | | | | | | | Add support for the TPM2 ACPI table. If we find it and its of the appropriate size, we can get the log_area_start_address and log_area_minimum_size from it. The latest version of the spec can be found here: https://trustedcomputinggroup.org/tcg-acpi-specification/ Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
* paravirt: Only enable sercon in NOGRAPHIC mode if no other console specifiedKevin O'Connor2017-11-101-6/+7
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* sercon: Disable ScreenAndDebug in case both serial console and serial debug ↵Gerd Hoffmann2017-11-031-0/+4
| | | | | | are active Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
* timer: Avoid integer overflows in usec and nsec calculationsKevin O'Connor2017-11-021-24/+31
| | | | | | | | | When timer_calc_usec() is used with large timeout values, such as 60s, the integer math can overflow and produce different results than when using timer_calc(time / 1000) for the same timeout. Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com> Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* nvme: Use the Maximum Queue Entries Supported (MQES) to initialize I/O queuesFilippo Sironi2017-10-141-2/+8
| | | | | | | | | | | | | Use the Maximum Queue Entries Supported (MQES) to initialize I/O queues depth rather than picking a fixed number (256) which might not be supported by some NVMe controllers (the NVMe specification says that an NVMe controller may support any number between 2 to 4096). Still cap the I/O queues depth to 256 since, during my testing, SeaBIOS was running out of memory when using something higher than 256 (4096 on the NVMe controller that I've had a chance to try). Signed-off-by: Filippo Sironi <sironi@amazon.de>
* xhci: Verify the device is still present in xhci_cmd_submit()Kevin O'Connor2017-10-091-0/+11
| | | | | | | | Make sure the USB device is still present before altering the xhci "slot" for it. It appears some controllers will hang if a request is sent to a port no longer connected. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* nvme: fix out of memory behaviorJulian Stecklina2017-10-061-36/+111
| | | | | | | | | | If the allocation of I/O queues ran out of memory, the code would fail to detect that and happily use these queues at address zero. For me this happens for systems with more than 7 NVMe controllers. Fix the out of memory handling to gracefully handle this case. Signed-off-by: Julian Stecklina <jsteckli@amazon.de>
* xhci: Build TRBs directly in xhci_trb_queue()Kevin O'Connor2017-10-031-105/+59
| | | | | | | | | Use the logic for building a 'struct xhci_trb' that was in xhci_xfer_queue() up so that command and ring TRBs can also use that functionality. This eliminates the need to manually generate the xhci_trb struct from those code paths. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* virtio: Allocate drive_s storage in low memoryKevin O'Connor2017-09-273-9/+7
| | | | | | | | Use the "low" memory segment instead of the f-segment for the drive_s storage. This can help avoid running out of memory in the f-segment. Tested-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* block: Rename disk_op_s->drive_gf to drive_flKevin O'Connor2017-09-2720-174/+174
| | | | | | | | | | Now that the drive_s struct does not need to be in the f-segment, rename references to drive_gf in the generic drive code to drive_fl. This is just variable renames - no code changes. Tested-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* disk: Don't require the 'struct drive_s' to be in the f-segmentKevin O'Connor2017-09-273-18/+18
| | | | | | | | Allow the 'struct drive_s' drive description structure to be in either the "low" memory segment or the f-segment. Tested-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* boot: Rename drive_g to driveKevin O'Connor2017-09-271-8/+8
| | | | | | | | | The 'struct drive_s' pointer is a 32bit pointer (and boot.c code is only compiled in 32bit mode), so avoid using the "_g" suffix on the pointer. Tested-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* add serial console supportGerd Hoffmann2017-09-229-16/+737
| | | | | | | | | Redirect int10 calls to serial console output. Parse serial input and queue key events. The serial console can work both as primary display and in parallel to another vga display (splitmode). Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
* paravirt: serial console configuration.Gerd Hoffmann2017-09-221-0/+8
| | | | | | | Read QEMU_CFG_NOGRAPHIC, if set add etc/sercon-port file to enable the serial console. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
* romfile: add support for constant files.Gerd Hoffmann2017-09-222-0/+48
| | | | Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
* kbd: make enqueue_key public, add ascii_to_keycodeGerd Hoffmann2017-09-222-1/+19
| | | | | | | | serial console wants queue key events and needs to map ascii chars to the keycode, so make enqueue_key public and also exports a helper function so sercon can use the scan_to_keycode mapping table. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
* std: add cp437 to unicode mapGerd Hoffmann2017-09-222-0/+276
| | | | Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
* pci: enable RedHat PCI bridges to reserve additional resources on PCI initAleksandr Bezzubikov2017-09-142-4/+105
| | | | | | | | In case of Red Hat Generic PCIE Root Port reserve additional buses and/or IO/MEM/PREF space, which values are provided in a vendor-specific capability. Signed-off-by: Aleksandr Bezzubikov <zuban32s@gmail.com> Reviewed-by: Marcel Apfelbaum <marcel@redhat.com>
* pci: add QEMU-specific PCI capability structureAleksandr Bezzubikov2017-09-141-0/+52
| | | | | | | | | | | | | On PCI init PCI bridge devices may need some extra info about bus number to reserve, IO, memory and prefetchable memory limits. QEMU can provide this with special vendor-specific PCI capability. This capability is intended to be used only for Red Hat PCI bridges, i.e. QEMU cooperation. Signed-off-by: Aleksandr Bezzubikov <zuban32s@gmail.com> Reviewed-by: Marcel Apfelbaum <marcel@redhat.com>
* pci: refactor pci_find_capapibilty to get bdf as the first argument instead ↵Aleksandr Bezzubikov2017-09-146-30/+30
| | | | | | | | | | | of the whole pci_device Refactor pci_find_capability function to get bdf instead of a whole pci_device* as the only necessary field for this function is still bdf. Signed-off-by: Aleksandr Bezzubikov <zuban32s@gmail.com> Reviewed-by: Marcel Apfelbaum <marcel@redhat.com>
* tcgbios: Fix use of unitialized variableKevin O'Connor2017-09-141-2/+1
| | | | | Review-by: Stefan Berger <stefanb@linux.vnet.ibm.com> Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* usb-xhci: use hub portmapGerd Hoffmann2017-07-251-4/+41
| | | | | | | | xhci controllers have two virtual ports per (usb3 capable) physical port, one for usb2 and one for usb3 devices. Add a hub portmap callback to map the virtual ports to physical ports. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
* usb: add hub portmapGerd Hoffmann2017-07-252-3/+11
| | | | | | | | Allow usb hubs to map (software) ports to physical ports via op callback. This is needed to make bootorder work in case there isn't a simple linear mapping. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>