Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | /* |
| 2 | * drivers/s390/cio/cio.c |
| 3 | * S/390 common I/O routines -- low level i/o calls |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4 | * |
Cornelia Huck | 0ae7a7b | 2008-07-14 09:58:43 +0200 | [diff] [blame] | 5 | * Copyright IBM Corp. 1999,2008 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6 | * Author(s): Ingo Adlung (adlung@de.ibm.com) |
Cornelia Huck | 4ce3b30 | 2006-01-14 13:21:04 -0800 | [diff] [blame] | 7 | * Cornelia Huck (cornelia.huck@de.ibm.com) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 8 | * Arnd Bergmann (arndb@de.ibm.com) |
| 9 | * Martin Schwidefsky (schwidefsky@de.ibm.com) |
| 10 | */ |
| 11 | |
| 12 | #include <linux/module.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 13 | #include <linux/init.h> |
| 14 | #include <linux/slab.h> |
| 15 | #include <linux/device.h> |
| 16 | #include <linux/kernel_stat.h> |
| 17 | #include <linux/interrupt.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 18 | #include <asm/cio.h> |
| 19 | #include <asm/delay.h> |
| 20 | #include <asm/irq.h> |
Heiko Carstens | 5a489b9 | 2006-10-06 16:38:35 +0200 | [diff] [blame] | 21 | #include <asm/irq_regs.h> |
Heiko Carstens | e87bfe5 | 2006-09-20 15:59:15 +0200 | [diff] [blame] | 22 | #include <asm/setup.h> |
Heiko Carstens | 15e9b58 | 2006-12-04 15:40:26 +0100 | [diff] [blame] | 23 | #include <asm/reset.h> |
Michael Holzheu | 46b05d2 | 2007-02-21 10:55:21 +0100 | [diff] [blame] | 24 | #include <asm/ipl.h> |
Peter Oberparleiter | e5854a5 | 2007-04-27 16:01:31 +0200 | [diff] [blame] | 25 | #include <asm/chpid.h> |
Peter Oberparleiter | 4e8e56c | 2008-01-26 14:10:44 +0100 | [diff] [blame] | 26 | #include <asm/airq.h> |
Heiko Carstens | 43ca5c3 | 2008-04-17 07:46:23 +0200 | [diff] [blame] | 27 | #include <asm/cpu.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 28 | #include "cio.h" |
| 29 | #include "css.h" |
| 30 | #include "chsc.h" |
| 31 | #include "ioasm.h" |
Cornelia Huck | cd6b4f2 | 2008-01-26 14:10:43 +0100 | [diff] [blame] | 32 | #include "io_sch.h" |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 33 | #include "blacklist.h" |
| 34 | #include "cio_debug.h" |
Peter Oberparleiter | e6b6e10 | 2007-04-27 16:01:28 +0200 | [diff] [blame] | 35 | #include "chp.h" |
Heiko Carstens | 15e9b58 | 2006-12-04 15:40:26 +0100 | [diff] [blame] | 36 | #include "../s390mach.h" |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 37 | |
| 38 | debug_info_t *cio_debug_msg_id; |
| 39 | debug_info_t *cio_debug_trace_id; |
| 40 | debug_info_t *cio_debug_crw_id; |
| 41 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 42 | /* |
| 43 | * Function: cio_debug_init |
Cornelia Huck | bc698bc | 2008-01-26 14:10:42 +0100 | [diff] [blame] | 44 | * Initializes three debug logs for common I/O: |
| 45 | * - cio_msg logs generic cio messages |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 46 | * - cio_trace logs the calling of different functions |
Cornelia Huck | bc698bc | 2008-01-26 14:10:42 +0100 | [diff] [blame] | 47 | * - cio_crw logs machine check related cio messages |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 48 | */ |
Cornelia Huck | bc698bc | 2008-01-26 14:10:42 +0100 | [diff] [blame] | 49 | static int __init cio_debug_init(void) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 50 | { |
Peter Tiedemann | 361f494 | 2008-01-26 14:11:30 +0100 | [diff] [blame] | 51 | cio_debug_msg_id = debug_register("cio_msg", 16, 1, 16 * sizeof(long)); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 52 | if (!cio_debug_msg_id) |
| 53 | goto out_unregister; |
Cornelia Huck | bc698bc | 2008-01-26 14:10:42 +0100 | [diff] [blame] | 54 | debug_register_view(cio_debug_msg_id, &debug_sprintf_view); |
| 55 | debug_set_level(cio_debug_msg_id, 2); |
Peter Tiedemann | 361f494 | 2008-01-26 14:11:30 +0100 | [diff] [blame] | 56 | cio_debug_trace_id = debug_register("cio_trace", 16, 1, 16); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 57 | if (!cio_debug_trace_id) |
| 58 | goto out_unregister; |
Cornelia Huck | bc698bc | 2008-01-26 14:10:42 +0100 | [diff] [blame] | 59 | debug_register_view(cio_debug_trace_id, &debug_hex_ascii_view); |
| 60 | debug_set_level(cio_debug_trace_id, 2); |
Peter Tiedemann | 361f494 | 2008-01-26 14:11:30 +0100 | [diff] [blame] | 61 | cio_debug_crw_id = debug_register("cio_crw", 16, 1, 16 * sizeof(long)); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 62 | if (!cio_debug_crw_id) |
| 63 | goto out_unregister; |
Cornelia Huck | bc698bc | 2008-01-26 14:10:42 +0100 | [diff] [blame] | 64 | debug_register_view(cio_debug_crw_id, &debug_sprintf_view); |
| 65 | debug_set_level(cio_debug_crw_id, 4); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 66 | return 0; |
| 67 | |
| 68 | out_unregister: |
| 69 | if (cio_debug_msg_id) |
Cornelia Huck | bc698bc | 2008-01-26 14:10:42 +0100 | [diff] [blame] | 70 | debug_unregister(cio_debug_msg_id); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 71 | if (cio_debug_trace_id) |
Cornelia Huck | bc698bc | 2008-01-26 14:10:42 +0100 | [diff] [blame] | 72 | debug_unregister(cio_debug_trace_id); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 73 | if (cio_debug_crw_id) |
Cornelia Huck | bc698bc | 2008-01-26 14:10:42 +0100 | [diff] [blame] | 74 | debug_unregister(cio_debug_crw_id); |
Cornelia Huck | e556bbb | 2007-07-27 12:29:19 +0200 | [diff] [blame] | 75 | printk(KERN_WARNING"cio: could not initialize debugging\n"); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 76 | return -1; |
| 77 | } |
| 78 | |
| 79 | arch_initcall (cio_debug_init); |
| 80 | |
| 81 | int |
| 82 | cio_set_options (struct subchannel *sch, int flags) |
| 83 | { |
| 84 | sch->options.suspend = (flags & DOIO_ALLOW_SUSPEND) != 0; |
| 85 | sch->options.prefetch = (flags & DOIO_DENY_PREFETCH) != 0; |
| 86 | sch->options.inter = (flags & DOIO_SUPPRESS_INTER) != 0; |
| 87 | return 0; |
| 88 | } |
| 89 | |
| 90 | /* FIXME: who wants to use this? */ |
| 91 | int |
| 92 | cio_get_options (struct subchannel *sch) |
| 93 | { |
| 94 | int flags; |
| 95 | |
| 96 | flags = 0; |
| 97 | if (sch->options.suspend) |
| 98 | flags |= DOIO_ALLOW_SUSPEND; |
| 99 | if (sch->options.prefetch) |
| 100 | flags |= DOIO_DENY_PREFETCH; |
| 101 | if (sch->options.inter) |
| 102 | flags |= DOIO_SUPPRESS_INTER; |
| 103 | return flags; |
| 104 | } |
| 105 | |
| 106 | /* |
| 107 | * Use tpi to get a pending interrupt, call the interrupt handler and |
| 108 | * return a pointer to the subchannel structure. |
| 109 | */ |
Heiko Carstens | 4d284ca | 2007-02-05 21:18:53 +0100 | [diff] [blame] | 110 | static int |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 111 | cio_tpi(void) |
| 112 | { |
| 113 | struct tpi_info *tpi_info; |
| 114 | struct subchannel *sch; |
| 115 | struct irb *irb; |
| 116 | |
| 117 | tpi_info = (struct tpi_info *) __LC_SUBCHANNEL_ID; |
| 118 | if (tpi (NULL) != 1) |
| 119 | return 0; |
| 120 | irb = (struct irb *) __LC_IRB; |
| 121 | /* Store interrupt response block to lowcore. */ |
Cornelia Huck | a8237fc | 2006-01-06 00:19:21 -0800 | [diff] [blame] | 122 | if (tsch (tpi_info->schid, irb) != 0) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 123 | /* Not status pending or not operational. */ |
| 124 | return 1; |
| 125 | sch = (struct subchannel *)(unsigned long)tpi_info->intparm; |
| 126 | if (!sch) |
| 127 | return 1; |
| 128 | local_bh_disable(); |
| 129 | irq_enter (); |
Cornelia Huck | 2ec2298 | 2006-12-08 15:54:26 +0100 | [diff] [blame] | 130 | spin_lock(sch->lock); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 131 | memcpy (&sch->schib.scsw, &irb->scsw, sizeof (struct scsw)); |
| 132 | if (sch->driver && sch->driver->irq) |
Cornelia Huck | 602b20f | 2008-01-26 14:10:39 +0100 | [diff] [blame] | 133 | sch->driver->irq(sch); |
Cornelia Huck | 2ec2298 | 2006-12-08 15:54:26 +0100 | [diff] [blame] | 134 | spin_unlock(sch->lock); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 135 | irq_exit (); |
Heiko Carstens | 1f194a4 | 2006-07-03 00:24:46 -0700 | [diff] [blame] | 136 | _local_bh_enable(); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 137 | return 1; |
| 138 | } |
| 139 | |
Heiko Carstens | 4d284ca | 2007-02-05 21:18:53 +0100 | [diff] [blame] | 140 | static int |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 141 | cio_start_handle_notoper(struct subchannel *sch, __u8 lpm) |
| 142 | { |
| 143 | char dbf_text[15]; |
| 144 | |
| 145 | if (lpm != 0) |
| 146 | sch->lpm &= ~lpm; |
| 147 | else |
| 148 | sch->lpm = 0; |
| 149 | |
Cornelia Huck | a8237fc | 2006-01-06 00:19:21 -0800 | [diff] [blame] | 150 | stsch (sch->schid, &sch->schib); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 151 | |
Michael Ernst | 139b83d | 2008-05-07 09:22:54 +0200 | [diff] [blame] | 152 | CIO_MSG_EVENT(2, "cio_start: 'not oper' status for " |
Cornelia Huck | fb6958a | 2006-01-06 00:19:25 -0800 | [diff] [blame] | 153 | "subchannel 0.%x.%04x!\n", sch->schid.ssid, |
| 154 | sch->schid.sch_no); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 155 | sprintf(dbf_text, "no%s", sch->dev.bus_id); |
| 156 | CIO_TRACE_EVENT(0, dbf_text); |
| 157 | CIO_HEX_EVENT(0, &sch->schib, sizeof (struct schib)); |
| 158 | |
| 159 | return (sch->lpm ? -EACCES : -ENODEV); |
| 160 | } |
| 161 | |
| 162 | int |
| 163 | cio_start_key (struct subchannel *sch, /* subchannel structure */ |
| 164 | struct ccw1 * cpa, /* logical channel prog addr */ |
| 165 | __u8 lpm, /* logical path mask */ |
| 166 | __u8 key) /* storage key */ |
| 167 | { |
| 168 | char dbf_txt[15]; |
| 169 | int ccode; |
Cornelia Huck | cd6b4f2 | 2008-01-26 14:10:43 +0100 | [diff] [blame] | 170 | struct orb *orb; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 171 | |
Cornelia Huck | cd6b4f2 | 2008-01-26 14:10:43 +0100 | [diff] [blame] | 172 | CIO_TRACE_EVENT(4, "stIO"); |
| 173 | CIO_TRACE_EVENT(4, sch->dev.bus_id); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 174 | |
Cornelia Huck | cd6b4f2 | 2008-01-26 14:10:43 +0100 | [diff] [blame] | 175 | orb = &to_io_private(sch)->orb; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 176 | /* sch is always under 2G. */ |
Cornelia Huck | cd6b4f2 | 2008-01-26 14:10:43 +0100 | [diff] [blame] | 177 | orb->intparm = (u32)(addr_t)sch; |
| 178 | orb->fmt = 1; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 179 | |
Cornelia Huck | cd6b4f2 | 2008-01-26 14:10:43 +0100 | [diff] [blame] | 180 | orb->pfch = sch->options.prefetch == 0; |
| 181 | orb->spnd = sch->options.suspend; |
| 182 | orb->ssic = sch->options.suspend && sch->options.inter; |
| 183 | orb->lpm = (lpm != 0) ? lpm : sch->lpm; |
Martin Schwidefsky | 347a8dc | 2006-01-06 00:19:28 -0800 | [diff] [blame] | 184 | #ifdef CONFIG_64BIT |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 185 | /* |
| 186 | * for 64 bit we always support 64 bit IDAWs with 4k page size only |
| 187 | */ |
Cornelia Huck | cd6b4f2 | 2008-01-26 14:10:43 +0100 | [diff] [blame] | 188 | orb->c64 = 1; |
| 189 | orb->i2k = 0; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 190 | #endif |
Cornelia Huck | cd6b4f2 | 2008-01-26 14:10:43 +0100 | [diff] [blame] | 191 | orb->key = key >> 4; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 192 | /* issue "Start Subchannel" */ |
Cornelia Huck | cd6b4f2 | 2008-01-26 14:10:43 +0100 | [diff] [blame] | 193 | orb->cpa = (__u32) __pa(cpa); |
| 194 | ccode = ssch(sch->schid, orb); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 195 | |
| 196 | /* process condition code */ |
Cornelia Huck | cd6b4f2 | 2008-01-26 14:10:43 +0100 | [diff] [blame] | 197 | sprintf(dbf_txt, "ccode:%d", ccode); |
| 198 | CIO_TRACE_EVENT(4, dbf_txt); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 199 | |
| 200 | switch (ccode) { |
| 201 | case 0: |
| 202 | /* |
| 203 | * initialize device status information |
| 204 | */ |
| 205 | sch->schib.scsw.actl |= SCSW_ACTL_START_PEND; |
| 206 | return 0; |
| 207 | case 1: /* status pending */ |
| 208 | case 2: /* busy */ |
| 209 | return -EBUSY; |
| 210 | default: /* device/path not operational */ |
| 211 | return cio_start_handle_notoper(sch, lpm); |
| 212 | } |
| 213 | } |
| 214 | |
| 215 | int |
| 216 | cio_start (struct subchannel *sch, struct ccw1 *cpa, __u8 lpm) |
| 217 | { |
Peter Oberparleiter | 0b642ed | 2005-05-01 08:58:58 -0700 | [diff] [blame] | 218 | return cio_start_key(sch, cpa, lpm, PAGE_DEFAULT_KEY); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 219 | } |
| 220 | |
| 221 | /* |
| 222 | * resume suspended I/O operation |
| 223 | */ |
| 224 | int |
| 225 | cio_resume (struct subchannel *sch) |
| 226 | { |
| 227 | char dbf_txt[15]; |
| 228 | int ccode; |
| 229 | |
| 230 | CIO_TRACE_EVENT (4, "resIO"); |
| 231 | CIO_TRACE_EVENT (4, sch->dev.bus_id); |
| 232 | |
Cornelia Huck | a8237fc | 2006-01-06 00:19:21 -0800 | [diff] [blame] | 233 | ccode = rsch (sch->schid); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 234 | |
| 235 | sprintf (dbf_txt, "ccode:%d", ccode); |
| 236 | CIO_TRACE_EVENT (4, dbf_txt); |
| 237 | |
| 238 | switch (ccode) { |
| 239 | case 0: |
| 240 | sch->schib.scsw.actl |= SCSW_ACTL_RESUME_PEND; |
| 241 | return 0; |
| 242 | case 1: |
| 243 | return -EBUSY; |
| 244 | case 2: |
| 245 | return -EINVAL; |
| 246 | default: |
| 247 | /* |
| 248 | * useless to wait for request completion |
| 249 | * as device is no longer operational ! |
| 250 | */ |
| 251 | return -ENODEV; |
| 252 | } |
| 253 | } |
| 254 | |
| 255 | /* |
| 256 | * halt I/O operation |
| 257 | */ |
| 258 | int |
| 259 | cio_halt(struct subchannel *sch) |
| 260 | { |
| 261 | char dbf_txt[15]; |
| 262 | int ccode; |
| 263 | |
| 264 | if (!sch) |
| 265 | return -ENODEV; |
| 266 | |
| 267 | CIO_TRACE_EVENT (2, "haltIO"); |
| 268 | CIO_TRACE_EVENT (2, sch->dev.bus_id); |
| 269 | |
| 270 | /* |
| 271 | * Issue "Halt subchannel" and process condition code |
| 272 | */ |
Cornelia Huck | a8237fc | 2006-01-06 00:19:21 -0800 | [diff] [blame] | 273 | ccode = hsch (sch->schid); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 274 | |
| 275 | sprintf (dbf_txt, "ccode:%d", ccode); |
| 276 | CIO_TRACE_EVENT (2, dbf_txt); |
| 277 | |
| 278 | switch (ccode) { |
| 279 | case 0: |
| 280 | sch->schib.scsw.actl |= SCSW_ACTL_HALT_PEND; |
| 281 | return 0; |
| 282 | case 1: /* status pending */ |
| 283 | case 2: /* busy */ |
| 284 | return -EBUSY; |
| 285 | default: /* device not operational */ |
| 286 | return -ENODEV; |
| 287 | } |
| 288 | } |
| 289 | |
| 290 | /* |
| 291 | * Clear I/O operation |
| 292 | */ |
| 293 | int |
| 294 | cio_clear(struct subchannel *sch) |
| 295 | { |
| 296 | char dbf_txt[15]; |
| 297 | int ccode; |
| 298 | |
| 299 | if (!sch) |
| 300 | return -ENODEV; |
| 301 | |
| 302 | CIO_TRACE_EVENT (2, "clearIO"); |
| 303 | CIO_TRACE_EVENT (2, sch->dev.bus_id); |
| 304 | |
| 305 | /* |
| 306 | * Issue "Clear subchannel" and process condition code |
| 307 | */ |
Cornelia Huck | a8237fc | 2006-01-06 00:19:21 -0800 | [diff] [blame] | 308 | ccode = csch (sch->schid); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 309 | |
| 310 | sprintf (dbf_txt, "ccode:%d", ccode); |
| 311 | CIO_TRACE_EVENT (2, dbf_txt); |
| 312 | |
| 313 | switch (ccode) { |
| 314 | case 0: |
| 315 | sch->schib.scsw.actl |= SCSW_ACTL_CLEAR_PEND; |
| 316 | return 0; |
| 317 | default: /* device not operational */ |
| 318 | return -ENODEV; |
| 319 | } |
| 320 | } |
| 321 | |
| 322 | /* |
| 323 | * Function: cio_cancel |
| 324 | * Issues a "Cancel Subchannel" on the specified subchannel |
| 325 | * Note: We don't need any fancy intparms and flags here |
| 326 | * since xsch is executed synchronously. |
| 327 | * Only for common I/O internal use as for now. |
| 328 | */ |
| 329 | int |
| 330 | cio_cancel (struct subchannel *sch) |
| 331 | { |
| 332 | char dbf_txt[15]; |
| 333 | int ccode; |
| 334 | |
| 335 | if (!sch) |
| 336 | return -ENODEV; |
| 337 | |
| 338 | CIO_TRACE_EVENT (2, "cancelIO"); |
| 339 | CIO_TRACE_EVENT (2, sch->dev.bus_id); |
| 340 | |
Cornelia Huck | a8237fc | 2006-01-06 00:19:21 -0800 | [diff] [blame] | 341 | ccode = xsch (sch->schid); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 342 | |
| 343 | sprintf (dbf_txt, "ccode:%d", ccode); |
| 344 | CIO_TRACE_EVENT (2, dbf_txt); |
| 345 | |
| 346 | switch (ccode) { |
| 347 | case 0: /* success */ |
| 348 | /* Update information in scsw. */ |
Cornelia Huck | a8237fc | 2006-01-06 00:19:21 -0800 | [diff] [blame] | 349 | stsch (sch->schid, &sch->schib); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 350 | return 0; |
| 351 | case 1: /* status pending */ |
| 352 | return -EBUSY; |
| 353 | case 2: /* not applicable */ |
| 354 | return -EINVAL; |
| 355 | default: /* not oper */ |
| 356 | return -ENODEV; |
| 357 | } |
| 358 | } |
| 359 | |
| 360 | /* |
| 361 | * Function: cio_modify |
| 362 | * Issues a "Modify Subchannel" on the specified subchannel |
| 363 | */ |
| 364 | int |
| 365 | cio_modify (struct subchannel *sch) |
| 366 | { |
| 367 | int ccode, retry, ret; |
| 368 | |
| 369 | ret = 0; |
| 370 | for (retry = 0; retry < 5; retry++) { |
Cornelia Huck | a8237fc | 2006-01-06 00:19:21 -0800 | [diff] [blame] | 371 | ccode = msch_err (sch->schid, &sch->schib); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 372 | if (ccode < 0) /* -EIO if msch gets a program check. */ |
| 373 | return ccode; |
| 374 | switch (ccode) { |
| 375 | case 0: /* successfull */ |
| 376 | return 0; |
| 377 | case 1: /* status pending */ |
| 378 | return -EBUSY; |
| 379 | case 2: /* busy */ |
| 380 | udelay (100); /* allow for recovery */ |
| 381 | ret = -EBUSY; |
| 382 | break; |
| 383 | case 3: /* not operational */ |
| 384 | return -ENODEV; |
| 385 | } |
| 386 | } |
| 387 | return ret; |
| 388 | } |
| 389 | |
Cornelia Huck | 44a1c19 | 2008-07-14 09:58:47 +0200 | [diff] [blame^] | 390 | /** |
| 391 | * cio_enable_subchannel - enable a subchannel. |
| 392 | * @sch: subchannel to be enabled |
| 393 | * @intparm: interruption parameter to set |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 394 | */ |
Cornelia Huck | edf2209 | 2008-04-30 13:38:39 +0200 | [diff] [blame] | 395 | int cio_enable_subchannel(struct subchannel *sch, u32 intparm) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 396 | { |
| 397 | char dbf_txt[15]; |
| 398 | int ccode; |
| 399 | int retry; |
| 400 | int ret; |
| 401 | |
| 402 | CIO_TRACE_EVENT (2, "ensch"); |
| 403 | CIO_TRACE_EVENT (2, sch->dev.bus_id); |
| 404 | |
Cornelia Huck | d7b5a4c | 2006-12-08 15:54:28 +0100 | [diff] [blame] | 405 | if (sch_is_pseudo_sch(sch)) |
| 406 | return -EINVAL; |
Cornelia Huck | a8237fc | 2006-01-06 00:19:21 -0800 | [diff] [blame] | 407 | ccode = stsch (sch->schid, &sch->schib); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 408 | if (ccode) |
| 409 | return -ENODEV; |
| 410 | |
| 411 | for (retry = 5, ret = 0; retry > 0; retry--) { |
| 412 | sch->schib.pmcw.ena = 1; |
Cornelia Huck | edf2209 | 2008-04-30 13:38:39 +0200 | [diff] [blame] | 413 | sch->schib.pmcw.isc = sch->isc; |
Cornelia Huck | b279a4f | 2008-01-26 14:10:45 +0100 | [diff] [blame] | 414 | sch->schib.pmcw.intparm = intparm; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 415 | ret = cio_modify(sch); |
| 416 | if (ret == -ENODEV) |
| 417 | break; |
| 418 | if (ret == -EIO) |
| 419 | /* |
| 420 | * Got a program check in cio_modify. Try without |
| 421 | * the concurrent sense bit the next time. |
| 422 | */ |
| 423 | sch->schib.pmcw.csense = 0; |
| 424 | if (ret == 0) { |
Cornelia Huck | a8237fc | 2006-01-06 00:19:21 -0800 | [diff] [blame] | 425 | stsch (sch->schid, &sch->schib); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 426 | if (sch->schib.pmcw.ena) |
| 427 | break; |
| 428 | } |
| 429 | if (ret == -EBUSY) { |
| 430 | struct irb irb; |
Cornelia Huck | a8237fc | 2006-01-06 00:19:21 -0800 | [diff] [blame] | 431 | if (tsch(sch->schid, &irb) != 0) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 432 | break; |
| 433 | } |
| 434 | } |
| 435 | sprintf (dbf_txt, "ret:%d", ret); |
| 436 | CIO_TRACE_EVENT (2, dbf_txt); |
| 437 | return ret; |
| 438 | } |
Cornelia Huck | 44a1c19 | 2008-07-14 09:58:47 +0200 | [diff] [blame^] | 439 | EXPORT_SYMBOL_GPL(cio_enable_subchannel); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 440 | |
Cornelia Huck | 44a1c19 | 2008-07-14 09:58:47 +0200 | [diff] [blame^] | 441 | /** |
| 442 | * cio_disable_subchannel - disable a subchannel. |
| 443 | * @sch: subchannel to disable |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 444 | */ |
Cornelia Huck | 44a1c19 | 2008-07-14 09:58:47 +0200 | [diff] [blame^] | 445 | int cio_disable_subchannel(struct subchannel *sch) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 446 | { |
| 447 | char dbf_txt[15]; |
| 448 | int ccode; |
| 449 | int retry; |
| 450 | int ret; |
| 451 | |
| 452 | CIO_TRACE_EVENT (2, "dissch"); |
| 453 | CIO_TRACE_EVENT (2, sch->dev.bus_id); |
| 454 | |
Cornelia Huck | d7b5a4c | 2006-12-08 15:54:28 +0100 | [diff] [blame] | 455 | if (sch_is_pseudo_sch(sch)) |
| 456 | return 0; |
Cornelia Huck | a8237fc | 2006-01-06 00:19:21 -0800 | [diff] [blame] | 457 | ccode = stsch (sch->schid, &sch->schib); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 458 | if (ccode == 3) /* Not operational. */ |
| 459 | return -ENODEV; |
| 460 | |
| 461 | if (sch->schib.scsw.actl != 0) |
| 462 | /* |
| 463 | * the disable function must not be called while there are |
| 464 | * requests pending for completion ! |
| 465 | */ |
| 466 | return -EBUSY; |
| 467 | |
| 468 | for (retry = 5, ret = 0; retry > 0; retry--) { |
| 469 | sch->schib.pmcw.ena = 0; |
| 470 | ret = cio_modify(sch); |
| 471 | if (ret == -ENODEV) |
| 472 | break; |
| 473 | if (ret == -EBUSY) |
| 474 | /* |
| 475 | * The subchannel is busy or status pending. |
| 476 | * We'll disable when the next interrupt was delivered |
| 477 | * via the state machine. |
| 478 | */ |
| 479 | break; |
| 480 | if (ret == 0) { |
Cornelia Huck | a8237fc | 2006-01-06 00:19:21 -0800 | [diff] [blame] | 481 | stsch (sch->schid, &sch->schib); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 482 | if (!sch->schib.pmcw.ena) |
| 483 | break; |
| 484 | } |
| 485 | } |
| 486 | sprintf (dbf_txt, "ret:%d", ret); |
| 487 | CIO_TRACE_EVENT (2, dbf_txt); |
| 488 | return ret; |
| 489 | } |
Cornelia Huck | 44a1c19 | 2008-07-14 09:58:47 +0200 | [diff] [blame^] | 490 | EXPORT_SYMBOL_GPL(cio_disable_subchannel); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 491 | |
Cornelia Huck | d7b5a4c | 2006-12-08 15:54:28 +0100 | [diff] [blame] | 492 | int cio_create_sch_lock(struct subchannel *sch) |
Cornelia Huck | 2ec2298 | 2006-12-08 15:54:26 +0100 | [diff] [blame] | 493 | { |
| 494 | sch->lock = kmalloc(sizeof(spinlock_t), GFP_KERNEL); |
| 495 | if (!sch->lock) |
| 496 | return -ENOMEM; |
| 497 | spin_lock_init(sch->lock); |
| 498 | return 0; |
| 499 | } |
| 500 | |
Cornelia Huck | 0ae7a7b | 2008-07-14 09:58:43 +0200 | [diff] [blame] | 501 | static int cio_validate_io_subchannel(struct subchannel *sch) |
| 502 | { |
| 503 | /* Initialization for io subchannels. */ |
| 504 | if (!css_sch_is_valid(&sch->schib)) |
| 505 | return -ENODEV; |
| 506 | |
| 507 | /* Devno is valid. */ |
| 508 | if (is_blacklisted(sch->schid.ssid, sch->schib.pmcw.dev)) { |
| 509 | /* |
| 510 | * This device must not be known to Linux. So we simply |
| 511 | * say that there is no device and return ENODEV. |
| 512 | */ |
| 513 | CIO_MSG_EVENT(6, "Blacklisted device detected " |
| 514 | "at devno %04X, subchannel set %x\n", |
| 515 | sch->schib.pmcw.dev, sch->schid.ssid); |
| 516 | return -ENODEV; |
| 517 | } |
| 518 | return 0; |
| 519 | } |
| 520 | |
| 521 | /** |
| 522 | * cio_validate_subchannel - basic validation of subchannel |
| 523 | * @sch: subchannel structure to be filled out |
| 524 | * @schid: subchannel id |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 525 | * |
| 526 | * Find out subchannel type and initialize struct subchannel. |
| 527 | * Return codes: |
Cornelia Huck | 0ae7a7b | 2008-07-14 09:58:43 +0200 | [diff] [blame] | 528 | * 0 on success |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 529 | * -ENXIO for non-defined subchannels |
Cornelia Huck | 0ae7a7b | 2008-07-14 09:58:43 +0200 | [diff] [blame] | 530 | * -ENODEV for invalid subchannels or blacklisted devices |
| 531 | * -EIO for subchannels in an invalid subchannel set |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 532 | */ |
Cornelia Huck | 0ae7a7b | 2008-07-14 09:58:43 +0200 | [diff] [blame] | 533 | int cio_validate_subchannel(struct subchannel *sch, struct subchannel_id schid) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 534 | { |
| 535 | char dbf_txt[15]; |
| 536 | int ccode; |
Cornelia Huck | 2ec2298 | 2006-12-08 15:54:26 +0100 | [diff] [blame] | 537 | int err; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 538 | |
Cornelia Huck | 0ae7a7b | 2008-07-14 09:58:43 +0200 | [diff] [blame] | 539 | sprintf(dbf_txt, "valsch%x", schid.sch_no); |
| 540 | CIO_TRACE_EVENT(4, dbf_txt); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 541 | |
| 542 | /* Nuke all fields. */ |
| 543 | memset(sch, 0, sizeof(struct subchannel)); |
| 544 | |
Cornelia Huck | 2ec2298 | 2006-12-08 15:54:26 +0100 | [diff] [blame] | 545 | sch->schid = schid; |
| 546 | if (cio_is_console(schid)) { |
| 547 | sch->lock = cio_get_console_lock(); |
| 548 | } else { |
| 549 | err = cio_create_sch_lock(sch); |
| 550 | if (err) |
| 551 | goto out; |
| 552 | } |
Cornelia Huck | 6ab4879 | 2006-07-12 16:39:50 +0200 | [diff] [blame] | 553 | mutex_init(&sch->reg_mutex); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 554 | /* Set a name for the subchannel */ |
Cornelia Huck | fb6958a | 2006-01-06 00:19:25 -0800 | [diff] [blame] | 555 | snprintf (sch->dev.bus_id, BUS_ID_SIZE, "0.%x.%04x", schid.ssid, |
| 556 | schid.sch_no); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 557 | |
| 558 | /* |
| 559 | * The first subchannel that is not-operational (ccode==3) |
| 560 | * indicates that there aren't any more devices available. |
Cornelia Huck | fb6958a | 2006-01-06 00:19:25 -0800 | [diff] [blame] | 561 | * If stsch gets an exception, it means the current subchannel set |
| 562 | * is not valid. |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 563 | */ |
Cornelia Huck | fb6958a | 2006-01-06 00:19:25 -0800 | [diff] [blame] | 564 | ccode = stsch_err (schid, &sch->schib); |
Cornelia Huck | 2ec2298 | 2006-12-08 15:54:26 +0100 | [diff] [blame] | 565 | if (ccode) { |
| 566 | err = (ccode == 3) ? -ENXIO : ccode; |
| 567 | goto out; |
| 568 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 569 | /* Copy subchannel type from path management control word. */ |
| 570 | sch->st = sch->schib.pmcw.st; |
Cornelia Huck | c820de3 | 2008-07-14 09:58:45 +0200 | [diff] [blame] | 571 | |
Cornelia Huck | 0ae7a7b | 2008-07-14 09:58:43 +0200 | [diff] [blame] | 572 | switch (sch->st) { |
| 573 | case SUBCHANNEL_TYPE_IO: |
| 574 | err = cio_validate_io_subchannel(sch); |
| 575 | break; |
| 576 | default: |
| 577 | err = 0; |
| 578 | } |
| 579 | if (err) |
Cornelia Huck | 2ec2298 | 2006-12-08 15:54:26 +0100 | [diff] [blame] | 580 | goto out; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 581 | |
Cornelia Huck | 0ae7a7b | 2008-07-14 09:58:43 +0200 | [diff] [blame] | 582 | CIO_MSG_EVENT(4, "Subchannel 0.%x.%04x reports subchannel type %04X\n", |
| 583 | sch->schid.ssid, sch->schid.sch_no, sch->st); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 584 | return 0; |
Cornelia Huck | 2ec2298 | 2006-12-08 15:54:26 +0100 | [diff] [blame] | 585 | out: |
| 586 | if (!cio_is_console(schid)) |
| 587 | kfree(sch->lock); |
| 588 | sch->lock = NULL; |
| 589 | return err; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 590 | } |
| 591 | |
| 592 | /* |
| 593 | * do_IRQ() handles all normal I/O device IRQ's (the special |
| 594 | * SMP cross-CPU interrupts have their own specific |
| 595 | * handlers). |
| 596 | * |
| 597 | */ |
| 598 | void |
| 599 | do_IRQ (struct pt_regs *regs) |
| 600 | { |
| 601 | struct tpi_info *tpi_info; |
| 602 | struct subchannel *sch; |
| 603 | struct irb *irb; |
Heiko Carstens | 5a489b9 | 2006-10-06 16:38:35 +0200 | [diff] [blame] | 604 | struct pt_regs *old_regs; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 605 | |
Heiko Carstens | 5a489b9 | 2006-10-06 16:38:35 +0200 | [diff] [blame] | 606 | old_regs = set_irq_regs(regs); |
Heiko Carstens | 9d0a57c | 2006-10-11 15:31:26 +0200 | [diff] [blame] | 607 | irq_enter(); |
Heiko Carstens | 43ca5c3 | 2008-04-17 07:46:23 +0200 | [diff] [blame] | 608 | s390_idle_check(); |
Heiko Carstens | 5a62b19 | 2008-04-17 07:46:25 +0200 | [diff] [blame] | 609 | if (S390_lowcore.int_clock >= S390_lowcore.clock_comparator) |
| 610 | /* Serve timer interrupts first. */ |
| 611 | clock_comparator_work(); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 612 | /* |
| 613 | * Get interrupt information from lowcore |
| 614 | */ |
| 615 | tpi_info = (struct tpi_info *) __LC_SUBCHANNEL_ID; |
| 616 | irb = (struct irb *) __LC_IRB; |
| 617 | do { |
| 618 | kstat_cpu(smp_processor_id()).irqs[IO_INTERRUPT]++; |
| 619 | /* |
| 620 | * Non I/O-subchannel thin interrupts are processed differently |
| 621 | */ |
| 622 | if (tpi_info->adapter_IO == 1 && |
| 623 | tpi_info->int_type == IO_INTERRUPT_TYPE) { |
| 624 | do_adapter_IO(); |
| 625 | continue; |
| 626 | } |
| 627 | sch = (struct subchannel *)(unsigned long)tpi_info->intparm; |
Heiko Carstens | a806170 | 2008-04-17 07:46:26 +0200 | [diff] [blame] | 628 | if (!sch) { |
| 629 | /* Clear pending interrupt condition. */ |
| 630 | tsch(tpi_info->schid, irb); |
| 631 | continue; |
| 632 | } |
| 633 | spin_lock(sch->lock); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 634 | /* Store interrupt response block to lowcore. */ |
Heiko Carstens | a806170 | 2008-04-17 07:46:26 +0200 | [diff] [blame] | 635 | if (tsch(tpi_info->schid, irb) == 0) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 636 | /* Keep subchannel information word up to date. */ |
| 637 | memcpy (&sch->schib.scsw, &irb->scsw, |
| 638 | sizeof (irb->scsw)); |
| 639 | /* Call interrupt handler if there is one. */ |
| 640 | if (sch->driver && sch->driver->irq) |
Cornelia Huck | 602b20f | 2008-01-26 14:10:39 +0100 | [diff] [blame] | 641 | sch->driver->irq(sch); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 642 | } |
Heiko Carstens | a806170 | 2008-04-17 07:46:26 +0200 | [diff] [blame] | 643 | spin_unlock(sch->lock); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 644 | /* |
| 645 | * Are more interrupts pending? |
| 646 | * If so, the tpi instruction will update the lowcore |
| 647 | * to hold the info for the next interrupt. |
| 648 | * We don't do this for VM because a tpi drops the cpu |
| 649 | * out of the sie which costs more cycles than it saves. |
| 650 | */ |
| 651 | } while (!MACHINE_IS_VM && tpi (NULL) != 0); |
Heiko Carstens | 9d0a57c | 2006-10-11 15:31:26 +0200 | [diff] [blame] | 652 | irq_exit(); |
Heiko Carstens | 5a489b9 | 2006-10-06 16:38:35 +0200 | [diff] [blame] | 653 | set_irq_regs(old_regs); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 654 | } |
| 655 | |
| 656 | #ifdef CONFIG_CCW_CONSOLE |
| 657 | static struct subchannel console_subchannel; |
Cornelia Huck | cd6b4f2 | 2008-01-26 14:10:43 +0100 | [diff] [blame] | 658 | static struct io_subchannel_private console_priv; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 659 | static int console_subchannel_in_use; |
| 660 | |
Cornelia Huck | cd6b4f2 | 2008-01-26 14:10:43 +0100 | [diff] [blame] | 661 | void *cio_get_console_priv(void) |
| 662 | { |
| 663 | return &console_priv; |
| 664 | } |
| 665 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 666 | /* |
| 667 | * busy wait for the next interrupt on the console |
| 668 | */ |
Heiko Carstens | a806170 | 2008-04-17 07:46:26 +0200 | [diff] [blame] | 669 | void wait_cons_dev(void) |
| 670 | __releases(console_subchannel.lock) |
| 671 | __acquires(console_subchannel.lock) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 672 | { |
| 673 | unsigned long cr6 __attribute__ ((aligned (8))); |
| 674 | unsigned long save_cr6 __attribute__ ((aligned (8))); |
| 675 | |
| 676 | /* |
| 677 | * before entering the spinlock we may already have |
| 678 | * processed the interrupt on a different CPU... |
| 679 | */ |
| 680 | if (!console_subchannel_in_use) |
| 681 | return; |
| 682 | |
Cornelia Huck | 85b0d7c | 2008-06-10 10:03:21 +0200 | [diff] [blame] | 683 | /* disable all but isc 1 (console device) */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 684 | __ctl_store (save_cr6, 6, 6); |
Cornelia Huck | 85b0d7c | 2008-06-10 10:03:21 +0200 | [diff] [blame] | 685 | cr6 = 0x40000000; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 686 | __ctl_load (cr6, 6, 6); |
| 687 | |
| 688 | do { |
Cornelia Huck | 2ec2298 | 2006-12-08 15:54:26 +0100 | [diff] [blame] | 689 | spin_unlock(console_subchannel.lock); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 690 | if (!cio_tpi()) |
| 691 | cpu_relax(); |
Cornelia Huck | 2ec2298 | 2006-12-08 15:54:26 +0100 | [diff] [blame] | 692 | spin_lock(console_subchannel.lock); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 693 | } while (console_subchannel.schib.scsw.actl != 0); |
| 694 | /* |
| 695 | * restore previous isc value |
| 696 | */ |
| 697 | __ctl_load (save_cr6, 6, 6); |
| 698 | } |
| 699 | |
| 700 | static int |
Cornelia Huck | f97a56f | 2006-01-06 00:19:22 -0800 | [diff] [blame] | 701 | cio_test_for_console(struct subchannel_id schid, void *data) |
| 702 | { |
Cornelia Huck | fb6958a | 2006-01-06 00:19:25 -0800 | [diff] [blame] | 703 | if (stsch_err(schid, &console_subchannel.schib) != 0) |
Cornelia Huck | f97a56f | 2006-01-06 00:19:22 -0800 | [diff] [blame] | 704 | return -ENXIO; |
Cornelia Huck | b279a4f | 2008-01-26 14:10:45 +0100 | [diff] [blame] | 705 | if ((console_subchannel.schib.pmcw.st == SUBCHANNEL_TYPE_IO) && |
| 706 | console_subchannel.schib.pmcw.dnv && |
| 707 | (console_subchannel.schib.pmcw.dev == console_devno)) { |
Cornelia Huck | f97a56f | 2006-01-06 00:19:22 -0800 | [diff] [blame] | 708 | console_irq = schid.sch_no; |
| 709 | return 1; /* found */ |
| 710 | } |
| 711 | return 0; |
| 712 | } |
| 713 | |
| 714 | |
| 715 | static int |
| 716 | cio_get_console_sch_no(void) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 717 | { |
Cornelia Huck | a8237fc | 2006-01-06 00:19:21 -0800 | [diff] [blame] | 718 | struct subchannel_id schid; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 719 | |
Cornelia Huck | a8237fc | 2006-01-06 00:19:21 -0800 | [diff] [blame] | 720 | init_subchannel_id(&schid); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 721 | if (console_irq != -1) { |
| 722 | /* VM provided us with the irq number of the console. */ |
Cornelia Huck | a8237fc | 2006-01-06 00:19:21 -0800 | [diff] [blame] | 723 | schid.sch_no = console_irq; |
| 724 | if (stsch(schid, &console_subchannel.schib) != 0 || |
Cornelia Huck | b279a4f | 2008-01-26 14:10:45 +0100 | [diff] [blame] | 725 | (console_subchannel.schib.pmcw.st != SUBCHANNEL_TYPE_IO) || |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 726 | !console_subchannel.schib.pmcw.dnv) |
| 727 | return -1; |
| 728 | console_devno = console_subchannel.schib.pmcw.dev; |
| 729 | } else if (console_devno != -1) { |
| 730 | /* At least the console device number is known. */ |
Cornelia Huck | f97a56f | 2006-01-06 00:19:22 -0800 | [diff] [blame] | 731 | for_each_subchannel(cio_test_for_console, NULL); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 732 | if (console_irq == -1) |
| 733 | return -1; |
| 734 | } else { |
| 735 | /* unlike in 2.4, we cannot autoprobe here, since |
| 736 | * the channel subsystem is not fully initialized. |
| 737 | * With some luck, the HWC console can take over */ |
Cornelia Huck | e556bbb | 2007-07-27 12:29:19 +0200 | [diff] [blame] | 738 | printk(KERN_WARNING "cio: No ccw console found!\n"); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 739 | return -1; |
| 740 | } |
| 741 | return console_irq; |
| 742 | } |
| 743 | |
| 744 | struct subchannel * |
| 745 | cio_probe_console(void) |
| 746 | { |
Cornelia Huck | f97a56f | 2006-01-06 00:19:22 -0800 | [diff] [blame] | 747 | int sch_no, ret; |
Cornelia Huck | a8237fc | 2006-01-06 00:19:21 -0800 | [diff] [blame] | 748 | struct subchannel_id schid; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 749 | |
| 750 | if (xchg(&console_subchannel_in_use, 1) != 0) |
| 751 | return ERR_PTR(-EBUSY); |
Cornelia Huck | f97a56f | 2006-01-06 00:19:22 -0800 | [diff] [blame] | 752 | sch_no = cio_get_console_sch_no(); |
| 753 | if (sch_no == -1) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 754 | console_subchannel_in_use = 0; |
| 755 | return ERR_PTR(-ENODEV); |
| 756 | } |
| 757 | memset(&console_subchannel, 0, sizeof(struct subchannel)); |
Cornelia Huck | a8237fc | 2006-01-06 00:19:21 -0800 | [diff] [blame] | 758 | init_subchannel_id(&schid); |
Cornelia Huck | f97a56f | 2006-01-06 00:19:22 -0800 | [diff] [blame] | 759 | schid.sch_no = sch_no; |
Cornelia Huck | a8237fc | 2006-01-06 00:19:21 -0800 | [diff] [blame] | 760 | ret = cio_validate_subchannel(&console_subchannel, schid); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 761 | if (ret) { |
| 762 | console_subchannel_in_use = 0; |
| 763 | return ERR_PTR(-ENODEV); |
| 764 | } |
| 765 | |
| 766 | /* |
Cornelia Huck | 85b0d7c | 2008-06-10 10:03:21 +0200 | [diff] [blame] | 767 | * enable console I/O-interrupt subclass 1 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 768 | */ |
Cornelia Huck | 85b0d7c | 2008-06-10 10:03:21 +0200 | [diff] [blame] | 769 | ctl_set_bit(6, 30); |
Cornelia Huck | 85b0d7c | 2008-06-10 10:03:21 +0200 | [diff] [blame] | 770 | console_subchannel.schib.pmcw.isc = 1; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 771 | console_subchannel.schib.pmcw.intparm = |
Cornelia Huck | cd6b4f2 | 2008-01-26 14:10:43 +0100 | [diff] [blame] | 772 | (u32)(addr_t)&console_subchannel; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 773 | ret = cio_modify(&console_subchannel); |
| 774 | if (ret) { |
| 775 | console_subchannel_in_use = 0; |
| 776 | return ERR_PTR(ret); |
| 777 | } |
| 778 | return &console_subchannel; |
| 779 | } |
| 780 | |
| 781 | void |
| 782 | cio_release_console(void) |
| 783 | { |
| 784 | console_subchannel.schib.pmcw.intparm = 0; |
| 785 | cio_modify(&console_subchannel); |
Cornelia Huck | 9689b33 | 2008-07-14 09:57:23 +0200 | [diff] [blame] | 786 | ctl_clear_bit(6, 30); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 787 | console_subchannel_in_use = 0; |
| 788 | } |
| 789 | |
| 790 | /* Bah... hack to catch console special sausages. */ |
| 791 | int |
Cornelia Huck | a8237fc | 2006-01-06 00:19:21 -0800 | [diff] [blame] | 792 | cio_is_console(struct subchannel_id schid) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 793 | { |
| 794 | if (!console_subchannel_in_use) |
| 795 | return 0; |
Cornelia Huck | a8237fc | 2006-01-06 00:19:21 -0800 | [diff] [blame] | 796 | return schid_equal(&schid, &console_subchannel.schid); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 797 | } |
| 798 | |
| 799 | struct subchannel * |
| 800 | cio_get_console_subchannel(void) |
| 801 | { |
| 802 | if (!console_subchannel_in_use) |
Heiko Carstens | d2c993d | 2006-07-12 16:41:55 +0200 | [diff] [blame] | 803 | return NULL; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 804 | return &console_subchannel; |
| 805 | } |
| 806 | |
| 807 | #endif |
Heiko Carstens | 4d284ca | 2007-02-05 21:18:53 +0100 | [diff] [blame] | 808 | static int |
Cornelia Huck | a8237fc | 2006-01-06 00:19:21 -0800 | [diff] [blame] | 809 | __disable_subchannel_easy(struct subchannel_id schid, struct schib *schib) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 810 | { |
| 811 | int retry, cc; |
| 812 | |
| 813 | cc = 0; |
| 814 | for (retry=0;retry<3;retry++) { |
| 815 | schib->pmcw.ena = 0; |
| 816 | cc = msch(schid, schib); |
| 817 | if (cc) |
| 818 | return (cc==3?-ENODEV:-EBUSY); |
| 819 | stsch(schid, schib); |
| 820 | if (!schib->pmcw.ena) |
| 821 | return 0; |
| 822 | } |
| 823 | return -EBUSY; /* uhm... */ |
| 824 | } |
| 825 | |
Martin Schwidefsky | d54853e | 2007-02-05 21:18:19 +0100 | [diff] [blame] | 826 | /* we can't use the normal udelay here, since it enables external interrupts */ |
| 827 | |
| 828 | static void udelay_reset(unsigned long usecs) |
| 829 | { |
| 830 | uint64_t start_cc, end_cc; |
| 831 | |
| 832 | asm volatile ("STCK %0" : "=m" (start_cc)); |
| 833 | do { |
| 834 | cpu_relax(); |
| 835 | asm volatile ("STCK %0" : "=m" (end_cc)); |
| 836 | } while (((end_cc - start_cc)/4096) < usecs); |
| 837 | } |
| 838 | |
Heiko Carstens | 4d284ca | 2007-02-05 21:18:53 +0100 | [diff] [blame] | 839 | static int |
Cornelia Huck | 0ae7a7b | 2008-07-14 09:58:43 +0200 | [diff] [blame] | 840 | __clear_io_subchannel_easy(struct subchannel_id schid) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 841 | { |
| 842 | int retry; |
| 843 | |
| 844 | if (csch(schid)) |
| 845 | return -ENODEV; |
| 846 | for (retry=0;retry<20;retry++) { |
| 847 | struct tpi_info ti; |
| 848 | |
| 849 | if (tpi(&ti)) { |
Cornelia Huck | a8237fc | 2006-01-06 00:19:21 -0800 | [diff] [blame] | 850 | tsch(ti.schid, (struct irb *)__LC_IRB); |
| 851 | if (schid_equal(&ti.schid, &schid)) |
Cornelia Huck | 4c24da7 | 2005-09-03 15:58:01 -0700 | [diff] [blame] | 852 | return 0; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 853 | } |
Martin Schwidefsky | d54853e | 2007-02-05 21:18:19 +0100 | [diff] [blame] | 854 | udelay_reset(100); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 855 | } |
| 856 | return -EBUSY; |
| 857 | } |
| 858 | |
Michael Holzheu | a45e141 | 2006-12-15 17:18:22 +0100 | [diff] [blame] | 859 | static int pgm_check_occured; |
| 860 | |
| 861 | static void cio_reset_pgm_check_handler(void) |
| 862 | { |
| 863 | pgm_check_occured = 1; |
| 864 | } |
| 865 | |
| 866 | static int stsch_reset(struct subchannel_id schid, volatile struct schib *addr) |
| 867 | { |
| 868 | int rc; |
| 869 | |
| 870 | pgm_check_occured = 0; |
Heiko Carstens | ab14de6 | 2007-02-05 21:18:37 +0100 | [diff] [blame] | 871 | s390_base_pgm_handler_fn = cio_reset_pgm_check_handler; |
Heiko Carstens | 6faf444 | 2007-01-09 10:18:41 +0100 | [diff] [blame] | 872 | rc = stsch(schid, addr); |
Heiko Carstens | ab14de6 | 2007-02-05 21:18:37 +0100 | [diff] [blame] | 873 | s390_base_pgm_handler_fn = NULL; |
Heiko Carstens | 6faf444 | 2007-01-09 10:18:41 +0100 | [diff] [blame] | 874 | |
Heiko Carstens | ab14de6 | 2007-02-05 21:18:37 +0100 | [diff] [blame] | 875 | /* The program check handler could have changed pgm_check_occured. */ |
Heiko Carstens | 6faf444 | 2007-01-09 10:18:41 +0100 | [diff] [blame] | 876 | barrier(); |
| 877 | |
Michael Holzheu | a45e141 | 2006-12-15 17:18:22 +0100 | [diff] [blame] | 878 | if (pgm_check_occured) |
| 879 | return -EIO; |
| 880 | else |
| 881 | return rc; |
| 882 | } |
| 883 | |
Heiko Carstens | 15e9b58 | 2006-12-04 15:40:26 +0100 | [diff] [blame] | 884 | static int __shutdown_subchannel_easy(struct subchannel_id schid, void *data) |
Cornelia Huck | f97a56f | 2006-01-06 00:19:22 -0800 | [diff] [blame] | 885 | { |
| 886 | struct schib schib; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 887 | |
Michael Holzheu | a45e141 | 2006-12-15 17:18:22 +0100 | [diff] [blame] | 888 | if (stsch_reset(schid, &schib)) |
Cornelia Huck | f97a56f | 2006-01-06 00:19:22 -0800 | [diff] [blame] | 889 | return -ENXIO; |
| 890 | if (!schib.pmcw.ena) |
| 891 | return 0; |
| 892 | switch(__disable_subchannel_easy(schid, &schib)) { |
| 893 | case 0: |
| 894 | case -ENODEV: |
| 895 | break; |
| 896 | default: /* -EBUSY */ |
Cornelia Huck | 0ae7a7b | 2008-07-14 09:58:43 +0200 | [diff] [blame] | 897 | switch (schib.pmcw.st) { |
| 898 | case SUBCHANNEL_TYPE_IO: |
| 899 | if (__clear_io_subchannel_easy(schid)) |
| 900 | goto out; /* give up... */ |
| 901 | break; |
| 902 | default: |
| 903 | /* No default clear strategy */ |
| 904 | break; |
| 905 | } |
Cornelia Huck | f97a56f | 2006-01-06 00:19:22 -0800 | [diff] [blame] | 906 | stsch(schid, &schib); |
| 907 | __disable_subchannel_easy(schid, &schib); |
| 908 | } |
Cornelia Huck | 0ae7a7b | 2008-07-14 09:58:43 +0200 | [diff] [blame] | 909 | out: |
Cornelia Huck | f97a56f | 2006-01-06 00:19:22 -0800 | [diff] [blame] | 910 | return 0; |
| 911 | } |
| 912 | |
Heiko Carstens | 15e9b58 | 2006-12-04 15:40:26 +0100 | [diff] [blame] | 913 | static atomic_t chpid_reset_count; |
| 914 | |
| 915 | static void s390_reset_chpids_mcck_handler(void) |
| 916 | { |
| 917 | struct crw crw; |
| 918 | struct mci *mci; |
| 919 | |
| 920 | /* Check for pending channel report word. */ |
| 921 | mci = (struct mci *)&S390_lowcore.mcck_interruption_code; |
| 922 | if (!mci->cp) |
| 923 | return; |
| 924 | /* Process channel report words. */ |
| 925 | while (stcrw(&crw) == 0) { |
| 926 | /* Check for responses to RCHP. */ |
| 927 | if (crw.slct && crw.rsc == CRW_RSC_CPATH) |
| 928 | atomic_dec(&chpid_reset_count); |
| 929 | } |
| 930 | } |
| 931 | |
| 932 | #define RCHP_TIMEOUT (30 * USEC_PER_SEC) |
| 933 | static void css_reset(void) |
| 934 | { |
| 935 | int i, ret; |
| 936 | unsigned long long timeout; |
Peter Oberparleiter | f86635f | 2007-04-27 16:01:26 +0200 | [diff] [blame] | 937 | struct chp_id chpid; |
Heiko Carstens | 15e9b58 | 2006-12-04 15:40:26 +0100 | [diff] [blame] | 938 | |
| 939 | /* Reset subchannels. */ |
| 940 | for_each_subchannel(__shutdown_subchannel_easy, NULL); |
| 941 | /* Reset channel paths. */ |
Heiko Carstens | ab14de6 | 2007-02-05 21:18:37 +0100 | [diff] [blame] | 942 | s390_base_mcck_handler_fn = s390_reset_chpids_mcck_handler; |
Heiko Carstens | 15e9b58 | 2006-12-04 15:40:26 +0100 | [diff] [blame] | 943 | /* Enable channel report machine checks. */ |
| 944 | __ctl_set_bit(14, 28); |
| 945 | /* Temporarily reenable machine checks. */ |
| 946 | local_mcck_enable(); |
Peter Oberparleiter | f86635f | 2007-04-27 16:01:26 +0200 | [diff] [blame] | 947 | chp_id_init(&chpid); |
Heiko Carstens | 15e9b58 | 2006-12-04 15:40:26 +0100 | [diff] [blame] | 948 | for (i = 0; i <= __MAX_CHPID; i++) { |
Peter Oberparleiter | f86635f | 2007-04-27 16:01:26 +0200 | [diff] [blame] | 949 | chpid.id = i; |
| 950 | ret = rchp(chpid); |
Heiko Carstens | 15e9b58 | 2006-12-04 15:40:26 +0100 | [diff] [blame] | 951 | if ((ret == 0) || (ret == 2)) |
| 952 | /* |
| 953 | * rchp either succeeded, or another rchp is already |
| 954 | * in progress. In either case, we'll get a crw. |
| 955 | */ |
| 956 | atomic_inc(&chpid_reset_count); |
| 957 | } |
| 958 | /* Wait for machine check for all channel paths. */ |
| 959 | timeout = get_clock() + (RCHP_TIMEOUT << 12); |
| 960 | while (atomic_read(&chpid_reset_count) != 0) { |
| 961 | if (get_clock() > timeout) |
| 962 | break; |
| 963 | cpu_relax(); |
| 964 | } |
| 965 | /* Disable machine checks again. */ |
| 966 | local_mcck_disable(); |
| 967 | /* Disable channel report machine checks. */ |
| 968 | __ctl_clear_bit(14, 28); |
Heiko Carstens | ab14de6 | 2007-02-05 21:18:37 +0100 | [diff] [blame] | 969 | s390_base_mcck_handler_fn = NULL; |
Heiko Carstens | 15e9b58 | 2006-12-04 15:40:26 +0100 | [diff] [blame] | 970 | } |
| 971 | |
| 972 | static struct reset_call css_reset_call = { |
| 973 | .fn = css_reset, |
| 974 | }; |
| 975 | |
| 976 | static int __init init_css_reset_call(void) |
| 977 | { |
| 978 | atomic_set(&chpid_reset_count, 0); |
| 979 | register_reset_call(&css_reset_call); |
| 980 | return 0; |
| 981 | } |
| 982 | |
| 983 | arch_initcall(init_css_reset_call); |
| 984 | |
| 985 | struct sch_match_id { |
| 986 | struct subchannel_id schid; |
| 987 | struct ccw_dev_id devid; |
| 988 | int rc; |
| 989 | }; |
| 990 | |
| 991 | static int __reipl_subchannel_match(struct subchannel_id schid, void *data) |
| 992 | { |
| 993 | struct schib schib; |
| 994 | struct sch_match_id *match_id = data; |
| 995 | |
Michael Holzheu | a45e141 | 2006-12-15 17:18:22 +0100 | [diff] [blame] | 996 | if (stsch_reset(schid, &schib)) |
Heiko Carstens | 15e9b58 | 2006-12-04 15:40:26 +0100 | [diff] [blame] | 997 | return -ENXIO; |
Cornelia Huck | b279a4f | 2008-01-26 14:10:45 +0100 | [diff] [blame] | 998 | if ((schib.pmcw.st == SUBCHANNEL_TYPE_IO) && schib.pmcw.dnv && |
Heiko Carstens | 15e9b58 | 2006-12-04 15:40:26 +0100 | [diff] [blame] | 999 | (schib.pmcw.dev == match_id->devid.devno) && |
| 1000 | (schid.ssid == match_id->devid.ssid)) { |
| 1001 | match_id->schid = schid; |
| 1002 | match_id->rc = 0; |
| 1003 | return 1; |
| 1004 | } |
| 1005 | return 0; |
| 1006 | } |
| 1007 | |
| 1008 | static int reipl_find_schid(struct ccw_dev_id *devid, |
| 1009 | struct subchannel_id *schid) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1010 | { |
Michael Holzheu | ff6b8ea | 2006-09-20 15:58:49 +0200 | [diff] [blame] | 1011 | struct sch_match_id match_id; |
| 1012 | |
| 1013 | match_id.devid = *devid; |
| 1014 | match_id.rc = -ENODEV; |
Heiko Carstens | 15e9b58 | 2006-12-04 15:40:26 +0100 | [diff] [blame] | 1015 | for_each_subchannel(__reipl_subchannel_match, &match_id); |
Michael Holzheu | ff6b8ea | 2006-09-20 15:58:49 +0200 | [diff] [blame] | 1016 | if (match_id.rc == 0) |
| 1017 | *schid = match_id.schid; |
| 1018 | return match_id.rc; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1019 | } |
| 1020 | |
Michael Holzheu | ff6b8ea | 2006-09-20 15:58:49 +0200 | [diff] [blame] | 1021 | extern void do_reipl_asm(__u32 schid); |
| 1022 | |
| 1023 | /* Make sure all subchannels are quiet before we re-ipl an lpar. */ |
| 1024 | void reipl_ccw_dev(struct ccw_dev_id *devid) |
| 1025 | { |
| 1026 | struct subchannel_id schid; |
| 1027 | |
Heiko Carstens | 15e9b58 | 2006-12-04 15:40:26 +0100 | [diff] [blame] | 1028 | s390_reset_system(); |
| 1029 | if (reipl_find_schid(devid, &schid) != 0) |
Michael Holzheu | ff6b8ea | 2006-09-20 15:58:49 +0200 | [diff] [blame] | 1030 | panic("IPL Device not found\n"); |
Michael Holzheu | ff6b8ea | 2006-09-20 15:58:49 +0200 | [diff] [blame] | 1031 | do_reipl_asm(*((__u32*)&schid)); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1032 | } |
Heiko Carstens | e87bfe5 | 2006-09-20 15:59:15 +0200 | [diff] [blame] | 1033 | |
Heiko Carstens | 6fc321f | 2007-04-27 16:01:25 +0200 | [diff] [blame] | 1034 | int __init cio_get_iplinfo(struct cio_iplinfo *iplinfo) |
Heiko Carstens | e87bfe5 | 2006-09-20 15:59:15 +0200 | [diff] [blame] | 1035 | { |
| 1036 | struct subchannel_id schid; |
Heiko Carstens | 6fc321f | 2007-04-27 16:01:25 +0200 | [diff] [blame] | 1037 | struct schib schib; |
Heiko Carstens | e87bfe5 | 2006-09-20 15:59:15 +0200 | [diff] [blame] | 1038 | |
| 1039 | schid = *(struct subchannel_id *)__LC_SUBCHANNEL_ID; |
| 1040 | if (!schid.one) |
Heiko Carstens | 6fc321f | 2007-04-27 16:01:25 +0200 | [diff] [blame] | 1041 | return -ENODEV; |
| 1042 | if (stsch(schid, &schib)) |
| 1043 | return -ENODEV; |
Cornelia Huck | b279a4f | 2008-01-26 14:10:45 +0100 | [diff] [blame] | 1044 | if (schib.pmcw.st != SUBCHANNEL_TYPE_IO) |
| 1045 | return -ENODEV; |
Heiko Carstens | 6fc321f | 2007-04-27 16:01:25 +0200 | [diff] [blame] | 1046 | if (!schib.pmcw.dnv) |
| 1047 | return -ENODEV; |
| 1048 | iplinfo->devno = schib.pmcw.dev; |
| 1049 | iplinfo->is_qdio = schib.pmcw.qf; |
| 1050 | return 0; |
Heiko Carstens | e87bfe5 | 2006-09-20 15:59:15 +0200 | [diff] [blame] | 1051 | } |