aboutsummaryrefslogtreecommitdiff
path: root/sys/dev/isp
diff options
context:
space:
mode:
authorKenneth D. Merry <ken@FreeBSD.org>2024-06-21 19:30:59 +0000
committerKenneth D. Merry <ken@FreeBSD.org>2024-06-24 20:47:55 +0000
commit137b004e2b7ab504abf98c4aad9d52607df47b9a (patch)
tree341a503cf8910a11151f51f6dfcf8d4725db9fef /sys/dev/isp
parent63875db56bd545896e019c922378f96ad5adc892 (diff)
Diffstat (limited to 'sys/dev/isp')
-rw-r--r--sys/dev/isp/isp.c10
-rw-r--r--sys/dev/isp/ispmbox.h6
2 files changed, 15 insertions, 1 deletions
diff --git a/sys/dev/isp/isp.c b/sys/dev/isp/isp.c
index b53171add5f5..2ed56c5e40bb 100644
--- a/sys/dev/isp/isp.c
+++ b/sys/dev/isp/isp.c
@@ -1539,7 +1539,15 @@ isp_getpdb(ispsoftc_t *isp, int chan, uint16_t id, isp_pdb_t *pdb)
chan, id, pdb->portid, un.bill.pdb_flags,
un.bill.pdb_curstate, un.bill.pdb_laststate);
- if (un.bill.pdb_curstate < PDB2400_STATE_PLOGI_DONE || un.bill.pdb_curstate > PDB2400_STATE_LOGGED_IN) {
+ /*
+ * XXX KDM this is broken for NVMe. Need to determine whether this
+ * is an NVMe target, and if so, check the NVMe status bits. We are
+ * probably missing more bits for proper NVMe support, though.
+ */
+ if (((un.bill.pdb_curstate & PDB2400_STATE_FCP_MASK) <
+ PDB2400_STATE_PLOGI_DONE)
+ || ((un.bill.pdb_curstate & PDB2400_STATE_FCP_MASK) >
+ PDB2400_STATE_LOGGED_IN)) {
mbs.param[0] = MBOX_NOT_LOGGED_IN;
return (mbs.param[0]);
}
diff --git a/sys/dev/isp/ispmbox.h b/sys/dev/isp/ispmbox.h
index c6ac9d9ce971..978ed4dc1638 100644
--- a/sys/dev/isp/ispmbox.h
+++ b/sys/dev/isp/ispmbox.h
@@ -890,6 +890,10 @@ typedef struct {
#define PDB2400_CLASS2 0x0010
#define PDB2400_ADDR_VALID 0x0002
+/*
+ * For NVMe, the state is the high nibble. For FCP, the state is the low
+ * nibble. This appears to have changed with the 9.x firmware.
+ */
#define PDB2400_STATE_PLOGI_PEND 0x03
#define PDB2400_STATE_PLOGI_DONE 0x04
#define PDB2400_STATE_PRLI_PEND 0x05
@@ -897,6 +901,8 @@ typedef struct {
#define PDB2400_STATE_PORT_UNAVAIL 0x07
#define PDB2400_STATE_PRLO_PEND 0x09
#define PDB2400_STATE_LOGO_PEND 0x0B
+#define PDB2400_STATE_FCP_MASK 0x0f
+#define PDB2400_STATE_NVME_SHIFT 4
/*
* Common elements from the above two structures that are actually useful to us.