fix: READ_CAPACITY command for 12 bytes CDB SCSI device.
[lunaix-os.git] / lunaix-os / hal / ahci / ata.c
index a77e03b4a87535ee0929911e2a57a5b7485a8a18..118bf1196a8697b6e4a001f66c2196d9e900a3d3 100644 (file)
@@ -9,8 +9,9 @@ void
 sata_read_error(struct hba_port* port)
 {
     uint32_t tfd = port->regs[HBA_RPxTFD];
-    port->device->last_error = (tfd >> 8) & 0xff;
-    port->device->last_status = tfd & 0xff;
+    port->device->last_result.sense_key = (tfd & 0xf000) >> 12;
+    port->device->last_result.error = (tfd & 0x0f00) >> 8;
+    port->device->last_result.status = tfd & 0x00ff;
 }
 
 int