summaryrefslogtreecommitdiff
path: root/usr/src
diff options
context:
space:
mode:
authorGarrett D'Amore <garrett@damore.org>2019-06-28 09:34:02 -0700
committerGarrett D'Amore <garrett@damore.org>2019-07-07 10:44:02 -0700
commit3fa8bc2d19bd24fbc2061549c236b6f7573471e8 (patch)
treed32e6b03e3848e072de1a94de5256a1dd8390ca7 /usr/src
parent3d4dea7f235476fb40c0a6d84dcedfd04740f96b (diff)
downloadillumos-gate-3fa8bc2d19bd24fbc2061549c236b6f7573471e8.tar.gz
11325 SES-3 element index handling incorrect
Reviewed by: Andrew Stormont <andyjstormont@gmail.com> Reviewed by: Maxim Khitrov <mkhitrov@racktopsystems.com> Reviewed by: David Lethe <dlethe@racktopsystems.com> Reviewed by: Toomas Soome <tsoome@me.com> Approved by: Gordon Ross <gwr@nexenta.com>
Diffstat (limited to 'usr/src')
-rw-r--r--usr/src/lib/scsi/plugins/ses/ses2/common/ses2_impl.h10
-rw-r--r--usr/src/lib/scsi/plugins/ses/ses2/common/ses2_pages.c44
2 files changed, 48 insertions, 6 deletions
diff --git a/usr/src/lib/scsi/plugins/ses/ses2/common/ses2_impl.h b/usr/src/lib/scsi/plugins/ses/ses2/common/ses2_impl.h
index 43c287975c..a080c1e32c 100644
--- a/usr/src/lib/scsi/plugins/ses/ses2/common/ses2_impl.h
+++ b/usr/src/lib/scsi/plugins/ses/ses2/common/ses2_impl.h
@@ -22,6 +22,9 @@
/*
* Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved.
*/
+/*
+ * Copyright 2019 RackTop Systems
+ */
#ifndef _PLUGIN_SES_IMPL_H
#define _PLUGIN_SES_IMPL_H
@@ -1163,6 +1166,9 @@ typedef struct ses2_aes_page_impl {
/*
* SES-2 Additional Element Status descriptor (EIP == 1) (Table 26, 6.1.13).
+ * Updated with EIIOE for Table 32 from SES-3, 6.1.13.
+ * Note that we think later revs of SES-3 probably widen the EIIOE to 2 bits,
+ * waiting for final document to be sure.
*/
typedef struct ses2_aes_descr_eip_impl {
DECL_BITFIELD4(
@@ -1171,7 +1177,9 @@ typedef struct ses2_aes_descr_eip_impl {
_reserved1 :2,
sadei_invalid :1);
uint8_t sadei_length;
- uint8_t _reserved2;
+ DECL_BITFIELD2(
+ sadei_eiioe :2,
+ _reserved2 :6);
uint8_t sadei_element_index;
uint8_t sadei_protocol_specific[1];
} ses2_aes_descr_eip_impl_t;
diff --git a/usr/src/lib/scsi/plugins/ses/ses2/common/ses2_pages.c b/usr/src/lib/scsi/plugins/ses/ses2/common/ses2_pages.c
index f4d6bd661f..6b0ac8e4a8 100644
--- a/usr/src/lib/scsi/plugins/ses/ses2/common/ses2_pages.c
+++ b/usr/src/lib/scsi/plugins/ses/ses2/common/ses2_pages.c
@@ -24,6 +24,7 @@
*/
/*
* Copyright 2012 Nexenta Systems, Inc. All rights reserved.
+ * Copyright 2019 RackTop Systems
*/
#include <stddef.h>
@@ -59,14 +60,16 @@ ses2_aes_index(ses_plugin_t *sp, ses_node_t *np, void *data, size_t pagelen,
size_t *len)
{
ses2_aes_page_impl_t *apip = data;
- uint64_t index, type;
+ uint64_t index, eindex, oindex, type;
nvlist_t *props = ses_node_props(np);
ses2_aes_descr_eip_impl_t *dep;
size_t desclen;
int i, pos;
VERIFY(nvlist_lookup_uint64(props, SES_PROP_ELEMENT_ONLY_INDEX,
- &index) == 0);
+ &eindex) == 0);
+ VERIFY(nvlist_lookup_uint64(props, SES_PROP_ELEMENT_INDEX,
+ &oindex) == 0);
VERIFY(nvlist_lookup_uint64(props, SES_PROP_ELEMENT_TYPE,
&type) == 0);
@@ -86,6 +89,34 @@ ses2_aes_index(ses_plugin_t *sp, ses_node_t *np, void *data, size_t pagelen,
if (!SES_WITHIN_PAGE(dep, desclen, data, pagelen))
break;
+ if (dep->sadei_eip) {
+ /*
+ * The following switch table deals with the cases
+ * for the EIIOE (element index includes overall
+ * elements). The treatment for this includes handling
+ * connector and other element indices, but we don't
+ * actually care about or use them, so for now we
+ * really only care about the ELEMENT INDEX field.
+ */
+ switch (dep->sadei_eiioe) {
+ case 1:
+ /*
+ * Use the overall index. We expect most
+ * modern implementations to use this case.
+ */
+ index = oindex;
+ break;
+ case 0:
+ case 2:
+ case 3:
+ /*
+ * Use the element only index - excluding
+ * the overall elements.
+ */
+ index = eindex;
+ break;
+ }
+ }
pos += desclen;
if (!dep->sadei_eip &&
type != SES_ET_DEVICE &&
@@ -102,8 +133,11 @@ ses2_aes_index(ses_plugin_t *sp, ses_node_t *np, void *data, size_t pagelen,
* to have otherwise. See 6.1.13.1.
*/
continue;
- } else if (dep->sadei_eip &&
- dep->sadei_element_index != index) {
+ } else if (dep->sadei_eip) {
+ if (dep->sadei_element_index == index) {
+ *len = desclen;
+ return (dep);
+ }
/*
* The element index field from AES descriptor is
* element only index which doesn't include the OVERALL
@@ -112,7 +146,7 @@ ses2_aes_index(ses_plugin_t *sp, ses_node_t *np, void *data, size_t pagelen,
* SES_PROP_ELEMENT_INDEX.
*/
continue;
- } else if (dep->sadei_eip || i == index) {
+ } else if (i == eindex) {
*len = desclen;
return (dep);
}