summaryrefslogtreecommitdiffstats
path: root/drivers/s390/block/dasd_devmap.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/s390/block/dasd_devmap.c')
-rw-r--r--drivers/s390/block/dasd_devmap.c94
1 files changed, 37 insertions, 57 deletions
diff --git a/drivers/s390/block/dasd_devmap.c b/drivers/s390/block/dasd_devmap.c
index 0c67258fb9ec..f4fb40257348 100644
--- a/drivers/s390/block/dasd_devmap.c
+++ b/drivers/s390/block/dasd_devmap.c
@@ -49,22 +49,6 @@ struct dasd_devmap {
};
/*
- * dasd_server_ssid_map contains a globally unique storage server subsystem ID.
- * dasd_server_ssid_list contains the list of all subsystem IDs accessed by
- * the DASD device driver.
- */
-struct dasd_server_ssid_map {
- struct list_head list;
- struct system_id {
- char vendor[4];
- char serial[15];
- __u16 ssid;
- } sid;
-};
-
-static struct list_head dasd_server_ssid_list;
-
-/*
* Parameter parsing functions for dasd= parameter. The syntax is:
* <devno> : (0x)?[0-9a-fA-F]+
* <busid> : [0-0a-f]\.[0-9a-f]\.(0x)?[0-9a-fA-F]+
@@ -721,8 +705,9 @@ dasd_ro_store(struct device *dev, struct device_attribute *attr,
devmap->features &= ~DASD_FEATURE_READONLY;
if (devmap->device)
devmap->device->features = devmap->features;
- if (devmap->device && devmap->device->gdp)
- set_disk_ro(devmap->device->gdp, val);
+ if (devmap->device && devmap->device->block
+ && devmap->device->block->gdp)
+ set_disk_ro(devmap->device->block->gdp, val);
spin_unlock(&dasd_devmap_lock);
return count;
}
@@ -893,12 +878,16 @@ dasd_alias_show(struct device *dev, struct device_attribute *attr, char *buf)
devmap = dasd_find_busid(dev->bus_id);
spin_lock(&dasd_devmap_lock);
- if (!IS_ERR(devmap))
- alias = devmap->uid.alias;
+ if (IS_ERR(devmap) || strlen(devmap->uid.vendor) == 0) {
+ spin_unlock(&dasd_devmap_lock);
+ return sprintf(buf, "0\n");
+ }
+ if (devmap->uid.type == UA_BASE_PAV_ALIAS ||
+ devmap->uid.type == UA_HYPER_PAV_ALIAS)
+ alias = 1;
else
alias = 0;
spin_unlock(&dasd_devmap_lock);
-
return sprintf(buf, alias ? "1\n" : "0\n");
}
@@ -930,19 +919,36 @@ static ssize_t
dasd_uid_show(struct device *dev, struct device_attribute *attr, char *buf)
{
struct dasd_devmap *devmap;
- char uid[UID_STRLEN];
+ char uid_string[UID_STRLEN];
+ char ua_string[3];
+ struct dasd_uid *uid;
devmap = dasd_find_busid(dev->bus_id);
spin_lock(&dasd_devmap_lock);
- if (!IS_ERR(devmap) && strlen(devmap->uid.vendor) > 0)
- snprintf(uid, sizeof(uid), "%s.%s.%04x.%02x",
- devmap->uid.vendor, devmap->uid.serial,
- devmap->uid.ssid, devmap->uid.unit_addr);
- else
- uid[0] = 0;
+ if (IS_ERR(devmap) || strlen(devmap->uid.vendor) == 0) {
+ spin_unlock(&dasd_devmap_lock);
+ return sprintf(buf, "\n");
+ }
+ uid = &devmap->uid;
+ switch (uid->type) {
+ case UA_BASE_DEVICE:
+ sprintf(ua_string, "%02x", uid->real_unit_addr);
+ break;
+ case UA_BASE_PAV_ALIAS:
+ sprintf(ua_string, "%02x", uid->base_unit_addr);
+ break;
+ case UA_HYPER_PAV_ALIAS:
+ sprintf(ua_string, "xx");
+ break;
+ default:
+ /* should not happen, treat like base device */
+ sprintf(ua_string, "%02x", uid->real_unit_addr);
+ break;
+ }
+ snprintf(uid_string, sizeof(uid_string), "%s.%s.%04x.%s",
+ uid->vendor, uid->serial, uid->ssid, ua_string);
spin_unlock(&dasd_devmap_lock);
-
- return snprintf(buf, PAGE_SIZE, "%s\n", uid);
+ return snprintf(buf, PAGE_SIZE, "%s\n", uid_string);
}
static DEVICE_ATTR(uid, 0444, dasd_uid_show, NULL);
@@ -1040,39 +1046,16 @@ int
dasd_set_uid(struct ccw_device *cdev, struct dasd_uid *uid)
{
struct dasd_devmap *devmap;
- struct dasd_server_ssid_map *srv, *tmp;
devmap = dasd_find_busid(cdev->dev.bus_id);
if (IS_ERR(devmap))
return PTR_ERR(devmap);
- /* generate entry for server_ssid_map */
- srv = (struct dasd_server_ssid_map *)
- kzalloc(sizeof(struct dasd_server_ssid_map), GFP_KERNEL);
- if (!srv)
- return -ENOMEM;
- strncpy(srv->sid.vendor, uid->vendor, sizeof(srv->sid.vendor) - 1);
- strncpy(srv->sid.serial, uid->serial, sizeof(srv->sid.serial) - 1);
- srv->sid.ssid = uid->ssid;
-
- /* server is already contained ? */
spin_lock(&dasd_devmap_lock);
devmap->uid = *uid;
- list_for_each_entry(tmp, &dasd_server_ssid_list, list) {
- if (!memcmp(&srv->sid, &tmp->sid,
- sizeof(struct system_id))) {
- kfree(srv);
- srv = NULL;
- break;
- }
- }
-
- /* add servermap to serverlist */
- if (srv)
- list_add(&srv->list, &dasd_server_ssid_list);
spin_unlock(&dasd_devmap_lock);
- return (srv ? 1 : 0);
+ return 0;
}
EXPORT_SYMBOL_GPL(dasd_set_uid);
@@ -1138,9 +1121,6 @@ dasd_devmap_init(void)
dasd_max_devindex = 0;
for (i = 0; i < 256; i++)
INIT_LIST_HEAD(&dasd_hashlists[i]);
-
- /* Initialize servermap structure. */
- INIT_LIST_HEAD(&dasd_server_ssid_list);
return 0;
}
OpenPOWER on IntegriCloud