device->queue_depth = PQI_PHYSICAL_DISK_DEFAULT_MAX_QUEUE_DEPTH;
return;
}
-
+ device->box_index = id_phys->box_index;
+ device->phys_box_on_bus = id_phys->phys_box_on_bus;
+ device->phy_connected_dev_type = id_phys->phy_connected_dev_type[0];
device->queue_depth =
get_unaligned_le16(&id_phys->current_queue_depth_limit);
device->device_type = id_phys->device_type;
existing_device->active_path_index = new_device->active_path_index;
existing_device->path_map = new_device->path_map;
existing_device->bay = new_device->bay;
+ existing_device->box_index = new_device->box_index;
+ existing_device->phys_box_on_bus = new_device->phys_box_on_bus;
+ existing_device->phy_connected_dev_type =
+ new_device->phy_connected_dev_type;
memcpy(existing_device->box, new_device->box,
sizeof(existing_device->box));
memcpy(existing_device->phys_connector, new_device->phys_connector,
device->aio_handle =
phys_lun_ext_entry->aio_handle;
}
- if (device->devtype == TYPE_DISK ||
- device->devtype == TYPE_ZBC) {
+
pqi_get_physical_disk_info(ctrl_info,
device, id_phys);
- }
+
} else {
memcpy(device->volume_id, log_lun_ext_entry->volume_id,
sizeof(device->volume_id));
static int pqi_sas_get_enclosure_identifier(struct sas_rphy *rphy,
u64 *identifier)
{
- return 0;
+
+ int rc;
+ unsigned long flags;
+ struct Scsi_Host *shost;
+ struct pqi_ctrl_info *ctrl_info;
+ struct pqi_scsi_dev *found_device;
+ struct pqi_scsi_dev *device;
+
+ if (!rphy)
+ return -ENODEV;
+
+ shost = rphy_to_shost(rphy);
+ ctrl_info = shost_to_hba(shost);
+ spin_lock_irqsave(&ctrl_info->scsi_device_list_lock, flags);
+ found_device = pqi_find_device_by_sas_rphy(ctrl_info, rphy);
+
+ if (!found_device) {
+ rc = -ENODEV;
+ goto out;
+ }
+
+ if (found_device->devtype == TYPE_ENCLOSURE) {
+ *identifier = get_unaligned_be64(&found_device->wwid);
+ rc = 0;
+ goto out;
+ }
+
+ if (found_device->box_index == 0xff ||
+ found_device->phys_box_on_bus == 0 ||
+ found_device->bay == 0xff) {
+ rc = -EINVAL;
+ goto out;
+ }
+
+ list_for_each_entry(device, &ctrl_info->scsi_device_list,
+ scsi_device_list_entry) {
+ if (device->devtype == TYPE_ENCLOSURE &&
+ device->box_index == found_device->box_index &&
+ device->phys_box_on_bus ==
+ found_device->phys_box_on_bus &&
+ memcmp(device->phys_connector,
+ found_device->phys_connector, 2) == 0) {
+ *identifier =
+ get_unaligned_be64(&device->wwid);
+ rc = 0;
+ goto out;
+ }
+ }
+
+ if (found_device->phy_connected_dev_type != SA_CONTROLLER_DEVICE) {
+ rc = -EINVAL;
+ goto out;
+ }
+
+ list_for_each_entry(device, &ctrl_info->scsi_device_list,
+ scsi_device_list_entry) {
+ if (device->devtype == TYPE_ENCLOSURE &&
+ CISS_GET_DRIVE_NUMBER(device->scsi3addr) ==
+ PQI_VSEP_CISS_BTL) {
+ *identifier = get_unaligned_be64(&device->wwid);
+ rc = 0;
+ goto out;
+ }
+ }
+
+ rc = -EINVAL;
+out:
+ spin_unlock_irqrestore(&ctrl_info->scsi_device_list_lock, flags);
+
+ return rc;
+
}
static int pqi_sas_get_bay_identifier(struct sas_rphy *rphy)
{
- return -ENXIO;
+
+ int rc;
+ unsigned long flags;
+ struct pqi_ctrl_info *ctrl_info;
+ struct pqi_scsi_dev *device;
+ struct Scsi_Host *shost;
+
+ if (!rphy)
+ return -ENODEV;
+
+ shost = rphy_to_shost(rphy);
+ ctrl_info = shost_to_hba(shost);
+ spin_lock_irqsave(&ctrl_info->scsi_device_list_lock, flags);
+ device = pqi_find_device_by_sas_rphy(ctrl_info, rphy);
+
+ if (!device) {
+ rc = -ENODEV;
+ goto out;
+ }
+
+ if (device->bay == 0xff)
+ rc = -EINVAL;
+ else
+ rc = device->bay;
+
+out:
+ spin_unlock_irqrestore(&ctrl_info->scsi_device_list_lock, flags);
+
+ return rc;
}
static int pqi_sas_phy_reset(struct sas_phy *phy, int hard_reset)