diff options
author | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-07-17 18:29:33 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-07-17 18:29:33 -0400 |
commit | fd2f261053b2f125d5f6882b6d095ce2f4076fe5 (patch) | |
tree | 5be548353e3c8b3a7e1e5e01e41b88777ad6d249 | |
parent | 99e1221d1a1edac316f7f8116c781f75733b1159 (diff) | |
parent | a07a5b336f699e21d405764931a9d5426dc4f945 (diff) |
Merge branch 'for-linus' of git://git390.osdl.marist.edu/pub/scm/linux-2.6
* 'for-linus' of git://git390.osdl.marist.edu/pub/scm/linux-2.6:
[S390] Fix broken logic, SIGA flags must be bitwise ORed
[S390] cio: Dont print trailing \0 in modalias_show().
[S390] Simplify stack trace.
[S390] z/VM unit record device driver
[S390] vmcp cleanup
[S390] qdio: output queue stall on FCP and network devices
[S390] Fix disassembly of RX_URRD, SI_URD & PC-relative instructions.
[S390] Update default configuration.
-rw-r--r-- | arch/s390/defconfig | 110 | ||||
-rw-r--r-- | arch/s390/kernel/dis.c | 7 | ||||
-rw-r--r-- | arch/s390/kernel/stacktrace.c | 26 | ||||
-rw-r--r-- | drivers/s390/char/Kconfig | 6 | ||||
-rw-r--r-- | drivers/s390/char/Makefile | 1 | ||||
-rw-r--r-- | drivers/s390/char/vmcp.c | 89 | ||||
-rw-r--r-- | drivers/s390/char/vmcp.h | 4 | ||||
-rw-r--r-- | drivers/s390/char/vmur.c | 906 | ||||
-rw-r--r-- | drivers/s390/char/vmur.h | 104 | ||||
-rw-r--r-- | drivers/s390/cio/device.c | 2 | ||||
-rw-r--r-- | drivers/s390/cio/qdio.c | 16 |
11 files changed, 1126 insertions, 145 deletions
diff --git a/arch/s390/defconfig b/arch/s390/defconfig index 485b60c1983c..2aae23dba4bb 100644 --- a/arch/s390/defconfig +++ b/arch/s390/defconfig | |||
@@ -1,7 +1,7 @@ | |||
1 | # | 1 | # |
2 | # Automatically generated make config: don't edit | 2 | # Automatically generated make config: don't edit |
3 | # Linux kernel version: 2.6.21 | 3 | # Linux kernel version: 2.6.22 |
4 | # Thu May 10 15:18:19 2007 | 4 | # Tue Jul 17 12:50:23 2007 |
5 | # | 5 | # |
6 | CONFIG_MMU=y | 6 | CONFIG_MMU=y |
7 | CONFIG_ZONE_DMA=y | 7 | CONFIG_ZONE_DMA=y |
@@ -32,12 +32,11 @@ CONFIG_LOCALVERSION="" | |||
32 | CONFIG_LOCALVERSION_AUTO=y | 32 | CONFIG_LOCALVERSION_AUTO=y |
33 | CONFIG_SWAP=y | 33 | CONFIG_SWAP=y |
34 | CONFIG_SYSVIPC=y | 34 | CONFIG_SYSVIPC=y |
35 | # CONFIG_IPC_NS is not set | ||
36 | CONFIG_SYSVIPC_SYSCTL=y | 35 | CONFIG_SYSVIPC_SYSCTL=y |
37 | CONFIG_POSIX_MQUEUE=y | 36 | CONFIG_POSIX_MQUEUE=y |
38 | # CONFIG_BSD_PROCESS_ACCT is not set | 37 | # CONFIG_BSD_PROCESS_ACCT is not set |
39 | # CONFIG_TASKSTATS is not set | 38 | # CONFIG_TASKSTATS is not set |
40 | # CONFIG_UTS_NS is not set | 39 | # CONFIG_USER_NS is not set |
41 | CONFIG_AUDIT=y | 40 | CONFIG_AUDIT=y |
42 | # CONFIG_AUDITSYSCALL is not set | 41 | # CONFIG_AUDITSYSCALL is not set |
43 | CONFIG_IKCONFIG=y | 42 | CONFIG_IKCONFIG=y |
@@ -61,20 +60,19 @@ CONFIG_BUG=y | |||
61 | CONFIG_ELF_CORE=y | 60 | CONFIG_ELF_CORE=y |
62 | CONFIG_BASE_FULL=y | 61 | CONFIG_BASE_FULL=y |
63 | CONFIG_FUTEX=y | 62 | CONFIG_FUTEX=y |
63 | CONFIG_ANON_INODES=y | ||
64 | CONFIG_EPOLL=y | 64 | CONFIG_EPOLL=y |
65 | CONFIG_SIGNALFD=y | ||
66 | CONFIG_TIMERFD=y | ||
67 | CONFIG_EVENTFD=y | ||
65 | CONFIG_SHMEM=y | 68 | CONFIG_SHMEM=y |
66 | CONFIG_VM_EVENT_COUNTERS=y | 69 | CONFIG_VM_EVENT_COUNTERS=y |
67 | CONFIG_SLUB_DEBUG=y | ||
68 | CONFIG_SLAB=y | 70 | CONFIG_SLAB=y |
69 | # CONFIG_SLUB is not set | 71 | # CONFIG_SLUB is not set |
70 | # CONFIG_SLOB is not set | 72 | # CONFIG_SLOB is not set |
71 | CONFIG_RT_MUTEXES=y | 73 | CONFIG_RT_MUTEXES=y |
72 | # CONFIG_TINY_SHMEM is not set | 74 | # CONFIG_TINY_SHMEM is not set |
73 | CONFIG_BASE_SMALL=0 | 75 | CONFIG_BASE_SMALL=0 |
74 | |||
75 | # | ||
76 | # Loadable module support | ||
77 | # | ||
78 | CONFIG_MODULES=y | 76 | CONFIG_MODULES=y |
79 | CONFIG_MODULE_UNLOAD=y | 77 | CONFIG_MODULE_UNLOAD=y |
80 | # CONFIG_MODULE_FORCE_UNLOAD is not set | 78 | # CONFIG_MODULE_FORCE_UNLOAD is not set |
@@ -82,12 +80,9 @@ CONFIG_MODVERSIONS=y | |||
82 | # CONFIG_MODULE_SRCVERSION_ALL is not set | 80 | # CONFIG_MODULE_SRCVERSION_ALL is not set |
83 | CONFIG_KMOD=y | 81 | CONFIG_KMOD=y |
84 | CONFIG_STOP_MACHINE=y | 82 | CONFIG_STOP_MACHINE=y |
85 | |||
86 | # | ||
87 | # Block layer | ||
88 | # | ||
89 | CONFIG_BLOCK=y | 83 | CONFIG_BLOCK=y |
90 | # CONFIG_BLK_DEV_IO_TRACE is not set | 84 | # CONFIG_BLK_DEV_IO_TRACE is not set |
85 | CONFIG_BLK_DEV_BSG=y | ||
91 | 86 | ||
92 | # | 87 | # |
93 | # IO Schedulers | 88 | # IO Schedulers |
@@ -151,6 +146,7 @@ CONFIG_FLAT_NODE_MEM_MAP=y | |||
151 | CONFIG_SPLIT_PTLOCK_CPUS=4 | 146 | CONFIG_SPLIT_PTLOCK_CPUS=4 |
152 | CONFIG_RESOURCES_64BIT=y | 147 | CONFIG_RESOURCES_64BIT=y |
153 | CONFIG_ZONE_DMA_FLAG=1 | 148 | CONFIG_ZONE_DMA_FLAG=1 |
149 | CONFIG_VIRT_TO_BUS=y | ||
154 | CONFIG_HOLES_IN_ZONE=y | 150 | CONFIG_HOLES_IN_ZONE=y |
155 | 151 | ||
156 | # | 152 | # |
@@ -248,25 +244,13 @@ CONFIG_IPV6_SIT=y | |||
248 | # CONFIG_IPV6_MULTIPLE_TABLES is not set | 244 | # CONFIG_IPV6_MULTIPLE_TABLES is not set |
249 | # CONFIG_NETWORK_SECMARK is not set | 245 | # CONFIG_NETWORK_SECMARK is not set |
250 | # CONFIG_NETFILTER is not set | 246 | # CONFIG_NETFILTER is not set |
251 | |||
252 | # | ||
253 | # DCCP Configuration (EXPERIMENTAL) | ||
254 | # | ||
255 | # CONFIG_IP_DCCP is not set | 247 | # CONFIG_IP_DCCP is not set |
256 | |||
257 | # | ||
258 | # SCTP Configuration (EXPERIMENTAL) | ||
259 | # | ||
260 | CONFIG_IP_SCTP=m | 248 | CONFIG_IP_SCTP=m |
261 | # CONFIG_SCTP_DBG_MSG is not set | 249 | # CONFIG_SCTP_DBG_MSG is not set |
262 | # CONFIG_SCTP_DBG_OBJCNT is not set | 250 | # CONFIG_SCTP_DBG_OBJCNT is not set |
263 | # CONFIG_SCTP_HMAC_NONE is not set | 251 | # CONFIG_SCTP_HMAC_NONE is not set |
264 | # CONFIG_SCTP_HMAC_SHA1 is not set | 252 | # CONFIG_SCTP_HMAC_SHA1 is not set |
265 | CONFIG_SCTP_HMAC_MD5=y | 253 | CONFIG_SCTP_HMAC_MD5=y |
266 | |||
267 | # | ||
268 | # TIPC Configuration (EXPERIMENTAL) | ||
269 | # | ||
270 | # CONFIG_TIPC is not set | 254 | # CONFIG_TIPC is not set |
271 | # CONFIG_ATM is not set | 255 | # CONFIG_ATM is not set |
272 | # CONFIG_BRIDGE is not set | 256 | # CONFIG_BRIDGE is not set |
@@ -293,6 +277,7 @@ CONFIG_NET_SCH_CBQ=m | |||
293 | # CONFIG_NET_SCH_HTB is not set | 277 | # CONFIG_NET_SCH_HTB is not set |
294 | # CONFIG_NET_SCH_HFSC is not set | 278 | # CONFIG_NET_SCH_HFSC is not set |
295 | CONFIG_NET_SCH_PRIO=m | 279 | CONFIG_NET_SCH_PRIO=m |
280 | CONFIG_NET_SCH_RR=m | ||
296 | CONFIG_NET_SCH_RED=m | 281 | CONFIG_NET_SCH_RED=m |
297 | CONFIG_NET_SCH_SFQ=m | 282 | CONFIG_NET_SCH_SFQ=m |
298 | CONFIG_NET_SCH_TEQL=m | 283 | CONFIG_NET_SCH_TEQL=m |
@@ -317,10 +302,14 @@ CONFIG_CLS_U32_MARK=y | |||
317 | CONFIG_NET_CLS_RSVP=m | 302 | CONFIG_NET_CLS_RSVP=m |
318 | CONFIG_NET_CLS_RSVP6=m | 303 | CONFIG_NET_CLS_RSVP6=m |
319 | # CONFIG_NET_EMATCH is not set | 304 | # CONFIG_NET_EMATCH is not set |
320 | # CONFIG_NET_CLS_ACT is not set | 305 | CONFIG_NET_CLS_ACT=y |
306 | CONFIG_NET_ACT_POLICE=y | ||
307 | # CONFIG_NET_ACT_GACT is not set | ||
308 | # CONFIG_NET_ACT_MIRRED is not set | ||
309 | # CONFIG_NET_ACT_PEDIT is not set | ||
310 | # CONFIG_NET_ACT_SIMP is not set | ||
321 | CONFIG_NET_CLS_POLICE=y | 311 | CONFIG_NET_CLS_POLICE=y |
322 | # CONFIG_NET_CLS_IND is not set | 312 | # CONFIG_NET_CLS_IND is not set |
323 | CONFIG_NET_ESTIMATOR=y | ||
324 | 313 | ||
325 | # | 314 | # |
326 | # Network testing | 315 | # Network testing |
@@ -329,6 +318,7 @@ CONFIG_NET_ESTIMATOR=y | |||
329 | # CONFIG_NET_TCPPROBE is not set | 318 | # CONFIG_NET_TCPPROBE is not set |
330 | # CONFIG_AF_RXRPC is not set | 319 | # CONFIG_AF_RXRPC is not set |
331 | # CONFIG_RFKILL is not set | 320 | # CONFIG_RFKILL is not set |
321 | # CONFIG_NET_9P is not set | ||
332 | # CONFIG_PCMCIA is not set | 322 | # CONFIG_PCMCIA is not set |
333 | CONFIG_CCW=y | 323 | CONFIG_CCW=y |
334 | 324 | ||
@@ -345,15 +335,8 @@ CONFIG_PREVENT_FIRMWARE_BUILD=y | |||
345 | # CONFIG_DEBUG_DRIVER is not set | 335 | # CONFIG_DEBUG_DRIVER is not set |
346 | # CONFIG_DEBUG_DEVRES is not set | 336 | # CONFIG_DEBUG_DEVRES is not set |
347 | CONFIG_SYS_HYPERVISOR=y | 337 | CONFIG_SYS_HYPERVISOR=y |
348 | |||
349 | # | ||
350 | # Connector - unified userspace <-> kernelspace linker | ||
351 | # | ||
352 | # CONFIG_CONNECTOR is not set | 338 | # CONFIG_CONNECTOR is not set |
353 | 339 | CONFIG_BLK_DEV=y | |
354 | # | ||
355 | # Block devices | ||
356 | # | ||
357 | # CONFIG_BLK_DEV_COW_COMMON is not set | 340 | # CONFIG_BLK_DEV_COW_COMMON is not set |
358 | CONFIG_BLK_DEV_LOOP=m | 341 | CONFIG_BLK_DEV_LOOP=m |
359 | # CONFIG_BLK_DEV_CRYPTOLOOP is not set | 342 | # CONFIG_BLK_DEV_CRYPTOLOOP is not set |
@@ -376,17 +359,15 @@ CONFIG_DASD_ECKD=y | |||
376 | CONFIG_DASD_FBA=y | 359 | CONFIG_DASD_FBA=y |
377 | CONFIG_DASD_DIAG=y | 360 | CONFIG_DASD_DIAG=y |
378 | CONFIG_DASD_EER=y | 361 | CONFIG_DASD_EER=y |
379 | 362 | CONFIG_MISC_DEVICES=y | |
380 | # | 363 | # CONFIG_EEPROM_93CX6 is not set |
381 | # Misc devices | ||
382 | # | ||
383 | # CONFIG_BLINK is not set | ||
384 | 364 | ||
385 | # | 365 | # |
386 | # SCSI device support | 366 | # SCSI device support |
387 | # | 367 | # |
388 | # CONFIG_RAID_ATTRS is not set | 368 | # CONFIG_RAID_ATTRS is not set |
389 | CONFIG_SCSI=y | 369 | CONFIG_SCSI=y |
370 | # CONFIG_SCSI_DMA is not set | ||
390 | # CONFIG_SCSI_TGT is not set | 371 | # CONFIG_SCSI_TGT is not set |
391 | CONFIG_SCSI_NETLINK=y | 372 | CONFIG_SCSI_NETLINK=y |
392 | CONFIG_SCSI_PROC_FS=y | 373 | CONFIG_SCSI_PROC_FS=y |
@@ -447,40 +428,21 @@ CONFIG_DM_MIRROR=y | |||
447 | CONFIG_DM_ZERO=y | 428 | CONFIG_DM_ZERO=y |
448 | CONFIG_DM_MULTIPATH=y | 429 | CONFIG_DM_MULTIPATH=y |
449 | # CONFIG_DM_MULTIPATH_EMC is not set | 430 | # CONFIG_DM_MULTIPATH_EMC is not set |
431 | # CONFIG_DM_MULTIPATH_RDAC is not set | ||
450 | # CONFIG_DM_DELAY is not set | 432 | # CONFIG_DM_DELAY is not set |
451 | |||
452 | # | ||
453 | # Network device support | ||
454 | # | ||
455 | CONFIG_NETDEVICES=y | 433 | CONFIG_NETDEVICES=y |
434 | # CONFIG_NETDEVICES_MULTIQUEUE is not set | ||
435 | # CONFIG_IFB is not set | ||
456 | CONFIG_DUMMY=m | 436 | CONFIG_DUMMY=m |
457 | CONFIG_BONDING=m | 437 | CONFIG_BONDING=m |
438 | # CONFIG_MACVLAN is not set | ||
458 | CONFIG_EQUALIZER=m | 439 | CONFIG_EQUALIZER=m |
459 | CONFIG_TUN=m | 440 | CONFIG_TUN=m |
460 | |||
461 | # | ||
462 | # Ethernet (10 or 100Mbit) | ||
463 | # | ||
464 | CONFIG_NET_ETHERNET=y | 441 | CONFIG_NET_ETHERNET=y |
465 | # CONFIG_MII is not set | 442 | # CONFIG_MII is not set |
466 | 443 | CONFIG_NETDEV_1000=y | |
467 | # | 444 | CONFIG_NETDEV_10000=y |
468 | # Ethernet (1000 Mbit) | ||
469 | # | ||
470 | |||
471 | # | ||
472 | # Ethernet (10000 Mbit) | ||
473 | # | ||
474 | CONFIG_MLX4_DEBUG=y | ||
475 | |||
476 | # | ||
477 | # Token Ring devices | ||
478 | # | ||
479 | # CONFIG_TR is not set | 445 | # CONFIG_TR is not set |
480 | |||
481 | # | ||
482 | # Wan interfaces | ||
483 | # | ||
484 | # CONFIG_WAN is not set | 446 | # CONFIG_WAN is not set |
485 | 447 | ||
486 | # | 448 | # |
@@ -511,10 +473,6 @@ CONFIG_CCWGROUP=y | |||
511 | CONFIG_UNIX98_PTYS=y | 473 | CONFIG_UNIX98_PTYS=y |
512 | CONFIG_LEGACY_PTYS=y | 474 | CONFIG_LEGACY_PTYS=y |
513 | CONFIG_LEGACY_PTY_COUNT=256 | 475 | CONFIG_LEGACY_PTY_COUNT=256 |
514 | |||
515 | # | ||
516 | # Watchdog Cards | ||
517 | # | ||
518 | # CONFIG_WATCHDOG is not set | 476 | # CONFIG_WATCHDOG is not set |
519 | CONFIG_HW_RANDOM=m | 477 | CONFIG_HW_RANDOM=m |
520 | # CONFIG_R3964 is not set | 478 | # CONFIG_R3964 is not set |
@@ -554,6 +512,8 @@ CONFIG_S390_TAPE_34XX=m | |||
554 | # CONFIG_VMCP is not set | 512 | # CONFIG_VMCP is not set |
555 | # CONFIG_MONREADER is not set | 513 | # CONFIG_MONREADER is not set |
556 | CONFIG_MONWRITER=m | 514 | CONFIG_MONWRITER=m |
515 | CONFIG_S390_VMUR=m | ||
516 | # CONFIG_POWER_SUPPLY is not set | ||
557 | 517 | ||
558 | # | 518 | # |
559 | # File systems | 519 | # File systems |
@@ -655,7 +615,6 @@ CONFIG_SUNRPC=y | |||
655 | # CONFIG_NCP_FS is not set | 615 | # CONFIG_NCP_FS is not set |
656 | # CONFIG_CODA_FS is not set | 616 | # CONFIG_CODA_FS is not set |
657 | # CONFIG_AFS_FS is not set | 617 | # CONFIG_AFS_FS is not set |
658 | # CONFIG_9P_FS is not set | ||
659 | 618 | ||
660 | # | 619 | # |
661 | # Partition Types | 620 | # Partition Types |
@@ -712,6 +671,7 @@ CONFIG_MAGIC_SYSRQ=y | |||
712 | CONFIG_DEBUG_FS=y | 671 | CONFIG_DEBUG_FS=y |
713 | CONFIG_HEADERS_CHECK=y | 672 | CONFIG_HEADERS_CHECK=y |
714 | CONFIG_DEBUG_KERNEL=y | 673 | CONFIG_DEBUG_KERNEL=y |
674 | # CONFIG_SCHED_DEBUG is not set | ||
715 | # CONFIG_SCHEDSTATS is not set | 675 | # CONFIG_SCHEDSTATS is not set |
716 | # CONFIG_TIMER_STATS is not set | 676 | # CONFIG_TIMER_STATS is not set |
717 | # CONFIG_DEBUG_SLAB is not set | 677 | # CONFIG_DEBUG_SLAB is not set |
@@ -740,10 +700,6 @@ CONFIG_FORCED_INLINING=y | |||
740 | # | 700 | # |
741 | # CONFIG_KEYS is not set | 701 | # CONFIG_KEYS is not set |
742 | # CONFIG_SECURITY is not set | 702 | # CONFIG_SECURITY is not set |
743 | |||
744 | # | ||
745 | # Cryptographic options | ||
746 | # | ||
747 | CONFIG_CRYPTO=y | 703 | CONFIG_CRYPTO=y |
748 | CONFIG_CRYPTO_ALGAPI=y | 704 | CONFIG_CRYPTO_ALGAPI=y |
749 | CONFIG_CRYPTO_BLKCIPHER=y | 705 | CONFIG_CRYPTO_BLKCIPHER=y |
@@ -782,10 +738,7 @@ CONFIG_CRYPTO_FCRYPT=m | |||
782 | # CONFIG_CRYPTO_CRC32C is not set | 738 | # CONFIG_CRYPTO_CRC32C is not set |
783 | CONFIG_CRYPTO_CAMELLIA=m | 739 | CONFIG_CRYPTO_CAMELLIA=m |
784 | # CONFIG_CRYPTO_TEST is not set | 740 | # CONFIG_CRYPTO_TEST is not set |
785 | 741 | CONFIG_CRYPTO_HW=y | |
786 | # | ||
787 | # Hardware crypto devices | ||
788 | # | ||
789 | # CONFIG_CRYPTO_SHA1_S390 is not set | 742 | # CONFIG_CRYPTO_SHA1_S390 is not set |
790 | # CONFIG_CRYPTO_SHA256_S390 is not set | 743 | # CONFIG_CRYPTO_SHA256_S390 is not set |
791 | # CONFIG_CRYPTO_DES_S390 is not set | 744 | # CONFIG_CRYPTO_DES_S390 is not set |
@@ -800,6 +753,7 @@ CONFIG_ZCRYPT=m | |||
800 | CONFIG_BITREVERSE=m | 753 | CONFIG_BITREVERSE=m |
801 | # CONFIG_CRC_CCITT is not set | 754 | # CONFIG_CRC_CCITT is not set |
802 | # CONFIG_CRC16 is not set | 755 | # CONFIG_CRC16 is not set |
756 | # CONFIG_CRC_ITU_T is not set | ||
803 | CONFIG_CRC32=m | 757 | CONFIG_CRC32=m |
804 | # CONFIG_LIBCRC32C is not set | 758 | # CONFIG_LIBCRC32C is not set |
805 | CONFIG_PLIST=y | 759 | CONFIG_PLIST=y |
diff --git a/arch/s390/kernel/dis.c b/arch/s390/kernel/dis.c index a057ebf108a7..d3057318f2bf 100644 --- a/arch/s390/kernel/dis.c +++ b/arch/s390/kernel/dis.c | |||
@@ -240,8 +240,8 @@ static const unsigned char formats[][7] = { | |||
240 | [INSTR_RXY_FRRD] = { 0xff, F_8,D20_20,X_12,B_16,0,0 },/* e.g. ley */ | 240 | [INSTR_RXY_FRRD] = { 0xff, F_8,D20_20,X_12,B_16,0,0 },/* e.g. ley */ |
241 | [INSTR_RX_FRRD] = { 0xff, F_8,D_20,X_12,B_16,0,0 }, /* e.g. ae */ | 241 | [INSTR_RX_FRRD] = { 0xff, F_8,D_20,X_12,B_16,0,0 }, /* e.g. ae */ |
242 | [INSTR_RX_RRRD] = { 0xff, R_8,D_20,X_12,B_16,0,0 }, /* e.g. l */ | 242 | [INSTR_RX_RRRD] = { 0xff, R_8,D_20,X_12,B_16,0,0 }, /* e.g. l */ |
243 | [INSTR_RX_URRD] = { 0x00, U4_8,D_20,X_12,B_16,0,0 }, /* e.g. bc */ | 243 | [INSTR_RX_URRD] = { 0xff, U4_8,D_20,X_12,B_16,0,0 }, /* e.g. bc */ |
244 | [INSTR_SI_URD] = { 0x00, D_20,B_16,U8_8,0,0,0 }, /* e.g. cli */ | 244 | [INSTR_SI_URD] = { 0xff, D_20,B_16,U8_8,0,0,0 }, /* e.g. cli */ |
245 | [INSTR_SIY_URD] = { 0xff, D20_20,B_16,U8_8,0,0,0 }, /* e.g. tmy */ | 245 | [INSTR_SIY_URD] = { 0xff, D20_20,B_16,U8_8,0,0,0 }, /* e.g. tmy */ |
246 | [INSTR_SSE_RDRD] = { 0xff, D_20,B_16,D_36,B_32,0,0 }, /* e.g. mvsdk */ | 246 | [INSTR_SSE_RDRD] = { 0xff, D_20,B_16,D_36,B_32,0,0 }, /* e.g. mvsdk */ |
247 | [INSTR_SS_L0RDRD] = { 0xff, D_20,L8_8,B_16,D_36,B_32,0 }, | 247 | [INSTR_SS_L0RDRD] = { 0xff, D_20,L8_8,B_16,D_36,B_32,0 }, |
@@ -1190,7 +1190,8 @@ static int print_insn(char *buffer, unsigned char *code, unsigned long addr) | |||
1190 | else if (operand->flags & OPERAND_CR) | 1190 | else if (operand->flags & OPERAND_CR) |
1191 | ptr += sprintf(ptr, "%%c%i", value); | 1191 | ptr += sprintf(ptr, "%%c%i", value); |
1192 | else if (operand->flags & OPERAND_PCREL) | 1192 | else if (operand->flags & OPERAND_PCREL) |
1193 | ptr += sprintf(ptr, "%lx", value + addr); | 1193 | ptr += sprintf(ptr, "%lx", (signed int) value |
1194 | + addr); | ||
1194 | else if (operand->flags & OPERAND_SIGNED) | 1195 | else if (operand->flags & OPERAND_SIGNED) |
1195 | ptr += sprintf(ptr, "%i", value); | 1196 | ptr += sprintf(ptr, "%i", value); |
1196 | else | 1197 | else |
diff --git a/arch/s390/kernel/stacktrace.c b/arch/s390/kernel/stacktrace.c index 515ff9011dd7..da6924729964 100644 --- a/arch/s390/kernel/stacktrace.c +++ b/arch/s390/kernel/stacktrace.c | |||
@@ -12,7 +12,6 @@ | |||
12 | #include <linux/kallsyms.h> | 12 | #include <linux/kallsyms.h> |
13 | 13 | ||
14 | static unsigned long save_context_stack(struct stack_trace *trace, | 14 | static unsigned long save_context_stack(struct stack_trace *trace, |
15 | unsigned int *skip, | ||
16 | unsigned long sp, | 15 | unsigned long sp, |
17 | unsigned long low, | 16 | unsigned long low, |
18 | unsigned long high) | 17 | unsigned long high) |
@@ -28,10 +27,10 @@ static unsigned long save_context_stack(struct stack_trace *trace, | |||
28 | sf = (struct stack_frame *)sp; | 27 | sf = (struct stack_frame *)sp; |
29 | while(1) { | 28 | while(1) { |
30 | addr = sf->gprs[8] & PSW_ADDR_INSN; | 29 | addr = sf->gprs[8] & PSW_ADDR_INSN; |
31 | if (!(*skip)) | 30 | if (!trace->skip) |
32 | trace->entries[trace->nr_entries++] = addr; | 31 | trace->entries[trace->nr_entries++] = addr; |
33 | else | 32 | else |
34 | (*skip)--; | 33 | trace->skip--; |
35 | if (trace->nr_entries >= trace->max_entries) | 34 | if (trace->nr_entries >= trace->max_entries) |
36 | return sp; | 35 | return sp; |
37 | low = sp; | 36 | low = sp; |
@@ -48,10 +47,10 @@ static unsigned long save_context_stack(struct stack_trace *trace, | |||
48 | return sp; | 47 | return sp; |
49 | regs = (struct pt_regs *)sp; | 48 | regs = (struct pt_regs *)sp; |
50 | addr = regs->psw.addr & PSW_ADDR_INSN; | 49 | addr = regs->psw.addr & PSW_ADDR_INSN; |
51 | if (!(*skip)) | 50 | if (!trace->skip) |
52 | trace->entries[trace->nr_entries++] = addr; | 51 | trace->entries[trace->nr_entries++] = addr; |
53 | else | 52 | else |
54 | (*skip)--; | 53 | trace->skip--; |
55 | if (trace->nr_entries >= trace->max_entries) | 54 | if (trace->nr_entries >= trace->max_entries) |
56 | return sp; | 55 | return sp; |
57 | low = sp; | 56 | low = sp; |
@@ -65,20 +64,17 @@ void save_stack_trace(struct stack_trace *trace) | |||
65 | unsigned long orig_sp, new_sp; | 64 | unsigned long orig_sp, new_sp; |
66 | 65 | ||
67 | orig_sp = sp & PSW_ADDR_INSN; | 66 | orig_sp = sp & PSW_ADDR_INSN; |
68 | 67 | new_sp = save_context_stack(trace, orig_sp, | |
69 | new_sp = save_context_stack(trace, &trace->skip, orig_sp, | 68 | S390_lowcore.panic_stack - PAGE_SIZE, |
70 | S390_lowcore.panic_stack - PAGE_SIZE, | 69 | S390_lowcore.panic_stack); |
71 | S390_lowcore.panic_stack); | ||
72 | if (new_sp != orig_sp) | 70 | if (new_sp != orig_sp) |
73 | return; | 71 | return; |
74 | new_sp = save_context_stack(trace, &trace->skip, new_sp, | 72 | new_sp = save_context_stack(trace, new_sp, |
75 | S390_lowcore.async_stack - ASYNC_SIZE, | 73 | S390_lowcore.async_stack - ASYNC_SIZE, |
76 | S390_lowcore.async_stack); | 74 | S390_lowcore.async_stack); |
77 | if (new_sp != orig_sp) | 75 | if (new_sp != orig_sp) |
78 | return; | 76 | return; |
79 | 77 | save_context_stack(trace, new_sp, | |
80 | save_context_stack(trace, &trace->skip, new_sp, | ||
81 | S390_lowcore.thread_info, | 78 | S390_lowcore.thread_info, |
82 | S390_lowcore.thread_info + THREAD_SIZE); | 79 | S390_lowcore.thread_info + THREAD_SIZE); |
83 | return; | ||
84 | } | 80 | } |
diff --git a/drivers/s390/char/Kconfig b/drivers/s390/char/Kconfig index 66102a184322..a3d095de5d7d 100644 --- a/drivers/s390/char/Kconfig +++ b/drivers/s390/char/Kconfig | |||
@@ -164,3 +164,9 @@ config MONWRITER | |||
164 | help | 164 | help |
165 | Character device driver for writing z/VM monitor service records | 165 | Character device driver for writing z/VM monitor service records |
166 | 166 | ||
167 | config S390_VMUR | ||
168 | tristate "z/VM unit record device driver" | ||
169 | default "m" | ||
170 | help | ||
171 | Character device driver for z/VM reader, puncher and printer. | ||
172 | |||
diff --git a/drivers/s390/char/Makefile b/drivers/s390/char/Makefile index c210784bdf46..130de19916f2 100644 --- a/drivers/s390/char/Makefile +++ b/drivers/s390/char/Makefile | |||
@@ -29,6 +29,7 @@ obj-$(CONFIG_S390_TAPE_34XX) += tape_34xx.o | |||
29 | obj-$(CONFIG_S390_TAPE_3590) += tape_3590.o | 29 | obj-$(CONFIG_S390_TAPE_3590) += tape_3590.o |
30 | obj-$(CONFIG_MONREADER) += monreader.o | 30 | obj-$(CONFIG_MONREADER) += monreader.o |
31 | obj-$(CONFIG_MONWRITER) += monwriter.o | 31 | obj-$(CONFIG_MONWRITER) += monwriter.o |
32 | obj-$(CONFIG_S390_VMUR) += vmur.o | ||
32 | 33 | ||
33 | zcore_mod-objs := sclp_sdias.o zcore.o | 34 | zcore_mod-objs := sclp_sdias.o zcore.o |
34 | obj-$(CONFIG_ZFCPDUMP) += zcore_mod.o | 35 | obj-$(CONFIG_ZFCPDUMP) += zcore_mod.o |
diff --git a/drivers/s390/char/vmcp.c b/drivers/s390/char/vmcp.c index 82e6a6b253eb..2f419b0ea628 100644 --- a/drivers/s390/char/vmcp.c +++ b/drivers/s390/char/vmcp.c | |||
@@ -1,7 +1,7 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (C) 2004,2005 IBM Corporation | 2 | * Copyright IBM Corp. 2004,2007 |
3 | * Interface implementation for communication with the z/VM control program | 3 | * Interface implementation for communication with the z/VM control program |
4 | * Author(s): Christian Borntraeger <cborntra@de.ibm.com> | 4 | * Author(s): Christian Borntraeger <borntraeger@de.ibm.com> |
5 | * | 5 | * |
6 | * | 6 | * |
7 | * z/VMs CP offers the possibility to issue commands via the diagnose code 8 | 7 | * z/VMs CP offers the possibility to issue commands via the diagnose code 8 |
@@ -22,9 +22,11 @@ | |||
22 | #include "vmcp.h" | 22 | #include "vmcp.h" |
23 | 23 | ||
24 | MODULE_LICENSE("GPL"); | 24 | MODULE_LICENSE("GPL"); |
25 | MODULE_AUTHOR("Christian Borntraeger <cborntra@de.ibm.com>"); | 25 | MODULE_AUTHOR("Christian Borntraeger <borntraeger@de.ibm.com>"); |
26 | MODULE_DESCRIPTION("z/VM CP interface"); | 26 | MODULE_DESCRIPTION("z/VM CP interface"); |
27 | 27 | ||
28 | #define PRINTK_HEADER "vmcp: " | ||
29 | |||
28 | static debug_info_t *vmcp_debug; | 30 | static debug_info_t *vmcp_debug; |
29 | 31 | ||
30 | static int vmcp_open(struct inode *inode, struct file *file) | 32 | static int vmcp_open(struct inode *inode, struct file *file) |
@@ -40,7 +42,7 @@ static int vmcp_open(struct inode *inode, struct file *file) | |||
40 | session->bufsize = PAGE_SIZE; | 42 | session->bufsize = PAGE_SIZE; |
41 | session->response = NULL; | 43 | session->response = NULL; |
42 | session->resp_size = 0; | 44 | session->resp_size = 0; |
43 | init_MUTEX(&session->mutex); | 45 | mutex_init(&session->mutex); |
44 | file->private_data = session; | 46 | file->private_data = session; |
45 | return nonseekable_open(inode, file); | 47 | return nonseekable_open(inode, file); |
46 | } | 48 | } |
@@ -57,37 +59,37 @@ static int vmcp_release(struct inode *inode, struct file *file) | |||
57 | } | 59 | } |
58 | 60 | ||
59 | static ssize_t | 61 | static ssize_t |
60 | vmcp_read(struct file *file, char __user * buff, size_t count, loff_t * ppos) | 62 | vmcp_read(struct file *file, char __user *buff, size_t count, loff_t *ppos) |
61 | { | 63 | { |
62 | size_t tocopy; | 64 | size_t tocopy; |
63 | struct vmcp_session *session; | 65 | struct vmcp_session *session; |
64 | 66 | ||
65 | session = (struct vmcp_session *)file->private_data; | 67 | session = (struct vmcp_session *)file->private_data; |
66 | if (down_interruptible(&session->mutex)) | 68 | if (mutex_lock_interruptible(&session->mutex)) |
67 | return -ERESTARTSYS; | 69 | return -ERESTARTSYS; |
68 | if (!session->response) { | 70 | if (!session->response) { |
69 | up(&session->mutex); | 71 | mutex_unlock(&session->mutex); |
70 | return 0; | 72 | return 0; |
71 | } | 73 | } |
72 | if (*ppos > session->resp_size) { | 74 | if (*ppos > session->resp_size) { |
73 | up(&session->mutex); | 75 | mutex_unlock(&session->mutex); |
74 | return 0; | 76 | return 0; |
75 | } | 77 | } |
76 | tocopy = min(session->resp_size - (size_t) (*ppos), count); | 78 | tocopy = min(session->resp_size - (size_t) (*ppos), count); |
77 | tocopy = min(tocopy,session->bufsize - (size_t) (*ppos)); | 79 | tocopy = min(tocopy, session->bufsize - (size_t) (*ppos)); |
78 | 80 | ||
79 | if (copy_to_user(buff, session->response + (*ppos), tocopy)) { | 81 | if (copy_to_user(buff, session->response + (*ppos), tocopy)) { |
80 | up(&session->mutex); | 82 | mutex_unlock(&session->mutex); |
81 | return -EFAULT; | 83 | return -EFAULT; |
82 | } | 84 | } |
83 | up(&session->mutex); | 85 | mutex_unlock(&session->mutex); |
84 | *ppos += tocopy; | 86 | *ppos += tocopy; |
85 | return tocopy; | 87 | return tocopy; |
86 | } | 88 | } |
87 | 89 | ||
88 | static ssize_t | 90 | static ssize_t |
89 | vmcp_write(struct file *file, const char __user * buff, size_t count, | 91 | vmcp_write(struct file *file, const char __user *buff, size_t count, |
90 | loff_t * ppos) | 92 | loff_t *ppos) |
91 | { | 93 | { |
92 | char *cmd; | 94 | char *cmd; |
93 | struct vmcp_session *session; | 95 | struct vmcp_session *session; |
@@ -103,24 +105,23 @@ vmcp_write(struct file *file, const char __user * buff, size_t count, | |||
103 | } | 105 | } |
104 | cmd[count] = '\0'; | 106 | cmd[count] = '\0'; |
105 | session = (struct vmcp_session *)file->private_data; | 107 | session = (struct vmcp_session *)file->private_data; |
106 | if (down_interruptible(&session->mutex)) { | 108 | if (mutex_lock_interruptible(&session->mutex)) { |
107 | kfree(cmd); | 109 | kfree(cmd); |
108 | return -ERESTARTSYS; | 110 | return -ERESTARTSYS; |
109 | } | 111 | } |
110 | if (!session->response) | 112 | if (!session->response) |
111 | session->response = (char *)__get_free_pages(GFP_KERNEL | 113 | session->response = (char *)__get_free_pages(GFP_KERNEL |
112 | | __GFP_REPEAT | GFP_DMA, | 114 | | __GFP_REPEAT | GFP_DMA, |
113 | get_order(session->bufsize)); | 115 | get_order(session->bufsize)); |
114 | if (!session->response) { | 116 | if (!session->response) { |
115 | up(&session->mutex); | 117 | mutex_unlock(&session->mutex); |
116 | kfree(cmd); | 118 | kfree(cmd); |
117 | return -ENOMEM; | 119 | return -ENOMEM; |
118 | } | 120 | } |
119 | debug_text_event(vmcp_debug, 1, cmd); | 121 | debug_text_event(vmcp_debug, 1, cmd); |
120 | session->resp_size = cpcmd(cmd, session->response, | 122 | session->resp_size = cpcmd(cmd, session->response, session->bufsize, |
121 | session->bufsize, | 123 | &session->resp_code); |
122 | &session->resp_code); | 124 | mutex_unlock(&session->mutex); |
123 | up(&session->mutex); | ||
124 | kfree(cmd); | 125 | kfree(cmd); |
125 | *ppos = 0; /* reset the file pointer after a command */ | 126 | *ppos = 0; /* reset the file pointer after a command */ |
126 | return count; | 127 | return count; |
@@ -145,12 +146,12 @@ static long vmcp_ioctl(struct file *file, unsigned int cmd, unsigned long arg) | |||
145 | int temp; | 146 | int temp; |
146 | 147 | ||
147 | session = (struct vmcp_session *)file->private_data; | 148 | session = (struct vmcp_session *)file->private_data; |
148 | if (down_interruptible(&session->mutex)) | 149 | if (mutex_lock_interruptible(&session->mutex)) |
149 | return -ERESTARTSYS; | 150 | return -ERESTARTSYS; |
150 | switch (cmd) { | 151 | switch (cmd) { |
151 | case VMCP_GETCODE: | 152 | case VMCP_GETCODE: |
152 | temp = session->resp_code; | 153 | temp = session->resp_code; |
153 | up(&session->mutex); | 154 | mutex_unlock(&session->mutex); |
154 | return put_user(temp, (int __user *)arg); | 155 | return put_user(temp, (int __user *)arg); |
155 | case VMCP_SETBUF: | 156 | case VMCP_SETBUF: |
156 | free_pages((unsigned long)session->response, | 157 | free_pages((unsigned long)session->response, |
@@ -161,14 +162,14 @@ static long vmcp_ioctl(struct file *file, unsigned int cmd, unsigned long arg) | |||
161 | session->bufsize = PAGE_SIZE; | 162 | session->bufsize = PAGE_SIZE; |
162 | temp = -EINVAL; | 163 | temp = -EINVAL; |
163 | } | 164 | } |
164 | up(&session->mutex); | 165 | mutex_unlock(&session->mutex); |
165 | return temp; | 166 | return temp; |
166 | case VMCP_GETSIZE: | 167 | case VMCP_GETSIZE: |
167 | temp = session->resp_size; | 168 | temp = session->resp_size; |
168 | up(&session->mutex); | 169 | mutex_unlock(&session->mutex); |
169 | return put_user(temp, (int __user *)arg); | 170 | return put_user(temp, (int __user *)arg); |
170 | default: | 171 | default: |
171 | up(&session->mutex); | 172 | mutex_unlock(&session->mutex); |
172 | return -ENOIOCTLCMD; | 173 | return -ENOIOCTLCMD; |
173 | } | 174 | } |
174 | } | 175 | } |
@@ -180,7 +181,7 @@ static const struct file_operations vmcp_fops = { | |||
180 | .read = vmcp_read, | 181 | .read = vmcp_read, |
181 | .write = vmcp_write, | 182 | .write = vmcp_write, |
182 | .unlocked_ioctl = vmcp_ioctl, | 183 | .unlocked_ioctl = vmcp_ioctl, |
183 | .compat_ioctl = vmcp_ioctl | 184 | .compat_ioctl = vmcp_ioctl, |
184 | }; | 185 | }; |
185 | 186 | ||
186 | static struct miscdevice vmcp_dev = { | 187 | static struct miscdevice vmcp_dev = { |
@@ -194,26 +195,38 @@ static int __init vmcp_init(void) | |||
194 | int ret; | 195 | int ret; |
195 | 196 | ||
196 | if (!MACHINE_IS_VM) { | 197 | if (!MACHINE_IS_VM) { |
197 | printk(KERN_WARNING | 198 | PRINT_WARN("z/VM CP interface is only available under z/VM\n"); |
198 | "z/VM CP interface is only available under z/VM\n"); | ||
199 | return -ENODEV; | 199 | return -ENODEV; |
200 | } | 200 | } |
201 | ret = misc_register(&vmcp_dev); | ||
202 | if (!ret) | ||
203 | printk(KERN_INFO "z/VM CP interface loaded\n"); | ||
204 | else | ||
205 | printk(KERN_WARNING | ||
206 | "z/VM CP interface not loaded. Could not register misc device.\n"); | ||
207 | vmcp_debug = debug_register("vmcp", 1, 1, 240); | 201 | vmcp_debug = debug_register("vmcp", 1, 1, 240); |
208 | debug_register_view(vmcp_debug, &debug_hex_ascii_view); | 202 | if (!vmcp_debug) { |
209 | return ret; | 203 | PRINT_ERR("z/VM CP interface not loaded. Could not register " |
204 | "debug feature\n"); | ||
205 | return -ENOMEM; | ||
206 | } | ||
207 | ret = debug_register_view(vmcp_debug, &debug_hex_ascii_view); | ||
208 | if (ret) { | ||
209 | PRINT_ERR("z/VM CP interface not loaded. Could not register " | ||
210 | "debug feature view. Error code: %d\n", ret); | ||
211 | debug_unregister(vmcp_debug); | ||
212 | return ret; | ||
213 | } | ||
214 | ret = misc_register(&vmcp_dev); | ||
215 | if (ret) { | ||
216 | PRINT_ERR("z/VM CP interface not loaded. Could not register " | ||
217 | "misc device. Error code: %d\n", ret); | ||
218 | debug_unregister(vmcp_debug); | ||
219 | return ret; | ||
220 | } | ||
221 | PRINT_INFO("z/VM CP interface loaded\n"); | ||
222 | return 0; | ||
210 | } | 223 | } |
211 | 224 | ||
212 | static void __exit vmcp_exit(void) | 225 | static void __exit vmcp_exit(void) |
213 | { | 226 | { |
214 | WARN_ON(misc_deregister(&vmcp_dev) != 0); | 227 | misc_deregister(&vmcp_dev); |
215 | debug_unregister(vmcp_debug); | 228 | debug_unregister(vmcp_debug); |
216 | printk(KERN_INFO "z/VM CP interface unloaded.\n"); | 229 | PRINT_INFO("z/VM CP interface unloaded.\n"); |
217 | } | 230 | } |
218 | 231 | ||
219 | module_init(vmcp_init); | 232 | module_init(vmcp_init); |
diff --git a/drivers/s390/char/vmcp.h b/drivers/s390/char/vmcp.h index 8a5975f3dad7..6a993948e188 100644 --- a/drivers/s390/char/vmcp.h +++ b/drivers/s390/char/vmcp.h | |||
@@ -12,8 +12,8 @@ | |||
12 | * The idea of this driver is based on cpint from Neale Ferguson | 12 | * The idea of this driver is based on cpint from Neale Ferguson |
13 | */ | 13 | */ |
14 | 14 | ||
15 | #include <asm/semaphore.h> | ||
16 | #include <linux/ioctl.h> | 15 | #include <linux/ioctl.h> |
16 | #include <linux/mutex.h> | ||
17 | 17 | ||
18 | #define VMCP_GETCODE _IOR(0x10, 1, int) | 18 | #define VMCP_GETCODE _IOR(0x10, 1, int) |
19 | #define VMCP_SETBUF _IOW(0x10, 2, int) | 19 | #define VMCP_SETBUF _IOW(0x10, 2, int) |
@@ -26,5 +26,5 @@ struct vmcp_session { | |||
26 | int resp_code; | 26 | int resp_code; |
27 | /* As we use copy_from/to_user, which might * | 27 | /* As we use copy_from/to_user, which might * |
28 | * sleep and cannot use a spinlock */ | 28 | * sleep and cannot use a spinlock */ |
29 | struct semaphore mutex; | 29 | struct mutex mutex; |
30 | }; | 30 | }; |
diff --git a/drivers/s390/char/vmur.c b/drivers/s390/char/vmur.c new file mode 100644 index 000000000000..e90b0f846195 --- /dev/null +++ b/drivers/s390/char/vmur.c | |||
@@ -0,0 +1,906 @@ | |||
1 | /* | ||
2 | * Linux driver for System z and s390 unit record devices | ||
3 | * (z/VM virtual punch, reader, printer) | ||
4 | * | ||
5 | * Copyright IBM Corp. 2001, 2007 | ||
6 | * Authors: Malcolm Beattie <beattiem@uk.ibm.com> | ||
7 | * Michael Holzheu <holzheu@de.ibm.com> | ||
8 | * Frank Munzert <munzert@de.ibm.com> | ||
9 | */ | ||
10 | |||
11 | #include <linux/cdev.h> | ||
12 | |||
13 | #include <asm/uaccess.h> | ||
14 | #include <asm/cio.h> | ||
15 | #include <asm/ccwdev.h> | ||
16 | #include <asm/debug.h> | ||
17 | |||
18 | #include "vmur.h" | ||
19 | |||
20 | /* | ||
21 | * Driver overview | ||
22 | * | ||
23 | * Unit record device support is implemented as a character device driver. | ||
24 | * We can fit at least 16 bits into a device minor number and use the | ||
25 | * simple method of mapping a character device number with minor abcd | ||
26 | * to the unit record device with devno abcd. | ||
27 | * I/O to virtual unit record devices is handled as follows: | ||
28 | * Reads: Diagnose code 0x14 (input spool file manipulation) | ||
29 | * is used to read spool data page-wise. | ||
30 | * Writes: The CCW used is WRITE_CCW_CMD (0x01). The device's record length | ||
31 | * is available by reading sysfs attr reclen. Each write() to the device | ||
32 | * must specify an integral multiple (maximal 511) of reclen. | ||
33 | */ | ||
34 | |||
35 | static char ur_banner[] = "z/VM virtual unit record device driver"; | ||
36 | |||
37 | MODULE_AUTHOR("IBM Corporation"); | ||
38 | MODULE_DESCRIPTION("s390 z/VM virtual unit record device driver"); | ||
39 | MODULE_LICENSE("GPL"); | ||
40 | |||
41 | #define PRINTK_HEADER "vmur: " | ||
42 | |||
43 | static dev_t ur_first_dev_maj_min; | ||
44 | static struct class *vmur_class; | ||
45 | static struct debug_info *vmur_dbf; | ||
46 | |||
47 | /* We put the device's record length (for writes) in the driver_info field */ | ||
48 | static struct ccw_device_id ur_ids[] = { | ||
49 | { CCWDEV_CU_DI(READER_PUNCH_DEVTYPE, 80) }, | ||
50 | { CCWDEV_CU_DI(PRINTER_DEVTYPE, 132) }, | ||
51 | { /* end of list */ } | ||
52 | }; | ||
53 | |||
54 | MODULE_DEVICE_TABLE(ccw, ur_ids); | ||
55 | |||
56 | static int ur_probe(struct ccw_device *cdev); | ||
57 | static void ur_remove(struct ccw_device *cdev); | ||
58 | static int ur_set_online(struct ccw_device *cdev); | ||
59 | static int ur_set_offline(struct ccw_device *cdev); | ||
60 | |||
61 | static struct ccw_driver ur_driver = { | ||
62 | .name = "vmur", | ||
63 | .owner = THIS_MODULE, | ||
64 | .ids = ur_ids, | ||
65 | .probe = ur_probe, | ||
66 | .remove = ur_remove, | ||
67 | .set_online = ur_set_online, | ||
68 | .set_offline = ur_set_offline, | ||
69 | }; | ||
70 | |||
71 | /* | ||
72 | * Allocation, freeing, getting and putting of urdev structures | ||
73 | */ | ||
74 | static struct urdev *urdev_alloc(struct ccw_device *cdev) | ||
75 | { | ||
76 | struct urdev *urd; | ||
77 | |||
78 | urd = kzalloc(sizeof(struct urdev), GFP_KERNEL); | ||
79 | if (!urd) | ||
80 | return NULL; | ||
81 | urd->cdev = cdev; | ||
82 | urd->reclen = cdev->id.driver_info; | ||
83 | ccw_device_get_id(cdev, &urd->dev_id); | ||
84 | mutex_init(&urd->io_mutex); | ||
85 | mutex_init(&urd->open_mutex); | ||
86 | return urd; | ||
87 | } | ||
88 | |||
89 | static void urdev_free(struct urdev *urd) | ||
90 | { | ||
91 | kfree(urd); | ||
92 | } | ||
93 | |||
94 | /* | ||
95 | * This is how the character device driver gets a reference to a | ||
96 | * ur device. When this call returns successfully, a reference has | ||
97 | * been taken (by get_device) on the underlying kobject. The recipient | ||
98 | * of this urdev pointer must eventually drop it with urdev_put(urd) | ||
99 | * which does the corresponding put_device(). | ||
100 | */ | ||
101 | static struct urdev *urdev_get_from_devno(u16 devno) | ||
102 | { | ||
103 | char bus_id[16]; | ||
104 | struct ccw_device *cdev; | ||
105 | |||
106 | sprintf(bus_id, "0.0.%04x", devno); | ||
107 | cdev = get_ccwdev_by_busid(&ur_driver, bus_id); | ||
108 | if (!cdev) | ||
109 | return NULL; | ||
110 | |||
111 | return cdev->dev.driver_data; | ||
112 | } | ||
113 | |||
114 | static void urdev_put(struct urdev *urd) | ||
115 | { | ||
116 | put_device(&urd->cdev->dev); | ||
117 | } | ||
118 | |||
119 | /* | ||
120 | * Low-level functions to do I/O to a ur device. | ||
121 | * alloc_chan_prog | ||
122 | * do_ur_io | ||
123 | * ur_int_handler | ||
124 | * | ||
125 | * alloc_chan_prog allocates and builds the channel program | ||
126 | * | ||
127 | * do_ur_io issues the channel program to the device and blocks waiting | ||
128 | * on a completion event it publishes at urd->io_done. The function | ||
129 | * serialises itself on the device's mutex so that only one I/O | ||
130 | * is issued at a time (and that I/O is synchronous). | ||
131 | * | ||
132 | * ur_int_handler catches the "I/O done" interrupt, writes the | ||
133 | * subchannel status word into the scsw member of the urdev structure | ||
134 | * and complete()s the io_done to wake the waiting do_ur_io. | ||
135 | * | ||
136 | * The caller of do_ur_io is responsible for kfree()ing the channel program | ||
137 | * address pointer that alloc_chan_prog returned. | ||
138 | */ | ||
139 | |||
140 | |||
141 | /* | ||
142 | * alloc_chan_prog | ||
143 | * The channel program we use is write commands chained together | ||
144 | * with a final NOP CCW command-chained on (which ensures that CE and DE | ||
145 | * are presented together in a single interrupt instead of as separate | ||
146 | * interrupts unless an incorrect length indication kicks in first). The | ||
147 | * data length in each CCW is reclen. The caller must ensure that count | ||
148 | * is an integral multiple of reclen. | ||
149 | * The channel program pointer returned by this function must be freed | ||
150 | * with kfree. The caller is responsible for checking that | ||
151 | * count/reclen is not ridiculously large. | ||
152 | */ | ||
153 | static struct ccw1 *alloc_chan_prog(char *buf, size_t count, size_t reclen) | ||
154 | { | ||
155 | size_t num_ccws; | ||
156 | struct ccw1 *cpa; | ||
157 | int i; | ||
158 | |||
159 | TRACE("alloc_chan_prog(%p, %zu, %zu)\n", buf, count, reclen); | ||
160 | |||
161 | /* | ||
162 | * We chain a NOP onto the writes to force CE+DE together. | ||
163 | * That means we allocate room for CCWs to cover count/reclen | ||
164 | * records plus a NOP. | ||
165 | */ | ||
166 | num_ccws = count / reclen + 1; | ||
167 | cpa = kmalloc(num_ccws * sizeof(struct ccw1), GFP_KERNEL | GFP_DMA); | ||
168 | if (!cpa) | ||
169 | return NULL; | ||
170 | |||
171 | for (i = 0; count; i++) { | ||
172 | cpa[i].cmd_code = WRITE_CCW_CMD; | ||
173 | cpa[i].flags = CCW_FLAG_CC | CCW_FLAG_SLI; | ||
174 | cpa[i].count = reclen; | ||
175 | cpa[i].cda = __pa(buf); | ||
176 | buf += reclen; | ||
177 | count -= reclen; | ||
178 | } | ||
179 | /* The following NOP CCW forces CE+DE to be presented together */ | ||
180 | cpa[i].cmd_code = CCW_CMD_NOOP; | ||
181 | cpa[i].flags = 0; | ||
182 | cpa[i].count = 0; | ||
183 | cpa[i].cda = 0; | ||
184 | |||
185 | return cpa; | ||
186 | } | ||
187 | |||
188 | static int do_ur_io(struct urdev *urd, struct ccw1 *cpa) | ||
189 | { | ||
190 | int rc; | ||
191 | struct ccw_device *cdev = urd->cdev; | ||
192 | DECLARE_COMPLETION(event); | ||
193 | |||
194 | TRACE("do_ur_io: cpa=%p\n", cpa); | ||
195 | |||
196 | rc = mutex_lock_interruptible(&urd->io_mutex); | ||
197 | if (rc) | ||
198 | return rc; | ||
199 | |||
200 | urd->io_done = &event; | ||
201 | |||
202 | spin_lock_irq(get_ccwdev_lock(cdev)); | ||
203 | rc = ccw_device_start(cdev, cpa, 1, 0, 0); | ||
204 | spin_unlock_irq(get_ccwdev_lock(cdev)); | ||
205 | |||
206 | TRACE("do_ur_io: ccw_device_start returned %d\n", rc); | ||
207 | if (rc) | ||
208 | goto out; | ||
209 | |||
210 | wait_for_completion(&event); | ||
211 | TRACE("do_ur_io: I/O complete\n"); | ||
212 | rc = 0; | ||
213 | |||
214 | out: | ||
215 | mutex_unlock(&urd->io_mutex); | ||
216 | return rc; | ||
217 | } | ||
218 | |||
219 | /* | ||
220 | * ur interrupt handler, called from the ccw_device layer | ||
221 | */ | ||
222 | static void ur_int_handler(struct ccw_device *cdev, unsigned long intparm, | ||
223 | struct irb *irb) | ||
224 | { | ||
225 | struct urdev *urd; | ||
226 | |||
227 | TRACE("ur_int_handler: intparm=0x%lx cstat=%02x dstat=%02x res=%u\n", | ||
228 | intparm, irb->scsw.cstat, irb->scsw.dstat, irb->scsw.count); | ||
229 | |||
230 | if (!intparm) { | ||
231 | TRACE("ur_int_handler: unsolicited interrupt\n"); | ||
232 | return; | ||
233 | } | ||
234 | urd = cdev->dev.driver_data; | ||
235 | /* On special conditions irb is an error pointer */ | ||
236 | if (IS_ERR(irb)) | ||
237 | urd->io_request_rc = PTR_ERR(irb); | ||
238 | else if (irb->scsw.dstat == (DEV_STAT_CHN_END | DEV_STAT_DEV_END)) | ||
239 | urd->io_request_rc = 0; | ||
240 | else | ||
241 | urd->io_request_rc = -EIO; | ||
242 | |||
243 | complete(urd->io_done); | ||
244 | } | ||
245 | |||
246 | /* | ||
247 | * reclen sysfs attribute - The record length to be used for write CCWs | ||
248 | */ | ||
249 | static ssize_t ur_attr_reclen_show(struct device *dev, | ||
250 | struct device_attribute *attr, char *buf) | ||
251 | { | ||
252 | struct urdev *urd = dev->driver_data; | ||
253 | |||
254 | return sprintf(buf, "%zu\n", urd->reclen); | ||
255 | } | ||
256 | |||
257 | static DEVICE_ATTR(reclen, 0444, ur_attr_reclen_show, NULL); | ||
258 | |||
259 | static int ur_create_attributes(struct device *dev) | ||
260 | { | ||
261 | return device_create_file(dev, &dev_attr_reclen); | ||
262 | } | ||
263 | |||
264 | static void ur_remove_attributes(struct device *dev) | ||
265 | { | ||
266 | device_remove_file(dev, &dev_attr_reclen); | ||
267 | } | ||
268 | |||
269 | /* | ||
270 | * diagnose code 0x210 - retrieve device information | ||
271 | * cc=0 normal completion, we have a real device | ||
272 | * cc=1 CP paging error | ||
273 | * cc=2 The virtual device exists, but is not associated with a real device | ||
274 | * cc=3 Invalid device address, or the virtual device does not exist | ||
275 | */ | ||
276 | static int get_urd_class(struct urdev *urd) | ||
277 | { | ||
278 | static struct diag210 ur_diag210; | ||
279 | int cc; | ||
280 | |||
281 | ur_diag210.vrdcdvno = urd->dev_id.devno; | ||
282 | ur_diag210.vrdclen = sizeof(struct diag210); | ||
283 | |||
284 | cc = diag210(&ur_diag210); | ||
285 | switch (cc) { | ||
286 | case 0: | ||
287 | return -ENOTSUPP; | ||
288 | case 2: | ||
289 | return ur_diag210.vrdcvcla; /* virtual device class */ | ||
290 | case 3: | ||
291 | return -ENODEV; | ||
292 | default: | ||
293 | return -EIO; | ||
294 | } | ||
295 | } | ||
296 | |||
297 | /* | ||
298 | * Allocation and freeing of urfile structures | ||
299 | */ | ||
300 | static struct urfile *urfile_alloc(struct urdev *urd) | ||
301 | { | ||
302 | struct urfile *urf; | ||
303 | |||
304 | urf = kzalloc(sizeof(struct urfile), GFP_KERNEL); | ||
305 | if (!urf) | ||
306 | return NULL; | ||
307 | urf->urd = urd; | ||
308 | |||
309 | TRACE("urfile_alloc: urd=%p urf=%p rl=%zu\n", urd, urf, | ||
310 | urf->dev_reclen); | ||
311 | |||
312 | return urf; | ||
313 | } | ||
314 | |||
315 | static void urfile_free(struct urfile *urf) | ||
316 | { | ||
317 | TRACE("urfile_free: urf=%p urd=%p\n", urf, urf->urd); | ||
318 | kfree(urf); | ||
319 | } | ||
320 | |||
321 | /* | ||
322 | * The fops implementation of the character device driver | ||
323 | */ | ||
324 | static ssize_t do_write(struct urdev *urd, const char __user *udata, | ||
325 | size_t count, size_t reclen, loff_t *ppos) | ||
326 | { | ||
327 | struct ccw1 *cpa; | ||
328 | char *buf; | ||
329 | int rc; | ||
330 | |||
331 | /* Data buffer must be under 2GB line for fmt1 CCWs: hence GFP_DMA */ | ||
332 | buf = kmalloc(count, GFP_KERNEL | GFP_DMA); | ||
333 | if (!buf) | ||
334 | return -ENOMEM; | ||
335 | |||
336 | if (copy_from_user(buf, udata, count)) { | ||
337 | rc = -EFAULT; | ||
338 | goto fail_kfree_buf; | ||
339 | } | ||
340 | |||
341 | cpa = alloc_chan_prog(buf, count, reclen); | ||
342 | if (!cpa) { | ||
343 | rc = -ENOMEM; | ||
344 | goto fail_kfree_buf; | ||
345 | } | ||
346 | |||
347 | rc = do_ur_io(urd, cpa); | ||
348 | if (rc) | ||
349 | goto fail_kfree_cpa; | ||
350 | |||
351 | if (urd->io_request_rc) { | ||
352 | rc = urd->io_request_rc; | ||
353 | goto fail_kfree_cpa; | ||
354 | } | ||
355 | *ppos += count; | ||
356 | rc = count; | ||
357 | fail_kfree_cpa: | ||
358 | kfree(cpa); | ||
359 | fail_kfree_buf: | ||
360 | kfree(buf); | ||
361 | return rc; | ||
362 | } | ||
363 | |||
364 | static ssize_t ur_write(struct file *file, const char __user *udata, | ||
365 | size_t count, loff_t *ppos) | ||
366 | { | ||
367 | struct urfile *urf = file->private_data; | ||
368 | |||
369 | TRACE("ur_write: count=%zu\n", count); | ||
370 | |||
371 | if (count == 0) | ||
372 | return 0; | ||
373 | |||
374 | if (count % urf->dev_reclen) | ||
375 | return -EINVAL; /* count must be a multiple of reclen */ | ||
376 | |||
377 | if (count > urf->dev_reclen * MAX_RECS_PER_IO) | ||
378 | count = urf->dev_reclen * MAX_RECS_PER_IO; | ||
379 | |||
380 | return do_write(urf->urd, udata, count, urf->dev_reclen, ppos); | ||
381 | } | ||
382 | |||
383 | static int do_diag_14(unsigned long rx, unsigned long ry1, | ||
384 | unsigned long subcode) | ||
385 | { | ||
386 | register unsigned long _ry1 asm("2") = ry1; | ||
387 | register unsigned long _ry2 asm("3") = subcode; | ||
388 | int rc = 0; | ||
389 | |||
390 | asm volatile( | ||
391 | #ifdef CONFIG_64BIT | ||
392 | " sam31\n" | ||
393 | " diag %2,2,0x14\n" | ||
394 | " sam64\n" | ||
395 | #else | ||
396 | " diag %2,2,0x14\n" | ||
397 | #endif | ||
398 | " ipm %0\n" | ||
399 | " srl %0,28\n" | ||
400 | : "=d" (rc), "+d" (_ry2) | ||
401 | : "d" (rx), "d" (_ry1) | ||
402 | : "cc"); | ||
403 | |||
404 | TRACE("diag 14: subcode=0x%lx, cc=%i\n", subcode, rc); | ||
405 | return rc; | ||
406 | } | ||
407 | |||
408 | /* | ||
409 | * diagnose code 0x14 subcode 0x0028 - position spool file to designated | ||
410 | * record | ||
411 | * cc=0 normal completion | ||
412 | * cc=2 no file active on the virtual reader or device not ready | ||
413 | * cc=3 record specified is beyond EOF | ||
414 | */ | ||
415 | static int diag_position_to_record(int devno, int record) | ||
416 | { | ||
417 | int cc; | ||
418 | |||
419 | cc = do_diag_14(record, devno, 0x28); | ||
420 | switch (cc) { | ||
421 | case 0: | ||
422 | return 0; | ||
423 | case 2: | ||
424 | return -ENOMEDIUM; | ||
425 | case 3: | ||
426 | return -ENODATA; /* position beyond end of file */ | ||
427 | default: | ||
428 | return -EIO; | ||
429 | } | ||
430 | } | ||
431 | |||
432 | /* | ||
433 | * diagnose code 0x14 subcode 0x0000 - read next spool file buffer | ||
434 | * cc=0 normal completion | ||
435 | * cc=1 EOF reached | ||
436 | * cc=2 no file active on the virtual reader, and no file eligible | ||
437 | * cc=3 file already active on the virtual reader or specified virtual | ||
438 | * reader does not exist or is not a reader | ||
439 | */ | ||
440 | static int diag_read_file(int devno, char *buf) | ||
441 | { | ||
442 | int cc; | ||
443 | |||
444 | cc = do_diag_14((unsigned long) buf, devno, 0x00); | ||
445 | switch (cc) { | ||
446 | case 0: | ||
447 | return 0; | ||
448 | case 1: | ||
449 | return -ENODATA; | ||
450 | case 2: | ||
451 | return -ENOMEDIUM; | ||
452 | default: | ||
453 | return -EIO; | ||
454 | } | ||
455 | } | ||
456 | |||
457 | static ssize_t diag14_read(struct file *file, char __user *ubuf, size_t count, | ||
458 | loff_t *offs) | ||
459 | { | ||
460 | size_t len, copied, res; | ||
461 | char *buf; | ||
462 | int rc; | ||
463 | u16 reclen; | ||
464 | struct urdev *urd; | ||
465 | |||
466 | urd = ((struct urfile *) file->private_data)->urd; | ||
467 | reclen = ((struct urfile *) file->private_data)->file_reclen; | ||
468 | |||
469 | rc = diag_position_to_record(urd->dev_id.devno, *offs / PAGE_SIZE + 1); | ||
470 | if (rc == -ENODATA) | ||
471 | return 0; | ||
472 | if (rc) | ||
473 | return rc; | ||
474 | |||
475 | len = min((size_t) PAGE_SIZE, count); | ||
476 | buf = kmalloc(PAGE_SIZE, GFP_KERNEL); | ||
477 | if (!buf) | ||
478 | return -ENOMEM; | ||
479 | |||
480 | copied = 0; | ||
481 | res = (size_t) (*offs % PAGE_SIZE); | ||
482 | do { | ||
483 | rc = diag_read_file(urd->dev_id.devno, buf); | ||
484 | if (rc == -ENODATA) { | ||
485 | break; | ||
486 | } | ||
487 | if (rc) | ||
488 | goto fail; | ||
489 | if (reclen) | ||
490 | *((u16 *) &buf[FILE_RECLEN_OFFSET]) = reclen; | ||
491 | len = min(count - copied, PAGE_SIZE - res); | ||
492 | if (copy_to_user(ubuf + copied, buf + res, len)) { | ||
493 | rc = -EFAULT; | ||
494 | goto fail; | ||
495 | } | ||
496 | res = 0; | ||
497 | copied += len; | ||
498 | } while (copied != count); | ||
499 | |||
500 | *offs += copied; | ||
501 | rc = copied; | ||
502 | fail: | ||
503 | kfree(buf); | ||
504 | return rc; | ||
505 | } | ||
506 | |||
507 | static ssize_t ur_read(struct file *file, char __user *ubuf, size_t count, | ||
508 | loff_t *offs) | ||
509 | { | ||
510 | struct urdev *urd; | ||
511 | int rc; | ||
512 | |||
513 | TRACE("ur_read: count=%zu ppos=%li\n", count, (unsigned long) *offs); | ||
514 | |||
515 | if (count == 0) | ||
516 | return 0; | ||
517 | |||
518 | urd = ((struct urfile *) file->private_data)->urd; | ||
519 | rc = mutex_lock_interruptible(&urd->io_mutex); | ||
520 | if (rc) | ||
521 | return rc; | ||
522 | rc = diag14_read(file, ubuf, count, offs); | ||
523 | mutex_unlock(&urd->io_mutex); | ||
524 | return rc; | ||
525 | } | ||
526 | |||
527 | /* | ||
528 | * diagnose code 0x14 subcode 0x0fff - retrieve next file descriptor | ||
529 | * cc=0 normal completion | ||
530 | * cc=1 no files on reader queue or no subsequent file | ||
531 | * cc=2 spid specified is invalid | ||
532 | */ | ||
533 | static int diag_read_next_file_info(struct file_control_block *buf, int spid) | ||
534 | { | ||
535 | int cc; | ||
536 | |||
537 | cc = do_diag_14((unsigned long) buf, spid, 0xfff); | ||
538 | switch (cc) { | ||
539 | case 0: | ||
540 | return 0; | ||
541 | default: | ||
542 | return -ENODATA; | ||
543 | } | ||
544 | } | ||
545 | |||
546 | static int verify_device(struct urdev *urd) | ||
547 | { | ||
548 | struct file_control_block fcb; | ||
549 | char *buf; | ||
550 | int rc; | ||
551 | |||
552 | switch (urd->class) { | ||
553 | case DEV_CLASS_UR_O: | ||
554 | return 0; /* no check needed here */ | ||
555 | case DEV_CLASS_UR_I: | ||
556 | /* check for empty reader device (beginning of chain) */ | ||
557 | rc = diag_read_next_file_info(&fcb, 0); | ||
558 | if (rc) | ||
559 | return rc; | ||
560 | |||
561 | /* open file on virtual reader */ | ||
562 | buf = kmalloc(PAGE_SIZE, GFP_KERNEL); | ||
563 | if (!buf) | ||
564 | return -ENOMEM; | ||
565 | rc = diag_read_file(urd->dev_id.devno, buf); | ||
566 | kfree(buf); | ||
567 | |||
568 | if ((rc != 0) && (rc != -ENODATA)) /* EOF does not hurt */ | ||
569 | return rc; | ||
570 | return 0; | ||
571 | default: | ||
572 | return -ENOTSUPP; | ||
573 | } | ||
574 | } | ||
575 | |||
576 | static int get_file_reclen(struct urdev *urd) | ||
577 | { | ||
578 | struct file_control_block fcb; | ||
579 | int rc; | ||
580 | |||
581 | switch (urd->class) { | ||
582 | case DEV_CLASS_UR_O: | ||
583 | return 0; | ||
584 | case DEV_CLASS_UR_I: | ||
585 | rc = diag_read_next_file_info(&fcb, 0); | ||
586 | if (rc) | ||
587 | return rc; | ||
588 | break; | ||
589 | default: | ||
590 | return -ENOTSUPP; | ||
591 | } | ||
592 | if (fcb.file_stat & FLG_CP_DUMP) | ||
593 | return 0; | ||
594 | |||
595 | return fcb.rec_len; | ||
596 | } | ||
597 | |||
598 | static int ur_open(struct inode *inode, struct file *file) | ||
599 | { | ||
600 | u16 devno; | ||
601 | struct urdev *urd; | ||
602 | struct urfile *urf; | ||
603 | unsigned short accmode; | ||
604 | int rc; | ||
605 | |||
606 | accmode = file->f_flags & O_ACCMODE; | ||
607 | |||
608 | if (accmode == O_RDWR) | ||
609 | return -EACCES; | ||
610 | |||
611 | /* | ||
612 | * We treat the minor number as the devno of the ur device | ||
613 | * to find in the driver tree. | ||
614 | */ | ||
615 | devno = MINOR(file->f_dentry->d_inode->i_rdev); | ||
616 | |||
617 | urd = urdev_get_from_devno(devno); | ||
618 | if (!urd) | ||
619 | return -ENXIO; | ||
620 | |||
621 | if (file->f_flags & O_NONBLOCK) { | ||
622 | if (!mutex_trylock(&urd->open_mutex)) { | ||
623 | rc = -EBUSY; | ||
624 | goto fail_put; | ||
625 | } | ||
626 | } else { | ||
627 | if (mutex_lock_interruptible(&urd->open_mutex)) { | ||
628 | rc = -ERESTARTSYS; | ||
629 | goto fail_put; | ||
630 | } | ||
631 | } | ||
632 | |||
633 | TRACE("ur_open\n"); | ||
634 | |||
635 | if (((accmode == O_RDONLY) && (urd->class != DEV_CLASS_UR_I)) || | ||
636 | ((accmode == O_WRONLY) && (urd->class != DEV_CLASS_UR_O))) { | ||
637 | TRACE("ur_open: unsupported dev class (%d)\n", urd->class); | ||
638 | rc = -EACCES; | ||
639 | goto fail_unlock; | ||
640 | } | ||
641 | |||
642 | rc = verify_device(urd); | ||
643 | if (rc) | ||
644 | goto fail_unlock; | ||
645 | |||
646 | urf = urfile_alloc(urd); | ||
647 | if (!urf) { | ||
648 | rc = -ENOMEM; | ||
649 | goto fail_unlock; | ||
650 | } | ||
651 | |||
652 | urf->dev_reclen = urd->reclen; | ||
653 | rc = get_file_reclen(urd); | ||
654 | if (rc < 0) | ||
655 | goto fail_urfile_free; | ||
656 | urf->file_reclen = rc; | ||
657 | file->private_data = urf; | ||
658 | return 0; | ||
659 | |||
660 | fail_urfile_free: | ||
661 | urfile_free(urf); | ||
662 | fail_unlock: | ||
663 | mutex_unlock(&urd->open_mutex); | ||
664 | fail_put: | ||
665 | urdev_put(urd); | ||
666 | return rc; | ||
667 | } | ||
668 | |||
669 | static int ur_release(struct inode *inode, struct file *file) | ||
670 | { | ||
671 | struct urfile *urf = file->private_data; | ||
672 | |||
673 | TRACE("ur_release\n"); | ||
674 | mutex_unlock(&urf->urd->open_mutex); | ||
675 | urdev_put(urf->urd); | ||
676 | urfile_free(urf); | ||
677 | return 0; | ||
678 | } | ||
679 | |||
680 | static loff_t ur_llseek(struct file *file, loff_t offset, int whence) | ||
681 | { | ||
682 | loff_t newpos; | ||
683 | |||
684 | if ((file->f_flags & O_ACCMODE) != O_RDONLY) | ||
685 | return -ESPIPE; /* seek allowed only for reader */ | ||
686 | if (offset % PAGE_SIZE) | ||
687 | return -ESPIPE; /* only multiples of 4K allowed */ | ||
688 | switch (whence) { | ||
689 | case 0: /* SEEK_SET */ | ||
690 | newpos = offset; | ||
691 | break; | ||
692 | case 1: /* SEEK_CUR */ | ||
693 | newpos = file->f_pos + offset; | ||
694 | break; | ||
695 | default: | ||
696 | return -EINVAL; | ||
697 | } | ||
698 | file->f_pos = newpos; | ||
699 | return newpos; | ||
700 | } | ||
701 | |||
702 | static struct file_operations ur_fops = { | ||
703 | .owner = THIS_MODULE, | ||
704 | .open = ur_open, | ||
705 | .release = ur_release, | ||
706 | .read = ur_read, | ||
707 | .write = ur_write, | ||
708 | .llseek = ur_llseek, | ||
709 | }; | ||
710 | |||
711 | /* | ||
712 | * ccw_device infrastructure: | ||
713 | * ur_probe gets its own ref to the device (i.e. get_device), | ||
714 | * creates the struct urdev, the device attributes, sets up | ||
715 | * the interrupt handler and validates the virtual unit record device. | ||
716 | * ur_remove removes the device attributes, frees the struct urdev | ||
717 | * and drops (put_device) the ref to the device we got in ur_probe. | ||
718 | */ | ||
719 | static int ur_probe(struct ccw_device *cdev) | ||
720 | { | ||
721 | struct urdev *urd; | ||
722 | int rc; | ||
723 | |||
724 | TRACE("ur_probe: cdev=%p state=%d\n", cdev, *(int *) cdev->private); | ||
725 | |||
726 | if (!get_device(&cdev->dev)) | ||
727 | return -ENODEV; | ||
728 | |||
729 | urd = urdev_alloc(cdev); | ||
730 | if (!urd) { | ||
731 | rc = -ENOMEM; | ||
732 | goto fail; | ||
733 | } | ||
734 | rc = ur_create_attributes(&cdev->dev); | ||
735 | if (rc) { | ||
736 | rc = -ENOMEM; | ||
737 | goto fail; | ||
738 | } | ||
739 | cdev->dev.driver_data = urd; | ||
740 | cdev->handler = ur_int_handler; | ||
741 | |||
742 | /* validate virtual unit record device */ | ||
743 | urd->class = get_urd_class(urd); | ||
744 | if (urd->class < 0) { | ||
745 | rc = urd->class; | ||
746 | goto fail; | ||
747 | } | ||
748 | if ((urd->class != DEV_CLASS_UR_I) && (urd->class != DEV_CLASS_UR_O)) { | ||
749 | rc = -ENOTSUPP; | ||
750 | goto fail; | ||
751 | } | ||
752 | |||
753 | return 0; | ||
754 | |||
755 | fail: | ||
756 | urdev_free(urd); | ||
757 | put_device(&cdev->dev); | ||
758 | return rc; | ||
759 | } | ||
760 | |||
761 | static void ur_remove(struct ccw_device *cdev) | ||
762 | { | ||
763 | struct urdev *urd = cdev->dev.driver_data; | ||
764 | |||
765 | TRACE("ur_remove\n"); | ||
766 | if (cdev->online) | ||
767 | ur_set_offline(cdev); | ||
768 | ur_remove_attributes(&cdev->dev); | ||
769 | urdev_free(urd); | ||
770 | put_device(&cdev->dev); | ||
771 | } | ||
772 | |||
773 | static int ur_set_online(struct ccw_device *cdev) | ||
774 | { | ||
775 | struct urdev *urd; | ||
776 | int minor, major, rc; | ||
777 | char node_id[16]; | ||
778 | |||
779 | TRACE("ur_set_online: cdev=%p state=%d\n", cdev, | ||
780 | *(int *) cdev->private); | ||
781 | |||
782 | if (!try_module_get(ur_driver.owner)) | ||
783 | return -EINVAL; | ||
784 | |||
785 | urd = (struct urdev *) cdev->dev.driver_data; | ||
786 | minor = urd->dev_id.devno; | ||
787 | major = MAJOR(ur_first_dev_maj_min); | ||
788 | |||
789 | urd->char_device = cdev_alloc(); | ||
790 | if (!urd->char_device) { | ||
791 | rc = -ENOMEM; | ||
792 | goto fail_module_put; | ||
793 | } | ||
794 | |||
795 | cdev_init(urd->char_device, &ur_fops); | ||
796 | urd->char_device->dev = MKDEV(major, minor); | ||
797 | urd->char_device->owner = ur_fops.owner; | ||
798 | |||
799 | rc = cdev_add(urd->char_device, urd->char_device->dev, 1); | ||
800 | if (rc) | ||
801 | goto fail_free_cdev; | ||
802 | if (urd->cdev->id.cu_type == READER_PUNCH_DEVTYPE) { | ||
803 | if (urd->class == DEV_CLASS_UR_I) | ||
804 | sprintf(node_id, "vmrdr-%s", cdev->dev.bus_id); | ||
805 | if (urd->class == DEV_CLASS_UR_O) | ||
806 | sprintf(node_id, "vmpun-%s", cdev->dev.bus_id); | ||
807 | } else if (urd->cdev->id.cu_type == PRINTER_DEVTYPE) { | ||
808 | sprintf(node_id, "vmprt-%s", cdev->dev.bus_id); | ||
809 | } else { | ||
810 | rc = -ENOTSUPP; | ||
811 | goto fail_free_cdev; | ||
812 | } | ||
813 | |||
814 | urd->device = device_create(vmur_class, NULL, urd->char_device->dev, | ||
815 | "%s", node_id); | ||
816 | if (IS_ERR(urd->device)) { | ||
817 | rc = PTR_ERR(urd->device); | ||
818 | TRACE("ur_set_online: device_create rc=%d\n", rc); | ||
819 | goto fail_free_cdev; | ||
820 | } | ||
821 | |||
822 | return 0; | ||
823 | |||
824 | fail_free_cdev: | ||
825 | cdev_del(urd->char_device); | ||
826 | fail_module_put: | ||
827 | module_put(ur_driver.owner); | ||
828 | |||
829 | return rc; | ||
830 | } | ||
831 | |||
832 | static int ur_set_offline(struct ccw_device *cdev) | ||
833 | { | ||
834 | struct urdev *urd; | ||
835 | |||
836 | TRACE("ur_set_offline: cdev=%p cdev->private=%p state=%d\n", | ||
837 | cdev, cdev->private, *(int *) cdev->private); | ||
838 | urd = (struct urdev *) cdev->dev.driver_data; | ||
839 | device_destroy(vmur_class, urd->char_device->dev); | ||
840 | cdev_del(urd->char_device); | ||
841 | module_put(ur_driver.owner); | ||
842 | |||
843 | return 0; | ||
844 | } | ||
845 | |||
846 | /* | ||
847 | * Module initialisation and cleanup | ||
848 | */ | ||
849 | static int __init ur_init(void) | ||
850 | { | ||
851 | int rc; | ||
852 | dev_t dev; | ||
853 | |||
854 | if (!MACHINE_IS_VM) { | ||
855 | PRINT_ERR("%s is only available under z/VM.\n", ur_banner); | ||
856 | return -ENODEV; | ||
857 | } | ||
858 | |||
859 | vmur_dbf = debug_register("vmur", 4, 1, 4 * sizeof(long)); | ||
860 | if (!vmur_dbf) | ||
861 | return -ENOMEM; | ||
862 | rc = debug_register_view(vmur_dbf, &debug_sprintf_view); | ||
863 | if (rc) | ||
864 | goto fail_free_dbf; | ||
865 | |||
866 | debug_set_level(vmur_dbf, 6); | ||
867 | |||
868 | rc = ccw_driver_register(&ur_driver); | ||
869 | if (rc) | ||
870 | goto fail_free_dbf; | ||
871 | |||
872 | rc = alloc_chrdev_region(&dev, 0, NUM_MINORS, "vmur"); | ||
873 | if (rc) { | ||
874 | PRINT_ERR("alloc_chrdev_region failed: err = %d\n", rc); | ||
875 | goto fail_unregister_driver; | ||
876 | } | ||
877 | ur_first_dev_maj_min = MKDEV(MAJOR(dev), 0); | ||
878 | |||
879 | vmur_class = class_create(THIS_MODULE, "vmur"); | ||
880 | if (IS_ERR(vmur_class)) { | ||
881 | rc = PTR_ERR(vmur_class); | ||
882 | goto fail_unregister_region; | ||
883 | } | ||
884 | PRINT_INFO("%s loaded.\n", ur_banner); | ||
885 | return 0; | ||
886 | |||
887 | fail_unregister_region: | ||
888 | unregister_chrdev_region(ur_first_dev_maj_min, NUM_MINORS); | ||
889 | fail_unregister_driver: | ||
890 | ccw_driver_unregister(&ur_driver); | ||
891 | fail_free_dbf: | ||
892 | debug_unregister(vmur_dbf); | ||
893 | return rc; | ||
894 | } | ||
895 | |||
896 | static void __exit ur_exit(void) | ||
897 | { | ||
898 | class_destroy(vmur_class); | ||
899 | unregister_chrdev_region(ur_first_dev_maj_min, NUM_MINORS); | ||
900 | ccw_driver_unregister(&ur_driver); | ||
901 | debug_unregister(vmur_dbf); | ||
902 | PRINT_INFO("%s unloaded.\n", ur_banner); | ||
903 | } | ||
904 | |||
905 | module_init(ur_init); | ||
906 | module_exit(ur_exit); | ||
diff --git a/drivers/s390/char/vmur.h b/drivers/s390/char/vmur.h new file mode 100644 index 000000000000..16d0a4e38e40 --- /dev/null +++ b/drivers/s390/char/vmur.h | |||
@@ -0,0 +1,104 @@ | |||
1 | /* | ||
2 | * Linux driver for System z and s390 unit record devices | ||
3 | * (z/VM virtual punch, reader, printer) | ||
4 | * | ||
5 | * Copyright IBM Corp. 2001, 2007 | ||
6 | * Authors: Malcolm Beattie <beattiem@uk.ibm.com> | ||
7 | * Michael Holzheu <holzheu@de.ibm.com> | ||
8 | * Frank Munzert <munzert@de.ibm.com> | ||
9 | */ | ||
10 | |||
11 | #ifndef _VMUR_H_ | ||
12 | #define _VMUR_H_ | ||
13 | |||
14 | #define DEV_CLASS_UR_I 0x20 /* diag210 unit record input device class */ | ||
15 | #define DEV_CLASS_UR_O 0x10 /* diag210 unit record output device class */ | ||
16 | /* | ||
17 | * we only support z/VM's default unit record devices: | ||
18 | * both in SPOOL directory control statement and in CP DEFINE statement | ||
19 | * RDR defaults to 2540 reader | ||
20 | * PUN defaults to 2540 punch | ||
21 | * PRT defaults to 1403 printer | ||
22 | */ | ||
23 | #define READER_PUNCH_DEVTYPE 0x2540 | ||
24 | #define PRINTER_DEVTYPE 0x1403 | ||
25 | |||
26 | /* z/VM spool file control block SFBLOK */ | ||
27 | struct file_control_block { | ||
28 | char reserved_1[8]; | ||
29 | char user_owner[8]; | ||
30 | char user_orig[8]; | ||
31 | __s32 data_recs; | ||
32 | __s16 rec_len; | ||
33 | __s16 file_num; | ||
34 | __u8 file_stat; | ||
35 | __u8 dev_type; | ||
36 | char reserved_2[6]; | ||
37 | char file_name[12]; | ||
38 | char file_type[12]; | ||
39 | char create_date[8]; | ||
40 | char create_time[8]; | ||
41 | char reserved_3[6]; | ||
42 | __u8 file_class; | ||
43 | __u8 sfb_lok; | ||
44 | __u64 distr_code; | ||
45 | __u32 reserved_4; | ||
46 | __u8 current_starting_copy_number; | ||
47 | __u8 sfblock_cntrl_flags; | ||
48 | __u8 reserved_5; | ||
49 | __u8 more_status_flags; | ||
50 | char rest[200]; | ||
51 | } __attribute__ ((packed)); | ||
52 | |||
53 | #define FLG_CP_DUMP 0x10 | ||
54 | |||
55 | /* | ||
56 | * A struct urdev is created for each ur device that is made available | ||
57 | * via the ccw_device driver model. | ||
58 | */ | ||
59 | struct urdev { | ||
60 | struct ccw_device *cdev; /* Backpointer to ccw device */ | ||
61 | struct mutex io_mutex; /* Serialises device IO */ | ||
62 | struct mutex open_mutex; /* Serialises access to device */ | ||
63 | struct completion *io_done; /* do_ur_io waits; irq completes */ | ||
64 | struct device *device; | ||
65 | struct cdev *char_device; | ||
66 | struct ccw_dev_id dev_id; /* device id */ | ||
67 | size_t reclen; /* Record length for *write* CCWs */ | ||
68 | int class; /* VM device class */ | ||
69 | int io_request_rc; /* return code from I/O request */ | ||
70 | }; | ||
71 | |||
72 | /* | ||
73 | * A struct urfile is allocated at open() time for each device and | ||
74 | * freed on release(). | ||
75 | */ | ||
76 | struct urfile { | ||
77 | struct urdev *urd; | ||
78 | unsigned int flags; | ||
79 | size_t dev_reclen; | ||
80 | __u16 file_reclen; | ||
81 | }; | ||
82 | |||
83 | /* | ||
84 | * Device major/minor definitions. | ||
85 | */ | ||
86 | |||
87 | #define UR_MAJOR 0 /* get dynamic major */ | ||
88 | /* | ||
89 | * We map minor numbers directly to device numbers (0-FFFF) for simplicity. | ||
90 | * This avoids having to allocate (and manage) slot numbers. | ||
91 | */ | ||
92 | #define NUM_MINORS 65536 | ||
93 | |||
94 | /* Limiting each I/O to 511 records limits chan prog to 4KB (511 r/w + 1 NOP) */ | ||
95 | #define MAX_RECS_PER_IO 511 | ||
96 | #define WRITE_CCW_CMD 0x01 | ||
97 | |||
98 | #define TRACE(x...) debug_sprintf_event(vmur_dbf, 1, x) | ||
99 | #define CCWDEV_CU_DI(cutype, di) \ | ||
100 | CCW_DEVICE(cutype, 0x00), .driver_info = (di) | ||
101 | |||
102 | #define FILE_RECLEN_OFFSET 4064 /* reclen offset in spool data block */ | ||
103 | |||
104 | #endif /* _VMUR_H_ */ | ||
diff --git a/drivers/s390/cio/device.c b/drivers/s390/cio/device.c index 6b264bdb5bfb..001682e70f67 100644 --- a/drivers/s390/cio/device.c +++ b/drivers/s390/cio/device.c | |||
@@ -272,7 +272,7 @@ modalias_show (struct device *dev, struct device_attribute *attr, char *buf) | |||
272 | struct ccw_device_id *id = &(cdev->id); | 272 | struct ccw_device_id *id = &(cdev->id); |
273 | int len; | 273 | int len; |
274 | 274 | ||
275 | len = snprint_alias(buf, PAGE_SIZE, id, "\n") + 1; | 275 | len = snprint_alias(buf, PAGE_SIZE, id, "\n"); |
276 | 276 | ||
277 | return len > PAGE_SIZE ? PAGE_SIZE : len; | 277 | return len > PAGE_SIZE ? PAGE_SIZE : len; |
278 | } | 278 | } |
diff --git a/drivers/s390/cio/qdio.c b/drivers/s390/cio/qdio.c index e70aeb7a3781..ed026a1dc324 100644 --- a/drivers/s390/cio/qdio.c +++ b/drivers/s390/cio/qdio.c | |||
@@ -166,9 +166,9 @@ qdio_check_ccq(struct qdio_q *q, unsigned int ccq) | |||
166 | { | 166 | { |
167 | char dbf_text[15]; | 167 | char dbf_text[15]; |
168 | 168 | ||
169 | if (ccq == 0 || ccq == 32 || ccq == 96) | 169 | if (ccq == 0 || ccq == 32) |
170 | return 0; | 170 | return 0; |
171 | if (ccq == 97) | 171 | if (ccq == 96 || ccq == 97) |
172 | return 1; | 172 | return 1; |
173 | /*notify devices immediately*/ | 173 | /*notify devices immediately*/ |
174 | sprintf(dbf_text,"%d", ccq); | 174 | sprintf(dbf_text,"%d", ccq); |
@@ -2306,8 +2306,8 @@ qdio_get_ssqd_information(struct qdio_irq *irq_ptr) | |||
2306 | if (!ssqd_area) { | 2306 | if (!ssqd_area) { |
2307 | QDIO_PRINT_WARN("Could not get memory for chsc. Using all " \ | 2307 | QDIO_PRINT_WARN("Could not get memory for chsc. Using all " \ |
2308 | "SIGAs for sch x%x.\n", irq_ptr->schid.sch_no); | 2308 | "SIGAs for sch x%x.\n", irq_ptr->schid.sch_no); |
2309 | irq_ptr->qdioac = CHSC_FLAG_SIGA_INPUT_NECESSARY || | 2309 | irq_ptr->qdioac = CHSC_FLAG_SIGA_INPUT_NECESSARY | |
2310 | CHSC_FLAG_SIGA_OUTPUT_NECESSARY || | 2310 | CHSC_FLAG_SIGA_OUTPUT_NECESSARY | |
2311 | CHSC_FLAG_SIGA_SYNC_NECESSARY; /* all flags set */ | 2311 | CHSC_FLAG_SIGA_SYNC_NECESSARY; /* all flags set */ |
2312 | irq_ptr->is_qebsm = 0; | 2312 | irq_ptr->is_qebsm = 0; |
2313 | irq_ptr->sch_token = 0; | 2313 | irq_ptr->sch_token = 0; |
@@ -2328,8 +2328,8 @@ qdio_get_ssqd_information(struct qdio_irq *irq_ptr) | |||
2328 | QDIO_PRINT_WARN("CHSC returned cc %i. Using all " \ | 2328 | QDIO_PRINT_WARN("CHSC returned cc %i. Using all " \ |
2329 | "SIGAs for sch 0.%x.%x.\n", result, | 2329 | "SIGAs for sch 0.%x.%x.\n", result, |
2330 | irq_ptr->schid.ssid, irq_ptr->schid.sch_no); | 2330 | irq_ptr->schid.ssid, irq_ptr->schid.sch_no); |
2331 | qdioac = CHSC_FLAG_SIGA_INPUT_NECESSARY || | 2331 | qdioac = CHSC_FLAG_SIGA_INPUT_NECESSARY | |
2332 | CHSC_FLAG_SIGA_OUTPUT_NECESSARY || | 2332 | CHSC_FLAG_SIGA_OUTPUT_NECESSARY | |
2333 | CHSC_FLAG_SIGA_SYNC_NECESSARY; /* all flags set */ | 2333 | CHSC_FLAG_SIGA_SYNC_NECESSARY; /* all flags set */ |
2334 | irq_ptr->is_qebsm = 0; | 2334 | irq_ptr->is_qebsm = 0; |
2335 | goto out; | 2335 | goto out; |
@@ -2340,8 +2340,8 @@ qdio_get_ssqd_information(struct qdio_irq *irq_ptr) | |||
2340 | "is 0x%x. Using all SIGAs for sch 0.%x.%x.\n", | 2340 | "is 0x%x. Using all SIGAs for sch 0.%x.%x.\n", |
2341 | ssqd_area->response.code, | 2341 | ssqd_area->response.code, |
2342 | irq_ptr->schid.ssid, irq_ptr->schid.sch_no); | 2342 | irq_ptr->schid.ssid, irq_ptr->schid.sch_no); |
2343 | qdioac = CHSC_FLAG_SIGA_INPUT_NECESSARY || | 2343 | qdioac = CHSC_FLAG_SIGA_INPUT_NECESSARY | |
2344 | CHSC_FLAG_SIGA_OUTPUT_NECESSARY || | 2344 | CHSC_FLAG_SIGA_OUTPUT_NECESSARY | |
2345 | CHSC_FLAG_SIGA_SYNC_NECESSARY; /* all flags set */ | 2345 | CHSC_FLAG_SIGA_SYNC_NECESSARY; /* all flags set */ |
2346 | irq_ptr->is_qebsm = 0; | 2346 | irq_ptr->is_qebsm = 0; |
2347 | goto out; | 2347 | goto out; |