summaryrefslogtreecommitdiff
path: root/utils/fwparam_ibft
diff options
context:
space:
mode:
authorHannes Reinecke <hare@suse.de>2014-10-30 18:00:30 -0700
committerMike Christie <michaelc@cs.wisc.edu>2014-11-14 14:12:08 -0600
commitdefd640862dd65a4dfc89288e43e7ccbdf002733 (patch)
tree7f135af303e8bae724ba6c996b9c691bc6ffb7a3 /utils/fwparam_ibft
parent4959a89f421fdebc521f48003a79c2161e59d192 (diff)
downloadopen-iscsi-defd640862dd65a4dfc89288e43e7ccbdf002733.tar.gz
fwparam_ibft: Check iBFT target and NIC flags
Check the iBFT NIC and Target flags for valid boot. Since some adapters correctly set Bit 0 and others set Bit 1 for NICs, allow either value there. Signed-off-by: Lee Duncan <lduncan@suse.com>
Diffstat (limited to 'utils/fwparam_ibft')
-rw-r--r--utils/fwparam_ibft/fwparam_sysfs.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/utils/fwparam_ibft/fwparam_sysfs.c b/utils/fwparam_ibft/fwparam_sysfs.c
index cd87b68..c5b0b00 100644
--- a/utils/fwparam_ibft/fwparam_sysfs.c
+++ b/utils/fwparam_ibft/fwparam_sysfs.c
@@ -170,6 +170,18 @@ static int fill_nic_context(char *subsys, char *id,
{
int rc;
+ rc = sysfs_get_int(id, subsys, "flags", &context->nic_flags);
+ /*
+ * Per spec we would need to check against Bit 0
+ * (Block Valid Flag), but some firmware only
+ * sets Bit 1 (Firmware Booting Selected).
+ * So any setting is deemed okay.
+ */
+ if (!rc && (context->nic_flags == 0))
+ rc = ENODEV;
+ if (rc)
+ return rc;
+
rc = sysfs_get_str(id, subsys, "mac", context->mac,
sizeof(context->mac));
if (rc)
@@ -236,6 +248,18 @@ static int fill_tgt_context(char *subsys, char *id,
{
int rc;
+ rc = sysfs_get_int(id, subsys, "flags", &context->target_flags);
+ /*
+ * Per spec we would need to check against Bit 0
+ * (Block Valid Flag), but some firmware only
+ * sets Bit 1 (Firmware Booting Selected).
+ * So any setting is deemed okay.
+ */
+ if (!rc && (context->nic_flags == 0))
+ rc = ENODEV;
+ if (rc)
+ return rc;
+
rc = sysfs_get_str(id, subsys, "target-name", context->targetname,
sizeof(context->targetname));
if (rc)