aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/ieee1394/sbp2.c34
-rw-r--r--drivers/ieee1394/sbp2.h7
2 files changed, 7 insertions, 34 deletions
diff --git a/drivers/ieee1394/sbp2.c b/drivers/ieee1394/sbp2.c
index d53c8cfe6610..747dbd1c3c9c 100644
--- a/drivers/ieee1394/sbp2.c
+++ b/drivers/ieee1394/sbp2.c
@@ -735,7 +735,7 @@ static struct scsi_id_instance_data *sbp2_alloc_device(struct unit_directory *ud
735 INIT_LIST_HEAD(&scsi_id->sbp2_command_orb_completed); 735 INIT_LIST_HEAD(&scsi_id->sbp2_command_orb_completed);
736 INIT_LIST_HEAD(&scsi_id->scsi_list); 736 INIT_LIST_HEAD(&scsi_id->scsi_list);
737 spin_lock_init(&scsi_id->sbp2_command_orb_lock); 737 spin_lock_init(&scsi_id->sbp2_command_orb_lock);
738 scsi_id->sbp2_device_type_and_lun = SBP2_DEVICE_TYPE_LUN_UNINITIALIZED; 738 scsi_id->sbp2_lun = 0;
739 739
740 ud->device.driver_data = scsi_id; 740 ud->device.driver_data = scsi_id;
741 741
@@ -1110,11 +1110,7 @@ static int sbp2_query_logins(struct scsi_id_instance_data *scsi_id)
1110 1110
1111 scsi_id->query_logins_orb->lun_misc = ORB_SET_FUNCTION(SBP2_QUERY_LOGINS_REQUEST); 1111 scsi_id->query_logins_orb->lun_misc = ORB_SET_FUNCTION(SBP2_QUERY_LOGINS_REQUEST);
1112 scsi_id->query_logins_orb->lun_misc |= ORB_SET_NOTIFY(1); 1112 scsi_id->query_logins_orb->lun_misc |= ORB_SET_NOTIFY(1);
1113 if (scsi_id->sbp2_device_type_and_lun != SBP2_DEVICE_TYPE_LUN_UNINITIALIZED) { 1113 scsi_id->query_logins_orb->lun_misc |= ORB_SET_LUN(scsi_id->sbp2_lun);
1114 scsi_id->query_logins_orb->lun_misc |= ORB_SET_LUN(scsi_id->sbp2_device_type_and_lun);
1115 SBP2_DEBUG("sbp2_query_logins: set lun to %d",
1116 ORB_SET_LUN(scsi_id->sbp2_device_type_and_lun));
1117 }
1118 SBP2_DEBUG("sbp2_query_logins: lun_misc initialized"); 1114 SBP2_DEBUG("sbp2_query_logins: lun_misc initialized");
1119 1115
1120 scsi_id->query_logins_orb->reserved_resp_length = 1116 scsi_id->query_logins_orb->reserved_resp_length =
@@ -1223,12 +1219,7 @@ static int sbp2_login_device(struct scsi_id_instance_data *scsi_id)
1223 scsi_id->login_orb->lun_misc |= ORB_SET_RECONNECT(0); /* One second reconnect time */ 1219 scsi_id->login_orb->lun_misc |= ORB_SET_RECONNECT(0); /* One second reconnect time */
1224 scsi_id->login_orb->lun_misc |= ORB_SET_EXCLUSIVE(exclusive_login); /* Exclusive access to device */ 1220 scsi_id->login_orb->lun_misc |= ORB_SET_EXCLUSIVE(exclusive_login); /* Exclusive access to device */
1225 scsi_id->login_orb->lun_misc |= ORB_SET_NOTIFY(1); /* Notify us of login complete */ 1221 scsi_id->login_orb->lun_misc |= ORB_SET_NOTIFY(1); /* Notify us of login complete */
1226 /* Set the lun if we were able to pull it from the device's unit directory */ 1222 scsi_id->login_orb->lun_misc |= ORB_SET_LUN(scsi_id->sbp2_lun);
1227 if (scsi_id->sbp2_device_type_and_lun != SBP2_DEVICE_TYPE_LUN_UNINITIALIZED) {
1228 scsi_id->login_orb->lun_misc |= ORB_SET_LUN(scsi_id->sbp2_device_type_and_lun);
1229 SBP2_DEBUG("sbp2_query_logins: set lun to %d",
1230 ORB_SET_LUN(scsi_id->sbp2_device_type_and_lun));
1231 }
1232 SBP2_DEBUG("sbp2_login_device: lun_misc initialized"); 1223 SBP2_DEBUG("sbp2_login_device: lun_misc initialized");
1233 1224
1234 scsi_id->login_orb->passwd_resp_lengths = 1225 scsi_id->login_orb->passwd_resp_lengths =
@@ -1543,7 +1534,7 @@ static void sbp2_parse_unit_directory(struct scsi_id_instance_data *scsi_id,
1543 SBP2_DEBUG("sbp2_management_agent_addr = %x", 1534 SBP2_DEBUG("sbp2_management_agent_addr = %x",
1544 (unsigned int) management_agent_addr); 1535 (unsigned int) management_agent_addr);
1545 } else if (kv->key.type == CSR1212_KV_TYPE_IMMEDIATE) { 1536 } else if (kv->key.type == CSR1212_KV_TYPE_IMMEDIATE) {
1546 scsi_id->sbp2_device_type_and_lun = kv->value.immediate; 1537 scsi_id->sbp2_lun = ORB_SET_LUN(kv->value.immediate);
1547 } 1538 }
1548 break; 1539 break;
1549 1540
@@ -1636,7 +1627,7 @@ static void sbp2_parse_unit_directory(struct scsi_id_instance_data *scsi_id,
1636 scsi_id->sbp2_firmware_revision = firmware_revision; 1627 scsi_id->sbp2_firmware_revision = firmware_revision;
1637 scsi_id->workarounds = workarounds; 1628 scsi_id->workarounds = workarounds;
1638 if (ud->flags & UNIT_DIRECTORY_HAS_LUN) 1629 if (ud->flags & UNIT_DIRECTORY_HAS_LUN)
1639 scsi_id->sbp2_device_type_and_lun = ud->lun; 1630 scsi_id->sbp2_lun = ORB_SET_LUN(ud->lun);
1640 } 1631 }
1641} 1632}
1642 1633
@@ -2158,16 +2149,6 @@ static void sbp2_check_sbp2_response(struct scsi_id_instance_data *scsi_id,
2158 switch (SCpnt->cmnd[0]) { 2149 switch (SCpnt->cmnd[0]) {
2159 2150
2160 case INQUIRY: 2151 case INQUIRY:
2161
2162 /*
2163 * If scsi_id->sbp2_device_type_and_lun is uninitialized, then fill
2164 * this information in from the inquiry response data. Lun is set to zero.
2165 */
2166 if (scsi_id->sbp2_device_type_and_lun == SBP2_DEVICE_TYPE_LUN_UNINITIALIZED) {
2167 SBP2_DEBUG("Creating sbp2_device_type_and_lun from scsi inquiry data");
2168 scsi_id->sbp2_device_type_and_lun = (scsi_buf[0] & 0x1f) << 16;
2169 }
2170
2171 /* 2152 /*
2172 * Make sure data length is ok. Minimum length is 36 bytes 2153 * Make sure data length is ok. Minimum length is 36 bytes
2173 */ 2154 */
@@ -2665,10 +2646,7 @@ static ssize_t sbp2_sysfs_ieee1394_id_show(struct device *dev, struct device_att
2665 if (!(scsi_id = (struct scsi_id_instance_data *)sdev->host->hostdata[0])) 2646 if (!(scsi_id = (struct scsi_id_instance_data *)sdev->host->hostdata[0]))
2666 return 0; 2647 return 0;
2667 2648
2668 if (scsi_id->sbp2_device_type_and_lun == SBP2_DEVICE_TYPE_LUN_UNINITIALIZED) 2649 lun = ORB_SET_LUN(scsi_id->sbp2_lun);
2669 lun = 0;
2670 else
2671 lun = ORB_SET_LUN(scsi_id->sbp2_device_type_and_lun);
2672 2650
2673 return sprintf(buf, "%016Lx:%d:%d\n", (unsigned long long)scsi_id->ne->guid, 2651 return sprintf(buf, "%016Lx:%d:%d\n", (unsigned long long)scsi_id->ne->guid,
2674 scsi_id->ud->id, lun); 2652 scsi_id->ud->id, lun);
diff --git a/drivers/ieee1394/sbp2.h b/drivers/ieee1394/sbp2.h
index cb111d751143..890be1365523 100644
--- a/drivers/ieee1394/sbp2.h
+++ b/drivers/ieee1394/sbp2.h
@@ -229,9 +229,6 @@ struct sbp2_status_block {
229#define SBP2_DEVICE_TYPE_AND_LUN_KEY 0x14 229#define SBP2_DEVICE_TYPE_AND_LUN_KEY 0x14
230#define SBP2_FIRMWARE_REVISION_KEY 0x3c 230#define SBP2_FIRMWARE_REVISION_KEY 0x3c
231 231
232#define SBP2_DEVICE_TYPE(q) (((q) >> 16) & 0x1f)
233#define SBP2_DEVICE_LUN(q) ((q) & 0xffff)
234
235#define SBP2_AGENT_STATE_OFFSET 0x00ULL 232#define SBP2_AGENT_STATE_OFFSET 0x00ULL
236#define SBP2_AGENT_RESET_OFFSET 0x04ULL 233#define SBP2_AGENT_RESET_OFFSET 0x04ULL
237#define SBP2_ORB_POINTER_OFFSET 0x08ULL 234#define SBP2_ORB_POINTER_OFFSET 0x08ULL
@@ -256,8 +253,6 @@ struct sbp2_status_block {
256 */ 253 */
257#define SBP2_128KB_BROKEN_FIRMWARE 0xa0b800 254#define SBP2_128KB_BROKEN_FIRMWARE 0xa0b800
258 255
259#define SBP2_DEVICE_TYPE_LUN_UNINITIALIZED 0xffffffff
260
261/* 256/*
262 * SCSI specific stuff 257 * SCSI specific stuff
263 */ 258 */
@@ -379,7 +374,7 @@ struct scsi_id_instance_data {
379 u32 sbp2_command_set_spec_id; 374 u32 sbp2_command_set_spec_id;
380 u32 sbp2_command_set; 375 u32 sbp2_command_set;
381 u32 sbp2_unit_characteristics; 376 u32 sbp2_unit_characteristics;
382 u32 sbp2_device_type_and_lun; 377 u32 sbp2_lun;
383 u32 sbp2_firmware_revision; 378 u32 sbp2_firmware_revision;
384 379
385 /* 380 /*