aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@woody.linux-foundation.org>2007-07-28 22:33:23 -0400
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-07-28 22:33:23 -0400
commit9873aed5a90aefb1642a85070c35088cca8b6a92 (patch)
treebe7d6cf2a3e0c71faa861e0c5d0c9bc4c5f40a10 /drivers
parent7b5573769f26a23518b33a64ec129d2833564877 (diff)
parent5aaaf9f0ed11882fe7c6bc4202f78da1baa8caba (diff)
Merge branch 'for-linus' of git://git390.osdl.marist.edu/pub/scm/linux-2.6
* 'for-linus' of git://git390.osdl.marist.edu/pub/scm/linux-2.6: [S390] Fix sclp_vt220 error handling. [S390] cio: Reorganize initialization. [S390] cio: Make CIO_* macros safe if dbfs are not available. [S390] cio: Clean up messages. [S390] Fix IRQ tracing. [S390] vmur: fix diag14_read. [S390] Wire up sys_fallocate. [S390] add types.h include to s390_ext.h [S390] cio: Remove deprecated rdc/rcd. [S390] Get rid of new section mismatch warnings. [S390] sclp: kill unused SCLP config option. [S390] cio: Remove remains of _ccw_device_get_device_number(). [S390] cio: css_sch_device_register() can be made static. [S390] Improve __smp_call_function_map. [S390] Convert to smp_call_function_single.
Diffstat (limited to 'drivers')
-rw-r--r--drivers/s390/char/Kconfig12
-rw-r--r--drivers/s390/char/raw3270.c6
-rw-r--r--drivers/s390/char/sclp_vt220.c62
-rw-r--r--drivers/s390/char/vmur.c2
-rw-r--r--drivers/s390/cio/blacklist.c19
-rw-r--r--drivers/s390/cio/ccwgroup.c3
-rw-r--r--drivers/s390/cio/chp.c19
-rw-r--r--drivers/s390/cio/chsc.c26
-rw-r--r--drivers/s390/cio/chsc.h2
-rw-r--r--drivers/s390/cio/cio.c13
-rw-r--r--drivers/s390/cio/cio_debug.h2
-rw-r--r--drivers/s390/cio/cmf.c16
-rw-r--r--drivers/s390/cio/css.c32
-rw-r--r--drivers/s390/cio/css.h1
-rw-r--r--drivers/s390/cio/device.c60
-rw-r--r--drivers/s390/cio/device_fsm.c20
-rw-r--r--drivers/s390/cio/device_ops.c257
17 files changed, 160 insertions, 392 deletions
diff --git a/drivers/s390/char/Kconfig b/drivers/s390/char/Kconfig
index 3f36cb3910ee..643033890e34 100644
--- a/drivers/s390/char/Kconfig
+++ b/drivers/s390/char/Kconfig
@@ -44,15 +44,9 @@ config CCW_CONSOLE
44 depends on TN3215_CONSOLE || TN3270_CONSOLE 44 depends on TN3215_CONSOLE || TN3270_CONSOLE
45 default y 45 default y
46 46
47config SCLP
48 bool "Support for SCLP"
49 depends on S390
50 help
51 Include support for the SCLP interface to the service element.
52
53config SCLP_TTY 47config SCLP_TTY
54 bool "Support for SCLP line mode terminal" 48 bool "Support for SCLP line mode terminal"
55 depends on SCLP 49 depends on S390
56 help 50 help
57 Include support for IBM SCLP line-mode terminals. 51 Include support for IBM SCLP line-mode terminals.
58 52
@@ -65,7 +59,7 @@ config SCLP_CONSOLE
65 59
66config SCLP_VT220_TTY 60config SCLP_VT220_TTY
67 bool "Support for SCLP VT220-compatible terminal" 61 bool "Support for SCLP VT220-compatible terminal"
68 depends on SCLP 62 depends on S390
69 help 63 help
70 Include support for an IBM SCLP VT220-compatible terminal. 64 Include support for an IBM SCLP VT220-compatible terminal.
71 65
@@ -78,7 +72,7 @@ config SCLP_VT220_CONSOLE
78 72
79config SCLP_CPI 73config SCLP_CPI
80 tristate "Control-Program Identification" 74 tristate "Control-Program Identification"
81 depends on SCLP 75 depends on S390
82 help 76 help
83 This option enables the hardware console interface for system 77 This option enables the hardware console interface for system
84 identification. This is commonly used for workload management and 78 identification. This is commonly used for workload management and
diff --git a/drivers/s390/char/raw3270.c b/drivers/s390/char/raw3270.c
index 743944ad61ec..4f2f81b16cfa 100644
--- a/drivers/s390/char/raw3270.c
+++ b/drivers/s390/char/raw3270.c
@@ -147,8 +147,7 @@ raw3270_request_alloc(size_t size)
147 * Allocate a new 3270 ccw request from bootmem. Only works very 147 * Allocate a new 3270 ccw request from bootmem. Only works very
148 * early in the boot process. Only con3270.c should be using this. 148 * early in the boot process. Only con3270.c should be using this.
149 */ 149 */
150struct raw3270_request * 150struct raw3270_request __init *raw3270_request_alloc_bootmem(size_t size)
151raw3270_request_alloc_bootmem(size_t size)
152{ 151{
153 struct raw3270_request *rq; 152 struct raw3270_request *rq;
154 153
@@ -848,8 +847,7 @@ raw3270_setup_device(struct ccw_device *cdev, struct raw3270 *rp, char *ascebc)
848/* 847/*
849 * Setup 3270 device configured as console. 848 * Setup 3270 device configured as console.
850 */ 849 */
851struct raw3270 * 850struct raw3270 __init *raw3270_setup_console(struct ccw_device *cdev)
852raw3270_setup_console(struct ccw_device *cdev)
853{ 851{
854 struct raw3270 *rp; 852 struct raw3270 *rp;
855 char *ascebc; 853 char *ascebc;
diff --git a/drivers/s390/char/sclp_vt220.c b/drivers/s390/char/sclp_vt220.c
index 726334757bbf..40cd21bc5cc4 100644
--- a/drivers/s390/char/sclp_vt220.c
+++ b/drivers/s390/char/sclp_vt220.c
@@ -621,11 +621,24 @@ sclp_vt220_flush_buffer(struct tty_struct *tty)
621/* 621/*
622 * Initialize all relevant components and register driver with system. 622 * Initialize all relevant components and register driver with system.
623 */ 623 */
624static int 624static void __init __sclp_vt220_cleanup(void)
625__sclp_vt220_init(int early) 625{
626 struct list_head *page, *p;
627
628 list_for_each_safe(page, p, &sclp_vt220_empty) {
629 list_del(page);
630 if (slab_is_available())
631 free_page((unsigned long) page);
632 else
633 free_bootmem((unsigned long) page, PAGE_SIZE);
634 }
635}
636
637static int __init __sclp_vt220_init(void)
626{ 638{
627 void *page; 639 void *page;
628 int i; 640 int i;
641 int num_pages;
629 642
630 if (sclp_vt220_initialized) 643 if (sclp_vt220_initialized)
631 return 0; 644 return 0;
@@ -642,13 +655,16 @@ __sclp_vt220_init(int early)
642 sclp_vt220_flush_later = 0; 655 sclp_vt220_flush_later = 0;
643 656
644 /* Allocate pages for output buffering */ 657 /* Allocate pages for output buffering */
645 for (i = 0; i < (early ? MAX_CONSOLE_PAGES : MAX_KMEM_PAGES); i++) { 658 num_pages = slab_is_available() ? MAX_KMEM_PAGES : MAX_CONSOLE_PAGES;
646 if (early) 659 for (i = 0; i < num_pages; i++) {
647 page = alloc_bootmem_low_pages(PAGE_SIZE); 660 if (slab_is_available())
648 else
649 page = (void *) get_zeroed_page(GFP_KERNEL | GFP_DMA); 661 page = (void *) get_zeroed_page(GFP_KERNEL | GFP_DMA);
650 if (!page) 662 else
663 page = alloc_bootmem_low_pages(PAGE_SIZE);
664 if (!page) {
665 __sclp_vt220_cleanup();
651 return -ENOMEM; 666 return -ENOMEM;
667 }
652 list_add_tail((struct list_head *) page, &sclp_vt220_empty); 668 list_add_tail((struct list_head *) page, &sclp_vt220_empty);
653 } 669 }
654 return 0; 670 return 0;
@@ -662,14 +678,13 @@ static const struct tty_operations sclp_vt220_ops = {
662 .flush_chars = sclp_vt220_flush_chars, 678 .flush_chars = sclp_vt220_flush_chars,
663 .write_room = sclp_vt220_write_room, 679 .write_room = sclp_vt220_write_room,
664 .chars_in_buffer = sclp_vt220_chars_in_buffer, 680 .chars_in_buffer = sclp_vt220_chars_in_buffer,
665 .flush_buffer = sclp_vt220_flush_buffer 681 .flush_buffer = sclp_vt220_flush_buffer,
666}; 682};
667 683
668/* 684/*
669 * Register driver with SCLP and Linux and initialize internal tty structures. 685 * Register driver with SCLP and Linux and initialize internal tty structures.
670 */ 686 */
671static int __init 687static int __init sclp_vt220_tty_init(void)
672sclp_vt220_tty_init(void)
673{ 688{
674 struct tty_driver *driver; 689 struct tty_driver *driver;
675 int rc; 690 int rc;
@@ -679,18 +694,15 @@ sclp_vt220_tty_init(void)
679 driver = alloc_tty_driver(1); 694 driver = alloc_tty_driver(1);
680 if (!driver) 695 if (!driver)
681 return -ENOMEM; 696 return -ENOMEM;
682 rc = __sclp_vt220_init(0); 697 rc = __sclp_vt220_init();
683 if (rc) { 698 if (rc)
684 put_tty_driver(driver); 699 goto out_driver;
685 return rc;
686 }
687 rc = sclp_register(&sclp_vt220_register); 700 rc = sclp_register(&sclp_vt220_register);
688 if (rc) { 701 if (rc) {
689 printk(KERN_ERR SCLP_VT220_PRINT_HEADER 702 printk(KERN_ERR SCLP_VT220_PRINT_HEADER
690 "could not register tty - " 703 "could not register tty - "
691 "sclp_register returned %d\n", rc); 704 "sclp_register returned %d\n", rc);
692 put_tty_driver(driver); 705 goto out_init;
693 return rc;
694 } 706 }
695 707
696 driver->owner = THIS_MODULE; 708 driver->owner = THIS_MODULE;
@@ -709,14 +721,20 @@ sclp_vt220_tty_init(void)
709 printk(KERN_ERR SCLP_VT220_PRINT_HEADER 721 printk(KERN_ERR SCLP_VT220_PRINT_HEADER
710 "could not register tty - " 722 "could not register tty - "
711 "tty_register_driver returned %d\n", rc); 723 "tty_register_driver returned %d\n", rc);
712 put_tty_driver(driver); 724 goto out_sclp;
713 return rc;
714 } 725 }
715 sclp_vt220_driver = driver; 726 sclp_vt220_driver = driver;
716 return 0; 727 return 0;
717}
718 728
719module_init(sclp_vt220_tty_init); 729out_sclp:
730 sclp_unregister(&sclp_vt220_register);
731out_init:
732 __sclp_vt220_cleanup();
733out_driver:
734 put_tty_driver(driver);
735 return rc;
736}
737__initcall(sclp_vt220_tty_init);
720 738
721#ifdef CONFIG_SCLP_VT220_CONSOLE 739#ifdef CONFIG_SCLP_VT220_CONSOLE
722 740
@@ -762,7 +780,7 @@ sclp_vt220_con_init(void)
762 780
763 if (!CONSOLE_IS_SCLP) 781 if (!CONSOLE_IS_SCLP)
764 return 0; 782 return 0;
765 rc = __sclp_vt220_init(1); 783 rc = __sclp_vt220_init();
766 if (rc) 784 if (rc)
767 return rc; 785 return rc;
768 /* Attach linux console */ 786 /* Attach linux console */
diff --git a/drivers/s390/char/vmur.c b/drivers/s390/char/vmur.c
index e90b0f846195..161867cebd8c 100644
--- a/drivers/s390/char/vmur.c
+++ b/drivers/s390/char/vmur.c
@@ -486,7 +486,7 @@ static ssize_t diag14_read(struct file *file, char __user *ubuf, size_t count,
486 } 486 }
487 if (rc) 487 if (rc)
488 goto fail; 488 goto fail;
489 if (reclen) 489 if (reclen && (copied == 0) && (*offs < PAGE_SIZE))
490 *((u16 *) &buf[FILE_RECLEN_OFFSET]) = reclen; 490 *((u16 *) &buf[FILE_RECLEN_OFFSET]) = reclen;
491 len = min(count - copied, PAGE_SIZE - res); 491 len = min(count - copied, PAGE_SIZE - res);
492 if (copy_to_user(ubuf + copied, buf + res, len)) { 492 if (copy_to_user(ubuf + copied, buf + res, len)) {
diff --git a/drivers/s390/cio/blacklist.c b/drivers/s390/cio/blacklist.c
index ec0404874fad..bd5f16f80bf8 100644
--- a/drivers/s390/cio/blacklist.c
+++ b/drivers/s390/cio/blacklist.c
@@ -51,7 +51,7 @@ blacklist_range (range_action action, unsigned int from, unsigned int to,
51 to = from; 51 to = from;
52 52
53 if (from > to || to > __MAX_SUBCHANNEL || ssid > __MAX_SSID) { 53 if (from > to || to > __MAX_SUBCHANNEL || ssid > __MAX_SSID) {
54 printk (KERN_WARNING "Invalid blacklist range " 54 printk (KERN_WARNING "cio: Invalid blacklist range "
55 "0.%x.%04x to 0.%x.%04x, skipping\n", 55 "0.%x.%04x to 0.%x.%04x, skipping\n",
56 ssid, from, ssid, to); 56 ssid, from, ssid, to);
57 return; 57 return;
@@ -119,7 +119,7 @@ blacklist_busid(char **str, int *id0, int *ssid, int *devno)
119 return 0; 119 return 0;
120confused: 120confused:
121 strsep(str, ",\n"); 121 strsep(str, ",\n");
122 printk(KERN_WARNING "Invalid cio_ignore parameter '%s'\n", sav); 122 printk(KERN_WARNING "cio: Invalid cio_ignore parameter '%s'\n", sav);
123 return 1; 123 return 1;
124} 124}
125 125
@@ -166,22 +166,19 @@ blacklist_parse_parameters (char *str, range_action action)
166 continue; 166 continue;
167 } 167 }
168 if (*str == '-') { 168 if (*str == '-') {
169 printk(KERN_WARNING "invalid cio_ignore " 169 printk(KERN_WARNING "cio: invalid cio_ignore "
170 "parameter '%s'\n", 170 "parameter '%s'\n",
171 strsep(&str, ",\n")); 171 strsep(&str, ",\n"));
172 continue; 172 continue;
173 } 173 }
174 if ((from_id0 != to_id0) || 174 if ((from_id0 != to_id0) ||
175 (from_ssid != to_ssid)) { 175 (from_ssid != to_ssid)) {
176 printk(KERN_WARNING "invalid cio_ignore range " 176 printk(KERN_WARNING "cio: invalid cio_ignore "
177 "%x.%x.%04x-%x.%x.%04x\n", 177 "range %x.%x.%04x-%x.%x.%04x\n",
178 from_id0, from_ssid, from, 178 from_id0, from_ssid, from,
179 to_id0, to_ssid, to); 179 to_id0, to_ssid, to);
180 continue; 180 continue;
181 } 181 }
182 pr_debug("blacklist_setup: adding range "
183 "from %x.%x.%04x to %x.%x.%04x\n",
184 from_id0, from_ssid, from, to_id0, to_ssid, to);
185 blacklist_range (ra, from, to, to_ssid); 182 blacklist_range (ra, from, to, to_ssid);
186 } 183 }
187 } 184 }
@@ -239,7 +236,7 @@ blacklist_parse_proc_parameters (char *buf)
239 */ 236 */
240 blacklist_parse_parameters (buf + 4, add); 237 blacklist_parse_parameters (buf + 4, add);
241 } else { 238 } else {
242 printk (KERN_WARNING "cio_ignore: Parse error; \n" 239 printk (KERN_WARNING "cio: cio_ignore: Parse error; \n"
243 KERN_WARNING "try using 'free all|<devno-range>," 240 KERN_WARNING "try using 'free all|<devno-range>,"
244 "<devno-range>,...'\n" 241 "<devno-range>,...'\n"
245 KERN_WARNING "or 'add <devno-range>," 242 KERN_WARNING "or 'add <devno-range>,"
diff --git a/drivers/s390/cio/ccwgroup.c b/drivers/s390/cio/ccwgroup.c
index e5ccda63e883..b0a18f5176aa 100644
--- a/drivers/s390/cio/ccwgroup.c
+++ b/drivers/s390/cio/ccwgroup.c
@@ -359,7 +359,6 @@ ccwgroup_probe (struct device *dev)
359 if ((ret = device_create_file(dev, &dev_attr_online))) 359 if ((ret = device_create_file(dev, &dev_attr_online)))
360 return ret; 360 return ret;
361 361
362 pr_debug("%s: device %s\n", __func__, gdev->dev.bus_id);
363 ret = gdrv->probe ? gdrv->probe(gdev) : -ENODEV; 362 ret = gdrv->probe ? gdrv->probe(gdev) : -ENODEV;
364 if (ret) 363 if (ret)
365 device_remove_file(dev, &dev_attr_online); 364 device_remove_file(dev, &dev_attr_online);
@@ -376,8 +375,6 @@ ccwgroup_remove (struct device *dev)
376 gdev = to_ccwgroupdev(dev); 375 gdev = to_ccwgroupdev(dev);
377 gdrv = to_ccwgroupdrv(dev->driver); 376 gdrv = to_ccwgroupdrv(dev->driver);
378 377
379 pr_debug("%s: device %s\n", __func__, gdev->dev.bus_id);
380
381 device_remove_file(dev, &dev_attr_online); 378 device_remove_file(dev, &dev_attr_online);
382 379
383 if (gdrv && gdrv->remove) 380 if (gdrv && gdrv->remove)
diff --git a/drivers/s390/cio/chp.c b/drivers/s390/cio/chp.c
index b57d93d986c0..920dd71e6434 100644
--- a/drivers/s390/cio/chp.c
+++ b/drivers/s390/cio/chp.c
@@ -121,14 +121,8 @@ static int s390_vary_chpid(struct chp_id chpid, int on)
121 CIO_TRACE_EVENT( 2, dbf_text); 121 CIO_TRACE_EVENT( 2, dbf_text);
122 122
123 status = chp_get_status(chpid); 123 status = chp_get_status(chpid);
124 if (status < 0) {
125 printk(KERN_ERR "Can't vary unknown chpid %x.%02x\n",
126 chpid.cssid, chpid.id);
127 return -EINVAL;
128 }
129
130 if (!on && !status) { 124 if (!on && !status) {
131 printk(KERN_ERR "chpid %x.%02x is already offline\n", 125 printk(KERN_ERR "cio: chpid %x.%02x is already offline\n",
132 chpid.cssid, chpid.id); 126 chpid.cssid, chpid.id);
133 return -EINVAL; 127 return -EINVAL;
134 } 128 }
@@ -421,21 +415,14 @@ int chp_new(struct chp_id chpid)
421 if (ret) 415 if (ret)
422 goto out_free; 416 goto out_free;
423 } else { 417 } else {
424 static int msg_done;
425
426 if (!msg_done) {
427 printk(KERN_WARNING "cio: Channel measurements not "
428 "available, continuing.\n");
429 msg_done = 1;
430 }
431 chp->cmg = -1; 418 chp->cmg = -1;
432 } 419 }
433 420
434 /* make it known to the system */ 421 /* make it known to the system */
435 ret = device_register(&chp->dev); 422 ret = device_register(&chp->dev);
436 if (ret) { 423 if (ret) {
437 printk(KERN_WARNING "%s: could not register %x.%02x\n", 424 CIO_MSG_EVENT(0, "Could not register chp%x.%02x: %d\n",
438 __func__, chpid.cssid, chpid.id); 425 chpid.cssid, chpid.id, ret);
439 goto out_free; 426 goto out_free;
440 } 427 }
441 ret = sysfs_create_group(&chp->dev.kobj, &chp_attr_group); 428 ret = sysfs_create_group(&chp->dev.kobj, &chp_attr_group);
diff --git a/drivers/s390/cio/chsc.c b/drivers/s390/cio/chsc.c
index ea92ac4d6577..597c0c76a2ad 100644
--- a/drivers/s390/cio/chsc.c
+++ b/drivers/s390/cio/chsc.c
@@ -990,16 +990,20 @@ out:
990 return ret; 990 return ret;
991} 991}
992 992
993static int __init 993int __init chsc_alloc_sei_area(void)
994chsc_alloc_sei_area(void)
995{ 994{
996 sei_page = (void *)get_zeroed_page(GFP_KERNEL | GFP_DMA); 995 sei_page = (void *)get_zeroed_page(GFP_KERNEL | GFP_DMA);
997 if (!sei_page) 996 if (!sei_page)
998 printk(KERN_WARNING"Can't allocate page for processing of " \ 997 CIO_MSG_EVENT(0, "Can't allocate page for processing of "
999 "chsc machine checks!\n"); 998 "chsc machine checks!\n");
1000 return (sei_page ? 0 : -ENOMEM); 999 return (sei_page ? 0 : -ENOMEM);
1001} 1000}
1002 1001
1002void __init chsc_free_sei_area(void)
1003{
1004 kfree(sei_page);
1005}
1006
1003int __init 1007int __init
1004chsc_enable_facility(int operation_code) 1008chsc_enable_facility(int operation_code)
1005{ 1009{
@@ -1051,8 +1055,6 @@ chsc_enable_facility(int operation_code)
1051 return ret; 1055 return ret;
1052} 1056}
1053 1057
1054subsys_initcall(chsc_alloc_sei_area);
1055
1056struct css_general_char css_general_characteristics; 1058struct css_general_char css_general_characteristics;
1057struct css_chsc_char css_chsc_characteristics; 1059struct css_chsc_char css_chsc_characteristics;
1058 1060
@@ -1073,8 +1075,8 @@ chsc_determine_css_characteristics(void)
1073 1075
1074 scsc_area = (void *)get_zeroed_page(GFP_KERNEL | GFP_DMA); 1076 scsc_area = (void *)get_zeroed_page(GFP_KERNEL | GFP_DMA);
1075 if (!scsc_area) { 1077 if (!scsc_area) {
1076 printk(KERN_WARNING"cio: Was not able to determine available" \ 1078 CIO_MSG_EVENT(0, "Was not able to determine available"
1077 "CHSCs due to no memory.\n"); 1079 "CHSCs due to no memory.\n");
1078 return -ENOMEM; 1080 return -ENOMEM;
1079 } 1081 }
1080 1082
@@ -1083,15 +1085,15 @@ chsc_determine_css_characteristics(void)
1083 1085
1084 result = chsc(scsc_area); 1086 result = chsc(scsc_area);
1085 if (result) { 1087 if (result) {
1086 printk(KERN_WARNING"cio: Was not able to determine " \ 1088 CIO_MSG_EVENT(0, "Was not able to determine available CHSCs, "
1087 "available CHSCs, cc=%i.\n", result); 1089 "cc=%i.\n", result);
1088 result = -EIO; 1090 result = -EIO;
1089 goto exit; 1091 goto exit;
1090 } 1092 }
1091 1093
1092 if (scsc_area->response.code != 1) { 1094 if (scsc_area->response.code != 1) {
1093 printk(KERN_WARNING"cio: Was not able to determine " \ 1095 CIO_MSG_EVENT(0, "Was not able to determine "
1094 "available CHSCs.\n"); 1096 "available CHSCs.\n");
1095 result = -EIO; 1097 result = -EIO;
1096 goto exit; 1098 goto exit;
1097 } 1099 }
diff --git a/drivers/s390/cio/chsc.h b/drivers/s390/cio/chsc.h
index 2ad81d11cf7b..d1f5db1e69b9 100644
--- a/drivers/s390/cio/chsc.h
+++ b/drivers/s390/cio/chsc.h
@@ -79,6 +79,8 @@ extern int chsc_get_ssd_info(struct subchannel_id schid,
79 struct chsc_ssd_info *ssd); 79 struct chsc_ssd_info *ssd);
80extern int chsc_determine_css_characteristics(void); 80extern int chsc_determine_css_characteristics(void);
81extern int css_characteristics_avail; 81extern int css_characteristics_avail;
82extern int chsc_alloc_sei_area(void);
83extern void chsc_free_sei_area(void);
82 84
83extern int chsc_enable_facility(int); 85extern int chsc_enable_facility(int);
84struct channel_subsystem; 86struct channel_subsystem;
diff --git a/drivers/s390/cio/cio.c b/drivers/s390/cio/cio.c
index ea1defba5693..f2708d65be5a 100644
--- a/drivers/s390/cio/cio.c
+++ b/drivers/s390/cio/cio.c
@@ -47,8 +47,8 @@ cio_setup (char *parm)
47 else if (!strcmp (parm, "no")) 47 else if (!strcmp (parm, "no"))
48 cio_show_msg = 0; 48 cio_show_msg = 0;
49 else 49 else
50 printk (KERN_ERR "cio_setup : invalid cio_msg parameter '%s'", 50 printk(KERN_ERR "cio: cio_setup: "
51 parm); 51 "invalid cio_msg parameter '%s'", parm);
52 return 1; 52 return 1;
53} 53}
54 54
@@ -80,7 +80,6 @@ cio_debug_init (void)
80 goto out_unregister; 80 goto out_unregister;
81 debug_register_view (cio_debug_crw_id, &debug_sprintf_view); 81 debug_register_view (cio_debug_crw_id, &debug_sprintf_view);
82 debug_set_level (cio_debug_crw_id, 2); 82 debug_set_level (cio_debug_crw_id, 2);
83 pr_debug("debugging initialized\n");
84 return 0; 83 return 0;
85 84
86out_unregister: 85out_unregister:
@@ -90,7 +89,7 @@ out_unregister:
90 debug_unregister (cio_debug_trace_id); 89 debug_unregister (cio_debug_trace_id);
91 if (cio_debug_crw_id) 90 if (cio_debug_crw_id)
92 debug_unregister (cio_debug_crw_id); 91 debug_unregister (cio_debug_crw_id);
93 pr_debug("could not initialize debugging\n"); 92 printk(KERN_WARNING"cio: could not initialize debugging\n");
94 return -1; 93 return -1;
95} 94}
96 95
@@ -568,7 +567,7 @@ cio_validate_subchannel (struct subchannel *sch, struct subchannel_id schid)
568 */ 567 */
569 if (sch->st != 0) { 568 if (sch->st != 0) {
570 CIO_DEBUG(KERN_INFO, 0, 569 CIO_DEBUG(KERN_INFO, 0,
571 "Subchannel 0.%x.%04x reports " 570 "cio: Subchannel 0.%x.%04x reports "
572 "non-I/O subchannel type %04X\n", 571 "non-I/O subchannel type %04X\n",
573 sch->schid.ssid, sch->schid.sch_no, sch->st); 572 sch->schid.ssid, sch->schid.sch_no, sch->st);
574 /* We stop here for non-io subchannels. */ 573 /* We stop here for non-io subchannels. */
@@ -601,7 +600,7 @@ cio_validate_subchannel (struct subchannel *sch, struct subchannel_id schid)
601 sch->lpm = sch->schib.pmcw.pam & sch->opm; 600 sch->lpm = sch->schib.pmcw.pam & sch->opm;
602 601
603 CIO_DEBUG(KERN_INFO, 0, 602 CIO_DEBUG(KERN_INFO, 0,
604 "Detected device %04x on subchannel 0.%x.%04X" 603 "cio: Detected device %04x on subchannel 0.%x.%04X"
605 " - PIM = %02X, PAM = %02X, POM = %02X\n", 604 " - PIM = %02X, PAM = %02X, POM = %02X\n",
606 sch->schib.pmcw.dev, sch->schid.ssid, 605 sch->schib.pmcw.dev, sch->schid.ssid,
607 sch->schid.sch_no, sch->schib.pmcw.pim, 606 sch->schid.sch_no, sch->schib.pmcw.pim,
@@ -766,7 +765,7 @@ cio_get_console_sch_no(void)
766 /* unlike in 2.4, we cannot autoprobe here, since 765 /* unlike in 2.4, we cannot autoprobe here, since
767 * the channel subsystem is not fully initialized. 766 * the channel subsystem is not fully initialized.
768 * With some luck, the HWC console can take over */ 767 * With some luck, the HWC console can take over */
769 printk(KERN_WARNING "No ccw console found!\n"); 768 printk(KERN_WARNING "cio: No ccw console found!\n");
770 return -1; 769 return -1;
771 } 770 }
772 return console_irq; 771 return console_irq;
diff --git a/drivers/s390/cio/cio_debug.h b/drivers/s390/cio/cio_debug.h
index f88844adae1b..c9bf8989930f 100644
--- a/drivers/s390/cio/cio_debug.h
+++ b/drivers/s390/cio/cio_debug.h
@@ -23,6 +23,8 @@ extern debug_info_t *cio_debug_crw_id;
23static inline void 23static inline void
24CIO_HEX_EVENT(int level, void *data, int length) 24CIO_HEX_EVENT(int level, void *data, int length)
25{ 25{
26 if (unlikely(!cio_debug_trace_id))
27 return;
26 while (length > 0) { 28 while (length > 0) {
27 debug_event(cio_debug_trace_id, level, data, length); 29 debug_event(cio_debug_trace_id, level, data, length);
28 length -= cio_debug_trace_id->buf_size; 30 length -= cio_debug_trace_id->buf_size;
diff --git a/drivers/s390/cio/cmf.c b/drivers/s390/cio/cmf.c
index 28abd697be1a..02fd00b55e1b 100644
--- a/drivers/s390/cio/cmf.c
+++ b/drivers/s390/cio/cmf.c
@@ -1185,12 +1185,12 @@ static ssize_t cmb_enable_store(struct device *dev, struct device_attribute *att
1185 case '0': 1185 case '0':
1186 ret = disable_cmf(cdev); 1186 ret = disable_cmf(cdev);
1187 if (ret) 1187 if (ret)
1188 printk(KERN_INFO "disable_cmf failed (%d)\n", ret); 1188 dev_info(&cdev->dev, "disable_cmf failed (%d)\n", ret);
1189 break; 1189 break;
1190 case '1': 1190 case '1':
1191 ret = enable_cmf(cdev); 1191 ret = enable_cmf(cdev);
1192 if (ret && ret != -EBUSY) 1192 if (ret && ret != -EBUSY)
1193 printk(KERN_INFO "enable_cmf failed (%d)\n", ret); 1193 dev_info(&cdev->dev, "enable_cmf failed (%d)\n", ret);
1194 break; 1194 break;
1195 } 1195 }
1196 1196
@@ -1280,10 +1280,10 @@ init_cmf(void)
1280 format_string = "basic"; 1280 format_string = "basic";
1281 cmbops = &cmbops_basic; 1281 cmbops = &cmbops_basic;
1282 if (cmb_area.num_channels > 4096 || cmb_area.num_channels < 1) { 1282 if (cmb_area.num_channels > 4096 || cmb_area.num_channels < 1) {
1283 printk(KERN_ERR "Basic channel measurement facility" 1283 printk(KERN_ERR "cio: Basic channel measurement "
1284 " can only use 1 to 4096 devices\n" 1284 "facility can only use 1 to 4096 devices\n"
1285 KERN_ERR "when the cmf driver is built" 1285 KERN_ERR "when the cmf driver is built"
1286 " as a loadable module\n"); 1286 " as a loadable module\n");
1287 return 1; 1287 return 1;
1288 } 1288 }
1289 break; 1289 break;
@@ -1292,13 +1292,13 @@ init_cmf(void)
1292 cmbops = &cmbops_extended; 1292 cmbops = &cmbops_extended;
1293 break; 1293 break;
1294 default: 1294 default:
1295 printk(KERN_ERR "Invalid format %d for channel " 1295 printk(KERN_ERR "cio: Invalid format %d for channel "
1296 "measurement facility\n", format); 1296 "measurement facility\n", format);
1297 return 1; 1297 return 1;
1298 } 1298 }
1299 1299
1300 printk(KERN_INFO "Channel measurement facility using %s format (%s)\n", 1300 printk(KERN_INFO "cio: Channel measurement facility using %s "
1301 format_string, detect_string); 1301 "format (%s)\n", format_string, detect_string);
1302 return 0; 1302 return 0;
1303} 1303}
1304 1304
diff --git a/drivers/s390/cio/css.c b/drivers/s390/cio/css.c
index dfca0ef139fd..1c27a5a06b49 100644
--- a/drivers/s390/cio/css.c
+++ b/drivers/s390/cio/css.c
@@ -109,7 +109,7 @@ css_subchannel_release(struct device *dev)
109 } 109 }
110} 110}
111 111
112int css_sch_device_register(struct subchannel *sch) 112static int css_sch_device_register(struct subchannel *sch)
113{ 113{
114 int ret; 114 int ret;
115 115
@@ -184,8 +184,8 @@ static int css_register_subchannel(struct subchannel *sch)
184 /* make it known to the system */ 184 /* make it known to the system */
185 ret = css_sch_device_register(sch); 185 ret = css_sch_device_register(sch);
186 if (ret) { 186 if (ret) {
187 printk (KERN_WARNING "%s: could not register %s\n", 187 CIO_MSG_EVENT(0, "Could not register sch 0.%x.%04x: %d\n",
188 __func__, sch->dev.bus_id); 188 sch->schid.ssid, sch->schid.sch_no, ret);
189 return ret; 189 return ret;
190 } 190 }
191 return ret; 191 return ret;
@@ -371,15 +371,12 @@ static int __init slow_subchannel_init(void)
371 spin_lock_init(&slow_subchannel_lock); 371 spin_lock_init(&slow_subchannel_lock);
372 slow_subchannel_set = idset_sch_new(); 372 slow_subchannel_set = idset_sch_new();
373 if (!slow_subchannel_set) { 373 if (!slow_subchannel_set) {
374 printk(KERN_WARNING "cio: could not allocate slow subchannel " 374 CIO_MSG_EVENT(0, "could not allocate slow subchannel set\n");
375 "set\n");
376 return -ENOMEM; 375 return -ENOMEM;
377 } 376 }
378 return 0; 377 return 0;
379} 378}
380 379
381subsys_initcall(slow_subchannel_init);
382
383static void css_slow_path_func(struct work_struct *unused) 380static void css_slow_path_func(struct work_struct *unused)
384{ 381{
385 struct subchannel_id schid; 382 struct subchannel_id schid;
@@ -425,8 +422,8 @@ static int reprobe_subchannel(struct subchannel_id schid, void *data)
425 struct subchannel *sch; 422 struct subchannel *sch;
426 int ret; 423 int ret;
427 424
428 CIO_DEBUG(KERN_INFO, 6, "cio: reprobe 0.%x.%04x\n", 425 CIO_MSG_EVENT(6, "cio: reprobe 0.%x.%04x\n",
429 schid.ssid, schid.sch_no); 426 schid.ssid, schid.sch_no);
430 if (need_reprobe) 427 if (need_reprobe)
431 return -EAGAIN; 428 return -EAGAIN;
432 429
@@ -642,9 +639,20 @@ init_channel_subsystem (void)
642{ 639{
643 int ret, i; 640 int ret, i;
644 641
645 if (chsc_determine_css_characteristics() == 0) 642 ret = chsc_determine_css_characteristics();
643 if (ret == -ENOMEM)
644 goto out; /* No need to continue. */
645 if (ret == 0)
646 css_characteristics_avail = 1; 646 css_characteristics_avail = 1;
647 647
648 ret = chsc_alloc_sei_area();
649 if (ret)
650 goto out;
651
652 ret = slow_subchannel_init();
653 if (ret)
654 goto out;
655
648 if ((ret = bus_register(&css_bus_type))) 656 if ((ret = bus_register(&css_bus_type)))
649 goto out; 657 goto out;
650 658
@@ -710,6 +718,10 @@ out_unregister:
710out_bus: 718out_bus:
711 bus_unregister(&css_bus_type); 719 bus_unregister(&css_bus_type);
712out: 720out:
721 chsc_free_sei_area();
722 kfree(slow_subchannel_set);
723 printk(KERN_WARNING"cio: failed to initialize css driver (%d)!\n",
724 ret);
713 return ret; 725 return ret;
714} 726}
715 727
diff --git a/drivers/s390/cio/css.h b/drivers/s390/cio/css.h
index ed7977531c3f..5d65e83ca66e 100644
--- a/drivers/s390/cio/css.h
+++ b/drivers/s390/cio/css.h
@@ -139,7 +139,6 @@ struct css_driver {
139 */ 139 */
140extern struct bus_type css_bus_type; 140extern struct bus_type css_bus_type;
141 141
142extern int css_sch_device_register(struct subchannel *);
143extern void css_sch_device_unregister(struct subchannel *); 142extern void css_sch_device_unregister(struct subchannel *);
144extern struct subchannel * get_subchannel_by_schid(struct subchannel_id); 143extern struct subchannel * get_subchannel_by_schid(struct subchannel_id);
145extern int css_init_done; 144extern int css_init_done;
diff --git a/drivers/s390/cio/device.c b/drivers/s390/cio/device.c
index 001682e70f67..297659fa0e26 100644
--- a/drivers/s390/cio/device.c
+++ b/drivers/s390/cio/device.c
@@ -338,15 +338,20 @@ ccw_device_remove_disconnected(struct ccw_device *cdev)
338 rc = device_schedule_callback(&cdev->dev, 338 rc = device_schedule_callback(&cdev->dev,
339 ccw_device_remove_orphan_cb); 339 ccw_device_remove_orphan_cb);
340 if (rc) 340 if (rc)
341 dev_info(&cdev->dev, "Couldn't unregister orphan\n"); 341 CIO_MSG_EVENT(2, "Couldn't unregister orphan "
342 "0.%x.%04x\n",
343 cdev->private->dev_id.ssid,
344 cdev->private->dev_id.devno);
342 return; 345 return;
343 } 346 }
344 /* Deregister subchannel, which will kill the ccw device. */ 347 /* Deregister subchannel, which will kill the ccw device. */
345 rc = device_schedule_callback(cdev->dev.parent, 348 rc = device_schedule_callback(cdev->dev.parent,
346 ccw_device_remove_sch_cb); 349 ccw_device_remove_sch_cb);
347 if (rc) 350 if (rc)
348 dev_info(&cdev->dev, 351 CIO_MSG_EVENT(2, "Couldn't unregister disconnected device "
349 "Couldn't unregister disconnected device\n"); 352 "0.%x.%04x\n",
353 cdev->private->dev_id.ssid,
354 cdev->private->dev_id.devno);
350} 355}
351 356
352int 357int
@@ -379,8 +384,10 @@ ccw_device_set_offline(struct ccw_device *cdev)
379 if (ret == 0) 384 if (ret == 0)
380 wait_event(cdev->private->wait_q, dev_fsm_final_state(cdev)); 385 wait_event(cdev->private->wait_q, dev_fsm_final_state(cdev));
381 else { 386 else {
382 pr_debug("ccw_device_offline returned %d, device %s\n", 387 CIO_MSG_EVENT(2, "ccw_device_offline returned %d, "
383 ret, cdev->dev.bus_id); 388 "device 0.%x.%04x\n",
389 ret, cdev->private->dev_id.ssid,
390 cdev->private->dev_id.devno);
384 cdev->online = 1; 391 cdev->online = 1;
385 } 392 }
386 return ret; 393 return ret;
@@ -402,8 +409,10 @@ ccw_device_set_online(struct ccw_device *cdev)
402 if (ret == 0) 409 if (ret == 0)
403 wait_event(cdev->private->wait_q, dev_fsm_final_state(cdev)); 410 wait_event(cdev->private->wait_q, dev_fsm_final_state(cdev));
404 else { 411 else {
405 pr_debug("ccw_device_online returned %d, device %s\n", 412 CIO_MSG_EVENT(2, "ccw_device_online returned %d, "
406 ret, cdev->dev.bus_id); 413 "device 0.%x.%04x\n",
414 ret, cdev->private->dev_id.ssid,
415 cdev->private->dev_id.devno);
407 return ret; 416 return ret;
408 } 417 }
409 if (cdev->private->state != DEV_STATE_ONLINE) 418 if (cdev->private->state != DEV_STATE_ONLINE)
@@ -417,9 +426,11 @@ ccw_device_set_online(struct ccw_device *cdev)
417 spin_unlock_irq(cdev->ccwlock); 426 spin_unlock_irq(cdev->ccwlock);
418 if (ret == 0) 427 if (ret == 0)
419 wait_event(cdev->private->wait_q, dev_fsm_final_state(cdev)); 428 wait_event(cdev->private->wait_q, dev_fsm_final_state(cdev));
420 else 429 else
421 pr_debug("ccw_device_offline returned %d, device %s\n", 430 CIO_MSG_EVENT(2, "ccw_device_offline returned %d, "
422 ret, cdev->dev.bus_id); 431 "device 0.%x.%04x\n",
432 ret, cdev->private->dev_id.ssid,
433 cdev->private->dev_id.devno);
423 return (ret == 0) ? -ENODEV : ret; 434 return (ret == 0) ? -ENODEV : ret;
424} 435}
425 436
@@ -439,9 +450,10 @@ static int online_store_recog_and_online(struct ccw_device *cdev)
439 if (cdev->id.cu_type == 0) { 450 if (cdev->id.cu_type == 0) {
440 ret = ccw_device_recognition(cdev); 451 ret = ccw_device_recognition(cdev);
441 if (ret) { 452 if (ret) {
442 printk(KERN_WARNING"Couldn't start recognition " 453 CIO_MSG_EVENT(0, "Couldn't start recognition "
443 "for device %s (ret=%d)\n", 454 "for device 0.%x.%04x (ret=%d)\n",
444 cdev->dev.bus_id, ret); 455 cdev->private->dev_id.ssid,
456 cdev->private->dev_id.devno, ret);
445 return ret; 457 return ret;
446 } 458 }
447 wait_event(cdev->private->wait_q, 459 wait_event(cdev->private->wait_q,
@@ -461,8 +473,8 @@ static void online_store_handle_online(struct ccw_device *cdev, int force)
461 if (force && cdev->private->state == DEV_STATE_BOXED) { 473 if (force && cdev->private->state == DEV_STATE_BOXED) {
462 ret = ccw_device_stlck(cdev); 474 ret = ccw_device_stlck(cdev);
463 if (ret) { 475 if (ret) {
464 printk(KERN_WARNING"ccw_device_stlck for device %s " 476 dev_warn(&cdev->dev,
465 "returned %d!\n", cdev->dev.bus_id, ret); 477 "ccw_device_stlck returned %d!\n", ret);
466 return; 478 return;
467 } 479 }
468 if (cdev->id.cu_type == 0) 480 if (cdev->id.cu_type == 0)
@@ -893,8 +905,10 @@ io_subchannel_register(struct work_struct *work)
893 ret = device_reprobe(&cdev->dev); 905 ret = device_reprobe(&cdev->dev);
894 if (ret) 906 if (ret)
895 /* We can't do much here. */ 907 /* We can't do much here. */
896 dev_info(&cdev->dev, "device_reprobe() returned" 908 CIO_MSG_EVENT(2, "device_reprobe() returned"
897 " %d\n", ret); 909 " %d for 0.%x.%04x\n", ret,
910 cdev->private->dev_id.ssid,
911 cdev->private->dev_id.devno);
898 } 912 }
899 goto out; 913 goto out;
900 } 914 }
@@ -907,8 +921,9 @@ io_subchannel_register(struct work_struct *work)
907 /* make it known to the system */ 921 /* make it known to the system */
908 ret = ccw_device_register(cdev); 922 ret = ccw_device_register(cdev);
909 if (ret) { 923 if (ret) {
910 printk (KERN_WARNING "%s: could not register %s\n", 924 CIO_MSG_EVENT(0, "Could not register ccw dev 0.%x.%04x: %d\n",
911 __func__, cdev->dev.bus_id); 925 cdev->private->dev_id.ssid,
926 cdev->private->dev_id.devno, ret);
912 put_device(&cdev->dev); 927 put_device(&cdev->dev);
913 spin_lock_irqsave(sch->lock, flags); 928 spin_lock_irqsave(sch->lock, flags);
914 sch->dev.driver_data = NULL; 929 sch->dev.driver_data = NULL;
@@ -1361,7 +1376,6 @@ ccw_device_remove (struct device *dev)
1361 struct ccw_driver *cdrv = cdev->drv; 1376 struct ccw_driver *cdrv = cdev->drv;
1362 int ret; 1377 int ret;
1363 1378
1364 pr_debug("removing device %s\n", cdev->dev.bus_id);
1365 if (cdrv->remove) 1379 if (cdrv->remove)
1366 cdrv->remove(cdev); 1380 cdrv->remove(cdev);
1367 if (cdev->online) { 1381 if (cdev->online) {
@@ -1374,8 +1388,10 @@ ccw_device_remove (struct device *dev)
1374 dev_fsm_final_state(cdev)); 1388 dev_fsm_final_state(cdev));
1375 else 1389 else
1376 //FIXME: we can't fail! 1390 //FIXME: we can't fail!
1377 pr_debug("ccw_device_offline returned %d, device %s\n", 1391 CIO_MSG_EVENT(2, "ccw_device_offline returned %d, "
1378 ret, cdev->dev.bus_id); 1392 "device 0.%x.%04x\n",
1393 ret, cdev->private->dev_id.ssid,
1394 cdev->private->dev_id.devno);
1379 } 1395 }
1380 ccw_device_set_timeout(cdev, 0); 1396 ccw_device_set_timeout(cdev, 0);
1381 cdev->drv = NULL; 1397 cdev->drv = NULL;
diff --git a/drivers/s390/cio/device_fsm.c b/drivers/s390/cio/device_fsm.c
index 6bba80929577..8633dc537695 100644
--- a/drivers/s390/cio/device_fsm.c
+++ b/drivers/s390/cio/device_fsm.c
@@ -268,7 +268,7 @@ ccw_device_recog_done(struct ccw_device *cdev, int state)
268 switch (state) { 268 switch (state) {
269 case DEV_STATE_NOT_OPER: 269 case DEV_STATE_NOT_OPER:
270 CIO_DEBUG(KERN_WARNING, 2, 270 CIO_DEBUG(KERN_WARNING, 2,
271 "SenseID : unknown device %04x on subchannel " 271 "cio: SenseID : unknown device %04x on subchannel "
272 "0.%x.%04x\n", cdev->private->dev_id.devno, 272 "0.%x.%04x\n", cdev->private->dev_id.devno,
273 sch->schid.ssid, sch->schid.sch_no); 273 sch->schid.ssid, sch->schid.sch_no);
274 break; 274 break;
@@ -293,7 +293,8 @@ ccw_device_recog_done(struct ccw_device *cdev, int state)
293 return; 293 return;
294 } 294 }
295 /* Issue device info message. */ 295 /* Issue device info message. */
296 CIO_DEBUG(KERN_INFO, 2, "SenseID : device 0.%x.%04x reports: " 296 CIO_DEBUG(KERN_INFO, 2,
297 "cio: SenseID : device 0.%x.%04x reports: "
297 "CU Type/Mod = %04X/%02X, Dev Type/Mod = " 298 "CU Type/Mod = %04X/%02X, Dev Type/Mod = "
298 "%04X/%02X\n", 299 "%04X/%02X\n",
299 cdev->private->dev_id.ssid, 300 cdev->private->dev_id.ssid,
@@ -303,7 +304,7 @@ ccw_device_recog_done(struct ccw_device *cdev, int state)
303 break; 304 break;
304 case DEV_STATE_BOXED: 305 case DEV_STATE_BOXED:
305 CIO_DEBUG(KERN_WARNING, 2, 306 CIO_DEBUG(KERN_WARNING, 2,
306 "SenseID : boxed device %04x on subchannel " 307 "cio: SenseID : boxed device %04x on subchannel "
307 "0.%x.%04x\n", cdev->private->dev_id.devno, 308 "0.%x.%04x\n", cdev->private->dev_id.devno,
308 sch->schid.ssid, sch->schid.sch_no); 309 sch->schid.ssid, sch->schid.sch_no);
309 break; 310 break;
@@ -388,7 +389,7 @@ ccw_device_done(struct ccw_device *cdev, int state)
388 389
389 if (state == DEV_STATE_BOXED) 390 if (state == DEV_STATE_BOXED)
390 CIO_DEBUG(KERN_WARNING, 2, 391 CIO_DEBUG(KERN_WARNING, 2,
391 "Boxed device %04x on subchannel %04x\n", 392 "cio: Boxed device %04x on subchannel %04x\n",
392 cdev->private->dev_id.devno, sch->schid.sch_no); 393 cdev->private->dev_id.devno, sch->schid.sch_no);
393 394
394 if (cdev->private->flags.donotify) { 395 if (cdev->private->flags.donotify) {
@@ -946,9 +947,10 @@ ccw_device_w4sense(struct ccw_device *cdev, enum dev_event dev_event)
946 /* Basic sense hasn't started. Try again. */ 947 /* Basic sense hasn't started. Try again. */
947 ccw_device_do_sense(cdev, irb); 948 ccw_device_do_sense(cdev, irb);
948 else { 949 else {
949 printk(KERN_INFO "Huh? %s(%s): unsolicited " 950 CIO_MSG_EVENT(2, "Huh? 0.%x.%04x: unsolicited "
950 "interrupt...\n", 951 "interrupt during w4sense...\n",
951 __FUNCTION__, cdev->dev.bus_id); 952 cdev->private->dev_id.ssid,
953 cdev->private->dev_id.devno);
952 if (cdev->handler) 954 if (cdev->handler)
953 cdev->handler (cdev, 0, irb); 955 cdev->handler (cdev, 0, irb);
954 } 956 }
@@ -1215,8 +1217,8 @@ ccw_device_nop(struct ccw_device *cdev, enum dev_event dev_event)
1215static void 1217static void
1216ccw_device_bug(struct ccw_device *cdev, enum dev_event dev_event) 1218ccw_device_bug(struct ccw_device *cdev, enum dev_event dev_event)
1217{ 1219{
1218 printk(KERN_EMERG "dev_jumptable[%i][%i] == NULL\n", 1220 CIO_MSG_EVENT(0, "dev_jumptable[%i][%i] == NULL\n",
1219 cdev->private->state, dev_event); 1221 cdev->private->state, dev_event);
1220 BUG(); 1222 BUG();
1221} 1223}
1222 1224
diff --git a/drivers/s390/cio/device_ops.c b/drivers/s390/cio/device_ops.c
index a5d263fb55ae..14eba854b155 100644
--- a/drivers/s390/cio/device_ops.c
+++ b/drivers/s390/cio/device_ops.c
@@ -288,253 +288,6 @@ ccw_device_get_path_mask(struct ccw_device *cdev)
288 return sch->lpm; 288 return sch->lpm;
289} 289}
290 290
291static void
292ccw_device_wake_up(struct ccw_device *cdev, unsigned long ip, struct irb *irb)
293{
294 if (!ip)
295 /* unsolicited interrupt */
296 return;
297
298 /* Abuse intparm for error reporting. */
299 if (IS_ERR(irb))
300 cdev->private->intparm = -EIO;
301 else if (irb->scsw.cc == 1)
302 /* Retry for deferred condition code. */
303 cdev->private->intparm = -EAGAIN;
304 else if ((irb->scsw.dstat !=
305 (DEV_STAT_CHN_END|DEV_STAT_DEV_END)) ||
306 (irb->scsw.cstat != 0)) {
307 /*
308 * We didn't get channel end / device end. Check if path
309 * verification has been started; we can retry after it has
310 * finished. We also retry unit checks except for command reject
311 * or intervention required. Also check for long busy
312 * conditions.
313 */
314 if (cdev->private->flags.doverify ||
315 cdev->private->state == DEV_STATE_VERIFY)
316 cdev->private->intparm = -EAGAIN;
317 else if ((irb->scsw.dstat & DEV_STAT_UNIT_CHECK) &&
318 !(irb->ecw[0] &
319 (SNS0_CMD_REJECT | SNS0_INTERVENTION_REQ)))
320 cdev->private->intparm = -EAGAIN;
321 else if ((irb->scsw.dstat & DEV_STAT_ATTENTION) &&
322 (irb->scsw.dstat & DEV_STAT_DEV_END) &&
323 (irb->scsw.dstat & DEV_STAT_UNIT_EXCEP))
324 cdev->private->intparm = -EAGAIN;
325 else
326 cdev->private->intparm = -EIO;
327
328 } else
329 cdev->private->intparm = 0;
330 wake_up(&cdev->private->wait_q);
331}
332
333static int
334__ccw_device_retry_loop(struct ccw_device *cdev, struct ccw1 *ccw, long magic, __u8 lpm)
335{
336 int ret;
337 struct subchannel *sch;
338
339 sch = to_subchannel(cdev->dev.parent);
340 do {
341 ccw_device_set_timeout(cdev, 60 * HZ);
342 ret = cio_start (sch, ccw, lpm);
343 if (ret != 0)
344 ccw_device_set_timeout(cdev, 0);
345 if (ret == -EBUSY) {
346 /* Try again later. */
347 spin_unlock_irq(sch->lock);
348 msleep(10);
349 spin_lock_irq(sch->lock);
350 continue;
351 }
352 if (ret != 0)
353 /* Non-retryable error. */
354 break;
355 /* Wait for end of request. */
356 cdev->private->intparm = magic;
357 spin_unlock_irq(sch->lock);
358 wait_event(cdev->private->wait_q,
359 (cdev->private->intparm == -EIO) ||
360 (cdev->private->intparm == -EAGAIN) ||
361 (cdev->private->intparm == 0));
362 spin_lock_irq(sch->lock);
363 /* Check at least for channel end / device end */
364 if (cdev->private->intparm == -EIO) {
365 /* Non-retryable error. */
366 ret = -EIO;
367 break;
368 }
369 if (cdev->private->intparm == 0)
370 /* Success. */
371 break;
372 /* Try again later. */
373 spin_unlock_irq(sch->lock);
374 msleep(10);
375 spin_lock_irq(sch->lock);
376 } while (1);
377
378 return ret;
379}
380
381/**
382 * read_dev_chars() - read device characteristics
383 * @param cdev target ccw device
384 * @param buffer pointer to buffer for rdc data
385 * @param length size of rdc data
386 * @returns 0 for success, negative error value on failure
387 *
388 * Context:
389 * called for online device, lock not held
390 **/
391int
392read_dev_chars (struct ccw_device *cdev, void **buffer, int length)
393{
394 void (*handler)(struct ccw_device *, unsigned long, struct irb *);
395 struct subchannel *sch;
396 int ret;
397 struct ccw1 *rdc_ccw;
398
399 if (!cdev)
400 return -ENODEV;
401 if (!buffer || !length)
402 return -EINVAL;
403 sch = to_subchannel(cdev->dev.parent);
404
405 CIO_TRACE_EVENT (4, "rddevch");
406 CIO_TRACE_EVENT (4, sch->dev.bus_id);
407
408 rdc_ccw = kzalloc(sizeof(struct ccw1), GFP_KERNEL | GFP_DMA);
409 if (!rdc_ccw)
410 return -ENOMEM;
411 rdc_ccw->cmd_code = CCW_CMD_RDC;
412 rdc_ccw->count = length;
413 rdc_ccw->flags = CCW_FLAG_SLI;
414 ret = set_normalized_cda (rdc_ccw, (*buffer));
415 if (ret != 0) {
416 kfree(rdc_ccw);
417 return ret;
418 }
419
420 spin_lock_irq(sch->lock);
421 /* Save interrupt handler. */
422 handler = cdev->handler;
423 /* Temporarily install own handler. */
424 cdev->handler = ccw_device_wake_up;
425 if (cdev->private->state != DEV_STATE_ONLINE)
426 ret = -ENODEV;
427 else if (((sch->schib.scsw.stctl & SCSW_STCTL_PRIM_STATUS) &&
428 !(sch->schib.scsw.stctl & SCSW_STCTL_SEC_STATUS)) ||
429 cdev->private->flags.doverify)
430 ret = -EBUSY;
431 else
432 /* 0x00D9C4C3 == ebcdic "RDC" */
433 ret = __ccw_device_retry_loop(cdev, rdc_ccw, 0x00D9C4C3, 0);
434
435 /* Restore interrupt handler. */
436 cdev->handler = handler;
437 spin_unlock_irq(sch->lock);
438
439 clear_normalized_cda (rdc_ccw);
440 kfree(rdc_ccw);
441
442 return ret;
443}
444
445/*
446 * Read Configuration data using path mask
447 */
448int
449read_conf_data_lpm (struct ccw_device *cdev, void **buffer, int *length, __u8 lpm)
450{
451 void (*handler)(struct ccw_device *, unsigned long, struct irb *);
452 struct subchannel *sch;
453 struct ciw *ciw;
454 char *rcd_buf;
455 int ret;
456 struct ccw1 *rcd_ccw;
457
458 if (!cdev)
459 return -ENODEV;
460 if (!buffer || !length)
461 return -EINVAL;
462 sch = to_subchannel(cdev->dev.parent);
463
464 CIO_TRACE_EVENT (4, "rdconf");
465 CIO_TRACE_EVENT (4, sch->dev.bus_id);
466
467 /*
468 * scan for RCD command in extended SenseID data
469 */
470 ciw = ccw_device_get_ciw(cdev, CIW_TYPE_RCD);
471 if (!ciw || ciw->cmd == 0)
472 return -EOPNOTSUPP;
473
474 /* Adjust requested path mask to excluded varied off paths. */
475 if (lpm) {
476 lpm &= sch->opm;
477 if (lpm == 0)
478 return -EACCES;
479 }
480
481 rcd_ccw = kzalloc(sizeof(struct ccw1), GFP_KERNEL | GFP_DMA);
482 if (!rcd_ccw)
483 return -ENOMEM;
484 rcd_buf = kzalloc(ciw->count, GFP_KERNEL | GFP_DMA);
485 if (!rcd_buf) {
486 kfree(rcd_ccw);
487 return -ENOMEM;
488 }
489 rcd_ccw->cmd_code = ciw->cmd;
490 rcd_ccw->cda = (__u32) __pa (rcd_buf);
491 rcd_ccw->count = ciw->count;
492 rcd_ccw->flags = CCW_FLAG_SLI;
493
494 spin_lock_irq(sch->lock);
495 /* Save interrupt handler. */
496 handler = cdev->handler;
497 /* Temporarily install own handler. */
498 cdev->handler = ccw_device_wake_up;
499 if (cdev->private->state != DEV_STATE_ONLINE)
500 ret = -ENODEV;
501 else if (((sch->schib.scsw.stctl & SCSW_STCTL_PRIM_STATUS) &&
502 !(sch->schib.scsw.stctl & SCSW_STCTL_SEC_STATUS)) ||
503 cdev->private->flags.doverify)
504 ret = -EBUSY;
505 else
506 /* 0x00D9C3C4 == ebcdic "RCD" */
507 ret = __ccw_device_retry_loop(cdev, rcd_ccw, 0x00D9C3C4, lpm);
508
509 /* Restore interrupt handler. */
510 cdev->handler = handler;
511 spin_unlock_irq(sch->lock);
512
513 /*
514 * on success we update the user input parms
515 */
516 if (ret) {
517 kfree (rcd_buf);
518 *buffer = NULL;
519 *length = 0;
520 } else {
521 *length = ciw->count;
522 *buffer = rcd_buf;
523 }
524 kfree(rcd_ccw);
525
526 return ret;
527}
528
529/*
530 * Read Configuration data
531 */
532int
533read_conf_data (struct ccw_device *cdev, void **buffer, int *length)
534{
535 return read_conf_data_lpm (cdev, buffer, length, 0);
536}
537
538/* 291/*
539 * Try to break the lock on a boxed device. 292 * Try to break the lock on a boxed device.
540 */ 293 */
@@ -635,12 +388,6 @@ _ccw_device_get_subchannel_number(struct ccw_device *cdev)
635 return cdev->private->schid.sch_no; 388 return cdev->private->schid.sch_no;
636} 389}
637 390
638int
639_ccw_device_get_device_number(struct ccw_device *cdev)
640{
641 return cdev->private->dev_id.devno;
642}
643
644 391
645MODULE_LICENSE("GPL"); 392MODULE_LICENSE("GPL");
646EXPORT_SYMBOL(ccw_device_set_options_mask); 393EXPORT_SYMBOL(ccw_device_set_options_mask);
@@ -655,9 +402,5 @@ EXPORT_SYMBOL(ccw_device_start_timeout_key);
655EXPORT_SYMBOL(ccw_device_start_key); 402EXPORT_SYMBOL(ccw_device_start_key);
656EXPORT_SYMBOL(ccw_device_get_ciw); 403EXPORT_SYMBOL(ccw_device_get_ciw);
657EXPORT_SYMBOL(ccw_device_get_path_mask); 404EXPORT_SYMBOL(ccw_device_get_path_mask);
658EXPORT_SYMBOL(read_conf_data);
659EXPORT_SYMBOL(read_dev_chars);
660EXPORT_SYMBOL(_ccw_device_get_subchannel_number); 405EXPORT_SYMBOL(_ccw_device_get_subchannel_number);
661EXPORT_SYMBOL(_ccw_device_get_device_number);
662EXPORT_SYMBOL_GPL(ccw_device_get_chp_desc); 406EXPORT_SYMBOL_GPL(ccw_device_get_chp_desc);
663EXPORT_SYMBOL_GPL(read_conf_data_lpm);