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];
186 jout(
"Seagate Field Access Reliability Metrics log (FARM) (GP Log 0xa6)\n");
188 jout(
"\tFARM Log Page 0: Log Header\n");
198 jout(
"\tFARM Log Page 1: Drive Information\n");
199 jout(
"\t\tSerial Number: %s\n", serialNumber);
200 jout(
"\t\tWorld Wide Name: %s\n", worldWideName);
201 jout(
"\t\tDevice Interface: %s\n", deviceInterface);
207 jout(
"\t\tDevice Form Factor: %s\n", formFactor);
209 jout(
"\t\tFirmware Rev: %s\n", firmwareRev);
222 jout(
"\t\tModel Number: %s\n", modelNumber);
223 jout(
"\t\tDrive Recording Type: %s\n", recordingType);
225 jout(
"\t\tAssembly Date (YYWW): %s\n", dateOfAssembly);
229 jout(
"\tFARM Log Page 2: Workload Statistics\n");
237 jout(
"\t\tNumber of dither events during current power cycle: %" PRIu64
"\n", farmLog.
workload.
dither);
238 jout(
"\t\tNumber of times dither was held off during random workloads: %" PRIu64
"\n", farmLog.
workload.
ditherRandom);
250 jout(
"\tFARM Log Page 3: Error Statistics\n");
272 for (uint8_t i = flash_led_size; i > 0; i--) {
274 jout(
"\t\tFlash LED Event %" PRIuMAX
":\n",
static_cast<uintmax_t
>(flash_led_size - i));
277 jout(
"\t\t\tPower Cycle Event %" PRIuMAX
": %" PRIx64
"\n",
static_cast<uintmax_t
>(flash_led_size - i), farmLog.
error.
powerCycleFlashLED[index]);
284 jout(
"\t\tCum Lifetime Unrecoverable by head %" PRIu8
":\n", hd);
290 jout(
"\tFARM Log Page 4: Environment Statistics\n");
320 jout(
"\tFARM Log Page 5: Reliability Statistics\n");
346 json::ref jref0 = jref[
"page_0_log_header"];
357 json::ref jref1 = jref[
"page_1_drive_information"];
358 jref1[
"serial_number"] = serialNumber;
359 jref1[
"world_wide_name"] = worldWideName;
360 jref1[
"device_interface"] = deviceInterface;
366 jref1[
"form_factor"] = formFactor;
368 jref1[
"firmware_rev"] = firmwareRev;
378 jref1[
"drive_recording_type"] = recordingType;
380 jref1[
"date_of_assembly"] = dateOfAssembly;
384 json::ref jref2 = jref[
"page_2_workload_statistics"];
405 json::ref jref3 = jref[
"page_3_error_statistics"];
428 for (uint8_t i = flash_led_size; i > 0; i--) {
430 snprintf(
buffer,
sizeof(
buffer),
"flash_led_event_%i", index);
439 snprintf(
buffer,
sizeof(
buffer),
"cum_lifetime_unrecoverable_by_head_%i", hd);
446 json::ref jref4 = jref[
"page_4_environment_statistics"];
476 json::ref jref5 = jref[
"page_5_reliability_statistics"];
511 jinf(
"FARM support was not tested on Big Endian platforms by the developers.\n"
512 "Please report success/failure to " PACKAGE_BUGREPORT
"\n\n");
519 char worldWideName[64];
543 jout(
"\nSeagate Field Access Reliability Metrics log (FARM) (SCSI Log page 0x3d, sub-page 0x3)\n");
546 jout(
"\tFARM Log Parameter 0: Log Header\n");
554 jout(
"\tFARM Log Parameter 1: Drive Information\n");
555 jout(
"\t\tSerial Number: %s\n", serialNumber);
556 jout(
"\t\tWorld Wide Name: %s\n", worldWideName);
557 jout(
"\t\tFirmware Rev: %s\n", firmwareRev);
558 jout(
"\t\tDevice Interface: %s\n", deviceInterface);
564 jout(
"\t\tDevice form factor: %s\n", formFactor);
569 jout(
"\t\tDate of Assembled: %s\n", dateOfAssembly);
572 jout(
"\tFARM Log Parameter 2: Workload Statistics\n");
590 jout(
"\tFARM Log Parameter 3: Error Statistics\n");
594 jout(
"\t\tFRU code if smart trip from most recent SMART Frame: %" PRIu64
"\n", farmLog.
error.
tripCode);
605 jout(
"\tFARM Log Parameter 4: Environment Statistics\n");
621 jout(
"\tFARM Log Parameter 5: Reliability Statistics\n");
625 jout(
"\tFARM Log Parameter 6: Drive Information Continued\n");
627 jout(
"\t\tProduct ID: %s\n", productID);
628 jout(
"\t\tDrive Recording Type: %s\n", recordingType);
636 jout(
"\tFARM Log Parameter 7: Environment Information Continued\n");
645 jout(
"\tFARM Log \"By Head\" Information\n");
658 for (uint8_t i = 0; i <
sizeof(actrefs) /
sizeof(actrefs[0]); i++) {
659 jout(
"\tFARM Log Actuator Information 0x%" PRIx64
"\n", actrefs[i].actuatorID);
660 jout(
"\t\tHead Load Events: %" PRIu64
"\n", actrefs[i].headLoadEvents);
661 jout(
"\t\tTimeStamp of last IDD test: %" PRIu64
"\n", actrefs[i].timelastIDDTest);
662 jout(
"\t\tSub-Command of Last IDD Test: %" PRIu64
"\n", actrefs[i].subcommandlastIDDTest);
663 jout(
"\t\tNumber of Reallocated Sector Reclamations: %" PRIu64
"\n", actrefs[i].numberGListReclam);
664 jout(
"\t\tServo Status: %" PRIu64
"\n", actrefs[i].servoStatus);
665 jout(
"\t\tNumber of Slipped Sectors Before IDD Scan: %" PRIu64
"\n", actrefs[i].numberSlippedSectorsBeforeIDD);
666 jout(
"\t\tNumber of Slipped Sectors Before IDD Scan: %" PRIu64
"\n", actrefs[i].numberSlippedSectorsAfterIDD);
667 jout(
"\t\tNumber of Resident Reallocated Sectors Before IDD Scan: %" PRIu64
"\n", actrefs[i].numberResidentReallocatedBeforeIDD);
668 jout(
"\t\tNumber of Resident Reallocated Sectors Before IDD Scan: %" PRIu64
"\n", actrefs[i].numberResidentReallocatedAfterIDD);
669 jout(
"\t\tSuccessfully Scrubbed Sectors Before IDD Scan: %" PRIu64
"\n", actrefs[i].numberScrubbedSectorsBeforeIDD);
670 jout(
"\t\tSuccessfully Scrubbed Sectors Before IDD Scan: %" PRIu64
"\n", actrefs[i].numberScrubbedSectorsAfterIDD);
671 jout(
"\t\tNumber of DOS Scans Performed: %" PRIu64
"\n", actrefs[i].dosScansPerformed);
672 jout(
"\t\tNumber of LBAs Corrected by ISP: %" PRIu64
"\n", actrefs[i].lbasCorrectedISP);
673 jout(
"\t\tNumber of Valid Parity Sectors: %" PRIu64
"\n", actrefs[i].numberValidParitySectors);
674 jout(
"\t\tNumber of LBAs Corrected by Parity Sector: %" PRIu64
"\n", actrefs[i].numberLBACorrectedParitySector);
679 size_t flash_led_size;
683 for (uint8_t i = 0; i <
sizeof(fledrefs) /
sizeof(fledrefs[0]); i++) {
684 jout(
"\tFARM Log Actuator 0x%" PRIx64
" Flash LED Information\n", fledrefs[i].actuatorID);
685 jout(
"\t\tTotal Flash LED Events: %" PRIu64
"\n", fledrefs[i].totalFlashLED);
686 jout(
"\t\tIndex of Last Flash LED: %" PRIu64
"\n", fledrefs[i].indexFlashLED);
688 flash_led_size =
sizeof(fledrefs[i].
flashLEDArray) /
sizeof(fledrefs[i].flashLEDArray[0]);
689 for (uint8_t j = flash_led_size; j > 0; j--) {
690 index = (j - fledrefs[i].
indexFlashLED + flash_led_size) % flash_led_size;
691 jout(
"\t\tEvent %" PRIuMAX
":\n",
static_cast<uintmax_t
>(flash_led_size - j));
692 jout(
"\t\t\tEvent Information: 0x%016" PRIx64
"\n", fledrefs[i].flashLEDArray[index]);
693 jout(
"\t\t\tTimestamp of Event %" PRIuMAX
" (hours): %" PRIu64
"\n",
static_cast<uintmax_t
>(flash_led_size - j), fledrefs[i].universalTimestampFlashLED[index]);
694 jout(
"\t\t\tPower Cycle Event %" PRIuMAX
": %" PRIx64
"\n",
static_cast<uintmax_t
>(flash_led_size - j), fledrefs[i].powerCycleFlashLED[index]);
702 for (uint8_t i = 0; i <
sizeof(ararefs) /
sizeof(ararefs[0]); i++) {
703 jout(
"\tFARM Log Actuator 0x%" PRIx64
" Reallocation\n", ararefs[i].actuatorID);
704 jout(
"\t\tNumber of Reallocated Sectors: %" PRIu64
"\n", ararefs[i].totalReallocations);
705 jout(
"\t\tNumber of Reallocated Candidate Sectors: %" PRIu64
"\n", ararefs[i].totalReallocationCanidates);
720 json::ref jref1 = jref[
"drive_information"];
721 jref1[
"serial_number"] = serialNumber;
722 jref1[
"world_wide_name"] = worldWideName;
723 jref1[
"firmware_rev"] = firmwareRev;
724 jref1[
"device_interface"] = deviceInterface;
730 jref1[
"device_form_factor"] = formFactor;
735 jref1[
"date_of_assembled"] = dateOfAssembly;
738 json::ref jref2 = jref[
"workload_statistics"];
756 json::ref jref3 = jref[
"error_statistics"];
760 jref3[
"fru_code_if_smart_trip_from_most_recent_smart_frame"] = farmLog.
error.
tripCode;
771 json::ref jref4 = jref[
"environment_statistics"];
787 json::ref jref5 = jref[
"reliability_statistics"];
793 json::ref jref6 = jref[
"drive_information_continued"];
795 jref6[
"product_id"] = productID;
796 jref6[
"drive_recording_type"] = recordingType;
804 json::ref jref7 = jref[
"environment_information_continued"];
814 json::ref jrefh = jref[
"head_information"];
824 for (
unsigned i = 0; i <
sizeof(actrefs) /
sizeof(actrefs[0]); i++) {
825 snprintf(
buffer,
sizeof(
buffer),
"actuator_information_%" PRIx64, actrefs[i].actuatorID);
830 jrefa[
"number_of_reallocated_sector_reclamations"] = actrefs[i].
numberGListReclam;
845 for (
unsigned i = 0; i <
sizeof(fledrefs) /
sizeof(fledrefs[0]); i++) {
846 snprintf(
buffer,
sizeof(
buffer),
"actuator_flash_led_information_%" PRIx64, fledrefs[i].actuatorID);
849 jrefa[
"index_of_last_flash_led"] = fledrefs[i].
indexFlashLED;
851 snprintf(
buffer,
sizeof(
buffer),
"event_%" PRIx64, fledrefs[i].actuatorID);
852 flash_led_size =
sizeof(fledrefs[i].
flashLEDArray) /
sizeof(fledrefs[i].flashLEDArray[0]);
853 for (uint8_t j = flash_led_size; j > 0; j--) {
854 index = (j - fledrefs[i].
indexFlashLED + flash_led_size) % flash_led_size;
862 for (
unsigned i = 0; i <
sizeof(ararefs) /
sizeof(ararefs[0]); i++) {
863 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