aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/s390/block
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/s390/block')
-rw-r--r--drivers/s390/block/dasd.c2
-rw-r--r--drivers/s390/block/dasd_devmap.c86
-rw-r--r--drivers/s390/block/dasd_eckd.c22
-rw-r--r--drivers/s390/block/xpram.c25
4 files changed, 54 insertions, 81 deletions
diff --git a/drivers/s390/block/dasd.c b/drivers/s390/block/dasd.c
index 4bf03fb67f8d..d8e9b95f0a1a 100644
--- a/drivers/s390/block/dasd.c
+++ b/drivers/s390/block/dasd.c
@@ -1730,8 +1730,8 @@ dasd_flush_request_queue(struct dasd_device * device)
1730 req = elv_next_request(device->request_queue); 1730 req = elv_next_request(device->request_queue);
1731 if (req == NULL) 1731 if (req == NULL)
1732 break; 1732 break;
1733 dasd_end_request(req, 0);
1734 blkdev_dequeue_request(req); 1733 blkdev_dequeue_request(req);
1734 dasd_end_request(req, 0);
1735 } 1735 }
1736 spin_unlock_irq(&device->request_queue_lock); 1736 spin_unlock_irq(&device->request_queue_lock);
1737} 1737}
diff --git a/drivers/s390/block/dasd_devmap.c b/drivers/s390/block/dasd_devmap.c
index 7f6fdac74706..9af02c79ce8a 100644
--- a/drivers/s390/block/dasd_devmap.c
+++ b/drivers/s390/block/dasd_devmap.c
@@ -48,18 +48,20 @@ struct dasd_devmap {
48}; 48};
49 49
50/* 50/*
51 * dasd_servermap is used to store the server_id of all storage servers 51 * dasd_server_ssid_map contains a globally unique storage server subsystem ID.
52 * accessed by DASD device driver. 52 * dasd_server_ssid_list contains the list of all subsystem IDs accessed by
53 * the DASD device driver.
53 */ 54 */
54struct dasd_servermap { 55struct dasd_server_ssid_map {
55 struct list_head list; 56 struct list_head list;
56 struct server_id { 57 struct system_id {
57 char vendor[4]; 58 char vendor[4];
58 char serial[15]; 59 char serial[15];
60 __u16 ssid;
59 } sid; 61 } sid;
60}; 62};
61 63
62static struct list_head dasd_serverlist; 64static struct list_head dasd_server_ssid_list;
63 65
64/* 66/*
65 * Parameter parsing functions for dasd= parameter. The syntax is: 67 * Parameter parsing functions for dasd= parameter. The syntax is:
@@ -89,7 +91,7 @@ static char *dasd[256];
89module_param_array(dasd, charp, NULL, 0); 91module_param_array(dasd, charp, NULL, 0);
90 92
91/* 93/*
92 * Single spinlock to protect devmap structures and lists. 94 * Single spinlock to protect devmap and servermap structures and lists.
93 */ 95 */
94static DEFINE_SPINLOCK(dasd_devmap_lock); 96static DEFINE_SPINLOCK(dasd_devmap_lock);
95 97
@@ -264,8 +266,9 @@ dasd_parse_keyword( char *parsestring ) {
264 if (dasd_page_cache) 266 if (dasd_page_cache)
265 return residual_str; 267 return residual_str;
266 dasd_page_cache = 268 dasd_page_cache =
267 kmem_cache_create("dasd_page_cache", PAGE_SIZE, 0, 269 kmem_cache_create("dasd_page_cache", PAGE_SIZE,
268 SLAB_CACHE_DMA, NULL, NULL ); 270 PAGE_SIZE, SLAB_CACHE_DMA,
271 NULL, NULL );
269 if (!dasd_page_cache) 272 if (!dasd_page_cache)
270 MESSAGE(KERN_WARNING, "%s", "Failed to create slab, " 273 MESSAGE(KERN_WARNING, "%s", "Failed to create slab, "
271 "fixed buffer mode disabled."); 274 "fixed buffer mode disabled.");
@@ -859,39 +862,6 @@ static struct attribute_group dasd_attr_group = {
859}; 862};
860 863
861/* 864/*
862 * Check if the related storage server is already contained in the
863 * dasd_serverlist. If server is not contained, create new entry.
864 * Return 0 if server was already in serverlist,
865 * 1 if the server was added successfully
866 * <0 in case of error.
867 */
868static int
869dasd_add_server(struct dasd_uid *uid)
870{
871 struct dasd_servermap *new, *tmp;
872
873 /* check if server is already contained */
874 list_for_each_entry(tmp, &dasd_serverlist, list)
875 // normale cmp?
876 if (strncmp(tmp->sid.vendor, uid->vendor,
877 sizeof(tmp->sid.vendor)) == 0
878 && strncmp(tmp->sid.serial, uid->serial,
879 sizeof(tmp->sid.serial)) == 0)
880 return 0;
881
882 new = (struct dasd_servermap *)
883 kzalloc(sizeof(struct dasd_servermap), GFP_KERNEL);
884 if (!new)
885 return -ENOMEM;
886
887 strncpy(new->sid.vendor, uid->vendor, sizeof(new->sid.vendor));
888 strncpy(new->sid.serial, uid->serial, sizeof(new->sid.serial));
889 list_add(&new->list, &dasd_serverlist);
890 return 1;
891}
892
893
894/*
895 * Return copy of the device unique identifier. 865 * Return copy of the device unique identifier.
896 */ 866 */
897int 867int
@@ -910,6 +880,9 @@ dasd_get_uid(struct ccw_device *cdev, struct dasd_uid *uid)
910 880
911/* 881/*
912 * Register the given device unique identifier into devmap struct. 882 * Register the given device unique identifier into devmap struct.
883 * In addition check if the related storage server subsystem ID is already
884 * contained in the dasd_server_ssid_list. If subsystem ID is not contained,
885 * create new entry.
913 * Return 0 if server was already in serverlist, 886 * Return 0 if server was already in serverlist,
914 * 1 if the server was added successful 887 * 1 if the server was added successful
915 * <0 in case of error. 888 * <0 in case of error.
@@ -918,16 +891,39 @@ int
918dasd_set_uid(struct ccw_device *cdev, struct dasd_uid *uid) 891dasd_set_uid(struct ccw_device *cdev, struct dasd_uid *uid)
919{ 892{
920 struct dasd_devmap *devmap; 893 struct dasd_devmap *devmap;
921 int rc; 894 struct dasd_server_ssid_map *srv, *tmp;
922 895
923 devmap = dasd_find_busid(cdev->dev.bus_id); 896 devmap = dasd_find_busid(cdev->dev.bus_id);
924 if (IS_ERR(devmap)) 897 if (IS_ERR(devmap))
925 return PTR_ERR(devmap); 898 return PTR_ERR(devmap);
899
900 /* generate entry for server_ssid_map */
901 srv = (struct dasd_server_ssid_map *)
902 kzalloc(sizeof(struct dasd_server_ssid_map), GFP_KERNEL);
903 if (!srv)
904 return -ENOMEM;
905 strncpy(srv->sid.vendor, uid->vendor, sizeof(srv->sid.vendor) - 1);
906 strncpy(srv->sid.serial, uid->serial, sizeof(srv->sid.serial) - 1);
907 srv->sid.ssid = uid->ssid;
908
909 /* server is already contained ? */
926 spin_lock(&dasd_devmap_lock); 910 spin_lock(&dasd_devmap_lock);
927 devmap->uid = *uid; 911 devmap->uid = *uid;
928 rc = dasd_add_server(uid); 912 list_for_each_entry(tmp, &dasd_server_ssid_list, list) {
913 if (!memcmp(&srv->sid, &tmp->sid,
914 sizeof(struct system_id))) {
915 kfree(srv);
916 srv = NULL;
917 break;
918 }
919 }
920
921 /* add servermap to serverlist */
922 if (srv)
923 list_add(&srv->list, &dasd_server_ssid_list);
929 spin_unlock(&dasd_devmap_lock); 924 spin_unlock(&dasd_devmap_lock);
930 return rc; 925
926 return (srv ? 1 : 0);
931} 927}
932EXPORT_SYMBOL_GPL(dasd_set_uid); 928EXPORT_SYMBOL_GPL(dasd_set_uid);
933 929
@@ -995,7 +991,7 @@ dasd_devmap_init(void)
995 INIT_LIST_HEAD(&dasd_hashlists[i]); 991 INIT_LIST_HEAD(&dasd_hashlists[i]);
996 992
997 /* Initialize servermap structure. */ 993 /* Initialize servermap structure. */
998 INIT_LIST_HEAD(&dasd_serverlist); 994 INIT_LIST_HEAD(&dasd_server_ssid_list);
999 return 0; 995 return 0;
1000} 996}
1001 997
diff --git a/drivers/s390/block/dasd_eckd.c b/drivers/s390/block/dasd_eckd.c
index 39c2281371b5..b7a7fac3f7c3 100644
--- a/drivers/s390/block/dasd_eckd.c
+++ b/drivers/s390/block/dasd_eckd.c
@@ -468,11 +468,11 @@ dasd_eckd_generate_uid(struct dasd_device *device, struct dasd_uid *uid)
468 return -ENODEV; 468 return -ENODEV;
469 469
470 memset(uid, 0, sizeof(struct dasd_uid)); 470 memset(uid, 0, sizeof(struct dasd_uid));
471 strncpy(uid->vendor, confdata->ned1.HDA_manufacturer, 471 memcpy(uid->vendor, confdata->ned1.HDA_manufacturer,
472 sizeof(uid->vendor) - 1); 472 sizeof(uid->vendor) - 1);
473 EBCASC(uid->vendor, sizeof(uid->vendor) - 1); 473 EBCASC(uid->vendor, sizeof(uid->vendor) - 1);
474 strncpy(uid->serial, confdata->ned1.HDA_location, 474 memcpy(uid->serial, confdata->ned1.HDA_location,
475 sizeof(uid->serial) - 1); 475 sizeof(uid->serial) - 1);
476 EBCASC(uid->serial, sizeof(uid->serial) - 1); 476 EBCASC(uid->serial, sizeof(uid->serial) - 1);
477 uid->ssid = confdata->neq.subsystemID; 477 uid->ssid = confdata->neq.subsystemID;
478 if (confdata->ned2.sneq.flags == 0x40) { 478 if (confdata->ned2.sneq.flags == 0x40) {
@@ -607,7 +607,7 @@ dasd_eckd_psf_ssc(struct dasd_device *device)
607 * Valide storage server of current device. 607 * Valide storage server of current device.
608 */ 608 */
609static int 609static int
610dasd_eckd_validate_server(struct dasd_device *device) 610dasd_eckd_validate_server(struct dasd_device *device, struct dasd_uid *uid)
611{ 611{
612 int rc; 612 int rc;
613 613
@@ -616,11 +616,11 @@ dasd_eckd_validate_server(struct dasd_device *device)
616 return 0; 616 return 0;
617 617
618 rc = dasd_eckd_psf_ssc(device); 618 rc = dasd_eckd_psf_ssc(device);
619 if (rc) 619 /* may be requested feature is not available on server,
620 /* may be requested feature is not available on server, 620 * therefore just report error and go ahead */
621 * therefore just report error and go ahead */ 621 DEV_MESSAGE(KERN_INFO, device,
622 DEV_MESSAGE(KERN_INFO, device, 622 "PSF-SSC on storage subsystem %s.%s.%04x returned rc=%d",
623 "Perform Subsystem Function returned rc=%d", rc); 623 uid->vendor, uid->serial, uid->ssid, rc);
624 /* RE-Read Configuration Data */ 624 /* RE-Read Configuration Data */
625 return dasd_eckd_read_conf(device); 625 return dasd_eckd_read_conf(device);
626} 626}
@@ -666,7 +666,7 @@ dasd_eckd_check_characteristics(struct dasd_device *device)
666 return rc; 666 return rc;
667 rc = dasd_set_uid(device->cdev, &uid); 667 rc = dasd_set_uid(device->cdev, &uid);
668 if (rc == 1) /* new server found */ 668 if (rc == 1) /* new server found */
669 rc = dasd_eckd_validate_server(device); 669 rc = dasd_eckd_validate_server(device, &uid);
670 if (rc) 670 if (rc)
671 return rc; 671 return rc;
672 672
diff --git a/drivers/s390/block/xpram.c b/drivers/s390/block/xpram.c
index 1140302ff11d..ca7d51f7eccc 100644
--- a/drivers/s390/block/xpram.c
+++ b/drivers/s390/block/xpram.c
@@ -48,15 +48,6 @@
48#define PRINT_ERR(x...) printk(KERN_ERR XPRAM_NAME " error:" x) 48#define PRINT_ERR(x...) printk(KERN_ERR XPRAM_NAME " error:" x)
49 49
50 50
51static struct sysdev_class xpram_sysclass = {
52 set_kset_name("xpram"),
53};
54
55static struct sys_device xpram_sys_device = {
56 .id = 0,
57 .cls = &xpram_sysclass,
58};
59
60typedef struct { 51typedef struct {
61 unsigned int size; /* size of xpram segment in pages */ 52 unsigned int size; /* size of xpram segment in pages */
62 unsigned int offset; /* start page of xpram segment */ 53 unsigned int offset; /* start page of xpram segment */
@@ -451,8 +442,6 @@ static void __exit xpram_exit(void)
451 } 442 }
452 unregister_blkdev(XPRAM_MAJOR, XPRAM_NAME); 443 unregister_blkdev(XPRAM_MAJOR, XPRAM_NAME);
453 blk_cleanup_queue(xpram_queue); 444 blk_cleanup_queue(xpram_queue);
454 sysdev_unregister(&xpram_sys_device);
455 sysdev_class_unregister(&xpram_sysclass);
456} 445}
457 446
458static int __init xpram_init(void) 447static int __init xpram_init(void)
@@ -470,19 +459,7 @@ static int __init xpram_init(void)
470 rc = xpram_setup_sizes(xpram_pages); 459 rc = xpram_setup_sizes(xpram_pages);
471 if (rc) 460 if (rc)
472 return rc; 461 return rc;
473 rc = sysdev_class_register(&xpram_sysclass); 462 return xpram_setup_blkdev();
474 if (rc)
475 return rc;
476
477 rc = sysdev_register(&xpram_sys_device);
478 if (rc) {
479 sysdev_class_unregister(&xpram_sysclass);
480 return rc;
481 }
482 rc = xpram_setup_blkdev();
483 if (rc)
484 sysdev_unregister(&xpram_sys_device);
485 return rc;
486} 463}
487 464
488module_init(xpram_init); 465module_init(xpram_init);