diff options
-rw-r--r-- | drivers/scsi/ipr.c | 43 | ||||
-rw-r--r-- | drivers/scsi/ipr.h | 4 |
2 files changed, 45 insertions, 2 deletions
diff --git a/drivers/scsi/ipr.c b/drivers/scsi/ipr.c index 52568588039f..67875d41345f 100644 --- a/drivers/scsi/ipr.c +++ b/drivers/scsi/ipr.c | |||
@@ -1096,6 +1096,7 @@ static void ipr_init_res_entry(struct ipr_resource_entry *res, | |||
1096 | res->bus = cfgtew->u.cfgte->res_addr.bus; | 1096 | res->bus = cfgtew->u.cfgte->res_addr.bus; |
1097 | res->target = cfgtew->u.cfgte->res_addr.target; | 1097 | res->target = cfgtew->u.cfgte->res_addr.target; |
1098 | res->lun = cfgtew->u.cfgte->res_addr.lun; | 1098 | res->lun = cfgtew->u.cfgte->res_addr.lun; |
1099 | res->lun_wwn = get_unaligned_be64(cfgtew->u.cfgte->lun_wwn); | ||
1099 | } | 1100 | } |
1100 | 1101 | ||
1101 | ipr_update_ata_class(res, proto); | 1102 | ipr_update_ata_class(res, proto); |
@@ -1142,7 +1143,7 @@ static char *ipr_format_res_path(u8 *res_path, char *buffer, int len) | |||
1142 | int i; | 1143 | int i; |
1143 | char *p = buffer; | 1144 | char *p = buffer; |
1144 | 1145 | ||
1145 | res_path[0] = '\0'; | 1146 | *p = '\0'; |
1146 | p += snprintf(p, buffer + len - p, "%02X", res_path[0]); | 1147 | p += snprintf(p, buffer + len - p, "%02X", res_path[0]); |
1147 | for (i = 1; res_path[i] != 0xff && ((i * 3) < len); i++) | 1148 | for (i = 1; res_path[i] != 0xff && ((i * 3) < len); i++) |
1148 | p += snprintf(p, buffer + len - p, "-%02X", res_path[i]); | 1149 | p += snprintf(p, buffer + len - p, "-%02X", res_path[i]); |
@@ -4089,6 +4090,7 @@ static int ipr_change_queue_type(struct scsi_device *sdev, int tag_type) | |||
4089 | /** | 4090 | /** |
4090 | * ipr_show_adapter_handle - Show the adapter's resource handle for this device | 4091 | * ipr_show_adapter_handle - Show the adapter's resource handle for this device |
4091 | * @dev: device struct | 4092 | * @dev: device struct |
4093 | * @attr: device attribute structure | ||
4092 | * @buf: buffer | 4094 | * @buf: buffer |
4093 | * | 4095 | * |
4094 | * Return value: | 4096 | * Return value: |
@@ -4122,6 +4124,7 @@ static struct device_attribute ipr_adapter_handle_attr = { | |||
4122 | * ipr_show_resource_path - Show the resource path or the resource address for | 4124 | * ipr_show_resource_path - Show the resource path or the resource address for |
4123 | * this device. | 4125 | * this device. |
4124 | * @dev: device struct | 4126 | * @dev: device struct |
4127 | * @attr: device attribute structure | ||
4125 | * @buf: buffer | 4128 | * @buf: buffer |
4126 | * | 4129 | * |
4127 | * Return value: | 4130 | * Return value: |
@@ -4159,8 +4162,45 @@ static struct device_attribute ipr_resource_path_attr = { | |||
4159 | }; | 4162 | }; |
4160 | 4163 | ||
4161 | /** | 4164 | /** |
4165 | * ipr_show_device_id - Show the device_id for this device. | ||
4166 | * @dev: device struct | ||
4167 | * @attr: device attribute structure | ||
4168 | * @buf: buffer | ||
4169 | * | ||
4170 | * Return value: | ||
4171 | * number of bytes printed to buffer | ||
4172 | **/ | ||
4173 | static ssize_t ipr_show_device_id(struct device *dev, struct device_attribute *attr, char *buf) | ||
4174 | { | ||
4175 | struct scsi_device *sdev = to_scsi_device(dev); | ||
4176 | struct ipr_ioa_cfg *ioa_cfg = (struct ipr_ioa_cfg *)sdev->host->hostdata; | ||
4177 | struct ipr_resource_entry *res; | ||
4178 | unsigned long lock_flags = 0; | ||
4179 | ssize_t len = -ENXIO; | ||
4180 | |||
4181 | spin_lock_irqsave(ioa_cfg->host->host_lock, lock_flags); | ||
4182 | res = (struct ipr_resource_entry *)sdev->hostdata; | ||
4183 | if (res && ioa_cfg->sis64) | ||
4184 | len = snprintf(buf, PAGE_SIZE, "0x%llx\n", res->dev_id); | ||
4185 | else if (res) | ||
4186 | len = snprintf(buf, PAGE_SIZE, "0x%llx\n", res->lun_wwn); | ||
4187 | |||
4188 | spin_unlock_irqrestore(ioa_cfg->host->host_lock, lock_flags); | ||
4189 | return len; | ||
4190 | } | ||
4191 | |||
4192 | static struct device_attribute ipr_device_id_attr = { | ||
4193 | .attr = { | ||
4194 | .name = "device_id", | ||
4195 | .mode = S_IRUGO, | ||
4196 | }, | ||
4197 | .show = ipr_show_device_id | ||
4198 | }; | ||
4199 | |||
4200 | /** | ||
4162 | * ipr_show_resource_type - Show the resource type for this device. | 4201 | * ipr_show_resource_type - Show the resource type for this device. |
4163 | * @dev: device struct | 4202 | * @dev: device struct |
4203 | * @attr: device attribute structure | ||
4164 | * @buf: buffer | 4204 | * @buf: buffer |
4165 | * | 4205 | * |
4166 | * Return value: | 4206 | * Return value: |
@@ -4195,6 +4235,7 @@ static struct device_attribute ipr_resource_type_attr = { | |||
4195 | static struct device_attribute *ipr_dev_attrs[] = { | 4235 | static struct device_attribute *ipr_dev_attrs[] = { |
4196 | &ipr_adapter_handle_attr, | 4236 | &ipr_adapter_handle_attr, |
4197 | &ipr_resource_path_attr, | 4237 | &ipr_resource_path_attr, |
4238 | &ipr_device_id_attr, | ||
4198 | &ipr_resource_type_attr, | 4239 | &ipr_resource_type_attr, |
4199 | NULL, | 4240 | NULL, |
4200 | }; | 4241 | }; |
diff --git a/drivers/scsi/ipr.h b/drivers/scsi/ipr.h index 4d31625ab9cf..16bc77a2be36 100644 --- a/drivers/scsi/ipr.h +++ b/drivers/scsi/ipr.h | |||
@@ -26,6 +26,7 @@ | |||
26 | #ifndef _IPR_H | 26 | #ifndef _IPR_H |
27 | #define _IPR_H | 27 | #define _IPR_H |
28 | 28 | ||
29 | #include <asm/unaligned.h> | ||
29 | #include <linux/types.h> | 30 | #include <linux/types.h> |
30 | #include <linux/completion.h> | 31 | #include <linux/completion.h> |
31 | #include <linux/libata.h> | 32 | #include <linux/libata.h> |
@@ -372,7 +373,7 @@ struct ipr_config_table_entry { | |||
372 | 373 | ||
373 | struct ipr_res_addr res_addr; | 374 | struct ipr_res_addr res_addr; |
374 | __be32 res_handle; | 375 | __be32 res_handle; |
375 | __be32 reserved4[2]; | 376 | __be32 lun_wwn[2]; |
376 | struct ipr_std_inq_data std_inq_data; | 377 | struct ipr_std_inq_data std_inq_data; |
377 | }__attribute__ ((packed, aligned (4))); | 378 | }__attribute__ ((packed, aligned (4))); |
378 | 379 | ||
@@ -1210,6 +1211,7 @@ struct ipr_resource_entry { | |||
1210 | 1211 | ||
1211 | __be32 res_handle; | 1212 | __be32 res_handle; |
1212 | __be64 dev_id; | 1213 | __be64 dev_id; |
1214 | __be64 lun_wwn; | ||
1213 | struct scsi_lun dev_lun; | 1215 | struct scsi_lun dev_lun; |
1214 | u8 res_path[8]; | 1216 | u8 res_path[8]; |
1215 | 1217 | ||