Lines Matching refs:tgt

119 	struct sbp2_target *tgt;  member
169 static struct fw_device *target_parent_device(struct sbp2_target *tgt) in target_parent_device() argument
171 return fw_parent_device(tgt->unit); in target_parent_device()
174 static const struct device *tgt_dev(const struct sbp2_target *tgt) in tgt_dev() argument
176 return &tgt->unit->device; in tgt_dev()
181 return &lu->tgt->unit->device; in lu_dev()
435 spin_lock_irqsave(&lu->tgt->lock, flags); in sbp2_status_write()
444 spin_unlock_irqrestore(&lu->tgt->lock, flags); in sbp2_status_write()
471 spin_lock_irqsave(&orb->lu->tgt->lock, flags); in complete_transaction()
477 spin_unlock_irqrestore(&orb->lu->tgt->lock, flags); in complete_transaction()
482 spin_unlock_irqrestore(&orb->lu->tgt->lock, flags); in complete_transaction()
491 struct fw_device *device = target_parent_device(lu->tgt); in sbp2_send_orb()
499 spin_lock_irqsave(&lu->tgt->lock, flags); in sbp2_send_orb()
501 spin_unlock_irqrestore(&lu->tgt->lock, flags); in sbp2_send_orb()
513 struct fw_device *device = target_parent_device(lu->tgt); in sbp2_cancel_orbs()
519 spin_lock_irq(&lu->tgt->lock); in sbp2_cancel_orbs()
521 spin_unlock_irq(&lu->tgt->lock); in sbp2_cancel_orbs()
551 struct fw_device *device = target_parent_device(lu->tgt); in sbp2_send_management_orb()
590 timeout = lu->tgt->mgt_orb_timeout; in sbp2_send_management_orb()
605 lu->tgt->management_agent_address); in sbp2_send_management_orb()
647 struct fw_device *device = target_parent_device(lu->tgt); in sbp2_agent_reset()
651 lu->tgt->node_id, lu->generation, device->max_speed, in sbp2_agent_reset()
664 struct fw_device *device = target_parent_device(lu->tgt); in sbp2_agent_reset_no_wait()
673 lu->tgt->node_id, lu->generation, device->max_speed, in sbp2_agent_reset_no_wait()
678 static inline void sbp2_allow_block(struct sbp2_target *tgt) in sbp2_allow_block() argument
680 spin_lock_irq(&tgt->lock); in sbp2_allow_block()
681 --tgt->dont_block; in sbp2_allow_block()
682 spin_unlock_irq(&tgt->lock); in sbp2_allow_block()
697 struct sbp2_target *tgt = lu->tgt; in sbp2_conditionally_block() local
698 struct fw_card *card = target_parent_device(tgt)->card; in sbp2_conditionally_block()
700 container_of((void *)tgt, struct Scsi_Host, hostdata[0]); in sbp2_conditionally_block()
703 spin_lock_irqsave(&tgt->lock, flags); in sbp2_conditionally_block()
704 if (!tgt->dont_block && !lu->blocked && in sbp2_conditionally_block()
707 if (++tgt->blocked == 1) in sbp2_conditionally_block()
710 spin_unlock_irqrestore(&tgt->lock, flags); in sbp2_conditionally_block()
721 struct sbp2_target *tgt = lu->tgt; in sbp2_conditionally_unblock() local
722 struct fw_card *card = target_parent_device(tgt)->card; in sbp2_conditionally_unblock()
724 container_of((void *)tgt, struct Scsi_Host, hostdata[0]); in sbp2_conditionally_unblock()
727 spin_lock_irq(&tgt->lock); in sbp2_conditionally_unblock()
730 unblock = --tgt->blocked == 0; in sbp2_conditionally_unblock()
732 spin_unlock_irq(&tgt->lock); in sbp2_conditionally_unblock()
744 static void sbp2_unblock(struct sbp2_target *tgt) in sbp2_unblock() argument
747 container_of((void *)tgt, struct Scsi_Host, hostdata[0]); in sbp2_unblock()
749 spin_lock_irq(&tgt->lock); in sbp2_unblock()
750 ++tgt->dont_block; in sbp2_unblock()
751 spin_unlock_irq(&tgt->lock); in sbp2_unblock()
785 struct fw_device *device = target_parent_device(lu->tgt); in sbp2_set_busy_timeout()
789 lu->tgt->node_id, lu->generation, device->max_speed, in sbp2_set_busy_timeout()
799 struct sbp2_target *tgt = lu->tgt; in sbp2_login() local
800 struct fw_device *device = target_parent_device(tgt); in sbp2_login()
824 dev_err(tgt_dev(tgt), "failed to login to LUN %04x\n", in sbp2_login()
827 sbp2_unblock(lu->tgt); in sbp2_login()
832 tgt->node_id = node_id; in sbp2_login()
833 tgt->address_high = local_node_id << 16; in sbp2_login()
842 dev_notice(tgt_dev(tgt), "logged in to LUN %04x (%d retries)\n", in sbp2_login()
859 if (lu->tgt->workarounds & SBP2_WORKAROUND_DELAY_INQUIRY) in sbp2_login()
862 shost = container_of((void *)tgt, struct Scsi_Host, hostdata[0]); in sbp2_login()
887 sbp2_allow_block(tgt); in sbp2_login()
909 struct sbp2_target *tgt = lu->tgt; in sbp2_reconnect() local
910 struct fw_device *device = target_parent_device(tgt); in sbp2_reconnect()
934 dev_err(tgt_dev(tgt), "failed to reconnect\n"); in sbp2_reconnect()
943 tgt->node_id = node_id; in sbp2_reconnect()
944 tgt->address_high = local_node_id << 16; in sbp2_reconnect()
948 dev_notice(tgt_dev(tgt), "reconnected to LUN %04x (%d retries)\n", in sbp2_reconnect()
963 static int sbp2_add_logical_unit(struct sbp2_target *tgt, int lun_entry) in sbp2_add_logical_unit() argument
981 lu->tgt = tgt; in sbp2_add_logical_unit()
987 ++tgt->dont_block; in sbp2_add_logical_unit()
992 list_add_tail(&lu->link, &tgt->lu_list); in sbp2_add_logical_unit()
996 static void sbp2_get_unit_unique_id(struct sbp2_target *tgt, in sbp2_get_unit_unique_id() argument
1000 tgt->guid = (u64)leaf[1] << 32 | leaf[2]; in sbp2_get_unit_unique_id()
1003 static int sbp2_scan_logical_unit_dir(struct sbp2_target *tgt, in sbp2_scan_logical_unit_dir() argument
1012 sbp2_add_logical_unit(tgt, value) < 0) in sbp2_scan_logical_unit_dir()
1017 static int sbp2_scan_unit_dir(struct sbp2_target *tgt, const u32 *directory, in sbp2_scan_unit_dir() argument
1028 tgt->management_agent_address = in sbp2_scan_unit_dir()
1033 tgt->directory_id = value; in sbp2_scan_unit_dir()
1046 tgt->mgt_orb_timeout = (value >> 8 & 0xff) * 500; in sbp2_scan_unit_dir()
1050 if (sbp2_add_logical_unit(tgt, value) < 0) in sbp2_scan_unit_dir()
1055 sbp2_get_unit_unique_id(tgt, ci.p - 1 + value); in sbp2_scan_unit_dir()
1060 if (sbp2_scan_logical_unit_dir(tgt, ci.p - 1 + value) < 0) in sbp2_scan_unit_dir()
1073 static void sbp2_clamp_management_orb_timeout(struct sbp2_target *tgt) in sbp2_clamp_management_orb_timeout() argument
1075 unsigned int timeout = tgt->mgt_orb_timeout; in sbp2_clamp_management_orb_timeout()
1078 dev_notice(tgt_dev(tgt), "%ds mgt_ORB_timeout limited to 40s\n", in sbp2_clamp_management_orb_timeout()
1081 tgt->mgt_orb_timeout = clamp_val(timeout, 5000, 40000); in sbp2_clamp_management_orb_timeout()
1084 static void sbp2_init_workarounds(struct sbp2_target *tgt, u32 model, in sbp2_init_workarounds() argument
1091 dev_notice(tgt_dev(tgt), in sbp2_init_workarounds()
1113 dev_notice(tgt_dev(tgt), "workarounds 0x%x " in sbp2_init_workarounds()
1116 tgt->workarounds = w; in sbp2_init_workarounds()
1125 struct sbp2_target *tgt; in sbp2_probe() local
1134 shost = scsi_host_alloc(&scsi_driver_template, sizeof(*tgt)); in sbp2_probe()
1138 tgt = (struct sbp2_target *)shost->hostdata; in sbp2_probe()
1139 dev_set_drvdata(&unit->device, tgt); in sbp2_probe()
1140 tgt->unit = unit; in sbp2_probe()
1141 INIT_LIST_HEAD(&tgt->lu_list); in sbp2_probe()
1142 spin_lock_init(&tgt->lock); in sbp2_probe()
1143 tgt->guid = (u64)device->config_rom[3] << 32 | device->config_rom[4]; in sbp2_probe()
1155 tgt->directory_id = ((unit->directory - device->config_rom) * 4 in sbp2_probe()
1161 if (sbp2_scan_unit_dir(tgt, unit->directory, &model, in sbp2_probe()
1165 sbp2_clamp_management_orb_timeout(tgt); in sbp2_probe()
1166 sbp2_init_workarounds(tgt, model, firmware_revision); in sbp2_probe()
1174 tgt->max_payload = min3(device->max_speed + 7, 10U, in sbp2_probe()
1178 list_for_each_entry(lu, &tgt->lu_list, link) in sbp2_probe()
1194 struct sbp2_target *tgt = dev_get_drvdata(&unit->device); in sbp2_update() local
1203 list_for_each_entry(lu, &tgt->lu_list, link) { in sbp2_update()
1213 struct sbp2_target *tgt = dev_get_drvdata(&unit->device); in sbp2_remove() local
1216 container_of((void *)tgt, struct Scsi_Host, hostdata[0]); in sbp2_remove()
1220 sbp2_unblock(tgt); in sbp2_remove()
1222 list_for_each_entry_safe(lu, next, &tgt->lu_list, link) { in sbp2_remove()
1339 struct fw_device *device = target_parent_device(base_orb->lu->tgt); in complete_command_orb()
1400 cpu_to_be32(lu->tgt->address_high); in sbp2_map_scatterlist()
1426 orb->request.data_descriptor.high = cpu_to_be32(lu->tgt->address_high); in sbp2_map_scatterlist()
1445 struct fw_device *device = target_parent_device(lu->tgt); in sbp2_scsi_queuecommand()
1459 COMMAND_ORB_MAX_PAYLOAD(lu->tgt->max_payload) | in sbp2_scsi_queuecommand()
1483 sbp2_send_orb(&orb->base, lu, lu->tgt->node_id, generation, in sbp2_scsi_queuecommand()
1507 if (lu->tgt->workarounds & SBP2_WORKAROUND_INQUIRY_36) in sbp2_scsi_slave_alloc()
1526 lu->tgt->workarounds & SBP2_WORKAROUND_MODE_SENSE_8) in sbp2_scsi_slave_configure()
1529 if (lu->tgt->workarounds & SBP2_WORKAROUND_FIX_CAPACITY) in sbp2_scsi_slave_configure()
1532 if (lu->tgt->workarounds & SBP2_WORKAROUND_POWER_CONDITION) in sbp2_scsi_slave_configure()
1535 if (lu->tgt->workarounds & SBP2_WORKAROUND_128K_MAX_TRANS) in sbp2_scsi_slave_configure()
1575 (unsigned long long)lu->tgt->guid, in sbp2_sysfs_ieee1394_id_show()
1576 lu->tgt->directory_id, lu->lun); in sbp2_sysfs_ieee1394_id_show()