aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2013-02-21 20:54:03 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2013-02-21 20:54:03 -0500
commit81ec44a6c69342fec1b1140c60a604027e429f69 (patch)
treeee6bec8a94ef28e111bf766cf4b7a9366cb4f7c1 /drivers
parent48a732dfaa77a4dfec803aa8f248373998704f76 (diff)
parente80cfc31d872b6b85b8966bce6ba80bee401a7dd (diff)
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/s390/linux
Pull s390 update from Martin Schwidefsky: "The most prominent change in this patch set is the software dirty bit patch for s390. It removes __HAVE_ARCH_PAGE_TEST_AND_CLEAR_DIRTY and the page_test_and_clear_dirty primitive which makes the common memory management code a bit less obscure. Heiko fixed most of the PCI related fallout, more often than not missing GENERIC_HARDIRQS dependencies. Notable is one of the 3270 patches which adds an export to tty_io to be able to resize a tty. The rest is the usual bunch of cleanups and bug fixes." * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/s390/linux: (42 commits) s390/module: Add missing R_390_NONE relocation type drivers/gpio: add missing GENERIC_HARDIRQ dependency drivers/input: add couple of missing GENERIC_HARDIRQS dependencies s390/cleanup: rename SPP to LPP s390/mm: implement software dirty bits s390/mm: Fix crst upgrade of mmap with MAP_FIXED s390/linker skript: discard exit.data at runtime drivers/media: add missing GENERIC_HARDIRQS dependency s390/bpf,jit: add vlan tag support drivers/net,AT91RM9200: add missing GENERIC_HARDIRQS dependency iucv: fix kernel panic at reboot s390/Kconfig: sort list of arch selected config options phylib: remove !S390 dependeny from Kconfig uio: remove !S390 dependency from Kconfig dasd: fix sysfs cleanup in dasd_generic_remove s390/pci: fix hotplug module init s390/pci: cleanup clp page allocation s390/pci: cleanup clp inline assembly s390/perf: cpum_cf: fallback to software sampling events s390/mm: provide PAGE_SHARED define ...
Diffstat (limited to 'drivers')
-rw-r--r--drivers/ata/Kconfig2
-rw-r--r--drivers/gpio/Kconfig4
-rw-r--r--drivers/media/radio/Kconfig2
-rw-r--r--drivers/net/ethernet/cadence/Kconfig1
-rw-r--r--drivers/net/phy/Kconfig1
-rw-r--r--drivers/parport/Kconfig2
-rw-r--r--drivers/pci/hotplug/s390_pci_hpc.c60
-rw-r--r--drivers/s390/block/dasd.c23
-rw-r--r--drivers/s390/block/dasd_3990_erp.c8
-rw-r--r--drivers/s390/block/dasd_alias.c4
-rw-r--r--drivers/s390/block/dasd_diag.c10
-rw-r--r--drivers/s390/block/dasd_eckd.c30
-rw-r--r--drivers/s390/block/dasd_eer.c2
-rw-r--r--drivers/s390/block/dasd_erp.c4
-rw-r--r--drivers/s390/block/dasd_fba.c2
-rw-r--r--drivers/s390/block/scm_blk.h41
-rw-r--r--drivers/s390/char/fs3270.c29
-rw-r--r--drivers/s390/char/raw3270.c611
-rw-r--r--drivers/s390/char/raw3270.h12
-rw-r--r--drivers/s390/char/sclp.c4
-rw-r--r--drivers/s390/char/sclp_cmd.c10
-rw-r--r--drivers/s390/char/tty3270.c187
-rw-r--r--drivers/s390/char/zcore.c64
-rw-r--r--drivers/s390/cio/chsc.c68
-rw-r--r--drivers/s390/cio/chsc.h2
-rw-r--r--drivers/s390/cio/cio.c4
-rw-r--r--drivers/s390/cio/cmf.c6
-rw-r--r--drivers/s390/cio/css.c2
-rw-r--r--drivers/s390/cio/device.c10
-rw-r--r--drivers/s390/cio/device_fsm.c2
-rw-r--r--drivers/s390/cio/device_pgid.c123
-rw-r--r--drivers/s390/cio/io_sch.h5
-rw-r--r--drivers/s390/cio/qdio_main.c12
-rw-r--r--drivers/s390/net/qeth_core.h2
-rw-r--r--drivers/s390/scsi/zfcp_fsf.c2
-rw-r--r--drivers/s390/scsi/zfcp_qdio.c2
-rw-r--r--drivers/tty/tty_io.c1
-rw-r--r--drivers/uio/Kconfig1
38 files changed, 774 insertions, 581 deletions
diff --git a/drivers/ata/Kconfig b/drivers/ata/Kconfig
index cdadce23e66d..4cfb7200260d 100644
--- a/drivers/ata/Kconfig
+++ b/drivers/ata/Kconfig
@@ -14,7 +14,7 @@ menuconfig ATA
14 tristate "Serial ATA and Parallel ATA drivers" 14 tristate "Serial ATA and Parallel ATA drivers"
15 depends on HAS_IOMEM 15 depends on HAS_IOMEM
16 depends on BLOCK 16 depends on BLOCK
17 depends on !(M32R || M68K) || BROKEN 17 depends on !(M32R || M68K || S390) || BROKEN
18 select SCSI 18 select SCSI
19 ---help--- 19 ---help---
20 If you want to use a ATA hard disk, ATA tape drive, ATA CD-ROM or 20 If you want to use a ATA hard disk, ATA tape drive, ATA CD-ROM or
diff --git a/drivers/gpio/Kconfig b/drivers/gpio/Kconfig
index 1855a6fd2b0a..b89d250f56e7 100644
--- a/drivers/gpio/Kconfig
+++ b/drivers/gpio/Kconfig
@@ -277,7 +277,7 @@ config GPIO_ICH
277 277
278config GPIO_VX855 278config GPIO_VX855
279 tristate "VIA VX855/VX875 GPIO" 279 tristate "VIA VX855/VX875 GPIO"
280 depends on PCI 280 depends on PCI && GENERIC_HARDIRQS
281 select MFD_CORE 281 select MFD_CORE
282 select MFD_VX855 282 select MFD_VX855
283 help 283 help
@@ -599,7 +599,7 @@ config GPIO_TIMBERDALE
599 599
600config GPIO_RDC321X 600config GPIO_RDC321X
601 tristate "RDC R-321x GPIO support" 601 tristate "RDC R-321x GPIO support"
602 depends on PCI 602 depends on PCI && GENERIC_HARDIRQS
603 select MFD_CORE 603 select MFD_CORE
604 select MFD_RDC321X 604 select MFD_RDC321X
605 help 605 help
diff --git a/drivers/media/radio/Kconfig b/drivers/media/radio/Kconfig
index 8090b87b3066..9e580166161a 100644
--- a/drivers/media/radio/Kconfig
+++ b/drivers/media/radio/Kconfig
@@ -180,7 +180,7 @@ config RADIO_TIMBERDALE
180 180
181config RADIO_WL1273 181config RADIO_WL1273
182 tristate "Texas Instruments WL1273 I2C FM Radio" 182 tristate "Texas Instruments WL1273 I2C FM Radio"
183 depends on I2C && VIDEO_V4L2 183 depends on I2C && VIDEO_V4L2 && GENERIC_HARDIRQS
184 select MFD_CORE 184 select MFD_CORE
185 select MFD_WL1273_CORE 185 select MFD_WL1273_CORE
186 select FW_LOADER 186 select FW_LOADER
diff --git a/drivers/net/ethernet/cadence/Kconfig b/drivers/net/ethernet/cadence/Kconfig
index ceb0de0cf62c..1194446f859a 100644
--- a/drivers/net/ethernet/cadence/Kconfig
+++ b/drivers/net/ethernet/cadence/Kconfig
@@ -22,6 +22,7 @@ if NET_CADENCE
22 22
23config ARM_AT91_ETHER 23config ARM_AT91_ETHER
24 tristate "AT91RM9200 Ethernet support" 24 tristate "AT91RM9200 Ethernet support"
25 depends on GENERIC_HARDIRQS
25 select NET_CORE 26 select NET_CORE
26 select MACB 27 select MACB
27 ---help--- 28 ---help---
diff --git a/drivers/net/phy/Kconfig b/drivers/net/phy/Kconfig
index 961f0b293913..450345261bd3 100644
--- a/drivers/net/phy/Kconfig
+++ b/drivers/net/phy/Kconfig
@@ -4,7 +4,6 @@
4 4
5menuconfig PHYLIB 5menuconfig PHYLIB
6 tristate "PHY Device support and infrastructure" 6 tristate "PHY Device support and infrastructure"
7 depends on !S390
8 depends on NETDEVICES 7 depends on NETDEVICES
9 help 8 help
10 Ethernet controllers are usually attached to PHY 9 Ethernet controllers are usually attached to PHY
diff --git a/drivers/parport/Kconfig b/drivers/parport/Kconfig
index 0e60438ebe30..24e12d4d1769 100644
--- a/drivers/parport/Kconfig
+++ b/drivers/parport/Kconfig
@@ -35,7 +35,7 @@ if PARPORT
35 35
36config PARPORT_PC 36config PARPORT_PC
37 tristate "PC-style hardware" 37 tristate "PC-style hardware"
38 depends on (!SPARC64 || PCI) && !SPARC32 && !M32R && !FRV && \ 38 depends on (!SPARC64 || PCI) && !SPARC32 && !M32R && !FRV && !S390 && \
39 (!M68K || ISA) && !MN10300 && !AVR32 && !BLACKFIN && !XTENSA 39 (!M68K || ISA) && !MN10300 && !AVR32 && !BLACKFIN && !XTENSA
40 ---help--- 40 ---help---
41 You should say Y here if you have a PC-style parallel port. All 41 You should say Y here if you have a PC-style parallel port. All
diff --git a/drivers/pci/hotplug/s390_pci_hpc.c b/drivers/pci/hotplug/s390_pci_hpc.c
index dee68e0698e1..7db249a25016 100644
--- a/drivers/pci/hotplug/s390_pci_hpc.c
+++ b/drivers/pci/hotplug/s390_pci_hpc.c
@@ -172,25 +172,6 @@ error:
172 return -ENOMEM; 172 return -ENOMEM;
173} 173}
174 174
175static int __init init_pci_slots(void)
176{
177 struct zpci_dev *zdev;
178 int device = 0;
179
180 /*
181 * Create a structure for each slot, and register that slot
182 * with the pci_hotplug subsystem.
183 */
184 mutex_lock(&zpci_list_lock);
185 list_for_each_entry(zdev, &zpci_list, entry) {
186 init_pci_slot(zdev);
187 device++;
188 }
189
190 mutex_unlock(&zpci_list_lock);
191 return (device) ? 0 : -ENODEV;
192}
193
194static void exit_pci_slot(struct zpci_dev *zdev) 175static void exit_pci_slot(struct zpci_dev *zdev)
195{ 176{
196 struct list_head *tmp, *n; 177 struct list_head *tmp, *n;
@@ -205,6 +186,26 @@ static void exit_pci_slot(struct zpci_dev *zdev)
205 } 186 }
206} 187}
207 188
189static struct pci_hp_callback_ops hp_ops = {
190 .create_slot = init_pci_slot,
191 .remove_slot = exit_pci_slot,
192};
193
194static void __init init_pci_slots(void)
195{
196 struct zpci_dev *zdev;
197
198 /*
199 * Create a structure for each slot, and register that slot
200 * with the pci_hotplug subsystem.
201 */
202 mutex_lock(&zpci_list_lock);
203 list_for_each_entry(zdev, &zpci_list, entry) {
204 init_pci_slot(zdev);
205 }
206 mutex_unlock(&zpci_list_lock);
207}
208
208static void __exit exit_pci_slots(void) 209static void __exit exit_pci_slots(void)
209{ 210{
210 struct list_head *tmp, *n; 211 struct list_head *tmp, *n;
@@ -224,28 +225,19 @@ static void __exit exit_pci_slots(void)
224 225
225static int __init pci_hotplug_s390_init(void) 226static int __init pci_hotplug_s390_init(void)
226{ 227{
227 /* 228 if (!s390_pci_probe)
228 * Do specific initialization stuff for your driver here
229 * like initializing your controller hardware (if any) and
230 * determining the number of slots you have in the system
231 * right now.
232 */
233
234 if (!pci_probe)
235 return -EOPNOTSUPP; 229 return -EOPNOTSUPP;
236 230
237 /* register callbacks for slot handling from arch code */ 231 zpci_register_hp_ops(&hp_ops);
238 mutex_lock(&zpci_list_lock); 232 init_pci_slots();
239 hotplug_ops.create_slot = init_pci_slot; 233
240 hotplug_ops.remove_slot = exit_pci_slot; 234 return 0;
241 mutex_unlock(&zpci_list_lock);
242 pr_info("registered hotplug slot callbacks\n");
243 return init_pci_slots();
244} 235}
245 236
246static void __exit pci_hotplug_s390_exit(void) 237static void __exit pci_hotplug_s390_exit(void)
247{ 238{
248 exit_pci_slots(); 239 exit_pci_slots();
240 zpci_deregister_hp_ops();
249} 241}
250 242
251module_init(pci_hotplug_s390_init); 243module_init(pci_hotplug_s390_init);
diff --git a/drivers/s390/block/dasd.c b/drivers/s390/block/dasd.c
index 29225e1c159c..f1b7fdc58a5f 100644
--- a/drivers/s390/block/dasd.c
+++ b/drivers/s390/block/dasd.c
@@ -1352,7 +1352,7 @@ int dasd_term_IO(struct dasd_ccw_req *cqr)
1352 switch (rc) { 1352 switch (rc) {
1353 case 0: /* termination successful */ 1353 case 0: /* termination successful */
1354 cqr->status = DASD_CQR_CLEAR_PENDING; 1354 cqr->status = DASD_CQR_CLEAR_PENDING;
1355 cqr->stopclk = get_clock(); 1355 cqr->stopclk = get_tod_clock();
1356 cqr->starttime = 0; 1356 cqr->starttime = 0;
1357 DBF_DEV_EVENT(DBF_DEBUG, device, 1357 DBF_DEV_EVENT(DBF_DEBUG, device,
1358 "terminate cqr %p successful", 1358 "terminate cqr %p successful",
@@ -1420,7 +1420,7 @@ int dasd_start_IO(struct dasd_ccw_req *cqr)
1420 cqr->status = DASD_CQR_ERROR; 1420 cqr->status = DASD_CQR_ERROR;
1421 return -EIO; 1421 return -EIO;
1422 } 1422 }
1423 cqr->startclk = get_clock(); 1423 cqr->startclk = get_tod_clock();
1424 cqr->starttime = jiffies; 1424 cqr->starttime = jiffies;
1425 cqr->retries--; 1425 cqr->retries--;
1426 if (!test_bit(DASD_CQR_VERIFY_PATH, &cqr->flags)) { 1426 if (!test_bit(DASD_CQR_VERIFY_PATH, &cqr->flags)) {
@@ -1623,7 +1623,7 @@ void dasd_int_handler(struct ccw_device *cdev, unsigned long intparm,
1623 return; 1623 return;
1624 } 1624 }
1625 1625
1626 now = get_clock(); 1626 now = get_tod_clock();
1627 cqr = (struct dasd_ccw_req *) intparm; 1627 cqr = (struct dasd_ccw_req *) intparm;
1628 /* check for conditions that should be handled immediately */ 1628 /* check for conditions that should be handled immediately */
1629 if (!cqr || 1629 if (!cqr ||
@@ -1963,7 +1963,7 @@ int dasd_flush_device_queue(struct dasd_device *device)
1963 } 1963 }
1964 break; 1964 break;
1965 case DASD_CQR_QUEUED: 1965 case DASD_CQR_QUEUED:
1966 cqr->stopclk = get_clock(); 1966 cqr->stopclk = get_tod_clock();
1967 cqr->status = DASD_CQR_CLEARED; 1967 cqr->status = DASD_CQR_CLEARED;
1968 break; 1968 break;
1969 default: /* no need to modify the others */ 1969 default: /* no need to modify the others */
@@ -2210,7 +2210,7 @@ static int _dasd_sleep_on(struct dasd_ccw_req *maincqr, int interruptible)
2210 wait_event(generic_waitq, _wait_for_wakeup(cqr)); 2210 wait_event(generic_waitq, _wait_for_wakeup(cqr));
2211 } 2211 }
2212 2212
2213 maincqr->endclk = get_clock(); 2213 maincqr->endclk = get_tod_clock();
2214 if ((maincqr->status != DASD_CQR_DONE) && 2214 if ((maincqr->status != DASD_CQR_DONE) &&
2215 (maincqr->intrc != -ERESTARTSYS)) 2215 (maincqr->intrc != -ERESTARTSYS))
2216 dasd_log_sense(maincqr, &maincqr->irb); 2216 dasd_log_sense(maincqr, &maincqr->irb);
@@ -2340,7 +2340,7 @@ int dasd_cancel_req(struct dasd_ccw_req *cqr)
2340 "Cancelling request %p failed with rc=%d\n", 2340 "Cancelling request %p failed with rc=%d\n",
2341 cqr, rc); 2341 cqr, rc);
2342 } else { 2342 } else {
2343 cqr->stopclk = get_clock(); 2343 cqr->stopclk = get_tod_clock();
2344 } 2344 }
2345 break; 2345 break;
2346 default: /* already finished or clear pending - do nothing */ 2346 default: /* already finished or clear pending - do nothing */
@@ -2568,7 +2568,7 @@ restart:
2568 } 2568 }
2569 2569
2570 /* Rechain finished requests to final queue */ 2570 /* Rechain finished requests to final queue */
2571 cqr->endclk = get_clock(); 2571 cqr->endclk = get_tod_clock();
2572 list_move_tail(&cqr->blocklist, final_queue); 2572 list_move_tail(&cqr->blocklist, final_queue);
2573 } 2573 }
2574} 2574}
@@ -2711,7 +2711,7 @@ restart_cb:
2711 } 2711 }
2712 /* call the callback function */ 2712 /* call the callback function */
2713 spin_lock_irq(&block->request_queue_lock); 2713 spin_lock_irq(&block->request_queue_lock);
2714 cqr->endclk = get_clock(); 2714 cqr->endclk = get_tod_clock();
2715 list_del_init(&cqr->blocklist); 2715 list_del_init(&cqr->blocklist);
2716 __dasd_cleanup_cqr(cqr); 2716 __dasd_cleanup_cqr(cqr);
2717 spin_unlock_irq(&block->request_queue_lock); 2717 spin_unlock_irq(&block->request_queue_lock);
@@ -3042,12 +3042,15 @@ void dasd_generic_remove(struct ccw_device *cdev)
3042 cdev->handler = NULL; 3042 cdev->handler = NULL;
3043 3043
3044 device = dasd_device_from_cdev(cdev); 3044 device = dasd_device_from_cdev(cdev);
3045 if (IS_ERR(device)) 3045 if (IS_ERR(device)) {
3046 dasd_remove_sysfs_files(cdev);
3046 return; 3047 return;
3048 }
3047 if (test_and_set_bit(DASD_FLAG_OFFLINE, &device->flags) && 3049 if (test_and_set_bit(DASD_FLAG_OFFLINE, &device->flags) &&
3048 !test_bit(DASD_FLAG_SAFE_OFFLINE_RUNNING, &device->flags)) { 3050 !test_bit(DASD_FLAG_SAFE_OFFLINE_RUNNING, &device->flags)) {
3049 /* Already doing offline processing */ 3051 /* Already doing offline processing */
3050 dasd_put_device(device); 3052 dasd_put_device(device);
3053 dasd_remove_sysfs_files(cdev);
3051 return; 3054 return;
3052 } 3055 }
3053 /* 3056 /*
@@ -3504,7 +3507,7 @@ static struct dasd_ccw_req *dasd_generic_build_rdc(struct dasd_device *device,
3504 cqr->memdev = device; 3507 cqr->memdev = device;
3505 cqr->expires = 10*HZ; 3508 cqr->expires = 10*HZ;
3506 cqr->retries = 256; 3509 cqr->retries = 256;
3507 cqr->buildclk = get_clock(); 3510 cqr->buildclk = get_tod_clock();
3508 cqr->status = DASD_CQR_FILLED; 3511 cqr->status = DASD_CQR_FILLED;
3509 return cqr; 3512 return cqr;
3510} 3513}
diff --git a/drivers/s390/block/dasd_3990_erp.c b/drivers/s390/block/dasd_3990_erp.c
index f8212d54013a..d26134713682 100644
--- a/drivers/s390/block/dasd_3990_erp.c
+++ b/drivers/s390/block/dasd_3990_erp.c
@@ -229,7 +229,7 @@ dasd_3990_erp_DCTL(struct dasd_ccw_req * erp, char modifier)
229 dctl_cqr->expires = 5 * 60 * HZ; 229 dctl_cqr->expires = 5 * 60 * HZ;
230 dctl_cqr->retries = 2; 230 dctl_cqr->retries = 2;
231 231
232 dctl_cqr->buildclk = get_clock(); 232 dctl_cqr->buildclk = get_tod_clock();
233 233
234 dctl_cqr->status = DASD_CQR_FILLED; 234 dctl_cqr->status = DASD_CQR_FILLED;
235 235
@@ -1719,7 +1719,7 @@ dasd_3990_erp_action_1B_32(struct dasd_ccw_req * default_erp, char *sense)
1719 erp->magic = default_erp->magic; 1719 erp->magic = default_erp->magic;
1720 erp->expires = default_erp->expires; 1720 erp->expires = default_erp->expires;
1721 erp->retries = 256; 1721 erp->retries = 256;
1722 erp->buildclk = get_clock(); 1722 erp->buildclk = get_tod_clock();
1723 erp->status = DASD_CQR_FILLED; 1723 erp->status = DASD_CQR_FILLED;
1724 1724
1725 /* remove the default erp */ 1725 /* remove the default erp */
@@ -2322,7 +2322,7 @@ static struct dasd_ccw_req *dasd_3990_erp_add_erp(struct dasd_ccw_req *cqr)
2322 DBF_DEV_EVENT(DBF_ERR, device, "%s", 2322 DBF_DEV_EVENT(DBF_ERR, device, "%s",
2323 "Unable to allocate ERP request"); 2323 "Unable to allocate ERP request");
2324 cqr->status = DASD_CQR_FAILED; 2324 cqr->status = DASD_CQR_FAILED;
2325 cqr->stopclk = get_clock (); 2325 cqr->stopclk = get_tod_clock();
2326 } else { 2326 } else {
2327 DBF_DEV_EVENT(DBF_ERR, device, 2327 DBF_DEV_EVENT(DBF_ERR, device,
2328 "Unable to allocate ERP request " 2328 "Unable to allocate ERP request "
@@ -2364,7 +2364,7 @@ static struct dasd_ccw_req *dasd_3990_erp_add_erp(struct dasd_ccw_req *cqr)
2364 erp->magic = cqr->magic; 2364 erp->magic = cqr->magic;
2365 erp->expires = cqr->expires; 2365 erp->expires = cqr->expires;
2366 erp->retries = 256; 2366 erp->retries = 256;
2367 erp->buildclk = get_clock(); 2367 erp->buildclk = get_tod_clock();
2368 erp->status = DASD_CQR_FILLED; 2368 erp->status = DASD_CQR_FILLED;
2369 2369
2370 return erp; 2370 return erp;
diff --git a/drivers/s390/block/dasd_alias.c b/drivers/s390/block/dasd_alias.c
index 6b556995bb33..a2597e683e79 100644
--- a/drivers/s390/block/dasd_alias.c
+++ b/drivers/s390/block/dasd_alias.c
@@ -448,7 +448,7 @@ static int read_unit_address_configuration(struct dasd_device *device,
448 ccw->count = sizeof(*(lcu->uac)); 448 ccw->count = sizeof(*(lcu->uac));
449 ccw->cda = (__u32)(addr_t) lcu->uac; 449 ccw->cda = (__u32)(addr_t) lcu->uac;
450 450
451 cqr->buildclk = get_clock(); 451 cqr->buildclk = get_tod_clock();
452 cqr->status = DASD_CQR_FILLED; 452 cqr->status = DASD_CQR_FILLED;
453 453
454 /* need to unset flag here to detect race with summary unit check */ 454 /* need to unset flag here to detect race with summary unit check */
@@ -733,7 +733,7 @@ static int reset_summary_unit_check(struct alias_lcu *lcu,
733 cqr->memdev = device; 733 cqr->memdev = device;
734 cqr->block = NULL; 734 cqr->block = NULL;
735 cqr->expires = 5 * HZ; 735 cqr->expires = 5 * HZ;
736 cqr->buildclk = get_clock(); 736 cqr->buildclk = get_tod_clock();
737 cqr->status = DASD_CQR_FILLED; 737 cqr->status = DASD_CQR_FILLED;
738 738
739 rc = dasd_sleep_on_immediatly(cqr); 739 rc = dasd_sleep_on_immediatly(cqr);
diff --git a/drivers/s390/block/dasd_diag.c b/drivers/s390/block/dasd_diag.c
index 704488d0f819..cc0603358522 100644
--- a/drivers/s390/block/dasd_diag.c
+++ b/drivers/s390/block/dasd_diag.c
@@ -184,14 +184,14 @@ dasd_start_diag(struct dasd_ccw_req * cqr)
184 private->iob.bio_list = dreq->bio; 184 private->iob.bio_list = dreq->bio;
185 private->iob.flaga = DASD_DIAG_FLAGA_DEFAULT; 185 private->iob.flaga = DASD_DIAG_FLAGA_DEFAULT;
186 186
187 cqr->startclk = get_clock(); 187 cqr->startclk = get_tod_clock();
188 cqr->starttime = jiffies; 188 cqr->starttime = jiffies;
189 cqr->retries--; 189 cqr->retries--;
190 190
191 rc = dia250(&private->iob, RW_BIO); 191 rc = dia250(&private->iob, RW_BIO);
192 switch (rc) { 192 switch (rc) {
193 case 0: /* Synchronous I/O finished successfully */ 193 case 0: /* Synchronous I/O finished successfully */
194 cqr->stopclk = get_clock(); 194 cqr->stopclk = get_tod_clock();
195 cqr->status = DASD_CQR_SUCCESS; 195 cqr->status = DASD_CQR_SUCCESS;
196 /* Indicate to calling function that only a dasd_schedule_bh() 196 /* Indicate to calling function that only a dasd_schedule_bh()
197 and no timer is needed */ 197 and no timer is needed */
@@ -222,7 +222,7 @@ dasd_diag_term_IO(struct dasd_ccw_req * cqr)
222 mdsk_term_io(device); 222 mdsk_term_io(device);
223 mdsk_init_io(device, device->block->bp_block, 0, NULL); 223 mdsk_init_io(device, device->block->bp_block, 0, NULL);
224 cqr->status = DASD_CQR_CLEAR_PENDING; 224 cqr->status = DASD_CQR_CLEAR_PENDING;
225 cqr->stopclk = get_clock(); 225 cqr->stopclk = get_tod_clock();
226 dasd_schedule_device_bh(device); 226 dasd_schedule_device_bh(device);
227 return 0; 227 return 0;
228} 228}
@@ -276,7 +276,7 @@ static void dasd_ext_handler(struct ext_code ext_code,
276 return; 276 return;
277 } 277 }
278 278
279 cqr->stopclk = get_clock(); 279 cqr->stopclk = get_tod_clock();
280 280
281 expires = 0; 281 expires = 0;
282 if ((ext_code.subcode & 0xff) == 0) { 282 if ((ext_code.subcode & 0xff) == 0) {
@@ -556,7 +556,7 @@ static struct dasd_ccw_req *dasd_diag_build_cp(struct dasd_device *memdev,
556 } 556 }
557 } 557 }
558 cqr->retries = DIAG_MAX_RETRIES; 558 cqr->retries = DIAG_MAX_RETRIES;
559 cqr->buildclk = get_clock(); 559 cqr->buildclk = get_tod_clock();
560 if (blk_noretry_request(req) || 560 if (blk_noretry_request(req) ||
561 block->base->features & DASD_FEATURE_FAILFAST) 561 block->base->features & DASD_FEATURE_FAILFAST)
562 set_bit(DASD_CQR_FLAGS_FAILFAST, &cqr->flags); 562 set_bit(DASD_CQR_FLAGS_FAILFAST, &cqr->flags);
diff --git a/drivers/s390/block/dasd_eckd.c b/drivers/s390/block/dasd_eckd.c
index e37bc1620d14..33f26bfa62f2 100644
--- a/drivers/s390/block/dasd_eckd.c
+++ b/drivers/s390/block/dasd_eckd.c
@@ -862,7 +862,7 @@ static void dasd_eckd_fill_rcd_cqr(struct dasd_device *device,
862 cqr->expires = 10*HZ; 862 cqr->expires = 10*HZ;
863 cqr->lpm = lpm; 863 cqr->lpm = lpm;
864 cqr->retries = 256; 864 cqr->retries = 256;
865 cqr->buildclk = get_clock(); 865 cqr->buildclk = get_tod_clock();
866 cqr->status = DASD_CQR_FILLED; 866 cqr->status = DASD_CQR_FILLED;
867 set_bit(DASD_CQR_VERIFY_PATH, &cqr->flags); 867 set_bit(DASD_CQR_VERIFY_PATH, &cqr->flags);
868} 868}
@@ -1449,7 +1449,7 @@ static int dasd_eckd_read_features(struct dasd_device *device)
1449 ccw->count = sizeof(struct dasd_rssd_features); 1449 ccw->count = sizeof(struct dasd_rssd_features);
1450 ccw->cda = (__u32)(addr_t) features; 1450 ccw->cda = (__u32)(addr_t) features;
1451 1451
1452 cqr->buildclk = get_clock(); 1452 cqr->buildclk = get_tod_clock();
1453 cqr->status = DASD_CQR_FILLED; 1453 cqr->status = DASD_CQR_FILLED;
1454 rc = dasd_sleep_on(cqr); 1454 rc = dasd_sleep_on(cqr);
1455 if (rc == 0) { 1455 if (rc == 0) {
@@ -1501,7 +1501,7 @@ static struct dasd_ccw_req *dasd_eckd_build_psf_ssc(struct dasd_device *device,
1501 cqr->block = NULL; 1501 cqr->block = NULL;
1502 cqr->retries = 256; 1502 cqr->retries = 256;
1503 cqr->expires = 10*HZ; 1503 cqr->expires = 10*HZ;
1504 cqr->buildclk = get_clock(); 1504 cqr->buildclk = get_tod_clock();
1505 cqr->status = DASD_CQR_FILLED; 1505 cqr->status = DASD_CQR_FILLED;
1506 return cqr; 1506 return cqr;
1507} 1507}
@@ -1841,7 +1841,7 @@ dasd_eckd_analysis_ccw(struct dasd_device *device)
1841 cqr->startdev = device; 1841 cqr->startdev = device;
1842 cqr->memdev = device; 1842 cqr->memdev = device;
1843 cqr->retries = 255; 1843 cqr->retries = 255;
1844 cqr->buildclk = get_clock(); 1844 cqr->buildclk = get_tod_clock();
1845 cqr->status = DASD_CQR_FILLED; 1845 cqr->status = DASD_CQR_FILLED;
1846 return cqr; 1846 return cqr;
1847} 1847}
@@ -2241,7 +2241,7 @@ dasd_eckd_format_device(struct dasd_device * device,
2241 fcp->startdev = device; 2241 fcp->startdev = device;
2242 fcp->memdev = device; 2242 fcp->memdev = device;
2243 fcp->retries = 256; 2243 fcp->retries = 256;
2244 fcp->buildclk = get_clock(); 2244 fcp->buildclk = get_tod_clock();
2245 fcp->status = DASD_CQR_FILLED; 2245 fcp->status = DASD_CQR_FILLED;
2246 return fcp; 2246 return fcp;
2247} 2247}
@@ -2530,7 +2530,7 @@ static struct dasd_ccw_req *dasd_eckd_build_cp_cmd_single(
2530 cqr->expires = startdev->default_expires * HZ; /* default 5 minutes */ 2530 cqr->expires = startdev->default_expires * HZ; /* default 5 minutes */
2531 cqr->lpm = startdev->path_data.ppm; 2531 cqr->lpm = startdev->path_data.ppm;
2532 cqr->retries = 256; 2532 cqr->retries = 256;
2533 cqr->buildclk = get_clock(); 2533 cqr->buildclk = get_tod_clock();
2534 cqr->status = DASD_CQR_FILLED; 2534 cqr->status = DASD_CQR_FILLED;
2535 return cqr; 2535 return cqr;
2536} 2536}
@@ -2705,7 +2705,7 @@ static struct dasd_ccw_req *dasd_eckd_build_cp_cmd_track(
2705 cqr->expires = startdev->default_expires * HZ; /* default 5 minutes */ 2705 cqr->expires = startdev->default_expires * HZ; /* default 5 minutes */
2706 cqr->lpm = startdev->path_data.ppm; 2706 cqr->lpm = startdev->path_data.ppm;
2707 cqr->retries = 256; 2707 cqr->retries = 256;
2708 cqr->buildclk = get_clock(); 2708 cqr->buildclk = get_tod_clock();
2709 cqr->status = DASD_CQR_FILLED; 2709 cqr->status = DASD_CQR_FILLED;
2710 return cqr; 2710 return cqr;
2711} 2711}
@@ -2998,7 +2998,7 @@ static struct dasd_ccw_req *dasd_eckd_build_cp_tpm_track(
2998 cqr->expires = startdev->default_expires * HZ; /* default 5 minutes */ 2998 cqr->expires = startdev->default_expires * HZ; /* default 5 minutes */
2999 cqr->lpm = startdev->path_data.ppm; 2999 cqr->lpm = startdev->path_data.ppm;
3000 cqr->retries = 256; 3000 cqr->retries = 256;
3001 cqr->buildclk = get_clock(); 3001 cqr->buildclk = get_tod_clock();
3002 cqr->status = DASD_CQR_FILLED; 3002 cqr->status = DASD_CQR_FILLED;
3003 return cqr; 3003 return cqr;
3004out_error: 3004out_error:
@@ -3201,7 +3201,7 @@ static struct dasd_ccw_req *dasd_raw_build_cp(struct dasd_device *startdev,
3201 cqr->expires = startdev->default_expires * HZ; 3201 cqr->expires = startdev->default_expires * HZ;
3202 cqr->lpm = startdev->path_data.ppm; 3202 cqr->lpm = startdev->path_data.ppm;
3203 cqr->retries = 256; 3203 cqr->retries = 256;
3204 cqr->buildclk = get_clock(); 3204 cqr->buildclk = get_tod_clock();
3205 cqr->status = DASD_CQR_FILLED; 3205 cqr->status = DASD_CQR_FILLED;
3206 3206
3207 if (IS_ERR(cqr) && PTR_ERR(cqr) != -EAGAIN) 3207 if (IS_ERR(cqr) && PTR_ERR(cqr) != -EAGAIN)
@@ -3402,7 +3402,7 @@ dasd_eckd_release(struct dasd_device *device)
3402 set_bit(DASD_CQR_FLAGS_FAILFAST, &cqr->flags); 3402 set_bit(DASD_CQR_FLAGS_FAILFAST, &cqr->flags);
3403 cqr->retries = 2; /* set retry counter to enable basic ERP */ 3403 cqr->retries = 2; /* set retry counter to enable basic ERP */
3404 cqr->expires = 2 * HZ; 3404 cqr->expires = 2 * HZ;
3405 cqr->buildclk = get_clock(); 3405 cqr->buildclk = get_tod_clock();
3406 cqr->status = DASD_CQR_FILLED; 3406 cqr->status = DASD_CQR_FILLED;
3407 3407
3408 rc = dasd_sleep_on_immediatly(cqr); 3408 rc = dasd_sleep_on_immediatly(cqr);
@@ -3457,7 +3457,7 @@ dasd_eckd_reserve(struct dasd_device *device)
3457 set_bit(DASD_CQR_FLAGS_FAILFAST, &cqr->flags); 3457 set_bit(DASD_CQR_FLAGS_FAILFAST, &cqr->flags);
3458 cqr->retries = 2; /* set retry counter to enable basic ERP */ 3458 cqr->retries = 2; /* set retry counter to enable basic ERP */
3459 cqr->expires = 2 * HZ; 3459 cqr->expires = 2 * HZ;
3460 cqr->buildclk = get_clock(); 3460 cqr->buildclk = get_tod_clock();
3461 cqr->status = DASD_CQR_FILLED; 3461 cqr->status = DASD_CQR_FILLED;
3462 3462
3463 rc = dasd_sleep_on_immediatly(cqr); 3463 rc = dasd_sleep_on_immediatly(cqr);
@@ -3511,7 +3511,7 @@ dasd_eckd_steal_lock(struct dasd_device *device)
3511 set_bit(DASD_CQR_FLAGS_FAILFAST, &cqr->flags); 3511 set_bit(DASD_CQR_FLAGS_FAILFAST, &cqr->flags);
3512 cqr->retries = 2; /* set retry counter to enable basic ERP */ 3512 cqr->retries = 2; /* set retry counter to enable basic ERP */
3513 cqr->expires = 2 * HZ; 3513 cqr->expires = 2 * HZ;
3514 cqr->buildclk = get_clock(); 3514 cqr->buildclk = get_tod_clock();
3515 cqr->status = DASD_CQR_FILLED; 3515 cqr->status = DASD_CQR_FILLED;
3516 3516
3517 rc = dasd_sleep_on_immediatly(cqr); 3517 rc = dasd_sleep_on_immediatly(cqr);
@@ -3572,7 +3572,7 @@ static int dasd_eckd_snid(struct dasd_device *device,
3572 set_bit(DASD_CQR_ALLOW_SLOCK, &cqr->flags); 3572 set_bit(DASD_CQR_ALLOW_SLOCK, &cqr->flags);
3573 cqr->retries = 5; 3573 cqr->retries = 5;
3574 cqr->expires = 10 * HZ; 3574 cqr->expires = 10 * HZ;
3575 cqr->buildclk = get_clock(); 3575 cqr->buildclk = get_tod_clock();
3576 cqr->status = DASD_CQR_FILLED; 3576 cqr->status = DASD_CQR_FILLED;
3577 cqr->lpm = usrparm.path_mask; 3577 cqr->lpm = usrparm.path_mask;
3578 3578
@@ -3642,7 +3642,7 @@ dasd_eckd_performance(struct dasd_device *device, void __user *argp)
3642 ccw->count = sizeof(struct dasd_rssd_perf_stats_t); 3642 ccw->count = sizeof(struct dasd_rssd_perf_stats_t);
3643 ccw->cda = (__u32)(addr_t) stats; 3643 ccw->cda = (__u32)(addr_t) stats;
3644 3644
3645 cqr->buildclk = get_clock(); 3645 cqr->buildclk = get_tod_clock();
3646 cqr->status = DASD_CQR_FILLED; 3646 cqr->status = DASD_CQR_FILLED;
3647 rc = dasd_sleep_on(cqr); 3647 rc = dasd_sleep_on(cqr);
3648 if (rc == 0) { 3648 if (rc == 0) {
@@ -3768,7 +3768,7 @@ static int dasd_symm_io(struct dasd_device *device, void __user *argp)
3768 cqr->memdev = device; 3768 cqr->memdev = device;
3769 cqr->retries = 3; 3769 cqr->retries = 3;
3770 cqr->expires = 10 * HZ; 3770 cqr->expires = 10 * HZ;
3771 cqr->buildclk = get_clock(); 3771 cqr->buildclk = get_tod_clock();
3772 cqr->status = DASD_CQR_FILLED; 3772 cqr->status = DASD_CQR_FILLED;
3773 3773
3774 /* Build the ccws */ 3774 /* Build the ccws */
diff --git a/drivers/s390/block/dasd_eer.c b/drivers/s390/block/dasd_eer.c
index ff901b5509c1..21ef63cf0960 100644
--- a/drivers/s390/block/dasd_eer.c
+++ b/drivers/s390/block/dasd_eer.c
@@ -481,7 +481,7 @@ int dasd_eer_enable(struct dasd_device *device)
481 ccw->flags = 0; 481 ccw->flags = 0;
482 ccw->cda = (__u32)(addr_t) cqr->data; 482 ccw->cda = (__u32)(addr_t) cqr->data;
483 483
484 cqr->buildclk = get_clock(); 484 cqr->buildclk = get_tod_clock();
485 cqr->status = DASD_CQR_FILLED; 485 cqr->status = DASD_CQR_FILLED;
486 cqr->callback = dasd_eer_snss_cb; 486 cqr->callback = dasd_eer_snss_cb;
487 487
diff --git a/drivers/s390/block/dasd_erp.c b/drivers/s390/block/dasd_erp.c
index d01ef82f8757..3250cb471f78 100644
--- a/drivers/s390/block/dasd_erp.c
+++ b/drivers/s390/block/dasd_erp.c
@@ -102,7 +102,7 @@ dasd_default_erp_action(struct dasd_ccw_req *cqr)
102 pr_err("%s: default ERP has run out of retries and failed\n", 102 pr_err("%s: default ERP has run out of retries and failed\n",
103 dev_name(&device->cdev->dev)); 103 dev_name(&device->cdev->dev));
104 cqr->status = DASD_CQR_FAILED; 104 cqr->status = DASD_CQR_FAILED;
105 cqr->stopclk = get_clock(); 105 cqr->stopclk = get_tod_clock();
106 } 106 }
107 return cqr; 107 return cqr;
108} /* end dasd_default_erp_action */ 108} /* end dasd_default_erp_action */
@@ -146,7 +146,7 @@ struct dasd_ccw_req *dasd_default_erp_postaction(struct dasd_ccw_req *cqr)
146 cqr->status = DASD_CQR_DONE; 146 cqr->status = DASD_CQR_DONE;
147 else { 147 else {
148 cqr->status = DASD_CQR_FAILED; 148 cqr->status = DASD_CQR_FAILED;
149 cqr->stopclk = get_clock(); 149 cqr->stopclk = get_tod_clock();
150 } 150 }
151 151
152 return cqr; 152 return cqr;
diff --git a/drivers/s390/block/dasd_fba.c b/drivers/s390/block/dasd_fba.c
index 414698584344..4dd0e2f6047e 100644
--- a/drivers/s390/block/dasd_fba.c
+++ b/drivers/s390/block/dasd_fba.c
@@ -370,7 +370,7 @@ static struct dasd_ccw_req *dasd_fba_build_cp(struct dasd_device * memdev,
370 cqr->block = block; 370 cqr->block = block;
371 cqr->expires = memdev->default_expires * HZ; /* default 5 minutes */ 371 cqr->expires = memdev->default_expires * HZ; /* default 5 minutes */
372 cqr->retries = 32; 372 cqr->retries = 32;
373 cqr->buildclk = get_clock(); 373 cqr->buildclk = get_tod_clock();
374 cqr->status = DASD_CQR_FILLED; 374 cqr->status = DASD_CQR_FILLED;
375 return cqr; 375 return cqr;
376} 376}
diff --git a/drivers/s390/block/scm_blk.h b/drivers/s390/block/scm_blk.h
index 7ac6bad919ef..3c1ccf494647 100644
--- a/drivers/s390/block/scm_blk.h
+++ b/drivers/s390/block/scm_blk.h
@@ -68,19 +68,34 @@ void scm_initiate_cluster_request(struct scm_request *);
68void scm_cluster_request_irq(struct scm_request *); 68void scm_cluster_request_irq(struct scm_request *);
69bool scm_test_cluster_request(struct scm_request *); 69bool scm_test_cluster_request(struct scm_request *);
70bool scm_cluster_size_valid(void); 70bool scm_cluster_size_valid(void);
71#else 71#else /* CONFIG_SCM_BLOCK_CLUSTER_WRITE */
72#define __scm_free_rq_cluster(scmrq) {} 72static inline void __scm_free_rq_cluster(struct scm_request *scmrq) {}
73#define __scm_alloc_rq_cluster(scmrq) 0 73static inline int __scm_alloc_rq_cluster(struct scm_request *scmrq)
74#define scm_request_cluster_init(scmrq) {} 74{
75#define scm_reserve_cluster(scmrq) true 75 return 0;
76#define scm_release_cluster(scmrq) {} 76}
77#define scm_blk_dev_cluster_setup(bdev) {} 77static inline void scm_request_cluster_init(struct scm_request *scmrq) {}
78#define scm_need_cluster_request(scmrq) false 78static inline bool scm_reserve_cluster(struct scm_request *scmrq)
79#define scm_initiate_cluster_request(scmrq) {} 79{
80#define scm_cluster_request_irq(scmrq) {} 80 return true;
81#define scm_test_cluster_request(scmrq) false 81}
82#define scm_cluster_size_valid() true 82static inline void scm_release_cluster(struct scm_request *scmrq) {}
83#endif 83static inline void scm_blk_dev_cluster_setup(struct scm_blk_dev *bdev) {}
84static inline bool scm_need_cluster_request(struct scm_request *scmrq)
85{
86 return false;
87}
88static inline void scm_initiate_cluster_request(struct scm_request *scmrq) {}
89static inline void scm_cluster_request_irq(struct scm_request *scmrq) {}
90static inline bool scm_test_cluster_request(struct scm_request *scmrq)
91{
92 return false;
93}
94static inline bool scm_cluster_size_valid(void)
95{
96 return true;
97}
98#endif /* CONFIG_SCM_BLOCK_CLUSTER_WRITE */
84 99
85extern debug_info_t *scm_debug; 100extern debug_info_t *scm_debug;
86 101
diff --git a/drivers/s390/char/fs3270.c b/drivers/s390/char/fs3270.c
index 911704571b9c..230697aac94b 100644
--- a/drivers/s390/char/fs3270.c
+++ b/drivers/s390/char/fs3270.c
@@ -443,7 +443,7 @@ fs3270_open(struct inode *inode, struct file *filp)
443 tty_kref_put(tty); 443 tty_kref_put(tty);
444 return -ENODEV; 444 return -ENODEV;
445 } 445 }
446 minor = tty->index + RAW3270_FIRSTMINOR; 446 minor = tty->index;
447 tty_kref_put(tty); 447 tty_kref_put(tty);
448 } 448 }
449 mutex_lock(&fs3270_mutex); 449 mutex_lock(&fs3270_mutex);
@@ -524,6 +524,25 @@ static const struct file_operations fs3270_fops = {
524 .llseek = no_llseek, 524 .llseek = no_llseek,
525}; 525};
526 526
527void fs3270_create_cb(int minor)
528{
529 __register_chrdev(IBM_FS3270_MAJOR, minor, 1, "tub", &fs3270_fops);
530 device_create(class3270, NULL, MKDEV(IBM_FS3270_MAJOR, minor),
531 NULL, "3270/tub%d", minor);
532}
533
534void fs3270_destroy_cb(int minor)
535{
536 device_destroy(class3270, MKDEV(IBM_FS3270_MAJOR, minor));
537 __unregister_chrdev(IBM_FS3270_MAJOR, minor, 1, "tub");
538}
539
540struct raw3270_notifier fs3270_notifier =
541{
542 .create = fs3270_create_cb,
543 .destroy = fs3270_destroy_cb,
544};
545
527/* 546/*
528 * 3270 fullscreen driver initialization. 547 * 3270 fullscreen driver initialization.
529 */ 548 */
@@ -532,16 +551,20 @@ fs3270_init(void)
532{ 551{
533 int rc; 552 int rc;
534 553
535 rc = register_chrdev(IBM_FS3270_MAJOR, "fs3270", &fs3270_fops); 554 rc = __register_chrdev(IBM_FS3270_MAJOR, 0, 1, "fs3270", &fs3270_fops);
536 if (rc) 555 if (rc)
537 return rc; 556 return rc;
557 device_create(class3270, NULL, MKDEV(IBM_FS3270_MAJOR, 0),
558 NULL, "3270/tub");
559 raw3270_register_notifier(&fs3270_notifier);
538 return 0; 560 return 0;
539} 561}
540 562
541static void __exit 563static void __exit
542fs3270_exit(void) 564fs3270_exit(void)
543{ 565{
544 unregister_chrdev(IBM_FS3270_MAJOR, "fs3270"); 566 raw3270_unregister_notifier(&fs3270_notifier);
567 __unregister_chrdev(IBM_FS3270_MAJOR, 0, 1, "fs3270");
545} 568}
546 569
547MODULE_LICENSE("GPL"); 570MODULE_LICENSE("GPL");
diff --git a/drivers/s390/char/raw3270.c b/drivers/s390/char/raw3270.c
index 9a6c140c5f07..4c9030a5b9f2 100644
--- a/drivers/s390/char/raw3270.c
+++ b/drivers/s390/char/raw3270.c
@@ -28,7 +28,7 @@
28#include <linux/device.h> 28#include <linux/device.h>
29#include <linux/mutex.h> 29#include <linux/mutex.h>
30 30
31static struct class *class3270; 31struct class *class3270;
32 32
33/* The main 3270 data structure. */ 33/* The main 3270 data structure. */
34struct raw3270 { 34struct raw3270 {
@@ -37,6 +37,7 @@ struct raw3270 {
37 int minor; 37 int minor;
38 38
39 short model, rows, cols; 39 short model, rows, cols;
40 unsigned int state;
40 unsigned long flags; 41 unsigned long flags;
41 42
42 struct list_head req_queue; /* Request queue. */ 43 struct list_head req_queue; /* Request queue. */
@@ -46,20 +47,26 @@ struct raw3270 {
46 struct timer_list timer; /* Device timer. */ 47 struct timer_list timer; /* Device timer. */
47 48
48 unsigned char *ascebc; /* ascii -> ebcdic table */ 49 unsigned char *ascebc; /* ascii -> ebcdic table */
49 struct device *clttydev; /* 3270-class tty device ptr */
50 struct device *cltubdev; /* 3270-class tub device ptr */
51 50
52 struct raw3270_request init_request; 51 struct raw3270_view init_view;
52 struct raw3270_request init_reset;
53 struct raw3270_request init_readpart;
54 struct raw3270_request init_readmod;
53 unsigned char init_data[256]; 55 unsigned char init_data[256];
54}; 56};
55 57
58/* raw3270->state */
59#define RAW3270_STATE_INIT 0 /* Initial state */
60#define RAW3270_STATE_RESET 1 /* Reset command is pending */
61#define RAW3270_STATE_W4ATTN 2 /* Wait for attention interrupt */
62#define RAW3270_STATE_READMOD 3 /* Read partition is pending */
63#define RAW3270_STATE_READY 4 /* Device is usable by views */
64
56/* raw3270->flags */ 65/* raw3270->flags */
57#define RAW3270_FLAGS_14BITADDR 0 /* 14-bit buffer addresses */ 66#define RAW3270_FLAGS_14BITADDR 0 /* 14-bit buffer addresses */
58#define RAW3270_FLAGS_BUSY 1 /* Device busy, leave it alone */ 67#define RAW3270_FLAGS_BUSY 1 /* Device busy, leave it alone */
59#define RAW3270_FLAGS_ATTN 2 /* Device sent an ATTN interrupt */ 68#define RAW3270_FLAGS_CONSOLE 2 /* Device is the console. */
60#define RAW3270_FLAGS_READY 4 /* Device is useable by views */ 69#define RAW3270_FLAGS_FROZEN 3 /* set if 3270 is frozen for suspend */
61#define RAW3270_FLAGS_CONSOLE 8 /* Device is the console. */
62#define RAW3270_FLAGS_FROZEN 16 /* set if 3270 is frozen for suspend */
63 70
64/* Semaphore to protect global data of raw3270 (devices, views, etc). */ 71/* Semaphore to protect global data of raw3270 (devices, views, etc). */
65static DEFINE_MUTEX(raw3270_mutex); 72static DEFINE_MUTEX(raw3270_mutex);
@@ -97,6 +104,17 @@ static unsigned char raw3270_ebcgraf[64] = {
97 0xf8, 0xf9, 0x7a, 0x7b, 0x7c, 0x7d, 0x7e, 0x7f 104 0xf8, 0xf9, 0x7a, 0x7b, 0x7c, 0x7d, 0x7e, 0x7f
98}; 105};
99 106
107static inline int raw3270_state_ready(struct raw3270 *rp)
108{
109 return rp->state == RAW3270_STATE_READY;
110}
111
112static inline int raw3270_state_final(struct raw3270 *rp)
113{
114 return rp->state == RAW3270_STATE_INIT ||
115 rp->state == RAW3270_STATE_READY;
116}
117
100void 118void
101raw3270_buffer_address(struct raw3270 *rp, char *cp, unsigned short addr) 119raw3270_buffer_address(struct raw3270 *rp, char *cp, unsigned short addr)
102{ 120{
@@ -214,7 +232,7 @@ raw3270_request_set_idal(struct raw3270_request *rq, struct idal_buffer *ib)
214 * Stop running ccw. 232 * Stop running ccw.
215 */ 233 */
216static int 234static int
217raw3270_halt_io_nolock(struct raw3270 *rp, struct raw3270_request *rq) 235__raw3270_halt_io(struct raw3270 *rp, struct raw3270_request *rq)
218{ 236{
219 int retries; 237 int retries;
220 int rc; 238 int rc;
@@ -233,18 +251,6 @@ raw3270_halt_io_nolock(struct raw3270 *rp, struct raw3270_request *rq)
233 return rc; 251 return rc;
234} 252}
235 253
236static int
237raw3270_halt_io(struct raw3270 *rp, struct raw3270_request *rq)
238{
239 unsigned long flags;
240 int rc;
241
242 spin_lock_irqsave(get_ccwdev_lock(rp->cdev), flags);
243 rc = raw3270_halt_io_nolock(rp, rq);
244 spin_unlock_irqrestore(get_ccwdev_lock(rp->cdev), flags);
245 return rc;
246}
247
248/* 254/*
249 * Add the request to the request queue, try to start it if the 255 * Add the request to the request queue, try to start it if the
250 * 3270 device is idle. Return without waiting for end of i/o. 256 * 3270 device is idle. Return without waiting for end of i/o.
@@ -281,8 +287,8 @@ raw3270_start(struct raw3270_view *view, struct raw3270_request *rq)
281 if (!rp || rp->view != view || 287 if (!rp || rp->view != view ||
282 test_bit(RAW3270_FLAGS_FROZEN, &rp->flags)) 288 test_bit(RAW3270_FLAGS_FROZEN, &rp->flags))
283 rc = -EACCES; 289 rc = -EACCES;
284 else if (!test_bit(RAW3270_FLAGS_READY, &rp->flags)) 290 else if (!raw3270_state_ready(rp))
285 rc = -ENODEV; 291 rc = -EBUSY;
286 else 292 else
287 rc = __raw3270_start(rp, view, rq); 293 rc = __raw3270_start(rp, view, rq);
288 spin_unlock_irqrestore(get_ccwdev_lock(view->dev->cdev), flags); 294 spin_unlock_irqrestore(get_ccwdev_lock(view->dev->cdev), flags);
@@ -299,8 +305,8 @@ raw3270_start_locked(struct raw3270_view *view, struct raw3270_request *rq)
299 if (!rp || rp->view != view || 305 if (!rp || rp->view != view ||
300 test_bit(RAW3270_FLAGS_FROZEN, &rp->flags)) 306 test_bit(RAW3270_FLAGS_FROZEN, &rp->flags))
301 rc = -EACCES; 307 rc = -EACCES;
302 else if (!test_bit(RAW3270_FLAGS_READY, &rp->flags)) 308 else if (!raw3270_state_ready(rp))
303 rc = -ENODEV; 309 rc = -EBUSY;
304 else 310 else
305 rc = __raw3270_start(rp, view, rq); 311 rc = __raw3270_start(rp, view, rq);
306 return rc; 312 return rc;
@@ -378,7 +384,7 @@ raw3270_irq (struct ccw_device *cdev, unsigned long intparm, struct irb *irb)
378 case RAW3270_IO_STOP: 384 case RAW3270_IO_STOP:
379 if (!rq) 385 if (!rq)
380 break; 386 break;
381 raw3270_halt_io_nolock(rp, rq); 387 __raw3270_halt_io(rp, rq);
382 rq->rc = -EIO; 388 rq->rc = -EIO;
383 break; 389 break;
384 default: 390 default:
@@ -413,9 +419,14 @@ raw3270_irq (struct ccw_device *cdev, unsigned long intparm, struct irb *irb)
413} 419}
414 420
415/* 421/*
416 * Size sensing. 422 * To determine the size of the 3270 device we need to do:
423 * 1) send a 'read partition' data stream to the device
424 * 2) wait for the attn interrupt that precedes the query reply
425 * 3) do a read modified to get the query reply
426 * To make things worse we have to cope with intervention
427 * required (3270 device switched to 'stand-by') and command
428 * rejects (old devices that can't do 'read partition').
417 */ 429 */
418
419struct raw3270_ua { /* Query Reply structure for Usable Area */ 430struct raw3270_ua { /* Query Reply structure for Usable Area */
420 struct { /* Usable Area Query Reply Base */ 431 struct { /* Usable Area Query Reply Base */
421 short l; /* Length of this structured field */ 432 short l; /* Length of this structured field */
@@ -451,117 +462,21 @@ struct raw3270_ua { /* Query Reply structure for Usable Area */
451 } __attribute__ ((packed)) aua; 462 } __attribute__ ((packed)) aua;
452} __attribute__ ((packed)); 463} __attribute__ ((packed));
453 464
454static struct diag210 raw3270_init_diag210;
455static DEFINE_MUTEX(raw3270_init_mutex);
456
457static int
458raw3270_init_irq(struct raw3270_view *view, struct raw3270_request *rq,
459 struct irb *irb)
460{
461 /*
462 * Unit-Check Processing:
463 * Expect Command Reject or Intervention Required.
464 */
465 if (irb->scsw.cmd.dstat & DEV_STAT_UNIT_CHECK) {
466 /* Request finished abnormally. */
467 if (irb->ecw[0] & SNS0_INTERVENTION_REQ) {
468 set_bit(RAW3270_FLAGS_BUSY, &view->dev->flags);
469 return RAW3270_IO_BUSY;
470 }
471 }
472 if (rq) {
473 if (irb->scsw.cmd.dstat & DEV_STAT_UNIT_CHECK) {
474 if (irb->ecw[0] & SNS0_CMD_REJECT)
475 rq->rc = -EOPNOTSUPP;
476 else
477 rq->rc = -EIO;
478 } else
479 /* Request finished normally. Copy residual count. */
480 rq->rescnt = irb->scsw.cmd.count;
481 }
482 if (irb->scsw.cmd.dstat & DEV_STAT_ATTENTION) {
483 set_bit(RAW3270_FLAGS_ATTN, &view->dev->flags);
484 wake_up(&raw3270_wait_queue);
485 }
486 return RAW3270_IO_DONE;
487}
488
489static struct raw3270_fn raw3270_init_fn = {
490 .intv = raw3270_init_irq
491};
492
493static struct raw3270_view raw3270_init_view = {
494 .fn = &raw3270_init_fn
495};
496
497/*
498 * raw3270_wait/raw3270_wait_interruptible/__raw3270_wakeup
499 * Wait for end of request. The request must have been started
500 * with raw3270_start, rc = 0. The device lock may NOT have been
501 * released between calling raw3270_start and raw3270_wait.
502 */
503static void 465static void
504raw3270_wake_init(struct raw3270_request *rq, void *data) 466raw3270_size_device_vm(struct raw3270 *rp)
505{
506 wake_up((wait_queue_head_t *) data);
507}
508
509/*
510 * Special wait function that can cope with console initialization.
511 */
512static int
513raw3270_start_init(struct raw3270 *rp, struct raw3270_view *view,
514 struct raw3270_request *rq)
515{
516 unsigned long flags;
517 int rc;
518
519#ifdef CONFIG_TN3270_CONSOLE
520 if (raw3270_registered == 0) {
521 spin_lock_irqsave(get_ccwdev_lock(view->dev->cdev), flags);
522 rq->callback = NULL;
523 rc = __raw3270_start(rp, view, rq);
524 if (rc == 0)
525 while (!raw3270_request_final(rq)) {
526 wait_cons_dev();
527 barrier();
528 }
529 spin_unlock_irqrestore(get_ccwdev_lock(view->dev->cdev), flags);
530 return rq->rc;
531 }
532#endif
533 rq->callback = raw3270_wake_init;
534 rq->callback_data = &raw3270_wait_queue;
535 spin_lock_irqsave(get_ccwdev_lock(view->dev->cdev), flags);
536 rc = __raw3270_start(rp, view, rq);
537 spin_unlock_irqrestore(get_ccwdev_lock(view->dev->cdev), flags);
538 if (rc)
539 return rc;
540 /* Now wait for the completion. */
541 rc = wait_event_interruptible(raw3270_wait_queue,
542 raw3270_request_final(rq));
543 if (rc == -ERESTARTSYS) { /* Interrupted by a signal. */
544 raw3270_halt_io(view->dev, rq);
545 /* No wait for the halt to complete. */
546 wait_event(raw3270_wait_queue, raw3270_request_final(rq));
547 return -ERESTARTSYS;
548 }
549 return rq->rc;
550}
551
552static int
553__raw3270_size_device_vm(struct raw3270 *rp)
554{ 467{
555 int rc, model; 468 int rc, model;
556 struct ccw_dev_id dev_id; 469 struct ccw_dev_id dev_id;
470 struct diag210 diag_data;
557 471
558 ccw_device_get_id(rp->cdev, &dev_id); 472 ccw_device_get_id(rp->cdev, &dev_id);
559 raw3270_init_diag210.vrdcdvno = dev_id.devno; 473 diag_data.vrdcdvno = dev_id.devno;
560 raw3270_init_diag210.vrdclen = sizeof(struct diag210); 474 diag_data.vrdclen = sizeof(struct diag210);
561 rc = diag210(&raw3270_init_diag210); 475 rc = diag210(&diag_data);
562 if (rc) 476 model = diag_data.vrdccrmd;
563 return rc; 477 /* Use default model 2 if the size could not be detected */
564 model = raw3270_init_diag210.vrdccrmd; 478 if (rc || model < 2 || model > 5)
479 model = 2;
565 switch (model) { 480 switch (model) {
566 case 2: 481 case 2:
567 rp->model = model; 482 rp->model = model;
@@ -583,77 +498,25 @@ __raw3270_size_device_vm(struct raw3270 *rp)
583 rp->rows = 27; 498 rp->rows = 27;
584 rp->cols = 132; 499 rp->cols = 132;
585 break; 500 break;
586 default:
587 rc = -EOPNOTSUPP;
588 break;
589 } 501 }
590 return rc;
591} 502}
592 503
593static int 504static void
594__raw3270_size_device(struct raw3270 *rp) 505raw3270_size_device(struct raw3270 *rp)
595{ 506{
596 static const unsigned char wbuf[] =
597 { 0x00, 0x07, 0x01, 0xff, 0x03, 0x00, 0x81 };
598 struct raw3270_ua *uap; 507 struct raw3270_ua *uap;
599 int rc;
600 508
601 /*
602 * To determine the size of the 3270 device we need to do:
603 * 1) send a 'read partition' data stream to the device
604 * 2) wait for the attn interrupt that precedes the query reply
605 * 3) do a read modified to get the query reply
606 * To make things worse we have to cope with intervention
607 * required (3270 device switched to 'stand-by') and command
608 * rejects (old devices that can't do 'read partition').
609 */
610 memset(&rp->init_request, 0, sizeof(rp->init_request));
611 memset(&rp->init_data, 0, 256);
612 /* Store 'read partition' data stream to init_data */
613 memcpy(&rp->init_data, wbuf, sizeof(wbuf));
614 INIT_LIST_HEAD(&rp->init_request.list);
615 rp->init_request.ccw.cmd_code = TC_WRITESF;
616 rp->init_request.ccw.flags = CCW_FLAG_SLI;
617 rp->init_request.ccw.count = sizeof(wbuf);
618 rp->init_request.ccw.cda = (__u32) __pa(&rp->init_data);
619
620 rc = raw3270_start_init(rp, &raw3270_init_view, &rp->init_request);
621 if (rc)
622 /* Check error cases: -ERESTARTSYS, -EIO and -EOPNOTSUPP */
623 return rc;
624
625 /* Wait for attention interrupt. */
626#ifdef CONFIG_TN3270_CONSOLE
627 if (raw3270_registered == 0) {
628 unsigned long flags;
629
630 spin_lock_irqsave(get_ccwdev_lock(rp->cdev), flags);
631 while (!test_and_clear_bit(RAW3270_FLAGS_ATTN, &rp->flags))
632 wait_cons_dev();
633 spin_unlock_irqrestore(get_ccwdev_lock(rp->cdev), flags);
634 } else
635#endif
636 rc = wait_event_interruptible(raw3270_wait_queue,
637 test_and_clear_bit(RAW3270_FLAGS_ATTN, &rp->flags));
638 if (rc)
639 return rc;
640
641 /*
642 * The device accepted the 'read partition' command. Now
643 * set up a read ccw and issue it.
644 */
645 rp->init_request.ccw.cmd_code = TC_READMOD;
646 rp->init_request.ccw.flags = CCW_FLAG_SLI;
647 rp->init_request.ccw.count = sizeof(rp->init_data);
648 rp->init_request.ccw.cda = (__u32) __pa(rp->init_data);
649 rc = raw3270_start_init(rp, &raw3270_init_view, &rp->init_request);
650 if (rc)
651 return rc;
652 /* Got a Query Reply */ 509 /* Got a Query Reply */
653 uap = (struct raw3270_ua *) (rp->init_data + 1); 510 uap = (struct raw3270_ua *) (rp->init_data + 1);
654 /* Paranoia check. */ 511 /* Paranoia check. */
655 if (rp->init_data[0] != 0x88 || uap->uab.qcode != 0x81) 512 if (rp->init_readmod.rc || rp->init_data[0] != 0x88 ||
656 return -EOPNOTSUPP; 513 uap->uab.qcode != 0x81) {
514 /* Couldn't detect size. Use default model 2. */
515 rp->model = 2;
516 rp->rows = 24;
517 rp->cols = 80;
518 return;
519 }
657 /* Copy rows/columns of default Usable Area */ 520 /* Copy rows/columns of default Usable Area */
658 rp->rows = uap->uab.h; 521 rp->rows = uap->uab.h;
659 rp->cols = uap->uab.w; 522 rp->cols = uap->uab.w;
@@ -666,66 +529,131 @@ __raw3270_size_device(struct raw3270 *rp)
666 rp->rows = uap->aua.hauai; 529 rp->rows = uap->aua.hauai;
667 rp->cols = uap->aua.wauai; 530 rp->cols = uap->aua.wauai;
668 } 531 }
669 return 0; 532 /* Try to find a model. */
533 rp->model = 0;
534 if (rp->rows == 24 && rp->cols == 80)
535 rp->model = 2;
536 if (rp->rows == 32 && rp->cols == 80)
537 rp->model = 3;
538 if (rp->rows == 43 && rp->cols == 80)
539 rp->model = 4;
540 if (rp->rows == 27 && rp->cols == 132)
541 rp->model = 5;
670} 542}
671 543
672static int 544static void
673raw3270_size_device(struct raw3270 *rp) 545raw3270_size_device_done(struct raw3270 *rp)
674{ 546{
675 int rc; 547 struct raw3270_view *view;
676 548
677 mutex_lock(&raw3270_init_mutex);
678 rp->view = &raw3270_init_view;
679 raw3270_init_view.dev = rp;
680 if (MACHINE_IS_VM)
681 rc = __raw3270_size_device_vm(rp);
682 else
683 rc = __raw3270_size_device(rp);
684 raw3270_init_view.dev = NULL;
685 rp->view = NULL; 549 rp->view = NULL;
686 mutex_unlock(&raw3270_init_mutex); 550 rp->state = RAW3270_STATE_READY;
687 if (rc == 0) { /* Found something. */ 551 /* Notify views about new size */
688 /* Try to find a model. */ 552 list_for_each_entry(view, &rp->view_list, list)
689 rp->model = 0; 553 if (view->fn->resize)
690 if (rp->rows == 24 && rp->cols == 80) 554 view->fn->resize(view, rp->model, rp->rows, rp->cols);
691 rp->model = 2; 555 /* Setup processing done, now activate a view */
692 if (rp->rows == 32 && rp->cols == 80) 556 list_for_each_entry(view, &rp->view_list, list) {
693 rp->model = 3; 557 rp->view = view;
694 if (rp->rows == 43 && rp->cols == 80) 558 if (view->fn->activate(view) == 0)
695 rp->model = 4; 559 break;
696 if (rp->rows == 27 && rp->cols == 132) 560 rp->view = NULL;
697 rp->model = 5;
698 } else {
699 /* Couldn't detect size. Use default model 2. */
700 rp->model = 2;
701 rp->rows = 24;
702 rp->cols = 80;
703 return 0;
704 } 561 }
705 return rc; 562}
563
564static void
565raw3270_read_modified_cb(struct raw3270_request *rq, void *data)
566{
567 struct raw3270 *rp = rq->view->dev;
568
569 raw3270_size_device(rp);
570 raw3270_size_device_done(rp);
571}
572
573static void
574raw3270_read_modified(struct raw3270 *rp)
575{
576 if (rp->state != RAW3270_STATE_W4ATTN)
577 return;
578 /* Use 'read modified' to get the result of a read partition. */
579 memset(&rp->init_readmod, 0, sizeof(rp->init_readmod));
580 memset(&rp->init_data, 0, sizeof(rp->init_data));
581 rp->init_readmod.ccw.cmd_code = TC_READMOD;
582 rp->init_readmod.ccw.flags = CCW_FLAG_SLI;
583 rp->init_readmod.ccw.count = sizeof(rp->init_data);
584 rp->init_readmod.ccw.cda = (__u32) __pa(rp->init_data);
585 rp->init_readmod.callback = raw3270_read_modified_cb;
586 rp->state = RAW3270_STATE_READMOD;
587 raw3270_start_irq(&rp->init_view, &rp->init_readmod);
588}
589
590static void
591raw3270_writesf_readpart(struct raw3270 *rp)
592{
593 static const unsigned char wbuf[] =
594 { 0x00, 0x07, 0x01, 0xff, 0x03, 0x00, 0x81 };
595
596 /* Store 'read partition' data stream to init_data */
597 memset(&rp->init_readpart, 0, sizeof(rp->init_readpart));
598 memset(&rp->init_data, 0, sizeof(rp->init_data));
599 memcpy(&rp->init_data, wbuf, sizeof(wbuf));
600 rp->init_readpart.ccw.cmd_code = TC_WRITESF;
601 rp->init_readpart.ccw.flags = CCW_FLAG_SLI;
602 rp->init_readpart.ccw.count = sizeof(wbuf);
603 rp->init_readpart.ccw.cda = (__u32) __pa(&rp->init_data);
604 rp->state = RAW3270_STATE_W4ATTN;
605 raw3270_start_irq(&rp->init_view, &rp->init_readpart);
606}
607
608/*
609 * Device reset
610 */
611static void
612raw3270_reset_device_cb(struct raw3270_request *rq, void *data)
613{
614 struct raw3270 *rp = rq->view->dev;
615
616 if (rp->state != RAW3270_STATE_RESET)
617 return;
618 if (rq && rq->rc) {
619 /* Reset command failed. */
620 rp->state = RAW3270_STATE_INIT;
621 } else if (0 && MACHINE_IS_VM) {
622 raw3270_size_device_vm(rp);
623 raw3270_size_device_done(rp);
624 } else
625 raw3270_writesf_readpart(rp);
706} 626}
707 627
708static int 628static int
709raw3270_reset_device(struct raw3270 *rp) 629__raw3270_reset_device(struct raw3270 *rp)
710{ 630{
711 int rc; 631 int rc;
712 632
713 mutex_lock(&raw3270_init_mutex); 633 /* Store reset data stream to init_data/init_reset */
714 memset(&rp->init_request, 0, sizeof(rp->init_request)); 634 memset(&rp->init_reset, 0, sizeof(rp->init_reset));
715 memset(&rp->init_data, 0, sizeof(rp->init_data)); 635 memset(&rp->init_data, 0, sizeof(rp->init_data));
716 /* Store reset data stream to init_data/init_request */
717 rp->init_data[0] = TW_KR; 636 rp->init_data[0] = TW_KR;
718 INIT_LIST_HEAD(&rp->init_request.list); 637 rp->init_reset.ccw.cmd_code = TC_EWRITEA;
719 rp->init_request.ccw.cmd_code = TC_EWRITEA; 638 rp->init_reset.ccw.flags = CCW_FLAG_SLI;
720 rp->init_request.ccw.flags = CCW_FLAG_SLI; 639 rp->init_reset.ccw.count = 1;
721 rp->init_request.ccw.count = 1; 640 rp->init_reset.ccw.cda = (__u32) __pa(rp->init_data);
722 rp->init_request.ccw.cda = (__u32) __pa(rp->init_data); 641 rp->init_reset.callback = raw3270_reset_device_cb;
723 rp->view = &raw3270_init_view; 642 rc = __raw3270_start(rp, &rp->init_view, &rp->init_reset);
724 raw3270_init_view.dev = rp; 643 if (rc == 0 && rp->state == RAW3270_STATE_INIT)
725 rc = raw3270_start_init(rp, &raw3270_init_view, &rp->init_request); 644 rp->state = RAW3270_STATE_RESET;
726 raw3270_init_view.dev = NULL; 645 return rc;
727 rp->view = NULL; 646}
728 mutex_unlock(&raw3270_init_mutex); 647
648static int
649raw3270_reset_device(struct raw3270 *rp)
650{
651 unsigned long flags;
652 int rc;
653
654 spin_lock_irqsave(get_ccwdev_lock(rp->cdev), flags);
655 rc = __raw3270_reset_device(rp);
656 spin_unlock_irqrestore(get_ccwdev_lock(rp->cdev), flags);
729 return rc; 657 return rc;
730} 658}
731 659
@@ -739,13 +667,50 @@ raw3270_reset(struct raw3270_view *view)
739 if (!rp || rp->view != view || 667 if (!rp || rp->view != view ||
740 test_bit(RAW3270_FLAGS_FROZEN, &rp->flags)) 668 test_bit(RAW3270_FLAGS_FROZEN, &rp->flags))
741 rc = -EACCES; 669 rc = -EACCES;
742 else if (!test_bit(RAW3270_FLAGS_READY, &rp->flags)) 670 else if (!raw3270_state_ready(rp))
743 rc = -ENODEV; 671 rc = -EBUSY;
744 else 672 else
745 rc = raw3270_reset_device(view->dev); 673 rc = raw3270_reset_device(view->dev);
746 return rc; 674 return rc;
747} 675}
748 676
677static int
678raw3270_init_irq(struct raw3270_view *view, struct raw3270_request *rq,
679 struct irb *irb)
680{
681 struct raw3270 *rp;
682
683 /*
684 * Unit-Check Processing:
685 * Expect Command Reject or Intervention Required.
686 */
687 if (irb->scsw.cmd.dstat & DEV_STAT_UNIT_CHECK) {
688 /* Request finished abnormally. */
689 if (irb->ecw[0] & SNS0_INTERVENTION_REQ) {
690 set_bit(RAW3270_FLAGS_BUSY, &view->dev->flags);
691 return RAW3270_IO_BUSY;
692 }
693 }
694 if (rq) {
695 if (irb->scsw.cmd.dstat & DEV_STAT_UNIT_CHECK) {
696 if (irb->ecw[0] & SNS0_CMD_REJECT)
697 rq->rc = -EOPNOTSUPP;
698 else
699 rq->rc = -EIO;
700 }
701 }
702 if (irb->scsw.cmd.dstat & DEV_STAT_ATTENTION) {
703 /* Queue read modified after attention interrupt */
704 rp = view->dev;
705 raw3270_read_modified(rp);
706 }
707 return RAW3270_IO_DONE;
708}
709
710static struct raw3270_fn raw3270_init_fn = {
711 .intv = raw3270_init_irq
712};
713
749/* 714/*
750 * Setup new 3270 device. 715 * Setup new 3270 device.
751 */ 716 */
@@ -774,6 +739,10 @@ raw3270_setup_device(struct ccw_device *cdev, struct raw3270 *rp, char *ascebc)
774 INIT_LIST_HEAD(&rp->req_queue); 739 INIT_LIST_HEAD(&rp->req_queue);
775 INIT_LIST_HEAD(&rp->view_list); 740 INIT_LIST_HEAD(&rp->view_list);
776 741
742 rp->init_view.dev = rp;
743 rp->init_view.fn = &raw3270_init_fn;
744 rp->view = &rp->init_view;
745
777 /* 746 /*
778 * Add device to list and find the smallest unused minor 747 * Add device to list and find the smallest unused minor
779 * number for it. Note: there is no device with minor 0, 748 * number for it. Note: there is no device with minor 0,
@@ -812,6 +781,7 @@ raw3270_setup_device(struct ccw_device *cdev, struct raw3270 *rp, char *ascebc)
812 */ 781 */
813struct raw3270 __init *raw3270_setup_console(struct ccw_device *cdev) 782struct raw3270 __init *raw3270_setup_console(struct ccw_device *cdev)
814{ 783{
784 unsigned long flags;
815 struct raw3270 *rp; 785 struct raw3270 *rp;
816 char *ascebc; 786 char *ascebc;
817 int rc; 787 int rc;
@@ -822,16 +792,15 @@ struct raw3270 __init *raw3270_setup_console(struct ccw_device *cdev)
822 if (rc) 792 if (rc)
823 return ERR_PTR(rc); 793 return ERR_PTR(rc);
824 set_bit(RAW3270_FLAGS_CONSOLE, &rp->flags); 794 set_bit(RAW3270_FLAGS_CONSOLE, &rp->flags);
825 rc = raw3270_reset_device(rp); 795 spin_lock_irqsave(get_ccwdev_lock(rp->cdev), flags);
826 if (rc) 796 do {
827 return ERR_PTR(rc); 797 __raw3270_reset_device(rp);
828 rc = raw3270_size_device(rp); 798 while (!raw3270_state_final(rp)) {
829 if (rc) 799 wait_cons_dev();
830 return ERR_PTR(rc); 800 barrier();
831 rc = raw3270_reset_device(rp); 801 }
832 if (rc) 802 } while (rp->state != RAW3270_STATE_READY);
833 return ERR_PTR(rc); 803 spin_unlock_irqrestore(get_ccwdev_lock(rp->cdev), flags);
834 set_bit(RAW3270_FLAGS_READY, &rp->flags);
835 return rp; 804 return rp;
836} 805}
837 806
@@ -893,13 +862,13 @@ raw3270_activate_view(struct raw3270_view *view)
893 spin_lock_irqsave(get_ccwdev_lock(rp->cdev), flags); 862 spin_lock_irqsave(get_ccwdev_lock(rp->cdev), flags);
894 if (rp->view == view) 863 if (rp->view == view)
895 rc = 0; 864 rc = 0;
896 else if (!test_bit(RAW3270_FLAGS_READY, &rp->flags)) 865 else if (!raw3270_state_ready(rp))
897 rc = -ENODEV; 866 rc = -EBUSY;
898 else if (test_bit(RAW3270_FLAGS_FROZEN, &rp->flags)) 867 else if (test_bit(RAW3270_FLAGS_FROZEN, &rp->flags))
899 rc = -EACCES; 868 rc = -EACCES;
900 else { 869 else {
901 oldview = NULL; 870 oldview = NULL;
902 if (rp->view) { 871 if (rp->view && rp->view->fn->deactivate) {
903 oldview = rp->view; 872 oldview = rp->view;
904 oldview->fn->deactivate(oldview); 873 oldview->fn->deactivate(oldview);
905 } 874 }
@@ -944,7 +913,7 @@ raw3270_deactivate_view(struct raw3270_view *view)
944 list_del_init(&view->list); 913 list_del_init(&view->list);
945 list_add_tail(&view->list, &rp->view_list); 914 list_add_tail(&view->list, &rp->view_list);
946 /* Try to activate another view. */ 915 /* Try to activate another view. */
947 if (test_bit(RAW3270_FLAGS_READY, &rp->flags) && 916 if (raw3270_state_ready(rp) &&
948 !test_bit(RAW3270_FLAGS_FROZEN, &rp->flags)) { 917 !test_bit(RAW3270_FLAGS_FROZEN, &rp->flags)) {
949 list_for_each_entry(view, &rp->view_list, list) { 918 list_for_each_entry(view, &rp->view_list, list) {
950 rp->view = view; 919 rp->view = view;
@@ -975,18 +944,16 @@ raw3270_add_view(struct raw3270_view *view, struct raw3270_fn *fn, int minor)
975 if (rp->minor != minor) 944 if (rp->minor != minor)
976 continue; 945 continue;
977 spin_lock_irqsave(get_ccwdev_lock(rp->cdev), flags); 946 spin_lock_irqsave(get_ccwdev_lock(rp->cdev), flags);
978 if (test_bit(RAW3270_FLAGS_READY, &rp->flags)) { 947 atomic_set(&view->ref_count, 2);
979 atomic_set(&view->ref_count, 2); 948 view->dev = rp;
980 view->dev = rp; 949 view->fn = fn;
981 view->fn = fn; 950 view->model = rp->model;
982 view->model = rp->model; 951 view->rows = rp->rows;
983 view->rows = rp->rows; 952 view->cols = rp->cols;
984 view->cols = rp->cols; 953 view->ascebc = rp->ascebc;
985 view->ascebc = rp->ascebc; 954 spin_lock_init(&view->lock);
986 spin_lock_init(&view->lock); 955 list_add(&view->list, &rp->view_list);
987 list_add(&view->list, &rp->view_list); 956 rc = 0;
988 rc = 0;
989 }
990 spin_unlock_irqrestore(get_ccwdev_lock(rp->cdev), flags); 957 spin_unlock_irqrestore(get_ccwdev_lock(rp->cdev), flags);
991 break; 958 break;
992 } 959 }
@@ -1010,14 +977,11 @@ raw3270_find_view(struct raw3270_fn *fn, int minor)
1010 if (rp->minor != minor) 977 if (rp->minor != minor)
1011 continue; 978 continue;
1012 spin_lock_irqsave(get_ccwdev_lock(rp->cdev), flags); 979 spin_lock_irqsave(get_ccwdev_lock(rp->cdev), flags);
1013 if (test_bit(RAW3270_FLAGS_READY, &rp->flags)) { 980 list_for_each_entry(tmp, &rp->view_list, list) {
1014 view = ERR_PTR(-ENOENT); 981 if (tmp->fn == fn) {
1015 list_for_each_entry(tmp, &rp->view_list, list) { 982 raw3270_get_view(tmp);
1016 if (tmp->fn == fn) { 983 view = tmp;
1017 raw3270_get_view(tmp); 984 break;
1018 view = tmp;
1019 break;
1020 }
1021 } 985 }
1022 } 986 }
1023 spin_unlock_irqrestore(get_ccwdev_lock(rp->cdev), flags); 987 spin_unlock_irqrestore(get_ccwdev_lock(rp->cdev), flags);
@@ -1044,7 +1008,7 @@ raw3270_del_view(struct raw3270_view *view)
1044 rp->view = NULL; 1008 rp->view = NULL;
1045 } 1009 }
1046 list_del_init(&view->list); 1010 list_del_init(&view->list);
1047 if (!rp->view && test_bit(RAW3270_FLAGS_READY, &rp->flags) && 1011 if (!rp->view && raw3270_state_ready(rp) &&
1048 !test_bit(RAW3270_FLAGS_FROZEN, &rp->flags)) { 1012 !test_bit(RAW3270_FLAGS_FROZEN, &rp->flags)) {
1049 /* Try to activate another view. */ 1013 /* Try to activate another view. */
1050 list_for_each_entry(nv, &rp->view_list, list) { 1014 list_for_each_entry(nv, &rp->view_list, list) {
@@ -1072,10 +1036,6 @@ raw3270_delete_device(struct raw3270 *rp)
1072 1036
1073 /* Remove from device chain. */ 1037 /* Remove from device chain. */
1074 mutex_lock(&raw3270_mutex); 1038 mutex_lock(&raw3270_mutex);
1075 if (rp->clttydev && !IS_ERR(rp->clttydev))
1076 device_destroy(class3270, MKDEV(IBM_TTY3270_MAJOR, rp->minor));
1077 if (rp->cltubdev && !IS_ERR(rp->cltubdev))
1078 device_destroy(class3270, MKDEV(IBM_FS3270_MAJOR, rp->minor));
1079 list_del_init(&rp->list); 1039 list_del_init(&rp->list);
1080 mutex_unlock(&raw3270_mutex); 1040 mutex_unlock(&raw3270_mutex);
1081 1041
@@ -1139,75 +1099,34 @@ static struct attribute_group raw3270_attr_group = {
1139 1099
1140static int raw3270_create_attributes(struct raw3270 *rp) 1100static int raw3270_create_attributes(struct raw3270 *rp)
1141{ 1101{
1142 int rc; 1102 return sysfs_create_group(&rp->cdev->dev.kobj, &raw3270_attr_group);
1143
1144 rc = sysfs_create_group(&rp->cdev->dev.kobj, &raw3270_attr_group);
1145 if (rc)
1146 goto out;
1147
1148 rp->clttydev = device_create(class3270, &rp->cdev->dev,
1149 MKDEV(IBM_TTY3270_MAJOR, rp->minor), NULL,
1150 "tty%s", dev_name(&rp->cdev->dev));
1151 if (IS_ERR(rp->clttydev)) {
1152 rc = PTR_ERR(rp->clttydev);
1153 goto out_ttydev;
1154 }
1155
1156 rp->cltubdev = device_create(class3270, &rp->cdev->dev,
1157 MKDEV(IBM_FS3270_MAJOR, rp->minor), NULL,
1158 "tub%s", dev_name(&rp->cdev->dev));
1159 if (!IS_ERR(rp->cltubdev))
1160 goto out;
1161
1162 rc = PTR_ERR(rp->cltubdev);
1163 device_destroy(class3270, MKDEV(IBM_TTY3270_MAJOR, rp->minor));
1164
1165out_ttydev:
1166 sysfs_remove_group(&rp->cdev->dev.kobj, &raw3270_attr_group);
1167out:
1168 return rc;
1169} 1103}
1170 1104
1171/* 1105/*
1172 * Notifier for device addition/removal 1106 * Notifier for device addition/removal
1173 */ 1107 */
1174struct raw3270_notifier {
1175 struct list_head list;
1176 void (*notifier)(int, int);
1177};
1178
1179static LIST_HEAD(raw3270_notifier); 1108static LIST_HEAD(raw3270_notifier);
1180 1109
1181int raw3270_register_notifier(void (*notifier)(int, int)) 1110int raw3270_register_notifier(struct raw3270_notifier *notifier)
1182{ 1111{
1183 struct raw3270_notifier *np;
1184 struct raw3270 *rp; 1112 struct raw3270 *rp;
1185 1113
1186 np = kmalloc(sizeof(struct raw3270_notifier), GFP_KERNEL);
1187 if (!np)
1188 return -ENOMEM;
1189 np->notifier = notifier;
1190 mutex_lock(&raw3270_mutex); 1114 mutex_lock(&raw3270_mutex);
1191 list_add_tail(&np->list, &raw3270_notifier); 1115 list_add_tail(&notifier->list, &raw3270_notifier);
1192 list_for_each_entry(rp, &raw3270_devices, list) { 1116 list_for_each_entry(rp, &raw3270_devices, list)
1193 get_device(&rp->cdev->dev); 1117 notifier->create(rp->minor);
1194 notifier(rp->minor, 1);
1195 }
1196 mutex_unlock(&raw3270_mutex); 1118 mutex_unlock(&raw3270_mutex);
1197 return 0; 1119 return 0;
1198} 1120}
1199 1121
1200void raw3270_unregister_notifier(void (*notifier)(int, int)) 1122void raw3270_unregister_notifier(struct raw3270_notifier *notifier)
1201{ 1123{
1202 struct raw3270_notifier *np; 1124 struct raw3270 *rp;
1203 1125
1204 mutex_lock(&raw3270_mutex); 1126 mutex_lock(&raw3270_mutex);
1205 list_for_each_entry(np, &raw3270_notifier, list) 1127 list_for_each_entry(rp, &raw3270_devices, list)
1206 if (np->notifier == notifier) { 1128 notifier->destroy(rp->minor);
1207 list_del(&np->list); 1129 list_del(&notifier->list);
1208 kfree(np);
1209 break;
1210 }
1211 mutex_unlock(&raw3270_mutex); 1130 mutex_unlock(&raw3270_mutex);
1212} 1131}
1213 1132
@@ -1217,29 +1136,20 @@ void raw3270_unregister_notifier(void (*notifier)(int, int))
1217static int 1136static int
1218raw3270_set_online (struct ccw_device *cdev) 1137raw3270_set_online (struct ccw_device *cdev)
1219{ 1138{
1220 struct raw3270 *rp;
1221 struct raw3270_notifier *np; 1139 struct raw3270_notifier *np;
1140 struct raw3270 *rp;
1222 int rc; 1141 int rc;
1223 1142
1224 rp = raw3270_create_device(cdev); 1143 rp = raw3270_create_device(cdev);
1225 if (IS_ERR(rp)) 1144 if (IS_ERR(rp))
1226 return PTR_ERR(rp); 1145 return PTR_ERR(rp);
1227 rc = raw3270_reset_device(rp);
1228 if (rc)
1229 goto failure;
1230 rc = raw3270_size_device(rp);
1231 if (rc)
1232 goto failure;
1233 rc = raw3270_reset_device(rp);
1234 if (rc)
1235 goto failure;
1236 rc = raw3270_create_attributes(rp); 1146 rc = raw3270_create_attributes(rp);
1237 if (rc) 1147 if (rc)
1238 goto failure; 1148 goto failure;
1239 set_bit(RAW3270_FLAGS_READY, &rp->flags); 1149 raw3270_reset_device(rp);
1240 mutex_lock(&raw3270_mutex); 1150 mutex_lock(&raw3270_mutex);
1241 list_for_each_entry(np, &raw3270_notifier, list) 1151 list_for_each_entry(np, &raw3270_notifier, list)
1242 np->notifier(rp->minor, 1); 1152 np->create(rp->minor);
1243 mutex_unlock(&raw3270_mutex); 1153 mutex_unlock(&raw3270_mutex);
1244 return 0; 1154 return 0;
1245 1155
@@ -1268,14 +1178,14 @@ raw3270_remove (struct ccw_device *cdev)
1268 */ 1178 */
1269 if (rp == NULL) 1179 if (rp == NULL)
1270 return; 1180 return;
1271 clear_bit(RAW3270_FLAGS_READY, &rp->flags);
1272 1181
1273 sysfs_remove_group(&cdev->dev.kobj, &raw3270_attr_group); 1182 sysfs_remove_group(&cdev->dev.kobj, &raw3270_attr_group);
1274 1183
1275 /* Deactivate current view and remove all views. */ 1184 /* Deactivate current view and remove all views. */
1276 spin_lock_irqsave(get_ccwdev_lock(cdev), flags); 1185 spin_lock_irqsave(get_ccwdev_lock(cdev), flags);
1277 if (rp->view) { 1186 if (rp->view) {
1278 rp->view->fn->deactivate(rp->view); 1187 if (rp->view->fn->deactivate)
1188 rp->view->fn->deactivate(rp->view);
1279 rp->view = NULL; 1189 rp->view = NULL;
1280 } 1190 }
1281 while (!list_empty(&rp->view_list)) { 1191 while (!list_empty(&rp->view_list)) {
@@ -1290,7 +1200,7 @@ raw3270_remove (struct ccw_device *cdev)
1290 1200
1291 mutex_lock(&raw3270_mutex); 1201 mutex_lock(&raw3270_mutex);
1292 list_for_each_entry(np, &raw3270_notifier, list) 1202 list_for_each_entry(np, &raw3270_notifier, list)
1293 np->notifier(rp->minor, 0); 1203 np->destroy(rp->minor);
1294 mutex_unlock(&raw3270_mutex); 1204 mutex_unlock(&raw3270_mutex);
1295 1205
1296 /* Reset 3270 device. */ 1206 /* Reset 3270 device. */
@@ -1324,7 +1234,7 @@ static int raw3270_pm_stop(struct ccw_device *cdev)
1324 if (!rp) 1234 if (!rp)
1325 return 0; 1235 return 0;
1326 spin_lock_irqsave(get_ccwdev_lock(rp->cdev), flags); 1236 spin_lock_irqsave(get_ccwdev_lock(rp->cdev), flags);
1327 if (rp->view) 1237 if (rp->view && rp->view->fn->deactivate)
1328 rp->view->fn->deactivate(rp->view); 1238 rp->view->fn->deactivate(rp->view);
1329 if (!test_bit(RAW3270_FLAGS_CONSOLE, &rp->flags)) { 1239 if (!test_bit(RAW3270_FLAGS_CONSOLE, &rp->flags)) {
1330 /* 1240 /*
@@ -1351,7 +1261,7 @@ static int raw3270_pm_start(struct ccw_device *cdev)
1351 return 0; 1261 return 0;
1352 spin_lock_irqsave(get_ccwdev_lock(rp->cdev), flags); 1262 spin_lock_irqsave(get_ccwdev_lock(rp->cdev), flags);
1353 clear_bit(RAW3270_FLAGS_FROZEN, &rp->flags); 1263 clear_bit(RAW3270_FLAGS_FROZEN, &rp->flags);
1354 if (rp->view) 1264 if (rp->view && rp->view->fn->activate)
1355 rp->view->fn->activate(rp->view); 1265 rp->view->fn->activate(rp->view);
1356 spin_unlock_irqrestore(get_ccwdev_lock(rp->cdev), flags); 1266 spin_unlock_irqrestore(get_ccwdev_lock(rp->cdev), flags);
1357 return 0; 1267 return 0;
@@ -1434,6 +1344,7 @@ MODULE_LICENSE("GPL");
1434module_init(raw3270_init); 1344module_init(raw3270_init);
1435module_exit(raw3270_exit); 1345module_exit(raw3270_exit);
1436 1346
1347EXPORT_SYMBOL(class3270);
1437EXPORT_SYMBOL(raw3270_request_alloc); 1348EXPORT_SYMBOL(raw3270_request_alloc);
1438EXPORT_SYMBOL(raw3270_request_free); 1349EXPORT_SYMBOL(raw3270_request_free);
1439EXPORT_SYMBOL(raw3270_request_reset); 1350EXPORT_SYMBOL(raw3270_request_reset);
diff --git a/drivers/s390/char/raw3270.h b/drivers/s390/char/raw3270.h
index ed34eb2199cc..7b73ff8c1bd7 100644
--- a/drivers/s390/char/raw3270.h
+++ b/drivers/s390/char/raw3270.h
@@ -91,6 +91,7 @@ struct raw3270_iocb {
91 91
92struct raw3270; 92struct raw3270;
93struct raw3270_view; 93struct raw3270_view;
94extern struct class *class3270;
94 95
95/* 3270 CCW request */ 96/* 3270 CCW request */
96struct raw3270_request { 97struct raw3270_request {
@@ -140,6 +141,7 @@ struct raw3270_fn {
140 struct raw3270_request *, struct irb *); 141 struct raw3270_request *, struct irb *);
141 void (*release)(struct raw3270_view *); 142 void (*release)(struct raw3270_view *);
142 void (*free)(struct raw3270_view *); 143 void (*free)(struct raw3270_view *);
144 void (*resize)(struct raw3270_view *, int, int, int);
143}; 145};
144 146
145/* 147/*
@@ -192,8 +194,14 @@ struct raw3270 *raw3270_setup_console(struct ccw_device *cdev);
192void raw3270_wait_cons_dev(struct raw3270 *); 194void raw3270_wait_cons_dev(struct raw3270 *);
193 195
194/* Notifier for device addition/removal */ 196/* Notifier for device addition/removal */
195int raw3270_register_notifier(void (*notifier)(int, int)); 197struct raw3270_notifier {
196void raw3270_unregister_notifier(void (*notifier)(int, int)); 198 struct list_head list;
199 void (*create)(int minor);
200 void (*destroy)(int minor);
201};
202
203int raw3270_register_notifier(struct raw3270_notifier *);
204void raw3270_unregister_notifier(struct raw3270_notifier *);
197void raw3270_pm_unfreeze(struct raw3270_view *); 205void raw3270_pm_unfreeze(struct raw3270_view *);
198 206
199/* 207/*
diff --git a/drivers/s390/char/sclp.c b/drivers/s390/char/sclp.c
index 12c16a65dd25..bd6871bf545a 100644
--- a/drivers/s390/char/sclp.c
+++ b/drivers/s390/char/sclp.c
@@ -450,7 +450,7 @@ sclp_sync_wait(void)
450 timeout = 0; 450 timeout = 0;
451 if (timer_pending(&sclp_request_timer)) { 451 if (timer_pending(&sclp_request_timer)) {
452 /* Get timeout TOD value */ 452 /* Get timeout TOD value */
453 timeout = get_clock() + 453 timeout = get_tod_clock() +
454 sclp_tod_from_jiffies(sclp_request_timer.expires - 454 sclp_tod_from_jiffies(sclp_request_timer.expires -
455 jiffies); 455 jiffies);
456 } 456 }
@@ -472,7 +472,7 @@ sclp_sync_wait(void)
472 while (sclp_running_state != sclp_running_state_idle) { 472 while (sclp_running_state != sclp_running_state_idle) {
473 /* Check for expired request timer */ 473 /* Check for expired request timer */
474 if (timer_pending(&sclp_request_timer) && 474 if (timer_pending(&sclp_request_timer) &&
475 get_clock() > timeout && 475 get_tod_clock() > timeout &&
476 del_timer(&sclp_request_timer)) 476 del_timer(&sclp_request_timer))
477 sclp_request_timer.function(sclp_request_timer.data); 477 sclp_request_timer.function(sclp_request_timer.data);
478 cpu_relax(); 478 cpu_relax();
diff --git a/drivers/s390/char/sclp_cmd.c b/drivers/s390/char/sclp_cmd.c
index c44d13f607bc..30a2255389e5 100644
--- a/drivers/s390/char/sclp_cmd.c
+++ b/drivers/s390/char/sclp_cmd.c
@@ -56,7 +56,6 @@ static int __initdata early_read_info_sccb_valid;
56 56
57u64 sclp_facilities; 57u64 sclp_facilities;
58static u8 sclp_fac84; 58static u8 sclp_fac84;
59static u8 sclp_fac85;
60static unsigned long long rzm; 59static unsigned long long rzm;
61static unsigned long long rnmax; 60static unsigned long long rnmax;
62 61
@@ -131,7 +130,8 @@ void __init sclp_facilities_detect(void)
131 sccb = &early_read_info_sccb; 130 sccb = &early_read_info_sccb;
132 sclp_facilities = sccb->facilities; 131 sclp_facilities = sccb->facilities;
133 sclp_fac84 = sccb->fac84; 132 sclp_fac84 = sccb->fac84;
134 sclp_fac85 = sccb->fac85; 133 if (sccb->fac85 & 0x02)
134 S390_lowcore.machine_flags |= MACHINE_FLAG_ESOP;
135 rnmax = sccb->rnmax ? sccb->rnmax : sccb->rnmax2; 135 rnmax = sccb->rnmax ? sccb->rnmax : sccb->rnmax2;
136 rzm = sccb->rnsize ? sccb->rnsize : sccb->rnsize2; 136 rzm = sccb->rnsize ? sccb->rnsize : sccb->rnsize2;
137 rzm <<= 20; 137 rzm <<= 20;
@@ -171,12 +171,6 @@ unsigned long long sclp_get_rzm(void)
171 return rzm; 171 return rzm;
172} 172}
173 173
174u8 sclp_get_fac85(void)
175{
176 return sclp_fac85;
177}
178EXPORT_SYMBOL_GPL(sclp_get_fac85);
179
180/* 174/*
181 * This function will be called after sclp_facilities_detect(), which gets 175 * This function will be called after sclp_facilities_detect(), which gets
182 * called from early.c code. Therefore the sccb should have valid contents. 176 * called from early.c code. Therefore the sccb should have valid contents.
diff --git a/drivers/s390/char/tty3270.c b/drivers/s390/char/tty3270.c
index 3860e796b65f..b907dba24025 100644
--- a/drivers/s390/char/tty3270.c
+++ b/drivers/s390/char/tty3270.c
@@ -15,6 +15,7 @@
15#include <linux/init.h> 15#include <linux/init.h>
16#include <linux/console.h> 16#include <linux/console.h>
17#include <linux/interrupt.h> 17#include <linux/interrupt.h>
18#include <linux/workqueue.h>
18 19
19#include <linux/slab.h> 20#include <linux/slab.h>
20#include <linux/bootmem.h> 21#include <linux/bootmem.h>
@@ -80,6 +81,8 @@ struct tty3270 {
80 unsigned int highlight; /* Blink/reverse/underscore */ 81 unsigned int highlight; /* Blink/reverse/underscore */
81 unsigned int f_color; /* Foreground color */ 82 unsigned int f_color; /* Foreground color */
82 struct tty3270_line *screen; 83 struct tty3270_line *screen;
84 unsigned int n_model, n_cols, n_rows; /* New model & size */
85 struct work_struct resize_work;
83 86
84 /* Input stuff. */ 87 /* Input stuff. */
85 struct string *prompt; /* Output string for input area. */ 88 struct string *prompt; /* Output string for input area. */
@@ -115,6 +118,7 @@ struct tty3270 {
115#define TTY_UPDATE_ALL 16 /* Recreate screen. */ 118#define TTY_UPDATE_ALL 16 /* Recreate screen. */
116 119
117static void tty3270_update(struct tty3270 *); 120static void tty3270_update(struct tty3270 *);
121static void tty3270_resize_work(struct work_struct *work);
118 122
119/* 123/*
120 * Setup timeout for a device. On timeout trigger an update. 124 * Setup timeout for a device. On timeout trigger an update.
@@ -683,12 +687,6 @@ tty3270_alloc_view(void)
683 INIT_LIST_HEAD(&tp->update); 687 INIT_LIST_HEAD(&tp->update);
684 INIT_LIST_HEAD(&tp->rcl_lines); 688 INIT_LIST_HEAD(&tp->rcl_lines);
685 tp->rcl_max = 20; 689 tp->rcl_max = 20;
686 tty_port_init(&tp->port);
687 setup_timer(&tp->timer, (void (*)(unsigned long)) tty3270_update,
688 (unsigned long) tp);
689 tasklet_init(&tp->readlet,
690 (void (*)(unsigned long)) tty3270_read_tasklet,
691 (unsigned long) tp->read);
692 690
693 for (pages = 0; pages < TTY3270_STRING_PAGES; pages++) { 691 for (pages = 0; pages < TTY3270_STRING_PAGES; pages++) {
694 tp->freemem_pages[pages] = (void *) 692 tp->freemem_pages[pages] = (void *)
@@ -710,6 +708,15 @@ tty3270_alloc_view(void)
710 tp->kbd = kbd_alloc(); 708 tp->kbd = kbd_alloc();
711 if (!tp->kbd) 709 if (!tp->kbd)
712 goto out_reset; 710 goto out_reset;
711
712 tty_port_init(&tp->port);
713 setup_timer(&tp->timer, (void (*)(unsigned long)) tty3270_update,
714 (unsigned long) tp);
715 tasklet_init(&tp->readlet,
716 (void (*)(unsigned long)) tty3270_read_tasklet,
717 (unsigned long) tp->read);
718 INIT_WORK(&tp->resize_work, tty3270_resize_work);
719
713 return tp; 720 return tp;
714 721
715out_reset: 722out_reset:
@@ -752,42 +759,96 @@ tty3270_free_view(struct tty3270 *tp)
752/* 759/*
753 * Allocate tty3270 screen. 760 * Allocate tty3270 screen.
754 */ 761 */
755static int 762static struct tty3270_line *
756tty3270_alloc_screen(struct tty3270 *tp) 763tty3270_alloc_screen(unsigned int rows, unsigned int cols)
757{ 764{
765 struct tty3270_line *screen;
758 unsigned long size; 766 unsigned long size;
759 int lines; 767 int lines;
760 768
761 size = sizeof(struct tty3270_line) * (tp->view.rows - 2); 769 size = sizeof(struct tty3270_line) * (rows - 2);
762 tp->screen = kzalloc(size, GFP_KERNEL); 770 screen = kzalloc(size, GFP_KERNEL);
763 if (!tp->screen) 771 if (!screen)
764 goto out_err; 772 goto out_err;
765 for (lines = 0; lines < tp->view.rows - 2; lines++) { 773 for (lines = 0; lines < rows - 2; lines++) {
766 size = sizeof(struct tty3270_cell) * tp->view.cols; 774 size = sizeof(struct tty3270_cell) * cols;
767 tp->screen[lines].cells = kzalloc(size, GFP_KERNEL); 775 screen[lines].cells = kzalloc(size, GFP_KERNEL);
768 if (!tp->screen[lines].cells) 776 if (!screen[lines].cells)
769 goto out_screen; 777 goto out_screen;
770 } 778 }
771 return 0; 779 return screen;
772out_screen: 780out_screen:
773 while (lines--) 781 while (lines--)
774 kfree(tp->screen[lines].cells); 782 kfree(screen[lines].cells);
775 kfree(tp->screen); 783 kfree(screen);
776out_err: 784out_err:
777 return -ENOMEM; 785 return ERR_PTR(-ENOMEM);
778} 786}
779 787
780/* 788/*
781 * Free tty3270 screen. 789 * Free tty3270 screen.
782 */ 790 */
783static void 791static void
784tty3270_free_screen(struct tty3270 *tp) 792tty3270_free_screen(struct tty3270_line *screen, unsigned int rows)
785{ 793{
786 int lines; 794 int lines;
787 795
788 for (lines = 0; lines < tp->view.rows - 2; lines++) 796 for (lines = 0; lines < rows - 2; lines++)
789 kfree(tp->screen[lines].cells); 797 kfree(screen[lines].cells);
790 kfree(tp->screen); 798 kfree(screen);
799}
800
801/*
802 * Resize tty3270 screen
803 */
804static void tty3270_resize_work(struct work_struct *work)
805{
806 struct tty3270 *tp = container_of(work, struct tty3270, resize_work);
807 struct tty3270_line *screen, *oscreen;
808 struct tty_struct *tty;
809 unsigned int orows;
810 struct winsize ws;
811
812 screen = tty3270_alloc_screen(tp->n_rows, tp->n_cols);
813 if (!screen)
814 return;
815 /* Switch to new output size */
816 spin_lock_bh(&tp->view.lock);
817 oscreen = tp->screen;
818 orows = tp->view.rows;
819 tp->view.model = tp->n_model;
820 tp->view.rows = tp->n_rows;
821 tp->view.cols = tp->n_cols;
822 tp->screen = screen;
823 free_string(&tp->freemem, tp->prompt);
824 free_string(&tp->freemem, tp->status);
825 tty3270_create_prompt(tp);
826 tty3270_create_status(tp);
827 tp->nr_up = 0;
828 while (tp->nr_lines < tp->view.rows - 2)
829 tty3270_blank_line(tp);
830 tp->update_flags = TTY_UPDATE_ALL;
831 spin_unlock_bh(&tp->view.lock);
832 tty3270_free_screen(oscreen, orows);
833 tty3270_set_timer(tp, 1);
834 /* Informat tty layer about new size */
835 tty = tty_port_tty_get(&tp->port);
836 if (!tty)
837 return;
838 ws.ws_row = tp->view.rows - 2;
839 ws.ws_col = tp->view.cols;
840 tty_do_resize(tty, &ws);
841}
842
843static void
844tty3270_resize(struct raw3270_view *view, int model, int rows, int cols)
845{
846 struct tty3270 *tp = container_of(view, struct tty3270, view);
847
848 tp->n_model = model;
849 tp->n_rows = rows;
850 tp->n_cols = cols;
851 schedule_work(&tp->resize_work);
791} 852}
792 853
793/* 854/*
@@ -815,7 +876,8 @@ static void
815tty3270_free(struct raw3270_view *view) 876tty3270_free(struct raw3270_view *view)
816{ 877{
817 struct tty3270 *tp = container_of(view, struct tty3270, view); 878 struct tty3270 *tp = container_of(view, struct tty3270, view);
818 tty3270_free_screen(tp); 879
880 tty3270_free_screen(tp->screen, tp->view.rows);
819 tty3270_free_view(tp); 881 tty3270_free_view(tp);
820} 882}
821 883
@@ -827,9 +889,8 @@ tty3270_del_views(void)
827{ 889{
828 int i; 890 int i;
829 891
830 for (i = 0; i < tty3270_max_index; i++) { 892 for (i = RAW3270_FIRSTMINOR; i <= tty3270_max_index; i++) {
831 struct raw3270_view *view = 893 struct raw3270_view *view = raw3270_find_view(&tty3270_fn, i);
832 raw3270_find_view(&tty3270_fn, i + RAW3270_FIRSTMINOR);
833 if (!IS_ERR(view)) 894 if (!IS_ERR(view))
834 raw3270_del_view(view); 895 raw3270_del_view(view);
835 } 896 }
@@ -840,7 +901,8 @@ static struct raw3270_fn tty3270_fn = {
840 .deactivate = tty3270_deactivate, 901 .deactivate = tty3270_deactivate,
841 .intv = (void *) tty3270_irq, 902 .intv = (void *) tty3270_irq,
842 .release = tty3270_release, 903 .release = tty3270_release,
843 .free = tty3270_free 904 .free = tty3270_free,
905 .resize = tty3270_resize
844}; 906};
845 907
846/* 908/*
@@ -853,8 +915,7 @@ static int tty3270_install(struct tty_driver *driver, struct tty_struct *tty)
853 int i, rc; 915 int i, rc;
854 916
855 /* Check if the tty3270 is already there. */ 917 /* Check if the tty3270 is already there. */
856 view = raw3270_find_view(&tty3270_fn, 918 view = raw3270_find_view(&tty3270_fn, tty->index);
857 tty->index + RAW3270_FIRSTMINOR);
858 if (!IS_ERR(view)) { 919 if (!IS_ERR(view)) {
859 tp = container_of(view, struct tty3270, view); 920 tp = container_of(view, struct tty3270, view);
860 tty->driver_data = tp; 921 tty->driver_data = tp;
@@ -866,29 +927,26 @@ static int tty3270_install(struct tty_driver *driver, struct tty_struct *tty)
866 tp->inattr = TF_INPUT; 927 tp->inattr = TF_INPUT;
867 return tty_port_install(&tp->port, driver, tty); 928 return tty_port_install(&tp->port, driver, tty);
868 } 929 }
869 if (tty3270_max_index < tty->index + 1) 930 if (tty3270_max_index < tty->index)
870 tty3270_max_index = tty->index + 1; 931 tty3270_max_index = tty->index;
871
872 /* Quick exit if there is no device for tty->index. */
873 if (PTR_ERR(view) == -ENODEV)
874 return -ENODEV;
875 932
876 /* Allocate tty3270 structure on first open. */ 933 /* Allocate tty3270 structure on first open. */
877 tp = tty3270_alloc_view(); 934 tp = tty3270_alloc_view();
878 if (IS_ERR(tp)) 935 if (IS_ERR(tp))
879 return PTR_ERR(tp); 936 return PTR_ERR(tp);
880 937
881 rc = raw3270_add_view(&tp->view, &tty3270_fn, 938 rc = raw3270_add_view(&tp->view, &tty3270_fn, tty->index);
882 tty->index + RAW3270_FIRSTMINOR);
883 if (rc) { 939 if (rc) {
884 tty3270_free_view(tp); 940 tty3270_free_view(tp);
885 return rc; 941 return rc;
886 } 942 }
887 943
888 rc = tty3270_alloc_screen(tp); 944 tp->screen = tty3270_alloc_screen(tp->view.cols, tp->view.rows);
889 if (rc) { 945 if (IS_ERR(tp->screen)) {
946 rc = PTR_ERR(tp->screen);
890 raw3270_put_view(&tp->view); 947 raw3270_put_view(&tp->view);
891 raw3270_del_view(&tp->view); 948 raw3270_del_view(&tp->view);
949 tty3270_free_view(tp);
892 return rc; 950 return rc;
893 } 951 }
894 952
@@ -926,6 +984,20 @@ static int tty3270_install(struct tty_driver *driver, struct tty_struct *tty)
926} 984}
927 985
928/* 986/*
987 * This routine is called whenever a 3270 tty is opened.
988 */
989static int
990tty3270_open(struct tty_struct *tty, struct file *filp)
991{
992 struct tty3270 *tp = tty->driver_data;
993 struct tty_port *port = &tp->port;
994
995 port->count++;
996 tty_port_tty_set(port, tty);
997 return 0;
998}
999
1000/*
929 * This routine is called when the 3270 tty is closed. We wait 1001 * This routine is called when the 3270 tty is closed. We wait
930 * for the remaining request to be completed. Then we clean up. 1002 * for the remaining request to be completed. Then we clean up.
931 */ 1003 */
@@ -1753,6 +1825,7 @@ static long tty3270_compat_ioctl(struct tty_struct *tty,
1753static const struct tty_operations tty3270_ops = { 1825static const struct tty_operations tty3270_ops = {
1754 .install = tty3270_install, 1826 .install = tty3270_install,
1755 .cleanup = tty3270_cleanup, 1827 .cleanup = tty3270_cleanup,
1828 .open = tty3270_open,
1756 .close = tty3270_close, 1829 .close = tty3270_close,
1757 .write = tty3270_write, 1830 .write = tty3270_write,
1758 .put_char = tty3270_put_char, 1831 .put_char = tty3270_put_char,
@@ -1771,6 +1844,22 @@ static const struct tty_operations tty3270_ops = {
1771 .set_termios = tty3270_set_termios 1844 .set_termios = tty3270_set_termios
1772}; 1845};
1773 1846
1847void tty3270_create_cb(int minor)
1848{
1849 tty_register_device(tty3270_driver, minor, NULL);
1850}
1851
1852void tty3270_destroy_cb(int minor)
1853{
1854 tty_unregister_device(tty3270_driver, minor);
1855}
1856
1857struct raw3270_notifier tty3270_notifier =
1858{
1859 .create = tty3270_create_cb,
1860 .destroy = tty3270_destroy_cb,
1861};
1862
1774/* 1863/*
1775 * 3270 tty registration code called from tty_init(). 1864 * 3270 tty registration code called from tty_init().
1776 * Most kernel services (incl. kmalloc) are available at this poimt. 1865 * Most kernel services (incl. kmalloc) are available at this poimt.
@@ -1780,23 +1869,25 @@ static int __init tty3270_init(void)
1780 struct tty_driver *driver; 1869 struct tty_driver *driver;
1781 int ret; 1870 int ret;
1782 1871
1783 driver = alloc_tty_driver(RAW3270_MAXDEVS); 1872 driver = tty_alloc_driver(RAW3270_MAXDEVS,
1784 if (!driver) 1873 TTY_DRIVER_REAL_RAW |
1785 return -ENOMEM; 1874 TTY_DRIVER_DYNAMIC_DEV |
1875 TTY_DRIVER_RESET_TERMIOS);
1876 if (IS_ERR(driver))
1877 return PTR_ERR(driver);
1786 1878
1787 /* 1879 /*
1788 * Initialize the tty_driver structure 1880 * Initialize the tty_driver structure
1789 * Entries in tty3270_driver that are NOT initialized: 1881 * Entries in tty3270_driver that are NOT initialized:
1790 * proc_entry, set_termios, flush_buffer, set_ldisc, write_proc 1882 * proc_entry, set_termios, flush_buffer, set_ldisc, write_proc
1791 */ 1883 */
1792 driver->driver_name = "ttyTUB"; 1884 driver->driver_name = "tty3270";
1793 driver->name = "ttyTUB"; 1885 driver->name = "3270/tty";
1794 driver->major = IBM_TTY3270_MAJOR; 1886 driver->major = IBM_TTY3270_MAJOR;
1795 driver->minor_start = RAW3270_FIRSTMINOR; 1887 driver->minor_start = 0;
1796 driver->type = TTY_DRIVER_TYPE_SYSTEM; 1888 driver->type = TTY_DRIVER_TYPE_SYSTEM;
1797 driver->subtype = SYSTEM_TYPE_TTY; 1889 driver->subtype = SYSTEM_TYPE_TTY;
1798 driver->init_termios = tty_std_termios; 1890 driver->init_termios = tty_std_termios;
1799 driver->flags = TTY_DRIVER_RESET_TERMIOS;
1800 tty_set_operations(driver, &tty3270_ops); 1891 tty_set_operations(driver, &tty3270_ops);
1801 ret = tty_register_driver(driver); 1892 ret = tty_register_driver(driver);
1802 if (ret) { 1893 if (ret) {
@@ -1804,6 +1895,7 @@ static int __init tty3270_init(void)
1804 return ret; 1895 return ret;
1805 } 1896 }
1806 tty3270_driver = driver; 1897 tty3270_driver = driver;
1898 raw3270_register_notifier(&tty3270_notifier);
1807 return 0; 1899 return 0;
1808} 1900}
1809 1901
@@ -1812,6 +1904,7 @@ tty3270_exit(void)
1812{ 1904{
1813 struct tty_driver *driver; 1905 struct tty_driver *driver;
1814 1906
1907 raw3270_unregister_notifier(&tty3270_notifier);
1815 driver = tty3270_driver; 1908 driver = tty3270_driver;
1816 tty3270_driver = NULL; 1909 tty3270_driver = NULL;
1817 tty_unregister_driver(driver); 1910 tty_unregister_driver(driver);
diff --git a/drivers/s390/char/zcore.c b/drivers/s390/char/zcore.c
index e3b9308b0fe3..1d61a01576d2 100644
--- a/drivers/s390/char/zcore.c
+++ b/drivers/s390/char/zcore.c
@@ -62,6 +62,7 @@ static struct dentry *zcore_dir;
62static struct dentry *zcore_file; 62static struct dentry *zcore_file;
63static struct dentry *zcore_memmap_file; 63static struct dentry *zcore_memmap_file;
64static struct dentry *zcore_reipl_file; 64static struct dentry *zcore_reipl_file;
65static struct dentry *zcore_hsa_file;
65static struct ipl_parameter_block *ipl_block; 66static struct ipl_parameter_block *ipl_block;
66 67
67/* 68/*
@@ -77,6 +78,8 @@ static int memcpy_hsa(void *dest, unsigned long src, size_t count, int mode)
77 int offs, blk_num; 78 int offs, blk_num;
78 static char buf[PAGE_SIZE] __attribute__((__aligned__(PAGE_SIZE))); 79 static char buf[PAGE_SIZE] __attribute__((__aligned__(PAGE_SIZE)));
79 80
81 if (!hsa_available)
82 return -ENODATA;
80 if (count == 0) 83 if (count == 0)
81 return 0; 84 return 0;
82 85
@@ -278,6 +281,15 @@ next:
278} 281}
279 282
280/* 283/*
284 * Release the HSA
285 */
286static void release_hsa(void)
287{
288 diag308(DIAG308_REL_HSA, NULL);
289 hsa_available = 0;
290}
291
292/*
281 * Read routine for zcore character device 293 * Read routine for zcore character device
282 * First 4K are dump header 294 * First 4K are dump header
283 * Next 32MB are HSA Memory 295 * Next 32MB are HSA Memory
@@ -363,8 +375,8 @@ static int zcore_open(struct inode *inode, struct file *filp)
363 375
364static int zcore_release(struct inode *inode, struct file *filep) 376static int zcore_release(struct inode *inode, struct file *filep)
365{ 377{
366 diag308(DIAG308_REL_HSA, NULL); 378 if (hsa_available)
367 hsa_available = 0; 379 release_hsa();
368 return 0; 380 return 0;
369} 381}
370 382
@@ -474,6 +486,41 @@ static const struct file_operations zcore_reipl_fops = {
474 .llseek = no_llseek, 486 .llseek = no_llseek,
475}; 487};
476 488
489static ssize_t zcore_hsa_read(struct file *filp, char __user *buf,
490 size_t count, loff_t *ppos)
491{
492 static char str[18];
493
494 if (hsa_available)
495 snprintf(str, sizeof(str), "%lx\n", ZFCPDUMP_HSA_SIZE);
496 else
497 snprintf(str, sizeof(str), "0\n");
498 return simple_read_from_buffer(buf, count, ppos, str, strlen(str));
499}
500
501static ssize_t zcore_hsa_write(struct file *filp, const char __user *buf,
502 size_t count, loff_t *ppos)
503{
504 char value;
505
506 if (*ppos != 0)
507 return -EPIPE;
508 if (copy_from_user(&value, buf, 1))
509 return -EFAULT;
510 if (value != '0')
511 return -EINVAL;
512 release_hsa();
513 return count;
514}
515
516static const struct file_operations zcore_hsa_fops = {
517 .owner = THIS_MODULE,
518 .write = zcore_hsa_write,
519 .read = zcore_hsa_read,
520 .open = nonseekable_open,
521 .llseek = no_llseek,
522};
523
477#ifdef CONFIG_32BIT 524#ifdef CONFIG_32BIT
478 525
479static void __init set_lc_mask(struct save_area *map) 526static void __init set_lc_mask(struct save_area *map)
@@ -590,7 +637,7 @@ static int __init zcore_header_init(int arch, struct zcore_header *hdr)
590 hdr->rmem_size = memory; 637 hdr->rmem_size = memory;
591 hdr->mem_end = sys_info.mem_size; 638 hdr->mem_end = sys_info.mem_size;
592 hdr->num_pages = memory / PAGE_SIZE; 639 hdr->num_pages = memory / PAGE_SIZE;
593 hdr->tod = get_clock(); 640 hdr->tod = get_tod_clock();
594 get_cpu_id(&hdr->cpu_id); 641 get_cpu_id(&hdr->cpu_id);
595 for (i = 0; zfcpdump_save_areas[i]; i++) { 642 for (i = 0; zfcpdump_save_areas[i]; i++) {
596 prefix = zfcpdump_save_areas[i]->pref_reg; 643 prefix = zfcpdump_save_areas[i]->pref_reg;
@@ -658,6 +705,7 @@ static int __init zcore_init(void)
658 rc = check_sdias(); 705 rc = check_sdias();
659 if (rc) 706 if (rc)
660 goto fail; 707 goto fail;
708 hsa_available = 1;
661 709
662 rc = memcpy_hsa_kernel(&arch, __LC_AR_MODE_ID, 1); 710 rc = memcpy_hsa_kernel(&arch, __LC_AR_MODE_ID, 1);
663 if (rc) 711 if (rc)
@@ -714,9 +762,16 @@ static int __init zcore_init(void)
714 rc = -ENOMEM; 762 rc = -ENOMEM;
715 goto fail_memmap_file; 763 goto fail_memmap_file;
716 } 764 }
717 hsa_available = 1; 765 zcore_hsa_file = debugfs_create_file("hsa", S_IRUSR|S_IWUSR, zcore_dir,
766 NULL, &zcore_hsa_fops);
767 if (!zcore_hsa_file) {
768 rc = -ENOMEM;
769 goto fail_reipl_file;
770 }
718 return 0; 771 return 0;
719 772
773fail_reipl_file:
774 debugfs_remove(zcore_reipl_file);
720fail_memmap_file: 775fail_memmap_file:
721 debugfs_remove(zcore_memmap_file); 776 debugfs_remove(zcore_memmap_file);
722fail_file: 777fail_file:
@@ -733,6 +788,7 @@ static void __exit zcore_exit(void)
733 debug_unregister(zcore_dbf); 788 debug_unregister(zcore_dbf);
734 sclp_sdias_exit(); 789 sclp_sdias_exit();
735 free_page((unsigned long) ipl_block); 790 free_page((unsigned long) ipl_block);
791 debugfs_remove(zcore_hsa_file);
736 debugfs_remove(zcore_reipl_file); 792 debugfs_remove(zcore_reipl_file);
737 debugfs_remove(zcore_memmap_file); 793 debugfs_remove(zcore_memmap_file);
738 debugfs_remove(zcore_file); 794 debugfs_remove(zcore_file);
diff --git a/drivers/s390/cio/chsc.c b/drivers/s390/cio/chsc.c
index 10729bbceced..31ceef1beb8b 100644
--- a/drivers/s390/cio/chsc.c
+++ b/drivers/s390/cio/chsc.c
@@ -435,7 +435,6 @@ static void chsc_process_sei_scm_change(struct chsc_sei_nt0_area *sei_area)
435 435
436static void chsc_process_sei_nt2(struct chsc_sei_nt2_area *sei_area) 436static void chsc_process_sei_nt2(struct chsc_sei_nt2_area *sei_area)
437{ 437{
438#ifdef CONFIG_PCI
439 switch (sei_area->cc) { 438 switch (sei_area->cc) {
440 case 1: 439 case 1:
441 zpci_event_error(sei_area->ccdf); 440 zpci_event_error(sei_area->ccdf);
@@ -444,11 +443,10 @@ static void chsc_process_sei_nt2(struct chsc_sei_nt2_area *sei_area)
444 zpci_event_availability(sei_area->ccdf); 443 zpci_event_availability(sei_area->ccdf);
445 break; 444 break;
446 default: 445 default:
447 CIO_CRW_EVENT(2, "chsc: unhandled sei content code %d\n", 446 CIO_CRW_EVENT(2, "chsc: sei nt2 unhandled cc=%d\n",
448 sei_area->cc); 447 sei_area->cc);
449 break; 448 break;
450 } 449 }
451#endif
452} 450}
453 451
454static void chsc_process_sei_nt0(struct chsc_sei_nt0_area *sei_area) 452static void chsc_process_sei_nt0(struct chsc_sei_nt0_area *sei_area)
@@ -471,13 +469,19 @@ static void chsc_process_sei_nt0(struct chsc_sei_nt0_area *sei_area)
471 chsc_process_sei_scm_change(sei_area); 469 chsc_process_sei_scm_change(sei_area);
472 break; 470 break;
473 default: /* other stuff */ 471 default: /* other stuff */
474 CIO_CRW_EVENT(4, "chsc: unhandled sei content code %d\n", 472 CIO_CRW_EVENT(2, "chsc: sei nt0 unhandled cc=%d\n",
475 sei_area->cc); 473 sei_area->cc);
476 break; 474 break;
477 } 475 }
476
477 /* Check if we might have lost some information. */
478 if (sei_area->flags & 0x40) {
479 CIO_CRW_EVENT(2, "chsc: event overflow\n");
480 css_schedule_eval_all();
481 }
478} 482}
479 483
480static int __chsc_process_crw(struct chsc_sei *sei, u64 ntsm) 484static void chsc_process_event_information(struct chsc_sei *sei, u64 ntsm)
481{ 485{
482 do { 486 do {
483 memset(sei, 0, sizeof(*sei)); 487 memset(sei, 0, sizeof(*sei));
@@ -488,40 +492,37 @@ static int __chsc_process_crw(struct chsc_sei *sei, u64 ntsm)
488 if (chsc(sei)) 492 if (chsc(sei))
489 break; 493 break;
490 494
491 if (sei->response.code == 0x0001) { 495 if (sei->response.code != 0x0001) {
492 CIO_CRW_EVENT(2, "chsc: sei successful\n");
493
494 /* Check if we might have lost some information. */
495 if (sei->u.nt0_area.flags & 0x40) {
496 CIO_CRW_EVENT(2, "chsc: event overflow\n");
497 css_schedule_eval_all();
498 }
499
500 switch (sei->nt) {
501 case 0:
502 chsc_process_sei_nt0(&sei->u.nt0_area);
503 break;
504 case 2:
505 chsc_process_sei_nt2(&sei->u.nt2_area);
506 break;
507 default:
508 CIO_CRW_EVENT(2, "chsc: unhandled nt=%d\n",
509 sei->nt);
510 break;
511 }
512 } else {
513 CIO_CRW_EVENT(2, "chsc: sei failed (rc=%04x)\n", 496 CIO_CRW_EVENT(2, "chsc: sei failed (rc=%04x)\n",
514 sei->response.code); 497 sei->response.code);
515 break; 498 break;
516 } 499 }
517 } while (sei->u.nt0_area.flags & 0x80);
518 500
519 return 0; 501 CIO_CRW_EVENT(2, "chsc: sei successful (nt=%d)\n", sei->nt);
502 switch (sei->nt) {
503 case 0:
504 chsc_process_sei_nt0(&sei->u.nt0_area);
505 break;
506 case 2:
507 chsc_process_sei_nt2(&sei->u.nt2_area);
508 break;
509 default:
510 CIO_CRW_EVENT(2, "chsc: unhandled nt: %d\n", sei->nt);
511 break;
512 }
513 } while (sei->u.nt0_area.flags & 0x80);
520} 514}
521 515
516/*
517 * Handle channel subsystem related CRWs.
518 * Use store event information to find out what's going on.
519 *
520 * Note: Access to sei_page is serialized through machine check handler
521 * thread, so no need for locking.
522 */
522static void chsc_process_crw(struct crw *crw0, struct crw *crw1, int overflow) 523static void chsc_process_crw(struct crw *crw0, struct crw *crw1, int overflow)
523{ 524{
524 struct chsc_sei *sei; 525 struct chsc_sei *sei = sei_page;
525 526
526 if (overflow) { 527 if (overflow) {
527 css_schedule_eval_all(); 528 css_schedule_eval_all();
@@ -531,14 +532,9 @@ static void chsc_process_crw(struct crw *crw0, struct crw *crw1, int overflow)
531 "chn=%d, rsc=%X, anc=%d, erc=%X, rsid=%X\n", 532 "chn=%d, rsc=%X, anc=%d, erc=%X, rsid=%X\n",
532 crw0->slct, crw0->oflw, crw0->chn, crw0->rsc, crw0->anc, 533 crw0->slct, crw0->oflw, crw0->chn, crw0->rsc, crw0->anc,
533 crw0->erc, crw0->rsid); 534 crw0->erc, crw0->rsid);
534 if (!sei_page)
535 return;
536 /* Access to sei_page is serialized through machine check handler
537 * thread, so no need for locking. */
538 sei = sei_page;
539 535
540 CIO_TRACE_EVENT(2, "prcss"); 536 CIO_TRACE_EVENT(2, "prcss");
541 __chsc_process_crw(sei, CHSC_SEI_NT0 | CHSC_SEI_NT2); 537 chsc_process_event_information(sei, CHSC_SEI_NT0 | CHSC_SEI_NT2);
542} 538}
543 539
544void chsc_chp_online(struct chp_id chpid) 540void chsc_chp_online(struct chp_id chpid)
diff --git a/drivers/s390/cio/chsc.h b/drivers/s390/cio/chsc.h
index 662dab4b93e6..227e05f674b3 100644
--- a/drivers/s390/cio/chsc.h
+++ b/drivers/s390/cio/chsc.h
@@ -157,7 +157,7 @@ int chsc_scm_info(struct chsc_scm_info *scm_area, u64 token);
157#ifdef CONFIG_SCM_BUS 157#ifdef CONFIG_SCM_BUS
158int scm_update_information(void); 158int scm_update_information(void);
159#else /* CONFIG_SCM_BUS */ 159#else /* CONFIG_SCM_BUS */
160#define scm_update_information() 0 160static inline int scm_update_information(void) { return 0; }
161#endif /* CONFIG_SCM_BUS */ 161#endif /* CONFIG_SCM_BUS */
162 162
163 163
diff --git a/drivers/s390/cio/cio.c b/drivers/s390/cio/cio.c
index c8faf6230b0f..986ef6a92a41 100644
--- a/drivers/s390/cio/cio.c
+++ b/drivers/s390/cio/cio.c
@@ -962,9 +962,9 @@ static void css_reset(void)
962 atomic_inc(&chpid_reset_count); 962 atomic_inc(&chpid_reset_count);
963 } 963 }
964 /* Wait for machine check for all channel paths. */ 964 /* Wait for machine check for all channel paths. */
965 timeout = get_clock() + (RCHP_TIMEOUT << 12); 965 timeout = get_tod_clock() + (RCHP_TIMEOUT << 12);
966 while (atomic_read(&chpid_reset_count) != 0) { 966 while (atomic_read(&chpid_reset_count) != 0) {
967 if (get_clock() > timeout) 967 if (get_tod_clock() > timeout)
968 break; 968 break;
969 cpu_relax(); 969 cpu_relax();
970 } 970 }
diff --git a/drivers/s390/cio/cmf.c b/drivers/s390/cio/cmf.c
index c9fc61c0a866..4495e0627a40 100644
--- a/drivers/s390/cio/cmf.c
+++ b/drivers/s390/cio/cmf.c
@@ -33,7 +33,7 @@
33#include <linux/module.h> 33#include <linux/module.h>
34#include <linux/moduleparam.h> 34#include <linux/moduleparam.h>
35#include <linux/slab.h> 35#include <linux/slab.h>
36#include <linux/timex.h> /* get_clock() */ 36#include <linux/timex.h> /* get_tod_clock() */
37 37
38#include <asm/ccwdev.h> 38#include <asm/ccwdev.h>
39#include <asm/cio.h> 39#include <asm/cio.h>
@@ -326,7 +326,7 @@ static int cmf_copy_block(struct ccw_device *cdev)
326 memcpy(cmb_data->last_block, hw_block, cmb_data->size); 326 memcpy(cmb_data->last_block, hw_block, cmb_data->size);
327 memcpy(reference_buf, hw_block, cmb_data->size); 327 memcpy(reference_buf, hw_block, cmb_data->size);
328 } while (memcmp(cmb_data->last_block, reference_buf, cmb_data->size)); 328 } while (memcmp(cmb_data->last_block, reference_buf, cmb_data->size));
329 cmb_data->last_update = get_clock(); 329 cmb_data->last_update = get_tod_clock();
330 kfree(reference_buf); 330 kfree(reference_buf);
331 return 0; 331 return 0;
332} 332}
@@ -428,7 +428,7 @@ static void cmf_generic_reset(struct ccw_device *cdev)
428 memset(cmbops->align(cmb_data->hw_block), 0, cmb_data->size); 428 memset(cmbops->align(cmb_data->hw_block), 0, cmb_data->size);
429 cmb_data->last_update = 0; 429 cmb_data->last_update = 0;
430 } 430 }
431 cdev->private->cmb_start_time = get_clock(); 431 cdev->private->cmb_start_time = get_tod_clock();
432 spin_unlock_irq(cdev->ccwlock); 432 spin_unlock_irq(cdev->ccwlock);
433} 433}
434 434
diff --git a/drivers/s390/cio/css.c b/drivers/s390/cio/css.c
index fd00afd8b850..a239237d43f3 100644
--- a/drivers/s390/cio/css.c
+++ b/drivers/s390/cio/css.c
@@ -780,7 +780,7 @@ static int __init setup_css(int nr)
780 css->cssid = nr; 780 css->cssid = nr;
781 dev_set_name(&css->device, "css%x", nr); 781 dev_set_name(&css->device, "css%x", nr);
782 css->device.release = channel_subsystem_release; 782 css->device.release = channel_subsystem_release;
783 tod_high = (u32) (get_clock() >> 32); 783 tod_high = (u32) (get_tod_clock() >> 32);
784 css_generate_pgid(css, tod_high); 784 css_generate_pgid(css, tod_high);
785 return 0; 785 return 0;
786} 786}
diff --git a/drivers/s390/cio/device.c b/drivers/s390/cio/device.c
index 7cd5c6812ac7..c6767f5a58b2 100644
--- a/drivers/s390/cio/device.c
+++ b/drivers/s390/cio/device.c
@@ -632,6 +632,14 @@ initiate_logging(struct device *dev, struct device_attribute *attr,
632 return count; 632 return count;
633} 633}
634 634
635static ssize_t vpm_show(struct device *dev, struct device_attribute *attr,
636 char *buf)
637{
638 struct subchannel *sch = to_subchannel(dev);
639
640 return sprintf(buf, "%02x\n", sch->vpm);
641}
642
635static DEVICE_ATTR(chpids, 0444, chpids_show, NULL); 643static DEVICE_ATTR(chpids, 0444, chpids_show, NULL);
636static DEVICE_ATTR(pimpampom, 0444, pimpampom_show, NULL); 644static DEVICE_ATTR(pimpampom, 0444, pimpampom_show, NULL);
637static DEVICE_ATTR(devtype, 0444, devtype_show, NULL); 645static DEVICE_ATTR(devtype, 0444, devtype_show, NULL);
@@ -640,11 +648,13 @@ static DEVICE_ATTR(modalias, 0444, modalias_show, NULL);
640static DEVICE_ATTR(online, 0644, online_show, online_store); 648static DEVICE_ATTR(online, 0644, online_show, online_store);
641static DEVICE_ATTR(availability, 0444, available_show, NULL); 649static DEVICE_ATTR(availability, 0444, available_show, NULL);
642static DEVICE_ATTR(logging, 0200, NULL, initiate_logging); 650static DEVICE_ATTR(logging, 0200, NULL, initiate_logging);
651static DEVICE_ATTR(vpm, 0444, vpm_show, NULL);
643 652
644static struct attribute *io_subchannel_attrs[] = { 653static struct attribute *io_subchannel_attrs[] = {
645 &dev_attr_chpids.attr, 654 &dev_attr_chpids.attr,
646 &dev_attr_pimpampom.attr, 655 &dev_attr_pimpampom.attr,
647 &dev_attr_logging.attr, 656 &dev_attr_logging.attr,
657 &dev_attr_vpm.attr,
648 NULL, 658 NULL,
649}; 659};
650 660
diff --git a/drivers/s390/cio/device_fsm.c b/drivers/s390/cio/device_fsm.c
index 1bb1d00095af..c7638c543250 100644
--- a/drivers/s390/cio/device_fsm.c
+++ b/drivers/s390/cio/device_fsm.c
@@ -47,7 +47,7 @@ static void ccw_timeout_log(struct ccw_device *cdev)
47 cc = stsch_err(sch->schid, &schib); 47 cc = stsch_err(sch->schid, &schib);
48 48
49 printk(KERN_WARNING "cio: ccw device timeout occurred at %llx, " 49 printk(KERN_WARNING "cio: ccw device timeout occurred at %llx, "
50 "device information:\n", get_clock()); 50 "device information:\n", get_tod_clock());
51 printk(KERN_WARNING "cio: orb:\n"); 51 printk(KERN_WARNING "cio: orb:\n");
52 print_hex_dump(KERN_WARNING, "cio: ", DUMP_PREFIX_NONE, 16, 1, 52 print_hex_dump(KERN_WARNING, "cio: ", DUMP_PREFIX_NONE, 16, 1,
53 orb, sizeof(*orb), 0); 53 orb, sizeof(*orb), 0);
diff --git a/drivers/s390/cio/device_pgid.c b/drivers/s390/cio/device_pgid.c
index 908d287f66c1..37ada05e82a5 100644
--- a/drivers/s390/cio/device_pgid.c
+++ b/drivers/s390/cio/device_pgid.c
@@ -23,6 +23,8 @@
23#define PGID_RETRIES 256 23#define PGID_RETRIES 256
24#define PGID_TIMEOUT (10 * HZ) 24#define PGID_TIMEOUT (10 * HZ)
25 25
26static void verify_start(struct ccw_device *cdev);
27
26/* 28/*
27 * Process path verification data and report result. 29 * Process path verification data and report result.
28 */ 30 */
@@ -70,8 +72,8 @@ static void nop_do(struct ccw_device *cdev)
70 struct subchannel *sch = to_subchannel(cdev->dev.parent); 72 struct subchannel *sch = to_subchannel(cdev->dev.parent);
71 struct ccw_request *req = &cdev->private->req; 73 struct ccw_request *req = &cdev->private->req;
72 74
73 /* Adjust lpm. */ 75 req->lpm = lpm_adjust(req->lpm, sch->schib.pmcw.pam & sch->opm &
74 req->lpm = lpm_adjust(req->lpm, sch->schib.pmcw.pam & sch->opm); 76 ~cdev->private->path_noirq_mask);
75 if (!req->lpm) 77 if (!req->lpm)
76 goto out_nopath; 78 goto out_nopath;
77 nop_build_cp(cdev); 79 nop_build_cp(cdev);
@@ -102,10 +104,20 @@ static void nop_callback(struct ccw_device *cdev, void *data, int rc)
102 struct subchannel *sch = to_subchannel(cdev->dev.parent); 104 struct subchannel *sch = to_subchannel(cdev->dev.parent);
103 struct ccw_request *req = &cdev->private->req; 105 struct ccw_request *req = &cdev->private->req;
104 106
105 if (rc == 0) 107 switch (rc) {
108 case 0:
106 sch->vpm |= req->lpm; 109 sch->vpm |= req->lpm;
107 else if (rc != -EACCES) 110 break;
111 case -ETIME:
112 cdev->private->path_noirq_mask |= req->lpm;
113 break;
114 case -EACCES:
115 cdev->private->path_notoper_mask |= req->lpm;
116 break;
117 default:
108 goto err; 118 goto err;
119 }
120 /* Continue on the next path. */
109 req->lpm >>= 1; 121 req->lpm >>= 1;
110 nop_do(cdev); 122 nop_do(cdev);
111 return; 123 return;
@@ -132,6 +144,48 @@ static void spid_build_cp(struct ccw_device *cdev, u8 fn)
132 req->cp = cp; 144 req->cp = cp;
133} 145}
134 146
147static void pgid_wipeout_callback(struct ccw_device *cdev, void *data, int rc)
148{
149 if (rc) {
150 /* We don't know the path groups' state. Abort. */
151 verify_done(cdev, rc);
152 return;
153 }
154 /*
155 * Path groups have been reset. Restart path verification but
156 * leave paths in path_noirq_mask out.
157 */
158 cdev->private->flags.pgid_unknown = 0;
159 verify_start(cdev);
160}
161
162/*
163 * Reset pathgroups and restart path verification, leave unusable paths out.
164 */
165static void pgid_wipeout_start(struct ccw_device *cdev)
166{
167 struct subchannel *sch = to_subchannel(cdev->dev.parent);
168 struct ccw_dev_id *id = &cdev->private->dev_id;
169 struct ccw_request *req = &cdev->private->req;
170 u8 fn;
171
172 CIO_MSG_EVENT(2, "wipe: device 0.%x.%04x: pvm=%02x nim=%02x\n",
173 id->ssid, id->devno, cdev->private->pgid_valid_mask,
174 cdev->private->path_noirq_mask);
175
176 /* Initialize request data. */
177 memset(req, 0, sizeof(*req));
178 req->timeout = PGID_TIMEOUT;
179 req->maxretries = PGID_RETRIES;
180 req->lpm = sch->schib.pmcw.pam;
181 req->callback = pgid_wipeout_callback;
182 fn = SPID_FUNC_DISBAND;
183 if (cdev->private->flags.mpath)
184 fn |= SPID_FUNC_MULTI_PATH;
185 spid_build_cp(cdev, fn);
186 ccw_request_start(cdev);
187}
188
135/* 189/*
136 * Perform establish/resign SET PGID on a single path. 190 * Perform establish/resign SET PGID on a single path.
137 */ 191 */
@@ -157,11 +211,14 @@ static void spid_do(struct ccw_device *cdev)
157 return; 211 return;
158 212
159out_nopath: 213out_nopath:
214 if (cdev->private->flags.pgid_unknown) {
215 /* At least one SPID could be partially done. */
216 pgid_wipeout_start(cdev);
217 return;
218 }
160 verify_done(cdev, sch->vpm ? 0 : -EACCES); 219 verify_done(cdev, sch->vpm ? 0 : -EACCES);
161} 220}
162 221
163static void verify_start(struct ccw_device *cdev);
164
165/* 222/*
166 * Process SET PGID request result for a single path. 223 * Process SET PGID request result for a single path.
167 */ 224 */
@@ -174,7 +231,12 @@ static void spid_callback(struct ccw_device *cdev, void *data, int rc)
174 case 0: 231 case 0:
175 sch->vpm |= req->lpm & sch->opm; 232 sch->vpm |= req->lpm & sch->opm;
176 break; 233 break;
234 case -ETIME:
235 cdev->private->flags.pgid_unknown = 1;
236 cdev->private->path_noirq_mask |= req->lpm;
237 break;
177 case -EACCES: 238 case -EACCES:
239 cdev->private->path_notoper_mask |= req->lpm;
178 break; 240 break;
179 case -EOPNOTSUPP: 241 case -EOPNOTSUPP:
180 if (cdev->private->flags.mpath) { 242 if (cdev->private->flags.mpath) {
@@ -330,8 +392,9 @@ static void snid_done(struct ccw_device *cdev, int rc)
330 else { 392 else {
331 donepm = pgid_to_donepm(cdev); 393 donepm = pgid_to_donepm(cdev);
332 sch->vpm = donepm & sch->opm; 394 sch->vpm = donepm & sch->opm;
333 cdev->private->pgid_todo_mask &= ~donepm;
334 cdev->private->pgid_reset_mask |= reset; 395 cdev->private->pgid_reset_mask |= reset;
396 cdev->private->pgid_todo_mask &=
397 ~(donepm | cdev->private->path_noirq_mask);
335 pgid_fill(cdev, pgid); 398 pgid_fill(cdev, pgid);
336 } 399 }
337out: 400out:
@@ -341,6 +404,10 @@ out:
341 cdev->private->pgid_todo_mask, mismatch, reserved, reset); 404 cdev->private->pgid_todo_mask, mismatch, reserved, reset);
342 switch (rc) { 405 switch (rc) {
343 case 0: 406 case 0:
407 if (cdev->private->flags.pgid_unknown) {
408 pgid_wipeout_start(cdev);
409 return;
410 }
344 /* Anything left to do? */ 411 /* Anything left to do? */
345 if (cdev->private->pgid_todo_mask == 0) { 412 if (cdev->private->pgid_todo_mask == 0) {
346 verify_done(cdev, sch->vpm == 0 ? -EACCES : 0); 413 verify_done(cdev, sch->vpm == 0 ? -EACCES : 0);
@@ -384,9 +451,10 @@ static void snid_do(struct ccw_device *cdev)
384{ 451{
385 struct subchannel *sch = to_subchannel(cdev->dev.parent); 452 struct subchannel *sch = to_subchannel(cdev->dev.parent);
386 struct ccw_request *req = &cdev->private->req; 453 struct ccw_request *req = &cdev->private->req;
454 int ret;
387 455
388 /* Adjust lpm if paths are not set in pam. */ 456 req->lpm = lpm_adjust(req->lpm, sch->schib.pmcw.pam &
389 req->lpm = lpm_adjust(req->lpm, sch->schib.pmcw.pam); 457 ~cdev->private->path_noirq_mask);
390 if (!req->lpm) 458 if (!req->lpm)
391 goto out_nopath; 459 goto out_nopath;
392 snid_build_cp(cdev); 460 snid_build_cp(cdev);
@@ -394,7 +462,13 @@ static void snid_do(struct ccw_device *cdev)
394 return; 462 return;
395 463
396out_nopath: 464out_nopath:
397 snid_done(cdev, cdev->private->pgid_valid_mask ? 0 : -EACCES); 465 if (cdev->private->pgid_valid_mask)
466 ret = 0;
467 else if (cdev->private->path_noirq_mask)
468 ret = -ETIME;
469 else
470 ret = -EACCES;
471 snid_done(cdev, ret);
398} 472}
399 473
400/* 474/*
@@ -404,10 +478,21 @@ static void snid_callback(struct ccw_device *cdev, void *data, int rc)
404{ 478{
405 struct ccw_request *req = &cdev->private->req; 479 struct ccw_request *req = &cdev->private->req;
406 480
407 if (rc == 0) 481 switch (rc) {
482 case 0:
408 cdev->private->pgid_valid_mask |= req->lpm; 483 cdev->private->pgid_valid_mask |= req->lpm;
409 else if (rc != -EACCES) 484 break;
485 case -ETIME:
486 cdev->private->flags.pgid_unknown = 1;
487 cdev->private->path_noirq_mask |= req->lpm;
488 break;
489 case -EACCES:
490 cdev->private->path_notoper_mask |= req->lpm;
491 break;
492 default:
410 goto err; 493 goto err;
494 }
495 /* Continue on the next path. */
411 req->lpm >>= 1; 496 req->lpm >>= 1;
412 snid_do(cdev); 497 snid_do(cdev);
413 return; 498 return;
@@ -427,6 +512,13 @@ static void verify_start(struct ccw_device *cdev)
427 512
428 sch->vpm = 0; 513 sch->vpm = 0;
429 sch->lpm = sch->schib.pmcw.pam; 514 sch->lpm = sch->schib.pmcw.pam;
515
516 /* Initialize PGID data. */
517 memset(cdev->private->pgid, 0, sizeof(cdev->private->pgid));
518 cdev->private->pgid_valid_mask = 0;
519 cdev->private->pgid_todo_mask = sch->schib.pmcw.pam;
520 cdev->private->path_notoper_mask = 0;
521
430 /* Initialize request data. */ 522 /* Initialize request data. */
431 memset(req, 0, sizeof(*req)); 523 memset(req, 0, sizeof(*req));
432 req->timeout = PGID_TIMEOUT; 524 req->timeout = PGID_TIMEOUT;
@@ -459,14 +551,8 @@ static void verify_start(struct ccw_device *cdev)
459 */ 551 */
460void ccw_device_verify_start(struct ccw_device *cdev) 552void ccw_device_verify_start(struct ccw_device *cdev)
461{ 553{
462 struct subchannel *sch = to_subchannel(cdev->dev.parent);
463
464 CIO_TRACE_EVENT(4, "vrfy"); 554 CIO_TRACE_EVENT(4, "vrfy");
465 CIO_HEX_EVENT(4, &cdev->private->dev_id, sizeof(cdev->private->dev_id)); 555 CIO_HEX_EVENT(4, &cdev->private->dev_id, sizeof(cdev->private->dev_id));
466 /* Initialize PGID data. */
467 memset(cdev->private->pgid, 0, sizeof(cdev->private->pgid));
468 cdev->private->pgid_valid_mask = 0;
469 cdev->private->pgid_todo_mask = sch->schib.pmcw.pam;
470 /* 556 /*
471 * Initialize pathgroup and multipath state with target values. 557 * Initialize pathgroup and multipath state with target values.
472 * They may change in the course of path verification. 558 * They may change in the course of path verification.
@@ -474,6 +560,7 @@ void ccw_device_verify_start(struct ccw_device *cdev)
474 cdev->private->flags.pgroup = cdev->private->options.pgroup; 560 cdev->private->flags.pgroup = cdev->private->options.pgroup;
475 cdev->private->flags.mpath = cdev->private->options.mpath; 561 cdev->private->flags.mpath = cdev->private->options.mpath;
476 cdev->private->flags.doverify = 0; 562 cdev->private->flags.doverify = 0;
563 cdev->private->path_noirq_mask = 0;
477 verify_start(cdev); 564 verify_start(cdev);
478} 565}
479 566
diff --git a/drivers/s390/cio/io_sch.h b/drivers/s390/cio/io_sch.h
index 76253dfcc1be..b108f4a5c7dd 100644
--- a/drivers/s390/cio/io_sch.h
+++ b/drivers/s390/cio/io_sch.h
@@ -126,6 +126,10 @@ struct ccw_device_private {
126 u8 pgid_valid_mask; /* mask of valid PGIDs */ 126 u8 pgid_valid_mask; /* mask of valid PGIDs */
127 u8 pgid_todo_mask; /* mask of PGIDs to be adjusted */ 127 u8 pgid_todo_mask; /* mask of PGIDs to be adjusted */
128 u8 pgid_reset_mask; /* mask of PGIDs which were reset */ 128 u8 pgid_reset_mask; /* mask of PGIDs which were reset */
129 u8 path_noirq_mask; /* mask of paths for which no irq was
130 received */
131 u8 path_notoper_mask; /* mask of paths which were found
132 not operable */
129 u8 path_gone_mask; /* mask of paths, that became unavailable */ 133 u8 path_gone_mask; /* mask of paths, that became unavailable */
130 u8 path_new_mask; /* mask of paths, that became available */ 134 u8 path_new_mask; /* mask of paths, that became available */
131 struct { 135 struct {
@@ -145,6 +149,7 @@ struct ccw_device_private {
145 unsigned int resuming:1; /* recognition while resume */ 149 unsigned int resuming:1; /* recognition while resume */
146 unsigned int pgroup:1; /* pathgroup is set up */ 150 unsigned int pgroup:1; /* pathgroup is set up */
147 unsigned int mpath:1; /* multipathing is set up */ 151 unsigned int mpath:1; /* multipathing is set up */
152 unsigned int pgid_unknown:1;/* unknown pgid state */
148 unsigned int initialized:1; /* set if initial reference held */ 153 unsigned int initialized:1; /* set if initial reference held */
149 } __attribute__((packed)) flags; 154 } __attribute__((packed)) flags;
150 unsigned long intparm; /* user interruption parameter */ 155 unsigned long intparm; /* user interruption parameter */
diff --git a/drivers/s390/cio/qdio_main.c b/drivers/s390/cio/qdio_main.c
index 1671d3461f29..abc550e5dd35 100644
--- a/drivers/s390/cio/qdio_main.c
+++ b/drivers/s390/cio/qdio_main.c
@@ -338,10 +338,10 @@ again:
338 retries++; 338 retries++;
339 339
340 if (!start_time) { 340 if (!start_time) {
341 start_time = get_clock(); 341 start_time = get_tod_clock();
342 goto again; 342 goto again;
343 } 343 }
344 if ((get_clock() - start_time) < QDIO_BUSY_BIT_PATIENCE) 344 if ((get_tod_clock() - start_time) < QDIO_BUSY_BIT_PATIENCE)
345 goto again; 345 goto again;
346 } 346 }
347 if (retries) { 347 if (retries) {
@@ -504,7 +504,7 @@ static int get_inbound_buffer_frontier(struct qdio_q *q)
504 int count, stop; 504 int count, stop;
505 unsigned char state = 0; 505 unsigned char state = 0;
506 506
507 q->timestamp = get_clock(); 507 q->timestamp = get_tod_clock();
508 508
509 /* 509 /*
510 * Don't check 128 buffers, as otherwise qdio_inbound_q_moved 510 * Don't check 128 buffers, as otherwise qdio_inbound_q_moved
@@ -563,7 +563,7 @@ static int qdio_inbound_q_moved(struct qdio_q *q)
563 if (bufnr != q->last_move) { 563 if (bufnr != q->last_move) {
564 q->last_move = bufnr; 564 q->last_move = bufnr;
565 if (!is_thinint_irq(q->irq_ptr) && MACHINE_IS_LPAR) 565 if (!is_thinint_irq(q->irq_ptr) && MACHINE_IS_LPAR)
566 q->u.in.timestamp = get_clock(); 566 q->u.in.timestamp = get_tod_clock();
567 return 1; 567 return 1;
568 } else 568 } else
569 return 0; 569 return 0;
@@ -595,7 +595,7 @@ static inline int qdio_inbound_q_done(struct qdio_q *q)
595 * At this point we know, that inbound first_to_check 595 * At this point we know, that inbound first_to_check
596 * has (probably) not moved (see qdio_inbound_processing). 596 * has (probably) not moved (see qdio_inbound_processing).
597 */ 597 */
598 if (get_clock() > q->u.in.timestamp + QDIO_INPUT_THRESHOLD) { 598 if (get_tod_clock() > q->u.in.timestamp + QDIO_INPUT_THRESHOLD) {
599 DBF_DEV_EVENT(DBF_INFO, q->irq_ptr, "in done:%02x", 599 DBF_DEV_EVENT(DBF_INFO, q->irq_ptr, "in done:%02x",
600 q->first_to_check); 600 q->first_to_check);
601 return 1; 601 return 1;
@@ -772,7 +772,7 @@ static int get_outbound_buffer_frontier(struct qdio_q *q)
772 int count, stop; 772 int count, stop;
773 unsigned char state = 0; 773 unsigned char state = 0;
774 774
775 q->timestamp = get_clock(); 775 q->timestamp = get_tod_clock();
776 776
777 if (need_siga_sync(q)) 777 if (need_siga_sync(q))
778 if (((queue_type(q) != QDIO_IQDIO_QFMT) && 778 if (((queue_type(q) != QDIO_IQDIO_QFMT) &&
diff --git a/drivers/s390/net/qeth_core.h b/drivers/s390/net/qeth_core.h
index d690b33846cc..d87961d4c0de 100644
--- a/drivers/s390/net/qeth_core.h
+++ b/drivers/s390/net/qeth_core.h
@@ -818,7 +818,7 @@ static inline struct qeth_card *CARD_FROM_CDEV(struct ccw_device *cdev)
818 818
819static inline int qeth_get_micros(void) 819static inline int qeth_get_micros(void)
820{ 820{
821 return (int) (get_clock() >> 12); 821 return (int) (get_tod_clock() >> 12);
822} 822}
823 823
824static inline int qeth_get_ip_version(struct sk_buff *skb) 824static inline int qeth_get_ip_version(struct sk_buff *skb)
diff --git a/drivers/s390/scsi/zfcp_fsf.c b/drivers/s390/scsi/zfcp_fsf.c
index c96320d79fbc..c7e148f33b2a 100644
--- a/drivers/s390/scsi/zfcp_fsf.c
+++ b/drivers/s390/scsi/zfcp_fsf.c
@@ -727,7 +727,7 @@ static int zfcp_fsf_req_send(struct zfcp_fsf_req *req)
727 zfcp_reqlist_add(adapter->req_list, req); 727 zfcp_reqlist_add(adapter->req_list, req);
728 728
729 req->qdio_req.qdio_outb_usage = atomic_read(&qdio->req_q_free); 729 req->qdio_req.qdio_outb_usage = atomic_read(&qdio->req_q_free);
730 req->issued = get_clock(); 730 req->issued = get_tod_clock();
731 if (zfcp_qdio_send(qdio, &req->qdio_req)) { 731 if (zfcp_qdio_send(qdio, &req->qdio_req)) {
732 del_timer(&req->timer); 732 del_timer(&req->timer);
733 /* lookup request again, list might have changed */ 733 /* lookup request again, list might have changed */
diff --git a/drivers/s390/scsi/zfcp_qdio.c b/drivers/s390/scsi/zfcp_qdio.c
index 50b5615848f6..665e3cfaaf85 100644
--- a/drivers/s390/scsi/zfcp_qdio.c
+++ b/drivers/s390/scsi/zfcp_qdio.c
@@ -68,7 +68,7 @@ static inline void zfcp_qdio_account(struct zfcp_qdio *qdio)
68 unsigned long long now, span; 68 unsigned long long now, span;
69 int used; 69 int used;
70 70
71 now = get_clock_monotonic(); 71 now = get_tod_clock_monotonic();
72 span = (now - qdio->req_q_time) >> 12; 72 span = (now - qdio->req_q_time) >> 12;
73 used = QDIO_MAX_BUFFERS_PER_Q - atomic_read(&qdio->req_q_free); 73 used = QDIO_MAX_BUFFERS_PER_Q - atomic_read(&qdio->req_q_free);
74 qdio->req_q_util += used * span; 74 qdio->req_q_util += used * span;
diff --git a/drivers/tty/tty_io.c b/drivers/tty/tty_io.c
index 60e48a11b66c..fd473639ab70 100644
--- a/drivers/tty/tty_io.c
+++ b/drivers/tty/tty_io.c
@@ -2199,6 +2199,7 @@ done:
2199 mutex_unlock(&tty->termios_mutex); 2199 mutex_unlock(&tty->termios_mutex);
2200 return 0; 2200 return 0;
2201} 2201}
2202EXPORT_SYMBOL(tty_do_resize);
2202 2203
2203/** 2204/**
2204 * tiocswinsz - implement window size set ioctl 2205 * tiocswinsz - implement window size set ioctl
diff --git a/drivers/uio/Kconfig b/drivers/uio/Kconfig
index f56d185790ea..e92eeaf251fe 100644
--- a/drivers/uio/Kconfig
+++ b/drivers/uio/Kconfig
@@ -1,6 +1,5 @@
1menuconfig UIO 1menuconfig UIO
2 tristate "Userspace I/O drivers" 2 tristate "Userspace I/O drivers"
3 depends on !S390
4 help 3 help
5 Enable this to allow the userspace driver core code to be 4 Enable this to allow the userspace driver core code to be
6 built. This code allows userspace programs easy access to 5 built. This code allows userspace programs easy access to