blob: d774e79476fee0c73e967979781210aa0faffdef [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001/*
2 * File...........: linux/drivers/s390/block/dasd_devmap.c
3 * Author(s)......: Holger Smolinski <Holger.Smolinski@de.ibm.com>
4 * Horst Hummel <Horst.Hummel@de.ibm.com>
5 * Carsten Otte <Cotte@de.ibm.com>
6 * Martin Schwidefsky <schwidefsky@de.ibm.com>
7 * Bugreports.to..: <Linux390@de.ibm.com>
8 * (C) IBM Corporation, IBM Deutschland Entwicklung GmbH, 1999-2001
9 *
10 * Device mapping and dasd= parameter parsing functions. All devmap
11 * functions may not be called from interrupt context. In particular
12 * dasd_get_device is a no-no from interrupt context.
13 *
Linus Torvalds1da177e2005-04-16 15:20:36 -070014 */
15
Linus Torvalds1da177e2005-04-16 15:20:36 -070016#include <linux/ctype.h>
17#include <linux/init.h>
Rusty Russell8d3b33f2006-03-25 03:07:05 -080018#include <linux/module.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070019
20#include <asm/debug.h>
21#include <asm/uaccess.h>
Peter Oberparleiter7039d3a2007-04-27 16:01:48 +020022#include <asm/ipl.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070023
24/* This is ugly... */
25#define PRINTK_HEADER "dasd_devmap:"
26
27#include "dasd_int.h"
28
Christoph Lametere18b8902006-12-06 20:33:20 -080029struct kmem_cache *dasd_page_cache;
Horst Hummel40545572006-06-29 15:08:18 +020030EXPORT_SYMBOL_GPL(dasd_page_cache);
Linus Torvalds1da177e2005-04-16 15:20:36 -070031
32/*
33 * dasd_devmap_t is used to store the features and the relation
34 * between device number and device index. To find a dasd_devmap_t
35 * that corresponds to a device number of a device index each
36 * dasd_devmap_t is added to two linked lists, one to search by
37 * the device number and one to search by the device index. As
38 * soon as big minor numbers are available the device index list
39 * can be removed since the device number will then be identical
40 * to the device index.
41 */
42struct dasd_devmap {
43 struct list_head list;
44 char bus_id[BUS_ID_SIZE];
45 unsigned int devindex;
46 unsigned short features;
47 struct dasd_device *device;
Horst Hummel3d052592006-04-27 18:40:28 -070048 struct dasd_uid uid;
Linus Torvalds1da177e2005-04-16 15:20:36 -070049};
50
51/*
52 * Parameter parsing functions for dasd= parameter. The syntax is:
53 * <devno> : (0x)?[0-9a-fA-F]+
54 * <busid> : [0-0a-f]\.[0-9a-f]\.(0x)?[0-9a-fA-F]+
55 * <feature> : ro
56 * <feature_list> : \(<feature>(:<feature>)*\)
57 * <devno-range> : <devno>(-<devno>)?<feature_list>?
58 * <busid-range> : <busid>(-<busid>)?<feature_list>?
59 * <devices> : <devno-range>|<busid-range>
60 * <dasd_module> : dasd_diag_mod|dasd_eckd_mod|dasd_fba_mod
61 *
62 * <dasd> : autodetect|probeonly|<devices>(,<devices>)*
63 */
64
65int dasd_probeonly = 0; /* is true, when probeonly mode is active */
66int dasd_autodetect = 0; /* is true, when autodetection is active */
Horst Hummel40545572006-06-29 15:08:18 +020067int dasd_nopav = 0; /* is true, when PAV is disabled */
68EXPORT_SYMBOL_GPL(dasd_nopav);
Linus Torvalds1da177e2005-04-16 15:20:36 -070069
70/*
71 * char *dasd[] is intended to hold the ranges supplied by the dasd= statement
72 * it is named 'dasd' to directly be filled by insmod with the comma separated
73 * strings when running as a module.
74 */
75static char *dasd[256];
Rusty Russell8d3b33f2006-03-25 03:07:05 -080076module_param_array(dasd, charp, NULL, 0);
77
Linus Torvalds1da177e2005-04-16 15:20:36 -070078/*
Horst Hummeld0710c72006-08-10 15:45:16 +020079 * Single spinlock to protect devmap and servermap structures and lists.
Linus Torvalds1da177e2005-04-16 15:20:36 -070080 */
81static DEFINE_SPINLOCK(dasd_devmap_lock);
82
83/*
84 * Hash lists for devmap structures.
85 */
86static struct list_head dasd_hashlists[256];
87int dasd_max_devindex;
88
Cornelia Huck69f90f62008-05-15 16:52:34 +020089static struct dasd_devmap *dasd_add_busid(const char *, int);
Linus Torvalds1da177e2005-04-16 15:20:36 -070090
91static inline int
Cornelia Huck69f90f62008-05-15 16:52:34 +020092dasd_hash_busid(const char *bus_id)
Linus Torvalds1da177e2005-04-16 15:20:36 -070093{
94 int hash, i;
95
96 hash = 0;
97 for (i = 0; (i < BUS_ID_SIZE) && *bus_id; i++, bus_id++)
98 hash += *bus_id;
99 return hash & 0xff;
100}
101
102#ifndef MODULE
103/*
104 * The parameter parsing functions for builtin-drivers are called
105 * before kmalloc works. Store the pointers to the parameters strings
106 * into dasd[] for later processing.
107 */
108static int __init
109dasd_call_setup(char *str)
110{
111 static int count = 0;
112
113 if (count < 256)
114 dasd[count++] = str;
115 return 1;
116}
117
118__setup ("dasd=", dasd_call_setup);
119#endif /* #ifndef MODULE */
120
Peter Oberparleiter7039d3a2007-04-27 16:01:48 +0200121#define DASD_IPLDEV "ipldev"
122
Linus Torvalds1da177e2005-04-16 15:20:36 -0700123/*
124 * Read a device busid/devno from a string.
125 */
Heiko Carstens4d284ca2007-02-05 21:18:53 +0100126static int
Linus Torvalds1da177e2005-04-16 15:20:36 -0700127dasd_busid(char **str, int *id0, int *id1, int *devno)
128{
129 int val, old_style;
Horst Hummel138c0142006-06-29 14:58:12 +0200130
Peter Oberparleiter7039d3a2007-04-27 16:01:48 +0200131 /* Interpret ipldev busid */
132 if (strncmp(DASD_IPLDEV, *str, strlen(DASD_IPLDEV)) == 0) {
133 if (ipl_info.type != IPL_TYPE_CCW) {
134 MESSAGE(KERN_ERR, "%s", "ipl device is not a ccw "
135 "device");
136 return -EINVAL;
137 }
138 *id0 = 0;
139 *id1 = ipl_info.data.ccw.dev_id.ssid;
140 *devno = ipl_info.data.ccw.dev_id.devno;
141 *str += strlen(DASD_IPLDEV);
142
143 return 0;
144 }
Linus Torvalds1da177e2005-04-16 15:20:36 -0700145 /* check for leading '0x' */
146 old_style = 0;
147 if ((*str)[0] == '0' && (*str)[1] == 'x') {
148 *str += 2;
149 old_style = 1;
150 }
151 if (!isxdigit((*str)[0])) /* We require at least one hex digit */
152 return -EINVAL;
153 val = simple_strtoul(*str, str, 16);
154 if (old_style || (*str)[0] != '.') {
155 *id0 = *id1 = 0;
156 if (val < 0 || val > 0xffff)
157 return -EINVAL;
158 *devno = val;
159 return 0;
160 }
161 /* New style x.y.z busid */
162 if (val < 0 || val > 0xff)
163 return -EINVAL;
164 *id0 = val;
165 (*str)++;
166 if (!isxdigit((*str)[0])) /* We require at least one hex digit */
167 return -EINVAL;
168 val = simple_strtoul(*str, str, 16);
169 if (val < 0 || val > 0xff || (*str)++[0] != '.')
170 return -EINVAL;
171 *id1 = val;
172 if (!isxdigit((*str)[0])) /* We require at least one hex digit */
173 return -EINVAL;
174 val = simple_strtoul(*str, str, 16);
175 if (val < 0 || val > 0xffff)
176 return -EINVAL;
177 *devno = val;
178 return 0;
179}
180
181/*
182 * Read colon separated list of dasd features. Currently there is
183 * only one: "ro" for read-only devices. The default feature set
184 * is empty (value 0).
185 */
Heiko Carstens4d284ca2007-02-05 21:18:53 +0100186static int
Linus Torvalds1da177e2005-04-16 15:20:36 -0700187dasd_feature_list(char *str, char **endp)
188{
189 int features, len, rc;
190
191 rc = 0;
192 if (*str != '(') {
193 *endp = str;
194 return DASD_FEATURE_DEFAULT;
195 }
196 str++;
197 features = 0;
198
199 while (1) {
Horst Hummel138c0142006-06-29 14:58:12 +0200200 for (len = 0;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700201 str[len] && str[len] != ':' && str[len] != ')'; len++);
202 if (len == 2 && !strncmp(str, "ro", 2))
203 features |= DASD_FEATURE_READONLY;
204 else if (len == 4 && !strncmp(str, "diag", 4))
205 features |= DASD_FEATURE_USEDIAG;
Horst Hummel9575bf22006-12-08 15:54:15 +0100206 else if (len == 6 && !strncmp(str, "erplog", 6))
207 features |= DASD_FEATURE_ERPLOG;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700208 else {
209 MESSAGE(KERN_WARNING,
210 "unsupported feature: %*s, "
211 "ignoring setting", len, str);
212 rc = -EINVAL;
213 }
214 str += len;
215 if (*str != ':')
216 break;
217 str++;
218 }
219 if (*str != ')') {
220 MESSAGE(KERN_WARNING, "%s",
221 "missing ')' in dasd parameter string\n");
222 rc = -EINVAL;
223 } else
224 str++;
225 *endp = str;
226 if (rc != 0)
227 return rc;
228 return features;
229}
230
231/*
232 * Try to match the first element on the comma separated parse string
233 * with one of the known keywords. If a keyword is found, take the approprate
234 * action and return a pointer to the residual string. If the first element
235 * could not be matched to any keyword then return an error code.
236 */
237static char *
238dasd_parse_keyword( char *parsestring ) {
239
240 char *nextcomma, *residual_str;
241 int length;
242
243 nextcomma = strchr(parsestring,',');
244 if (nextcomma) {
245 length = nextcomma - parsestring;
246 residual_str = nextcomma + 1;
247 } else {
248 length = strlen(parsestring);
249 residual_str = parsestring + length;
250 }
Horst Hummel40545572006-06-29 15:08:18 +0200251 if (strncmp("autodetect", parsestring, length) == 0) {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700252 dasd_autodetect = 1;
253 MESSAGE (KERN_INFO, "%s",
254 "turning to autodetection mode");
255 return residual_str;
256 }
Horst Hummel40545572006-06-29 15:08:18 +0200257 if (strncmp("probeonly", parsestring, length) == 0) {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700258 dasd_probeonly = 1;
259 MESSAGE(KERN_INFO, "%s",
260 "turning to probeonly mode");
261 return residual_str;
262 }
Horst Hummel40545572006-06-29 15:08:18 +0200263 if (strncmp("nopav", parsestring, length) == 0) {
Peter Oberparleiterdcd707b2006-09-20 15:59:52 +0200264 if (MACHINE_IS_VM)
265 MESSAGE(KERN_INFO, "%s", "'nopav' not supported on VM");
266 else {
267 dasd_nopav = 1;
268 MESSAGE(KERN_INFO, "%s", "disable PAV mode");
269 }
Horst Hummel40545572006-06-29 15:08:18 +0200270 return residual_str;
271 }
272 if (strncmp("fixedbuffers", parsestring, length) == 0) {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700273 if (dasd_page_cache)
274 return residual_str;
275 dasd_page_cache =
Heiko Carstens2f6c55f2006-08-16 13:49:27 +0200276 kmem_cache_create("dasd_page_cache", PAGE_SIZE,
277 PAGE_SIZE, SLAB_CACHE_DMA,
Paul Mundt20c2df82007-07-20 10:11:58 +0900278 NULL);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700279 if (!dasd_page_cache)
280 MESSAGE(KERN_WARNING, "%s", "Failed to create slab, "
281 "fixed buffer mode disabled.");
282 else
283 MESSAGE (KERN_INFO, "%s",
284 "turning on fixed buffer mode");
285 return residual_str;
286 }
287 return ERR_PTR(-EINVAL);
288}
289
290/*
291 * Try to interprete the first element on the comma separated parse string
292 * as a device number or a range of devices. If the interpretation is
293 * successfull, create the matching dasd_devmap entries and return a pointer
294 * to the residual string.
295 * If interpretation fails or in case of an error, return an error code.
296 */
297static char *
298dasd_parse_range( char *parsestring ) {
299
300 struct dasd_devmap *devmap;
301 int from, from_id0, from_id1;
302 int to, to_id0, to_id1;
303 int features, rc;
304 char bus_id[BUS_ID_SIZE+1], *str;
305
306 str = parsestring;
307 rc = dasd_busid(&str, &from_id0, &from_id1, &from);
308 if (rc == 0) {
309 to = from;
310 to_id0 = from_id0;
311 to_id1 = from_id1;
312 if (*str == '-') {
313 str++;
314 rc = dasd_busid(&str, &to_id0, &to_id1, &to);
315 }
316 }
317 if (rc == 0 &&
318 (from_id0 != to_id0 || from_id1 != to_id1 || from > to))
319 rc = -EINVAL;
320 if (rc) {
321 MESSAGE(KERN_ERR, "Invalid device range %s", parsestring);
322 return ERR_PTR(rc);
323 }
324 features = dasd_feature_list(str, &str);
325 if (features < 0)
326 return ERR_PTR(-EINVAL);
Horst Hummel40545572006-06-29 15:08:18 +0200327 /* each device in dasd= parameter should be set initially online */
328 features |= DASD_FEATURE_INITIAL_ONLINE;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700329 while (from <= to) {
330 sprintf(bus_id, "%01x.%01x.%04x",
331 from_id0, from_id1, from++);
332 devmap = dasd_add_busid(bus_id, features);
333 if (IS_ERR(devmap))
334 return (char *)devmap;
335 }
336 if (*str == ',')
337 return str + 1;
338 if (*str == '\0')
339 return str;
340 MESSAGE(KERN_WARNING,
341 "junk at end of dasd parameter string: %s\n", str);
342 return ERR_PTR(-EINVAL);
343}
344
Heiko Carstens4d284ca2007-02-05 21:18:53 +0100345static char *
Linus Torvalds1da177e2005-04-16 15:20:36 -0700346dasd_parse_next_element( char *parsestring ) {
347 char * residual_str;
348 residual_str = dasd_parse_keyword(parsestring);
349 if (!IS_ERR(residual_str))
350 return residual_str;
351 residual_str = dasd_parse_range(parsestring);
352 return residual_str;
353}
354
355/*
356 * Parse parameters stored in dasd[]
357 * The 'dasd=...' parameter allows to specify a comma separated list of
358 * keywords and device ranges. When the dasd driver is build into the kernel,
359 * the complete list will be stored as one element of the dasd[] array.
360 * When the dasd driver is build as a module, then the list is broken into
361 * it's elements and each dasd[] entry contains one element.
362 */
363int
364dasd_parse(void)
365{
366 int rc, i;
367 char *parsestring;
368
369 rc = 0;
370 for (i = 0; i < 256; i++) {
371 if (dasd[i] == NULL)
372 break;
373 parsestring = dasd[i];
374 /* loop over the comma separated list in the parsestring */
375 while (*parsestring) {
376 parsestring = dasd_parse_next_element(parsestring);
377 if(IS_ERR(parsestring)) {
378 rc = PTR_ERR(parsestring);
379 break;
380 }
381 }
382 if (rc) {
383 DBF_EVENT(DBF_ALERT, "%s", "invalid range found");
384 break;
385 }
386 }
387 return rc;
388}
389
390/*
391 * Add a devmap for the device specified by busid. It is possible that
392 * the devmap already exists (dasd= parameter). The order of the devices
393 * added through this function will define the kdevs for the individual
Horst Hummel138c0142006-06-29 14:58:12 +0200394 * devices.
Linus Torvalds1da177e2005-04-16 15:20:36 -0700395 */
396static struct dasd_devmap *
Cornelia Huck69f90f62008-05-15 16:52:34 +0200397dasd_add_busid(const char *bus_id, int features)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700398{
399 struct dasd_devmap *devmap, *new, *tmp;
400 int hash;
401
402 new = (struct dasd_devmap *)
Horst Hummel138c0142006-06-29 14:58:12 +0200403 kzalloc(sizeof(struct dasd_devmap), GFP_KERNEL);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700404 if (!new)
405 return ERR_PTR(-ENOMEM);
406 spin_lock(&dasd_devmap_lock);
Heiko Carstensd2c993d2006-07-12 16:41:55 +0200407 devmap = NULL;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700408 hash = dasd_hash_busid(bus_id);
409 list_for_each_entry(tmp, &dasd_hashlists[hash], list)
410 if (strncmp(tmp->bus_id, bus_id, BUS_ID_SIZE) == 0) {
411 devmap = tmp;
412 break;
413 }
414 if (!devmap) {
415 /* This bus_id is new. */
416 new->devindex = dasd_max_devindex++;
417 strncpy(new->bus_id, bus_id, BUS_ID_SIZE);
418 new->features = features;
Heiko Carstensd2c993d2006-07-12 16:41:55 +0200419 new->device = NULL;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700420 list_add(&new->list, &dasd_hashlists[hash]);
421 devmap = new;
Heiko Carstensd2c993d2006-07-12 16:41:55 +0200422 new = NULL;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700423 }
424 spin_unlock(&dasd_devmap_lock);
Jesper Juhl17fd6822005-11-07 01:01:30 -0800425 kfree(new);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700426 return devmap;
427}
428
429/*
430 * Find devmap for device with given bus_id.
431 */
432static struct dasd_devmap *
Cornelia Huck69f90f62008-05-15 16:52:34 +0200433dasd_find_busid(const char *bus_id)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700434{
435 struct dasd_devmap *devmap, *tmp;
436 int hash;
437
438 spin_lock(&dasd_devmap_lock);
439 devmap = ERR_PTR(-ENODEV);
440 hash = dasd_hash_busid(bus_id);
441 list_for_each_entry(tmp, &dasd_hashlists[hash], list) {
442 if (strncmp(tmp->bus_id, bus_id, BUS_ID_SIZE) == 0) {
443 devmap = tmp;
444 break;
445 }
446 }
447 spin_unlock(&dasd_devmap_lock);
448 return devmap;
449}
450
451/*
452 * Check if busid has been added to the list of dasd ranges.
453 */
454int
Cornelia Huck69f90f62008-05-15 16:52:34 +0200455dasd_busid_known(const char *bus_id)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700456{
457 return IS_ERR(dasd_find_busid(bus_id)) ? -ENOENT : 0;
458}
459
460/*
461 * Forget all about the device numbers added so far.
462 * This may only be called at module unload or system shutdown.
463 */
464static void
465dasd_forget_ranges(void)
466{
467 struct dasd_devmap *devmap, *n;
468 int i;
469
470 spin_lock(&dasd_devmap_lock);
471 for (i = 0; i < 256; i++) {
472 list_for_each_entry_safe(devmap, n, &dasd_hashlists[i], list) {
Eric Sesterhenn606f4422006-03-26 18:33:07 +0200473 BUG_ON(devmap->device != NULL);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700474 list_del(&devmap->list);
475 kfree(devmap);
476 }
477 }
478 spin_unlock(&dasd_devmap_lock);
479}
480
481/*
482 * Find the device struct by its device index.
483 */
484struct dasd_device *
485dasd_device_from_devindex(int devindex)
486{
487 struct dasd_devmap *devmap, *tmp;
488 struct dasd_device *device;
489 int i;
490
491 spin_lock(&dasd_devmap_lock);
Heiko Carstensd2c993d2006-07-12 16:41:55 +0200492 devmap = NULL;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700493 for (i = 0; (i < 256) && !devmap; i++)
494 list_for_each_entry(tmp, &dasd_hashlists[i], list)
495 if (tmp->devindex == devindex) {
496 /* Found the devmap for the device. */
497 devmap = tmp;
498 break;
499 }
500 if (devmap && devmap->device) {
501 device = devmap->device;
502 dasd_get_device(device);
503 } else
504 device = ERR_PTR(-ENODEV);
505 spin_unlock(&dasd_devmap_lock);
506 return device;
507}
508
509/*
510 * Return devmap for cdev. If no devmap exists yet, create one and
511 * connect it to the cdev.
512 */
513static struct dasd_devmap *
514dasd_devmap_from_cdev(struct ccw_device *cdev)
515{
516 struct dasd_devmap *devmap;
517
518 devmap = dasd_find_busid(cdev->dev.bus_id);
519 if (IS_ERR(devmap))
520 devmap = dasd_add_busid(cdev->dev.bus_id,
521 DASD_FEATURE_DEFAULT);
522 return devmap;
523}
524
525/*
526 * Create a dasd device structure for cdev.
527 */
528struct dasd_device *
529dasd_create_device(struct ccw_device *cdev)
530{
531 struct dasd_devmap *devmap;
532 struct dasd_device *device;
Martin Schwidefskya00bfd72006-09-20 15:59:05 +0200533 unsigned long flags;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700534 int rc;
535
536 devmap = dasd_devmap_from_cdev(cdev);
537 if (IS_ERR(devmap))
538 return (void *) devmap;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700539
540 device = dasd_alloc_device();
541 if (IS_ERR(device))
542 return device;
Martin Schwidefskya00bfd72006-09-20 15:59:05 +0200543 atomic_set(&device->ref_count, 3);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700544
545 spin_lock(&dasd_devmap_lock);
546 if (!devmap->device) {
547 devmap->device = device;
548 device->devindex = devmap->devindex;
Horst Hummelc6eb7b72005-09-03 15:57:58 -0700549 device->features = devmap->features;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700550 get_device(&cdev->dev);
551 device->cdev = cdev;
552 rc = 0;
553 } else
554 /* Someone else was faster. */
555 rc = -EBUSY;
556 spin_unlock(&dasd_devmap_lock);
557
558 if (rc) {
559 dasd_free_device(device);
560 return ERR_PTR(rc);
561 }
Martin Schwidefskya00bfd72006-09-20 15:59:05 +0200562
563 spin_lock_irqsave(get_ccwdev_lock(cdev), flags);
564 cdev->dev.driver_data = device;
565 spin_unlock_irqrestore(get_ccwdev_lock(cdev), flags);
566
Linus Torvalds1da177e2005-04-16 15:20:36 -0700567 return device;
568}
569
570/*
571 * Wait queue for dasd_delete_device waits.
572 */
573static DECLARE_WAIT_QUEUE_HEAD(dasd_delete_wq);
574
575/*
576 * Remove a dasd device structure. The passed referenced
577 * is destroyed.
578 */
579void
580dasd_delete_device(struct dasd_device *device)
581{
582 struct ccw_device *cdev;
583 struct dasd_devmap *devmap;
Martin Schwidefskya00bfd72006-09-20 15:59:05 +0200584 unsigned long flags;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700585
586 /* First remove device pointer from devmap. */
587 devmap = dasd_find_busid(device->cdev->dev.bus_id);
Eric Sesterhenn606f4422006-03-26 18:33:07 +0200588 BUG_ON(IS_ERR(devmap));
Linus Torvalds1da177e2005-04-16 15:20:36 -0700589 spin_lock(&dasd_devmap_lock);
590 if (devmap->device != device) {
591 spin_unlock(&dasd_devmap_lock);
592 dasd_put_device(device);
593 return;
594 }
595 devmap->device = NULL;
596 spin_unlock(&dasd_devmap_lock);
597
Martin Schwidefskya00bfd72006-09-20 15:59:05 +0200598 /* Disconnect dasd_device structure from ccw_device structure. */
599 spin_lock_irqsave(get_ccwdev_lock(device->cdev), flags);
600 device->cdev->dev.driver_data = NULL;
601 spin_unlock_irqrestore(get_ccwdev_lock(device->cdev), flags);
602
603 /*
604 * Drop ref_count by 3, one for the devmap reference, one for
605 * the cdev reference and one for the passed reference.
606 */
607 atomic_sub(3, &device->ref_count);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700608
609 /* Wait for reference counter to drop to zero. */
610 wait_event(dasd_delete_wq, atomic_read(&device->ref_count) == 0);
611
612 /* Disconnect dasd_device structure from ccw_device structure. */
613 cdev = device->cdev;
614 device->cdev = NULL;
615
Linus Torvalds1da177e2005-04-16 15:20:36 -0700616 /* Put ccw_device structure. */
617 put_device(&cdev->dev);
618
619 /* Now the device structure can be freed. */
620 dasd_free_device(device);
621}
622
623/*
624 * Reference counter dropped to zero. Wake up waiter
625 * in dasd_delete_device.
626 */
627void
628dasd_put_device_wake(struct dasd_device *device)
629{
630 wake_up(&dasd_delete_wq);
631}
632
633/*
634 * Return dasd_device structure associated with cdev.
Martin Schwidefskya00bfd72006-09-20 15:59:05 +0200635 * This function needs to be called with the ccw device
636 * lock held. It can be used from interrupt context.
637 */
638struct dasd_device *
639dasd_device_from_cdev_locked(struct ccw_device *cdev)
640{
641 struct dasd_device *device = cdev->dev.driver_data;
642
643 if (!device)
644 return ERR_PTR(-ENODEV);
645 dasd_get_device(device);
646 return device;
647}
648
649/*
650 * Return dasd_device structure associated with cdev.
Linus Torvalds1da177e2005-04-16 15:20:36 -0700651 */
652struct dasd_device *
653dasd_device_from_cdev(struct ccw_device *cdev)
654{
Linus Torvalds1da177e2005-04-16 15:20:36 -0700655 struct dasd_device *device;
Martin Schwidefskya00bfd72006-09-20 15:59:05 +0200656 unsigned long flags;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700657
Martin Schwidefskya00bfd72006-09-20 15:59:05 +0200658 spin_lock_irqsave(get_ccwdev_lock(cdev), flags);
659 device = dasd_device_from_cdev_locked(cdev);
660 spin_unlock_irqrestore(get_ccwdev_lock(cdev), flags);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700661 return device;
662}
663
664/*
665 * SECTION: files in sysfs
666 */
667
668/*
669 * readonly controls the readonly status of a dasd
670 */
671static ssize_t
Yani Ioannoue404e272005-05-17 06:42:58 -0400672dasd_ro_show(struct device *dev, struct device_attribute *attr, char *buf)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700673{
674 struct dasd_devmap *devmap;
675 int ro_flag;
676
677 devmap = dasd_find_busid(dev->bus_id);
678 if (!IS_ERR(devmap))
679 ro_flag = (devmap->features & DASD_FEATURE_READONLY) != 0;
680 else
681 ro_flag = (DASD_FEATURE_DEFAULT & DASD_FEATURE_READONLY) != 0;
682 return snprintf(buf, PAGE_SIZE, ro_flag ? "1\n" : "0\n");
683}
684
685static ssize_t
Horst Hummel138c0142006-06-29 14:58:12 +0200686dasd_ro_store(struct device *dev, struct device_attribute *attr,
687 const char *buf, size_t count)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700688{
689 struct dasd_devmap *devmap;
Horst Hummel01376f42006-12-04 15:39:50 +0100690 int val;
691 char *endp;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700692
693 devmap = dasd_devmap_from_cdev(to_ccwdev(dev));
694 if (IS_ERR(devmap))
695 return PTR_ERR(devmap);
Horst Hummel01376f42006-12-04 15:39:50 +0100696
697 val = simple_strtoul(buf, &endp, 0);
698 if (((endp + 1) < (buf + count)) || (val > 1))
699 return -EINVAL;
700
Linus Torvalds1da177e2005-04-16 15:20:36 -0700701 spin_lock(&dasd_devmap_lock);
Horst Hummel01376f42006-12-04 15:39:50 +0100702 if (val)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700703 devmap->features |= DASD_FEATURE_READONLY;
704 else
705 devmap->features &= ~DASD_FEATURE_READONLY;
Horst Hummelc6eb7b72005-09-03 15:57:58 -0700706 if (devmap->device)
707 devmap->device->features = devmap->features;
Stefan Weinhuber8e09f212008-01-26 14:11:23 +0100708 if (devmap->device && devmap->device->block
709 && devmap->device->block->gdp)
710 set_disk_ro(devmap->device->block->gdp, val);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700711 spin_unlock(&dasd_devmap_lock);
712 return count;
713}
714
715static DEVICE_ATTR(readonly, 0644, dasd_ro_show, dasd_ro_store);
Horst Hummel9575bf22006-12-08 15:54:15 +0100716/*
717 * erplog controls the logging of ERP related data
718 * (e.g. failing channel programs).
719 */
720static ssize_t
721dasd_erplog_show(struct device *dev, struct device_attribute *attr, char *buf)
722{
723 struct dasd_devmap *devmap;
724 int erplog;
725
726 devmap = dasd_find_busid(dev->bus_id);
727 if (!IS_ERR(devmap))
728 erplog = (devmap->features & DASD_FEATURE_ERPLOG) != 0;
729 else
730 erplog = (DASD_FEATURE_DEFAULT & DASD_FEATURE_ERPLOG) != 0;
731 return snprintf(buf, PAGE_SIZE, erplog ? "1\n" : "0\n");
732}
733
734static ssize_t
735dasd_erplog_store(struct device *dev, struct device_attribute *attr,
736 const char *buf, size_t count)
737{
738 struct dasd_devmap *devmap;
739 int val;
740 char *endp;
741
742 devmap = dasd_devmap_from_cdev(to_ccwdev(dev));
743 if (IS_ERR(devmap))
744 return PTR_ERR(devmap);
745
746 val = simple_strtoul(buf, &endp, 0);
747 if (((endp + 1) < (buf + count)) || (val > 1))
748 return -EINVAL;
749
750 spin_lock(&dasd_devmap_lock);
751 if (val)
752 devmap->features |= DASD_FEATURE_ERPLOG;
753 else
754 devmap->features &= ~DASD_FEATURE_ERPLOG;
755 if (devmap->device)
756 devmap->device->features = devmap->features;
757 spin_unlock(&dasd_devmap_lock);
758 return count;
759}
760
761static DEVICE_ATTR(erplog, 0644, dasd_erplog_show, dasd_erplog_store);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700762
763/*
764 * use_diag controls whether the driver should use diag rather than ssch
765 * to talk to the device
766 */
Horst Hummel138c0142006-06-29 14:58:12 +0200767static ssize_t
Yani Ioannoue404e272005-05-17 06:42:58 -0400768dasd_use_diag_show(struct device *dev, struct device_attribute *attr, char *buf)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700769{
770 struct dasd_devmap *devmap;
771 int use_diag;
772
773 devmap = dasd_find_busid(dev->bus_id);
774 if (!IS_ERR(devmap))
775 use_diag = (devmap->features & DASD_FEATURE_USEDIAG) != 0;
776 else
777 use_diag = (DASD_FEATURE_DEFAULT & DASD_FEATURE_USEDIAG) != 0;
778 return sprintf(buf, use_diag ? "1\n" : "0\n");
779}
780
781static ssize_t
Horst Hummel138c0142006-06-29 14:58:12 +0200782dasd_use_diag_store(struct device *dev, struct device_attribute *attr,
783 const char *buf, size_t count)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700784{
785 struct dasd_devmap *devmap;
786 ssize_t rc;
Horst Hummel01376f42006-12-04 15:39:50 +0100787 int val;
788 char *endp;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700789
790 devmap = dasd_devmap_from_cdev(to_ccwdev(dev));
791 if (IS_ERR(devmap))
792 return PTR_ERR(devmap);
Horst Hummel01376f42006-12-04 15:39:50 +0100793
794 val = simple_strtoul(buf, &endp, 0);
795 if (((endp + 1) < (buf + count)) || (val > 1))
796 return -EINVAL;
797
Linus Torvalds1da177e2005-04-16 15:20:36 -0700798 spin_lock(&dasd_devmap_lock);
799 /* Changing diag discipline flag is only allowed in offline state. */
800 rc = count;
801 if (!devmap->device) {
Horst Hummel01376f42006-12-04 15:39:50 +0100802 if (val)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700803 devmap->features |= DASD_FEATURE_USEDIAG;
804 else
805 devmap->features &= ~DASD_FEATURE_USEDIAG;
806 } else
807 rc = -EPERM;
808 spin_unlock(&dasd_devmap_lock);
809 return rc;
810}
811
Horst Hummel138c0142006-06-29 14:58:12 +0200812static DEVICE_ATTR(use_diag, 0644, dasd_use_diag_show, dasd_use_diag_store);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700813
814static ssize_t
Horst Hummel138c0142006-06-29 14:58:12 +0200815dasd_discipline_show(struct device *dev, struct device_attribute *attr,
816 char *buf)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700817{
Martin Schwidefskya00bfd72006-09-20 15:59:05 +0200818 struct dasd_device *device;
819 ssize_t len;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700820
Martin Schwidefskya00bfd72006-09-20 15:59:05 +0200821 device = dasd_device_from_cdev(to_ccwdev(dev));
822 if (!IS_ERR(device) && device->discipline) {
823 len = snprintf(buf, PAGE_SIZE, "%s\n",
824 device->discipline->name);
825 dasd_put_device(device);
826 } else
827 len = snprintf(buf, PAGE_SIZE, "none\n");
828 return len;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700829}
830
831static DEVICE_ATTR(discipline, 0444, dasd_discipline_show, NULL);
832
Horst Hummel3d052592006-04-27 18:40:28 -0700833static ssize_t
Horst Hummel4dfd5c42007-04-27 16:01:47 +0200834dasd_device_status_show(struct device *dev, struct device_attribute *attr,
835 char *buf)
836{
837 struct dasd_device *device;
838 ssize_t len;
839
840 device = dasd_device_from_cdev(to_ccwdev(dev));
841 if (!IS_ERR(device)) {
842 switch (device->state) {
843 case DASD_STATE_NEW:
844 len = snprintf(buf, PAGE_SIZE, "new\n");
845 break;
846 case DASD_STATE_KNOWN:
847 len = snprintf(buf, PAGE_SIZE, "detected\n");
848 break;
849 case DASD_STATE_BASIC:
850 len = snprintf(buf, PAGE_SIZE, "basic\n");
851 break;
852 case DASD_STATE_UNFMT:
853 len = snprintf(buf, PAGE_SIZE, "unformatted\n");
854 break;
855 case DASD_STATE_READY:
856 len = snprintf(buf, PAGE_SIZE, "ready\n");
857 break;
858 case DASD_STATE_ONLINE:
859 len = snprintf(buf, PAGE_SIZE, "online\n");
860 break;
861 default:
862 len = snprintf(buf, PAGE_SIZE, "no stat\n");
863 break;
864 }
865 dasd_put_device(device);
866 } else
867 len = snprintf(buf, PAGE_SIZE, "unknown\n");
868 return len;
869}
870
871static DEVICE_ATTR(status, 0444, dasd_device_status_show, NULL);
872
873static ssize_t
Horst Hummel3d052592006-04-27 18:40:28 -0700874dasd_alias_show(struct device *dev, struct device_attribute *attr, char *buf)
875{
876 struct dasd_devmap *devmap;
877 int alias;
878
879 devmap = dasd_find_busid(dev->bus_id);
880 spin_lock(&dasd_devmap_lock);
Stefan Weinhuber8e09f212008-01-26 14:11:23 +0100881 if (IS_ERR(devmap) || strlen(devmap->uid.vendor) == 0) {
882 spin_unlock(&dasd_devmap_lock);
883 return sprintf(buf, "0\n");
884 }
885 if (devmap->uid.type == UA_BASE_PAV_ALIAS ||
886 devmap->uid.type == UA_HYPER_PAV_ALIAS)
887 alias = 1;
Horst Hummel3d052592006-04-27 18:40:28 -0700888 else
889 alias = 0;
890 spin_unlock(&dasd_devmap_lock);
Horst Hummel3d052592006-04-27 18:40:28 -0700891 return sprintf(buf, alias ? "1\n" : "0\n");
892}
893
894static DEVICE_ATTR(alias, 0444, dasd_alias_show, NULL);
895
896static ssize_t
897dasd_vendor_show(struct device *dev, struct device_attribute *attr, char *buf)
898{
899 struct dasd_devmap *devmap;
900 char *vendor;
901
902 devmap = dasd_find_busid(dev->bus_id);
903 spin_lock(&dasd_devmap_lock);
904 if (!IS_ERR(devmap) && strlen(devmap->uid.vendor) > 0)
905 vendor = devmap->uid.vendor;
906 else
907 vendor = "";
908 spin_unlock(&dasd_devmap_lock);
909
910 return snprintf(buf, PAGE_SIZE, "%s\n", vendor);
911}
912
913static DEVICE_ATTR(vendor, 0444, dasd_vendor_show, NULL);
914
915#define UID_STRLEN ( /* vendor */ 3 + 1 + /* serial */ 14 + 1 +\
916 /* SSID */ 4 + 1 + /* unit addr */ 2 + 1)
917
918static ssize_t
919dasd_uid_show(struct device *dev, struct device_attribute *attr, char *buf)
920{
921 struct dasd_devmap *devmap;
Stefan Weinhuber8e09f212008-01-26 14:11:23 +0100922 char uid_string[UID_STRLEN];
923 char ua_string[3];
924 struct dasd_uid *uid;
Horst Hummel3d052592006-04-27 18:40:28 -0700925
926 devmap = dasd_find_busid(dev->bus_id);
927 spin_lock(&dasd_devmap_lock);
Stefan Weinhuber8e09f212008-01-26 14:11:23 +0100928 if (IS_ERR(devmap) || strlen(devmap->uid.vendor) == 0) {
929 spin_unlock(&dasd_devmap_lock);
930 return sprintf(buf, "\n");
931 }
932 uid = &devmap->uid;
933 switch (uid->type) {
934 case UA_BASE_DEVICE:
935 sprintf(ua_string, "%02x", uid->real_unit_addr);
936 break;
937 case UA_BASE_PAV_ALIAS:
938 sprintf(ua_string, "%02x", uid->base_unit_addr);
939 break;
940 case UA_HYPER_PAV_ALIAS:
941 sprintf(ua_string, "xx");
942 break;
943 default:
944 /* should not happen, treat like base device */
945 sprintf(ua_string, "%02x", uid->real_unit_addr);
946 break;
947 }
948 snprintf(uid_string, sizeof(uid_string), "%s.%s.%04x.%s",
949 uid->vendor, uid->serial, uid->ssid, ua_string);
Horst Hummel3d052592006-04-27 18:40:28 -0700950 spin_unlock(&dasd_devmap_lock);
Stefan Weinhuber8e09f212008-01-26 14:11:23 +0100951 return snprintf(buf, PAGE_SIZE, "%s\n", uid_string);
Horst Hummel3d052592006-04-27 18:40:28 -0700952}
953
954static DEVICE_ATTR(uid, 0444, dasd_uid_show, NULL);
955
Stefan Weinhuber20c64462006-03-24 03:15:25 -0800956/*
957 * extended error-reporting
958 */
959static ssize_t
960dasd_eer_show(struct device *dev, struct device_attribute *attr, char *buf)
961{
962 struct dasd_devmap *devmap;
963 int eer_flag;
964
965 devmap = dasd_find_busid(dev->bus_id);
966 if (!IS_ERR(devmap) && devmap->device)
967 eer_flag = dasd_eer_enabled(devmap->device);
968 else
969 eer_flag = 0;
970 return snprintf(buf, PAGE_SIZE, eer_flag ? "1\n" : "0\n");
971}
972
973static ssize_t
974dasd_eer_store(struct device *dev, struct device_attribute *attr,
975 const char *buf, size_t count)
976{
977 struct dasd_devmap *devmap;
Horst Hummel01376f42006-12-04 15:39:50 +0100978 int val, rc;
979 char *endp;
Stefan Weinhuber20c64462006-03-24 03:15:25 -0800980
981 devmap = dasd_devmap_from_cdev(to_ccwdev(dev));
982 if (IS_ERR(devmap))
983 return PTR_ERR(devmap);
984 if (!devmap->device)
Horst Hummel01376f42006-12-04 15:39:50 +0100985 return -ENODEV;
986
987 val = simple_strtoul(buf, &endp, 0);
988 if (((endp + 1) < (buf + count)) || (val > 1))
989 return -EINVAL;
990
Horst Hummel645c98c2006-12-04 15:40:18 +0100991 if (val) {
Stefan Weinhuber20c64462006-03-24 03:15:25 -0800992 rc = dasd_eer_enable(devmap->device);
Horst Hummel645c98c2006-12-04 15:40:18 +0100993 if (rc)
994 return rc;
995 } else
Stefan Weinhuber20c64462006-03-24 03:15:25 -0800996 dasd_eer_disable(devmap->device);
Horst Hummel645c98c2006-12-04 15:40:18 +0100997 return count;
Stefan Weinhuber20c64462006-03-24 03:15:25 -0800998}
999
1000static DEVICE_ATTR(eer_enabled, 0644, dasd_eer_show, dasd_eer_store);
1001
Linus Torvalds1da177e2005-04-16 15:20:36 -07001002static struct attribute * dasd_attrs[] = {
1003 &dev_attr_readonly.attr,
1004 &dev_attr_discipline.attr,
Horst Hummel4dfd5c42007-04-27 16:01:47 +02001005 &dev_attr_status.attr,
Horst Hummel3d052592006-04-27 18:40:28 -07001006 &dev_attr_alias.attr,
1007 &dev_attr_vendor.attr,
1008 &dev_attr_uid.attr,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001009 &dev_attr_use_diag.attr,
Stefan Weinhuber20c64462006-03-24 03:15:25 -08001010 &dev_attr_eer_enabled.attr,
Horst Hummel9575bf22006-12-08 15:54:15 +01001011 &dev_attr_erplog.attr,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001012 NULL,
1013};
1014
1015static struct attribute_group dasd_attr_group = {
1016 .attrs = dasd_attrs,
1017};
1018
Horst Hummel40545572006-06-29 15:08:18 +02001019/*
Horst Hummel3d052592006-04-27 18:40:28 -07001020 * Return copy of the device unique identifier.
1021 */
1022int
1023dasd_get_uid(struct ccw_device *cdev, struct dasd_uid *uid)
1024{
1025 struct dasd_devmap *devmap;
1026
1027 devmap = dasd_find_busid(cdev->dev.bus_id);
1028 if (IS_ERR(devmap))
1029 return PTR_ERR(devmap);
1030 spin_lock(&dasd_devmap_lock);
1031 *uid = devmap->uid;
1032 spin_unlock(&dasd_devmap_lock);
1033 return 0;
1034}
1035
1036/*
1037 * Register the given device unique identifier into devmap struct.
Peter Oberparleiterb18a60e2006-08-16 13:49:33 +02001038 * In addition check if the related storage server subsystem ID is already
1039 * contained in the dasd_server_ssid_list. If subsystem ID is not contained,
1040 * create new entry.
Horst Hummel40545572006-06-29 15:08:18 +02001041 * Return 0 if server was already in serverlist,
1042 * 1 if the server was added successful
1043 * <0 in case of error.
Horst Hummel3d052592006-04-27 18:40:28 -07001044 */
1045int
1046dasd_set_uid(struct ccw_device *cdev, struct dasd_uid *uid)
1047{
1048 struct dasd_devmap *devmap;
1049
1050 devmap = dasd_find_busid(cdev->dev.bus_id);
1051 if (IS_ERR(devmap))
1052 return PTR_ERR(devmap);
Horst Hummeld0710c72006-08-10 15:45:16 +02001053
Horst Hummel3d052592006-04-27 18:40:28 -07001054 spin_lock(&dasd_devmap_lock);
1055 devmap->uid = *uid;
1056 spin_unlock(&dasd_devmap_lock);
Horst Hummeld0710c72006-08-10 15:45:16 +02001057
Stefan Weinhuber8e09f212008-01-26 14:11:23 +01001058 return 0;
Horst Hummel3d052592006-04-27 18:40:28 -07001059}
Horst Hummel40545572006-06-29 15:08:18 +02001060EXPORT_SYMBOL_GPL(dasd_set_uid);
Horst Hummel3d052592006-04-27 18:40:28 -07001061
Horst Hummelf24acd42005-05-01 08:58:59 -07001062/*
1063 * Return value of the specified feature.
1064 */
1065int
1066dasd_get_feature(struct ccw_device *cdev, int feature)
1067{
1068 struct dasd_devmap *devmap;
1069
1070 devmap = dasd_find_busid(cdev->dev.bus_id);
1071 if (IS_ERR(devmap))
Horst Hummel40545572006-06-29 15:08:18 +02001072 return PTR_ERR(devmap);
Horst Hummelf24acd42005-05-01 08:58:59 -07001073
1074 return ((devmap->features & feature) != 0);
1075}
1076
1077/*
1078 * Set / reset given feature.
1079 * Flag indicates wether to set (!=0) or the reset (=0) the feature.
1080 */
1081int
1082dasd_set_feature(struct ccw_device *cdev, int feature, int flag)
1083{
1084 struct dasd_devmap *devmap;
1085
1086 devmap = dasd_find_busid(cdev->dev.bus_id);
1087 if (IS_ERR(devmap))
Horst Hummel40545572006-06-29 15:08:18 +02001088 return PTR_ERR(devmap);
Horst Hummelf24acd42005-05-01 08:58:59 -07001089
1090 spin_lock(&dasd_devmap_lock);
1091 if (flag)
1092 devmap->features |= feature;
1093 else
1094 devmap->features &= ~feature;
Horst Hummelc6eb7b72005-09-03 15:57:58 -07001095 if (devmap->device)
1096 devmap->device->features = devmap->features;
Horst Hummelf24acd42005-05-01 08:58:59 -07001097 spin_unlock(&dasd_devmap_lock);
1098 return 0;
1099}
1100
1101
Linus Torvalds1da177e2005-04-16 15:20:36 -07001102int
1103dasd_add_sysfs_files(struct ccw_device *cdev)
1104{
1105 return sysfs_create_group(&cdev->dev.kobj, &dasd_attr_group);
1106}
1107
1108void
1109dasd_remove_sysfs_files(struct ccw_device *cdev)
1110{
1111 sysfs_remove_group(&cdev->dev.kobj, &dasd_attr_group);
1112}
1113
1114
1115int
1116dasd_devmap_init(void)
1117{
1118 int i;
1119
1120 /* Initialize devmap structures. */
1121 dasd_max_devindex = 0;
1122 for (i = 0; i < 256; i++)
1123 INIT_LIST_HEAD(&dasd_hashlists[i]);
Horst Hummel40545572006-06-29 15:08:18 +02001124 return 0;
Linus Torvalds1da177e2005-04-16 15:20:36 -07001125}
1126
1127void
1128dasd_devmap_exit(void)
1129{
1130 dasd_forget_ranges();
1131}