Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | /* |
Sebastian Ott | 823d494 | 2009-06-16 10:30:20 +0200 | [diff] [blame] | 2 | * Copyright IBM Corp. 2002, 2009 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3 | * |
Sebastian Ott | 823d494 | 2009-06-16 10:30:20 +0200 | [diff] [blame] | 4 | * Author(s): Martin Schwidefsky (schwidefsky@de.ibm.com) |
| 5 | * Cornelia Huck (cornelia.huck@de.ibm.com) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6 | */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7 | #include <linux/module.h> |
| 8 | #include <linux/init.h> |
| 9 | #include <linux/errno.h> |
| 10 | #include <linux/slab.h> |
| 11 | #include <linux/list.h> |
| 12 | #include <linux/device.h> |
| 13 | #include <linux/delay.h> |
Peter Oberparleiter | d7d12ef | 2009-12-07 12:51:32 +0100 | [diff] [blame] | 14 | #include <linux/completion.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 15 | |
| 16 | #include <asm/ccwdev.h> |
| 17 | #include <asm/idals.h> |
Peter Oberparleiter | e5854a5 | 2007-04-27 16:01:31 +0200 | [diff] [blame] | 18 | #include <asm/chpid.h> |
Peter Oberparleiter | 83262d6 | 2008-07-14 09:58:51 +0200 | [diff] [blame] | 19 | #include <asm/fcx.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 20 | |
| 21 | #include "cio.h" |
| 22 | #include "cio_debug.h" |
| 23 | #include "css.h" |
| 24 | #include "chsc.h" |
| 25 | #include "device.h" |
Peter Oberparleiter | e6b6e10 | 2007-04-27 16:01:28 +0200 | [diff] [blame] | 26 | #include "chp.h" |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 27 | |
Cornelia Huck | b2ffd8e | 2007-10-12 16:11:17 +0200 | [diff] [blame] | 28 | /** |
| 29 | * ccw_device_set_options_mask() - set some options and unset the rest |
| 30 | * @cdev: device for which the options are to be set |
| 31 | * @flags: options to be set |
| 32 | * |
| 33 | * All flags specified in @flags are set, all flags not specified in @flags |
| 34 | * are cleared. |
| 35 | * Returns: |
| 36 | * %0 on success, -%EINVAL on an invalid flag combination. |
| 37 | */ |
Cornelia Huck | 4dd3cc5 | 2007-02-12 15:47:18 +0100 | [diff] [blame] | 38 | int ccw_device_set_options_mask(struct ccw_device *cdev, unsigned long flags) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 39 | { |
| 40 | /* |
| 41 | * The flag usage is mutal exclusive ... |
| 42 | */ |
| 43 | if ((flags & CCWDEV_EARLY_NOTIFICATION) && |
| 44 | (flags & CCWDEV_REPORT_ALL)) |
| 45 | return -EINVAL; |
| 46 | cdev->private->options.fast = (flags & CCWDEV_EARLY_NOTIFICATION) != 0; |
| 47 | cdev->private->options.repall = (flags & CCWDEV_REPORT_ALL) != 0; |
| 48 | cdev->private->options.pgroup = (flags & CCWDEV_DO_PATHGROUP) != 0; |
| 49 | cdev->private->options.force = (flags & CCWDEV_ALLOW_FORCE) != 0; |
Peter Oberparleiter | 454e1fa | 2009-12-07 12:51:30 +0100 | [diff] [blame] | 50 | cdev->private->options.mpath = (flags & CCWDEV_DO_MULTIPATH) != 0; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 51 | return 0; |
| 52 | } |
| 53 | |
Cornelia Huck | b2ffd8e | 2007-10-12 16:11:17 +0200 | [diff] [blame] | 54 | /** |
| 55 | * ccw_device_set_options() - set some options |
| 56 | * @cdev: device for which the options are to be set |
| 57 | * @flags: options to be set |
| 58 | * |
| 59 | * All flags specified in @flags are set, the remainder is left untouched. |
| 60 | * Returns: |
| 61 | * %0 on success, -%EINVAL if an invalid flag combination would ensue. |
| 62 | */ |
Cornelia Huck | 4dd3cc5 | 2007-02-12 15:47:18 +0100 | [diff] [blame] | 63 | int ccw_device_set_options(struct ccw_device *cdev, unsigned long flags) |
| 64 | { |
| 65 | /* |
| 66 | * The flag usage is mutal exclusive ... |
| 67 | */ |
| 68 | if (((flags & CCWDEV_EARLY_NOTIFICATION) && |
| 69 | (flags & CCWDEV_REPORT_ALL)) || |
| 70 | ((flags & CCWDEV_EARLY_NOTIFICATION) && |
| 71 | cdev->private->options.repall) || |
| 72 | ((flags & CCWDEV_REPORT_ALL) && |
| 73 | cdev->private->options.fast)) |
| 74 | return -EINVAL; |
| 75 | cdev->private->options.fast |= (flags & CCWDEV_EARLY_NOTIFICATION) != 0; |
| 76 | cdev->private->options.repall |= (flags & CCWDEV_REPORT_ALL) != 0; |
| 77 | cdev->private->options.pgroup |= (flags & CCWDEV_DO_PATHGROUP) != 0; |
| 78 | cdev->private->options.force |= (flags & CCWDEV_ALLOW_FORCE) != 0; |
Peter Oberparleiter | 454e1fa | 2009-12-07 12:51:30 +0100 | [diff] [blame] | 79 | cdev->private->options.mpath |= (flags & CCWDEV_DO_MULTIPATH) != 0; |
Cornelia Huck | 4dd3cc5 | 2007-02-12 15:47:18 +0100 | [diff] [blame] | 80 | return 0; |
| 81 | } |
| 82 | |
Cornelia Huck | b2ffd8e | 2007-10-12 16:11:17 +0200 | [diff] [blame] | 83 | /** |
| 84 | * ccw_device_clear_options() - clear some options |
| 85 | * @cdev: device for which the options are to be cleared |
| 86 | * @flags: options to be cleared |
| 87 | * |
| 88 | * All flags specified in @flags are cleared, the remainder is left untouched. |
| 89 | */ |
Cornelia Huck | 4dd3cc5 | 2007-02-12 15:47:18 +0100 | [diff] [blame] | 90 | void ccw_device_clear_options(struct ccw_device *cdev, unsigned long flags) |
| 91 | { |
| 92 | cdev->private->options.fast &= (flags & CCWDEV_EARLY_NOTIFICATION) == 0; |
| 93 | cdev->private->options.repall &= (flags & CCWDEV_REPORT_ALL) == 0; |
| 94 | cdev->private->options.pgroup &= (flags & CCWDEV_DO_PATHGROUP) == 0; |
| 95 | cdev->private->options.force &= (flags & CCWDEV_ALLOW_FORCE) == 0; |
Peter Oberparleiter | 454e1fa | 2009-12-07 12:51:30 +0100 | [diff] [blame] | 96 | cdev->private->options.mpath &= (flags & CCWDEV_DO_MULTIPATH) == 0; |
Cornelia Huck | 4dd3cc5 | 2007-02-12 15:47:18 +0100 | [diff] [blame] | 97 | } |
| 98 | |
Cornelia Huck | b2ffd8e | 2007-10-12 16:11:17 +0200 | [diff] [blame] | 99 | /** |
Peter Oberparleiter | 454e1fa | 2009-12-07 12:51:30 +0100 | [diff] [blame] | 100 | * ccw_device_is_pathgroup - determine if paths to this device are grouped |
| 101 | * @cdev: ccw device |
| 102 | * |
| 103 | * Return non-zero if there is a path group, zero otherwise. |
| 104 | */ |
| 105 | int ccw_device_is_pathgroup(struct ccw_device *cdev) |
| 106 | { |
| 107 | return cdev->private->flags.pgroup; |
| 108 | } |
| 109 | EXPORT_SYMBOL(ccw_device_is_pathgroup); |
| 110 | |
| 111 | /** |
| 112 | * ccw_device_is_multipath - determine if device is operating in multipath mode |
| 113 | * @cdev: ccw device |
| 114 | * |
| 115 | * Return non-zero if device is operating in multipath mode, zero otherwise. |
| 116 | */ |
| 117 | int ccw_device_is_multipath(struct ccw_device *cdev) |
| 118 | { |
| 119 | return cdev->private->flags.mpath; |
| 120 | } |
| 121 | EXPORT_SYMBOL(ccw_device_is_multipath); |
| 122 | |
| 123 | /** |
Cornelia Huck | b2ffd8e | 2007-10-12 16:11:17 +0200 | [diff] [blame] | 124 | * ccw_device_clear() - terminate I/O request processing |
| 125 | * @cdev: target ccw device |
| 126 | * @intparm: interruption parameter; value is only used if no I/O is |
| 127 | * outstanding, otherwise the intparm associated with the I/O request |
| 128 | * is returned |
| 129 | * |
| 130 | * ccw_device_clear() calls csch on @cdev's subchannel. |
| 131 | * Returns: |
| 132 | * %0 on success, |
| 133 | * -%ENODEV on device not operational, |
| 134 | * -%EINVAL on invalid device state. |
| 135 | * Context: |
| 136 | * Interrupts disabled, ccw device lock held |
| 137 | */ |
| 138 | int ccw_device_clear(struct ccw_device *cdev, unsigned long intparm) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 139 | { |
| 140 | struct subchannel *sch; |
| 141 | int ret; |
| 142 | |
Sebastian Ott | e45efa9 | 2009-06-12 10:26:27 +0200 | [diff] [blame] | 143 | if (!cdev || !cdev->dev.parent) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 144 | return -ENODEV; |
Sebastian Ott | 823d494 | 2009-06-16 10:30:20 +0200 | [diff] [blame] | 145 | sch = to_subchannel(cdev->dev.parent); |
| 146 | if (!sch->schib.pmcw.ena) |
| 147 | return -EINVAL; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 148 | if (cdev->private->state == DEV_STATE_NOT_OPER) |
| 149 | return -ENODEV; |
| 150 | if (cdev->private->state != DEV_STATE_ONLINE && |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 151 | cdev->private->state != DEV_STATE_W4SENSE) |
| 152 | return -EINVAL; |
Sebastian Ott | 823d494 | 2009-06-16 10:30:20 +0200 | [diff] [blame] | 153 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 154 | ret = cio_clear(sch); |
| 155 | if (ret == 0) |
| 156 | cdev->private->intparm = intparm; |
| 157 | return ret; |
| 158 | } |
| 159 | |
Cornelia Huck | b2ffd8e | 2007-10-12 16:11:17 +0200 | [diff] [blame] | 160 | /** |
| 161 | * ccw_device_start_key() - start a s390 channel program with key |
| 162 | * @cdev: target ccw device |
| 163 | * @cpa: logical start address of channel program |
| 164 | * @intparm: user specific interruption parameter; will be presented back to |
| 165 | * @cdev's interrupt handler. Allows a device driver to associate |
| 166 | * the interrupt with a particular I/O request. |
| 167 | * @lpm: defines the channel path to be used for a specific I/O request. A |
| 168 | * value of 0 will make cio use the opm. |
| 169 | * @key: storage key to be used for the I/O |
| 170 | * @flags: additional flags; defines the action to be performed for I/O |
| 171 | * processing. |
| 172 | * |
| 173 | * Start a S/390 channel program. When the interrupt arrives, the |
| 174 | * IRQ handler is called, either immediately, delayed (dev-end missing, |
| 175 | * or sense required) or never (no IRQ handler registered). |
| 176 | * Returns: |
| 177 | * %0, if the operation was successful; |
| 178 | * -%EBUSY, if the device is busy, or status pending; |
| 179 | * -%EACCES, if no path specified in @lpm is operational; |
| 180 | * -%ENODEV, if the device is not operational. |
| 181 | * Context: |
| 182 | * Interrupts disabled, ccw device lock held |
| 183 | */ |
| 184 | int ccw_device_start_key(struct ccw_device *cdev, struct ccw1 *cpa, |
| 185 | unsigned long intparm, __u8 lpm, __u8 key, |
| 186 | unsigned long flags) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 187 | { |
| 188 | struct subchannel *sch; |
| 189 | int ret; |
| 190 | |
Sebastian Ott | e45efa9 | 2009-06-12 10:26:27 +0200 | [diff] [blame] | 191 | if (!cdev || !cdev->dev.parent) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 192 | return -ENODEV; |
| 193 | sch = to_subchannel(cdev->dev.parent); |
Sebastian Ott | 823d494 | 2009-06-16 10:30:20 +0200 | [diff] [blame] | 194 | if (!sch->schib.pmcw.ena) |
| 195 | return -EINVAL; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 196 | if (cdev->private->state == DEV_STATE_NOT_OPER) |
| 197 | return -ENODEV; |
Peter Oberparleiter | 4257aae | 2009-12-07 12:51:29 +0100 | [diff] [blame] | 198 | if (cdev->private->state == DEV_STATE_VERIFY) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 199 | /* Remember to fake irb when finished. */ |
| 200 | if (!cdev->private->flags.fake_irb) { |
| 201 | cdev->private->flags.fake_irb = 1; |
| 202 | cdev->private->intparm = intparm; |
| 203 | return 0; |
| 204 | } else |
| 205 | /* There's already a fake I/O around. */ |
| 206 | return -EBUSY; |
| 207 | } |
| 208 | if (cdev->private->state != DEV_STATE_ONLINE || |
Peter Oberparleiter | 23d805b | 2008-07-14 09:58:50 +0200 | [diff] [blame] | 209 | ((sch->schib.scsw.cmd.stctl & SCSW_STCTL_PRIM_STATUS) && |
| 210 | !(sch->schib.scsw.cmd.stctl & SCSW_STCTL_SEC_STATUS)) || |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 211 | cdev->private->flags.doverify) |
| 212 | return -EBUSY; |
| 213 | ret = cio_set_options (sch, flags); |
| 214 | if (ret) |
| 215 | return ret; |
Peter Oberparleiter | e0e32c8 | 2006-09-20 15:59:57 +0200 | [diff] [blame] | 216 | /* Adjust requested path mask to excluded varied off paths. */ |
| 217 | if (lpm) { |
| 218 | lpm &= sch->opm; |
| 219 | if (lpm == 0) |
| 220 | return -EACCES; |
| 221 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 222 | ret = cio_start_key (sch, cpa, lpm, key); |
Cornelia Huck | fe6173d | 2008-04-17 07:46:00 +0200 | [diff] [blame] | 223 | switch (ret) { |
| 224 | case 0: |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 225 | cdev->private->intparm = intparm; |
Cornelia Huck | fe6173d | 2008-04-17 07:46:00 +0200 | [diff] [blame] | 226 | break; |
| 227 | case -EACCES: |
| 228 | case -ENODEV: |
| 229 | dev_fsm_event(cdev, DEV_EVENT_VERIFY); |
| 230 | break; |
| 231 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 232 | return ret; |
| 233 | } |
| 234 | |
Cornelia Huck | b2ffd8e | 2007-10-12 16:11:17 +0200 | [diff] [blame] | 235 | /** |
| 236 | * ccw_device_start_timeout_key() - start a s390 channel program with timeout and key |
| 237 | * @cdev: target ccw device |
| 238 | * @cpa: logical start address of channel program |
| 239 | * @intparm: user specific interruption parameter; will be presented back to |
| 240 | * @cdev's interrupt handler. Allows a device driver to associate |
| 241 | * the interrupt with a particular I/O request. |
| 242 | * @lpm: defines the channel path to be used for a specific I/O request. A |
| 243 | * value of 0 will make cio use the opm. |
| 244 | * @key: storage key to be used for the I/O |
| 245 | * @flags: additional flags; defines the action to be performed for I/O |
| 246 | * processing. |
| 247 | * @expires: timeout value in jiffies |
| 248 | * |
| 249 | * Start a S/390 channel program. When the interrupt arrives, the |
| 250 | * IRQ handler is called, either immediately, delayed (dev-end missing, |
| 251 | * or sense required) or never (no IRQ handler registered). |
| 252 | * This function notifies the device driver if the channel program has not |
| 253 | * completed during the time specified by @expires. If a timeout occurs, the |
| 254 | * channel program is terminated via xsch, hsch or csch, and the device's |
| 255 | * interrupt handler will be called with an irb containing ERR_PTR(-%ETIMEDOUT). |
| 256 | * Returns: |
| 257 | * %0, if the operation was successful; |
| 258 | * -%EBUSY, if the device is busy, or status pending; |
| 259 | * -%EACCES, if no path specified in @lpm is operational; |
| 260 | * -%ENODEV, if the device is not operational. |
| 261 | * Context: |
| 262 | * Interrupts disabled, ccw device lock held |
| 263 | */ |
| 264 | int ccw_device_start_timeout_key(struct ccw_device *cdev, struct ccw1 *cpa, |
| 265 | unsigned long intparm, __u8 lpm, __u8 key, |
| 266 | unsigned long flags, int expires) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 267 | { |
| 268 | int ret; |
| 269 | |
| 270 | if (!cdev) |
| 271 | return -ENODEV; |
| 272 | ccw_device_set_timeout(cdev, expires); |
| 273 | ret = ccw_device_start_key(cdev, cpa, intparm, lpm, key, flags); |
| 274 | if (ret != 0) |
| 275 | ccw_device_set_timeout(cdev, 0); |
| 276 | return ret; |
| 277 | } |
| 278 | |
Cornelia Huck | b2ffd8e | 2007-10-12 16:11:17 +0200 | [diff] [blame] | 279 | /** |
| 280 | * ccw_device_start() - start a s390 channel program |
| 281 | * @cdev: target ccw device |
| 282 | * @cpa: logical start address of channel program |
| 283 | * @intparm: user specific interruption parameter; will be presented back to |
| 284 | * @cdev's interrupt handler. Allows a device driver to associate |
| 285 | * the interrupt with a particular I/O request. |
| 286 | * @lpm: defines the channel path to be used for a specific I/O request. A |
| 287 | * value of 0 will make cio use the opm. |
| 288 | * @flags: additional flags; defines the action to be performed for I/O |
| 289 | * processing. |
| 290 | * |
| 291 | * Start a S/390 channel program. When the interrupt arrives, the |
| 292 | * IRQ handler is called, either immediately, delayed (dev-end missing, |
| 293 | * or sense required) or never (no IRQ handler registered). |
| 294 | * Returns: |
| 295 | * %0, if the operation was successful; |
| 296 | * -%EBUSY, if the device is busy, or status pending; |
| 297 | * -%EACCES, if no path specified in @lpm is operational; |
| 298 | * -%ENODEV, if the device is not operational. |
| 299 | * Context: |
| 300 | * Interrupts disabled, ccw device lock held |
| 301 | */ |
| 302 | int ccw_device_start(struct ccw_device *cdev, struct ccw1 *cpa, |
| 303 | unsigned long intparm, __u8 lpm, unsigned long flags) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 304 | { |
| 305 | return ccw_device_start_key(cdev, cpa, intparm, lpm, |
Peter Oberparleiter | 0b642ed | 2005-05-01 08:58:58 -0700 | [diff] [blame] | 306 | PAGE_DEFAULT_KEY, flags); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 307 | } |
| 308 | |
Cornelia Huck | b2ffd8e | 2007-10-12 16:11:17 +0200 | [diff] [blame] | 309 | /** |
| 310 | * ccw_device_start_timeout() - start a s390 channel program with timeout |
| 311 | * @cdev: target ccw device |
| 312 | * @cpa: logical start address of channel program |
| 313 | * @intparm: user specific interruption parameter; will be presented back to |
| 314 | * @cdev's interrupt handler. Allows a device driver to associate |
| 315 | * the interrupt with a particular I/O request. |
| 316 | * @lpm: defines the channel path to be used for a specific I/O request. A |
| 317 | * value of 0 will make cio use the opm. |
| 318 | * @flags: additional flags; defines the action to be performed for I/O |
| 319 | * processing. |
| 320 | * @expires: timeout value in jiffies |
| 321 | * |
| 322 | * Start a S/390 channel program. When the interrupt arrives, the |
| 323 | * IRQ handler is called, either immediately, delayed (dev-end missing, |
| 324 | * or sense required) or never (no IRQ handler registered). |
| 325 | * This function notifies the device driver if the channel program has not |
| 326 | * completed during the time specified by @expires. If a timeout occurs, the |
| 327 | * channel program is terminated via xsch, hsch or csch, and the device's |
| 328 | * interrupt handler will be called with an irb containing ERR_PTR(-%ETIMEDOUT). |
| 329 | * Returns: |
| 330 | * %0, if the operation was successful; |
| 331 | * -%EBUSY, if the device is busy, or status pending; |
| 332 | * -%EACCES, if no path specified in @lpm is operational; |
| 333 | * -%ENODEV, if the device is not operational. |
| 334 | * Context: |
| 335 | * Interrupts disabled, ccw device lock held |
| 336 | */ |
| 337 | int ccw_device_start_timeout(struct ccw_device *cdev, struct ccw1 *cpa, |
| 338 | unsigned long intparm, __u8 lpm, |
| 339 | unsigned long flags, int expires) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 340 | { |
| 341 | return ccw_device_start_timeout_key(cdev, cpa, intparm, lpm, |
Peter Oberparleiter | 0b642ed | 2005-05-01 08:58:58 -0700 | [diff] [blame] | 342 | PAGE_DEFAULT_KEY, flags, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 343 | expires); |
| 344 | } |
| 345 | |
| 346 | |
Cornelia Huck | b2ffd8e | 2007-10-12 16:11:17 +0200 | [diff] [blame] | 347 | /** |
| 348 | * ccw_device_halt() - halt I/O request processing |
| 349 | * @cdev: target ccw device |
| 350 | * @intparm: interruption parameter; value is only used if no I/O is |
| 351 | * outstanding, otherwise the intparm associated with the I/O request |
| 352 | * is returned |
| 353 | * |
| 354 | * ccw_device_halt() calls hsch on @cdev's subchannel. |
| 355 | * Returns: |
| 356 | * %0 on success, |
| 357 | * -%ENODEV on device not operational, |
| 358 | * -%EINVAL on invalid device state, |
| 359 | * -%EBUSY on device busy or interrupt pending. |
| 360 | * Context: |
| 361 | * Interrupts disabled, ccw device lock held |
| 362 | */ |
| 363 | int ccw_device_halt(struct ccw_device *cdev, unsigned long intparm) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 364 | { |
| 365 | struct subchannel *sch; |
| 366 | int ret; |
| 367 | |
Sebastian Ott | e45efa9 | 2009-06-12 10:26:27 +0200 | [diff] [blame] | 368 | if (!cdev || !cdev->dev.parent) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 369 | return -ENODEV; |
Sebastian Ott | 823d494 | 2009-06-16 10:30:20 +0200 | [diff] [blame] | 370 | sch = to_subchannel(cdev->dev.parent); |
| 371 | if (!sch->schib.pmcw.ena) |
| 372 | return -EINVAL; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 373 | if (cdev->private->state == DEV_STATE_NOT_OPER) |
| 374 | return -ENODEV; |
| 375 | if (cdev->private->state != DEV_STATE_ONLINE && |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 376 | cdev->private->state != DEV_STATE_W4SENSE) |
| 377 | return -EINVAL; |
Sebastian Ott | 823d494 | 2009-06-16 10:30:20 +0200 | [diff] [blame] | 378 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 379 | ret = cio_halt(sch); |
| 380 | if (ret == 0) |
| 381 | cdev->private->intparm = intparm; |
| 382 | return ret; |
| 383 | } |
| 384 | |
Cornelia Huck | b2ffd8e | 2007-10-12 16:11:17 +0200 | [diff] [blame] | 385 | /** |
| 386 | * ccw_device_resume() - resume channel program execution |
| 387 | * @cdev: target ccw device |
| 388 | * |
| 389 | * ccw_device_resume() calls rsch on @cdev's subchannel. |
| 390 | * Returns: |
| 391 | * %0 on success, |
| 392 | * -%ENODEV on device not operational, |
| 393 | * -%EINVAL on invalid device state, |
| 394 | * -%EBUSY on device busy or interrupt pending. |
| 395 | * Context: |
| 396 | * Interrupts disabled, ccw device lock held |
| 397 | */ |
| 398 | int ccw_device_resume(struct ccw_device *cdev) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 399 | { |
| 400 | struct subchannel *sch; |
| 401 | |
Sebastian Ott | e45efa9 | 2009-06-12 10:26:27 +0200 | [diff] [blame] | 402 | if (!cdev || !cdev->dev.parent) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 403 | return -ENODEV; |
| 404 | sch = to_subchannel(cdev->dev.parent); |
Sebastian Ott | 823d494 | 2009-06-16 10:30:20 +0200 | [diff] [blame] | 405 | if (!sch->schib.pmcw.ena) |
| 406 | return -EINVAL; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 407 | if (cdev->private->state == DEV_STATE_NOT_OPER) |
| 408 | return -ENODEV; |
| 409 | if (cdev->private->state != DEV_STATE_ONLINE || |
Peter Oberparleiter | 23d805b | 2008-07-14 09:58:50 +0200 | [diff] [blame] | 410 | !(sch->schib.scsw.cmd.actl & SCSW_ACTL_SUSPENDED)) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 411 | return -EINVAL; |
| 412 | return cio_resume(sch); |
| 413 | } |
| 414 | |
| 415 | /* |
| 416 | * Pass interrupt to device driver. |
| 417 | */ |
| 418 | int |
| 419 | ccw_device_call_handler(struct ccw_device *cdev) |
| 420 | { |
| 421 | struct subchannel *sch; |
| 422 | unsigned int stctl; |
| 423 | int ending_status; |
| 424 | |
| 425 | sch = to_subchannel(cdev->dev.parent); |
| 426 | |
| 427 | /* |
| 428 | * we allow for the device action handler if . |
| 429 | * - we received ending status |
| 430 | * - the action handler requested to see all interrupts |
| 431 | * - we received an intermediate status |
| 432 | * - fast notification was requested (primary status) |
| 433 | * - unsolicited interrupts |
| 434 | */ |
Peter Oberparleiter | 23d805b | 2008-07-14 09:58:50 +0200 | [diff] [blame] | 435 | stctl = scsw_stctl(&cdev->private->irb.scsw); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 436 | ending_status = (stctl & SCSW_STCTL_SEC_STATUS) || |
| 437 | (stctl == (SCSW_STCTL_ALERT_STATUS | SCSW_STCTL_STATUS_PEND)) || |
| 438 | (stctl == SCSW_STCTL_STATUS_PEND); |
| 439 | if (!ending_status && |
| 440 | !cdev->private->options.repall && |
| 441 | !(stctl & SCSW_STCTL_INTER_STATUS) && |
| 442 | !(cdev->private->options.fast && |
| 443 | (stctl & SCSW_STCTL_PRIM_STATUS))) |
| 444 | return 0; |
| 445 | |
Cornelia Huck | f1ee328 | 2006-10-04 20:02:02 +0200 | [diff] [blame] | 446 | /* Clear pending timers for device driver initiated I/O. */ |
| 447 | if (ending_status) |
| 448 | ccw_device_set_timeout(cdev, 0); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 449 | /* |
| 450 | * Now we are ready to call the device driver interrupt handler. |
| 451 | */ |
| 452 | if (cdev->handler) |
| 453 | cdev->handler(cdev, cdev->private->intparm, |
| 454 | &cdev->private->irb); |
| 455 | |
| 456 | /* |
| 457 | * Clear the old and now useless interrupt response block. |
| 458 | */ |
| 459 | memset(&cdev->private->irb, 0, sizeof(struct irb)); |
| 460 | |
| 461 | return 1; |
| 462 | } |
| 463 | |
Cornelia Huck | b2ffd8e | 2007-10-12 16:11:17 +0200 | [diff] [blame] | 464 | /** |
| 465 | * ccw_device_get_ciw() - Search for CIW command in extended sense data. |
| 466 | * @cdev: ccw device to inspect |
| 467 | * @ct: command type to look for |
| 468 | * |
| 469 | * During SenseID, command information words (CIWs) describing special |
| 470 | * commands available to the device may have been stored in the extended |
| 471 | * sense data. This function searches for CIWs of a specified command |
| 472 | * type in the extended sense data. |
| 473 | * Returns: |
| 474 | * %NULL if no extended sense data has been stored or if no CIW of the |
| 475 | * specified command type could be found, |
| 476 | * else a pointer to the CIW of the specified command type. |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 477 | */ |
Cornelia Huck | b2ffd8e | 2007-10-12 16:11:17 +0200 | [diff] [blame] | 478 | struct ciw *ccw_device_get_ciw(struct ccw_device *cdev, __u32 ct) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 479 | { |
| 480 | int ciw_cnt; |
| 481 | |
| 482 | if (cdev->private->flags.esid == 0) |
| 483 | return NULL; |
| 484 | for (ciw_cnt = 0; ciw_cnt < MAX_CIWS; ciw_cnt++) |
| 485 | if (cdev->private->senseid.ciw[ciw_cnt].ct == ct) |
| 486 | return cdev->private->senseid.ciw + ciw_cnt; |
| 487 | return NULL; |
| 488 | } |
| 489 | |
Cornelia Huck | b2ffd8e | 2007-10-12 16:11:17 +0200 | [diff] [blame] | 490 | /** |
| 491 | * ccw_device_get_path_mask() - get currently available paths |
| 492 | * @cdev: ccw device to be queried |
| 493 | * Returns: |
| 494 | * %0 if no subchannel for the device is available, |
| 495 | * else the mask of currently available paths for the ccw device's subchannel. |
| 496 | */ |
| 497 | __u8 ccw_device_get_path_mask(struct ccw_device *cdev) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 498 | { |
| 499 | struct subchannel *sch; |
| 500 | |
Sebastian Ott | e45efa9 | 2009-06-12 10:26:27 +0200 | [diff] [blame] | 501 | if (!cdev->dev.parent) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 502 | return 0; |
Sebastian Ott | e45efa9 | 2009-06-12 10:26:27 +0200 | [diff] [blame] | 503 | |
| 504 | sch = to_subchannel(cdev->dev.parent); |
| 505 | return sch->lpm; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 506 | } |
| 507 | |
Peter Oberparleiter | d7d12ef | 2009-12-07 12:51:32 +0100 | [diff] [blame] | 508 | struct stlck_data { |
| 509 | struct completion done; |
| 510 | int rc; |
| 511 | }; |
| 512 | |
| 513 | void ccw_device_stlck_done(struct ccw_device *cdev, void *data, int rc) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 514 | { |
Peter Oberparleiter | d7d12ef | 2009-12-07 12:51:32 +0100 | [diff] [blame] | 515 | struct stlck_data *sdata = data; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 516 | |
Peter Oberparleiter | d7d12ef | 2009-12-07 12:51:32 +0100 | [diff] [blame] | 517 | sdata->rc = rc; |
| 518 | complete(&sdata->done); |
| 519 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 520 | |
Peter Oberparleiter | d7d12ef | 2009-12-07 12:51:32 +0100 | [diff] [blame] | 521 | /* |
| 522 | * Perform unconditional reserve + release. |
| 523 | */ |
| 524 | int ccw_device_stlck(struct ccw_device *cdev) |
| 525 | { |
| 526 | struct subchannel *sch = to_subchannel(cdev->dev.parent); |
| 527 | struct stlck_data data; |
| 528 | u8 *buffer; |
| 529 | int rc; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 530 | |
Peter Oberparleiter | d7d12ef | 2009-12-07 12:51:32 +0100 | [diff] [blame] | 531 | /* Check if steal lock operation is valid for this device. */ |
| 532 | if (cdev->drv) { |
| 533 | if (!cdev->private->options.force) |
| 534 | return -EINVAL; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 535 | } |
Peter Oberparleiter | d7d12ef | 2009-12-07 12:51:32 +0100 | [diff] [blame] | 536 | buffer = kzalloc(64, GFP_DMA | GFP_KERNEL); |
| 537 | if (!buffer) |
| 538 | return -ENOMEM; |
| 539 | init_completion(&data.done); |
| 540 | data.rc = -EIO; |
| 541 | spin_lock_irq(sch->lock); |
| 542 | rc = cio_enable_subchannel(sch, (u32) (addr_t) sch); |
| 543 | if (rc) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 544 | goto out_unlock; |
Peter Oberparleiter | d7d12ef | 2009-12-07 12:51:32 +0100 | [diff] [blame] | 545 | /* Perform operation. */ |
| 546 | cdev->private->state = DEV_STATE_STEAL_LOCK, |
| 547 | ccw_device_stlck_start(cdev, &data, &buffer[0], &buffer[32]); |
| 548 | spin_unlock_irq(sch->lock); |
| 549 | /* Wait for operation to finish. */ |
| 550 | if (wait_for_completion_interruptible(&data.done)) { |
| 551 | /* Got a signal. */ |
| 552 | spin_lock_irq(sch->lock); |
| 553 | ccw_request_cancel(cdev); |
| 554 | spin_unlock_irq(sch->lock); |
| 555 | wait_for_completion(&data.done); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 556 | } |
Peter Oberparleiter | d7d12ef | 2009-12-07 12:51:32 +0100 | [diff] [blame] | 557 | rc = data.rc; |
| 558 | /* Check results. */ |
| 559 | spin_lock_irq(sch->lock); |
| 560 | cio_disable_subchannel(sch); |
| 561 | cdev->private->state = DEV_STATE_BOXED; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 562 | out_unlock: |
Peter Oberparleiter | d7d12ef | 2009-12-07 12:51:32 +0100 | [diff] [blame] | 563 | spin_unlock_irq(sch->lock); |
| 564 | kfree(buffer); |
| 565 | |
| 566 | return rc; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 567 | } |
| 568 | |
Cornelia Huck | b2ffd8e | 2007-10-12 16:11:17 +0200 | [diff] [blame] | 569 | void *ccw_device_get_chp_desc(struct ccw_device *cdev, int chp_no) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 570 | { |
| 571 | struct subchannel *sch; |
Peter Oberparleiter | e6b6e10 | 2007-04-27 16:01:28 +0200 | [diff] [blame] | 572 | struct chp_id chpid; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 573 | |
| 574 | sch = to_subchannel(cdev->dev.parent); |
Peter Oberparleiter | e6b6e10 | 2007-04-27 16:01:28 +0200 | [diff] [blame] | 575 | chp_id_init(&chpid); |
| 576 | chpid.id = sch->schib.pmcw.chpid[chp_no]; |
| 577 | return chp_get_chp_desc(chpid); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 578 | } |
| 579 | |
Cornelia Huck | 9a92fe4 | 2007-05-10 15:45:42 +0200 | [diff] [blame] | 580 | /** |
| 581 | * ccw_device_get_id - obtain a ccw device id |
| 582 | * @cdev: device to obtain the id for |
| 583 | * @dev_id: where to fill in the values |
| 584 | */ |
| 585 | void ccw_device_get_id(struct ccw_device *cdev, struct ccw_dev_id *dev_id) |
| 586 | { |
| 587 | *dev_id = cdev->private->dev_id; |
| 588 | } |
| 589 | EXPORT_SYMBOL(ccw_device_get_id); |
| 590 | |
Peter Oberparleiter | 83262d6 | 2008-07-14 09:58:51 +0200 | [diff] [blame] | 591 | /** |
| 592 | * ccw_device_tm_start_key - perform start function |
| 593 | * @cdev: ccw device on which to perform the start function |
| 594 | * @tcw: transport-command word to be started |
| 595 | * @intparm: user defined parameter to be passed to the interrupt handler |
| 596 | * @lpm: mask of paths to use |
| 597 | * @key: storage key to use for storage access |
| 598 | * |
| 599 | * Start the tcw on the given ccw device. Return zero on success, non-zero |
| 600 | * otherwise. |
| 601 | */ |
| 602 | int ccw_device_tm_start_key(struct ccw_device *cdev, struct tcw *tcw, |
| 603 | unsigned long intparm, u8 lpm, u8 key) |
| 604 | { |
| 605 | struct subchannel *sch; |
| 606 | int rc; |
| 607 | |
| 608 | sch = to_subchannel(cdev->dev.parent); |
Sebastian Ott | 823d494 | 2009-06-16 10:30:20 +0200 | [diff] [blame] | 609 | if (!sch->schib.pmcw.ena) |
| 610 | return -EINVAL; |
Peter Oberparleiter | 83262d6 | 2008-07-14 09:58:51 +0200 | [diff] [blame] | 611 | if (cdev->private->state != DEV_STATE_ONLINE) |
| 612 | return -EIO; |
| 613 | /* Adjust requested path mask to excluded varied off paths. */ |
| 614 | if (lpm) { |
| 615 | lpm &= sch->opm; |
| 616 | if (lpm == 0) |
| 617 | return -EACCES; |
| 618 | } |
| 619 | rc = cio_tm_start_key(sch, tcw, lpm, key); |
| 620 | if (rc == 0) |
| 621 | cdev->private->intparm = intparm; |
| 622 | return rc; |
| 623 | } |
| 624 | EXPORT_SYMBOL(ccw_device_tm_start_key); |
| 625 | |
| 626 | /** |
| 627 | * ccw_device_tm_start_timeout_key - perform start function |
| 628 | * @cdev: ccw device on which to perform the start function |
| 629 | * @tcw: transport-command word to be started |
| 630 | * @intparm: user defined parameter to be passed to the interrupt handler |
| 631 | * @lpm: mask of paths to use |
| 632 | * @key: storage key to use for storage access |
| 633 | * @expires: time span in jiffies after which to abort request |
| 634 | * |
| 635 | * Start the tcw on the given ccw device. Return zero on success, non-zero |
| 636 | * otherwise. |
| 637 | */ |
| 638 | int ccw_device_tm_start_timeout_key(struct ccw_device *cdev, struct tcw *tcw, |
| 639 | unsigned long intparm, u8 lpm, u8 key, |
| 640 | int expires) |
| 641 | { |
| 642 | int ret; |
| 643 | |
| 644 | ccw_device_set_timeout(cdev, expires); |
| 645 | ret = ccw_device_tm_start_key(cdev, tcw, intparm, lpm, key); |
| 646 | if (ret != 0) |
| 647 | ccw_device_set_timeout(cdev, 0); |
| 648 | return ret; |
| 649 | } |
| 650 | EXPORT_SYMBOL(ccw_device_tm_start_timeout_key); |
| 651 | |
| 652 | /** |
| 653 | * ccw_device_tm_start - perform start function |
| 654 | * @cdev: ccw device on which to perform the start function |
| 655 | * @tcw: transport-command word to be started |
| 656 | * @intparm: user defined parameter to be passed to the interrupt handler |
| 657 | * @lpm: mask of paths to use |
| 658 | * |
| 659 | * Start the tcw on the given ccw device. Return zero on success, non-zero |
| 660 | * otherwise. |
| 661 | */ |
| 662 | int ccw_device_tm_start(struct ccw_device *cdev, struct tcw *tcw, |
| 663 | unsigned long intparm, u8 lpm) |
| 664 | { |
| 665 | return ccw_device_tm_start_key(cdev, tcw, intparm, lpm, |
| 666 | PAGE_DEFAULT_KEY); |
| 667 | } |
| 668 | EXPORT_SYMBOL(ccw_device_tm_start); |
| 669 | |
| 670 | /** |
| 671 | * ccw_device_tm_start_timeout - perform start function |
| 672 | * @cdev: ccw device on which to perform the start function |
| 673 | * @tcw: transport-command word to be started |
| 674 | * @intparm: user defined parameter to be passed to the interrupt handler |
| 675 | * @lpm: mask of paths to use |
| 676 | * @expires: time span in jiffies after which to abort request |
| 677 | * |
| 678 | * Start the tcw on the given ccw device. Return zero on success, non-zero |
| 679 | * otherwise. |
| 680 | */ |
| 681 | int ccw_device_tm_start_timeout(struct ccw_device *cdev, struct tcw *tcw, |
| 682 | unsigned long intparm, u8 lpm, int expires) |
| 683 | { |
| 684 | return ccw_device_tm_start_timeout_key(cdev, tcw, intparm, lpm, |
| 685 | PAGE_DEFAULT_KEY, expires); |
| 686 | } |
| 687 | EXPORT_SYMBOL(ccw_device_tm_start_timeout); |
| 688 | |
| 689 | /** |
Sebastian Ott | ce322cc | 2011-01-05 12:47:56 +0100 | [diff] [blame] | 690 | * ccw_device_get_mdc - accumulate max data count |
| 691 | * @cdev: ccw device for which the max data count is accumulated |
| 692 | * @mask: mask of paths to use |
| 693 | * |
| 694 | * Return the number of 64K-bytes blocks all paths at least support |
| 695 | * for a transport command. Return values <= 0 indicate failures. |
| 696 | */ |
| 697 | int ccw_device_get_mdc(struct ccw_device *cdev, u8 mask) |
| 698 | { |
| 699 | struct subchannel *sch = to_subchannel(cdev->dev.parent); |
| 700 | struct channel_path_desc_fmt1 desc; |
| 701 | struct chp_id chpid; |
| 702 | int mdc = 0, ret, i; |
| 703 | |
| 704 | /* Adjust requested path mask to excluded varied off paths. */ |
| 705 | if (mask) |
| 706 | mask &= sch->lpm; |
| 707 | else |
| 708 | mask = sch->lpm; |
| 709 | |
| 710 | chp_id_init(&chpid); |
| 711 | for (i = 0; i < 8; i++) { |
| 712 | if (!(mask & (0x80 >> i))) |
| 713 | continue; |
| 714 | chpid.id = sch->schib.pmcw.chpid[i]; |
| 715 | ret = chsc_determine_fmt1_channel_path_desc(chpid, &desc); |
| 716 | if (ret) |
| 717 | return ret; |
| 718 | if (!desc.f) |
| 719 | return 0; |
| 720 | if (!desc.r) |
| 721 | mdc = 1; |
| 722 | mdc = mdc ? min(mdc, (int)desc.mdc) : desc.mdc; |
| 723 | } |
| 724 | |
| 725 | return mdc; |
| 726 | } |
| 727 | EXPORT_SYMBOL(ccw_device_get_mdc); |
| 728 | |
| 729 | /** |
Peter Oberparleiter | 83262d6 | 2008-07-14 09:58:51 +0200 | [diff] [blame] | 730 | * ccw_device_tm_intrg - perform interrogate function |
| 731 | * @cdev: ccw device on which to perform the interrogate function |
| 732 | * |
| 733 | * Perform an interrogate function on the given ccw device. Return zero on |
| 734 | * success, non-zero otherwise. |
| 735 | */ |
| 736 | int ccw_device_tm_intrg(struct ccw_device *cdev) |
| 737 | { |
| 738 | struct subchannel *sch = to_subchannel(cdev->dev.parent); |
| 739 | |
Sebastian Ott | 823d494 | 2009-06-16 10:30:20 +0200 | [diff] [blame] | 740 | if (!sch->schib.pmcw.ena) |
| 741 | return -EINVAL; |
Peter Oberparleiter | 83262d6 | 2008-07-14 09:58:51 +0200 | [diff] [blame] | 742 | if (cdev->private->state != DEV_STATE_ONLINE) |
| 743 | return -EIO; |
| 744 | if (!scsw_is_tm(&sch->schib.scsw) || |
Peter Oberparleiter | 7a968f0 | 2009-03-26 15:24:18 +0100 | [diff] [blame] | 745 | !(scsw_actl(&sch->schib.scsw) & SCSW_ACTL_START_PEND)) |
Peter Oberparleiter | 83262d6 | 2008-07-14 09:58:51 +0200 | [diff] [blame] | 746 | return -EINVAL; |
| 747 | return cio_tm_intrg(sch); |
| 748 | } |
| 749 | EXPORT_SYMBOL(ccw_device_tm_intrg); |
| 750 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 751 | // FIXME: these have to go: |
| 752 | |
| 753 | int |
| 754 | _ccw_device_get_subchannel_number(struct ccw_device *cdev) |
| 755 | { |
Cornelia Huck | 7896426 | 2006-10-11 15:31:38 +0200 | [diff] [blame] | 756 | return cdev->private->schid.sch_no; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 757 | } |
| 758 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 759 | |
| 760 | MODULE_LICENSE("GPL"); |
Cornelia Huck | 4dd3cc5 | 2007-02-12 15:47:18 +0100 | [diff] [blame] | 761 | EXPORT_SYMBOL(ccw_device_set_options_mask); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 762 | EXPORT_SYMBOL(ccw_device_set_options); |
Cornelia Huck | 4dd3cc5 | 2007-02-12 15:47:18 +0100 | [diff] [blame] | 763 | EXPORT_SYMBOL(ccw_device_clear_options); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 764 | EXPORT_SYMBOL(ccw_device_clear); |
| 765 | EXPORT_SYMBOL(ccw_device_halt); |
| 766 | EXPORT_SYMBOL(ccw_device_resume); |
| 767 | EXPORT_SYMBOL(ccw_device_start_timeout); |
| 768 | EXPORT_SYMBOL(ccw_device_start); |
| 769 | EXPORT_SYMBOL(ccw_device_start_timeout_key); |
| 770 | EXPORT_SYMBOL(ccw_device_start_key); |
| 771 | EXPORT_SYMBOL(ccw_device_get_ciw); |
| 772 | EXPORT_SYMBOL(ccw_device_get_path_mask); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 773 | EXPORT_SYMBOL(_ccw_device_get_subchannel_number); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 774 | EXPORT_SYMBOL_GPL(ccw_device_get_chp_desc); |