aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/s390/block/dasd_eckd.c
diff options
context:
space:
mode:
authorStefan Haberland <stefan.haberland@de.ibm.com>2009-06-16 04:30:25 -0400
committerMartin Schwidefsky <schwidefsky@de.ibm.com>2009-06-16 04:31:10 -0400
commitd41dd122acf960db78c9ddc87684b43751dd36d9 (patch)
tree6005ea4914d1d2556b182ae86d82185d792b2f30 /drivers/s390/block/dasd_eckd.c
parentad285ae9fc6b9c0058f2a558b43fe8817685ebfa (diff)
[S390] pm: dasd power management callbacks.
Introduce the power management callbacks to the dasd driver. On suspend the dasd devices are stopped and removed from the focus of alias management. On resume they are reinitialized by rereading the device characteristics and adding the device to the alias management. In case the device has gone away during suspend it will caught in the suspend state with stopped flag set to UNRESUMED. After it appears again the restore function is called again. Signed-off-by: Stefan Haberland <stefan.haberland@de.ibm.com> Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
Diffstat (limited to 'drivers/s390/block/dasd_eckd.c')
-rw-r--r--drivers/s390/block/dasd_eckd.c108
1 files changed, 95 insertions, 13 deletions
diff --git a/drivers/s390/block/dasd_eckd.c b/drivers/s390/block/dasd_eckd.c
index cf0cfdba1244..1c28ec3e4ccb 100644
--- a/drivers/s390/block/dasd_eckd.c
+++ b/drivers/s390/block/dasd_eckd.c
@@ -5,10 +5,9 @@
5 * Carsten Otte <Cotte@de.ibm.com> 5 * Carsten Otte <Cotte@de.ibm.com>
6 * Martin Schwidefsky <schwidefsky@de.ibm.com> 6 * Martin Schwidefsky <schwidefsky@de.ibm.com>
7 * Bugreports.to..: <Linux390@de.ibm.com> 7 * Bugreports.to..: <Linux390@de.ibm.com>
8 * (C) IBM Corporation, IBM Deutschland Entwicklung GmbH, 1999,2000 8 * Copyright IBM Corp. 1999, 2009
9 * EMC Symmetrix ioctl Copyright EMC Corporation, 2008 9 * EMC Symmetrix ioctl Copyright EMC Corporation, 2008
10 * Author.........: Nigel Hislop <hislop_nigel@emc.com> 10 * Author.........: Nigel Hislop <hislop_nigel@emc.com>
11 *
12 */ 11 */
13 12
14#define KMSG_COMPONENT "dasd" 13#define KMSG_COMPONENT "dasd"
@@ -104,17 +103,6 @@ dasd_eckd_set_online(struct ccw_device *cdev)
104 return dasd_generic_set_online(cdev, &dasd_eckd_discipline); 103 return dasd_generic_set_online(cdev, &dasd_eckd_discipline);
105} 104}
106 105
107static struct ccw_driver dasd_eckd_driver = {
108 .name = "dasd-eckd",
109 .owner = THIS_MODULE,
110 .ids = dasd_eckd_ids,
111 .probe = dasd_eckd_probe,
112 .remove = dasd_generic_remove,
113 .set_offline = dasd_generic_set_offline,
114 .set_online = dasd_eckd_set_online,
115 .notify = dasd_generic_notify,
116};
117
118static const int sizes_trk0[] = { 28, 148, 84 }; 106static const int sizes_trk0[] = { 28, 148, 84 };
119#define LABEL_SIZE 140 107#define LABEL_SIZE 140
120 108
@@ -3236,6 +3224,98 @@ static void dasd_eckd_dump_sense(struct dasd_device *device,
3236 dasd_eckd_dump_sense_ccw(device, req, irb); 3224 dasd_eckd_dump_sense_ccw(device, req, irb);
3237} 3225}
3238 3226
3227int dasd_eckd_pm_freeze(struct dasd_device *device)
3228{
3229 /*
3230 * the device should be disconnected from our LCU structure
3231 * on restore we will reconnect it and reread LCU specific
3232 * information like PAV support that might have changed
3233 */
3234 dasd_alias_remove_device(device);
3235 dasd_alias_disconnect_device_from_lcu(device);
3236
3237 return 0;
3238}
3239
3240int dasd_eckd_restore_device(struct dasd_device *device)
3241{
3242 struct dasd_eckd_private *private;
3243 int is_known, rc;
3244 struct dasd_uid temp_uid;
3245
3246 /* allow new IO again */
3247 device->stopped &= ~DASD_STOPPED_PM;
3248
3249 private = (struct dasd_eckd_private *) device->private;
3250
3251 /* Read Configuration Data */
3252 rc = dasd_eckd_read_conf(device);
3253 if (rc)
3254 goto out_err;
3255
3256 /* Generate device unique id and register in devmap */
3257 rc = dasd_eckd_generate_uid(device, &private->uid);
3258 dasd_get_uid(device->cdev, &temp_uid);
3259 if (memcmp(&private->uid, &temp_uid, sizeof(struct dasd_uid)) != 0)
3260 dev_err(&device->cdev->dev, "The UID of the DASD has changed\n");
3261 if (rc)
3262 goto out_err;
3263 dasd_set_uid(device->cdev, &private->uid);
3264
3265 /* register lcu with alias handling, enable PAV if this is a new lcu */
3266 is_known = dasd_alias_make_device_known_to_lcu(device);
3267 if (is_known < 0)
3268 return is_known;
3269 if (!is_known) {
3270 /* new lcu found */
3271 rc = dasd_eckd_validate_server(device); /* will switch pav on */
3272 if (rc)
3273 goto out_err;
3274 }
3275
3276 /* Read Feature Codes */
3277 rc = dasd_eckd_read_features(device);
3278 if (rc)
3279 goto out_err;
3280
3281 /* Read Device Characteristics */
3282 memset(&private->rdc_data, 0, sizeof(private->rdc_data));
3283 rc = dasd_generic_read_dev_chars(device, "ECKD",
3284 &private->rdc_data, 64);
3285 if (rc) {
3286 DBF_EVENT(DBF_WARNING,
3287 "Read device characteristics failed, rc=%d for "
3288 "device: %s", rc, dev_name(&device->cdev->dev));
3289 goto out_err;
3290 }
3291
3292 /* add device to alias management */
3293 dasd_alias_add_device(device);
3294
3295 return 0;
3296
3297out_err:
3298 /*
3299 * if the resume failed for the DASD we put it in
3300 * an UNRESUMED stop state
3301 */
3302 device->stopped |= DASD_UNRESUMED_PM;
3303 return 0;
3304}
3305
3306static struct ccw_driver dasd_eckd_driver = {
3307 .name = "dasd-eckd",
3308 .owner = THIS_MODULE,
3309 .ids = dasd_eckd_ids,
3310 .probe = dasd_eckd_probe,
3311 .remove = dasd_generic_remove,
3312 .set_offline = dasd_generic_set_offline,
3313 .set_online = dasd_eckd_set_online,
3314 .notify = dasd_generic_notify,
3315 .freeze = dasd_generic_pm_freeze,
3316 .thaw = dasd_generic_restore_device,
3317 .restore = dasd_generic_restore_device,
3318};
3239 3319
3240/* 3320/*
3241 * max_blocks is dependent on the amount of storage that is available 3321 * max_blocks is dependent on the amount of storage that is available
@@ -3274,6 +3354,8 @@ static struct dasd_discipline dasd_eckd_discipline = {
3274 .dump_sense_dbf = dasd_eckd_dump_sense_dbf, 3354 .dump_sense_dbf = dasd_eckd_dump_sense_dbf,
3275 .fill_info = dasd_eckd_fill_info, 3355 .fill_info = dasd_eckd_fill_info,
3276 .ioctl = dasd_eckd_ioctl, 3356 .ioctl = dasd_eckd_ioctl,
3357 .freeze = dasd_eckd_pm_freeze,
3358 .restore = dasd_eckd_restore_device,
3277}; 3359};
3278 3360
3279static int __init 3361static int __init