From: Ivan Mironov <mironov.ivan@gmail.com>
To: linux-scsi@vger.kernel.org, mironov.ivan@gmail.com
Cc: linux-kernel@vger.kernel.org, Don Brace <don.brace@microsemi.com>,
"James E.J. Bottomley" <jejb@linux.vnet.ibm.com>,
"Martin K. Petersen" <martin.petersen@oracle.com>,
esc.storagedev@microsemi.com
Subject: [PATCH 6/6] scsi: hpsa: Do not use HBA flag from NVRAM if HBA is not supported
Date: Fri, 14 Dec 2018 18:21:15 +0500 [thread overview]
Message-ID: <20181214132115.21440-7-mironov.ivan@gmail.com> (raw)
In-Reply-To: <20181214132115.21440-1-mironov.ivan@gmail.com>
Check bmic_identify_controller.yet_more_controller_flags for HBA support
bit before trying to enable HBA mode.
HP's ssacli tool calls this bit "Hba Mode Supported" in full diagnostics
report.
Signed-off-by: Ivan Mironov <mironov.ivan@gmail.com>
---
drivers/scsi/hpsa.c | 16 ++++++++++++++--
drivers/scsi/hpsa_cmd.h | 4 ++++
2 files changed, 18 insertions(+), 2 deletions(-)
diff --git a/drivers/scsi/hpsa.c b/drivers/scsi/hpsa.c
index 0b5b3a651b70..38026b82ac6b 100644
--- a/drivers/scsi/hpsa.c
+++ b/drivers/scsi/hpsa.c
@@ -4342,6 +4342,12 @@ static bool hpsa_skip_device(struct ctlr_info *h, u8 *lunaddrbytes,
return false;
}
+static bool is_hba_supported(const struct bmic_identify_controller *id_ctlr)
+{
+ return le32_to_cpu(id_ctlr->yet_more_controller_flags) &
+ YET_MORE_CTLR_FLAG_HBA_MODE_SUPP;
+}
+
static int hpsa_nvram_hba_flag_enabled(struct ctlr_info *h, bool *flag_enabled)
{
int rc;
@@ -4364,7 +4370,8 @@ static int hpsa_nvram_hba_flag_enabled(struct ctlr_info *h, bool *flag_enabled)
return rc;
}
-static int hpsa_update_nvram_hba_mode(struct ctlr_info *h, u32 nlogicals)
+static int hpsa_update_nvram_hba_mode(struct ctlr_info *h, u32 nlogicals,
+ const struct bmic_identify_controller *id_ctlr)
{
int rc;
bool flag_enabled;
@@ -4373,6 +4380,11 @@ static int hpsa_update_nvram_hba_mode(struct ctlr_info *h, u32 nlogicals)
if (!hpsa_use_nvram_hba_flag)
return 0;
+ if (!is_hba_supported(id_ctlr)) {
+ dev_info(&h->pdev->dev, "NVRAM HBA flag: not supported\n");
+ return 0;
+ }
+
rc = hpsa_nvram_hba_flag_enabled(h, &flag_enabled);
if (rc == -ENOMEM)
dev_warn(&h->pdev->dev, "Out of memory.\n");
@@ -4446,7 +4458,7 @@ static void hpsa_update_scsi_devices(struct ctlr_info *h)
__func__);
}
- if (hpsa_update_nvram_hba_mode(h, nlogicals)) {
+ if (hpsa_update_nvram_hba_mode(h, nlogicals, id_ctlr)) {
h->drv_req_rescan = 1;
goto out;
}
diff --git a/drivers/scsi/hpsa_cmd.h b/drivers/scsi/hpsa_cmd.h
index 64100a33f844..b27f94b257bc 100644
--- a/drivers/scsi/hpsa_cmd.h
+++ b/drivers/scsi/hpsa_cmd.h
@@ -806,6 +806,10 @@ struct bmic_identify_controller {
};
+/* ssacli calls this bit "Hba Mode Supported". */
+#define YET_MORE_CTLR_FLAG_HBA_MODE_SUPP (1 << 25)
+
+
struct bmic_identify_physical_device {
u8 scsi_bus; /* SCSI Bus number on controller */
u8 scsi_id; /* SCSI ID on this bus */
--
2.19.2
next prev parent reply other threads:[~2018-12-14 13:22 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-12-14 13:21 [PATCH 0/6] Add support of the HBA mode on HP Smart Array P410i controllers Ivan Mironov
2018-12-14 13:21 ` [PATCH 1/6] scsi: hpsa: Add function to check if device is a disk or a zoned device Ivan Mironov
2018-12-14 13:26 ` Johannes Thumshirn
2018-12-14 13:21 ` [PATCH 2/6] scsi: hpsa: Support HBA mode on HP Smart Array P410i controllers Ivan Mironov
2018-12-14 13:21 ` [PATCH 3/6] scsi: hpsa: Add/mask existing devices on rescan if visibility changes Ivan Mironov
2018-12-14 13:21 ` [PATCH 4/6] scsi: hpsa: Ignore HBA flag from NVRAM if logical devices exist Ivan Mironov
2018-12-14 13:21 ` [PATCH 5/6] scsi: hpsa: Name more fields in "struct bmic_identify_controller" Ivan Mironov
2018-12-14 13:21 ` Ivan Mironov [this message]
2018-12-14 19:38 ` [PATCH 0/6] Add support of the HBA mode on HP Smart Array P410i controllers Don.Brace
2018-12-14 20:30 ` Ivan Mironov
2018-12-17 16:32 ` Don.Brace
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=20181214132115.21440-7-mironov.ivan@gmail.com \
--to=mironov.ivan@gmail.com \
--cc=don.brace@microsemi.com \
--cc=esc.storagedev@microsemi.com \
--cc=jejb@linux.vnet.ibm.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-scsi@vger.kernel.org \
--cc=martin.petersen@oracle.com \
/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;
as well as URLs for NNTP newsgroup(s).