Commit 5a59204f authored by Jody McIntyre's avatar Jody McIntyre

Bugfix for Logical Unit Number in unit directory -- popular with multi-bay
enclosures -- while not breaking Logical Unit Directory.
Signed-off-by: default avatarDan Dennedy <dan@dennedy.org>
Signed-off-by: default avatarJody McIntyre <scjody@modernduck.com>
parent 422d6acf
......@@ -932,13 +932,28 @@ static struct unit_directory *nodemgr_process_unit_directory
break;
case CSR1212_KV_ID_DEPENDENT_INFO:
if (kv->key.type == CSR1212_KV_TYPE_DIRECTORY) {
/* Logical Unit Number */
if (kv->key.type == CSR1212_KV_TYPE_IMMEDIATE) {
if (ud->flags & UNIT_DIRECTORY_HAS_LUN) {
nodemgr_register_device(ne, ud, &ne->device);
ud_child = kmalloc(sizeof(struct unit_directory), GFP_KERNEL);
if (!ud_child)
goto unit_directory_error;
memcpy(ud_child, ud, sizeof(struct unit_directory));
ud = ud_child;
ud_child = NULL;
ud->id = (*id)++;
ud->device.bus = NULL;
}
ud->lun = kv->value.immediate;
ud->flags |= UNIT_DIRECTORY_HAS_LUN;
/* Logical Unit Directory */
} else if (kv->key.type == CSR1212_KV_TYPE_DIRECTORY) {
/* This should really be done in SBP2 as this is
* doing SBP2 specific parsing.
* DRD> Hmm.. that would add a lot of udev bits to sbp2.c, and
* really it is just subdirectory handling, not necessarily
* specific to SBP2 although that is only known application at
* this time.
*/
/* first register the parent unit */
......
......@@ -51,6 +51,7 @@ struct bus_options {
#define UNIT_DIRECTORY_VERSION 0x08
#define UNIT_DIRECTORY_HAS_LUN_DIRECTORY 0x10
#define UNIT_DIRECTORY_LUN_DIRECTORY 0x20
#define UNIT_DIRECTORY_HAS_LUN 0x40
/*
* A unit directory corresponds to a protocol supported by the
......@@ -82,6 +83,7 @@ struct unit_directory {
struct class_device class_dev;
struct csr1212_keyval *ud_kv;
u32 lun; /* logical unit number immediate value */
};
struct node_entry {
......
......@@ -1524,8 +1524,7 @@ static void sbp2_parse_unit_directory(struct scsi_id_instance_data *scsi_id,
SBP2_DEBUG("sbp2_management_agent_addr = %x",
(unsigned int) management_agent_addr);
} else if (kv->key.type == CSR1212_KV_TYPE_IMMEDIATE)
scsi_id->sbp2_device_type_and_lun = kv->value.immediate;
}
break;
case SBP2_COMMAND_SET_SPEC_ID_KEY:
......@@ -1616,6 +1615,7 @@ static void sbp2_parse_unit_directory(struct scsi_id_instance_data *scsi_id,
scsi_id->sbp2_unit_characteristics = unit_characteristics;
scsi_id->sbp2_firmware_revision = firmware_revision;
scsi_id->workarounds = workarounds;
scsi_id->sbp2_device_type_and_lun = ud->lun;
}
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment