OK a fix has been found.
It seems ahci_command() doesn't correctly handle the situation, where buffer == NULL.
It sets one cmd->prdt[0] entry and the AHCI hardware will probably either try to access
NULL pointer or will just wait indefinitely on data. NULL pointer is used in ATAPI command
cdb_test_unit_ready() and any subsequent command will get stuck.
Not setting any prd entry seems to fix the problem. Patch looks like that (but I don't know
how much clean solution is it).
diff --git a/src/hw/ahci.c b/src/hw/ahci.c
index d45b430..fbe1cec 100644
--- a/src/hw/ahci.c
+++ b/src/hw/ahci.c
@@ -117,7 +117,7 @@ static int ahci_command(struct ahci_port_s *port_gf, int iswrite, int isatapi,
cmd->prdt[0].baseu = 0;
cmd->prdt[0].flags = bsize-1;
- flags = ((1 << 16) | /* one prd entry */
+ flags = (((buffer?1:0) << 16) | /* one prd entry */
(iswrite ? (1 << 6) : 0) |
(isatapi ? (1 << 5) : 0) |
(5 << 0)); /* fis length (dwords) */
If this code is OK I will send the patch in a new thread.
There may be similar problem for PATA/IDE controller, but I didn't test it yet.
Petr
Dne 14. 07. 22 v 6:36 Petr Cvek napsal(a):
> Hello,
>
> I've tried to boot a coreboot supported machine (Kontron 986lcd-m) from CD and it hangs.
>
> The drive is correctly identified (AHCI ATAPI).
>
> Petr
>
> Log follows:
>
> Booting from DVD/CD...
> scsi_is_ready (drive=0x000f5820)
> disk_op d=0x000f5820 lba=0 buf=0x00000000 count=0 cmd=32
> AHCI/2: send cmd ...
> AHCI/2: ... intbits 0x1, status 0x50 ...
> AHCI/2: ... finished, status 0x50, OK
> disk_op d=0x000f5820 lba=17 buf=0x000067a8 count=1 cmd=2
> AHCI/2: send cmd ...
> handle_08
> handle_hwpic1 irq=1
>
> ... repeats ...
>
> handle_08
> handle_hwpic1 irq=1
> WARNING - Timeout at ahci_command:153!
> Boot failed: Could nothandle_08
> handle_hwpic1 irq=1
> read from CDROM (code 0003)
> enter handle_18:
> NULL
> Booting from Hard Disk...
> enter handle_13:
> a=00000201 b=00000000 c=00000001 d=00000080 ds=0000 es=07c0 ss=9000
> si=00000000 di=00000000 bp=00000000 sp=0000ffd6 cs=f000 ip=ca99 f=0202
> disk_op d=0x000f5870 lba=0 buf=0x00007c00 count=1 cmd=2
> AHCI/1: send cmd ...
> AHCI/1: ... intbits 0x1, status 0x50 ...
> AHCI/1: ... finished, status 0x50, OK
> ahci disk read, lba 0, count 1, buf 0x00007c00, rc 0
> Booting from 0000:7c00
>
> ... continues with sata hdd ...
_______________________________________________
SeaBIOS mailing list -- seabios@seabios.org
To unsubscribe send an email to seabios-leave@seabios.org
© 2016 - 2024 Red Hat, Inc.