grub/grub-core/disk
Stefan Fritsch d97d20da82 ahci: Improve error handling
Check the error bits in the interrupt status register. According to the
AHCI 1.2 spec, "Interrupt sources that are disabled (‘0’) are still
reflected in the status registers.", so this should work even though
grub uses polling

This fixes the following problem on a Fujitsu E744 laptop:

Sometimes there is a very long delay (up to several minutes) when
booting from hard disk. It seems accessing the DVD drive (which has no
disk inserted) sometimes fails with some errors, which leads to each
access being stalled until the 20s timeout triggers. This seems to
happen when grub is trying to read filesystem/partition data.

The problem is that the command_issue bit that is checked in the loop is
only reset if the "HBA receives a FIS which clears the BSY, DRQ, and ERR
bits for the command", but the ERR bit is never cleared. Therefore
command_issue is never reset and grub waits for the timeout.

The relevant bit in our case is the Task File Error Status (TFES), which
is equivalent to the ERR bit 0 in tfd. But this patch also checks
the other error bits except for the "Interface non-fatal error status"
bit.

Signed-off-by: Stefan Fritsch <fritsch@genua.de>
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
2020-09-21 12:16:25 -04:00
..
arc Enable mipsel-arc. 2013-04-25 22:42:35 +02:00
efi i386, x86_64, ppc: fix switch fallthrough cases with GCC7 2017-04-04 19:23:55 +03:00
i386/pc biosdisk: add verbose debug logging 2016-08-22 13:02:29 -07:00
ieee1275 ofdisk: add sas disks to the device list 2015-11-12 09:23:02 -02:00
uboot * grub-core/disk/uboot/ubootdisk.c: Include SCSI disks. 2013-11-17 15:38:09 +01:00
xen accept also hdX as alias to native Xen disk name 2015-01-23 19:52:45 +03:00
AFSplitter.c disk/AFsplitter: check argument validity before doing any allocs. 2015-01-24 21:33:30 +01:00
ahci.c ahci: Improve error handling 2020-09-21 12:16:25 -04:00
ata.c grub_ata_setaddress: Check that geometry is sane when using CHS addressing. 2015-01-21 17:42:10 +01:00
cryptodisk.c i386, x86_64, ppc: fix switch fallthrough cases with GCC7 2017-04-04 19:23:55 +03:00
diskfilter.c diskfilter: Make name a const char to fix compilation error. 2015-07-22 20:39:14 +02:00
dmraid_nvidia.c dmraid_nvidia: Set a name to usable value to avoid null dereference. 2015-07-22 01:57:40 +02:00
geli.c disk/geli: Add missing free. 2015-01-24 21:47:51 +01:00
host.c Remove practice of assigning random const pointers to device id. 2013-12-16 14:49:11 +01:00
ldm.c disk/ldm, partmap/msdos.c: fix spelling error 2015-08-22 21:22:41 +02:00
loopback.c * grub-core/disk/loopback.c: Use sequential IDs rather than pointer. 2013-12-15 14:31:21 +01:00
luks.c grub-core/disk/luks.c: fix use after free and memory leaks 2014-11-28 21:12:00 +03:00
lvm.c remove extra newlines in grub_util_* strings 2015-05-13 09:47:17 +03:00
mdraid1x_linux.c Add gcc_struct to all packed structures when compiling with mingw. 2013-12-15 14:14:30 +01:00
mdraid_linux.c cleanup: grub_cpu_to_XXX_compile_time for constants 2014-09-22 20:47:10 +04:00
mdraid_linux_be.c Handle big-endian mdraid. 2012-03-26 16:10:40 +02:00
memdisk.c Remove practice of assigning random const pointers to device id. 2013-12-16 14:49:11 +01:00
pata.c Add PCI command activation to all PCI drivers as required for coreboot 2013-11-26 14:21:11 +01:00
raid5_recover.c * include/grub/diskfilter.h (grub_raid5_recover_func_t): Use proper 2012-06-25 17:36:50 +02:00
raid6_recover.c raid6: Optimize by removing division. 2015-02-26 22:07:22 +01:00
scsi.c disk/scsi: fix use after free 2015-06-20 23:38:18 +03:00
usbms.c cleanup: grub_cpu_to_XXX_compile_time for constants 2014-09-22 20:47:10 +04:00