From 3fafaa8921864c1baa613c4849a49aa6354e209d Mon Sep 17 00:00:00 2001 From: Natalia Portillo Date: Thu, 29 Jul 2021 00:56:12 +0100 Subject: [PATCH] Fix 48-bit ATA commands. Fixes #532 --- ATA/Registers.cs | 18 ++++++++++++------ SCSI/Sense.cs | 17 ++++++++++------- 2 files changed, 22 insertions(+), 13 deletions(-) diff --git a/ATA/Registers.cs b/ATA/Registers.cs index e03539bde..5dd75ed78 100644 --- a/ATA/Registers.cs +++ b/ATA/Registers.cs @@ -63,9 +63,12 @@ namespace Aaru.Decoders.ATA { public ushort Feature; public ushort SectorCount; - public ushort LbaLow; - public ushort LbaMid; - public ushort LbaHigh; + public byte LbaLowPrevious; + public byte LbaLowCurrent; + public byte LbaMidPrevious; + public byte LbaMidCurrent; + public byte LbaHighPrevious; + public byte LbaHighCurrent; public byte DeviceHead; public byte Command; } @@ -100,9 +103,12 @@ namespace Aaru.Decoders.ATA public byte Status; public byte Error; public ushort SectorCount; - public ushort LbaLow; - public ushort LbaMid; - public ushort LbaHigh; + public byte LbaLowPrevious; + public byte LbaLowCurrent; + public byte LbaMidPrevious; + public byte LbaMidCurrent; + public byte LbaHighPrevious; + public byte LbaHighCurrent; public byte DeviceHead; } } \ No newline at end of file diff --git a/SCSI/Sense.cs b/SCSI/Sense.cs index ba784b210..5848a3dc5 100644 --- a/SCSI/Sense.cs +++ b/SCSI/Sense.cs @@ -568,13 +568,16 @@ namespace Aaru.Decoders.SCSI public static AtaErrorRegistersLba48 DecodeDescriptor09(byte[] descriptor) => new AtaErrorRegistersLba48 { - Error = descriptor[3], - SectorCount = (ushort)((descriptor[4] << 8) + descriptor[5]), - LbaLow = (ushort)((descriptor[6] << 8) + descriptor[7]), - LbaMid = (ushort)((descriptor[8] << 8) + descriptor[9]), - LbaHigh = (ushort)((descriptor[10] << 8) + descriptor[11]), - DeviceHead = descriptor[12], - Status = descriptor[13] + Error = descriptor[3], + SectorCount = (ushort)((descriptor[4] << 8) + descriptor[5]), + LbaLowCurrent = descriptor[6], + LbaLowPrevious = descriptor[7], + LbaMidCurrent = descriptor[8], + LbaMidPrevious = descriptor[9], + LbaHighCurrent = descriptor[10], + LbaHighPrevious = descriptor[11], + DeviceHead = descriptor[12], + Status = descriptor[13] }; public static void DecodeDescriptor0B(byte[] descriptor) => throw new NotImplementedException("Check SBC-3");