From d7c1da6153fbfa9f135dd9fd2b0602209919bc9b Mon Sep 17 00:00:00 2001 From: Alexander Motin Date: Sun, 28 Jul 2019 20:17:40 +0000 Subject: [PATCH] Decode some more IDENTIFY DEVICE bits. MFC after: 2 weeks --- sbin/camcontrol/camcontrol.c | 46 ++++++++++++++++++++++++------------ sys/sys/ata.h | 7 ++++-- 2 files changed, 36 insertions(+), 17 deletions(-) diff --git a/sbin/camcontrol/camcontrol.c b/sbin/camcontrol/camcontrol.c index 7ec809abcc59..0e305edfb117 100644 --- a/sbin/camcontrol/camcontrol.c +++ b/sbin/camcontrol/camcontrol.c @@ -1521,6 +1521,7 @@ atacapprint(struct ata_params *parm) printf("WWN %04x%04x%04x%04x\n", parm->wwn[0], parm->wwn[1], parm->wwn[2], parm->wwn[3]); } + printf("additional product id %.8s\n", parm->product_id); if (parm->enabled.extension & ATA_SUPPORT_MEDIASN) { printf("media serial number %.30s\n", parm->media_serial); @@ -1650,35 +1651,39 @@ atacapprint(struct ata_params *parm) } else printf("\n"); printf("Native Command Queuing (NCQ) "); - if (parm->satacapabilities != 0xffff && - (parm->satacapabilities & ATA_SUPPORT_NCQ)) { + if (atasata(parm) && (parm->satacapabilities & ATA_SUPPORT_NCQ)) { printf("yes %d tags\n", ATA_QUEUE_LEN(parm->queue) + 1); + printf("NCQ Priority Information %s\n", + parm->satacapabilities & ATA_SUPPORT_NCQ_PRIO ? + "yes" : "no"); + printf("NCQ Non-Data Command %s\n", + parm->satacapabilities2 & ATA_SUPPORT_NCQ_NON_DATA ? + "yes" : "no"); + printf("NCQ Streaming %s\n", + parm->satacapabilities2 & ATA_SUPPORT_NCQ_STREAM ? + "yes" : "no"); + printf("Receive & Send FPDMA Queued %s\n", + parm->satacapabilities2 & ATA_SUPPORT_RCVSND_FPDMA_QUEUED ? + "yes" : "no"); + printf("NCQ Autosense %s\n", + parm->satasupport & ATA_SUPPORT_NCQ_AUTOSENSE ? + "yes" : "no"); } else printf("no\n"); - printf("NCQ Queue Management %s\n", atasata(parm) && - parm->satacapabilities2 & ATA_SUPPORT_NCQ_QMANAGEMENT ? - "yes" : "no"); - printf("NCQ Streaming %s\n", atasata(parm) && - parm->satacapabilities2 & ATA_SUPPORT_NCQ_STREAM ? - "yes" : "no"); - printf("Receive & Send FPDMA Queued %s\n", atasata(parm) && - parm->satacapabilities2 & ATA_SUPPORT_RCVSND_FPDMA_QUEUED ? - "yes" : "no"); - printf("SMART %s %s\n", parm->support.command1 & ATA_SUPPORT_SMART ? "yes" : "no", parm->enabled.command1 & ATA_SUPPORT_SMART ? "yes" : "no"); - printf("microcode download %s %s\n", - parm->support.command2 & ATA_SUPPORT_MICROCODE ? "yes" : "no", - parm->enabled.command2 & ATA_SUPPORT_MICROCODE ? "yes" : "no"); printf("security %s %s\n", parm->support.command1 & ATA_SUPPORT_SECURITY ? "yes" : "no", parm->enabled.command1 & ATA_SUPPORT_SECURITY ? "yes" : "no"); printf("power management %s %s\n", parm->support.command1 & ATA_SUPPORT_POWERMGT ? "yes" : "no", parm->enabled.command1 & ATA_SUPPORT_POWERMGT ? "yes" : "no"); + printf("microcode download %s %s\n", + parm->support.command2 & ATA_SUPPORT_MICROCODE ? "yes" : "no", + parm->enabled.command2 & ATA_SUPPORT_MICROCODE ? "yes" : "no"); printf("advanced power management %s %s", parm->support.command2 & ATA_SUPPORT_APM ? "yes" : "no", parm->enabled.command2 & ATA_SUPPORT_APM ? "yes" : "no"); @@ -1721,6 +1726,15 @@ atacapprint(struct ata_params *parm) printf("free-fall %s %s\n", parm->support2 & ATA_SUPPORT_FREEFALL ? "yes" : "no", parm->enabled2 & ATA_SUPPORT_FREEFALL ? "yes" : "no"); + printf("sense data reporting %s %s\n", + parm->support2 & ATA_SUPPORT_SENSE_REPORT ? "yes" : "no", + parm->enabled2 & ATA_SUPPORT_SENSE_REPORT ? "yes" : "no"); + printf("extended power conditions %s %s\n", + parm->support2 & ATA_SUPPORT_EPC ? "yes" : "no", + parm->enabled2 & ATA_SUPPORT_EPC ? "yes" : "no"); + printf("device statistics notification %s %s\n", + parm->support2 & ATA_SUPPORT_DSN ? "yes" : "no", + parm->enabled2 & ATA_SUPPORT_DSN ? "yes" : "no"); printf("Data Set Management (DSM/TRIM) "); if (parm->support_dsm & ATA_SUPPORT_DSM_TRIM) { printf("yes\n"); @@ -1743,6 +1757,8 @@ atacapprint(struct ata_params *parm) } else { printf("no\n"); } + printf("encrypts all user data %s\n", + parm->support3 & ATA_ENCRYPTS_ALL_USER_DATA ? "yes" : "no"); printf("Sanitize "); if (parm->multi & ATA_SUPPORT_SANITIZE) { printf("yes\t\t%s%s%s\n", diff --git a/sys/sys/ata.h b/sys/sys/ata.h index df87ddb57fca..22edb5573d1a 100644 --- a/sys/sys/ata.h +++ b/sys/sys/ata.h @@ -143,7 +143,8 @@ struct ata_params { /*77*/ u_int16_t satacapabilities2; #define ATA_SATA_CURR_GEN_MASK 0x0006 #define ATA_SUPPORT_NCQ_STREAM 0x0010 -#define ATA_SUPPORT_NCQ_QMANAGEMENT 0x0020 +#define ATA_SUPPORT_NCQ_NON_DATA 0x0020 +#define ATA_SUPPORT_NCQ_QMANAGEMENT ATA_SUPPORT_NCQ_NON_DATA #define ATA_SUPPORT_RCVSND_FPDMA_QUEUED 0x0040 /*78*/ u_int16_t satasupport; #define ATA_SUPPORT_NONZERO 0x0002 @@ -152,6 +153,7 @@ struct ata_params { #define ATA_SUPPORT_INORDERDATA 0x0010 #define ATA_SUPPORT_ASYNCNOTIF 0x0020 #define ATA_SUPPORT_SOFTSETPRESERVE 0x0040 +#define ATA_SUPPORT_NCQ_AUTOSENSE 0x0080 /*79*/ u_int16_t sataenabled; #define ATA_ENABLED_DAPST 0x0080 @@ -285,7 +287,8 @@ struct ata_params { #define ATA_FORM_FACTOR_C_FAST 0x0009 /*169*/ u_int16_t support_dsm; #define ATA_SUPPORT_DSM_TRIM 0x0001 - u_int16_t reserved170[6]; +/*170*/ u_int8_t product_id[8]; /* Additional Product Identifier */ + u_int16_t reserved174[2]; /*176*/ u_int8_t media_serial[60]; /*206*/ u_int16_t sct; u_int16_t reserved207[2];