Пример #1
0
        public virtual StorApiStatus GetSmartPrediction(ref SmartPrediction smartPredict)
        {
            StorApiStatus storApiStatus = StorApiStatusEnum.STOR_NO_ERROR;
            ATACmdInfo    atacmdInfo    = new ATACmdInfo();

            atacmdInfo.datalen      = 0u;
            atacmdInfo.registers[0] = 218;
            atacmdInfo.registers[3] = 79;
            atacmdInfo.registers[4] = 194;
            atacmdInfo.registers[6] = 176;
            atacmdInfo.data         = null;
            storApiStatus           = this.ATACmd(ref atacmdInfo);
            if (storApiStatus == StorApiStatusEnum.STOR_NO_ERROR)
            {
                if (smartPredict == null)
                {
                    smartPredict = new SmartPrediction();
                }
                if (atacmdInfo.registers[3] == 244 && atacmdInfo.registers[4] == 44)
                {
                    smartPredict.predictFailure = true;
                }
                else
                {
                    smartPredict.predictFailure = false;
                }
                smartPredict.cylinderLow  = atacmdInfo.registers[3];
                smartPredict.cylinderHigh = atacmdInfo.registers[4];
            }
            return(storApiStatus);
        }
Пример #2
0
        public virtual StorApiStatus GetErrorRecoveryTime(bool isReadTimer, ref ushort value)
        {
            StorApiStatus storApiStatus = StorApiStatusEnum.STOR_NO_ERROR;
            ATACmdInfo    atacmdInfo    = new ATACmdInfo();

            atacmdInfo.datalen      = 512u;
            atacmdInfo.registers[0] = 214;
            atacmdInfo.registers[1] = 1;
            atacmdInfo.registers[2] = 224;
            atacmdInfo.registers[3] = 79;
            atacmdInfo.registers[4] = 194;
            atacmdInfo.registers[6] = 176;
            COMMAND_ERROR_RECOVERY_CONTROL t = new COMMAND_ERROR_RECOVERY_CONTROL
            {
                Control   = 3,
                Function  = 2,
                Selection = (ushort)(isReadTimer ? 1 : 2),
                Value     = 0
            };

            atacmdInfo.data = Ata.StructToByteArray <COMMAND_ERROR_RECOVERY_CONTROL>(t, 512);
            storApiStatus   = this.ATACmd(ref atacmdInfo);
            if (storApiStatus == StorApiStatusEnum.STOR_NO_ERROR)
            {
                value = (ushort)((int)atacmdInfo.registers[2] << 8 | (int)atacmdInfo.registers[1]);
            }
            return(storApiStatus);
        }
Пример #3
0
        public virtual StorApiStatus GetAC55(byte feat, byte parm1, ref uint value)
        {
            StorApiStatus storApiStatus = StorApiStatusEnum.STOR_NO_ERROR;

            storApiStatus = this.EnableVSC(true);
            if (storApiStatus != StorApiStatusEnum.STOR_NO_ERROR)
            {
                return(storApiStatus);
            }
            ATACmdInfo atacmdInfo = new ATACmdInfo();

            atacmdInfo.datalen      = 512u;
            atacmdInfo.registers[0] = 214;
            atacmdInfo.registers[1] = 1;
            atacmdInfo.registers[2] = 190;
            atacmdInfo.registers[3] = 79;
            atacmdInfo.registers[4] = 194;
            atacmdInfo.registers[6] = 176;
            KEY_SECT t = new KEY_SECT
            {
                ActionCode   = 55,
                FunctionCode = 11,
                Parm1        = 48879,
                Parm2        = 57005,
                Parm3        = (ushort)feat,
                Parm4        = (ushort)parm1
            };

            atacmdInfo.data = Ata.StructToByteArray <KEY_SECT>(t, 512);
            storApiStatus   = this.ATACmd(ref atacmdInfo);
            if (storApiStatus != StorApiStatusEnum.STOR_NO_ERROR)
            {
                this.EnableVSC(false);
                return(storApiStatus);
            }
            atacmdInfo.datalen      = 512u;
            atacmdInfo.registers[0] = 213;
            atacmdInfo.registers[1] = 1;
            atacmdInfo.registers[2] = 191;
            atacmdInfo.registers[3] = 79;
            atacmdInfo.registers[4] = 194;
            atacmdInfo.registers[6] = 176;
            atacmdInfo.data         = new byte[512];
            storApiStatus           = this.ATACmd(ref atacmdInfo);
            if (storApiStatus != StorApiStatusEnum.STOR_NO_ERROR)
            {
                this.EnableVSC(false);
                return(storApiStatus);
            }
            value = Ata.ByteArrayToStruct <FEAT_ID>(atacmdInfo.data).Data;
            this.EnableVSC(false);
            return(storApiStatus);
        }
Пример #4
0
        public virtual StorApiStatus SetSSC(bool enabled)
        {
            StorApiStatus storApiStatus = StorApiStatusEnum.STOR_NO_ERROR;
            ATACmdInfo    atacmdInfo    = new ATACmdInfo();

            atacmdInfo.datalen      = 0u;
            atacmdInfo.registers[0] = (byte)(enabled ? 81 : 209);
            atacmdInfo.registers[3] = 199;
            atacmdInfo.registers[4] = 169;
            atacmdInfo.registers[6] = 143;
            atacmdInfo.data         = null;
            return(this.ATACmd(ref atacmdInfo));
        }
Пример #5
0
        public virtual StorApiStatus EnableSmart()
        {
            StorApiStatus storApiStatus = StorApiStatusEnum.STOR_NO_ERROR;
            ATACmdInfo    atacmdInfo    = new ATACmdInfo();

            atacmdInfo.datalen      = 0u;
            atacmdInfo.registers[0] = 216;
            atacmdInfo.registers[3] = 79;
            atacmdInfo.registers[4] = 194;
            atacmdInfo.registers[6] = 176;
            atacmdInfo.data         = null;
            return(this.ATACmd(ref atacmdInfo));
        }
Пример #6
0
        public virtual StorApiStatus EnableVSC(bool enable)
        {
            StorApiStatus storApiStatus = StorApiStatusEnum.STOR_NO_ERROR;
            ATACmdInfo    atacmdInfo    = new ATACmdInfo();

            atacmdInfo.datalen      = 0u;
            atacmdInfo.registers[0] = (byte)(enable ? 69 : 68);
            atacmdInfo.registers[1] = 0;
            atacmdInfo.registers[2] = 0;
            atacmdInfo.registers[3] = 68;
            atacmdInfo.registers[4] = 87;
            atacmdInfo.registers[6] = 128;
            atacmdInfo.data         = null;
            return(this.ATACmd(ref atacmdInfo));
        }
Пример #7
0
        public virtual StorApiStatus GetIdentity(ref short[] identity)
        {
            StorApiStatus storApiStatus = StorApiStatusEnum.STOR_NO_ERROR;
            ATACmdInfo    atacmdInfo    = new ATACmdInfo();

            atacmdInfo.datalen      = 512u;
            atacmdInfo.registers[6] = 236;
            atacmdInfo.data         = new byte[512];
            storApiStatus           = this.ATACmd(ref atacmdInfo);
            if (storApiStatus == StorApiStatusEnum.STOR_NO_ERROR)
            {
                identity = Ata.ByteArrayToShortArray(atacmdInfo.data);
            }
            return(storApiStatus);
        }
Пример #8
0
        public virtual StorApiStatus SetAC55(byte feat, byte parm1, byte type, byte size, uint value)
        {
            StorApiStatus storApiStatus = StorApiStatusEnum.STOR_NO_ERROR;

            storApiStatus = this.EnableVSC(true);
            if (storApiStatus != StorApiStatusEnum.STOR_NO_ERROR)
            {
                return(storApiStatus);
            }
            ATACmdInfo atacmdInfo = new ATACmdInfo();

            atacmdInfo.datalen      = 512u;
            atacmdInfo.registers[0] = 214;
            atacmdInfo.registers[1] = 1;
            atacmdInfo.registers[2] = 190;
            atacmdInfo.registers[3] = 79;
            atacmdInfo.registers[4] = 194;
            atacmdInfo.registers[6] = 176;
            KEY_SECT t = new KEY_SECT
            {
                ActionCode   = 55,
                FunctionCode = 2,
                Parm1        = 48879,
                Parm2        = 57005,
                Parm3        = (ushort)feat,
                Parm4        = (ushort)parm1,
                Parm5        = (ushort)type,
                Parm6        = (ushort)size,
                Parm7        = (ushort)value
            };

            atacmdInfo.data = Ata.StructToByteArray <KEY_SECT>(t, 512);
            storApiStatus   = this.ATACmd(ref atacmdInfo);
            if (storApiStatus != StorApiStatusEnum.STOR_NO_ERROR)
            {
                this.EnableVSC(false);
                return(storApiStatus);
            }
            this.EnableVSC(false);
            return(storApiStatus);
        }
Пример #9
0
        public override StorApiStatus ATACmd(ref ATACmdInfo ata)
        {
            StorApiStatus storApiStatus = StorApiStatusEnum.STOR_NO_ERROR;
            byte          b             = 0;

            MvApi.MvApi.ATA_REGS ata_REGS = default(MvApi.MvApi.ATA_REGS);
            ata_REGS.Init();
            Array.Copy(ata.registers, ata_REGS.drive_regs, ata_REGS.drive_regs.Length);
            if (ata.datalen > 0u)
            {
                if (ata.data == null || (long)ata.data.Length != (long)((ulong)ata.datalen))
                {
                    return(StorApiStatusEnum.STOR_INVALID_PARAM);
                }
                ata_REGS.buffer_size = (short)ata.datalen;
            }
            lock (MarvellUtil.mvApiLock)
            {
                try
                {
                    b = MvApi.MvApi.MV_PassThrough_ATA_Helper(((MarvellController)this.controller).AdapterId, this.mvid, ref ata_REGS, ref ata.data);
                }
                catch (Exception ex)
                {
                    Logger.Warn("MV_PassThrough_ATA_Helper exception: {0}", new object[]
                    {
                        ex
                    });
                    return(StorApiStatusEnum.STOR_API_ERROR);
                }
            }
            if (b == 0)
            {
                Array.Copy(ata_REGS.drive_regs, ata.registers, ata.registers.Length);
            }
            return(MarvellUtil.ToStorApiStatus(b));
        }
Пример #10
0
 public virtual StorApiStatus ATACmd(ref ATACmdInfo ata)
 {
     return(StorApiStatusEnum.STOR_NOT_SUPPORTED);
 }