39
39
#define NON_MEDIUM_LPAGE 0x6
40
40
#define LAST_N_ERR_LPAGE 0x7
41
41
#define LAST_N_DEFERRED_LPAGE 0xb
42
#define THIN_PROV_LPAGE 0xc
42
43
#define TEMPERATURE_LPAGE 0xd
43
44
#define START_STOP_LPAGE 0xe
44
45
#define APP_CLIENT_LPAGE 0xf
45
46
#define SELF_TEST_LPAGE 0x10
46
47
#define PORT_SPECIFIC_LPAGE 0x18
47
#define GSP_LPAGE 0x19
48
#define STATS_LPAGE 0x19
48
49
#define PCT_LPAGE 0x1a
49
50
#define TAPE_ALERT_LPAGE 0x2e
50
51
#define IE_LPAGE 0x2f
51
#define NOT_SUBPG_LOG 0x0
52
#define ALL_SUBPG_LOG 0xff
52
#define NOT_SPG_SUBPG 0x0
53
#define SUPP_SPGS_SUBPG 0xff
54
#define LOW_GRP_STATS_SUBPG 0x1
55
#define HIGH_GRP_STATS_SUBPG 0x1f
56
#define CACHE_STATS_SUBPG 0x20
54
58
#define PCB_STR_LEN 128
630
634
memset(b, 0, sizeof(b));
631
635
/* first process log pages that do not depend on peripheral type */
632
if (NOT_SUBPG_LOG == subpg_code)
636
if (NOT_SPG_SUBPG == subpg_code)
633
637
snprintf(b, sizeof(b) - 1, " 0x%02x ", pg_code);
635
639
snprintf(b, sizeof(b) - 1, " 0x%02x,0x%02x ", pg_code,
638
if ((NOT_SUBPG_LOG == subpg_code) || (ALL_SUBPG_LOG == subpg_code)) {
642
if ((NOT_SPG_SUBPG == subpg_code) || (SUPP_SPGS_SUBPG == subpg_code)) {
639
643
switch (pg_code) {
640
case ALL_PAGE_LPAGE: printf("%sSupported log pages", b); break;
644
case SUPP_PAGES_LPAGE: printf("%sSupported log pages", b); break;
641
645
case BUFF_OVER_UNDER_LPAGE:
642
646
printf("%sBuffer over-run/under-run", b);
656
660
case APP_CLIENT_LPAGE: printf("%sApplication client", b); break;
657
661
case SELF_TEST_LPAGE: printf("%sSelf-test results", b); break;
658
662
case PORT_SPECIFIC_LPAGE: printf("%sProtocol specific port", b); break;
660
664
printf("%sGeneral statistics and performance", b);
663
667
printf("%sPower condition transition", b);
665
case IE_LPAGE: printf("%sInformational exceptions (SMART)", b); break;
666
default : done = 0; break;
670
printf("%sInformational exceptions (SMART)", b);
669
if (ALL_SUBPG_LOG == subpg_code)
677
if (SUPP_SPGS_SUBPG == subpg_code)
670
678
printf(" and subpages\n");
676
if ((GSP_LPAGE == pg_code) && (subpg_code > 0) && (subpg_code < 32)) {
677
printf("%sGroup statistics and performance (%d)\n", b, subpg_code);
685
/* There are not many log subpages currently */
686
if (STATS_LPAGE == pg_code) {
687
if ((subpg_code >= LOW_GRP_STATS_SUBPG) &&
688
(subpg_code <= HIGH_GRP_STATS_SUBPG)) {
689
printf("%sGroup statistics and performance (%d)\n", b, subpg_code);
691
} else if (subpg_code == CACHE_STATS_SUBPG) {
692
printf("%sCache memory statistics\n", b);
680
696
if (subpg_code > 0) {
681
697
printf("%s??\n", b);
1913
1943
: "write FUA_NV command processing intervals = ";
1914
1944
printf(" %s%" PRIu64 "\n", ccp, ull);
1946
case 6: /* Time interval log parameter for cache stats */
1947
ccp = nam ? "parameter_code=6" : "Time interval log "
1948
"parameter for cache stats";
1949
printf("%s\n", ccp);
1950
for (n = 0, ull = ucp[4]; n < 4; ++n) {
1951
ull <<= 8; ull |= ucp[4 + n];
1953
ccp = nam ? "time_interval_neg_exp=" : "time interval "
1954
"negative exponent = ";
1955
printf(" %s%" PRIu64 "\n", ccp, ull);
1956
for (n = 0, ull = ucp[8]; n < 4; ++n) {
1957
ull <<= 8; ull |= ucp[8 + n];
1959
ccp = nam ? "time_interval_int=" : "time interval "
1961
printf(" %s%" PRIu64 "\n", ccp, ull);
1918
1965
printf("parameter_code=%d\n", param_code);
2106
/* Returns 1 if processed page, 0 otherwise */
2108
show_cache_stats_page(unsigned char * resp, int len,
2109
const struct opts_t * optsp)
2111
int k, num, n, pc, spf, subpg_code, extra;
2113
unsigned char * ucp;
2116
char pcb_str[PCB_STR_LEN];
2118
nam = optsp->do_name;
2122
printf("badly formed Cache memory statistics log page\n");
2125
spf = !!(resp[0] & 0x40);
2126
subpg_code = spf ? resp[1] : 0;
2128
printf("log_page=0x%x\n", STATS_LPAGE);
2130
printf("log_subpage=0x%x\n", subpg_code);
2132
printf("Cache memory statistics log page\n");
2134
for (k = num; k > 0; k -= extra, ucp += extra) {
2136
printf("short Cache memory statistics log page\n");
2140
printf("Cache memory statistics log page parameter length not "
2145
pc = (ucp[0] << 8) + ucp[1];
2148
case 1: /* Read cache memory hits log parameter */
2149
ccp = nam ? "parameter_code=1" :
2150
"Read cache memory hits log parameter";
2151
printf("%s\n", ccp);
2152
for (n = 0, ull = ucp[4]; n < 8; ++n) {
2153
ull <<= 8; ull |= ucp[4 + n];
2155
ccp = nam ? "read_cache_memory_hits=" :
2156
"read cache memory hits = ";
2157
printf(" %s%" PRIu64 "\n", ccp, ull);
2159
case 2: /* Reads to cache memory log parameter */
2160
ccp = nam ? "parameter_code=2" :
2161
"Reads to cache memory log parameter";
2162
printf("%s\n", ccp);
2163
for (n = 0, ull = ucp[4]; n < 8; ++n) {
2164
ull <<= 8; ull |= ucp[4 + n];
2166
ccp = nam ? "reads_to_cache_memory=" :
2167
"reads to cache memory = ";
2168
printf(" %s%" PRIu64 "\n", ccp, ull);
2170
case 3: /* Write cache memory hits log parameter */
2171
ccp = nam ? "parameter_code=3" :
2172
"Write cache memory hits log parameter";
2173
printf("%s\n", ccp);
2174
for (n = 0, ull = ucp[4]; n < 8; ++n) {
2175
ull <<= 8; ull |= ucp[4 + n];
2177
ccp = nam ? "write_cache_memory_hits=" :
2178
"write cache memory hits = ";
2179
printf(" %s%" PRIu64 "\n", ccp, ull);
2181
case 4: /* Writes from cache memory log parameter */
2182
ccp = nam ? "parameter_code=4" :
2183
"Writes from cache memory log parameter";
2184
printf("%s\n", ccp);
2185
for (n = 0, ull = ucp[4]; n < 8; ++n) {
2186
ull <<= 8; ull |= ucp[4 + n];
2188
ccp = nam ? "writes_from_cache_memory=" :
2189
"writes from cache memory = ";
2190
printf(" %s%" PRIu64 "\n", ccp, ull);
2192
case 5: /* Time from last hard reset log parameter */
2193
ccp = nam ? "parameter_code=5" :
2194
"Time from last hard reset log parameter";
2195
printf("%s\n", ccp);
2196
for (n = 0, ull = ucp[4]; n < 8; ++n) {
2197
ull <<= 8; ull |= ucp[4 + n];
2199
ccp = nam ? "time_from_last_hard_reset=" :
2200
"time from last hard reset = ";
2201
printf(" %s%" PRIu64 "\n", ccp, ull);
2203
case 6: /* Time interval log parameter for cache stats */
2204
ccp = nam ? "parameter_code=6" :
2205
"Time interval log parameter";
2206
printf("%s\n", ccp);
2207
for (n = 0, ull = ucp[4]; n < 4; ++n) {
2208
ull <<= 8; ull |= ucp[4 + n];
2210
ccp = nam ? "time_interval_neg_exp=" : "time interval "
2211
"negative exponent = ";
2212
printf(" %s%" PRIu64 "\n", ccp, ull);
2213
for (n = 0, ull = ucp[8]; n < 4; ++n) {
2214
ull <<= 8; ull |= ucp[8 + n];
2216
ccp = nam ? "time_interval_int=" : "time interval "
2218
printf(" %s%" PRIu64 "\n", ccp, ull);
2222
printf("parameter_code=%d\n", pc);
2223
printf(" unknown=1\n");
2225
fprintf(stderr, "show_performance... unknown parameter "
2227
if (optsp->do_verbose)
2228
dStrHex((const char *)ucp, extra, 1);
2231
if ((optsp->do_pcb) && (0 == optsp->do_name)) {
2232
get_pcb_str(pcb, pcb_str, sizeof(pcb_str));
2233
printf(" <%s>\n", pcb_str);
2060
2240
show_format_status_page(unsigned char * resp, int len, int show_pcb)
2199
2379
static const char * bms_status[] = {
2200
2380
"no background scans active",
2201
"background scan is active",
2381
"background medium scan is active",
2202
2382
"background pre-scan is active",
2203
2383
"background scan halted due to fatal error",
2204
2384
"background scan halted due to a vendor specific pattern of error",
2205
2385
"background scan halted due to medium formatted without P-List",
2206
2386
"background scan halted - vendor specific cause",
2207
2387
"background scan halted due to temperature out of range",
2208
"background scan halted until BM interval timer expires", /* 8 */
2388
"background scan enabled, none active (waiting for BMS interval timer "
2389
"to expire)", /* 8 */
2211
2392
static const char * reassign_status[] = {
2269
2450
j = (ucp[14] << 8) + ucp[15];
2271
printf(" Number of background medium scans performed: "
2272
"not reported [0]\n");
2452
printf(" Number of background medium scans performed: 0 "
2453
"[not reported]\n");
2274
2455
printf(" Number of background medium scans performed: "
2278
printf(" Medium scan parameter # %d\n", pc);
2460
if ((pc >= 0x8000) && (pc <= 0xafff))
2461
printf(" Medium scan parameter # %d [0x%x], vendor "
2462
"specific\n", pc, pc);
2464
printf(" Medium scan parameter # %d [0x%x], "
2465
"reserved\n", pc, pc);
2466
dStrHex((const char *)ucp, ((pl < num) ? pl : num), 0);
2469
printf(" Medium scan parameter # %d [0x%x]\n", pc, pc);
2279
2470
if ((pl < 24) || (num < 24)) {
2281
2472
fprintf(stderr, " truncated by response length, "
3314
3510
if (SG_LIB_CAT_NOT_READY == k)
3315
3511
fprintf(stderr, "log_select: device not ready\n");
3512
else if (SG_LIB_CAT_ILLEGAL_REQ == res)
3513
fprintf(stderr, "log_select: field in cdb illegal\n");
3316
3514
else if (SG_LIB_CAT_INVALID_OP == k)
3317
3515
fprintf(stderr, "log_select: not supported\n");
3318
3516
else if (SG_LIB_CAT_UNIT_ATTENTION == k)
3319
3517
fprintf(stderr, "log_select: unit attention\n");
3320
3518
else if (SG_LIB_CAT_ABORTED_COMMAND == k)
3321
3519
fprintf(stderr, "log_select: aborted command\n");
3521
fprintf(stderr, "log_select: failed (%d), try '-v' for more "
3522
"information\n", k);
3323
3524
return (k >= 0) ? k : SG_LIB_CAT_OTHER;