From 3cdd558fe48dfaa5d69f5127bcd92cb3663c9689 Mon Sep 17 00:00:00 2001 From: Mario Limonciello Date: Tue, 26 Mar 2019 15:26:36 -0400 Subject: [PATCH] ata: Correct activation functionality No data is actually exchanged in the activation flow. The commands need to be sent in the direction `SG_DXFER_NONE` to avoid ATA errors. --- plugins/ata/fu-ata-device.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/plugins/ata/fu-ata-device.c b/plugins/ata/fu-ata-device.c index 3044ef4d7..b19673217 100644 --- a/plugins/ata/fu-ata-device.c +++ b/plugins/ata/fu-ata-device.c @@ -474,9 +474,9 @@ fu_ata_device_activate (FuDevice *device, GError **error) struct ata_tf tf = { 0x0 }; /* flush caches and make sure drive is ready to activate */ - tf.dev = 0xa0 | ATA_USING_LBA; + tf.dev = ATA_USING_LBA; tf.command = ATA_OP_STANDBY_IMMEDIATE; - if (!fu_ata_device_command (self, &tf, SG_DXFER_TO_DEV, + if (!fu_ata_device_command (self, &tf, SG_DXFER_NONE, 120 * 1000, /* a long time! */ NULL, 0, error)) { g_prefix_error (error, "failed to standby immediate: "); @@ -484,9 +484,10 @@ fu_ata_device_activate (FuDevice *device, GError **error) } /* load the new firmware */ + tf.dev = 0x0a | ATA_USING_LBA; tf.command = ATA_OP_DOWNLOAD_MICROCODE; tf.feat = ATA_SUBCMD_MICROCODE_ACTIVATE; - if (!fu_ata_device_command (self, &tf, SG_DXFER_TO_DEV, + if (!fu_ata_device_command (self, &tf, SG_DXFER_NONE, 120 * 1000, /* a long time! */ NULL, 0, error)) { g_prefix_error (error, "failed to activate firmware: ");