svn commit: r364309 - head/sys/cam/scsi
Alexander Motin
mav at FreeBSD.org
Mon Aug 17 15:11:47 UTC 2020
Author: mav
Date: Mon Aug 17 15:11:46 2020
New Revision: 364309
URL: https://svnweb.freebsd.org/changeset/base/364309
Log:
Extend EIIOE field handling according to ses4r5 draft.
It should not affect any existing systems.
MFC after: 2 weeks
Modified:
head/sys/cam/scsi/scsi_enc_ses.c
head/sys/cam/scsi/scsi_ses.h
Modified: head/sys/cam/scsi/scsi_enc_ses.c
==============================================================================
--- head/sys/cam/scsi/scsi_enc_ses.c Mon Aug 17 15:05:41 2020 (r364308)
+++ head/sys/cam/scsi/scsi_enc_ses.c Mon Aug 17 15:11:46 2020 (r364309)
@@ -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: head/sys/cam/scsi/scsi_ses.h
==============================================================================
--- head/sys/cam/scsi/scsi_ses.h Mon Aug 17 15:05:41 2020 (r364308)
+++ head/sys/cam/scsi/scsi_ses.h Mon Aug 17 15:11:46 2020 (r364309)
@@ -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
More information about the svn-src-all
mailing list