aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristopher Lentocha <christopherericlentocha@gmail.com>2025-01-21 11:59:14 -0500
committerGerd Hoffmann <kraxel@redhat.com>2025-01-29 10:49:08 +0100
commit44693a974cd90917f81a7d0310df4b592edd7e09 (patch)
tree116d75a19d6ee8f7808681716d01e0e8cab97ea9
parentdf9dd418b3b0e586cb208125094620fc7f90f23d (diff)
downloadseabios-master.zip
seabios-master.tar.gz
seabios-master.tar.bz2
Fix AHCI Disk Detection when using EDK2 CSMHEADmaster
For whatever reason, when you compile SeaBIOS in Csm16 mode, and use it under EDK2's OvmfPkg, the ATA_CMD_IDENTIFY_PACKET_DEVICE command doesn't work properly, therefore, SeaBIOS detects the "SATA HARDDISK" as a "SATA CDROM" device, in QEMU. Despite the Tianocore developers seem to have removed support for Csm16 some time ago, if we decide to remove Csm16 mode in SeaBIOS in favor of that, at least we have the last commit of Csm16 working properly and not half-broken. In order to fix this bug, I decided to add another command, that command being ATA_CMD_DEVICE_RESET, right before the ATA_CMD_IDENTIFY_PACKET_DEVICE command is called. Signed-off-by: Christopher Lentocha <christopherericlentocha@gmail.com> Message-ID: <eabe9bd2-a7c4-84dd-9a18-7e2e5e1f1247@gmail.com> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
-rw-r--r--src/hw/ahci.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/hw/ahci.c b/src/hw/ahci.c
index 4f0f640..e0864fa 100644
--- a/src/hw/ahci.c
+++ b/src/hw/ahci.c
@@ -484,7 +484,8 @@ static int ahci_port_setup(struct ahci_port_s *port)
/* start device */
cmd |= PORT_CMD_START;
ahci_port_writel(ctrl, pnr, PORT_CMD, cmd);
-
+ sata_prep_simple(&port->cmd->fis, ATA_CMD_DEVICE_RESET);
+ ahci_command(port, 0, 0, buffer, sizeof(buffer));
sata_prep_simple(&port->cmd->fis, ATA_CMD_IDENTIFY_PACKET_DEVICE);
rc = ahci_command(port, 0, 0, buffer, sizeof(buffer));
if (rc == 0) {