13#define __STDC_FORMAT_MACROS 1
27 switch (driveRecordingType & 0x3) {
46 switch (formFactor & 0xF) {
56 return "< 1.8 inches";
70 for (uint8_t hd = 0; hd < (uint8_t)numHeads; hd++) {
71 jout(
"\t\t%s %" PRIu8
": %" PRIu64
"\n", desc, hd, paramArray[hd]);
85 const int64_t* paramArray,
const uint64_t numHeads) {
86 for (uint8_t hd = 0; hd < (uint8_t)numHeads; hd++) {
87 snprintf(
buffer,
sizeof(
buffer),
"%s_%" PRIu8, desc, hd);
88 jref[
buffer] = paramArray[hd];
99 const uint64_t even_bytes = 0x0000FFFF0000FFFF;
100 const uint64_t odd_bytes = 0xFFFF0000FFFF0000;
101 return ((param & even_bytes) << 16) | ((param & odd_bytes) >> 16);
114 size_t str_size =
sizeof(param) /
sizeof(
buffer[0]);
116 for (uint8_t i = 0; i < str_size; i++) {
117 val = (param >> ((str_size - i - 1) * 8)) & 0xFF;
118 if (32 <= val && val < 127) {
153 jinf(
"FARM support was not tested on Big Endian platforms by the developers.\n"
154 "Please report success/failure to " PACKAGE_BUGREPORT
"\n\n");
163 char worldWideName[64];
176 modelNumber[0] =
'\0';
187 jout(
"Seagate Field Access Reliability Metrics log (FARM) (GP Log 0xa6)\n");
189 jout(
"\tFARM Log Page 0: Log Header\n");
199 jout(
"\tFARM Log Page 1: Drive Information\n");
200 jout(
"\t\tSerial Number: %s\n", serialNumber);
201 jout(
"\t\tWorld Wide Name: %s\n", worldWideName);
202 jout(
"\t\tDevice Interface: %s\n", deviceInterface);
208 jout(
"\t\tDevice Form Factor: %s\n", formFactor);
210 jout(
"\t\tFirmware Rev: %s\n", firmwareRev);
223 jout(
"\t\tModel Number: %s\n", modelNumber);
224 jout(
"\t\tDrive Recording Type: %s\n", recordingType);
226 jout(
"\t\tAssembly Date (YYWW): %s\n", dateOfAssembly);
230 jout(
"\tFARM Log Page 2: Workload Statistics\n");
238 jout(
"\t\tNumber of dither events during current power cycle: %" PRIu64
"\n", farmLog.
workload.
dither);
239 jout(
"\t\tNumber of times dither was held off during random workloads: %" PRIu64
"\n", farmLog.
workload.
ditherRandom);
251 jout(
"\tFARM Log Page 3: Error Statistics\n");
273 for (uint8_t i = flash_led_size; i > 0; i--) {
275 jout(
"\t\tFlash LED Event %" PRIuMAX
":\n",
static_cast<uintmax_t
>(flash_led_size - i));
278 jout(
"\t\t\tPower Cycle Event %" PRIuMAX
": %" PRIx64
"\n",
static_cast<uintmax_t
>(flash_led_size - i), farmLog.
error.
powerCycleFlashLED[index]);
285 jout(
"\t\tCum Lifetime Unrecoverable by head %" PRIu8
":\n", hd);
291 jout(
"\tFARM Log Page 4: Environment Statistics\n");
321 jout(
"\tFARM Log Page 5: Reliability Statistics\n");
347 json::ref jref0 = jref[
"page_0_log_header"];
358 json::ref jref1 = jref[
"page_1_drive_information"];
359 jref1[
"serial_number"] = serialNumber;
360 jref1[
"world_wide_name"] = worldWideName;
361 jref1[
"device_interface"] = deviceInterface;
367 jref1[
"form_factor"] = formFactor;
369 jref1[
"firmware_rev"] = firmwareRev;
379 jref1[
"drive_recording_type"] = recordingType;
381 jref1[
"date_of_assembly"] = dateOfAssembly;
385 json::ref jref2 = jref[
"page_2_workload_statistics"];
406 json::ref jref3 = jref[
"page_3_error_statistics"];
429 for (uint8_t i = flash_led_size; i > 0; i--) {
431 snprintf(
buffer,
sizeof(
buffer),
"flash_led_event_%i", index);
440 snprintf(
buffer,
sizeof(
buffer),
"cum_lifetime_unrecoverable_by_head_%i", hd);
447 json::ref jref4 = jref[
"page_4_environment_statistics"];
477 json::ref jref5 = jref[
"page_5_reliability_statistics"];
512 jinf(
"FARM support was not tested on Big Endian platforms by the developers.\n"
513 "Please report success/failure to " PACKAGE_BUGREPORT
"\n\n");
520 char worldWideName[64];
544 jout(
"\nSeagate Field Access Reliability Metrics log (FARM) (SCSI Log page 0x3d, sub-page 0x3)\n");
547 jout(
"\tFARM Log Parameter 0: Log Header\n");
555 jout(
"\tFARM Log Parameter 1: Drive Information\n");
556 jout(
"\t\tSerial Number: %s\n", serialNumber);
557 jout(
"\t\tWorld Wide Name: %s\n", worldWideName);
558 jout(
"\t\tFirmware Rev: %s\n", firmwareRev);
559 jout(
"\t\tDevice Interface: %s\n", deviceInterface);
565 jout(
"\t\tDevice form factor: %s\n", formFactor);
570 jout(
"\t\tDate of Assembled: %s\n", dateOfAssembly);
573 jout(
"\tFARM Log Parameter 2: Workload Statistics\n");
591 jout(
"\tFARM Log Parameter 3: Error Statistics\n");
595 jout(
"\t\tFRU code if smart trip from most recent SMART Frame: %" PRIu64
"\n", farmLog.
error.
tripCode);
606 jout(
"\tFARM Log Parameter 4: Environment Statistics\n");
622 jout(
"\tFARM Log Parameter 5: Reliability Statistics\n");
626 jout(
"\tFARM Log Parameter 6: Drive Information Continued\n");
628 jout(
"\t\tProduct ID: %s\n", productID);
629 jout(
"\t\tDrive Recording Type: %s\n", recordingType);
637 jout(
"\tFARM Log Parameter 7: Environment Information Continued\n");
646 jout(
"\tFARM Log \"By Head\" Information\n");
659 for (uint8_t i = 0; i <
sizeof(actrefs) /
sizeof(actrefs[0]); i++) {
660 jout(
"\tFARM Log Actuator Information 0x%" PRIx64
"\n", actrefs[i].actuatorID);
661 jout(
"\t\tHead Load Events: %" PRIu64
"\n", actrefs[i].headLoadEvents);
662 jout(
"\t\tTimeStamp of last IDD test: %" PRIu64
"\n", actrefs[i].timelastIDDTest);
663 jout(
"\t\tSub-Command of Last IDD Test: %" PRIu64
"\n", actrefs[i].subcommandlastIDDTest);
664 jout(
"\t\tNumber of Reallocated Sector Reclamations: %" PRIu64
"\n", actrefs[i].numberGListReclam);
665 jout(
"\t\tServo Status: %" PRIu64
"\n", actrefs[i].servoStatus);
666 jout(
"\t\tNumber of Slipped Sectors Before IDD Scan: %" PRIu64
"\n", actrefs[i].numberSlippedSectorsBeforeIDD);
667 jout(
"\t\tNumber of Slipped Sectors Before IDD Scan: %" PRIu64
"\n", actrefs[i].numberSlippedSectorsAfterIDD);
668 jout(
"\t\tNumber of Resident Reallocated Sectors Before IDD Scan: %" PRIu64
"\n", actrefs[i].numberResidentReallocatedBeforeIDD);
669 jout(
"\t\tNumber of Resident Reallocated Sectors Before IDD Scan: %" PRIu64
"\n", actrefs[i].numberResidentReallocatedAfterIDD);
670 jout(
"\t\tSuccessfully Scrubbed Sectors Before IDD Scan: %" PRIu64
"\n", actrefs[i].numberScrubbedSectorsBeforeIDD);
671 jout(
"\t\tSuccessfully Scrubbed Sectors Before IDD Scan: %" PRIu64
"\n", actrefs[i].numberScrubbedSectorsAfterIDD);
672 jout(
"\t\tNumber of DOS Scans Performed: %" PRIu64
"\n", actrefs[i].dosScansPerformed);
673 jout(
"\t\tNumber of LBAs Corrected by ISP: %" PRIu64
"\n", actrefs[i].lbasCorrectedISP);
674 jout(
"\t\tNumber of Valid Parity Sectors: %" PRIu64
"\n", actrefs[i].numberValidParitySectors);
675 jout(
"\t\tNumber of LBAs Corrected by Parity Sector: %" PRIu64
"\n", actrefs[i].numberLBACorrectedParitySector);
680 size_t flash_led_size;
684 for (uint8_t i = 0; i <
sizeof(fledrefs) /
sizeof(fledrefs[0]); i++) {
685 jout(
"\tFARM Log Actuator 0x%" PRIx64
" Flash LED Information\n", fledrefs[i].actuatorID);
686 jout(
"\t\tTotal Flash LED Events: %" PRIu64
"\n", fledrefs[i].totalFlashLED);
687 jout(
"\t\tIndex of Last Flash LED: %" PRIu64
"\n", fledrefs[i].indexFlashLED);
689 flash_led_size =
sizeof(fledrefs[i].
flashLEDArray) /
sizeof(fledrefs[i].flashLEDArray[0]);
690 for (uint8_t j = flash_led_size; j > 0; j--) {
691 index = (j - fledrefs[i].
indexFlashLED + flash_led_size) % flash_led_size;
692 jout(
"\t\tEvent %" PRIuMAX
":\n",
static_cast<uintmax_t
>(flash_led_size - j));
693 jout(
"\t\t\tEvent Information: 0x%016" PRIx64
"\n", fledrefs[i].flashLEDArray[index]);
694 jout(
"\t\t\tTimestamp of Event %" PRIuMAX
" (hours): %" PRIu64
"\n",
static_cast<uintmax_t
>(flash_led_size - j), fledrefs[i].universalTimestampFlashLED[index]);
695 jout(
"\t\t\tPower Cycle Event %" PRIuMAX
": %" PRIx64
"\n",
static_cast<uintmax_t
>(flash_led_size - j), fledrefs[i].powerCycleFlashLED[index]);
703 for (uint8_t i = 0; i <
sizeof(ararefs) /
sizeof(ararefs[0]); i++) {
704 jout(
"\tFARM Log Actuator 0x%" PRIx64
" Reallocation\n", ararefs[i].actuatorID);
705 jout(
"\t\tNumber of Reallocated Sectors: %" PRIu64
"\n", ararefs[i].totalReallocations);
706 jout(
"\t\tNumber of Reallocated Candidate Sectors: %" PRIu64
"\n", ararefs[i].totalReallocationCanidates);
721 json::ref jref1 = jref[
"drive_information"];
722 jref1[
"serial_number"] = serialNumber;
723 jref1[
"world_wide_name"] = worldWideName;
724 jref1[
"firmware_rev"] = firmwareRev;
725 jref1[
"device_interface"] = deviceInterface;
731 jref1[
"device_form_factor"] = formFactor;
736 jref1[
"date_of_assembled"] = dateOfAssembly;
739 json::ref jref2 = jref[
"workload_statistics"];
757 json::ref jref3 = jref[
"error_statistics"];
761 jref3[
"fru_code_if_smart_trip_from_most_recent_smart_frame"] = farmLog.
error.
tripCode;
772 json::ref jref4 = jref[
"environment_statistics"];
788 json::ref jref5 = jref[
"reliability_statistics"];
794 json::ref jref6 = jref[
"drive_information_continued"];
796 jref6[
"product_id"] = productID;
797 jref6[
"drive_recording_type"] = recordingType;
805 json::ref jref7 = jref[
"environment_information_continued"];
815 json::ref jrefh = jref[
"head_information"];
825 for (
unsigned i = 0; i <
sizeof(actrefs) /
sizeof(actrefs[0]); i++) {
826 snprintf(
buffer,
sizeof(
buffer),
"actuator_information_%" PRIx64, actrefs[i].actuatorID);
831 jrefa[
"number_of_reallocated_sector_reclamations"] = actrefs[i].
numberGListReclam;
846 for (
unsigned i = 0; i <
sizeof(fledrefs) /
sizeof(fledrefs[0]); i++) {
847 snprintf(
buffer,
sizeof(
buffer),
"actuator_flash_led_information_%" PRIx64, fledrefs[i].actuatorID);
850 jrefa[
"index_of_last_flash_led"] = fledrefs[i].
indexFlashLED;
852 snprintf(
buffer,
sizeof(
buffer),
"event_%" PRIx64, fledrefs[i].actuatorID);
853 flash_led_size =
sizeof(fledrefs[i].
flashLEDArray) /
sizeof(fledrefs[i].flashLEDArray[0]);
854 for (uint8_t j = flash_led_size; j > 0; j--) {
855 index = (j - fledrefs[i].
indexFlashLED + flash_led_size) % flash_led_size;
863 for (
unsigned i = 0; i <
sizeof(ararefs) /
sizeof(ararefs[0]); i++) {
864 snprintf(
buffer,
sizeof(
buffer),
"actuator_reallocation_information_%" PRIx64, ararefs[i].actuatorID);
Reference to a JSON element.
void ataPrintFarmLog(const ataFarmLog &farmLog)
static void farm_print_by_head_to_text(const char *desc, const int64_t *paramArray, const uint64_t numHeads)
static uint64_t farm_byte_swap(const uint64_t param)
static void farm_print_by_head_to_json(const json::ref &jref, char(&buffer)[128], const char *desc, const int64_t *paramArray, const uint64_t numHeads)
void scsiPrintFarmLog(const scsiFarmLog &farmLog)
static const char * farm_get_form_factor(const uint64_t formFactor)
static char * farm_format_id_string(char *buffer, const uint64_t param)
static const char * farm_get_recording_type(const uint64_t driveRecordingType)
void void jinf(const char *fmt,...) __attribute_format_printf(1
void jout(const char *fmt,...) __attribute_format_printf(1
uint64_t currentMotorPower
uint64_t highestShortTemp
uint64_t totalMechanicalStartRetries
uint64_t totalReadRecoveryAttepts
uint64_t cumulativeUnrecoverableReadUnique[24]
uint64_t totalUnrecoverableWriteErrors
uint64_t totalReallocationCanidates
uint64_t attrSpinRetryCount
uint64_t powerCycleFlashLED[8]
uint64_t cumulativeUnrecoverableReadERC
uint64_t totalReallocations
uint64_t totalUnrecoverableReadErrors
uint64_t cumulativeUnrecoverableReadRepeating[24]
uint64_t worstSpinRretryCount
uint64_t universalTimestampFlashLED[8]
uint64_t normalSpinRetryCount
uint64_t flashLEDArray[8]
ataFarmErrorStatistics error
ataFarmReliabilityStatistics reliability
ataFarmWorkloadStatistics workload
ataFarmEnvironmentStatistics environment
ataFarmDriveInformation driveInformation
int64_t RVGASkipWriteDetect[24]
int64_t secondMRHeadResistance[24]
int64_t writeWorkloadPowerOnTime[24]
uint64_t mrHeadResistance[24]
int64_t DVGASkipWriteDetect[24]
int64_t attrErrorRateWorst
int64_t attrSeekErrorRateWorst
int64_t attrUnloadEventsRaw
int64_t reallocatedSectors[24]
int64_t FVGASkipWriteDetect[24]
int64_t attrSeekErrorRateNormal
int64_t skipWriteDetectThresExceeded[24]
int64_t numberLBACorrectedParitySector
int64_t reallocationCandidates[24]
int64_t heliumPresureTrip
int64_t attrErrorRateNormal
int64_t attrSeekErrorRateRaw
uint64_t totalNumberofOtherCMDS
uint64_t writeCommandsByRadius1
uint64_t totalWriteCommands
uint64_t totalRandomWrites
uint64_t readCommandsByRadius1
uint64_t writeCommandsByRadius3
uint64_t logicalSecWritten
uint64_t totalRandomReads
uint64_t writeCommandsByRadius4
uint64_t readCommandsByRadius3
uint64_t writeCommandsByRadius2
uint64_t totalReadCommands
uint64_t readCommandsByRadius4
uint64_t ditherSequential
uint64_t readCommandsByRadius2
uint64_t flashLEDArray[8]
uint64_t powerCycleFlashLED[8]
uint64_t universalTimestampFlashLED[8]
uint64_t totalReallocationCanidates
uint64_t totalReallocations
uint64_t numberSlippedSectorsBeforeIDD
uint64_t lbasCorrectedISP
uint64_t numberResidentReallocatedAfterIDD
uint64_t subcommandlastIDDTest
uint64_t numberScrubbedSectorsAfterIDD
uint64_t numberLBACorrectedParitySector
uint64_t dosScansPerformed
uint64_t numberResidentReallocatedBeforeIDD
uint64_t numberScrubbedSectorsBeforeIDD
uint64_t numberGListReclam
uint64_t numberValidParitySectors
uint64_t numberSlippedSectorsAfterIDD
uint64_t currentMotorPower
uint64_t disparityErrorCodeA
uint64_t lossOfDWordSyncA
uint64_t phyResetProblemA
uint64_t disparityErrorCodeB
uint64_t invalidDWordCountB
uint64_t totalUnrecoverableWriteErrors
uint64_t invalidDWordCountA
uint64_t lossOfDWordSyncB
uint64_t totalMechanicalStartRetries
uint64_t phyResetProblemB
uint64_t totalUnrecoverableReadErrors
scsiFarmByActuator actuator0
scsiFarmByHead totalReallocations
scsiFarmDriveInformation2 driveInformation2
scsiFarmByHead totalReallocationCanidates
scsiFarmByHead cumulativeUnrecoverableReadUnique
scsiFarmByActuatorReallocation actuatorReallocation1
scsiFarmEnvironmentStatistics2 environment2
scsiFarmReliabilityStatistics reliability
scsiFarmDriveInformation driveInformation
scsiFarmByActuator actuator1
scsiFarmByHead writeWorkloadPowerOnTime
scsiFarmEnvironmentStatistics environment
scsiFarmWorkloadStatistics workload
scsiFarmByActuatorFLED actuatorFLED1
scsiFarmByHead secondMRHeadResistance
scsiFarmByActuatorReallocation actuatorReallocation2
scsiFarmByActuatorFLED actuatorFLED0
scsiFarmByHead cumulativeUnrecoverableReadRepeat
scsiFarmByActuatorReallocation actuatorReallocation0
scsiFarmByActuator actuator3
scsiFarmErrorStatistics error
scsiFarmByActuatorReallocation actuatorReallocation3
scsiFarmByActuator actuator2
scsiFarmByHead mrHeadResistance
scsiFarmByActuatorFLED actuatorFLED2
scsiFarmByActuatorFLED actuatorFLED3
int64_t heliumPresureTrip
uint64_t writeCommandsByRadius3
uint64_t writeCommandsByRadius1
uint64_t totalReadCommands
uint64_t writeCommandsByRadius4
uint64_t writeCommandsByRadius2
uint64_t readCommandsByRadius1
uint64_t readCommandsByRadius3
uint64_t totalWriteCommands
uint64_t totalNumberofOtherCMDS
uint64_t totalRandomWrites
uint64_t totalRandomReads
uint64_t readCommandsByRadius2
uint64_t readCommandsByRadius4
uint64_t logicalSecWritten