|
|
2d6102 |
From 4fed8b17b1cd75492d20cf701ebe4f66e13385f5 Mon Sep 17 00:00:00 2001
|
|
|
2d6102 |
From: David Sommerseth <davids@redhat.com>
|
|
|
2d6102 |
Date: Fri, 29 Apr 2016 01:12:20 +0200
|
|
|
2d6102 |
Subject: [PATCH] Add upstream updates to sg_inq, sg_rdac and sg_vpd
|
|
|
2d6102 |
|
|
|
2d6102 |
---
|
|
|
2d6102 |
src/sg_inq.c | 165 +++++++++++++++++++++++++++++++-----
|
|
|
2d6102 |
src/sg_rdac.c | 216 ++++++++++++++++++++++++++++++++++-------------
|
|
|
2d6102 |
src/sg_vpd_vendor.c | 239 +++++++++++++++++++++++++++++++++++++++++++++++-----
|
|
|
2d6102 |
3 files changed, 519 insertions(+), 101 deletions(-)
|
|
|
2d6102 |
|
|
|
2d6102 |
diff --git a/src/sg_inq.c b/src/sg_inq.c
|
|
|
2d6102 |
index 80c8aec..9666e08 100644
|
|
|
2d6102 |
--- a/src/sg_inq.c
|
|
|
2d6102 |
+++ b/src/sg_inq.c
|
|
|
2d6102 |
@@ -2225,8 +2225,8 @@ decode_rdac_vpd_c2(unsigned char * buff, int len)
|
|
|
2d6102 |
"not possible.\n" , buff[4], buff[5], buff[6], buff[7]);
|
|
|
2d6102 |
return;
|
|
|
2d6102 |
}
|
|
|
2d6102 |
- printf(" Software Version: %d.%d.%d\n", buff[8], buff[9], buff[10]);
|
|
|
2d6102 |
- printf(" Software Date: %02x/%02x/%02x\n", buff[11], buff[12], buff[13]);
|
|
|
2d6102 |
+ printf(" Software Version: %02x.%02x.%02x\n", buff[8], buff[9], buff[10]);
|
|
|
2d6102 |
+ printf(" Software Date: %02d/%02d/%02d\n", buff[11], buff[12], buff[13]);
|
|
|
2d6102 |
printf(" Features:");
|
|
|
2d6102 |
if (buff[14] & 0x01)
|
|
|
2d6102 |
printf(" Dual Active,");
|
|
|
2d6102 |
@@ -2235,15 +2235,77 @@ decode_rdac_vpd_c2(unsigned char * buff, int len)
|
|
|
2d6102 |
if (buff[14] & 0x04)
|
|
|
2d6102 |
printf(" Multiple Sub-enclosures,");
|
|
|
2d6102 |
if (buff[14] & 0x08)
|
|
|
2d6102 |
- printf(" DCE/DRM,");
|
|
|
2d6102 |
+ printf(" DCE/DRM/DSS/DVE,");
|
|
|
2d6102 |
if (buff[14] & 0x10)
|
|
|
2d6102 |
- printf(" AVT,");
|
|
|
2d6102 |
+ printf(" Asymmetric Logical Unit Access,");
|
|
|
2d6102 |
printf("\n");
|
|
|
2d6102 |
printf(" Max. #of LUNS: %d\n", buff[15]);
|
|
|
2d6102 |
return;
|
|
|
2d6102 |
}
|
|
|
2d6102 |
|
|
|
2d6102 |
static void
|
|
|
2d6102 |
+decode_rdac_vpd_c9_rtpg_data(unsigned char aas, unsigned char vendor)
|
|
|
2d6102 |
+{
|
|
|
2d6102 |
+ printf(" Asymmetric Access State:");
|
|
|
2d6102 |
+ switch(aas & 0x0F) {
|
|
|
2d6102 |
+ case 0x0:
|
|
|
2d6102 |
+ printf(" Active/Optimized");
|
|
|
2d6102 |
+ break;
|
|
|
2d6102 |
+ case 0x1:
|
|
|
2d6102 |
+ printf(" Active/Non-Optimized");
|
|
|
2d6102 |
+ break;
|
|
|
2d6102 |
+ case 0x2:
|
|
|
2d6102 |
+ printf(" Standby");
|
|
|
2d6102 |
+ break;
|
|
|
2d6102 |
+ case 0x3:
|
|
|
2d6102 |
+ printf(" Unavailable");
|
|
|
2d6102 |
+ break;
|
|
|
2d6102 |
+ case 0xE:
|
|
|
2d6102 |
+ printf(" Offline");
|
|
|
2d6102 |
+ break;
|
|
|
2d6102 |
+ case 0xF:
|
|
|
2d6102 |
+ printf(" Transitioning");
|
|
|
2d6102 |
+ break;
|
|
|
2d6102 |
+ default:
|
|
|
2d6102 |
+ printf(" (unknown)");
|
|
|
2d6102 |
+ break;
|
|
|
2d6102 |
+ }
|
|
|
2d6102 |
+ printf("\n");
|
|
|
2d6102 |
+
|
|
|
2d6102 |
+ printf(" Vendor Specific Field:");
|
|
|
2d6102 |
+ switch(vendor) {
|
|
|
2d6102 |
+ case 0x01:
|
|
|
2d6102 |
+ printf(" Operating normally");
|
|
|
2d6102 |
+ break;
|
|
|
2d6102 |
+ case 0x02:
|
|
|
2d6102 |
+ printf(" Non-responsive to queries");
|
|
|
2d6102 |
+ break;
|
|
|
2d6102 |
+ case 0x03:
|
|
|
2d6102 |
+ printf(" Controller being held in reset");
|
|
|
2d6102 |
+ break;
|
|
|
2d6102 |
+ case 0x04:
|
|
|
2d6102 |
+ printf(" Performing controller firmware download (1st controller)");
|
|
|
2d6102 |
+ break;
|
|
|
2d6102 |
+ case 0x05:
|
|
|
2d6102 |
+ printf(" Performing controller firmware download (2nd controller)");
|
|
|
2d6102 |
+ break;
|
|
|
2d6102 |
+ case 0x06:
|
|
|
2d6102 |
+ printf(" Quiesced as a result of an administrative request");
|
|
|
2d6102 |
+ break;
|
|
|
2d6102 |
+ case 0x07:
|
|
|
2d6102 |
+ printf(" Service mode as a result of an administrative request");
|
|
|
2d6102 |
+ break;
|
|
|
2d6102 |
+ case 0xFF:
|
|
|
2d6102 |
+ printf(" Details are not available");
|
|
|
2d6102 |
+ break;
|
|
|
2d6102 |
+ default:
|
|
|
2d6102 |
+ printf(" (unknown)");
|
|
|
2d6102 |
+ break;
|
|
|
2d6102 |
+ }
|
|
|
2d6102 |
+ printf("\n");
|
|
|
2d6102 |
+}
|
|
|
2d6102 |
+
|
|
|
2d6102 |
+static void
|
|
|
2d6102 |
decode_rdac_vpd_c9(unsigned char * buff, int len)
|
|
|
2d6102 |
{
|
|
|
2d6102 |
if (len < 3) {
|
|
|
2d6102 |
@@ -2260,14 +2322,18 @@ decode_rdac_vpd_c9(unsigned char * buff, int len)
|
|
|
2d6102 |
fprintf(stderr, "Invalid page version '%c' (should be 1)\n",
|
|
|
2d6102 |
buff[7]);
|
|
|
2d6102 |
}
|
|
|
2d6102 |
- printf(" AVT:");
|
|
|
2d6102 |
- if (buff[8] & 0x80) {
|
|
|
2d6102 |
- printf(" Enabled");
|
|
|
2d6102 |
- if (buff[8] & 0x40)
|
|
|
2d6102 |
- printf(" (Allow reads on sector 0)");
|
|
|
2d6102 |
- printf("\n");
|
|
|
2d6102 |
+ if ( (buff[8] & 0xE0) == 0xE0 ) {
|
|
|
2d6102 |
+ printf(" IOShipping (ALUA): Enabled\n");
|
|
|
2d6102 |
} else {
|
|
|
2d6102 |
- printf(" Disabled\n");
|
|
|
2d6102 |
+ printf(" AVT:");
|
|
|
2d6102 |
+ if (buff[8] & 0x80) {
|
|
|
2d6102 |
+ printf(" Enabled");
|
|
|
2d6102 |
+ if (buff[8] & 0x40)
|
|
|
2d6102 |
+ printf(" (Allow reads on sector 0)");
|
|
|
2d6102 |
+ printf("\n");
|
|
|
2d6102 |
+ } else {
|
|
|
2d6102 |
+ printf(" Disabled\n");
|
|
|
2d6102 |
+ }
|
|
|
2d6102 |
}
|
|
|
2d6102 |
printf(" Volume Access via: ");
|
|
|
2d6102 |
if (buff[8] & 0x01)
|
|
|
2d6102 |
@@ -2275,17 +2341,72 @@ decode_rdac_vpd_c9(unsigned char * buff, int len)
|
|
|
2d6102 |
else
|
|
|
2d6102 |
printf("alternate controller\n");
|
|
|
2d6102 |
|
|
|
2d6102 |
- printf(" Path priority: %d ", buff[9] & 0xf);
|
|
|
2d6102 |
- switch(buff[9] & 0xf) {
|
|
|
2d6102 |
- case 0x1:
|
|
|
2d6102 |
- printf("(preferred path)\n");
|
|
|
2d6102 |
- break;
|
|
|
2d6102 |
- case 0x2:
|
|
|
2d6102 |
- printf("(secondary path)\n");
|
|
|
2d6102 |
- break;
|
|
|
2d6102 |
- default:
|
|
|
2d6102 |
- printf("(unknown)\n");
|
|
|
2d6102 |
- break;
|
|
|
2d6102 |
+ if (buff[8] & 0x08) {
|
|
|
2d6102 |
+ printf(" Path priority: %d ", buff[15] & 0xf);
|
|
|
2d6102 |
+ switch(buff[15] & 0xf) {
|
|
|
2d6102 |
+ case 0x1:
|
|
|
2d6102 |
+ printf("(preferred path)\n");
|
|
|
2d6102 |
+ break;
|
|
|
2d6102 |
+ case 0x2:
|
|
|
2d6102 |
+ printf("(secondary path)\n");
|
|
|
2d6102 |
+ break;
|
|
|
2d6102 |
+ default:
|
|
|
2d6102 |
+ printf("(unknown)\n");
|
|
|
2d6102 |
+ break;
|
|
|
2d6102 |
+ }
|
|
|
2d6102 |
+
|
|
|
2d6102 |
+ printf(" Preferred Path Auto Changeable:");
|
|
|
2d6102 |
+ switch(buff[14] & 0x3C) {
|
|
|
2d6102 |
+ case 0x14:
|
|
|
2d6102 |
+ printf(" No (User Disabled and Host Type Restricted)\n");
|
|
|
2d6102 |
+ break;
|
|
|
2d6102 |
+ case 0x18:
|
|
|
2d6102 |
+ printf(" No (User Disabled)\n");
|
|
|
2d6102 |
+ break;
|
|
|
2d6102 |
+ case 0x24:
|
|
|
2d6102 |
+ printf(" No (Host Type Restricted)\n");
|
|
|
2d6102 |
+ break;
|
|
|
2d6102 |
+ case 0x28:
|
|
|
2d6102 |
+ printf(" Yes\n");
|
|
|
2d6102 |
+ break;
|
|
|
2d6102 |
+ default:
|
|
|
2d6102 |
+ printf(" (Unknown)\n");
|
|
|
2d6102 |
+ break;
|
|
|
2d6102 |
+ }
|
|
|
2d6102 |
+
|
|
|
2d6102 |
+ printf(" Implicit Failback:");
|
|
|
2d6102 |
+ switch(buff[14] & 0x03) {
|
|
|
2d6102 |
+ case 0x1:
|
|
|
2d6102 |
+ printf(" Disabled\n");
|
|
|
2d6102 |
+ break;
|
|
|
2d6102 |
+ case 0x2:
|
|
|
2d6102 |
+ printf(" Enabled\n");
|
|
|
2d6102 |
+ break;
|
|
|
2d6102 |
+ default:
|
|
|
2d6102 |
+ printf(" (Unknown)\n");
|
|
|
2d6102 |
+ break;
|
|
|
2d6102 |
+ }
|
|
|
2d6102 |
+ } else {
|
|
|
2d6102 |
+ printf(" Path priority: %d ", buff[9] & 0xf);
|
|
|
2d6102 |
+ switch(buff[9] & 0xf) {
|
|
|
2d6102 |
+ case 0x1:
|
|
|
2d6102 |
+ printf("(preferred path)\n");
|
|
|
2d6102 |
+ break;
|
|
|
2d6102 |
+ case 0x2:
|
|
|
2d6102 |
+ printf("(secondary path)\n");
|
|
|
2d6102 |
+ break;
|
|
|
2d6102 |
+ default:
|
|
|
2d6102 |
+ printf("(unknown)\n");
|
|
|
2d6102 |
+ break;
|
|
|
2d6102 |
+ }
|
|
|
2d6102 |
+ }
|
|
|
2d6102 |
+
|
|
|
2d6102 |
+ if (buff[8] & 0x80) {
|
|
|
2d6102 |
+ printf(" Target Port Group Data (This controller):\n");
|
|
|
2d6102 |
+ decode_rdac_vpd_c9_rtpg_data(buff[10], buff[11]);
|
|
|
2d6102 |
+
|
|
|
2d6102 |
+ printf(" Target Port Group Data (Alternate controller):\n");
|
|
|
2d6102 |
+ decode_rdac_vpd_c9_rtpg_data(buff[12], buff[13]);
|
|
|
2d6102 |
}
|
|
|
2d6102 |
|
|
|
2d6102 |
return;
|
|
|
2d6102 |
diff --git a/src/sg_rdac.c b/src/sg_rdac.c
|
|
|
2d6102 |
index 41ec544..ea243a2 100644
|
|
|
2d6102 |
--- a/src/sg_rdac.c
|
|
|
2d6102 |
+++ b/src/sg_rdac.c
|
|
|
2d6102 |
@@ -28,12 +28,20 @@
|
|
|
2d6102 |
static const char * version_str = "1.06 20130507";
|
|
|
2d6102 |
|
|
|
2d6102 |
unsigned char mode6_hdr[] = {
|
|
|
2d6102 |
- 75, /* Length */
|
|
|
2d6102 |
+ 0x75, /* Length */
|
|
|
2d6102 |
0, /* medium */
|
|
|
2d6102 |
0, /* params */
|
|
|
2d6102 |
8, /* Block descriptor length */
|
|
|
2d6102 |
};
|
|
|
2d6102 |
|
|
|
2d6102 |
+unsigned char mode10_hdr[] = {
|
|
|
2d6102 |
+ 0x01, 0x18, /* Length */
|
|
|
2d6102 |
+ 0, /* medium */
|
|
|
2d6102 |
+ 0, /* params */
|
|
|
2d6102 |
+ 0, 0, /* reserved */
|
|
|
2d6102 |
+ 0, 0, /* block descriptor length */
|
|
|
2d6102 |
+};
|
|
|
2d6102 |
+
|
|
|
2d6102 |
unsigned char block_descriptor[] = {
|
|
|
2d6102 |
0, /* Density code */
|
|
|
2d6102 |
0, 0, 0, /* Number of blocks */
|
|
|
2d6102 |
@@ -41,22 +49,35 @@ unsigned char block_descriptor[] = {
|
|
|
2d6102 |
0, 0x02, 0, /* 512 byte blocks */
|
|
|
2d6102 |
};
|
|
|
2d6102 |
|
|
|
2d6102 |
-struct rdac_legacy_page {
|
|
|
2d6102 |
- unsigned char page_code;
|
|
|
2d6102 |
- unsigned char page_length;
|
|
|
2d6102 |
- char current_serial[16];
|
|
|
2d6102 |
- char alternate_serial[16];
|
|
|
2d6102 |
+struct rdac_page_common {
|
|
|
2d6102 |
+ unsigned char current_serial[16];
|
|
|
2d6102 |
+ unsigned char alternate_serial[16];
|
|
|
2d6102 |
unsigned char current_mode_msb;
|
|
|
2d6102 |
unsigned char current_mode_lsb;
|
|
|
2d6102 |
unsigned char alternate_mode_msb;
|
|
|
2d6102 |
unsigned char alternate_mode_lsb;
|
|
|
2d6102 |
unsigned char quiescence;
|
|
|
2d6102 |
unsigned char options;
|
|
|
2d6102 |
+};
|
|
|
2d6102 |
+
|
|
|
2d6102 |
+struct rdac_legacy_page {
|
|
|
2d6102 |
+ unsigned char page_code;
|
|
|
2d6102 |
+ unsigned char page_length;
|
|
|
2d6102 |
+ struct rdac_page_common attr;
|
|
|
2d6102 |
unsigned char lun_table[32];
|
|
|
2d6102 |
unsigned char lun_table_exp[32];
|
|
|
2d6102 |
unsigned short reserved;
|
|
|
2d6102 |
};
|
|
|
2d6102 |
|
|
|
2d6102 |
+struct rdac_expanded_page {
|
|
|
2d6102 |
+ unsigned char page_code;
|
|
|
2d6102 |
+ unsigned char subpage_code;
|
|
|
2d6102 |
+ unsigned char page_length[2];
|
|
|
2d6102 |
+ struct rdac_page_common attr;
|
|
|
2d6102 |
+ unsigned char lun_table[256];
|
|
|
2d6102 |
+ unsigned char reserved[2];
|
|
|
2d6102 |
+};
|
|
|
2d6102 |
+
|
|
|
2d6102 |
static int do_verbose = 0;
|
|
|
2d6102 |
|
|
|
2d6102 |
static void dump_mode_page( unsigned char *page, int len )
|
|
|
2d6102 |
@@ -83,30 +104,52 @@ static void dump_mode_page( unsigned char *page, int len )
|
|
|
2d6102 |
#define RDAC_CONTROLLER_PAGE_LEN 0x68
|
|
|
2d6102 |
#define LEGACY_PAGE 0x00
|
|
|
2d6102 |
#define EXPANDED_LUN_SPACE_PAGE 0x01
|
|
|
2d6102 |
+#define EXPANDED_LUN_SPACE_PAGE_LEN 0x128
|
|
|
2d6102 |
#define RDAC_FAIL_ALL_PATHS 0x1
|
|
|
2d6102 |
#define RDAC_FAIL_SELECTED_PATHS 0x2
|
|
|
2d6102 |
#define RDAC_FORCE_QUIESCENCE 0x2
|
|
|
2d6102 |
#define RDAC_QUIESCENCE_TIME 10
|
|
|
2d6102 |
|
|
|
2d6102 |
-static int fail_all_paths(int fd)
|
|
|
2d6102 |
+static int fail_all_paths(int fd, int use_6_byte)
|
|
|
2d6102 |
{
|
|
|
2d6102 |
- unsigned char fail_paths_pg[118];
|
|
|
2d6102 |
+ unsigned char fail_paths_pg[308];
|
|
|
2d6102 |
struct rdac_legacy_page *rdac_page;
|
|
|
2d6102 |
+ struct rdac_expanded_page *rdac_page_exp;
|
|
|
2d6102 |
+ struct rdac_page_common *rdac_common = NULL;
|
|
|
2d6102 |
+
|
|
|
2d6102 |
int res;
|
|
|
2d6102 |
|
|
|
2d6102 |
- memset(fail_paths_pg, 0, 118);
|
|
|
2d6102 |
- memcpy(fail_paths_pg, mode6_hdr, 4);
|
|
|
2d6102 |
- memcpy(fail_paths_pg + 4, block_descriptor, 8);
|
|
|
2d6102 |
- rdac_page = (struct rdac_legacy_page *)(fail_paths_pg + 4 + 8);
|
|
|
2d6102 |
- rdac_page->page_code = RDAC_CONTROLLER_PAGE | 0x40;
|
|
|
2d6102 |
- rdac_page->page_length = RDAC_CONTROLLER_PAGE_LEN;
|
|
|
2d6102 |
- rdac_page->quiescence = RDAC_QUIESCENCE_TIME;
|
|
|
2d6102 |
- rdac_page->options = RDAC_FORCE_QUIESCENCE;
|
|
|
2d6102 |
- rdac_page->current_mode_lsb = RDAC_FAIL_ALL_PATHS;
|
|
|
2d6102 |
+ memset(fail_paths_pg, 0, 308);
|
|
|
2d6102 |
+ if (use_6_byte) {
|
|
|
2d6102 |
+ memcpy(fail_paths_pg, mode6_hdr, 4);
|
|
|
2d6102 |
+ memcpy(fail_paths_pg + 4, block_descriptor, 8);
|
|
|
2d6102 |
+ rdac_page = (struct rdac_legacy_page *)(fail_paths_pg + 4 + 8);
|
|
|
2d6102 |
+ rdac_page->page_code = RDAC_CONTROLLER_PAGE;
|
|
|
2d6102 |
+ rdac_page->page_length = RDAC_CONTROLLER_PAGE_LEN;
|
|
|
2d6102 |
+ rdac_common = &rdac_page->attr;
|
|
|
2d6102 |
+ } else {
|
|
|
2d6102 |
+ memcpy(fail_paths_pg, mode10_hdr, 8);
|
|
|
2d6102 |
+ rdac_page_exp = (struct rdac_expanded_page *)(fail_paths_pg + 8);
|
|
|
2d6102 |
+ rdac_page_exp->page_code = RDAC_CONTROLLER_PAGE | 0x40;
|
|
|
2d6102 |
+ rdac_page_exp->subpage_code = 0x1;
|
|
|
2d6102 |
+ rdac_page_exp->page_length[0] = EXPANDED_LUN_SPACE_PAGE_LEN >> 8;
|
|
|
2d6102 |
+ rdac_page_exp->page_length[1] = EXPANDED_LUN_SPACE_PAGE_LEN & 0xFF;
|
|
|
2d6102 |
+ rdac_common = &rdac_page_exp->attr;
|
|
|
2d6102 |
+ }
|
|
|
2d6102 |
|
|
|
2d6102 |
- res = sg_ll_mode_select6(fd, 1 /* pf */, 0 /* sp */,
|
|
|
2d6102 |
- fail_paths_pg, 118,
|
|
|
2d6102 |
- 1, (do_verbose ? 2 : 0));
|
|
|
2d6102 |
+ rdac_common->current_mode_lsb = RDAC_FAIL_ALL_PATHS;
|
|
|
2d6102 |
+ rdac_common->quiescence = RDAC_QUIESCENCE_TIME;
|
|
|
2d6102 |
+ rdac_common->options = RDAC_FORCE_QUIESCENCE;
|
|
|
2d6102 |
+
|
|
|
2d6102 |
+ if (use_6_byte) {
|
|
|
2d6102 |
+ res = sg_ll_mode_select6(fd, 1 /* pf */, 0 /* sp */,
|
|
|
2d6102 |
+ fail_paths_pg, 118,
|
|
|
2d6102 |
+ 1, (do_verbose ? 2 : 0));
|
|
|
2d6102 |
+ } else {
|
|
|
2d6102 |
+ res = sg_ll_mode_select10(fd, 1 /* pf */, 0 /* sp */,
|
|
|
2d6102 |
+ fail_paths_pg, 308,
|
|
|
2d6102 |
+ 1, (do_verbose ? 2: 0));
|
|
|
2d6102 |
+ }
|
|
|
2d6102 |
|
|
|
2d6102 |
switch (res) {
|
|
|
2d6102 |
case 0:
|
|
|
2d6102 |
@@ -137,27 +180,54 @@ static int fail_all_paths(int fd)
|
|
|
2d6102 |
return res;
|
|
|
2d6102 |
}
|
|
|
2d6102 |
|
|
|
2d6102 |
-static int fail_this_path(int fd, int lun)
|
|
|
2d6102 |
+static int fail_this_path(int fd, int lun, int use_6_byte)
|
|
|
2d6102 |
{
|
|
|
2d6102 |
- unsigned char fail_paths_pg[118];
|
|
|
2d6102 |
+ unsigned char fail_paths_pg[308];
|
|
|
2d6102 |
struct rdac_legacy_page *rdac_page;
|
|
|
2d6102 |
+ struct rdac_expanded_page *rdac_page_exp;
|
|
|
2d6102 |
+ struct rdac_page_common *rdac_common = NULL;
|
|
|
2d6102 |
int res;
|
|
|
2d6102 |
|
|
|
2d6102 |
- memset(fail_paths_pg, 0, 118);
|
|
|
2d6102 |
- memcpy(fail_paths_pg, mode6_hdr, 4);
|
|
|
2d6102 |
- memcpy(fail_paths_pg + 4, block_descriptor, 8);
|
|
|
2d6102 |
- rdac_page = (struct rdac_legacy_page *)(fail_paths_pg + 4 + 8);
|
|
|
2d6102 |
- rdac_page->page_code = RDAC_CONTROLLER_PAGE | 0x40;
|
|
|
2d6102 |
- rdac_page->page_length = RDAC_CONTROLLER_PAGE_LEN;
|
|
|
2d6102 |
- rdac_page->current_mode_lsb = RDAC_FAIL_SELECTED_PATHS;
|
|
|
2d6102 |
- rdac_page->quiescence = RDAC_QUIESCENCE_TIME;
|
|
|
2d6102 |
- rdac_page->options = RDAC_FORCE_QUIESCENCE;
|
|
|
2d6102 |
- memset(rdac_page->lun_table, 0x0, 32);
|
|
|
2d6102 |
- rdac_page->lun_table[lun] = 0x81;
|
|
|
2d6102 |
-
|
|
|
2d6102 |
- res = sg_ll_mode_select6(fd, 1 /* pf */, 0 /* sp */,
|
|
|
2d6102 |
- fail_paths_pg, 118,
|
|
|
2d6102 |
- 1, (do_verbose ? 2 : 0));
|
|
|
2d6102 |
+ if (use_6_byte && lun > 32) {
|
|
|
2d6102 |
+ fprintf(stderr, "must use 10 byte cdb to fail luns over 32\n");
|
|
|
2d6102 |
+ return -1;
|
|
|
2d6102 |
+ }
|
|
|
2d6102 |
+
|
|
|
2d6102 |
+ memset(fail_paths_pg, 0, 308);
|
|
|
2d6102 |
+ if (use_6_byte) {
|
|
|
2d6102 |
+ memcpy(fail_paths_pg, mode6_hdr, 4);
|
|
|
2d6102 |
+ memcpy(fail_paths_pg + 4, block_descriptor, 8);
|
|
|
2d6102 |
+ rdac_page = (struct rdac_legacy_page *)(fail_paths_pg + 4 + 8);
|
|
|
2d6102 |
+ rdac_page->page_code = RDAC_CONTROLLER_PAGE;
|
|
|
2d6102 |
+ rdac_page->page_length = RDAC_CONTROLLER_PAGE_LEN;
|
|
|
2d6102 |
+ rdac_common = &rdac_page->attr;
|
|
|
2d6102 |
+ memset(rdac_page->lun_table, 0x0, 32);
|
|
|
2d6102 |
+ rdac_page->lun_table[lun] = 0x81;
|
|
|
2d6102 |
+ } else {
|
|
|
2d6102 |
+ memcpy(fail_paths_pg, mode10_hdr, 8);
|
|
|
2d6102 |
+ rdac_page_exp = (struct rdac_expanded_page *)(fail_paths_pg + 8);
|
|
|
2d6102 |
+ rdac_page_exp->page_code = RDAC_CONTROLLER_PAGE | 0x40;
|
|
|
2d6102 |
+ rdac_page_exp->subpage_code = 0x1;
|
|
|
2d6102 |
+ rdac_page_exp->page_length[0] = EXPANDED_LUN_SPACE_PAGE_LEN >> 8;
|
|
|
2d6102 |
+ rdac_page_exp->page_length[1] = EXPANDED_LUN_SPACE_PAGE_LEN & 0xFF;
|
|
|
2d6102 |
+ rdac_common = &rdac_page_exp->attr;
|
|
|
2d6102 |
+ memset(rdac_page_exp->lun_table, 0x0, 256);
|
|
|
2d6102 |
+ rdac_page_exp->lun_table[lun] = 0x81;
|
|
|
2d6102 |
+ }
|
|
|
2d6102 |
+
|
|
|
2d6102 |
+ rdac_common->current_mode_lsb = RDAC_FAIL_SELECTED_PATHS;
|
|
|
2d6102 |
+ rdac_common->quiescence = RDAC_QUIESCENCE_TIME;
|
|
|
2d6102 |
+ rdac_common->options = RDAC_FORCE_QUIESCENCE;
|
|
|
2d6102 |
+
|
|
|
2d6102 |
+ if (use_6_byte) {
|
|
|
2d6102 |
+ res = sg_ll_mode_select6(fd, 1 /* pf */, 0 /* sp */,
|
|
|
2d6102 |
+ fail_paths_pg, 118,
|
|
|
2d6102 |
+ 1, (do_verbose ? 2 : 0));
|
|
|
2d6102 |
+ } else {
|
|
|
2d6102 |
+ res = sg_ll_mode_select10(fd, 1 /* pf */, 0 /* sp */,
|
|
|
2d6102 |
+ fail_paths_pg, 308,
|
|
|
2d6102 |
+ 1, (do_verbose ? 2: 0));
|
|
|
2d6102 |
+ }
|
|
|
2d6102 |
|
|
|
2d6102 |
switch (res) {
|
|
|
2d6102 |
case 0:
|
|
|
2d6102 |
@@ -189,16 +259,29 @@ static int fail_this_path(int fd, int lun)
|
|
|
2d6102 |
return res;
|
|
|
2d6102 |
}
|
|
|
2d6102 |
|
|
|
2d6102 |
-static void print_rdac_mode( unsigned char *ptr )
|
|
|
2d6102 |
+static void print_rdac_mode( unsigned char *ptr, int subpg)
|
|
|
2d6102 |
{
|
|
|
2d6102 |
- struct rdac_legacy_page *rdac_ptr;
|
|
|
2d6102 |
- int i, k, bd_len;
|
|
|
2d6102 |
-
|
|
|
2d6102 |
- bd_len = ptr[3];
|
|
|
2d6102 |
-
|
|
|
2d6102 |
- rdac_ptr = (struct rdac_legacy_page *)(ptr + 4 + bd_len);
|
|
|
2d6102 |
+ struct rdac_legacy_page *legacy;
|
|
|
2d6102 |
+ struct rdac_expanded_page *expanded;
|
|
|
2d6102 |
+ struct rdac_page_common *rdac_ptr = NULL;
|
|
|
2d6102 |
+ unsigned char * lun_table = NULL;
|
|
|
2d6102 |
+ int i, k, bd_len, lun_table_len;
|
|
|
2d6102 |
+
|
|
|
2d6102 |
+ if (subpg == 1) {
|
|
|
2d6102 |
+ bd_len = ptr[7];
|
|
|
2d6102 |
+ expanded = (struct rdac_expanded_page *)(ptr + 8 + bd_len);
|
|
|
2d6102 |
+ rdac_ptr = &expanded->attr;
|
|
|
2d6102 |
+ lun_table = expanded->lun_table;
|
|
|
2d6102 |
+ lun_table_len = 256;
|
|
|
2d6102 |
+ } else {
|
|
|
2d6102 |
+ bd_len = ptr[3];
|
|
|
2d6102 |
+ legacy = (struct rdac_legacy_page *)(ptr + 4 + bd_len);
|
|
|
2d6102 |
+ rdac_ptr = &legacy->attr;
|
|
|
2d6102 |
+ lun_table = legacy->lun_table;
|
|
|
2d6102 |
+ lun_table_len = 32;
|
|
|
2d6102 |
+ }
|
|
|
2d6102 |
|
|
|
2d6102 |
- printf("RDAC Legacy page\n");
|
|
|
2d6102 |
+ printf("RDAC %s page\n", (subpg == 1) ? "Expanded" : "Legacy");
|
|
|
2d6102 |
printf(" Controller serial: %s\n",
|
|
|
2d6102 |
rdac_ptr->current_serial);
|
|
|
2d6102 |
printf(" Alternate controller serial: %s\n",
|
|
|
2d6102 |
@@ -239,9 +322,6 @@ static void print_rdac_mode( unsigned char *ptr )
|
|
|
2d6102 |
case 0x01:
|
|
|
2d6102 |
printf("alternate controller present; ");
|
|
|
2d6102 |
break;
|
|
|
2d6102 |
- case 0x02:
|
|
|
2d6102 |
- printf("active/active mode; ");
|
|
|
2d6102 |
- break;
|
|
|
2d6102 |
default:
|
|
|
2d6102 |
printf("(Unknown status 0x%x); ",
|
|
|
2d6102 |
rdac_ptr->alternate_mode_msb);
|
|
|
2d6102 |
@@ -257,7 +337,10 @@ static void print_rdac_mode( unsigned char *ptr )
|
|
|
2d6102 |
case 0x2:
|
|
|
2d6102 |
printf("Dual active mode\n");
|
|
|
2d6102 |
break;
|
|
|
2d6102 |
- case 0x04:
|
|
|
2d6102 |
+ case 0x3:
|
|
|
2d6102 |
+ printf("Not present\n");
|
|
|
2d6102 |
+ break;
|
|
|
2d6102 |
+ case 0x4:
|
|
|
2d6102 |
printf("held in reset\n");
|
|
|
2d6102 |
break;
|
|
|
2d6102 |
default:
|
|
|
2d6102 |
@@ -266,11 +349,14 @@ static void print_rdac_mode( unsigned char *ptr )
|
|
|
2d6102 |
}
|
|
|
2d6102 |
printf(" Quiescence timeout: %d\n", rdac_ptr->quiescence);
|
|
|
2d6102 |
printf(" RDAC option 0x%x\n", rdac_ptr->options);
|
|
|
2d6102 |
- printf (" LUN Table:\n");
|
|
|
2d6102 |
- for (k = 0; k < 32; k += 8) {
|
|
|
2d6102 |
- printf(" %x:",k / 8);
|
|
|
2d6102 |
- for (i = 0; i < 8; i++) {
|
|
|
2d6102 |
- switch (rdac_ptr->lun_table[k + i]) {
|
|
|
2d6102 |
+ printf(" ALUA: %s\n", (rdac_ptr->options & 0x4 ? "Enabled" : "Disabled" ));
|
|
|
2d6102 |
+ printf(" Force Quiescence: %s\n", (rdac_ptr->options & 0x2 ? "Enabled" : "Disabled" ));
|
|
|
2d6102 |
+ printf (" LUN Table: (p = preferred, a = alternate, u = utm lun)\n");
|
|
|
2d6102 |
+ printf(" 0 1 2 3 4 5 6 7 8 9 a b c d e f\n");
|
|
|
2d6102 |
+ for (k = 0; k < lun_table_len; k += 16) {
|
|
|
2d6102 |
+ printf(" 0x%x:",k / 16);
|
|
|
2d6102 |
+ for (i = 0; i < 16; i++) {
|
|
|
2d6102 |
+ switch (lun_table[k + i]) {
|
|
|
2d6102 |
case 0x0:
|
|
|
2d6102 |
printf(" x");
|
|
|
2d6102 |
break;
|
|
|
2d6102 |
@@ -287,6 +373,9 @@ static void print_rdac_mode( unsigned char *ptr )
|
|
|
2d6102 |
printf(" ?");
|
|
|
2d6102 |
break;
|
|
|
2d6102 |
}
|
|
|
2d6102 |
+ if (i == 7) {
|
|
|
2d6102 |
+ printf(" ");
|
|
|
2d6102 |
+ }
|
|
|
2d6102 |
}
|
|
|
2d6102 |
printf("\n");
|
|
|
2d6102 |
}
|
|
|
2d6102 |
@@ -296,6 +385,7 @@ static void usage()
|
|
|
2d6102 |
{
|
|
|
2d6102 |
printf("Usage: sg_rdac [-a] [-f=LUN] [-v] [-V] DEVICE\n"
|
|
|
2d6102 |
" where:\n"
|
|
|
2d6102 |
+ " -6 use 6 byte cdbs for mode sense/select\n"
|
|
|
2d6102 |
" -a transfer all devices to the controller\n"
|
|
|
2d6102 |
" serving DEVICE.\n"
|
|
|
2d6102 |
" -f=LUN transfer the device at LUN to the\n"
|
|
|
2d6102 |
@@ -316,6 +406,7 @@ int main(int argc, char * argv[])
|
|
|
2d6102 |
int fail_all = 0;
|
|
|
2d6102 |
int fail_path = 0;
|
|
|
2d6102 |
int ret = 0;
|
|
|
2d6102 |
+ int use_6_byte = 0;
|
|
|
2d6102 |
|
|
|
2d6102 |
if (argc < 2) {
|
|
|
2d6102 |
usage ();
|
|
|
2d6102 |
@@ -333,6 +424,9 @@ int main(int argc, char * argv[])
|
|
|
2d6102 |
else if (!strcmp(*argptr, "-a")) {
|
|
|
2d6102 |
++fail_all;
|
|
|
2d6102 |
}
|
|
|
2d6102 |
+ else if (!strcmp(*argptr, "-6")) {
|
|
|
2d6102 |
+ use_6_byte = 1;
|
|
|
2d6102 |
+ }
|
|
|
2d6102 |
else if (!strcmp(*argptr, "-V")) {
|
|
|
2d6102 |
fprintf(stderr, "sg_rdac version: %s\n", version_str);
|
|
|
2d6102 |
return 0;
|
|
|
2d6102 |
@@ -364,18 +458,24 @@ int main(int argc, char * argv[])
|
|
|
2d6102 |
}
|
|
|
2d6102 |
|
|
|
2d6102 |
if (fail_all) {
|
|
|
2d6102 |
- res = fail_all_paths(fd);
|
|
|
2d6102 |
+ res = fail_all_paths(fd, use_6_byte);
|
|
|
2d6102 |
} else if (fail_path) {
|
|
|
2d6102 |
- res = fail_this_path(fd, lun);
|
|
|
2d6102 |
+ res = fail_this_path(fd, lun, use_6_byte);
|
|
|
2d6102 |
} else {
|
|
|
2d6102 |
- res = sg_ll_mode_sense6(fd, /*DBD*/ 0, /* page control */0,
|
|
|
2d6102 |
+ if (use_6_byte) {
|
|
|
2d6102 |
+ res = sg_ll_mode_sense6(fd, /*DBD*/ 0, /* page control */0,
|
|
|
2d6102 |
0x2c, 0, rsp_buff, 252,
|
|
|
2d6102 |
1, do_verbose);
|
|
|
2d6102 |
+ } else {
|
|
|
2d6102 |
+ res = sg_ll_mode_sense10(fd, /*llbaa*/ 0, /*DBD*/ 0, /* page control */0,
|
|
|
2d6102 |
+ 0x2c, 0x1, rsp_buff, 308,
|
|
|
2d6102 |
+ 1, do_verbose);
|
|
|
2d6102 |
+ }
|
|
|
2d6102 |
|
|
|
2d6102 |
if (!res) {
|
|
|
2d6102 |
if (do_verbose)
|
|
|
2d6102 |
dump_mode_page(rsp_buff, rsp_buff[0]);
|
|
|
2d6102 |
- print_rdac_mode(rsp_buff);
|
|
|
2d6102 |
+ print_rdac_mode(rsp_buff, !use_6_byte);
|
|
|
2d6102 |
}
|
|
|
2d6102 |
}
|
|
|
2d6102 |
ret = res;
|
|
|
2d6102 |
diff --git a/src/sg_vpd_vendor.c b/src/sg_vpd_vendor.c
|
|
|
2d6102 |
index 10d455a..45e2b9d 100644
|
|
|
2d6102 |
--- a/src/sg_vpd_vendor.c
|
|
|
2d6102 |
+++ b/src/sg_vpd_vendor.c
|
|
|
2d6102 |
@@ -89,20 +89,20 @@ static struct svpd_values_name_t vendor_vpd_pg[] = {
|
|
|
2d6102 |
{VPD_V_DEV_BEH_SEA, 0, -1, 1, "devb", "Device behavior (Seagate)"},
|
|
|
2d6102 |
{VPD_V_EDID_RDAC, 0, -1, 1, "edid", "Extended device identification "
|
|
|
2d6102 |
"(RDAC)"},
|
|
|
2d6102 |
- {VPD_V_FEAT_RDAC, 1, -1, 1, "feat", "Feature Parameters (RDAC)"},
|
|
|
2d6102 |
+ {VPD_V_FEAT_RDAC, 1, -1, 1, "prm4", "Feature Parameters (RDAC)"},
|
|
|
2d6102 |
{VPD_V_FIRM_SEA, 0, -1, 1, "firm", "Firmware numbers (Seagate)"},
|
|
|
2d6102 |
- {VPD_V_FVER_RDAC, 1, -1, 1, "fver", "Firmware version (RDAC)"},
|
|
|
2d6102 |
+ {VPD_V_FVER_RDAC, 1, -1, 1, "fwr4", "Firmware version (RDAC)"},
|
|
|
2d6102 |
{VPD_V_HP3PAR, 2, -1, 1, "hp3par", "Volume information (HP/3PAR)"},
|
|
|
2d6102 |
- {VPD_V_HVER_RDAC, 3, -1, 1, "hver", "Hardware version (RDAC)"},
|
|
|
2d6102 |
+ {VPD_V_HVER_RDAC, 3, -1, 1, "hwr4", "Hardware version (RDAC)"},
|
|
|
2d6102 |
{VPD_V_JUMP_SEA, 0, -1, 1, "jump", "Jump setting (Seagate)"},
|
|
|
2d6102 |
{VPD_V_RVSI_RDAC, 0, -1, 1, "rvsi", "Replicated volume source "
|
|
|
2d6102 |
"identifier (RDAC)"},
|
|
|
2d6102 |
{VPD_V_SAID_RDAC, 0, -1, 1, "said", "Storage array world wide name "
|
|
|
2d6102 |
"(RDAC)"},
|
|
|
2d6102 |
- {VPD_V_SUBS_RDAC, 0, -1, 1, "sub", "Subsystem identifier (RDAC)"},
|
|
|
2d6102 |
- {VPD_V_SVER_RDAC, 1, -1, 1, "sver", "Software version (RDAC)"},
|
|
|
2d6102 |
+ {VPD_V_SUBS_RDAC, 0, -1, 1, "subs", "Subsystem identifier (RDAC)"},
|
|
|
2d6102 |
+ {VPD_V_SVER_RDAC, 1, -1, 1, "swr4", "Software version (RDAC)"},
|
|
|
2d6102 |
{VPD_V_UPR_EMC, 1, -1, 1, "upr", "Unit path report (EMC)"},
|
|
|
2d6102 |
- {VPD_V_VAC_RDAC, 0, -1, 1, "vac", "Volume access control (RDAC)"},
|
|
|
2d6102 |
+ {VPD_V_VAC_RDAC, 0, -1, 1, "vac1", "Volume access control (RDAC)"},
|
|
|
2d6102 |
{0, 0, 0, 0, NULL, NULL},
|
|
|
2d6102 |
};
|
|
|
2d6102 |
|
|
|
2d6102 |
@@ -439,7 +439,7 @@ decode_rdac_vpd_c0(unsigned char * buff, int len)
|
|
|
2d6102 |
memcpy(name, buff + 152, 2);
|
|
|
2d6102 |
printf(" Board Revision: %s\n", name);
|
|
|
2d6102 |
memset(name, 0, 65);
|
|
|
2d6102 |
- memcpy(name, buff + 154, 2);
|
|
|
2d6102 |
+ memcpy(name, buff + 154, 4);
|
|
|
2d6102 |
printf(" Board Identifier: %s\n", name);
|
|
|
2d6102 |
|
|
|
2d6102 |
return;
|
|
|
2d6102 |
@@ -461,7 +461,7 @@ decode_rdac_vpd_c1(unsigned char * buff, int len)
|
|
|
2d6102 |
"not possible.\n" , buff[4], buff[5], buff[6], buff[7]);
|
|
|
2d6102 |
return;
|
|
|
2d6102 |
}
|
|
|
2d6102 |
- printf(" Firmware Version: %x.%x.%x\n", buff[8], buff[9], buff[10]);
|
|
|
2d6102 |
+ printf(" Firmware Version: %02x.%02x.%02x\n", buff[8], buff[9], buff[10]);
|
|
|
2d6102 |
printf(" Firmware Date: %02d/%02d/%02d\n", buff[11], buff[12], buff[13]);
|
|
|
2d6102 |
|
|
|
2d6102 |
num_part = (len - 12) / 16;
|
|
|
2d6102 |
@@ -504,7 +504,7 @@ decode_rdac_vpd_c2(unsigned char * buff, int len)
|
|
|
2d6102 |
"not possible.\n" , buff[4], buff[5], buff[6], buff[7]);
|
|
|
2d6102 |
return;
|
|
|
2d6102 |
}
|
|
|
2d6102 |
- printf(" Software Version: %x.%x.%x\n", buff[8], buff[9], buff[10]);
|
|
|
2d6102 |
+ printf(" Software Version: %02x.%02x.%02x\n", buff[8], buff[9], buff[10]);
|
|
|
2d6102 |
printf(" Software Date: %02d/%02d/%02d\n", buff[11], buff[12], buff[13]);
|
|
|
2d6102 |
printf(" Features:");
|
|
|
2d6102 |
if (buff[14] & 0x01)
|
|
|
2d6102 |
@@ -514,9 +514,9 @@ decode_rdac_vpd_c2(unsigned char * buff, int len)
|
|
|
2d6102 |
if (buff[14] & 0x04)
|
|
|
2d6102 |
printf(" Multiple Sub-enclosures,");
|
|
|
2d6102 |
if (buff[14] & 0x08)
|
|
|
2d6102 |
- printf(" DCE/DRM,");
|
|
|
2d6102 |
+ printf(" DCE/DRM/DSS/DVE,");
|
|
|
2d6102 |
if (buff[14] & 0x10)
|
|
|
2d6102 |
- printf(" AVT,");
|
|
|
2d6102 |
+ printf(" Asymmetric Logical Unit Access,");
|
|
|
2d6102 |
printf("\n");
|
|
|
2d6102 |
printf(" Max. #of LUNS: %d\n", buff[15]);
|
|
|
2d6102 |
|
|
|
2d6102 |
@@ -562,6 +562,7 @@ decode_rdac_vpd_c3(unsigned char * buff, int len)
|
|
|
2d6102 |
printf(" UTM: %s\n", buff[11] & 0x80?"enabled":"disabled");
|
|
|
2d6102 |
if ((buff[11] & 0x80))
|
|
|
2d6102 |
printf(" UTM LUN: %02x\n", buff[11] & 0x7f);
|
|
|
2d6102 |
+ printf(" Persistent Reservations Bus Reset Support: %s\n", buff[12] & 0x01?"enabled":"disabled");
|
|
|
2d6102 |
|
|
|
2d6102 |
return;
|
|
|
2d6102 |
}
|
|
|
2d6102 |
@@ -603,6 +604,32 @@ decode_rdac_vpd_c4(unsigned char * buff, int len)
|
|
|
2d6102 |
printf(" (Board ID 2880)\n");
|
|
|
2d6102 |
else if (!strcmp(subsystem_rev, "14.0"))
|
|
|
2d6102 |
printf(" (Board ID 2822)\n");
|
|
|
2d6102 |
+ else if (!strcmp(subsystem_rev, "15.0"))
|
|
|
2d6102 |
+ printf(" (Board ID 6091)\n");
|
|
|
2d6102 |
+ else if (!strcmp(subsystem_rev, "16.0"))
|
|
|
2d6102 |
+ printf(" (Board ID 3992)\n");
|
|
|
2d6102 |
+ else if (!strcmp(subsystem_rev, "16.1"))
|
|
|
2d6102 |
+ printf(" (Board ID 3991)\n");
|
|
|
2d6102 |
+ else if (!strcmp(subsystem_rev, "17.0"))
|
|
|
2d6102 |
+ printf(" (Board ID 1331)\n");
|
|
|
2d6102 |
+ else if (!strcmp(subsystem_rev, "17.1"))
|
|
|
2d6102 |
+ printf(" (Board ID 1332)\n");
|
|
|
2d6102 |
+ else if (!strcmp(subsystem_rev, "17.3"))
|
|
|
2d6102 |
+ printf(" (Board ID 1532)\n");
|
|
|
2d6102 |
+ else if (!strcmp(subsystem_rev, "17.4"))
|
|
|
2d6102 |
+ printf(" (Board ID 1932)\n");
|
|
|
2d6102 |
+ else if (!strcmp(subsystem_rev, "42.0"))
|
|
|
2d6102 |
+ printf(" (Board ID 26x0)\n");
|
|
|
2d6102 |
+ else if (!strcmp(subsystem_rev, "43.0"))
|
|
|
2d6102 |
+ printf(" (Board ID 498x)\n");
|
|
|
2d6102 |
+ else if (!strcmp(subsystem_rev, "44.0"))
|
|
|
2d6102 |
+ printf(" (Board ID 548x)\n");
|
|
|
2d6102 |
+ else if (!strcmp(subsystem_rev, "45.0"))
|
|
|
2d6102 |
+ printf(" (Board ID 5501)\n");
|
|
|
2d6102 |
+ else if (!strcmp(subsystem_rev, "46.0"))
|
|
|
2d6102 |
+ printf(" (Board ID 2701)\n");
|
|
|
2d6102 |
+ else if (!strcmp(subsystem_rev, "47.0"))
|
|
|
2d6102 |
+ printf(" (Board ID 5601)\n");
|
|
|
2d6102 |
else
|
|
|
2d6102 |
printf(" (Board ID unknown)\n");
|
|
|
2d6102 |
|
|
|
2d6102 |
@@ -612,6 +639,16 @@ decode_rdac_vpd_c4(unsigned char * buff, int len)
|
|
|
2d6102 |
}
|
|
|
2d6102 |
|
|
|
2d6102 |
static void
|
|
|
2d6102 |
+convert_binary_to_ascii(unsigned char * src, unsigned char * dst, int len)
|
|
|
2d6102 |
+{
|
|
|
2d6102 |
+ int i;
|
|
|
2d6102 |
+
|
|
|
2d6102 |
+ for (i = 0; i < len; i++) {
|
|
|
2d6102 |
+ sprintf((char *)(dst+2*i), "%02x", *(src+i));
|
|
|
2d6102 |
+ }
|
|
|
2d6102 |
+}
|
|
|
2d6102 |
+
|
|
|
2d6102 |
+static void
|
|
|
2d6102 |
decode_rdac_vpd_c8(unsigned char * buff, int len)
|
|
|
2d6102 |
{
|
|
|
2d6102 |
int i;
|
|
|
2d6102 |
@@ -623,6 +660,8 @@ decode_rdac_vpd_c8(unsigned char * buff, int len)
|
|
|
2d6102 |
int label_len;
|
|
|
2d6102 |
char uuid[33];
|
|
|
2d6102 |
int uuid_len;
|
|
|
2d6102 |
+ unsigned char port_id[128];
|
|
|
2d6102 |
+ int n;
|
|
|
2d6102 |
|
|
|
2d6102 |
if (len < 0xab) {
|
|
|
2d6102 |
fprintf(stderr, "Extended Device Identification VPD page length too "
|
|
|
2d6102 |
@@ -679,10 +718,110 @@ decode_rdac_vpd_c8(unsigned char * buff, int len)
|
|
|
2d6102 |
|
|
|
2d6102 |
printf(" Logical Unit Number: %s\n", uuid);
|
|
|
2d6102 |
|
|
|
2d6102 |
+ /* Initiator transport ID */
|
|
|
2d6102 |
+ if ( buff[10] & 0x01 ) {
|
|
|
2d6102 |
+ memset(port_id, 0, 128);
|
|
|
2d6102 |
+ printf(" Transport Protocol: ");
|
|
|
2d6102 |
+ switch (buff[175] & 0x0F) {
|
|
|
2d6102 |
+ case TPROTO_FCP: /* FC */
|
|
|
2d6102 |
+ printf("FC\n");
|
|
|
2d6102 |
+ convert_binary_to_ascii(&buff[183], port_id, 8);
|
|
|
2d6102 |
+ n = 199;
|
|
|
2d6102 |
+ break;
|
|
|
2d6102 |
+ case TPROTO_SRP: /* SRP */
|
|
|
2d6102 |
+ printf("SRP\n");
|
|
|
2d6102 |
+ convert_binary_to_ascii(&buff[183], port_id, 8);
|
|
|
2d6102 |
+ n = 199;
|
|
|
2d6102 |
+ break;
|
|
|
2d6102 |
+ case TPROTO_ISCSI: /* iSCSI */
|
|
|
2d6102 |
+ printf("iSCSI\n");
|
|
|
2d6102 |
+ n = (buff[177] << 8) + buff[178];
|
|
|
2d6102 |
+ memcpy(port_id, &buff[179], n);
|
|
|
2d6102 |
+ n = 179 + n;
|
|
|
2d6102 |
+ break;
|
|
|
2d6102 |
+ case TPROTO_SAS: /* SAS */
|
|
|
2d6102 |
+ printf("SAS\n");
|
|
|
2d6102 |
+ convert_binary_to_ascii(&buff[179], port_id, 8);
|
|
|
2d6102 |
+ n = 199;
|
|
|
2d6102 |
+ break;
|
|
|
2d6102 |
+ default:
|
|
|
2d6102 |
+ return; /* Can't continue decoding, so return */
|
|
|
2d6102 |
+ }
|
|
|
2d6102 |
+
|
|
|
2d6102 |
+ printf(" Initiator Port Identifier: %s\n", port_id);
|
|
|
2d6102 |
+ if ( buff[10] & 0x02 ) {
|
|
|
2d6102 |
+ memset(port_id, 0, 128);
|
|
|
2d6102 |
+ memcpy(port_id, &buff[n], 8);
|
|
|
2d6102 |
+ printf(" Supplemental Vendor ID: %s\n", port_id);
|
|
|
2d6102 |
+ }
|
|
|
2d6102 |
+ }
|
|
|
2d6102 |
+
|
|
|
2d6102 |
return;
|
|
|
2d6102 |
}
|
|
|
2d6102 |
|
|
|
2d6102 |
static void
|
|
|
2d6102 |
+decode_rdac_vpd_c9_rtpg_data(unsigned char aas, unsigned char vendor)
|
|
|
2d6102 |
+{
|
|
|
2d6102 |
+ printf(" Asymmetric Access State:");
|
|
|
2d6102 |
+ switch(aas & 0x0F) {
|
|
|
2d6102 |
+ case 0x0:
|
|
|
2d6102 |
+ printf(" Active/Optimized");
|
|
|
2d6102 |
+ break;
|
|
|
2d6102 |
+ case 0x1:
|
|
|
2d6102 |
+ printf(" Active/Non-Optimized");
|
|
|
2d6102 |
+ break;
|
|
|
2d6102 |
+ case 0x2:
|
|
|
2d6102 |
+ printf(" Standby");
|
|
|
2d6102 |
+ break;
|
|
|
2d6102 |
+ case 0x3:
|
|
|
2d6102 |
+ printf(" Unavailable");
|
|
|
2d6102 |
+ break;
|
|
|
2d6102 |
+ case 0xE:
|
|
|
2d6102 |
+ printf(" Offline");
|
|
|
2d6102 |
+ break;
|
|
|
2d6102 |
+ case 0xF:
|
|
|
2d6102 |
+ printf(" Transitioning");
|
|
|
2d6102 |
+ break;
|
|
|
2d6102 |
+ default:
|
|
|
2d6102 |
+ printf(" (unknown)");
|
|
|
2d6102 |
+ break;
|
|
|
2d6102 |
+ }
|
|
|
2d6102 |
+ printf("\n");
|
|
|
2d6102 |
+
|
|
|
2d6102 |
+ printf(" Vendor Specific Field:");
|
|
|
2d6102 |
+ switch(vendor) {
|
|
|
2d6102 |
+ case 0x01:
|
|
|
2d6102 |
+ printf(" Operating normally");
|
|
|
2d6102 |
+ break;
|
|
|
2d6102 |
+ case 0x02:
|
|
|
2d6102 |
+ printf(" Non-responsive to queries");
|
|
|
2d6102 |
+ break;
|
|
|
2d6102 |
+ case 0x03:
|
|
|
2d6102 |
+ printf(" Controller being held in reset");
|
|
|
2d6102 |
+ break;
|
|
|
2d6102 |
+ case 0x04:
|
|
|
2d6102 |
+ printf(" Performing controller firmware download (1st controller)");
|
|
|
2d6102 |
+ break;
|
|
|
2d6102 |
+ case 0x05:
|
|
|
2d6102 |
+ printf(" Performing controller firmware download (2nd controller)");
|
|
|
2d6102 |
+ break;
|
|
|
2d6102 |
+ case 0x06:
|
|
|
2d6102 |
+ printf(" Quiesced as a result of an administrative request");
|
|
|
2d6102 |
+ break;
|
|
|
2d6102 |
+ case 0x07:
|
|
|
2d6102 |
+ printf(" Service mode as a result of an administrative request");
|
|
|
2d6102 |
+ break;
|
|
|
2d6102 |
+ case 0xFF:
|
|
|
2d6102 |
+ printf(" Details are not available");
|
|
|
2d6102 |
+ break;
|
|
|
2d6102 |
+ default:
|
|
|
2d6102 |
+ printf(" (unknown)");
|
|
|
2d6102 |
+ break;
|
|
|
2d6102 |
+ }
|
|
|
2d6102 |
+ printf("\n");
|
|
|
2d6102 |
+}
|
|
|
2d6102 |
+
|
|
|
2d6102 |
+static void
|
|
|
2d6102 |
decode_rdac_vpd_c9(unsigned char * buff, int len)
|
|
|
2d6102 |
{
|
|
|
2d6102 |
if (len < 3) {
|
|
|
2d6102 |
@@ -699,14 +838,18 @@ decode_rdac_vpd_c9(unsigned char * buff, int len)
|
|
|
2d6102 |
fprintf(stderr, "Invalid page version '%c' (should be 1)\n",
|
|
|
2d6102 |
buff[7]);
|
|
|
2d6102 |
}
|
|
|
2d6102 |
- printf(" AVT:");
|
|
|
2d6102 |
- if (buff[8] & 0x80) {
|
|
|
2d6102 |
- printf(" Enabled");
|
|
|
2d6102 |
- if (buff[8] & 0x40)
|
|
|
2d6102 |
- printf(" (Allow reads on sector 0)");
|
|
|
2d6102 |
- printf("\n");
|
|
|
2d6102 |
+ if ( (buff[8] & 0xE0) == 0xE0 ) {
|
|
|
2d6102 |
+ printf(" IOShipping (ALUA): Enabled\n");
|
|
|
2d6102 |
} else {
|
|
|
2d6102 |
- printf(" Disabled\n");
|
|
|
2d6102 |
+ printf(" AVT:");
|
|
|
2d6102 |
+ if (buff[8] & 0x80) {
|
|
|
2d6102 |
+ printf(" Enabled");
|
|
|
2d6102 |
+ if (buff[8] & 0x40)
|
|
|
2d6102 |
+ printf(" (Allow reads on sector 0)");
|
|
|
2d6102 |
+ printf("\n");
|
|
|
2d6102 |
+ } else {
|
|
|
2d6102 |
+ printf(" Disabled\n");
|
|
|
2d6102 |
+ }
|
|
|
2d6102 |
}
|
|
|
2d6102 |
printf(" Volume Access via: ");
|
|
|
2d6102 |
if (buff[8] & 0x01)
|
|
|
2d6102 |
@@ -714,8 +857,54 @@ decode_rdac_vpd_c9(unsigned char * buff, int len)
|
|
|
2d6102 |
else
|
|
|
2d6102 |
printf("alternate controller\n");
|
|
|
2d6102 |
|
|
|
2d6102 |
- printf(" Path priority: %d ", buff[9] & 0xf);
|
|
|
2d6102 |
- switch(buff[9] & 0xf) {
|
|
|
2d6102 |
+ if (buff[8] & 0x08) {
|
|
|
2d6102 |
+ printf(" Path priority: %d ", buff[15] & 0xf);
|
|
|
2d6102 |
+ switch(buff[15] & 0xf) {
|
|
|
2d6102 |
+ case 0x1:
|
|
|
2d6102 |
+ printf("(preferred path)\n");
|
|
|
2d6102 |
+ break;
|
|
|
2d6102 |
+ case 0x2:
|
|
|
2d6102 |
+ printf("(secondary path)\n");
|
|
|
2d6102 |
+ break;
|
|
|
2d6102 |
+ default:
|
|
|
2d6102 |
+ printf("(unknown)\n");
|
|
|
2d6102 |
+ break;
|
|
|
2d6102 |
+ }
|
|
|
2d6102 |
+
|
|
|
2d6102 |
+ printf(" Preferred Path Auto Changeable:");
|
|
|
2d6102 |
+ switch(buff[14] & 0x3C) {
|
|
|
2d6102 |
+ case 0x14:
|
|
|
2d6102 |
+ printf(" No (User Disabled and Host Type Restricted)\n");
|
|
|
2d6102 |
+ break;
|
|
|
2d6102 |
+ case 0x18:
|
|
|
2d6102 |
+ printf(" No (User Disabled)\n");
|
|
|
2d6102 |
+ break;
|
|
|
2d6102 |
+ case 0x24:
|
|
|
2d6102 |
+ printf(" No (Host Type Restricted)\n");
|
|
|
2d6102 |
+ break;
|
|
|
2d6102 |
+ case 0x28:
|
|
|
2d6102 |
+ printf(" Yes\n");
|
|
|
2d6102 |
+ break;
|
|
|
2d6102 |
+ default:
|
|
|
2d6102 |
+ printf(" (Unknown)\n");
|
|
|
2d6102 |
+ break;
|
|
|
2d6102 |
+ }
|
|
|
2d6102 |
+
|
|
|
2d6102 |
+ printf(" Implicit Failback:");
|
|
|
2d6102 |
+ switch(buff[14] & 0x03) {
|
|
|
2d6102 |
+ case 0x1:
|
|
|
2d6102 |
+ printf(" Disabled\n");
|
|
|
2d6102 |
+ break;
|
|
|
2d6102 |
+ case 0x2:
|
|
|
2d6102 |
+ printf(" Enabled\n");
|
|
|
2d6102 |
+ break;
|
|
|
2d6102 |
+ default:
|
|
|
2d6102 |
+ printf(" (Unknown)\n");
|
|
|
2d6102 |
+ break;
|
|
|
2d6102 |
+ }
|
|
|
2d6102 |
+ } else {
|
|
|
2d6102 |
+ printf(" Path priority: %d ", buff[9] & 0xf);
|
|
|
2d6102 |
+ switch(buff[9] & 0xf) {
|
|
|
2d6102 |
case 0x1:
|
|
|
2d6102 |
printf("(preferred path)\n");
|
|
|
2d6102 |
break;
|
|
|
2d6102 |
@@ -725,9 +914,17 @@ decode_rdac_vpd_c9(unsigned char * buff, int len)
|
|
|
2d6102 |
default:
|
|
|
2d6102 |
printf("(unknown)\n");
|
|
|
2d6102 |
break;
|
|
|
2d6102 |
+ }
|
|
|
2d6102 |
}
|
|
|
2d6102 |
|
|
|
2d6102 |
- return;
|
|
|
2d6102 |
+
|
|
|
2d6102 |
+ if (buff[8] & 0x80) {
|
|
|
2d6102 |
+ printf(" Target Port Group Data (This controller):\n");
|
|
|
2d6102 |
+ decode_rdac_vpd_c9_rtpg_data(buff[10], buff[11]);
|
|
|
2d6102 |
+
|
|
|
2d6102 |
+ printf(" Target Port Group Data (Alternate controller):\n");
|
|
|
2d6102 |
+ decode_rdac_vpd_c9_rtpg_data(buff[12], buff[13]);
|
|
|
2d6102 |
+ }
|
|
|
2d6102 |
}
|
|
|
2d6102 |
|
|
|
2d6102 |
static void
|
|
|
2d6102 |
--
|
|
|
2d6102 |
1.8.3.1
|
|
|
2d6102 |
|