When binding AHCI controller to virtual machine, the attached ATA device cannot be recognized for the following reason:
The first Identify PACKET CMD will be failed without dobut which will lead PORT_IRQ_TF_ERR be set in PxIS due to ERR bit set to 1 in D2H Register FIS(PxTFD.STS.ERR=1). In this case, the first CMD will be timeout for seabios only polling PORT_IRQ_D2H_REG_FIS & PORT_IRQ_PIOS_FIS before triggering error handling which leads AHCI controller is an error state, then the second IDENTIFY CMD cannot be issued by AHCI controller, no ATA device will be detected.
In AHCI spec HBA Port State Machine section(5.3.8.1 and 5.3.16.5), we can see this sequence: RegFIS:Entry --> ERR:FatalTaskfile (PxTFD.STS.ERR=1) --> ERR:WaitForClear, no entry for PORT_IRQ_D2H_REG_FIS/PORT_IRQ_PIOS_FIS to be set at this time.
May be we can also add PORT_IRQ_TF_ERR bit check when polling command completion status?
fail log:
02.386: |bffa6000| AHCI/1: link up
02.387: |bffa6000| AHCI/1: send cmd ...
02.387: |bffa7000| phys_free bffa9c00 (detail=0xbffaa320)
02.396: |bffa7000| phys_free bffaa200 (detail=0xbffaa1d0)
02.396: |bffa7000| phys_free bffaa000 (detail=0xbffaa1a0)
02.396: |bffa7000| phys_free bffaa380 (detail=0xbffaa350)
02.400: \bffa7000/ End thread
02.401: phys_free bffa7000 (detail=0xbffaa170)
34.391: |bffa6000| WARNING - Timeout at ahci_command:153!
34.392: |bffa6000| AHCI/1: send cmd ...
66.397: |bffa6000| WARNING - Timeout at ahci_command:153!
Signed-off-by: zhaoxin\runaguooc <RunaGuo-oc(a)zhaoxin.com>
---
src/hw/ahci.c | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/src/hw/ahci.c b/src/hw/ahci.c index d45b430..bab5c35 100644
--- a/src/hw/ahci.c
+++ b/src/hw/ahci.c
@@ -104,7 +104,7 @@ static void ahci_port_writel(struct ahci_ctrl_s *ctrl, u32 pnr, u32 reg, u32 val static int ahci_command(struct ahci_port_s *port_gf, int iswrite, int isatapi,
void *buffer, u32 bsize) {
- u32 val, status, success, flags, intbits, error;
+ u32 val, status, success, flags, intbits, error, tf;
struct ahci_ctrl_s *ctrl = port_gf->ctrl;
struct ahci_cmd_s *cmd = port_gf->cmd;
struct ahci_fis_s *fis = port_gf->fis; @@ -148,6 +148,14 @@ static int ahci_command(struct ahci_port_s *port_gf, int iswrite, int isatapi,
error = GET_LOWFLAT(fis->rfis[3]);
break;
}
+
+ if(intbits & PORT_IRQ_TF_ERR){
+ tf = ahci_port_readl(ctrl,pnr,PORT_TFDATA);
+ status = tf & 0xff;
+ error = tf & 0xff00;
+ break;
+ }
+
}
if (timer_check(end)) {
warn_timeout();
--
2.17.1
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(a)zhaoxin.com>
---
src/hw/usb-xhci.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/hw/usb-xhci.c b/src/hw/usb-xhci.c
index 08d1e32..21d091f 100644
--- a/src/hw/usb-xhci.c
+++ b/src/hw/usb-xhci.c
@@ -467,9 +467,9 @@ configure_xhci(void *data)
dprintf(3, "%s: resetting\n", __func__);
writel(&xhci->op->usbcmd, XHCI_CMD_HCRST);
- if (wait_bit(&xhci->op->usbcmd, XHCI_CMD_HCRST, 0, 100) != 0)
+ if (wait_bit(&xhci->op->usbcmd, XHCI_CMD_HCRST, 0, 1000) != 0)
goto fail;
- if (wait_bit(&xhci->op->usbsts, XHCI_STS_CNR, 0, 100) != 0)
+ if (wait_bit(&xhci->op->usbsts, XHCI_STS_CNR, 0, 1000) != 0)
goto fail;
writel(&xhci->op->config, xhci->slots);
--
2.7.4
This patch series make seabios linkable with lld.
This is beneficial for FreeBSD ports as well
https://svnweb.freebsd.org/ports/head/misc/seabios/Makefile
as they can drop an LLD_UNSAFE
As a maintainer of lld ELF, I have triaged numerous pieces of software.
seabios is the only one making use of
This drops the only instance https://sourceware.org/bugzilla/show_bug.cgi?id=12726
1, 2, 3 and 4 are really independent and can be applied in arbitrary order.
5 depends on 4. I originally combined 4 and 5 and that was why I don't think a patch series made sense.
Fangrui Song (5):
romlayout.S: Add missing SHF_ALLOC flag to .fixedaddr.\addr
Make rom16.o linkable with lld
Makefile: Change ET_EXEC to ET_REL so that lld can link bios.bin.elf
romlayout32flag.lds: Use `. +=` instead of `. =`
test-build.sh: Delete unneeded LD capability test
Makefile | 4 ++++
scripts/layoutrom.py | 13 ++++++++++---
scripts/test-build.sh | 42 +-----------------------------------------
src/romlayout.S | 2 +-
4 files changed, 16 insertions(+), 45 deletions(-)
--
2.26.0.292.g33ef6b2f38-goog
The 1.14.0 version of SeaBIOS has now been released. For more
information on the release, please see:
http://seabios.org/Releases
New in this release:
* New virtio MMIO support. Support for finding virtio MMIO devices via
an ACPI DSDT parser. Support for handling a large number of virtio
devices.
* Improved handling of USB keyboards with non-standard packet size.
* Improved KVM CPU frequency detection.
* Support for PCI mmconfig support on QEMU.
* Several bug fixes and code cleanups.
For information on obtaining SeaBIOS, please see:
http://seabios.org/Download
===== git shortlog -n rel-1.13.0..rel-1.14.0 =====
Gerd Hoffmann (25):
boot: cache HALT priority
virtio-scsi: skip initializing non-bootable devices
nvme: skip initializing non-bootable devices
timer: add tsctimer_setfreq()
kvm: detect unconditionally
kvm: add support for reading tsc frequency via cpuid.
kvm: add support for reading tsc frequency from kvmclock
sercon: vbe modeset is int 10h function 4f02 not 4f00
pci: factor out ioconfig_cmd()
pci: add mmconfig support
qemu: factor out qemu_cfg_detect()
qemu: rework e820 detection
qemu: check rtc presence before reading cpu count from cmos
virtio-mmio: device probing and initialization.
virtio-mmio: add support to vp_*() functions
virtio-mmio: add support for scsi devices.
virtio-mmio: add support for block devices.
virtio-mmio: print device type
acpi: add xsdt support
acpi: add dsdt parser
acpi: skip kbd init if not present
acpi: find and register virtio-mmio devices
rewrap Makefile lines.
pci: fix mmconfig support
vga: fix cirrus bios
Kevin O'Connor (6):
usb-hid: Improve max packet size checking
Revert "ps2port: adjust init routine to fix PS/2 keyboard issues"
boot: Fixup check for only one item in boot list
vgabios: Fix preserve memory flag in handle_1000
ldnoexec: Add script to remove ET_EXEC flag from intermediate build objects
docs: Note v1.14.0 release
Paul Menzel (5):
std/tcg: Replace zero-length array with flexible-array member
boot: Extend `etc/show-boot-menu` to configure skipping boot menu with only one device
boot: Log, if boot menu is skipped
cdrom: Demote `scsi_is_ready` return print to debug level
nvme: Increase `nvme_cmd_readwrite()` message log level from 3 to 5
Matt DeVillier (4):
hw/usb-hid: Don't abort if setting key repeat rate fails
Skip boot menu and timeout with only one boot device
ps2port: adjust init routine to fix PS/2 keyboard issues
boot: Fix logic for boot menu display
Stefan Berger (3):
tcgbios: Only write logs for PCRs that are in active PCR banks
tcgbios: Fix the vendorInfoSize to be of type u8
tcgbios: Add support for SHA3 type of algorithms
Alexey Kirillov (2):
boot: Detect strict boot order (HALT record) in function
virtio: Do not init non-bootable devices
Christian Ehrhardt (1):
build: use -fcf-protection=none when available
Jason Andryuk (1):
serialio: Preserve Xen DebugOutputPort
Roman Bolshakov (1):
timer: Handle decrements of PIT counter
Stefan Reiter (1):
virtio-scsi: fix boot prio detection by using correct lun