diff options
Diffstat (limited to 'drivers/char')
-rw-r--r-- | drivers/char/Kconfig | 34 | ||||
-rw-r--r-- | drivers/char/Makefile | 1 | ||||
-rw-r--r-- | drivers/char/agp/uninorth-agp.c | 2 | ||||
-rw-r--r-- | drivers/char/cp437.uni | 12 | ||||
-rw-r--r-- | drivers/char/hvc_iucv.c | 850 | ||||
-rw-r--r-- | drivers/char/ipmi/ipmi_msghandler.c | 20 | ||||
-rw-r--r-- | drivers/char/ipmi/ipmi_si_intf.c | 16 | ||||
-rw-r--r-- | drivers/char/isicom.c | 6 | ||||
-rw-r--r-- | drivers/char/istallion.c | 4 | ||||
-rw-r--r-- | drivers/char/mxser.c | 3 | ||||
-rw-r--r-- | drivers/char/serial167.c | 2 | ||||
-rw-r--r-- | drivers/char/sonypi.c | 4 | ||||
-rw-r--r-- | drivers/char/specialix.c | 2 | ||||
-rw-r--r-- | drivers/char/sysrq.c | 18 | ||||
-rw-r--r-- | drivers/char/tty_audit.c | 76 | ||||
-rw-r--r-- | drivers/char/tty_io.c | 16 | ||||
-rw-r--r-- | drivers/char/vt.c | 2 | ||||
-rw-r--r-- | drivers/char/xilinx_hwicap/buffer_icap.c | 3 | ||||
-rw-r--r-- | drivers/char/xilinx_hwicap/buffer_icap.h | 3 | ||||
-rw-r--r-- | drivers/char/xilinx_hwicap/fifo_icap.c | 3 | ||||
-rw-r--r-- | drivers/char/xilinx_hwicap/fifo_icap.h | 3 | ||||
-rw-r--r-- | drivers/char/xilinx_hwicap/xilinx_hwicap.c | 12 | ||||
-rw-r--r-- | drivers/char/xilinx_hwicap/xilinx_hwicap.h | 3 |
23 files changed, 1006 insertions, 89 deletions
diff --git a/drivers/char/Kconfig b/drivers/char/Kconfig index 43b35d0369d6..8783457b93d3 100644 --- a/drivers/char/Kconfig +++ b/drivers/char/Kconfig | |||
@@ -124,7 +124,7 @@ config COMPUTONE | |||
124 | which give you many serial ports. You would need something like this | 124 | which give you many serial ports. You would need something like this |
125 | to connect more than two modems to your Linux box, for instance in | 125 | to connect more than two modems to your Linux box, for instance in |
126 | order to become a dial-in server. If you have a card like that, say | 126 | order to become a dial-in server. If you have a card like that, say |
127 | Y here and read <file:Documentation/computone.txt>. | 127 | Y here and read <file:Documentation/serial/computone.txt>. |
128 | 128 | ||
129 | To compile this driver as module, choose M here: the | 129 | To compile this driver as module, choose M here: the |
130 | module will be called ip2. | 130 | module will be called ip2. |
@@ -136,7 +136,7 @@ config ROCKETPORT | |||
136 | This driver supports Comtrol RocketPort and RocketModem PCI boards. | 136 | This driver supports Comtrol RocketPort and RocketModem PCI boards. |
137 | These boards provide 2, 4, 8, 16, or 32 high-speed serial ports or | 137 | These boards provide 2, 4, 8, 16, or 32 high-speed serial ports or |
138 | modems. For information about the RocketPort/RocketModem boards | 138 | modems. For information about the RocketPort/RocketModem boards |
139 | and this driver read <file:Documentation/rocket.txt>. | 139 | and this driver read <file:Documentation/serial/rocket.txt>. |
140 | 140 | ||
141 | To compile this driver as a module, choose M here: the | 141 | To compile this driver as a module, choose M here: the |
142 | module will be called rocket. | 142 | module will be called rocket. |
@@ -154,7 +154,7 @@ config CYCLADES | |||
154 | your Linux box, for instance in order to become a dial-in server. | 154 | your Linux box, for instance in order to become a dial-in server. |
155 | 155 | ||
156 | For information about the Cyclades-Z card, read | 156 | For information about the Cyclades-Z card, read |
157 | <file:Documentation/README.cycladesZ>. | 157 | <file:Documentation/serial/README.cycladesZ>. |
158 | 158 | ||
159 | To compile this driver as a module, choose M here: the | 159 | To compile this driver as a module, choose M here: the |
160 | module will be called cyclades. | 160 | module will be called cyclades. |
@@ -183,7 +183,7 @@ config DIGIEPCA | |||
183 | box, for instance in order to become a dial-in server. This driver | 183 | box, for instance in order to become a dial-in server. This driver |
184 | supports the original PC (ISA) boards as well as PCI, and EISA. If | 184 | supports the original PC (ISA) boards as well as PCI, and EISA. If |
185 | you have a card like this, say Y here and read the file | 185 | you have a card like this, say Y here and read the file |
186 | <file:Documentation/digiepca.txt>. | 186 | <file:Documentation/serial/digiepca.txt>. |
187 | 187 | ||
188 | To compile this driver as a module, choose M here: the | 188 | To compile this driver as a module, choose M here: the |
189 | module will be called epca. | 189 | module will be called epca. |
@@ -289,7 +289,7 @@ config RISCOM8 | |||
289 | which gives you many serial ports. You would need something like | 289 | which gives you many serial ports. You would need something like |
290 | this to connect more than two modems to your Linux box, for instance | 290 | this to connect more than two modems to your Linux box, for instance |
291 | in order to become a dial-in server. If you have a card like that, | 291 | in order to become a dial-in server. If you have a card like that, |
292 | say Y here and read the file <file:Documentation/riscom8.txt>. | 292 | say Y here and read the file <file:Documentation/serial/riscom8.txt>. |
293 | 293 | ||
294 | Also it's possible to say M here and compile this driver as kernel | 294 | Also it's possible to say M here and compile this driver as kernel |
295 | loadable module; the module will be called riscom8. | 295 | loadable module; the module will be called riscom8. |
@@ -304,8 +304,8 @@ config SPECIALIX | |||
304 | your Linux box, for instance in order to become a dial-in server. | 304 | your Linux box, for instance in order to become a dial-in server. |
305 | 305 | ||
306 | If you have a card like that, say Y here and read the file | 306 | If you have a card like that, say Y here and read the file |
307 | <file:Documentation/specialix.txt>. Also it's possible to say M here | 307 | <file:Documentation/serial/specialix.txt>. Also it's possible to say |
308 | and compile this driver as kernel loadable module which will be | 308 | M here and compile this driver as kernel loadable module which will be |
309 | called specialix. | 309 | called specialix. |
310 | 310 | ||
311 | config SX | 311 | config SX |
@@ -313,7 +313,7 @@ config SX | |||
313 | depends on SERIAL_NONSTANDARD && (PCI || EISA || ISA) | 313 | depends on SERIAL_NONSTANDARD && (PCI || EISA || ISA) |
314 | help | 314 | help |
315 | This is a driver for the SX and SI multiport serial cards. | 315 | This is a driver for the SX and SI multiport serial cards. |
316 | Please read the file <file:Documentation/sx.txt> for details. | 316 | Please read the file <file:Documentation/serial/sx.txt> for details. |
317 | 317 | ||
318 | This driver can only be built as a module ( = code which can be | 318 | This driver can only be built as a module ( = code which can be |
319 | inserted in and removed from the running kernel whenever you want). | 319 | inserted in and removed from the running kernel whenever you want). |
@@ -344,8 +344,8 @@ config STALDRV | |||
344 | like this to connect more than two modems to your Linux box, for | 344 | like this to connect more than two modems to your Linux box, for |
345 | instance in order to become a dial-in server. If you say Y here, | 345 | instance in order to become a dial-in server. If you say Y here, |
346 | you will be asked for your specific card model in the next | 346 | you will be asked for your specific card model in the next |
347 | questions. Make sure to read <file:Documentation/stallion.txt> in | 347 | questions. Make sure to read <file:Documentation/serial/stallion.txt> |
348 | this case. If you have never heard about all this, it's safe to | 348 | in this case. If you have never heard about all this, it's safe to |
349 | say N. | 349 | say N. |
350 | 350 | ||
351 | config STALLION | 351 | config STALLION |
@@ -354,7 +354,7 @@ config STALLION | |||
354 | help | 354 | help |
355 | If you have an EasyIO or EasyConnection 8/32 multiport Stallion | 355 | If you have an EasyIO or EasyConnection 8/32 multiport Stallion |
356 | card, then this is for you; say Y. Make sure to read | 356 | card, then this is for you; say Y. Make sure to read |
357 | <file:Documentation/stallion.txt>. | 357 | <file:Documentation/serial/stallion.txt>. |
358 | 358 | ||
359 | To compile this driver as a module, choose M here: the | 359 | To compile this driver as a module, choose M here: the |
360 | module will be called stallion. | 360 | module will be called stallion. |
@@ -365,7 +365,7 @@ config ISTALLION | |||
365 | help | 365 | help |
366 | If you have an EasyConnection 8/64, ONboard, Brumby or Stallion | 366 | If you have an EasyConnection 8/64, ONboard, Brumby or Stallion |
367 | serial multiport card, say Y here. Make sure to read | 367 | serial multiport card, say Y here. Make sure to read |
368 | <file:Documentation/stallion.txt>. | 368 | <file:Documentation/serial/stallion.txt>. |
369 | 369 | ||
370 | To compile this driver as a module, choose M here: the | 370 | To compile this driver as a module, choose M here: the |
371 | module will be called istallion. | 371 | module will be called istallion. |
@@ -622,6 +622,16 @@ config HVC_BEAT | |||
622 | help | 622 | help |
623 | Toshiba's Cell Reference Set Beat Console device driver | 623 | Toshiba's Cell Reference Set Beat Console device driver |
624 | 624 | ||
625 | config HVC_IUCV | ||
626 | bool "z/VM IUCV Hypervisor console support (VM only)" | ||
627 | depends on S390 | ||
628 | select HVC_DRIVER | ||
629 | select IUCV | ||
630 | default y | ||
631 | help | ||
632 | This driver provides a Hypervisor console (HVC) back-end to access | ||
633 | a Linux (console) terminal via a z/VM IUCV communication path. | ||
634 | |||
625 | config HVC_XEN | 635 | config HVC_XEN |
626 | bool "Xen Hypervisor Console support" | 636 | bool "Xen Hypervisor Console support" |
627 | depends on XEN | 637 | depends on XEN |
diff --git a/drivers/char/Makefile b/drivers/char/Makefile index 438f71317c5c..36151bae0d72 100644 --- a/drivers/char/Makefile +++ b/drivers/char/Makefile | |||
@@ -50,6 +50,7 @@ obj-$(CONFIG_HVC_BEAT) += hvc_beat.o | |||
50 | obj-$(CONFIG_HVC_DRIVER) += hvc_console.o | 50 | obj-$(CONFIG_HVC_DRIVER) += hvc_console.o |
51 | obj-$(CONFIG_HVC_IRQ) += hvc_irq.o | 51 | obj-$(CONFIG_HVC_IRQ) += hvc_irq.o |
52 | obj-$(CONFIG_HVC_XEN) += hvc_xen.o | 52 | obj-$(CONFIG_HVC_XEN) += hvc_xen.o |
53 | obj-$(CONFIG_HVC_IUCV) += hvc_iucv.o | ||
53 | obj-$(CONFIG_VIRTIO_CONSOLE) += virtio_console.o | 54 | obj-$(CONFIG_VIRTIO_CONSOLE) += virtio_console.o |
54 | obj-$(CONFIG_RAW_DRIVER) += raw.o | 55 | obj-$(CONFIG_RAW_DRIVER) += raw.o |
55 | obj-$(CONFIG_SGI_SNSC) += snsc.o snsc_event.o | 56 | obj-$(CONFIG_SGI_SNSC) += snsc.o snsc_event.o |
diff --git a/drivers/char/agp/uninorth-agp.c b/drivers/char/agp/uninorth-agp.c index 0f004b65ec03..03f95ec08f59 100644 --- a/drivers/char/agp/uninorth-agp.c +++ b/drivers/char/agp/uninorth-agp.c | |||
@@ -27,7 +27,7 @@ | |||
27 | static int uninorth_rev; | 27 | static int uninorth_rev; |
28 | static int is_u3; | 28 | static int is_u3; |
29 | 29 | ||
30 | static char __devinitdata *aperture = NULL; | 30 | static char *aperture = NULL; |
31 | 31 | ||
32 | static int uninorth_fetch_size(void) | 32 | static int uninorth_fetch_size(void) |
33 | { | 33 | { |
diff --git a/drivers/char/cp437.uni b/drivers/char/cp437.uni index 1f06889a96b9..bc6163484f62 100644 --- a/drivers/char/cp437.uni +++ b/drivers/char/cp437.uni | |||
@@ -27,7 +27,7 @@ | |||
27 | 0x0c U+2640 | 27 | 0x0c U+2640 |
28 | 0x0d U+266a | 28 | 0x0d U+266a |
29 | 0x0e U+266b | 29 | 0x0e U+266b |
30 | 0x0f U+263c | 30 | 0x0f U+263c U+00a4 |
31 | 0x10 U+25b6 U+25ba | 31 | 0x10 U+25b6 U+25ba |
32 | 0x11 U+25c0 U+25c4 | 32 | 0x11 U+25c0 U+25c4 |
33 | 0x12 U+2195 | 33 | 0x12 U+2195 |
@@ -55,7 +55,7 @@ | |||
55 | 0x24 U+0024 | 55 | 0x24 U+0024 |
56 | 0x25 U+0025 | 56 | 0x25 U+0025 |
57 | 0x26 U+0026 | 57 | 0x26 U+0026 |
58 | 0x27 U+0027 | 58 | 0x27 U+0027 U+00b4 |
59 | 0x28 U+0028 | 59 | 0x28 U+0028 |
60 | 0x29 U+0029 | 60 | 0x29 U+0029 |
61 | 0x2a U+002a | 61 | 0x2a U+002a |
@@ -84,7 +84,7 @@ | |||
84 | 0x41 U+0041 U+00c0 U+00c1 U+00c2 U+00c3 | 84 | 0x41 U+0041 U+00c0 U+00c1 U+00c2 U+00c3 |
85 | 0x42 U+0042 | 85 | 0x42 U+0042 |
86 | 0x43 U+0043 U+00a9 | 86 | 0x43 U+0043 U+00a9 |
87 | 0x44 U+0044 | 87 | 0x44 U+0044 U+00d0 |
88 | 0x45 U+0045 U+00c8 U+00ca U+00cb | 88 | 0x45 U+0045 U+00c8 U+00ca U+00cb |
89 | 0x46 U+0046 | 89 | 0x46 U+0046 |
90 | 0x47 U+0047 | 90 | 0x47 U+0047 |
@@ -140,7 +140,7 @@ | |||
140 | 0x79 U+0079 U+00fd | 140 | 0x79 U+0079 U+00fd |
141 | 0x7a U+007a | 141 | 0x7a U+007a |
142 | 0x7b U+007b | 142 | 0x7b U+007b |
143 | 0x7c U+007c U+00a5 | 143 | 0x7c U+007c U+00a6 |
144 | 0x7d U+007d | 144 | 0x7d U+007d |
145 | 0x7e U+007e | 145 | 0x7e U+007e |
146 | # | 146 | # |
@@ -263,10 +263,10 @@ | |||
263 | 0xe8 U+03a6 U+00d8 | 263 | 0xe8 U+03a6 U+00d8 |
264 | 0xe9 U+0398 | 264 | 0xe9 U+0398 |
265 | 0xea U+03a9 U+2126 | 265 | 0xea U+03a9 U+2126 |
266 | 0xeb U+03b4 | 266 | 0xeb U+03b4 U+00f0 |
267 | 0xec U+221e | 267 | 0xec U+221e |
268 | 0xed U+03c6 U+00f8 | 268 | 0xed U+03c6 U+00f8 |
269 | 0xee U+03b5 | 269 | 0xee U+03b5 U+2208 |
270 | 0xef U+2229 | 270 | 0xef U+2229 |
271 | 0xf0 U+2261 | 271 | 0xf0 U+2261 |
272 | 0xf1 U+00b1 | 272 | 0xf1 U+00b1 |
diff --git a/drivers/char/hvc_iucv.c b/drivers/char/hvc_iucv.c new file mode 100644 index 000000000000..5ea7d7713fca --- /dev/null +++ b/drivers/char/hvc_iucv.c | |||
@@ -0,0 +1,850 @@ | |||
1 | /* | ||
2 | * hvc_iucv.c - z/VM IUCV back-end for the Hypervisor Console (HVC) | ||
3 | * | ||
4 | * This back-end for HVC provides terminal access via | ||
5 | * z/VM IUCV communication paths. | ||
6 | * | ||
7 | * Copyright IBM Corp. 2008. | ||
8 | * | ||
9 | * Author(s): Hendrik Brueckner <brueckner@linux.vnet.ibm.com> | ||
10 | */ | ||
11 | #define KMSG_COMPONENT "hvc_iucv" | ||
12 | |||
13 | #include <linux/types.h> | ||
14 | #include <asm/ebcdic.h> | ||
15 | #include <linux/mempool.h> | ||
16 | #include <linux/module.h> | ||
17 | #include <linux/tty.h> | ||
18 | #include <net/iucv/iucv.h> | ||
19 | |||
20 | #include "hvc_console.h" | ||
21 | |||
22 | |||
23 | /* HVC backend for z/VM IUCV */ | ||
24 | #define HVC_IUCV_MAGIC 0xc9e4c3e5 | ||
25 | #define MAX_HVC_IUCV_LINES HVC_ALLOC_TTY_ADAPTERS | ||
26 | #define MEMPOOL_MIN_NR (PAGE_SIZE / sizeof(struct iucv_tty_buffer)/4) | ||
27 | |||
28 | /* IUCV TTY message */ | ||
29 | #define MSG_VERSION 0x02 /* Message version */ | ||
30 | #define MSG_TYPE_ERROR 0x01 /* Error message */ | ||
31 | #define MSG_TYPE_TERMENV 0x02 /* Terminal environment variable */ | ||
32 | #define MSG_TYPE_TERMIOS 0x04 /* Terminal IO struct update */ | ||
33 | #define MSG_TYPE_WINSIZE 0x08 /* Terminal window size update */ | ||
34 | #define MSG_TYPE_DATA 0x10 /* Terminal data */ | ||
35 | |||
36 | #define MSG_SIZE(s) ((s) + offsetof(struct iucv_tty_msg, data)) | ||
37 | struct iucv_tty_msg { | ||
38 | u8 version; /* Message version */ | ||
39 | u8 type; /* Message type */ | ||
40 | #define MSG_MAX_DATALEN (~(u16)0) | ||
41 | u16 datalen; /* Payload length */ | ||
42 | u8 data[]; /* Payload buffer */ | ||
43 | } __attribute__((packed)); | ||
44 | |||
45 | enum iucv_state_t { | ||
46 | IUCV_DISCONN = 0, | ||
47 | IUCV_CONNECTED = 1, | ||
48 | IUCV_SEVERED = 2, | ||
49 | }; | ||
50 | |||
51 | enum tty_state_t { | ||
52 | TTY_CLOSED = 0, | ||
53 | TTY_OPENED = 1, | ||
54 | }; | ||
55 | |||
56 | struct hvc_iucv_private { | ||
57 | struct hvc_struct *hvc; /* HVC console struct reference */ | ||
58 | u8 srv_name[8]; /* IUCV service name (ebcdic) */ | ||
59 | enum iucv_state_t iucv_state; /* IUCV connection status */ | ||
60 | enum tty_state_t tty_state; /* TTY status */ | ||
61 | struct iucv_path *path; /* IUCV path pointer */ | ||
62 | spinlock_t lock; /* hvc_iucv_private lock */ | ||
63 | struct list_head tty_outqueue; /* outgoing IUCV messages */ | ||
64 | struct list_head tty_inqueue; /* incoming IUCV messages */ | ||
65 | }; | ||
66 | |||
67 | struct iucv_tty_buffer { | ||
68 | struct list_head list; /* list pointer */ | ||
69 | struct iucv_message msg; /* store an incoming IUCV message */ | ||
70 | size_t offset; /* data buffer offset */ | ||
71 | struct iucv_tty_msg *mbuf; /* buffer to store input/output data */ | ||
72 | }; | ||
73 | |||
74 | /* IUCV callback handler */ | ||
75 | static int hvc_iucv_path_pending(struct iucv_path *, u8[8], u8[16]); | ||
76 | static void hvc_iucv_path_severed(struct iucv_path *, u8[16]); | ||
77 | static void hvc_iucv_msg_pending(struct iucv_path *, struct iucv_message *); | ||
78 | static void hvc_iucv_msg_complete(struct iucv_path *, struct iucv_message *); | ||
79 | |||
80 | |||
81 | /* Kernel module parameters */ | ||
82 | static unsigned long hvc_iucv_devices; | ||
83 | |||
84 | /* Array of allocated hvc iucv tty lines... */ | ||
85 | static struct hvc_iucv_private *hvc_iucv_table[MAX_HVC_IUCV_LINES]; | ||
86 | |||
87 | /* Kmem cache and mempool for iucv_tty_buffer elements */ | ||
88 | static struct kmem_cache *hvc_iucv_buffer_cache; | ||
89 | static mempool_t *hvc_iucv_mempool; | ||
90 | |||
91 | /* IUCV handler callback functions */ | ||
92 | static struct iucv_handler hvc_iucv_handler = { | ||
93 | .path_pending = hvc_iucv_path_pending, | ||
94 | .path_severed = hvc_iucv_path_severed, | ||
95 | .message_complete = hvc_iucv_msg_complete, | ||
96 | .message_pending = hvc_iucv_msg_pending, | ||
97 | }; | ||
98 | |||
99 | |||
100 | /** | ||
101 | * hvc_iucv_get_private() - Return a struct hvc_iucv_private instance. | ||
102 | * @num: The HVC virtual terminal number (vtermno) | ||
103 | * | ||
104 | * This function returns the struct hvc_iucv_private instance that corresponds | ||
105 | * to the HVC virtual terminal number specified as parameter @num. | ||
106 | */ | ||
107 | struct hvc_iucv_private *hvc_iucv_get_private(uint32_t num) | ||
108 | { | ||
109 | if ((num < HVC_IUCV_MAGIC) || (num - HVC_IUCV_MAGIC > hvc_iucv_devices)) | ||
110 | return NULL; | ||
111 | return hvc_iucv_table[num - HVC_IUCV_MAGIC]; | ||
112 | } | ||
113 | |||
114 | /** | ||
115 | * alloc_tty_buffer() - Returns a new struct iucv_tty_buffer element. | ||
116 | * @size: Size of the internal buffer used to store data. | ||
117 | * @flags: Memory allocation flags passed to mempool. | ||
118 | * | ||
119 | * This function allocates a new struct iucv_tty_buffer element and, optionally, | ||
120 | * allocates an internal data buffer with the specified size @size. | ||
121 | * Note: The total message size arises from the internal buffer size and the | ||
122 | * members of the iucv_tty_msg structure. | ||
123 | * | ||
124 | * The function returns NULL if memory allocation has failed. | ||
125 | */ | ||
126 | static struct iucv_tty_buffer *alloc_tty_buffer(size_t size, gfp_t flags) | ||
127 | { | ||
128 | struct iucv_tty_buffer *bufp; | ||
129 | |||
130 | bufp = mempool_alloc(hvc_iucv_mempool, flags); | ||
131 | if (!bufp) | ||
132 | return NULL; | ||
133 | memset(bufp, 0, sizeof(struct iucv_tty_buffer)); | ||
134 | |||
135 | if (size > 0) { | ||
136 | bufp->msg.length = MSG_SIZE(size); | ||
137 | bufp->mbuf = kmalloc(bufp->msg.length, flags); | ||
138 | if (!bufp->mbuf) { | ||
139 | mempool_free(bufp, hvc_iucv_mempool); | ||
140 | return NULL; | ||
141 | } | ||
142 | bufp->mbuf->version = MSG_VERSION; | ||
143 | bufp->mbuf->type = MSG_TYPE_DATA; | ||
144 | bufp->mbuf->datalen = (u16) size; | ||
145 | } | ||
146 | return bufp; | ||
147 | } | ||
148 | |||
149 | /** | ||
150 | * destroy_tty_buffer() - destroy struct iucv_tty_buffer element. | ||
151 | * @bufp: Pointer to a struct iucv_tty_buffer element, SHALL NOT be NULL. | ||
152 | * | ||
153 | * The destroy_tty_buffer() function frees the internal data buffer and returns | ||
154 | * the struct iucv_tty_buffer element back to the mempool for freeing. | ||
155 | */ | ||
156 | static void destroy_tty_buffer(struct iucv_tty_buffer *bufp) | ||
157 | { | ||
158 | kfree(bufp->mbuf); | ||
159 | mempool_free(bufp, hvc_iucv_mempool); | ||
160 | } | ||
161 | |||
162 | /** | ||
163 | * destroy_tty_buffer_list() - call destroy_tty_buffer() for each list element. | ||
164 | * @list: List head pointer to a list containing struct iucv_tty_buffer | ||
165 | * elements. | ||
166 | * | ||
167 | * Calls destroy_tty_buffer() for each struct iucv_tty_buffer element in the | ||
168 | * list @list. | ||
169 | */ | ||
170 | static void destroy_tty_buffer_list(struct list_head *list) | ||
171 | { | ||
172 | struct iucv_tty_buffer *ent, *next; | ||
173 | |||
174 | list_for_each_entry_safe(ent, next, list, list) { | ||
175 | list_del(&ent->list); | ||
176 | destroy_tty_buffer(ent); | ||
177 | } | ||
178 | } | ||
179 | |||
180 | /** | ||
181 | * hvc_iucv_write() - Receive IUCV message write data to HVC console buffer. | ||
182 | * @priv: Pointer to hvc_iucv_private structure. | ||
183 | * @buf: HVC console buffer for writing received terminal data. | ||
184 | * @count: HVC console buffer size. | ||
185 | * @has_more_data: Pointer to an int variable. | ||
186 | * | ||
187 | * The function picks up pending messages from the input queue and receives | ||
188 | * the message data that is then written to the specified buffer @buf. | ||
189 | * If the buffer size @count is less than the data message size, then the | ||
190 | * message is kept on the input queue and @has_more_data is set to 1. | ||
191 | * If the message data has been entirely written, the message is removed from | ||
192 | * the input queue. | ||
193 | * | ||
194 | * The function returns the number of bytes written to the terminal, zero if | ||
195 | * there are no pending data messages available or if there is no established | ||
196 | * IUCV path. | ||
197 | * If the IUCV path has been severed, then -EPIPE is returned to cause a | ||
198 | * hang up (that is issued by the HVC console layer). | ||
199 | */ | ||
200 | static int hvc_iucv_write(struct hvc_iucv_private *priv, | ||
201 | char *buf, int count, int *has_more_data) | ||
202 | { | ||
203 | struct iucv_tty_buffer *rb; | ||
204 | int written; | ||
205 | int rc; | ||
206 | |||
207 | /* Immediately return if there is no IUCV connection */ | ||
208 | if (priv->iucv_state == IUCV_DISCONN) | ||
209 | return 0; | ||
210 | |||
211 | /* If the IUCV path has been severed, return -EPIPE to inform the | ||
212 | * hvc console layer to hang up the tty device. */ | ||
213 | if (priv->iucv_state == IUCV_SEVERED) | ||
214 | return -EPIPE; | ||
215 | |||
216 | /* check if there are pending messages */ | ||
217 | if (list_empty(&priv->tty_inqueue)) | ||
218 | return 0; | ||
219 | |||
220 | /* receive a iucv message and flip data to the tty (ldisc) */ | ||
221 | rb = list_first_entry(&priv->tty_inqueue, struct iucv_tty_buffer, list); | ||
222 | |||
223 | written = 0; | ||
224 | if (!rb->mbuf) { /* message not yet received ... */ | ||
225 | /* allocate mem to store msg data; if no memory is available | ||
226 | * then leave the buffer on the list and re-try later */ | ||
227 | rb->mbuf = kmalloc(rb->msg.length, GFP_ATOMIC); | ||
228 | if (!rb->mbuf) | ||
229 | return -ENOMEM; | ||
230 | |||
231 | rc = __iucv_message_receive(priv->path, &rb->msg, 0, | ||
232 | rb->mbuf, rb->msg.length, NULL); | ||
233 | switch (rc) { | ||
234 | case 0: /* Successful */ | ||
235 | break; | ||
236 | case 2: /* No message found */ | ||
237 | case 9: /* Message purged */ | ||
238 | break; | ||
239 | default: | ||
240 | written = -EIO; | ||
241 | } | ||
242 | /* remove buffer if an error has occured or received data | ||
243 | * is not correct */ | ||
244 | if (rc || (rb->mbuf->version != MSG_VERSION) || | ||
245 | (rb->msg.length != MSG_SIZE(rb->mbuf->datalen))) | ||
246 | goto out_remove_buffer; | ||
247 | } | ||
248 | |||
249 | switch (rb->mbuf->type) { | ||
250 | case MSG_TYPE_DATA: | ||
251 | written = min_t(int, rb->mbuf->datalen - rb->offset, count); | ||
252 | memcpy(buf, rb->mbuf->data + rb->offset, written); | ||
253 | if (written < (rb->mbuf->datalen - rb->offset)) { | ||
254 | rb->offset += written; | ||
255 | *has_more_data = 1; | ||
256 | goto out_written; | ||
257 | } | ||
258 | break; | ||
259 | |||
260 | case MSG_TYPE_WINSIZE: | ||
261 | if (rb->mbuf->datalen != sizeof(struct winsize)) | ||
262 | break; | ||
263 | hvc_resize(priv->hvc, *((struct winsize *)rb->mbuf->data)); | ||
264 | break; | ||
265 | |||
266 | case MSG_TYPE_ERROR: /* ignored ... */ | ||
267 | case MSG_TYPE_TERMENV: /* ignored ... */ | ||
268 | case MSG_TYPE_TERMIOS: /* ignored ... */ | ||
269 | break; | ||
270 | } | ||
271 | |||
272 | out_remove_buffer: | ||
273 | list_del(&rb->list); | ||
274 | destroy_tty_buffer(rb); | ||
275 | *has_more_data = !list_empty(&priv->tty_inqueue); | ||
276 | |||
277 | out_written: | ||
278 | return written; | ||
279 | } | ||
280 | |||
281 | /** | ||
282 | * hvc_iucv_get_chars() - HVC get_chars operation. | ||
283 | * @vtermno: HVC virtual terminal number. | ||
284 | * @buf: Pointer to a buffer to store data | ||
285 | * @count: Size of buffer available for writing | ||
286 | * | ||
287 | * The hvc_console thread calls this method to read characters from | ||
288 | * the terminal backend. If an IUCV communication path has been established, | ||
289 | * pending IUCV messages are received and data is copied into buffer @buf | ||
290 | * up to @count bytes. | ||
291 | * | ||
292 | * Locking: The routine gets called under an irqsave() spinlock; and | ||
293 | * the routine locks the struct hvc_iucv_private->lock to call | ||
294 | * helper functions. | ||
295 | */ | ||
296 | static int hvc_iucv_get_chars(uint32_t vtermno, char *buf, int count) | ||
297 | { | ||
298 | struct hvc_iucv_private *priv = hvc_iucv_get_private(vtermno); | ||
299 | int written; | ||
300 | int has_more_data; | ||
301 | |||
302 | if (count <= 0) | ||
303 | return 0; | ||
304 | |||
305 | if (!priv) | ||
306 | return -ENODEV; | ||
307 | |||
308 | spin_lock(&priv->lock); | ||
309 | has_more_data = 0; | ||
310 | written = hvc_iucv_write(priv, buf, count, &has_more_data); | ||
311 | spin_unlock(&priv->lock); | ||
312 | |||
313 | /* if there are still messages on the queue... schedule another run */ | ||
314 | if (has_more_data) | ||
315 | hvc_kick(); | ||
316 | |||
317 | return written; | ||
318 | } | ||
319 | |||
320 | /** | ||
321 | * hvc_iucv_send() - Send an IUCV message containing terminal data. | ||
322 | * @priv: Pointer to struct hvc_iucv_private instance. | ||
323 | * @buf: Buffer containing data to send. | ||
324 | * @size: Size of buffer and amount of data to send. | ||
325 | * | ||
326 | * If an IUCV communication path is established, the function copies the buffer | ||
327 | * data to a newly allocated struct iucv_tty_buffer element, sends the data and | ||
328 | * puts the element to the outqueue. | ||
329 | * | ||
330 | * If there is no IUCV communication path established, the function returns 0. | ||
331 | * If an existing IUCV communicaton path has been severed, the function returns | ||
332 | * -EPIPE (can be passed to HVC layer to cause a tty hangup). | ||
333 | */ | ||
334 | static int hvc_iucv_send(struct hvc_iucv_private *priv, const char *buf, | ||
335 | int count) | ||
336 | { | ||
337 | struct iucv_tty_buffer *sb; | ||
338 | int rc; | ||
339 | u16 len; | ||
340 | |||
341 | if (priv->iucv_state == IUCV_SEVERED) | ||
342 | return -EPIPE; | ||
343 | |||
344 | if (priv->iucv_state == IUCV_DISCONN) | ||
345 | return 0; | ||
346 | |||
347 | len = min_t(u16, MSG_MAX_DATALEN, count); | ||
348 | |||
349 | /* allocate internal buffer to store msg data and also compute total | ||
350 | * message length */ | ||
351 | sb = alloc_tty_buffer(len, GFP_ATOMIC); | ||
352 | if (!sb) | ||
353 | return -ENOMEM; | ||
354 | |||
355 | sb->mbuf->datalen = len; | ||
356 | memcpy(sb->mbuf->data, buf, len); | ||
357 | |||
358 | list_add_tail(&sb->list, &priv->tty_outqueue); | ||
359 | |||
360 | rc = __iucv_message_send(priv->path, &sb->msg, 0, 0, | ||
361 | (void *) sb->mbuf, sb->msg.length); | ||
362 | if (rc) { | ||
363 | list_del(&sb->list); | ||
364 | destroy_tty_buffer(sb); | ||
365 | len = 0; | ||
366 | } | ||
367 | |||
368 | return len; | ||
369 | } | ||
370 | |||
371 | /** | ||
372 | * hvc_iucv_put_chars() - HVC put_chars operation. | ||
373 | * @vtermno: HVC virtual terminal number. | ||
374 | * @buf: Pointer to an buffer to read data from | ||
375 | * @count: Size of buffer available for reading | ||
376 | * | ||
377 | * The hvc_console thread calls this method to write characters from | ||
378 | * to the terminal backend. | ||
379 | * The function calls hvc_iucv_send() under the lock of the | ||
380 | * struct hvc_iucv_private instance that corresponds to the tty @vtermno. | ||
381 | * | ||
382 | * Locking: The method gets called under an irqsave() spinlock; and | ||
383 | * locks struct hvc_iucv_private->lock. | ||
384 | */ | ||
385 | static int hvc_iucv_put_chars(uint32_t vtermno, const char *buf, int count) | ||
386 | { | ||
387 | struct hvc_iucv_private *priv = hvc_iucv_get_private(vtermno); | ||
388 | int sent; | ||
389 | |||
390 | if (count <= 0) | ||
391 | return 0; | ||
392 | |||
393 | if (!priv) | ||
394 | return -ENODEV; | ||
395 | |||
396 | spin_lock(&priv->lock); | ||
397 | sent = hvc_iucv_send(priv, buf, count); | ||
398 | spin_unlock(&priv->lock); | ||
399 | |||
400 | return sent; | ||
401 | } | ||
402 | |||
403 | /** | ||
404 | * hvc_iucv_notifier_add() - HVC notifier for opening a TTY for the first time. | ||
405 | * @hp: Pointer to the HVC device (struct hvc_struct) | ||
406 | * @id: Additional data (originally passed to hvc_alloc): the index of an struct | ||
407 | * hvc_iucv_private instance. | ||
408 | * | ||
409 | * The function sets the tty state to TTY_OPEN for the struct hvc_iucv_private | ||
410 | * instance that is derived from @id. Always returns 0. | ||
411 | * | ||
412 | * Locking: struct hvc_iucv_private->lock, spin_lock_bh | ||
413 | */ | ||
414 | static int hvc_iucv_notifier_add(struct hvc_struct *hp, int id) | ||
415 | { | ||
416 | struct hvc_iucv_private *priv; | ||
417 | |||
418 | priv = hvc_iucv_get_private(id); | ||
419 | if (!priv) | ||
420 | return 0; | ||
421 | |||
422 | spin_lock_bh(&priv->lock); | ||
423 | priv->tty_state = TTY_OPENED; | ||
424 | spin_unlock_bh(&priv->lock); | ||
425 | |||
426 | return 0; | ||
427 | } | ||
428 | |||
429 | /** | ||
430 | * hvc_iucv_cleanup() - Clean up function if the tty portion is finally closed. | ||
431 | * @priv: Pointer to the struct hvc_iucv_private instance. | ||
432 | * | ||
433 | * The functions severs the established IUCV communication path (if any), and | ||
434 | * destroy struct iucv_tty_buffer elements from the in- and outqueue. Finally, | ||
435 | * the functions resets the states to TTY_CLOSED and IUCV_DISCONN. | ||
436 | */ | ||
437 | static void hvc_iucv_cleanup(struct hvc_iucv_private *priv) | ||
438 | { | ||
439 | destroy_tty_buffer_list(&priv->tty_outqueue); | ||
440 | destroy_tty_buffer_list(&priv->tty_inqueue); | ||
441 | |||
442 | priv->tty_state = TTY_CLOSED; | ||
443 | priv->iucv_state = IUCV_DISCONN; | ||
444 | } | ||
445 | |||
446 | /** | ||
447 | * hvc_iucv_notifier_hangup() - HVC notifier for tty hangups. | ||
448 | * @hp: Pointer to the HVC device (struct hvc_struct) | ||
449 | * @id: Additional data (originally passed to hvc_alloc): the index of an struct | ||
450 | * hvc_iucv_private instance. | ||
451 | * | ||
452 | * This routine notifies the HVC backend that a tty hangup (carrier loss, | ||
453 | * virtual or otherwise) has occured. | ||
454 | * | ||
455 | * The HVC backend for z/VM IUCV ignores virtual hangups (vhangup()), to keep | ||
456 | * an existing IUCV communication path established. | ||
457 | * (Background: vhangup() is called from user space (by getty or login) to | ||
458 | * disable writing to the tty by other applications). | ||
459 | * | ||
460 | * If the tty has been opened (e.g. getty) and an established IUCV path has been | ||
461 | * severed (we caused the tty hangup in that case), then the functions invokes | ||
462 | * hvc_iucv_cleanup() to clean up. | ||
463 | * | ||
464 | * Locking: struct hvc_iucv_private->lock | ||
465 | */ | ||
466 | static void hvc_iucv_notifier_hangup(struct hvc_struct *hp, int id) | ||
467 | { | ||
468 | struct hvc_iucv_private *priv; | ||
469 | |||
470 | priv = hvc_iucv_get_private(id); | ||
471 | if (!priv) | ||
472 | return; | ||
473 | |||
474 | spin_lock_bh(&priv->lock); | ||
475 | /* NOTE: If the hangup was scheduled by ourself (from the iucv | ||
476 | * path_servered callback [IUCV_SEVERED]), then we have to | ||
477 | * finally clean up the tty backend structure and set state to | ||
478 | * TTY_CLOSED. | ||
479 | * | ||
480 | * If the tty was hung up otherwise (e.g. vhangup()), then we | ||
481 | * ignore this hangup and keep an established IUCV path open... | ||
482 | * (...the reason is that we are not able to connect back to the | ||
483 | * client if we disconnect on hang up) */ | ||
484 | priv->tty_state = TTY_CLOSED; | ||
485 | |||
486 | if (priv->iucv_state == IUCV_SEVERED) | ||
487 | hvc_iucv_cleanup(priv); | ||
488 | spin_unlock_bh(&priv->lock); | ||
489 | } | ||
490 | |||
491 | /** | ||
492 | * hvc_iucv_notifier_del() - HVC notifier for closing a TTY for the last time. | ||
493 | * @hp: Pointer to the HVC device (struct hvc_struct) | ||
494 | * @id: Additional data (originally passed to hvc_alloc): | ||
495 | * the index of an struct hvc_iucv_private instance. | ||
496 | * | ||
497 | * This routine notifies the HVC backend that the last tty device file | ||
498 | * descriptor has been closed. | ||
499 | * The function calls hvc_iucv_cleanup() to clean up the struct hvc_iucv_private | ||
500 | * instance. | ||
501 | * | ||
502 | * Locking: struct hvc_iucv_private->lock | ||
503 | */ | ||
504 | static void hvc_iucv_notifier_del(struct hvc_struct *hp, int id) | ||
505 | { | ||
506 | struct hvc_iucv_private *priv; | ||
507 | struct iucv_path *path; | ||
508 | |||
509 | priv = hvc_iucv_get_private(id); | ||
510 | if (!priv) | ||
511 | return; | ||
512 | |||
513 | spin_lock_bh(&priv->lock); | ||
514 | path = priv->path; /* save reference to IUCV path */ | ||
515 | priv->path = NULL; | ||
516 | hvc_iucv_cleanup(priv); | ||
517 | spin_unlock_bh(&priv->lock); | ||
518 | |||
519 | /* sever IUCV path outside of priv->lock due to lock ordering of: | ||
520 | * priv->lock <--> iucv_table_lock */ | ||
521 | if (path) { | ||
522 | iucv_path_sever(path, NULL); | ||
523 | iucv_path_free(path); | ||
524 | } | ||
525 | } | ||
526 | |||
527 | /** | ||
528 | * hvc_iucv_path_pending() - IUCV handler to process a connection request. | ||
529 | * @path: Pending path (struct iucv_path) | ||
530 | * @ipvmid: Originator z/VM system identifier | ||
531 | * @ipuser: User specified data for this path | ||
532 | * (AF_IUCV: port/service name and originator port) | ||
533 | * | ||
534 | * The function uses the @ipuser data to check to determine if the pending | ||
535 | * path belongs to a terminal managed by this HVC backend. | ||
536 | * If the check is successful, then an additional check is done to ensure | ||
537 | * that a terminal cannot be accessed multiple times (only one connection | ||
538 | * to a terminal is allowed). In that particular case, the pending path is | ||
539 | * severed. If it is the first connection, the pending path is accepted and | ||
540 | * associated to the struct hvc_iucv_private. The iucv state is updated to | ||
541 | * reflect that a communication path has been established. | ||
542 | * | ||
543 | * Returns 0 if the path belongs to a terminal managed by the this HVC backend; | ||
544 | * otherwise returns -ENODEV in order to dispatch this path to other handlers. | ||
545 | * | ||
546 | * Locking: struct hvc_iucv_private->lock | ||
547 | */ | ||
548 | static int hvc_iucv_path_pending(struct iucv_path *path, | ||
549 | u8 ipvmid[8], u8 ipuser[16]) | ||
550 | { | ||
551 | struct hvc_iucv_private *priv; | ||
552 | u8 nuser_data[16]; | ||
553 | int i, rc; | ||
554 | |||
555 | priv = NULL; | ||
556 | for (i = 0; i < hvc_iucv_devices; i++) | ||
557 | if (hvc_iucv_table[i] && | ||
558 | (0 == memcmp(hvc_iucv_table[i]->srv_name, ipuser, 8))) { | ||
559 | priv = hvc_iucv_table[i]; | ||
560 | break; | ||
561 | } | ||
562 | |||
563 | if (!priv) | ||
564 | return -ENODEV; | ||
565 | |||
566 | spin_lock(&priv->lock); | ||
567 | |||
568 | /* If the terminal is already connected or being severed, then sever | ||
569 | * this path to enforce that there is only ONE established communication | ||
570 | * path per terminal. */ | ||
571 | if (priv->iucv_state != IUCV_DISCONN) { | ||
572 | iucv_path_sever(path, ipuser); | ||
573 | iucv_path_free(path); | ||
574 | goto out_path_handled; | ||
575 | } | ||
576 | |||
577 | /* accept path */ | ||
578 | memcpy(nuser_data, ipuser + 8, 8); /* remote service (for af_iucv) */ | ||
579 | memcpy(nuser_data + 8, ipuser, 8); /* local service (for af_iucv) */ | ||
580 | path->msglim = 0xffff; /* IUCV MSGLIMIT */ | ||
581 | path->flags &= ~IUCV_IPRMDATA; /* TODO: use IUCV_IPRMDATA */ | ||
582 | rc = iucv_path_accept(path, &hvc_iucv_handler, nuser_data, priv); | ||
583 | if (rc) { | ||
584 | iucv_path_sever(path, ipuser); | ||
585 | iucv_path_free(path); | ||
586 | goto out_path_handled; | ||
587 | } | ||
588 | priv->path = path; | ||
589 | priv->iucv_state = IUCV_CONNECTED; | ||
590 | |||
591 | out_path_handled: | ||
592 | spin_unlock(&priv->lock); | ||
593 | return 0; | ||
594 | } | ||
595 | |||
596 | /** | ||
597 | * hvc_iucv_path_severed() - IUCV handler to process a path sever. | ||
598 | * @path: Pending path (struct iucv_path) | ||
599 | * @ipuser: User specified data for this path | ||
600 | * (AF_IUCV: port/service name and originator port) | ||
601 | * | ||
602 | * The function also severs the path (as required by the IUCV protocol) and | ||
603 | * sets the iucv state to IUCV_SEVERED for the associated struct | ||
604 | * hvc_iucv_private instance. Later, the IUCV_SEVERED state triggers a tty | ||
605 | * hangup (hvc_iucv_get_chars() / hvc_iucv_write()). | ||
606 | * | ||
607 | * If tty portion of the HVC is closed then clean up the outqueue in addition. | ||
608 | * | ||
609 | * Locking: struct hvc_iucv_private->lock | ||
610 | */ | ||
611 | static void hvc_iucv_path_severed(struct iucv_path *path, u8 ipuser[16]) | ||
612 | { | ||
613 | struct hvc_iucv_private *priv = path->private; | ||
614 | |||
615 | spin_lock(&priv->lock); | ||
616 | priv->iucv_state = IUCV_SEVERED; | ||
617 | |||
618 | /* NOTE: If the tty has not yet been opened by a getty program | ||
619 | * (e.g. to see console messages), then cleanup the | ||
620 | * hvc_iucv_private structure to allow re-connects. | ||
621 | * | ||
622 | * If the tty has been opened, the get_chars() callback returns | ||
623 | * -EPIPE to signal the hvc console layer to hang up the tty. */ | ||
624 | priv->path = NULL; | ||
625 | if (priv->tty_state == TTY_CLOSED) | ||
626 | hvc_iucv_cleanup(priv); | ||
627 | spin_unlock(&priv->lock); | ||
628 | |||
629 | /* finally sever path (outside of priv->lock due to lock ordering) */ | ||
630 | iucv_path_sever(path, ipuser); | ||
631 | iucv_path_free(path); | ||
632 | } | ||
633 | |||
634 | /** | ||
635 | * hvc_iucv_msg_pending() - IUCV handler to process an incoming IUCV message. | ||
636 | * @path: Pending path (struct iucv_path) | ||
637 | * @msg: Pointer to the IUCV message | ||
638 | * | ||
639 | * The function stores an incoming message on the input queue for later | ||
640 | * processing (by hvc_iucv_get_chars() / hvc_iucv_write()). | ||
641 | * However, if the tty has not yet been opened, the message is rejected. | ||
642 | * | ||
643 | * Locking: struct hvc_iucv_private->lock | ||
644 | */ | ||
645 | static void hvc_iucv_msg_pending(struct iucv_path *path, | ||
646 | struct iucv_message *msg) | ||
647 | { | ||
648 | struct hvc_iucv_private *priv = path->private; | ||
649 | struct iucv_tty_buffer *rb; | ||
650 | |||
651 | spin_lock(&priv->lock); | ||
652 | |||
653 | /* reject messages if tty has not yet been opened */ | ||
654 | if (priv->tty_state == TTY_CLOSED) { | ||
655 | iucv_message_reject(path, msg); | ||
656 | goto unlock_return; | ||
657 | } | ||
658 | |||
659 | /* allocate buffer an empty buffer element */ | ||
660 | rb = alloc_tty_buffer(0, GFP_ATOMIC); | ||
661 | if (!rb) { | ||
662 | iucv_message_reject(path, msg); | ||
663 | goto unlock_return; /* -ENOMEM */ | ||
664 | } | ||
665 | rb->msg = *msg; | ||
666 | |||
667 | list_add_tail(&rb->list, &priv->tty_inqueue); | ||
668 | |||
669 | hvc_kick(); /* wakup hvc console thread */ | ||
670 | |||
671 | unlock_return: | ||
672 | spin_unlock(&priv->lock); | ||
673 | } | ||
674 | |||
675 | /** | ||
676 | * hvc_iucv_msg_complete() - IUCV handler to process message completion | ||
677 | * @path: Pending path (struct iucv_path) | ||
678 | * @msg: Pointer to the IUCV message | ||
679 | * | ||
680 | * The function is called upon completion of message delivery and the | ||
681 | * message is removed from the outqueue. Additional delivery information | ||
682 | * can be found in msg->audit: rejected messages (0x040000 (IPADRJCT)) and | ||
683 | * purged messages (0x010000 (IPADPGNR)). | ||
684 | * | ||
685 | * Locking: struct hvc_iucv_private->lock | ||
686 | */ | ||
687 | static void hvc_iucv_msg_complete(struct iucv_path *path, | ||
688 | struct iucv_message *msg) | ||
689 | { | ||
690 | struct hvc_iucv_private *priv = path->private; | ||
691 | struct iucv_tty_buffer *ent, *next; | ||
692 | LIST_HEAD(list_remove); | ||
693 | |||
694 | spin_lock(&priv->lock); | ||
695 | list_for_each_entry_safe(ent, next, &priv->tty_outqueue, list) | ||
696 | if (ent->msg.id == msg->id) { | ||
697 | list_move(&ent->list, &list_remove); | ||
698 | break; | ||
699 | } | ||
700 | spin_unlock(&priv->lock); | ||
701 | destroy_tty_buffer_list(&list_remove); | ||
702 | } | ||
703 | |||
704 | |||
705 | /* HVC operations */ | ||
706 | static struct hv_ops hvc_iucv_ops = { | ||
707 | .get_chars = hvc_iucv_get_chars, | ||
708 | .put_chars = hvc_iucv_put_chars, | ||
709 | .notifier_add = hvc_iucv_notifier_add, | ||
710 | .notifier_del = hvc_iucv_notifier_del, | ||
711 | .notifier_hangup = hvc_iucv_notifier_hangup, | ||
712 | }; | ||
713 | |||
714 | /** | ||
715 | * hvc_iucv_alloc() - Allocates a new struct hvc_iucv_private instance | ||
716 | * @id: hvc_iucv_table index | ||
717 | * | ||
718 | * This function allocates a new hvc_iucv_private struct and put the | ||
719 | * instance into hvc_iucv_table at index @id. | ||
720 | * Returns 0 on success; otherwise non-zero. | ||
721 | */ | ||
722 | static int __init hvc_iucv_alloc(int id) | ||
723 | { | ||
724 | struct hvc_iucv_private *priv; | ||
725 | char name[9]; | ||
726 | int rc; | ||
727 | |||
728 | priv = kzalloc(sizeof(struct hvc_iucv_private), GFP_KERNEL); | ||
729 | if (!priv) | ||
730 | return -ENOMEM; | ||
731 | |||
732 | spin_lock_init(&priv->lock); | ||
733 | INIT_LIST_HEAD(&priv->tty_outqueue); | ||
734 | INIT_LIST_HEAD(&priv->tty_inqueue); | ||
735 | |||
736 | /* Finally allocate hvc */ | ||
737 | priv->hvc = hvc_alloc(HVC_IUCV_MAGIC + id, | ||
738 | HVC_IUCV_MAGIC + id, &hvc_iucv_ops, PAGE_SIZE); | ||
739 | if (IS_ERR(priv->hvc)) { | ||
740 | rc = PTR_ERR(priv->hvc); | ||
741 | kfree(priv); | ||
742 | return rc; | ||
743 | } | ||
744 | |||
745 | /* setup iucv related information */ | ||
746 | snprintf(name, 9, "ihvc%-4d", id); | ||
747 | memcpy(priv->srv_name, name, 8); | ||
748 | ASCEBC(priv->srv_name, 8); | ||
749 | |||
750 | hvc_iucv_table[id] = priv; | ||
751 | return 0; | ||
752 | } | ||
753 | |||
754 | /** | ||
755 | * hvc_iucv_init() - Initialization of HVC backend for z/VM IUCV | ||
756 | */ | ||
757 | static int __init hvc_iucv_init(void) | ||
758 | { | ||
759 | int rc, i; | ||
760 | |||
761 | if (!MACHINE_IS_VM) { | ||
762 | pr_warning("The z/VM IUCV Hypervisor console cannot be " | ||
763 | "used without z/VM.\n"); | ||
764 | return -ENODEV; | ||
765 | } | ||
766 | |||
767 | if (!hvc_iucv_devices) | ||
768 | return -ENODEV; | ||
769 | |||
770 | if (hvc_iucv_devices > MAX_HVC_IUCV_LINES) | ||
771 | return -EINVAL; | ||
772 | |||
773 | hvc_iucv_buffer_cache = kmem_cache_create(KMSG_COMPONENT, | ||
774 | sizeof(struct iucv_tty_buffer), | ||
775 | 0, 0, NULL); | ||
776 | if (!hvc_iucv_buffer_cache) { | ||
777 | pr_err("Not enough memory for driver initialization " | ||
778 | "(rs=%d).\n", 1); | ||
779 | return -ENOMEM; | ||
780 | } | ||
781 | |||
782 | hvc_iucv_mempool = mempool_create_slab_pool(MEMPOOL_MIN_NR, | ||
783 | hvc_iucv_buffer_cache); | ||
784 | if (!hvc_iucv_mempool) { | ||
785 | pr_err("Not enough memory for driver initialization " | ||
786 | "(rs=%d).\n", 2); | ||
787 | kmem_cache_destroy(hvc_iucv_buffer_cache); | ||
788 | return -ENOMEM; | ||
789 | } | ||
790 | |||
791 | /* allocate hvc_iucv_private structs */ | ||
792 | for (i = 0; i < hvc_iucv_devices; i++) { | ||
793 | rc = hvc_iucv_alloc(i); | ||
794 | if (rc) { | ||
795 | pr_err("Could not create new z/VM IUCV HVC backend " | ||
796 | "rc=%d.\n", rc); | ||
797 | goto out_error_hvc; | ||
798 | } | ||
799 | } | ||
800 | |||
801 | /* register IUCV callback handler */ | ||
802 | rc = iucv_register(&hvc_iucv_handler, 0); | ||
803 | if (rc) { | ||
804 | pr_err("Could not register iucv handler (rc=%d).\n", rc); | ||
805 | goto out_error_iucv; | ||
806 | } | ||
807 | |||
808 | return 0; | ||
809 | |||
810 | out_error_iucv: | ||
811 | iucv_unregister(&hvc_iucv_handler, 0); | ||
812 | out_error_hvc: | ||
813 | for (i = 0; i < hvc_iucv_devices; i++) | ||
814 | if (hvc_iucv_table[i]) { | ||
815 | if (hvc_iucv_table[i]->hvc) | ||
816 | hvc_remove(hvc_iucv_table[i]->hvc); | ||
817 | kfree(hvc_iucv_table[i]); | ||
818 | } | ||
819 | mempool_destroy(hvc_iucv_mempool); | ||
820 | kmem_cache_destroy(hvc_iucv_buffer_cache); | ||
821 | return rc; | ||
822 | } | ||
823 | |||
824 | /** | ||
825 | * hvc_iucv_console_init() - Early console initialization | ||
826 | */ | ||
827 | static int __init hvc_iucv_console_init(void) | ||
828 | { | ||
829 | if (!MACHINE_IS_VM || !hvc_iucv_devices) | ||
830 | return -ENODEV; | ||
831 | return hvc_instantiate(HVC_IUCV_MAGIC, 0, &hvc_iucv_ops); | ||
832 | } | ||
833 | |||
834 | /** | ||
835 | * hvc_iucv_config() - Parsing of hvc_iucv= kernel command line parameter | ||
836 | * @val: Parameter value (numeric) | ||
837 | */ | ||
838 | static int __init hvc_iucv_config(char *val) | ||
839 | { | ||
840 | return strict_strtoul(val, 10, &hvc_iucv_devices); | ||
841 | } | ||
842 | |||
843 | |||
844 | module_init(hvc_iucv_init); | ||
845 | console_initcall(hvc_iucv_console_init); | ||
846 | __setup("hvc_iucv=", hvc_iucv_config); | ||
847 | |||
848 | MODULE_LICENSE("GPL"); | ||
849 | MODULE_DESCRIPTION("HVC back-end for z/VM IUCV."); | ||
850 | MODULE_AUTHOR("Hendrik Brueckner <brueckner@linux.vnet.ibm.com>"); | ||
diff --git a/drivers/char/ipmi/ipmi_msghandler.c b/drivers/char/ipmi/ipmi_msghandler.c index 8a59aaa21be5..7a88dfd4427b 100644 --- a/drivers/char/ipmi/ipmi_msghandler.c +++ b/drivers/char/ipmi/ipmi_msghandler.c | |||
@@ -422,9 +422,11 @@ struct ipmi_smi { | |||
422 | /** | 422 | /** |
423 | * The driver model view of the IPMI messaging driver. | 423 | * The driver model view of the IPMI messaging driver. |
424 | */ | 424 | */ |
425 | static struct device_driver ipmidriver = { | 425 | static struct platform_driver ipmidriver = { |
426 | .name = "ipmi", | 426 | .driver = { |
427 | .bus = &platform_bus_type | 427 | .name = "ipmi", |
428 | .bus = &platform_bus_type | ||
429 | } | ||
428 | }; | 430 | }; |
429 | static DEFINE_MUTEX(ipmidriver_mutex); | 431 | static DEFINE_MUTEX(ipmidriver_mutex); |
430 | 432 | ||
@@ -2384,9 +2386,9 @@ static int ipmi_bmc_register(ipmi_smi_t intf, int ifnum, | |||
2384 | * representing the interfaced BMC already | 2386 | * representing the interfaced BMC already |
2385 | */ | 2387 | */ |
2386 | if (bmc->guid_set) | 2388 | if (bmc->guid_set) |
2387 | old_bmc = ipmi_find_bmc_guid(&ipmidriver, bmc->guid); | 2389 | old_bmc = ipmi_find_bmc_guid(&ipmidriver.driver, bmc->guid); |
2388 | else | 2390 | else |
2389 | old_bmc = ipmi_find_bmc_prod_dev_id(&ipmidriver, | 2391 | old_bmc = ipmi_find_bmc_prod_dev_id(&ipmidriver.driver, |
2390 | bmc->id.product_id, | 2392 | bmc->id.product_id, |
2391 | bmc->id.device_id); | 2393 | bmc->id.device_id); |
2392 | 2394 | ||
@@ -2416,7 +2418,7 @@ static int ipmi_bmc_register(ipmi_smi_t intf, int ifnum, | |||
2416 | snprintf(name, sizeof(name), | 2418 | snprintf(name, sizeof(name), |
2417 | "ipmi_bmc.%4.4x", bmc->id.product_id); | 2419 | "ipmi_bmc.%4.4x", bmc->id.product_id); |
2418 | 2420 | ||
2419 | while (ipmi_find_bmc_prod_dev_id(&ipmidriver, | 2421 | while (ipmi_find_bmc_prod_dev_id(&ipmidriver.driver, |
2420 | bmc->id.product_id, | 2422 | bmc->id.product_id, |
2421 | bmc->id.device_id)) { | 2423 | bmc->id.device_id)) { |
2422 | if (!warn_printed) { | 2424 | if (!warn_printed) { |
@@ -2446,7 +2448,7 @@ static int ipmi_bmc_register(ipmi_smi_t intf, int ifnum, | |||
2446 | " Unable to allocate platform device\n"); | 2448 | " Unable to allocate platform device\n"); |
2447 | return -ENOMEM; | 2449 | return -ENOMEM; |
2448 | } | 2450 | } |
2449 | bmc->dev->dev.driver = &ipmidriver; | 2451 | bmc->dev->dev.driver = &ipmidriver.driver; |
2450 | dev_set_drvdata(&bmc->dev->dev, bmc); | 2452 | dev_set_drvdata(&bmc->dev->dev, bmc); |
2451 | kref_init(&bmc->refcount); | 2453 | kref_init(&bmc->refcount); |
2452 | 2454 | ||
@@ -4247,7 +4249,7 @@ static int ipmi_init_msghandler(void) | |||
4247 | if (initialized) | 4249 | if (initialized) |
4248 | return 0; | 4250 | return 0; |
4249 | 4251 | ||
4250 | rv = driver_register(&ipmidriver); | 4252 | rv = driver_register(&ipmidriver.driver); |
4251 | if (rv) { | 4253 | if (rv) { |
4252 | printk(KERN_ERR PFX "Could not register IPMI driver\n"); | 4254 | printk(KERN_ERR PFX "Could not register IPMI driver\n"); |
4253 | return rv; | 4255 | return rv; |
@@ -4308,7 +4310,7 @@ static __exit void cleanup_ipmi(void) | |||
4308 | remove_proc_entry(proc_ipmi_root->name, NULL); | 4310 | remove_proc_entry(proc_ipmi_root->name, NULL); |
4309 | #endif /* CONFIG_PROC_FS */ | 4311 | #endif /* CONFIG_PROC_FS */ |
4310 | 4312 | ||
4311 | driver_unregister(&ipmidriver); | 4313 | driver_unregister(&ipmidriver.driver); |
4312 | 4314 | ||
4313 | initialized = 0; | 4315 | initialized = 0; |
4314 | 4316 | ||
diff --git a/drivers/char/ipmi/ipmi_si_intf.c b/drivers/char/ipmi/ipmi_si_intf.c index 3123bf57ad91..3000135f2ead 100644 --- a/drivers/char/ipmi/ipmi_si_intf.c +++ b/drivers/char/ipmi/ipmi_si_intf.c | |||
@@ -114,9 +114,11 @@ static char *si_to_str[] = { "kcs", "smic", "bt" }; | |||
114 | 114 | ||
115 | #define DEVICE_NAME "ipmi_si" | 115 | #define DEVICE_NAME "ipmi_si" |
116 | 116 | ||
117 | static struct device_driver ipmi_driver = { | 117 | static struct platform_driver ipmi_driver = { |
118 | .name = DEVICE_NAME, | 118 | .driver = { |
119 | .bus = &platform_bus_type | 119 | .name = DEVICE_NAME, |
120 | .bus = &platform_bus_type | ||
121 | } | ||
120 | }; | 122 | }; |
121 | 123 | ||
122 | 124 | ||
@@ -2868,7 +2870,7 @@ static int try_smi_init(struct smi_info *new_smi) | |||
2868 | goto out_err; | 2870 | goto out_err; |
2869 | } | 2871 | } |
2870 | new_smi->dev = &new_smi->pdev->dev; | 2872 | new_smi->dev = &new_smi->pdev->dev; |
2871 | new_smi->dev->driver = &ipmi_driver; | 2873 | new_smi->dev->driver = &ipmi_driver.driver; |
2872 | 2874 | ||
2873 | rv = platform_device_add(new_smi->pdev); | 2875 | rv = platform_device_add(new_smi->pdev); |
2874 | if (rv) { | 2876 | if (rv) { |
@@ -2983,7 +2985,7 @@ static __devinit int init_ipmi_si(void) | |||
2983 | initialized = 1; | 2985 | initialized = 1; |
2984 | 2986 | ||
2985 | /* Register the device drivers. */ | 2987 | /* Register the device drivers. */ |
2986 | rv = driver_register(&ipmi_driver); | 2988 | rv = driver_register(&ipmi_driver.driver); |
2987 | if (rv) { | 2989 | if (rv) { |
2988 | printk(KERN_ERR | 2990 | printk(KERN_ERR |
2989 | "init_ipmi_si: Unable to register driver: %d\n", | 2991 | "init_ipmi_si: Unable to register driver: %d\n", |
@@ -3052,7 +3054,7 @@ static __devinit int init_ipmi_si(void) | |||
3052 | #ifdef CONFIG_PPC_OF | 3054 | #ifdef CONFIG_PPC_OF |
3053 | of_unregister_platform_driver(&ipmi_of_platform_driver); | 3055 | of_unregister_platform_driver(&ipmi_of_platform_driver); |
3054 | #endif | 3056 | #endif |
3055 | driver_unregister(&ipmi_driver); | 3057 | driver_unregister(&ipmi_driver.driver); |
3056 | printk(KERN_WARNING | 3058 | printk(KERN_WARNING |
3057 | "ipmi_si: Unable to find any System Interface(s)\n"); | 3059 | "ipmi_si: Unable to find any System Interface(s)\n"); |
3058 | return -ENODEV; | 3060 | return -ENODEV; |
@@ -3151,7 +3153,7 @@ static __exit void cleanup_ipmi_si(void) | |||
3151 | cleanup_one_si(e); | 3153 | cleanup_one_si(e); |
3152 | mutex_unlock(&smi_infos_lock); | 3154 | mutex_unlock(&smi_infos_lock); |
3153 | 3155 | ||
3154 | driver_unregister(&ipmi_driver); | 3156 | driver_unregister(&ipmi_driver.driver); |
3155 | } | 3157 | } |
3156 | module_exit(cleanup_ipmi_si); | 3158 | module_exit(cleanup_ipmi_si); |
3157 | 3159 | ||
diff --git a/drivers/char/isicom.c b/drivers/char/isicom.c index 7d30ee1d3fca..04e4549299ba 100644 --- a/drivers/char/isicom.c +++ b/drivers/char/isicom.c | |||
@@ -7,12 +7,14 @@ | |||
7 | * Original driver code supplied by Multi-Tech | 7 | * Original driver code supplied by Multi-Tech |
8 | * | 8 | * |
9 | * Changes | 9 | * Changes |
10 | * 1/9/98 alan@redhat.com Merge to 2.0.x kernel tree | 10 | * 1/9/98 alan@lxorguk.ukuu.org.uk |
11 | * Merge to 2.0.x kernel tree | ||
11 | * Obtain and use official major/minors | 12 | * Obtain and use official major/minors |
12 | * Loader switched to a misc device | 13 | * Loader switched to a misc device |
13 | * (fixed range check bug as a side effect) | 14 | * (fixed range check bug as a side effect) |
14 | * Printk clean up | 15 | * Printk clean up |
15 | * 9/12/98 alan@redhat.com Rough port to 2.1.x | 16 | * 9/12/98 alan@lxorguk.ukuu.org.uk |
17 | * Rough port to 2.1.x | ||
16 | * | 18 | * |
17 | * 10/6/99 sameer Merged the ISA and PCI drivers to | 19 | * 10/6/99 sameer Merged the ISA and PCI drivers to |
18 | * a new unified driver. | 20 | * a new unified driver. |
diff --git a/drivers/char/istallion.c b/drivers/char/istallion.c index 44e5d60f517e..4b10770fa937 100644 --- a/drivers/char/istallion.c +++ b/drivers/char/istallion.c | |||
@@ -3739,7 +3739,7 @@ static int stli_getbrdnr(void) | |||
3739 | * do is go probing around in the usual places hoping we can find it. | 3739 | * do is go probing around in the usual places hoping we can find it. |
3740 | */ | 3740 | */ |
3741 | 3741 | ||
3742 | static int stli_findeisabrds(void) | 3742 | static int __init stli_findeisabrds(void) |
3743 | { | 3743 | { |
3744 | struct stlibrd *brdp; | 3744 | struct stlibrd *brdp; |
3745 | unsigned int iobase, eid, i; | 3745 | unsigned int iobase, eid, i; |
@@ -3935,7 +3935,7 @@ static struct stlibrd *stli_allocbrd(void) | |||
3935 | * can find. | 3935 | * can find. |
3936 | */ | 3936 | */ |
3937 | 3937 | ||
3938 | static int stli_initbrds(void) | 3938 | static int __init stli_initbrds(void) |
3939 | { | 3939 | { |
3940 | struct stlibrd *brdp, *nxtbrdp; | 3940 | struct stlibrd *brdp, *nxtbrdp; |
3941 | struct stlconf conf; | 3941 | struct stlconf conf; |
diff --git a/drivers/char/mxser.c b/drivers/char/mxser.c index 8beef50f95a0..047766915411 100644 --- a/drivers/char/mxser.c +++ b/drivers/char/mxser.c | |||
@@ -14,7 +14,8 @@ | |||
14 | * (at your option) any later version. | 14 | * (at your option) any later version. |
15 | * | 15 | * |
16 | * Fed through a cleanup, indent and remove of non 2.6 code by Alan Cox | 16 | * Fed through a cleanup, indent and remove of non 2.6 code by Alan Cox |
17 | * <alan@redhat.com>. The original 1.8 code is available on www.moxa.com. | 17 | * <alan@lxorguk.ukuu.org.uk>. The original 1.8 code is available on |
18 | * www.moxa.com. | ||
18 | * - Fixed x86_64 cleanness | 19 | * - Fixed x86_64 cleanness |
19 | */ | 20 | */ |
20 | 21 | ||
diff --git a/drivers/char/serial167.c b/drivers/char/serial167.c index 3b23270eaa65..a8f15e6be594 100644 --- a/drivers/char/serial167.c +++ b/drivers/char/serial167.c | |||
@@ -418,7 +418,7 @@ static irqreturn_t cd2401_rxerr_interrupt(int irq, void *dev_id) | |||
418 | TTY_OVERRUN); | 418 | TTY_OVERRUN); |
419 | /* | 419 | /* |
420 | If the flip buffer itself is | 420 | If the flip buffer itself is |
421 | overflowing, we still loose | 421 | overflowing, we still lose |
422 | the next incoming character. | 422 | the next incoming character. |
423 | */ | 423 | */ |
424 | if (tty_buffer_request_room(tty, 1) != | 424 | if (tty_buffer_request_room(tty, 1) != |
diff --git a/drivers/char/sonypi.c b/drivers/char/sonypi.c index 2457b07dabd6..f4374437a033 100644 --- a/drivers/char/sonypi.c +++ b/drivers/char/sonypi.c | |||
@@ -523,7 +523,7 @@ static int acpi_driver_registered; | |||
523 | 523 | ||
524 | static int sonypi_ec_write(u8 addr, u8 value) | 524 | static int sonypi_ec_write(u8 addr, u8 value) |
525 | { | 525 | { |
526 | #ifdef CONFIG_ACPI_EC | 526 | #ifdef CONFIG_ACPI |
527 | if (SONYPI_ACPI_ACTIVE) | 527 | if (SONYPI_ACPI_ACTIVE) |
528 | return ec_write(addr, value); | 528 | return ec_write(addr, value); |
529 | #endif | 529 | #endif |
@@ -539,7 +539,7 @@ static int sonypi_ec_write(u8 addr, u8 value) | |||
539 | 539 | ||
540 | static int sonypi_ec_read(u8 addr, u8 *value) | 540 | static int sonypi_ec_read(u8 addr, u8 *value) |
541 | { | 541 | { |
542 | #ifdef CONFIG_ACPI_EC | 542 | #ifdef CONFIG_ACPI |
543 | if (SONYPI_ACPI_ACTIVE) | 543 | if (SONYPI_ACPI_ACTIVE) |
544 | return ec_read(addr, value); | 544 | return ec_read(addr, value); |
545 | #endif | 545 | #endif |
diff --git a/drivers/char/specialix.c b/drivers/char/specialix.c index 242fd46fda22..a16b94f12eb2 100644 --- a/drivers/char/specialix.c +++ b/drivers/char/specialix.c | |||
@@ -72,7 +72,7 @@ | |||
72 | /* | 72 | /* |
73 | * There is a bunch of documentation about the card, jumpers, config | 73 | * There is a bunch of documentation about the card, jumpers, config |
74 | * settings, restrictions, cables, device names and numbers in | 74 | * settings, restrictions, cables, device names and numbers in |
75 | * Documentation/specialix.txt | 75 | * Documentation/serial/specialix.txt |
76 | */ | 76 | */ |
77 | 77 | ||
78 | #include <linux/module.h> | 78 | #include <linux/module.h> |
diff --git a/drivers/char/sysrq.c b/drivers/char/sysrq.c index ce0d9da52a8a..94966edfb44d 100644 --- a/drivers/char/sysrq.c +++ b/drivers/char/sysrq.c | |||
@@ -274,6 +274,22 @@ static struct sysrq_key_op sysrq_showstate_blocked_op = { | |||
274 | .enable_mask = SYSRQ_ENABLE_DUMP, | 274 | .enable_mask = SYSRQ_ENABLE_DUMP, |
275 | }; | 275 | }; |
276 | 276 | ||
277 | #ifdef CONFIG_TRACING | ||
278 | #include <linux/ftrace.h> | ||
279 | |||
280 | static void sysrq_ftrace_dump(int key, struct tty_struct *tty) | ||
281 | { | ||
282 | ftrace_dump(); | ||
283 | } | ||
284 | static struct sysrq_key_op sysrq_ftrace_dump_op = { | ||
285 | .handler = sysrq_ftrace_dump, | ||
286 | .help_msg = "dumpZ-ftrace-buffer", | ||
287 | .action_msg = "Dump ftrace buffer", | ||
288 | .enable_mask = SYSRQ_ENABLE_DUMP, | ||
289 | }; | ||
290 | #else | ||
291 | #define sysrq_ftrace_dump_op (*(struct sysrq_key_op *)0) | ||
292 | #endif | ||
277 | 293 | ||
278 | static void sysrq_handle_showmem(int key, struct tty_struct *tty) | 294 | static void sysrq_handle_showmem(int key, struct tty_struct *tty) |
279 | { | 295 | { |
@@ -406,7 +422,7 @@ static struct sysrq_key_op *sysrq_key_table[36] = { | |||
406 | NULL, /* x */ | 422 | NULL, /* x */ |
407 | /* y: May be registered on sparc64 for global register dump */ | 423 | /* y: May be registered on sparc64 for global register dump */ |
408 | NULL, /* y */ | 424 | NULL, /* y */ |
409 | NULL /* z */ | 425 | &sysrq_ftrace_dump_op, /* z */ |
410 | }; | 426 | }; |
411 | 427 | ||
412 | /* key2index calculation, -1 on invalid index */ | 428 | /* key2index calculation, -1 on invalid index */ |
diff --git a/drivers/char/tty_audit.c b/drivers/char/tty_audit.c index 5787249934c8..34ab6d798f81 100644 --- a/drivers/char/tty_audit.c +++ b/drivers/char/tty_audit.c | |||
@@ -67,6 +67,29 @@ static void tty_audit_buf_put(struct tty_audit_buf *buf) | |||
67 | tty_audit_buf_free(buf); | 67 | tty_audit_buf_free(buf); |
68 | } | 68 | } |
69 | 69 | ||
70 | static void tty_audit_log(const char *description, struct task_struct *tsk, | ||
71 | uid_t loginuid, unsigned sessionid, int major, | ||
72 | int minor, unsigned char *data, size_t size) | ||
73 | { | ||
74 | struct audit_buffer *ab; | ||
75 | |||
76 | ab = audit_log_start(NULL, GFP_KERNEL, AUDIT_TTY); | ||
77 | if (ab) { | ||
78 | char name[sizeof(tsk->comm)]; | ||
79 | uid_t uid = task_uid(tsk); | ||
80 | |||
81 | audit_log_format(ab, "%s pid=%u uid=%u auid=%u ses=%u " | ||
82 | "major=%d minor=%d comm=", description, | ||
83 | tsk->pid, uid, loginuid, sessionid, | ||
84 | major, minor); | ||
85 | get_task_comm(name, tsk); | ||
86 | audit_log_untrustedstring(ab, name); | ||
87 | audit_log_format(ab, " data="); | ||
88 | audit_log_n_hex(ab, data, size); | ||
89 | audit_log_end(ab); | ||
90 | } | ||
91 | } | ||
92 | |||
70 | /** | 93 | /** |
71 | * tty_audit_buf_push - Push buffered data out | 94 | * tty_audit_buf_push - Push buffered data out |
72 | * | 95 | * |
@@ -77,25 +100,12 @@ static void tty_audit_buf_push(struct task_struct *tsk, uid_t loginuid, | |||
77 | unsigned int sessionid, | 100 | unsigned int sessionid, |
78 | struct tty_audit_buf *buf) | 101 | struct tty_audit_buf *buf) |
79 | { | 102 | { |
80 | struct audit_buffer *ab; | ||
81 | |||
82 | if (buf->valid == 0) | 103 | if (buf->valid == 0) |
83 | return; | 104 | return; |
84 | if (audit_enabled == 0) | 105 | if (audit_enabled == 0) |
85 | return; | 106 | return; |
86 | ab = audit_log_start(NULL, GFP_KERNEL, AUDIT_TTY); | 107 | tty_audit_log("tty", tsk, loginuid, sessionid, buf->major, buf->minor, |
87 | if (ab) { | 108 | buf->data, buf->valid); |
88 | char name[sizeof(tsk->comm)]; | ||
89 | |||
90 | audit_log_format(ab, "tty pid=%u uid=%u auid=%u ses=%u " | ||
91 | "major=%d minor=%d comm=", tsk->pid, tsk->uid, | ||
92 | loginuid, sessionid, buf->major, buf->minor); | ||
93 | get_task_comm(name, tsk); | ||
94 | audit_log_untrustedstring(ab, name); | ||
95 | audit_log_format(ab, " data="); | ||
96 | audit_log_n_hex(ab, buf->data, buf->valid); | ||
97 | audit_log_end(ab); | ||
98 | } | ||
99 | buf->valid = 0; | 109 | buf->valid = 0; |
100 | } | 110 | } |
101 | 111 | ||
@@ -150,6 +160,42 @@ void tty_audit_fork(struct signal_struct *sig) | |||
150 | } | 160 | } |
151 | 161 | ||
152 | /** | 162 | /** |
163 | * tty_audit_tiocsti - Log TIOCSTI | ||
164 | */ | ||
165 | void tty_audit_tiocsti(struct tty_struct *tty, char ch) | ||
166 | { | ||
167 | struct tty_audit_buf *buf; | ||
168 | int major, minor, should_audit; | ||
169 | |||
170 | spin_lock_irq(¤t->sighand->siglock); | ||
171 | should_audit = current->signal->audit_tty; | ||
172 | buf = current->signal->tty_audit_buf; | ||
173 | if (buf) | ||
174 | atomic_inc(&buf->count); | ||
175 | spin_unlock_irq(¤t->sighand->siglock); | ||
176 | |||
177 | major = tty->driver->major; | ||
178 | minor = tty->driver->minor_start + tty->index; | ||
179 | if (buf) { | ||
180 | mutex_lock(&buf->mutex); | ||
181 | if (buf->major == major && buf->minor == minor) | ||
182 | tty_audit_buf_push_current(buf); | ||
183 | mutex_unlock(&buf->mutex); | ||
184 | tty_audit_buf_put(buf); | ||
185 | } | ||
186 | |||
187 | if (should_audit && audit_enabled) { | ||
188 | uid_t auid; | ||
189 | unsigned int sessionid; | ||
190 | |||
191 | auid = audit_get_loginuid(current); | ||
192 | sessionid = audit_get_sessionid(current); | ||
193 | tty_audit_log("ioctl=TIOCSTI", current, auid, sessionid, major, | ||
194 | minor, &ch, 1); | ||
195 | } | ||
196 | } | ||
197 | |||
198 | /** | ||
153 | * tty_audit_push_task - Flush task's pending audit data | 199 | * tty_audit_push_task - Flush task's pending audit data |
154 | */ | 200 | */ |
155 | void tty_audit_push_task(struct task_struct *tsk, uid_t loginuid, u32 sessionid) | 201 | void tty_audit_push_task(struct task_struct *tsk, uid_t loginuid, u32 sessionid) |
diff --git a/drivers/char/tty_io.c b/drivers/char/tty_io.c index 59f472143f08..db15f9ba7c0b 100644 --- a/drivers/char/tty_io.c +++ b/drivers/char/tty_io.c | |||
@@ -1795,12 +1795,15 @@ retry_open: | |||
1795 | } | 1795 | } |
1796 | #endif | 1796 | #endif |
1797 | if (device == MKDEV(TTYAUX_MAJOR, 1)) { | 1797 | if (device == MKDEV(TTYAUX_MAJOR, 1)) { |
1798 | driver = tty_driver_kref_get(console_device(&index)); | 1798 | struct tty_driver *console_driver = console_device(&index); |
1799 | if (driver) { | 1799 | if (console_driver) { |
1800 | /* Don't let /dev/console block */ | 1800 | driver = tty_driver_kref_get(console_driver); |
1801 | filp->f_flags |= O_NONBLOCK; | 1801 | if (driver) { |
1802 | noctty = 1; | 1802 | /* Don't let /dev/console block */ |
1803 | goto got_driver; | 1803 | filp->f_flags |= O_NONBLOCK; |
1804 | noctty = 1; | ||
1805 | goto got_driver; | ||
1806 | } | ||
1804 | } | 1807 | } |
1805 | mutex_unlock(&tty_mutex); | 1808 | mutex_unlock(&tty_mutex); |
1806 | return -ENODEV; | 1809 | return -ENODEV; |
@@ -2015,6 +2018,7 @@ static int tiocsti(struct tty_struct *tty, char __user *p) | |||
2015 | return -EPERM; | 2018 | return -EPERM; |
2016 | if (get_user(ch, p)) | 2019 | if (get_user(ch, p)) |
2017 | return -EFAULT; | 2020 | return -EFAULT; |
2021 | tty_audit_tiocsti(tty, ch); | ||
2018 | ld = tty_ldisc_ref_wait(tty); | 2022 | ld = tty_ldisc_ref_wait(tty); |
2019 | ld->ops->receive_buf(tty, &ch, &mbz, 1); | 2023 | ld->ops->receive_buf(tty, &ch, &mbz, 1); |
2020 | tty_ldisc_deref(ld); | 2024 | tty_ldisc_deref(ld); |
diff --git a/drivers/char/vt.c b/drivers/char/vt.c index a5af6072e2b3..008176edbd64 100644 --- a/drivers/char/vt.c +++ b/drivers/char/vt.c | |||
@@ -2274,7 +2274,7 @@ rescan_last_byte: | |||
2274 | continue; /* nothing to display */ | 2274 | continue; /* nothing to display */ |
2275 | } | 2275 | } |
2276 | /* Glyph not found */ | 2276 | /* Glyph not found */ |
2277 | if ((!(vc->vc_utf && !vc->vc_disp_ctrl) || c < 128) && !(c & ~charmask)) { | 2277 | if ((!(vc->vc_utf && !vc->vc_disp_ctrl) && c < 128) && !(c & ~charmask)) { |
2278 | /* In legacy mode use the glyph we get by a 1:1 mapping. | 2278 | /* In legacy mode use the glyph we get by a 1:1 mapping. |
2279 | This would make absolutely no sense with Unicode in mind, | 2279 | This would make absolutely no sense with Unicode in mind, |
2280 | but do this for ASCII characters since a font may lack | 2280 | but do this for ASCII characters since a font may lack |
diff --git a/drivers/char/xilinx_hwicap/buffer_icap.c b/drivers/char/xilinx_hwicap/buffer_icap.c index aa7f7962a9a0..05d897764f02 100644 --- a/drivers/char/xilinx_hwicap/buffer_icap.c +++ b/drivers/char/xilinx_hwicap/buffer_icap.c | |||
@@ -21,9 +21,6 @@ | |||
21 | * INFRINGEMENT, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS | 21 | * INFRINGEMENT, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS |
22 | * FOR A PARTICULAR PURPOSE. | 22 | * FOR A PARTICULAR PURPOSE. |
23 | * | 23 | * |
24 | * Xilinx products are not intended for use in life support appliances, | ||
25 | * devices, or systems. Use in such applications is expressly prohibited. | ||
26 | * | ||
27 | * (c) Copyright 2003-2008 Xilinx Inc. | 24 | * (c) Copyright 2003-2008 Xilinx Inc. |
28 | * All rights reserved. | 25 | * All rights reserved. |
29 | * | 26 | * |
diff --git a/drivers/char/xilinx_hwicap/buffer_icap.h b/drivers/char/xilinx_hwicap/buffer_icap.h index 8b0252bf06e2..d4f419ee87ab 100644 --- a/drivers/char/xilinx_hwicap/buffer_icap.h +++ b/drivers/char/xilinx_hwicap/buffer_icap.h | |||
@@ -21,9 +21,6 @@ | |||
21 | * INFRINGEMENT, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS | 21 | * INFRINGEMENT, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS |
22 | * FOR A PARTICULAR PURPOSE. | 22 | * FOR A PARTICULAR PURPOSE. |
23 | * | 23 | * |
24 | * Xilinx products are not intended for use in life support appliances, | ||
25 | * devices, or systems. Use in such applications is expressly prohibited. | ||
26 | * | ||
27 | * (c) Copyright 2003-2008 Xilinx Inc. | 24 | * (c) Copyright 2003-2008 Xilinx Inc. |
28 | * All rights reserved. | 25 | * All rights reserved. |
29 | * | 26 | * |
diff --git a/drivers/char/xilinx_hwicap/fifo_icap.c b/drivers/char/xilinx_hwicap/fifo_icap.c index 776b50528478..02225eb19cf6 100644 --- a/drivers/char/xilinx_hwicap/fifo_icap.c +++ b/drivers/char/xilinx_hwicap/fifo_icap.c | |||
@@ -21,9 +21,6 @@ | |||
21 | * INFRINGEMENT, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS | 21 | * INFRINGEMENT, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS |
22 | * FOR A PARTICULAR PURPOSE. | 22 | * FOR A PARTICULAR PURPOSE. |
23 | * | 23 | * |
24 | * Xilinx products are not intended for use in life support appliances, | ||
25 | * devices, or systems. Use in such applications is expressly prohibited. | ||
26 | * | ||
27 | * (c) Copyright 2007-2008 Xilinx Inc. | 24 | * (c) Copyright 2007-2008 Xilinx Inc. |
28 | * All rights reserved. | 25 | * All rights reserved. |
29 | * | 26 | * |
diff --git a/drivers/char/xilinx_hwicap/fifo_icap.h b/drivers/char/xilinx_hwicap/fifo_icap.h index 62bda453c90b..4c9dd9a3b62a 100644 --- a/drivers/char/xilinx_hwicap/fifo_icap.h +++ b/drivers/char/xilinx_hwicap/fifo_icap.h | |||
@@ -21,9 +21,6 @@ | |||
21 | * INFRINGEMENT, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS | 21 | * INFRINGEMENT, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS |
22 | * FOR A PARTICULAR PURPOSE. | 22 | * FOR A PARTICULAR PURPOSE. |
23 | * | 23 | * |
24 | * Xilinx products are not intended for use in life support appliances, | ||
25 | * devices, or systems. Use in such applications is expressly prohibited. | ||
26 | * | ||
27 | * (c) Copyright 2007-2008 Xilinx Inc. | 24 | * (c) Copyright 2007-2008 Xilinx Inc. |
28 | * All rights reserved. | 25 | * All rights reserved. |
29 | * | 26 | * |
diff --git a/drivers/char/xilinx_hwicap/xilinx_hwicap.c b/drivers/char/xilinx_hwicap/xilinx_hwicap.c index ed132fe55d3d..f40ab699860f 100644 --- a/drivers/char/xilinx_hwicap/xilinx_hwicap.c +++ b/drivers/char/xilinx_hwicap/xilinx_hwicap.c | |||
@@ -21,9 +21,6 @@ | |||
21 | * INFRINGEMENT, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS | 21 | * INFRINGEMENT, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS |
22 | * FOR A PARTICULAR PURPOSE. | 22 | * FOR A PARTICULAR PURPOSE. |
23 | * | 23 | * |
24 | * Xilinx products are not intended for use in life support appliances, | ||
25 | * devices, or systems. Use in such applications is expressly prohibited. | ||
26 | * | ||
27 | * (c) Copyright 2002 Xilinx Inc., Systems Engineering Group | 24 | * (c) Copyright 2002 Xilinx Inc., Systems Engineering Group |
28 | * (c) Copyright 2004 Xilinx Inc., Systems Engineering Group | 25 | * (c) Copyright 2004 Xilinx Inc., Systems Engineering Group |
29 | * (c) Copyright 2007-2008 Xilinx Inc. | 26 | * (c) Copyright 2007-2008 Xilinx Inc. |
@@ -626,7 +623,7 @@ static int __devinit hwicap_setup(struct device *dev, int id, | |||
626 | if (!request_mem_region(drvdata->mem_start, | 623 | if (!request_mem_region(drvdata->mem_start, |
627 | drvdata->mem_size, DRIVER_NAME)) { | 624 | drvdata->mem_size, DRIVER_NAME)) { |
628 | dev_err(dev, "Couldn't lock memory region at %Lx\n", | 625 | dev_err(dev, "Couldn't lock memory region at %Lx\n", |
629 | regs_res->start); | 626 | (unsigned long long) regs_res->start); |
630 | retval = -EBUSY; | 627 | retval = -EBUSY; |
631 | goto failed1; | 628 | goto failed1; |
632 | } | 629 | } |
@@ -645,9 +642,10 @@ static int __devinit hwicap_setup(struct device *dev, int id, | |||
645 | mutex_init(&drvdata->sem); | 642 | mutex_init(&drvdata->sem); |
646 | drvdata->is_open = 0; | 643 | drvdata->is_open = 0; |
647 | 644 | ||
648 | dev_info(dev, "ioremap %lx to %p with size %Lx\n", | 645 | dev_info(dev, "ioremap %llx to %p with size %llx\n", |
649 | (unsigned long int)drvdata->mem_start, | 646 | (unsigned long long) drvdata->mem_start, |
650 | drvdata->base_address, drvdata->mem_size); | 647 | drvdata->base_address, |
648 | (unsigned long long) drvdata->mem_size); | ||
651 | 649 | ||
652 | cdev_init(&drvdata->cdev, &hwicap_fops); | 650 | cdev_init(&drvdata->cdev, &hwicap_fops); |
653 | drvdata->cdev.owner = THIS_MODULE; | 651 | drvdata->cdev.owner = THIS_MODULE; |
diff --git a/drivers/char/xilinx_hwicap/xilinx_hwicap.h b/drivers/char/xilinx_hwicap/xilinx_hwicap.h index 24d0d9b938fb..8cca11981c5f 100644 --- a/drivers/char/xilinx_hwicap/xilinx_hwicap.h +++ b/drivers/char/xilinx_hwicap/xilinx_hwicap.h | |||
@@ -21,9 +21,6 @@ | |||
21 | * INFRINGEMENT, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS | 21 | * INFRINGEMENT, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS |
22 | * FOR A PARTICULAR PURPOSE. | 22 | * FOR A PARTICULAR PURPOSE. |
23 | * | 23 | * |
24 | * Xilinx products are not intended for use in life support appliances, | ||
25 | * devices, or systems. Use in such applications is expressly prohibited. | ||
26 | * | ||
27 | * (c) Copyright 2003-2007 Xilinx Inc. | 24 | * (c) Copyright 2003-2007 Xilinx Inc. |
28 | * All rights reserved. | 25 | * All rights reserved. |
29 | * | 26 | * |