aboutsummaryrefslogtreecommitdiffstats
path: root/src/hw
Commit message (Collapse)AuthorAgeFilesLines
* esp-scsi: indicate acceptance of MESSAGE IN phase dataMark Cave-Ayland2024-09-041-1/+3
| | | | | | | | | | | | | When the target has sent its MESSAGE IN phase data to the initiator, it waits for the initiator to release the ACK signal before disconnecting from the bus. Send a MSG_ACC command to the ESP so that the initiator releases the ACK signal to allow the target to disconnect, and also return the ASC back to the disconnected state. Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk> Message-ID: <20240829115846.954993-1-mark.cave-ayland@ilande.co.uk> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
* Add LBA 64bit support for reads beyond 2TB.Max Tottenham2024-01-262-14/+71
| | | | | | | | | | | | | | | | | When booting from a >2TB drive/filesystem, it's possible what the kernel/bootloader may be updated and written out at an LBA address beyond what is normally accessible by the READ(10) SCSI commands. If this happens to the kernel grub will fail to boot the kernel as it will call into the BIOS with an LBA address >2TB, and the BIOS will return an error. Per the SCSI spec, >2TB drives should return 0XFFFFFFFF, and a READ CAPACITY(16) command should be issued to determine the full size of the drive, READ(16) commands can then be used in order to read data at LBA addresses beyond 2TB (64 bit LBA addresses) Signed-off-by: Max Tottenham <mtottenh@akamai.com> Message-ID: <20240125150050.3775834-2-mtottenh@akamai.com> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
* Add AHCI Power ON + ICC_ACTIVE into port setup codeAndrej Kruták2024-01-251-1/+2
| | | | | | | | | | | | | Windows appears to put the AHCI port into 'Partial power management state' during reboot, the command puts it back into 'active state'. AHCI/1: link down 0x00000231 (SCR STAT register) -> AHCI/1: link up 0x00000133 Signed-off-by: Andrej Krutak andrej.krutak@sysgo.com Message-ID: <1531455205.6484.1704814463638@ox.sysgo.com> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
* esp-scsi: terminate DMA transfer when ESP data transfer completesMark Cave-Ayland2024-01-251-0/+2
| | | | | | | | | | | | | | | | When the ESP data transfer completes indicated by the STAT_TC flag being set, terminate the DMA transfer by issuing a DMA IDLE command. Otherwise in the case where the guest sends a reset followed by an ESP command, the DMA signal remains enabled and so the next SeaBIOS DMA transfer begins immediately when the next ESP command is received rather than waiting until the data is ready and the DMA command is issued. With this fix it is possible to boot a Windows XP ISO to the installer and complete a full installation within QEMU directly using SeaBIOS. Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk> Message-ID: <20240101121942.383191-1-mark.cave-ayland@ilande.co.uk> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
* esp-scsi: handle non-DMA SCSI commands with no data phaseMark Cave-Ayland2023-08-241-1/+10
| | | | | | | | | | | | | | | The existing esp-scsi state machine checks for the STAT_TC bit to exit state 1 but in the case where there is no data phase, a non-DMA command is executed which doesn't set STAT_TC. This only works because QEMU currently always sets STAT_TC just after issuing every SCSI command. Update the esp-scsi state machine so that in the case where there is no data phase, we immediately execute CMD_ICCS instead of waiting for STAT_TC to be set which will never happen with a non-DMA CMD_SELATN command. Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk> Message-ID: <20230807065300.366070-4-mark.cave-ayland@ilande.co.uk> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
* esp-scsi: check for INTR_BS/INTR_FC instead of STAT_TC for command completionMark Cave-Ayland2023-08-241-14/+22
| | | | | | | | | | | | | | | | | | | | | | | | | | | The ESP SELATN command used to send SCSI commands from the ESP to the SCSI bus is not a DMA command and therefore does not affect the STAT_TC bit. The only reason this works at all is due to a bug in QEMU which (currently) always updates the STAT_TC bit in ESP_RSTAT regardless of the state of the ESP_CMD_DMA bit. According to the NCR datasheet [1] the INTR_BS/INTR_FC bits are set when the SELATN command has completed, so update the existing logic to check for these bits in ESP_RINTR instead. Note that the read of ESP_RINTR needs to be restricted to state == 0 as reading ESP_RINTR resets the ESP_RSTAT register which breaks the STAT_TC check when state == 1. This commit also includes an extra read of ESP_INTR to clear all the interrupt bits before submitting the SELATN command to ensure that we don't accidentally immediately progress to the data phase handling logic where ESP_RINTR bits have already been set by a previous ESP command. [1] "NCR 53C94, 53C95, 53C96 Advanced SCSI Controller" NCR_53C94_53C95_53C96_Data_Sheet_Feb90.pdf Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk> Reviewed-by: Paolo Bonzini <pbonzini@redhat.com> Message-ID: <20230807065300.366070-3-mark.cave-ayland@ilande.co.uk> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
* esp-scsi: flush FIFO before sending SCSI commandMark Cave-Ayland2023-08-241-0/+4
| | | | | | | | | | | | | The ESP FIFO is used as a buffer for DMA requests and so isn't guaranteed to be empty in the case of SCSI errors or a mixed DMA/non-DMA request. Flush the FIFO before sending a SCSI command to guarantee that it is correctly positioned at the start of the FIFO. Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk> Reviewed-by: Paolo Bonzini <pbonzini@redhat.com> Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> Message-ID: <20230807065300.366070-2-mark.cave-ayland@ilande.co.uk> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
* ahci: handle TFES irq correctlyNiklas Cassel via SeaBIOS2023-06-211-0/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | According to AHCI 1.3.1, 5.3.8.1 RegFIS:Entry, if ERR_STAT is set in the received FIS, the HBA shall jump to state ERR:FatalTaskfile, which will raise a TFES IRQ. This means that if ERR_STAT is set in the recevied FIS, PxIS.TFES will be set, without either PxIS.DHRS or PxIS.PSS being set. SeaBIOS function ahci_port_setup() will try to identify an AHCI device by sending an ATAPI identify device command. However, such a command will be aborted with ERR_STAT set for a regular (non-ATAPI) device. ahci_command() already performs the correct error recovery steps when status is correctly set, so simply modify ahci_command() to read the correct status when PxIS.TFES is set. It is safe to read PxTFD when PxIS.TFES is set, even for systems with a port multiplier, see AHCI 1.3.1, 9.3.7 PxTFD Register Information: "When a taskfile error occurs (PxIS.TFES is set to '1'), the host may refer to the values in PxTFD. The values in PxTFD at this time are guaranteed to correspond to the device that reported the taskfile error condition." Without this, each boot will be delayed by 32 seconds, waiting for the AHCI command to timeout. Signed-off-by: Niklas Cassel <niklas.cassel@wdc.com> Tested-by: Gerd Hoffmann <kraxel@redhat.com> Acked-by: Gerd Hoffmann <kraxel@redhat.com>
* virtio-blk: Fix integer overflow for large max IO sizesLukas Stockner via SeaBIOS2023-06-131-1/+1
| | | | | | | | | | | | | When the maximum IO size supported by the virtio-blk backend is large enough (>= 32MiB for 512B sectors), the computed blk_num_max will overflow. In particular, if it's a multiple of 32MiB, blk_num_max will end up as zero, causing IO requests to fail. This is triggered by e.g. the SPDK virtio-blk vhost-user backend. To fix it, just limit blk_num_max to 65535 before converting to u16. Signed-off-by: Lukas Stockner <lstockner@genesiscloud.com>
* usb: fix wrong init of keyboard/mouse's if first interface is not boot protocolQi Zhou2022-11-232-10/+15
| | | | | | | | There is always some endpoint descriptors after each interface descriptor, We should only decrement num_iface if interface type is USB_DT_INTERFACE, see https://www.beyondlogic.org/usbnutshell/usb5.shtml#ConfigurationDescriptors Signed-off-by: Qi Zhou <atmgnd@outlook.com>
* virtio: finalize features before using devicerel-1.16.1Xuan Zhuo2022-11-232-9/+26
| | | | | | | | | | | | | | | | | | | Under the standard of Virtio 1.0, the initialization process of the device must first write sub-features back to device before using device, such as finding vqs. There are four places using vp_find_vq(). 1. virtio-blk.pci: put the code of finalizing features in front of using device 2. virtio-blk.mmio: put the code of finalizing features in front of using device 3. virtio-scsi.pci: is ok 4. virtio-scsi.mmio: add the code of finalizing features before vp_find_vq() Link: https://www.mail-archive.com/qemu-devel@nongnu.org/msg920776.html Signed-off-by: Xuan Zhuo <xuanzhuo@linux.alibaba.com> Acked-by: Michael S. Tsirkin <mst@redhat.com> Message-Id: <20221114035818.109511-3-xuanzhuo@linux.alibaba.com> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
* virtio-mmio: read/write the hi 32 features for mmioXuan Zhuo2022-11-231-2/+5
| | | | | | | | | | | Under mmio, when we read the feature from the device, we should read the high 32-bit part. Similarly, when writing the feature back, we should also write back the high 32-bit feature. Signed-off-by: Xuan Zhuo <xuanzhuo@linux.alibaba.com> Acked-by: Michael S. Tsirkin <mst@redhat.com> Message-Id: <20221114035818.109511-2-xuanzhuo@linux.alibaba.com> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
* virtio-blk: Fix incorrect type conversion in virtio_blk_op()Xiaofei Lee2022-11-221-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When using spdk aio bdev driver, the qemu command line like this: qemu-system-x86_64 \ -chardev socket,id=char0,path=/tmp/vhost.0 \ -device vhost-user-blk-pci,id=blk0,chardev=char0 \ ... Boot failure message as below: e820 map has 7 items: 0: 0000000000000000 - 000000000009fc00 = 1 RAM 1: 000000000009fc00 - 00000000000a0000 = 2 RESERVED 2: 00000000000f0000 - 0000000000100000 = 2 RESERVED 3: 0000000000100000 - 000000007ffdd000 = 1 RAM 4: 000000007ffdd000 - 0000000080000000 = 2 RESERVED 5: 00000000feffc000 - 00000000ff000000 = 2 RESERVED 6: 00000000fffc0000 - 0000000100000000 = 2 RESERVED enter handle_19: NULL Booting from Hard Disk... Boot failed: could not read the boot disk Fixes: a05af290bac5 ("virtio-blk: split large IO according to size_max") Acked-by: Andy Pei <andy.pei@intel.com> Acked-by: Gerd Hoffmann <kraxel@redhat.com> Acked-by: Michael S. Tsirkin <mst@redhat.com> Acked-by: Paul Menzel <pmenzel@molgen.mpg.de> Signed-off-by: Xiaofei Lee <hbuxiaofei@gmail.com>
* virtio-blk: use larger default request sizeGerd Hoffmann2022-07-071-1/+1
| | | | | | | | | | | Bump default from 8 to 64 blocks. Using 8 by default leads to requests being splitted on qemu, which slows down boot. Some (temporary) debug logging added showed that almost all requests on a standard fedora install are less than 64 blocks, so that should bring us back to 1.15 performance levels. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
* reset: force standard PCI configuration accessVolker Rümelin2022-04-042-0/+33
| | | | | | | | | | | | | | | | | | | | | | | | | | | After a reset of a QEMU -machine q35 guest, the PCI Express Enhanced Configuration Mechanism is disabled and the variable mmconfig no longer matches the configuration register PCIEXBAR of the Q35 chipset. Until the variable mmconfig is reset to 0, all pci_config_*() functions no longer work. The variable mmconfig is located in one of the read-only C-F segments. To reset it the pci_config_*() functions are needed, but they do not work. Replace all pci_config_*() calls with Standard PCI Configuration Mechanism pci_ioconfig_*() calls until mmconfig is overwritten with 0 by a fresh copy of the BIOS. This fixes In resume (status=0) In 32bit resume Attempting a hard reboot Unable to unlock ram - bridge not found and a reset loop with QEMU -accel tcg. Signed-off-by: Volker Rümelin <vr_qemu@t-online.de>
* pci: refactor the pci_config_*() functionsVolker Rümelin2022-04-042-13/+53
| | | | | | | | | Split out the Standard PCI Configuration Access Mechanism pci_ioconfig_*() functions from the pci_config_*() functions. The standard PCI CAM functions will be used in the next patch. Reviewed-by: Gerd Hoffmann <kraxel@redhat.com> Signed-off-by: Volker Rümelin <vr_qemu@t-online.de>
* nvme: fix LBA format data structureFlorian Larysch2022-02-031-1/+0
| | | | | | | | | | The LBA Format Data structure is dword-sized, but struct nvme_lba_format erroneously contains an additional member, misaligning all LBAF descriptors after the first and causing them to be misinterpreted. Remove it. Signed-off-by: Florian Larysch <fl@n621.de> Reviewed-by: Alexander Graf <graf@amazon.com>
* nvme: avoid use-after-free in nvme_controller_enable()Jan Beulich via SeaBIOS2022-01-271-1/+2
| | | | | | | | | Commit b68f313c9139 ("nvme: Record maximum allowed request size") introduced a use of "identify" past it being passed to free(). Latch the value of interest into a local variable. Reported-by: Coverity (ID 1497613) Signed-off-by: Jan Beulich <jbeulich@suse.com>
* nvme: Only allocate one dma bounce buffer for all nvme drivesKevin O'Connor2022-01-272-9/+15
| | | | | | | | | | There is no need to create multiple dma bounce buffers as the BIOS disk code isn't reentrant capable. Also, verify that the allocation succeeds. Signed-off-by: Kevin O'Connor <kevin@koconnor.net> Reviewed-by: Alexander Graf <graf@amazon.com>
* nvme: Build the page list in the existing dma bufferKevin O'Connor2022-01-272-43/+24
| | | | | | | | | | | | | | | | | | | | | | Commit 01f2736cc905d ("nvme: Pass large I/O requests as PRP lists") introduced multi-page requests using the NVMe PRP mechanism. To store the list and "first page to write to" hints, it added fields to the NVMe namespace struct. Unfortunately, that struct resides in fseg which is read-only at runtime. While KVM ignores the read-only part and allows writes, real hardware and TCG adhere to the semantics and ignore writes to the fseg region. The net effect of that is that reads and writes were always happening on address 0, unless they went through the bounce buffer logic. This patch builds the PRP maintenance data in the existing "dma bounce buffer" and only builds it when needed. Fixes: 01f2736cc905d ("nvme: Pass large I/O requests as PRP lists") Reported-by: Matt DeVillier <matt.devillier@gmail.com> Signed-off-by: Alexander Graf <graf@amazon.com> Signed-off-by: Kevin O'Connor <kevin@koconnor.net> Reviewed-by: Alexander Graf <graf@amazon.com>
* nvme: Pass prp1 and prp2 directly to nvme_io_xfer()Kevin O'Connor2022-01-271-21/+18
| | | | | | | | When using a prp2 parameter, build it in nvme_prpl_xfer() and pass it directly to nvme_io_xfer(). Signed-off-by: Kevin O'Connor <kevin@koconnor.net> Reviewed-by: Alexander Graf <graf@amazon.com>
* nvme: Convert nvme_build_prpl() to nvme_prpl_xfer()Kevin O'Connor2022-01-272-27/+20
| | | | | | | | Rename nvme_build_prpl() to nvme_prpl_xfer() and directly invoke nvme_io_xfer() or nvme_bounce_xfer() from that function. Signed-off-by: Kevin O'Connor <kevin@koconnor.net> Reviewed-by: Alexander Graf <graf@amazon.com>
* nvme: Add nvme_bounce_xfer() helper functionKevin O'Connor2022-01-211-14/+21
| | | | | | | Move bounce buffer processing to a new helper function. Signed-off-by: Kevin O'Connor <kevin@koconnor.net> Reviewed-by: Alexander Graf <graf@amazon.com>
* nvme: Rework nvme_io_readwrite() to return -1 on errorKevin O'Connor2022-01-211-19/+18
| | | | | | | | Rename nvme_io_readwrite() to nvme_io_xfer() and change it so it implements the debugging dprintf() and it returns -1 on an error. Signed-off-by: Kevin O'Connor <kevin@koconnor.net> Reviewed-by: Alexander Graf <graf@amazon.com>
* virtio-blk: split large IO according to size_maxAndy Pei2021-12-181-1/+34
| | | | | | | | | | | | | if driver reads data larger than VIRTIO_BLK_F_SIZE_MAX, it will cause some issue to the DMA engine. So when upper software wants to read data larger than VIRTIO_BLK_F_SIZE_MAX, virtio-blk driver split one large request into multiple smaller ones. Signed-off-by: Andy Pei <andy.pei@intel.com> Signed-off-by: Ding Limin <dinglimin@cmss.chinamobile.com> Reviewed-by: Gerd Hoffmann <kraxel@redhat.com>
* virtio-blk: abstract a function named virtio_blk_op_one_segment to handle ↵Andy Pei2021-12-181-20/+28
| | | | | | | | | | r/w request abstract virtio-blk queue operation to form a function named virtio_blk_op_one_segment Signed-off-by: Andy Pei <andy.pei@intel.com> Signed-off-by: Ding Limin <dinglimin@cmss.chinamobile.com> Reviewed-by: Gerd Hoffmann <kraxel@redhat.com>
* virtio-blk: add feature VIRTIO_BLK_F_SIZE_MAX and VIRTIO_BLK_F_SEG_MAXAndy Pei2021-12-182-8/+46
| | | | | | | | | according to virtio spec, add feature VIRTIO_BLK_F_SIZE_MAX and VIRTIO_BLK_F_SEG_MAX parse to virtio blk driver. Signed-off-by: Andy Pei <andy.pei@intel.com> Signed-off-by: Ding Limin <dinglimin@cmss.chinamobile.com> Reviewed-by: Gerd Hoffmann <kraxel@redhat.com>
* nvme: fix missing newline on sq full printAlex Martens via SeaBIOS2021-06-301-1/+1
| | | | Signed-off-by: Alex Martens <alexmgit@protonmail.com>
* nvme: drive desc should not include the newlineGerd Hoffmann2021-05-311-2/+2
| | | | Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
* nvme: improve namespace allocationGerd Hoffmann2021-05-312-25/+16
| | | | | | | | Instead of allocating a big array upfront go probe the namespaces and only allocate an nvme_namespace struct for those namespaces which are actually active. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
* usb-hid: Increase MAX_KBD_EVENTStefan Ott via SeaBIOS2021-03-101-1/+1
| | | | | | | | | | Some USB keyboards use max packet sizes beyond the current maximum supported by SeaBIOS. This increases the available size to support keyboards such as the Matias Ergo Pro. Signed-off-by: Stefan Ott <stefan@ott.net>
* Support booting USB drives with a write protect switch enabledMike Banon2020-12-211-3/+7
| | | | | | | | | | At least some USB drives with a write protect switch (e.g. Netac U335) could report "MEDIUM NOT PRESENT" for a while if a write protection is enabled. Instead of stopping the initialization attempts immediately, stop only after getting this report for 3 times, to ensure the successful initialization of such a "broken hardware". Signed-off-by: Mike Banon <mikebdp2@gmail.com>
* nvme: Clean up nvme_cmd_readwrite()David Woodhouse2020-11-161-44/+33
| | | | | | | | | | | | | | This ended up with an odd mix of recursion (albeit *mostly* tail-recursion) and interation that could have been prettier. In addition, while recursing it potentially adjusted op->count which is used by callers to see the amount of I/O actually performed. Fix it by bringing nvme_build_prpl() into the normal loop using 'i' as the offset in the op. Fixes: 94f0510dc ("nvme: Split requests by maximum allowed size") Reviewed-by: Alexander Graf <graf@amazon.com> Signed-off-by: David Woodhouse <dwmw@amazon.co.uk>
* nvme: Split requests by maximum allowed sizeAlexander Graf2020-10-281-0/+16
| | | | | | | | | | | | | | | | | Some NVMe controllers only support small maximum request sizes, such as the AWS EBS NVMe implementation which only supports NVMe requests of up to 32 pages (256kb) at once. BIOS callers can exceed those request sizes by defining sector counts above this threshold. Currently we fall back to the bounce buffer implementation for those. This is slow. This patch introduces splitting logic to the NVMe I/O request code so that every NVMe I/O request gets handled in a chunk size that is consumable by the NVMe adapter, while maintaining the fast path PRPL logic we just introduced. Signed-off-by: Alexander Graf <graf@amazon.com>
* nvme: Pass large I/O requests as PRP listsAlexander Graf2020-10-282-10/+82
| | | | | | | | | | | | | | | | | | | Today, we split every I/O request into at most 4kb chunks and wait for these requests to finish. We encountered issues where the backing storage is network based, so every I/O request needs to go over the network with associated latency cost. A few ms of latency when loading 100MB initrd in 4kb chunks does add up. NVMe implements a feature to allow I/O requests spanning multiple pages, called PRP lists. This patch takes larger I/O operations and checks if they can be directly passed to the NVMe backing device as PRP list. At least for grub, read operations can always be mapped directly into PRP list items. This reduces the number of I/O operations required during a typical boot path by roughly a factor of 5. Signed-off-by: Alexander Graf <graf@amazon.com>
* nvme: Allow to set PRP2Alexander Graf2020-10-281-5/+6
| | | | | | | | | | | | | When creating a PRP based I/O request, we pass in the pointer to operate on. Going forward, we will want to be able to pass additional pointers though for mappings above 4k. This patch adds a parameter to nvme_get_next_sqe() to pass in the PRP2 value of an NVMe I/O request, paving the way for a future patch to implement PRP lists. Signed-off-by: Alexander Graf <graf@amazon.com> Reviewed-by: Filippo Sironi <sironi@amazon.de>
* nvme: Record maximum allowed request sizeAlexander Graf2020-10-282-3/+18
| | | | | | | | NVMe has a limit on how many sectors it can handle at most within a single request. Remember that number, so that in a follow-up patch, we can verify that we don't exceed it. Signed-off-by: Alexander Graf <graf@amazon.com>
* usb/xhci: add support for mmio host adapters (via acpi).Gerd Hoffmann2020-10-131-0/+31
| | | | | | | | | Add xhci_controller_setup_acpi() function to initialize usb host adapters declared in the DSDT table. Search the acpi devices list for xhci controllers. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Message-id: 20200930111433.21533-4-kraxel@redhat.com
* usb/xhci: split xhci setup into generic and pci partsGerd Hoffmann2020-10-131-13/+27
| | | | | | | | | Split the pci-specific code into a separate xhci_controller_setup_pci() function, turn xhci_controller_setup() to a generic xhci setup function which only needs the mmio address if the control registers. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Message-id: 20200930111433.21533-3-kraxel@redhat.com
* usb: add boot prio support for mmio host adaptersGerd Hoffmann2020-10-131-0/+1
| | | | | | | | Add mmio field to usb controller struct, add support for mmio-mapped usb host adapters to boot order handling. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Message-id: 20200930111433.21533-2-kraxel@redhat.com
* USB:Fix xHCI initail fail by using longer reset and CNR clear timeout valueweitaowang-oc@zhaoxin.com2020-09-301-2/+2
| | | | | | | | | | | Some xHCI controller's reset time than 100ms,such as 120ms. On the on hand, xHCI spec has not specified a timeout value. Maybe setting xHCI HCRST and CNR bit clear timeout value larger is a nice thing.As a compromise between compatibility and latency,we can take 1000ms as a timeout value. Signed-off-by: WeitaoWangoc <WeitaoWang-oc@zhaoxin.com> Message-Id: <159698294308.14.13067234241650533818@b63950293ec5>
* usb.c: Fix devices using non-primary interface descriptorMatt DeVillier2020-09-251-8/+19
| | | | | | | | | | | | | A fair number of USB devices (keyboards in particular) use an interface descriptor other than the first available, making them non-functional currently. To correct this, iterate through all available interface descriptors until one with the correct class/subclass is found, then proceed to set the configuration and setup the driver. Tested on an ultimate hacking keyboard (UHK 60) Signed-off-by: Matt DeVillier <matt.devillier@puri.sm>
* nvme: Increase `nvme_cmd_readwrite()` message log level from 3 to 5Paul Menzel2020-07-281-1/+1
| | | | | | | | | | | | | | | | | | | | | | | Currently, setting SeaBIOS debug level to 3, the log is filled with messages like below. ns 1 read lba 11346288+8: 0 ns 1 read lba 11346296+4: 0 ns 1 read lba 11346300+4: 0 ns 1 read lba 11346304+8: 0 ns 1 read lba 11346312+8: 0 ns 1 read lba 11346320+8: 0 ns 1 read lba 11346328+8: 0 ns 1 read lba 11346336+8: 0 With SeaBIOS as coreboot payload, this fills up the CBMEM console buffer. So, increase the debug level to 5, so possible console buffer do not overflow. Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> Signed-off-by: Paul Menzel <pmenzel@molgen.mpg.de>
* virtio-scsi: fix boot prio detection by using correct lunStefan Reiter2020-07-281-3/+3
| | | | | | | | | | | | | | Commits d6bdb85eb0 virtio-scsi: skip initializing non-bootable devices f82e82a5ab2 virtio-mmio: add support for scsi devices. both use the lun value from tmpl_drv, which is always 0, instead of the correct one passed as a separate parameter. This causes systems where LUNs other than 0 are set as bootable, but 0 is not, to not boot. Reviewed-by: Paul Menzel <pmenzel@molgen.mpg.de> Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
* timer: Handle decrements of PIT counterRoman Bolshakov2020-06-261-1/+1
| | | | | | | | | | | | | | | | | | | | | | | There's a fallback to PIT if TSC is not present but it doesn't work properly. It prevents boot from floppy on isapc and 486 cpu [1][2]. SeaBIOS configures PIT in Mode 2. PIT counter is decremented in the mode but timer_adjust_bits() thinks that the counter overflows and increases 32-bit tick counter on each detected "overflow". Invalid overflow detection results in 55ms time advance (1 / 18.2Hz) on each read from PIT counter. So all timers expire much faster and 5-second floppy timeout expires in 83 real microseconds (or just a bit longer). It can be fixed by making the counter recieved from PIT an increasing value so it can be passed to timer_adjust_bits(): 0, 1, 2 and up to 65535 and then the counter is re-loaded with 0. 1. https://bugs.launchpad.net/seabios/+bug/1840719 2. https://lists.gnu.org/archive/html/qemu-devel/2019-08/msg03924.html Fixes: eac11944019 ("Unify pmtimer_read() and pittimer_read() code.") Reported-by: Philippe Mathieu-Daudé <philmd@redhat.com> Signed-off-by: Roman Bolshakov <r.bolshakov@yadro.com>
* serialio: Preserve Xen DebugOutputPortJason Andryuk2020-06-241-0/+4
| | | | | | | | | | | | xen_preinit() runs early and changes DebugOutputPort. qemu_preinit() runs soon after. inb on DebugOutputPort doesn't work on Xen, so the check will always fail and DebugOutputPort will be cleared to 0 disabling output. Quick exit the function when running on Xen to preserve the modified DebugOutputPort. Signed-off-by: Jason Andryuk <jandryuk@gmail.com>
* pci: fix mmconfig supportGerd Hoffmann2020-05-251-6/+6
| | | | | | | | | | | | | | The MODESEGMENT condition is backwards, with the effect that mmconfig mode is not used to configure pci bars during POST. Oops. Fix it. The only real mode pci config space access seems to come from the ipxe option rom initialiation. Which happens to work via mmconfig because it runs in big real mode so this went unnoticed ... Fixes: 6a3b59ab9c7d ("pci: add mmconfig support") Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
* Revert "ps2port: adjust init routine to fix PS/2 keyboard issues"Kevin O'Connor2020-05-211-13/+5
| | | | | | | | | It is believed that the underlying problem was fixed in commit dbf9dd27f and therefore this commit is not necessary. This reverts commit bfdb3f86e9116fc79ce63c231373b084aad11218. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* acpi: find and register virtio-mmio devicesGerd Hoffmann2020-05-152-0/+21
| | | | | | | Seach for virtio-mmio devices in the DSDT table, register the devices found. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
* acpi: skip kbd init if not presentGerd Hoffmann2020-05-151-0/+4
| | | | | | | Don't initialize the ps/2 keyboard in case the device is not listed in the ACPi DSDT table. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>