Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 31 Aug 2020 00:59:03 +0000 (UTC)
From:      Alexander Motin <mav@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org
Subject:   svn commit: r364981 - stable/12/sys/cam/scsi
Message-ID:  <202008310059.07V0x37I072565@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: mav
Date: Mon Aug 31 00:59:02 2020
New Revision: 364981
URL: https://svnweb.freebsd.org/changeset/base/364981

Log:
  MFC r364309: Extend EIIOE field handling according to ses4r5 draft.
  
  It should not affect any existing systems.

Modified:
  stable/12/sys/cam/scsi/scsi_enc_ses.c
  stable/12/sys/cam/scsi/scsi_ses.h
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/cam/scsi/scsi_enc_ses.c
==============================================================================
--- stable/12/sys/cam/scsi/scsi_enc_ses.c	Sun Aug 30 21:46:29 2020	(r364980)
+++ stable/12/sys/cam/scsi/scsi_enc_ses.c	Mon Aug 31 00:59:02 2020	(r364981)
@@ -1797,7 +1797,7 @@ ses_process_elm_addlstatus(enc_softc_t *enc, struct en
 			ses_elem_index_type_t index_type;
 
 			eip_hdr = (struct ses_elm_addlstatus_eip_hdr *)elm_hdr;
-			if (eip_hdr->byte2 & SES_ADDL_EIP_EIIOE) {
+			if (SES_ADDL_EIP_EIIOE_EI_GLOB(eip_hdr->byte2)) {
 				index_type = SES_ELEM_INDEX_GLOBAL;
 				expected_index = iter.global_element_index;
 			} else {
@@ -1807,8 +1807,8 @@ ses_process_elm_addlstatus(enc_softc_t *enc, struct en
 			if (eip_hdr->element_index < expected_index) {
 				ENC_VLOG(enc, "%s: provided %selement index "
 				    "%d is lower then expected %d\n",
-				    __func__, (eip_hdr->byte2 &
-				    SES_ADDL_EIP_EIIOE) ? "global " : "",
+				    __func__, SES_ADDL_EIP_EIIOE_EI_GLOB(
+				    eip_hdr->byte2) ? "global " : "",
 				    eip_hdr->element_index, expected_index);
 				goto badindex;
 			}
@@ -1818,7 +1818,7 @@ ses_process_elm_addlstatus(enc_softc_t *enc, struct en
 			if (telement == NULL) {
 				ENC_VLOG(enc, "%s: provided %selement index "
 				    "%d does not exist\n", __func__,
-				    (eip_hdr->byte2 & SES_ADDL_EIP_EIIOE) ?
+				    SES_ADDL_EIP_EIIOE_EI_GLOB(eip_hdr->byte2) ?
 				    "global " : "", eip_hdr->element_index);
 				goto badindex;
 			}
@@ -1827,7 +1827,7 @@ ses_process_elm_addlstatus(enc_softc_t *enc, struct en
 				ENC_VLOG(enc, "%s: provided %selement index "
 				    "%d can't have additional status\n",
 				    __func__,
-				    (eip_hdr->byte2 & SES_ADDL_EIP_EIIOE) ?
+				    SES_ADDL_EIP_EIIOE_EI_GLOB(eip_hdr->byte2) ?
 				    "global " : "", eip_hdr->element_index);
 badindex:
 				/*
@@ -1843,7 +1843,7 @@ badindex:
 				element = telement;
 			}
 
-			if (eip_hdr->byte2 & SES_ADDL_EIP_EIIOE)
+			if (SES_ADDL_EIP_EIIOE_EI_GLOB(eip_hdr->byte2))
 				index = iter.global_element_index;
 			else
 				index = iter.individual_element_index;
@@ -1852,8 +1852,8 @@ badindex:
 				ENC_VLOG(enc, "%s: provided %s element"
 					"index %d skips mandatory status "
 					" element at index %d\n",
-					__func__, (eip_hdr->byte2 &
-					SES_ADDL_EIP_EIIOE) ? "global " : "",
+					__func__, SES_ADDL_EIP_EIIOE_EI_GLOB(
+					eip_hdr->byte2) ? "global " : "",
 					index, expected_index);
 			}
 		}

Modified: stable/12/sys/cam/scsi/scsi_ses.h
==============================================================================
--- stable/12/sys/cam/scsi/scsi_ses.h	Sun Aug 30 21:46:29 2020	(r364980)
+++ stable/12/sys/cam/scsi/scsi_ses.h	Mon Aug 31 00:59:02 2020	(r364981)
@@ -2439,7 +2439,13 @@ int ses_elm_addlstatus_invalid(struct ses_elm_addlstat
 struct ses_elm_addlstatus_eip_hdr {
 	struct ses_elm_addlstatus_base_hdr base;
 	uint8_t byte2;
-#define	SES_ADDL_EIP_EIIOE	1
+#define	SES_ADDL_EIP_EIIOE_MASK	3
+#define	SES_ADDL_EIP_EIIOE_SES2	0
+#define	SES_ADDL_EIP_EIIOE_GLOB	1
+#define	SES_ADDL_EIP_EIIOE_IND	2
+#define	SES_ADDL_EIP_EIIOE_MIX	3
+#define	SES_ADDL_EIP_EIIOE_EI_GLOB(x)				\
+    (((x) & SES_ADDL_EIP_EIIOE_MASK) == SES_ADDL_EIP_EIIOE_GLOB)
 	uint8_t element_index;
 	/* NB: This define (currently) applies to all eip=1 headers */
 #define	SES_EIP_HDR_EXTRA_LEN	2



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202008310059.07V0x37I072565>