public inbox for linux-scsi@vger.kernel.org
 help / color / mirror / Atom feed
From: Justin Tee <justintee8345@gmail.com>
To: linux-scsi@vger.kernel.org
Cc: jsmart833426@gmail.com, justin.tee@broadcom.com,
	Justin Tee <justintee8345@gmail.com>
Subject: [PATCH 07/10] lpfc: Check ASIC_ID register to aid diagnostics during failed fw updates
Date: Tue, 31 Mar 2026 13:59:25 -0700	[thread overview]
Message-ID: <20260331205928.119833-8-justintee8345@gmail.com> (raw)
In-Reply-To: <20260331205928.119833-1-justintee8345@gmail.com>

When WRITE_OBJECT mailbox command fails during firmware update, the
lpfc_log_write_firmware_error routine is used to log and parse commonly
found error codes.  Update this routine to also include ASIC_ID register
checks for notifying users of incompatible images.

Signed-off-by: Justin Tee <justintee8345@gmail.com>
---
 drivers/scsi/lpfc/lpfc_hw4.h  | 20 ++++++++++++++++++--
 drivers/scsi/lpfc/lpfc_init.c | 19 ++++++++++++++++++-
 drivers/scsi/lpfc/lpfc_sli4.h |  1 +
 3 files changed, 37 insertions(+), 3 deletions(-)

diff --git a/drivers/scsi/lpfc/lpfc_hw4.h b/drivers/scsi/lpfc/lpfc_hw4.h
index 0e11701b0881..f91bde4a6c38 100644
--- a/drivers/scsi/lpfc/lpfc_hw4.h
+++ b/drivers/scsi/lpfc/lpfc_hw4.h
@@ -100,7 +100,8 @@ struct lpfc_sli_intf {
 #define lpfc_sli_intf_sli_family_MASK		0x0000000F
 #define lpfc_sli_intf_sli_family_WORD		word0
 #define LPFC_SLI_INTF_FAMILY_BE2	0x0
-#define LPFC_SLI_INTF_FAMILY_BE3	0x1
+#define LPFC_SLI_INTF_ASIC_ID		0x1	/* Refer to ASIC_ID register */
+#define LPFC_SLI_INTF_FAMILY_BE3	0x3
 #define LPFC_SLI_INTF_FAMILY_LNCR_A0	0xa
 #define LPFC_SLI_INTF_FAMILY_LNCR_B0	0xb
 #define LPFC_SLI_INTF_FAMILY_G6		0xc
@@ -118,6 +119,17 @@ struct lpfc_sli_intf {
 #define LPFC_SLI_INTF_IF_TYPE_VIRT	1
 };
 
+struct lpfc_asic_id {
+	u32 word0;
+#define lpfc_asic_id_gen_num_SHIFT	8
+#define lpfc_asic_id_gen_num_MASK	0x000000FF
+#define lpfc_asic_id_gen_num_WORD	word0
+#define LPFC_SLI_INTF_FAMILY_G8		0x10
+#define lpfc_asic_id_rev_num_SHIFT	0
+#define lpfc_asic_id_rev_num_MASK	0x000000FF
+#define lpfc_asic_id_rev_num_WORD	word0
+};
+
 #define LPFC_SLI4_MBX_EMBED	true
 #define LPFC_SLI4_MBX_NEMBED	false
 
@@ -624,6 +636,10 @@ struct lpfc_register {
 
 #define LPFC_PORT_SEM_UE_RECOVERABLE    0xE000
 #define LPFC_PORT_SEM_MASK		0xF000
+
+/* The following are config space register offsets */
+#define LPFC_ASIC_ID_OFFSET		0x0308
+
 /* The following BAR0 Registers apply to SLI4 if_type 0 UCNAs. */
 #define LPFC_UERR_STATUS_HI		0x00A4
 #define LPFC_UERR_STATUS_LO		0x00A0
@@ -632,7 +648,6 @@ struct lpfc_register {
 
 /* The following BAR0 register sets are defined for if_type 0 and 2 UCNAs. */
 #define LPFC_SLI_INTF			0x0058
-#define LPFC_SLI_ASIC_VER		0x009C
 
 #define LPFC_CTL_PORT_SEM_OFFSET	0x400
 #define lpfc_port_smphr_perr_SHIFT	31
@@ -4965,6 +4980,7 @@ union lpfc_wqe128 {
 #define MAGIC_NUMBER_G6 0xFEAA0003
 #define MAGIC_NUMBER_G7 0xFEAA0005
 #define MAGIC_NUMBER_G7P 0xFEAA0020
+#define MAGIC_NUMBER_G8 0xFEAA0070
 
 struct lpfc_grp_hdr {
 	uint32_t size;
diff --git a/drivers/scsi/lpfc/lpfc_init.c b/drivers/scsi/lpfc/lpfc_init.c
index 8e5f00e6abe0..fd6b48e46a69 100644
--- a/drivers/scsi/lpfc/lpfc_init.c
+++ b/drivers/scsi/lpfc/lpfc_init.c
@@ -11793,6 +11793,7 @@ lpfc_sli4_pci_mem_setup(struct lpfc_hba *phba)
 	unsigned long bar0map_len, bar1map_len, bar2map_len;
 	int error;
 	uint32_t if_type;
+	u8 sli_family;
 
 	if (!pdev)
 		return -ENODEV;
@@ -11823,6 +11824,14 @@ lpfc_sli4_pci_mem_setup(struct lpfc_hba *phba)
 		return -ENODEV;
 	}
 
+	/* Check if ASIC_ID register should be read */
+	sli_family = bf_get(lpfc_sli_intf_sli_family, &phba->sli4_hba.sli_intf);
+	if (sli_family == LPFC_SLI_INTF_ASIC_ID) {
+		if (pci_read_config_dword(pdev, LPFC_ASIC_ID_OFFSET,
+					  &phba->sli4_hba.asic_id.word0))
+			return -ENODEV;
+	}
+
 	if_type = bf_get(lpfc_sli_intf_if_type, &phba->sli4_hba.sli_intf);
 	/*
 	 * Get the bus address of SLI4 device Bar regions and the
@@ -14480,6 +14489,12 @@ lpfc_log_write_firmware_error(struct lpfc_hba *phba, uint32_t offset,
 	u8 sli_family;
 
 	sli_family = bf_get(lpfc_sli_intf_sli_family, &phba->sli4_hba.sli_intf);
+
+	/* Refer to ASIC_ID register case */
+	if (sli_family == LPFC_SLI_INTF_ASIC_ID)
+		sli_family = bf_get(lpfc_asic_id_gen_num,
+				    &phba->sli4_hba.asic_id);
+
 	/* Three cases:  (1) FW was not supported on the detected adapter.
 	 * (2) FW update has been locked out administratively.
 	 * (3) Some other error during FW update.
@@ -14492,7 +14507,9 @@ lpfc_log_write_firmware_error(struct lpfc_hba *phba, uint32_t offset,
 	    (sli_family == LPFC_SLI_INTF_FAMILY_G7 &&
 	     magic_number != MAGIC_NUMBER_G7) ||
 	    (sli_family == LPFC_SLI_INTF_FAMILY_G7P &&
-	     magic_number != MAGIC_NUMBER_G7P)) {
+	     magic_number != MAGIC_NUMBER_G7P) ||
+	    (sli_family == LPFC_SLI_INTF_FAMILY_G8 &&
+	     magic_number != MAGIC_NUMBER_G8)) {
 		lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT,
 				"3030 This firmware version is not supported on"
 				" this HBA model. Device:%x Magic:%x Type:%x "
diff --git a/drivers/scsi/lpfc/lpfc_sli4.h b/drivers/scsi/lpfc/lpfc_sli4.h
index 0aa105cab125..036760702ecc 100644
--- a/drivers/scsi/lpfc/lpfc_sli4.h
+++ b/drivers/scsi/lpfc/lpfc_sli4.h
@@ -838,6 +838,7 @@ struct lpfc_sli4_hba {
 	uint32_t ue_to_sr;
 	uint32_t ue_to_rp;
 	struct lpfc_register sli_intf;
+	struct lpfc_register asic_id;
 	struct lpfc_pc_sli4_params pc_sli4_params;
 	struct lpfc_bbscn_params bbscn_params;
 	struct lpfc_hba_eq_hdl *hba_eq_hdl; /* HBA per-WQ handle */
-- 
2.38.0


  parent reply	other threads:[~2026-03-31 20:23 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-31 20:59 [PATCH 00/10] Update lpfc to revision 15.0.0.0 Justin Tee
2026-03-31 20:59 ` [PATCH 01/10] lpfc: Break out of IRQ affinity assignment when mask reaches nr_cpu_ids Justin Tee
2026-03-31 20:59 ` [PATCH 02/10] lpfc: Select mailbox rq_create cmd version based on sli4 if_type Justin Tee
2026-03-31 20:59 ` [PATCH 03/10] lpfc: Log mcqe contents for mbox commands with no context Justin Tee
2026-03-31 20:59 ` [PATCH 04/10] lpfc: Add REG_VFI mailbox cmd error handling Justin Tee
2026-03-31 20:59 ` [PATCH 05/10] lpfc: Remove deprecated PBDE feature Justin Tee
2026-03-31 20:59 ` [PATCH 06/10] lpfc: Update construction of SGL when XPSGL is enabled Justin Tee
2026-03-31 20:59 ` Justin Tee [this message]
2026-03-31 20:59 ` [PATCH 08/10] lpfc: Introduce 128G link speed selection and support Justin Tee
2026-03-31 20:59 ` [PATCH 09/10] lpfc: Add PCI ID support for LPe42100 series adapters Justin Tee
2026-03-31 20:59 ` [PATCH 10/10] lpfc: Update lpfc version to 15.0.0.0 Justin Tee
2026-04-03  1:37 ` [PATCH 00/10] Update lpfc to revision 15.0.0.0 Martin K. Petersen
2026-04-09  2:43 ` Martin K. Petersen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260331205928.119833-8-justintee8345@gmail.com \
    --to=justintee8345@gmail.com \
    --cc=jsmart833426@gmail.com \
    --cc=justin.tee@broadcom.com \
    --cc=linux-scsi@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox