aboutsummaryrefslogtreecommitdiff
path: root/src/hw
AgeCommit message (Collapse)AuthorFilesLines
2016-04-06virtio: Use threads when scanning for virtio devicesKevin O'Connor2-4/+8
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2016-03-30mpt-scsi: Declare 'int i' outside of for loop for older compilersKevin O'Connor1-1/+2
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2016-03-29Support for booting from LSI Logic LSI53C1030, SAS1068, SAS1068eDon Slutz2-0/+317
Also known as Fusion MPT disk; this controller model is supported by VirtualBox and VMware, and QEMU support patches have been posted. Signed-off-by: Don Slutz <Don.Slutz@Gmail.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2016-03-21sdcard: skip detection of PCI sdhci controllers if etc/sdcard usedMatt DeVillier1-0/+5
Some BayTrail ChromeOS devices have the eMMC controller hidden (thus requiring the use of etc/sdcard), while others do not, making it problematic to have a single payload which serves all devices properly. Therefore, if the CBFS contains etc/sdcard entries, skip detection of any visible PCI sdhci controllers in order to avoid duplicate entries in the boot menu. Signed-off-by: Matt DeVillier <matt.devillier@gmail.com> Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2016-02-29ahci: set transfer mode according to the capabilities of connected driveGerd Hoffmann2-0/+62
Use case: cf cards behind sata-ide bridge, which might not support the default transfer mode. Based on a patch by Werner Zeh <werner.zeh@siemens.com>, with some minor tweaks applied. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2016-02-05tpm: Implement tpm20_set_timeoutsStefan Berger1-0/+17
The TIS timeouts for TPM 2 are different than for TPM 1.2. Also the timeouts indicating a failed TPM 2 command are different. Further, the command durations and timeouts cannot be read from the device. We take the command timeout values for short, medium, and long running commands from table 15 of the following specification: TCG PC Client Platform TPM Profile (PTP) Specification http://www.trustedcomputinggroup.org/resources/pc_client_platform_tpm_profile_ptp_specification The values should work for all physical TPMs. The tricky thing with virtualized environments is that the values may need to be longer for a system where a vTPM cannot get sufficient cycles. So a future patch _may_ need to multiply those values here with some factor. Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
2016-02-05tpm: Extend TPM TIS with TPM 2 support.Stefan Berger2-5/+42
Extend the probing of the interface with TPM 2 specifics. Use the new interface ID register of the TIS to check whether a TPM 1.2 or a TPM 2 is underneath. We select the TIS if possible and lock it so we can issue commands during S3 for example and prevent the OS from changing to CRB type of interface. The register is described in table 13 here: http://www.trustedcomputinggroup.org/resources/pc_client_platform_tpm_profile_ptp_specification Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
2016-02-03scsi: Always use MAXDESCSIZE when building drive descriptionKevin O'Connor4-4/+5
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2016-02-03pci: Split low-level pci code from higher-level 'struct pci_device' codeKevin O'Connor19-305/+323
Split pci.c into pci.c and pcidevice.c. The low-level code that interacts directly with the PCI devices remains in pci.c, while functions dealing with the higher level pci_device cache move to pcidevice.c. Only pci.c is needed in 16bit mode. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2016-02-03pci: Move code in pci.c that is specific to pciinit.c to pciinit.cKevin O'Connor2-41/+0
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2016-02-03pci: Implement '%pP' printf handler for 'struct pci_device' pointersKevin O'Connor13-85/+40
Handle '%pP' format descriptions as a pointer to a 'struct pci_device' and display it in bus:device.function (%02x:%02x.%x) format. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2016-02-02pci: Consistently set pci->have_drivers for devices with internal driversKevin O'Connor2-1/+3
Set the pci->have_drivers flag for any device that calls pci_enable_x() to ensure that the flag is consistently set on any device with an internal driver. Setting this flag prevents an option rom on the device from being executed. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2016-02-02virtio: Convert to new PCI BAR helper functionsKevin O'Connor2-30/+38
Use the pci_enable_x() functions. This patch also converts cap->addr from a 'u32' to a union storing a 'u32' or a 'void*'. This makes it more clear when the address is a virtual memory address. The virtio controller code will now explicitly set PCI_COMMAND_MEMORY and/or PCI_COMMAND_IO instead of assuming it has already been enabled. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2016-02-02xhci: Convert to new PCI BAR helper functionsKevin O'Connor1-13/+14
Use the pci_enable_x() functions. The xhci controller code will now explicitly set PCI_COMMAND_MEMORY instead of assuming it has already been enabled. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2016-02-02uhci: Convert to new PCI BAR helper functionsKevin O'Connor1-7/+9
Use the pci_enable_x() functions. The uhci controller code will now explicitly set PCI_COMMAND_IO instead of assuming it has already been enabled. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2016-02-02ohci: Convert to new PCI BAR helper functionsKevin O'Connor1-9/+8
Use the pci_enable_x() functions. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2016-02-02ehci: Convert to new PCI BAR helper functionsKevin O'Connor1-6/+6
Use the pci_enable_x() functions. The ehci controller code will now explicitly set PCI_COMMAND_MEMORY instead of assuming it has already been enabled. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2016-02-02sdcard: Convert to new PCI BAR helper functionsKevin O'Connor1-8/+6
Use the pci_enable_x() functions. After this change, the sdcard driver will no longer enable PCI_COMMAND_IO or PCI_COMMAND_MASTER accesses, as the sdcard driver doesn't actually use IO BARs or implement DMA. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2016-02-02pvscsi: Convert to new PCI BAR helper functionsKevin O'Connor1-9/+8
Use the pci_enable_x() functions. The pvscsi controller code will now explicitly set PCI_COMMAND_MEMORY instead of assuming it has already been enabled. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2016-02-02megasas: Convert to new PCI BAR helper functionsKevin O'Connor1-10/+8
Use the pci_enable_x() functions. After this change, the megasas driver will no longer enable PCI_COMMAND_MEMORY accesses, as the megasas driver doesn't actually map any BARs as memory. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2016-02-02lsi-scsi: Convert to new PCI BAR helper functionsKevin O'Connor1-7/+6
Use the pci_enable_x() functions. The lsi-scsi controller code will now explicitly set PCI_COMMAND_IO instead of assuming it has already been enabled. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2016-02-02esp-scsi: Convert to new PCI BAR helper functionsKevin O'Connor1-7/+6
Use the pci_enable_x() functions. The esp-scsi controller code will now explicitly set PCI_COMMAND_IO instead of assuming it has already been enabled. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2016-02-02ata: Convert to new PCI BAR helper functionsKevin O'Connor1-13/+12
Use the pci_enable_x() functions. The ATA controller code will now explicitly set PCI_COMMAND_IO instead of assuming it has already been enabled. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2016-02-02ahci: Convert to new PCI BAR helper functionsKevin O'Connor2-21/+17
Use the pci_enable_x() functions. This patch also converts cntl->iobase from a 'u32' to a 'void*' so that it is clear that the address is a virtual memory address. After this change, the AHCI driver will no longer enable PCI_COMMAND_IO io accesses, as the AHCI driver doesn't actually attempt IO accesses to the device. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2016-02-02pci: Add helper functions for internal driver BAR handlingKevin O'Connor2-0/+61
Add functions to verify and obtain PCI BARs (Base Address Registers). These new functions check that the requested BAR is of the right type and appears valid. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2016-02-02usb: Eliminate USB controller setup threadKevin O'Connor5-15/+5
There are no longer any sleep or yield calls during the usb controller device scans, so there is no need to run these device scans in a separate thread. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2016-02-02ehci: Only delay UHCI/OHCI port scan until after EHCI setup completesKevin O'Connor4-3/+15
EHCI controller setup needs to occur prior to checking any UHCI or OHCI ports to ensure a high speed device is not mistakenly configured on a full speed "companion" controller. However, only the UHCI/OHCI port scan needs to be delayed, not the full UHCI/OHCI controller init. This change moves back the ehci controller setup check until port scan in UHCI/OHCI. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2016-01-07usb: Remove usbdev->slotid fieldKevin O'Connor2-3/+4
The usbdev->slotid field is xhci specific and on xhci it is always reachable from usbdev->defpipe->slotid. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2016-01-05tpm: Don't use 16bit BIOS return codes in tpmhw_* functionsKevin O'Connor2-11/+11
Don't use the return codes from the 16bit BIOS spec in the internal tpmhw functions. Only the 16bit BIOS interface code should need to handle the details of that spec. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2016-01-05tpm: Move TPM hardware functions from tcgbios.c to hw/tpm_drivers.cKevin O'Connor2-22/+97
Move the hardware interface functions (tpmhw_probe, tpmhw_is_present, tpmhw_transmit, and tpmhw_set_timeouts) to tpm_drivers.c code, and only export those functions. This simplifies the hardware interface. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2015-12-28block: Report drive->sectors using "%u" instead of "%d"Kevin O'Connor1-1/+1
The sector count is a 64bit number that is often reported as a 32bit number (due to limitations in dprintf). Consistently use "%u" reporting to avoid confusing negative numbers. Reported-by: Tobias Diedrich <tobiasdiedrich@gmail.com> Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2015-12-28scsi: Do not call printf() from scsi_is_ready()Kevin O'Connor1-1/+1
The scsi_is_ready() function may be called from a thread, and it is not valid to call printf() from a thread. Convert printf() to dprintf() to avoid this possibility. This does mean that cdrom detection (from cdrom_boot() ) may not give notification of slow cdrom drives to a user. However, the extra medium detection time is unlikely to be large anyway. Reported-by: Tobias Diedrich <tobiasdiedrich@gmail.com> Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2015-12-20xhci: Disable slot on failed set_address commandKevin O'Connor1-3/+8
If the set_address command fails, attempt to free up the slot resource associated with the attempt. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2015-12-20xhci: Improve port status change debuggingKevin O'Connor1-3/+9
Report the port state on a port status change notification. Clear the change bits so further change notifications are delivered. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2015-12-20xhci: Wait for port enable even for USB3 devicesKevin O'Connor1-22/+21
Some USB3 controllers (and/or devices) need additional time after the device is detected to place the port in an enabled state. Wait for the controller to report enabled before proceeding. This fixes several reports of devices that showed a "stall" error (cc 4) during set address. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2015-11-22tpm: Set timeouts and durations to microsecond valuesStefan Berger2-20/+34
Fix the timeouts and durations -- they are provided in microseconds. Adapt the TPM driver for it. Get TPM specific timeout and duration values earlier from the device. Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
2015-11-22tpm: Drop code using the TPM for sha1Stefan Berger2-4/+0
Drop the code that is using the TPM for sha1 calculations. Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
2015-11-19tpm: Move standard definitions from tcgbios.h to new file std/tcg.hKevin O'Connor1-2/+2
Tested-by: Stefan Berger <stefanb@us.ibm.com> Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2015-11-19tpm: fix compiler warning with older gcc versionsStefan Berger1-1/+1
gcc v3.4 shows a warning due to "comparison is always false due to limited range of data type". This patch fixes it. Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
2015-11-19sdcard: Enable extra debugging on sdcard_waitw() timeoutKevin O'Connor1-0/+1
On a timeout, report what register failed to update. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2015-11-19sdcard: fix typo causing 32bit write to 16bit block_size fieldKevin O'Connor1-1/+1
The block_size field is 16bits and only 16bit writes should be used with it. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2015-11-19sdcard: Only enable error_irq_enable for bits defined in SDHCI v1 specKevin O'Connor1-1/+1
The SDHCI v1 spec only defines the first 9 error_irq_enable bits and reserves other bits in the field. Don't enable the 10th bit (which was defined in the v2 spec) as it's not needed anyway. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2015-11-19xhci: Check for device disconnects during USB2 reset pollingKevin O'Connor1-5/+19
Some XHCI controllers register super-speed devices on high-speed ports and then disconnect them when the super-speed detection completes. Make sure to recognize these disconnect events during the reset process. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2015-11-17usb: Allow configuration of sigatt time (in etc/usb-time-sigatt)Kevin O'Connor1-1/+5
Several users have reported devices that take more than 100ms to announce their presence on a USB port. Allow the sigatt timeout to be specified at runtime as a way to extend the default timeout. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2015-11-04PCI SDHCI driver: Fix base addressKyösti Mälkki1-0/+1
MMIO register space was off by 4 bytes, bottom bits of PCI BAR registers are not part of the address. Test boot on real hardware: PCI device 00:14.7 (vd=3D1022:7813 c=3D0805) Searching bootorder for: /pci@i0cf8/*@14,7 sdhci@0xfeb25500 ver=3D1001 cap=3D31fe3fb2 2570 sdcard_set_frequency 63 400 8000 sdcard_pio command stop (code=3D1) sdcard_set_frequency 63 25000 200 Found sdcard at 0xfeb25500: SD card SD01G 982MiB Registering bootable: SD card SD01G 982MiB (type:2 prio:103 data:f46e0) Signed-off-by: Kyösti Mälkki <kyosti.malkki@gmail.com>
2015-10-24virtio: Minor - replace tab characters with spaceKevin O'Connor1-2/+2
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2015-10-15stacks: Use macro wrappers for call32() and stack_hop_back()Kevin O'Connor1-3/+2
The C code only uses _cfuncX_ prefixes for parameters to the call32(), stack_hop_back(), and call32_params() functions. It's simpler to use macro wrappers around those functions which provide the required prefix. This also changes the parameter order of stack_hop() and stack_hop_back() to use the more natural (func, params) ordering. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2015-10-15virtio: Move standard definitions from virtio-ring.h to standard headersKevin O'Connor2-8/+1
Move PAGE_SHIFT / virt_to_phys() to memmap.h and smp_[rw]mb() to x86.h. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2015-10-15virtio: Simplify vring alignment codeKevin O'Connor1-20/+9
Don't do phys_to_virt(virt_to_phys(vaddr)) for page alignment - page alignment can be determined directly from the virtual address. Use the ALIGN() macro to make the code more readable. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2015-10-15e820: Rename memmap.c to e820map.c and use consistent "e820_" prefixKevin O'Connor1-2/+3
Rename memmap.c to e820map.c as the code in that file only deals with maintaining the e820 map. Move all the e820 definitions to new file e820map.h and use a consistent "e820_" prefix on all exported functions. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>