diff options
Diffstat (limited to 'drivers/s390/block')
-rw-r--r-- | drivers/s390/block/dasd.c | 12 | ||||
-rw-r--r-- | drivers/s390/block/dasd_devmap.c | 3 | ||||
-rw-r--r-- | drivers/s390/block/dasd_diag.c | 64 | ||||
-rw-r--r-- | drivers/s390/block/dasd_diag.h | 10 |
4 files changed, 47 insertions, 42 deletions
diff --git a/drivers/s390/block/dasd.c b/drivers/s390/block/dasd.c index 8fc891a9d47f..7008d32433bf 100644 --- a/drivers/s390/block/dasd.c +++ b/drivers/s390/block/dasd.c | |||
@@ -115,8 +115,7 @@ dasd_alloc_device(void) | |||
115 | void | 115 | void |
116 | dasd_free_device(struct dasd_device *device) | 116 | dasd_free_device(struct dasd_device *device) |
117 | { | 117 | { |
118 | if (device->private) | 118 | kfree(device->private); |
119 | kfree(device->private); | ||
120 | free_page((unsigned long) device->erp_mem); | 119 | free_page((unsigned long) device->erp_mem); |
121 | free_pages((unsigned long) device->ccw_mem, 1); | 120 | free_pages((unsigned long) device->ccw_mem, 1); |
122 | kfree(device); | 121 | kfree(device); |
@@ -539,8 +538,7 @@ dasd_kmalloc_request(char *magic, int cplength, int datasize, | |||
539 | if (datasize > 0) { | 538 | if (datasize > 0) { |
540 | cqr->data = kmalloc(datasize, GFP_ATOMIC | GFP_DMA); | 539 | cqr->data = kmalloc(datasize, GFP_ATOMIC | GFP_DMA); |
541 | if (cqr->data == NULL) { | 540 | if (cqr->data == NULL) { |
542 | if (cqr->cpaddr != NULL) | 541 | kfree(cqr->cpaddr); |
543 | kfree(cqr->cpaddr); | ||
544 | kfree(cqr); | 542 | kfree(cqr); |
545 | return ERR_PTR(-ENOMEM); | 543 | return ERR_PTR(-ENOMEM); |
546 | } | 544 | } |
@@ -615,10 +613,8 @@ dasd_kfree_request(struct dasd_ccw_req * cqr, struct dasd_device * device) | |||
615 | clear_normalized_cda(ccw); | 613 | clear_normalized_cda(ccw); |
616 | } while (ccw++->flags & (CCW_FLAG_CC | CCW_FLAG_DC)); | 614 | } while (ccw++->flags & (CCW_FLAG_CC | CCW_FLAG_DC)); |
617 | #endif | 615 | #endif |
618 | if (cqr->cpaddr != NULL) | 616 | kfree(cqr->cpaddr); |
619 | kfree(cqr->cpaddr); | 617 | kfree(cqr->data); |
620 | if (cqr->data != NULL) | ||
621 | kfree(cqr->data); | ||
622 | kfree(cqr); | 618 | kfree(cqr); |
623 | dasd_put_device(device); | 619 | dasd_put_device(device); |
624 | } | 620 | } |
diff --git a/drivers/s390/block/dasd_devmap.c b/drivers/s390/block/dasd_devmap.c index bda896d9d788..caee16a3dc62 100644 --- a/drivers/s390/block/dasd_devmap.c +++ b/drivers/s390/block/dasd_devmap.c | |||
@@ -387,8 +387,7 @@ dasd_add_busid(char *bus_id, int features) | |||
387 | new = 0; | 387 | new = 0; |
388 | } | 388 | } |
389 | spin_unlock(&dasd_devmap_lock); | 389 | spin_unlock(&dasd_devmap_lock); |
390 | if (new) | 390 | kfree(new); |
391 | kfree(new); | ||
392 | return devmap; | 391 | return devmap; |
393 | } | 392 | } |
394 | 393 | ||
diff --git a/drivers/s390/block/dasd_diag.c b/drivers/s390/block/dasd_diag.c index 7478423b53bb..ab8754e566bc 100644 --- a/drivers/s390/block/dasd_diag.c +++ b/drivers/s390/block/dasd_diag.c | |||
@@ -6,7 +6,7 @@ | |||
6 | * Bugreports.to..: <Linux390@de.ibm.com> | 6 | * Bugreports.to..: <Linux390@de.ibm.com> |
7 | * (C) IBM Corporation, IBM Deutschland Entwicklung GmbH, 1999,2000 | 7 | * (C) IBM Corporation, IBM Deutschland Entwicklung GmbH, 1999,2000 |
8 | * | 8 | * |
9 | * $Revision: 1.49 $ | 9 | * $Revision: 1.51 $ |
10 | */ | 10 | */ |
11 | 11 | ||
12 | #include <linux/config.h> | 12 | #include <linux/config.h> |
@@ -67,9 +67,9 @@ static const u8 DASD_DIAG_CMS1[] = { 0xc3, 0xd4, 0xe2, 0xf1 };/* EBCDIC CMS1 */ | |||
67 | static __inline__ int | 67 | static __inline__ int |
68 | dia250(void *iob, int cmd) | 68 | dia250(void *iob, int cmd) |
69 | { | 69 | { |
70 | typedef struct { | 70 | typedef union { |
71 | char _[max(sizeof (struct dasd_diag_init_io), | 71 | struct dasd_diag_init_io init_io; |
72 | sizeof (struct dasd_diag_rw_io))]; | 72 | struct dasd_diag_rw_io rw_io; |
73 | } addr_type; | 73 | } addr_type; |
74 | int rc; | 74 | int rc; |
75 | 75 | ||
@@ -190,7 +190,7 @@ dasd_start_diag(struct dasd_ccw_req * cqr) | |||
190 | private->iob.flags = DASD_DIAG_RWFLAG_ASYNC; | 190 | private->iob.flags = DASD_DIAG_RWFLAG_ASYNC; |
191 | private->iob.block_count = dreq->block_count; | 191 | private->iob.block_count = dreq->block_count; |
192 | private->iob.interrupt_params = (addr_t) cqr; | 192 | private->iob.interrupt_params = (addr_t) cqr; |
193 | private->iob.bio_list = __pa(dreq->bio); | 193 | private->iob.bio_list = dreq->bio; |
194 | private->iob.flaga = DASD_DIAG_FLAGA_DEFAULT; | 194 | private->iob.flaga = DASD_DIAG_FLAGA_DEFAULT; |
195 | 195 | ||
196 | cqr->startclk = get_clock(); | 196 | cqr->startclk = get_clock(); |
@@ -394,47 +394,57 @@ dasd_diag_check_device(struct dasd_device *device) | |||
394 | memset(&bio, 0, sizeof (struct dasd_diag_bio)); | 394 | memset(&bio, 0, sizeof (struct dasd_diag_bio)); |
395 | bio.type = MDSK_READ_REQ; | 395 | bio.type = MDSK_READ_REQ; |
396 | bio.block_number = private->pt_block + 1; | 396 | bio.block_number = private->pt_block + 1; |
397 | bio.buffer = __pa(label); | 397 | bio.buffer = label; |
398 | memset(&private->iob, 0, sizeof (struct dasd_diag_rw_io)); | 398 | memset(&private->iob, 0, sizeof (struct dasd_diag_rw_io)); |
399 | private->iob.dev_nr = rdc_data->dev_nr; | 399 | private->iob.dev_nr = rdc_data->dev_nr; |
400 | private->iob.key = 0; | 400 | private->iob.key = 0; |
401 | private->iob.flags = 0; /* do synchronous io */ | 401 | private->iob.flags = 0; /* do synchronous io */ |
402 | private->iob.block_count = 1; | 402 | private->iob.block_count = 1; |
403 | private->iob.interrupt_params = 0; | 403 | private->iob.interrupt_params = 0; |
404 | private->iob.bio_list = __pa(&bio); | 404 | private->iob.bio_list = &bio; |
405 | private->iob.flaga = DASD_DIAG_FLAGA_DEFAULT; | 405 | private->iob.flaga = DASD_DIAG_FLAGA_DEFAULT; |
406 | rc = dia250(&private->iob, RW_BIO); | 406 | rc = dia250(&private->iob, RW_BIO); |
407 | if (rc == 0 || rc == 3) | 407 | if (rc == 3) { |
408 | break; | 408 | DEV_MESSAGE(KERN_WARNING, device, "%s", |
409 | "DIAG call failed"); | ||
410 | rc = -EOPNOTSUPP; | ||
411 | goto out; | ||
412 | } | ||
409 | mdsk_term_io(device); | 413 | mdsk_term_io(device); |
414 | if (rc == 0) | ||
415 | break; | ||
410 | } | 416 | } |
411 | if (rc == 3) { | 417 | if (bsize > PAGE_SIZE) { |
412 | DEV_MESSAGE(KERN_WARNING, device, "%s", "DIAG call failed"); | ||
413 | rc = -EOPNOTSUPP; | ||
414 | } else if (rc != 0) { | ||
415 | DEV_MESSAGE(KERN_WARNING, device, "device access failed " | 418 | DEV_MESSAGE(KERN_WARNING, device, "device access failed " |
416 | "(rc=%d)", rc); | 419 | "(rc=%d)", rc); |
417 | rc = -EIO; | 420 | rc = -EIO; |
421 | goto out; | ||
422 | } | ||
423 | /* check for label block */ | ||
424 | if (memcmp(label->label_id, DASD_DIAG_CMS1, | ||
425 | sizeof(DASD_DIAG_CMS1)) == 0) { | ||
426 | /* get formatted blocksize from label block */ | ||
427 | bsize = (unsigned int) label->block_size; | ||
428 | device->blocks = (unsigned long) label->block_count; | ||
429 | } else | ||
430 | device->blocks = end_block; | ||
431 | device->bp_block = bsize; | ||
432 | device->s2b_shift = 0; /* bits to shift 512 to get a block */ | ||
433 | for (sb = 512; sb < bsize; sb = sb << 1) | ||
434 | device->s2b_shift++; | ||
435 | rc = mdsk_init_io(device, device->bp_block, 0, NULL); | ||
436 | if (rc) { | ||
437 | DEV_MESSAGE(KERN_WARNING, device, "DIAG initialization " | ||
438 | "failed (rc=%d)", rc); | ||
439 | rc = -EIO; | ||
418 | } else { | 440 | } else { |
419 | if (memcmp(label->label_id, DASD_DIAG_CMS1, | ||
420 | sizeof(DASD_DIAG_CMS1)) == 0) { | ||
421 | /* get formatted blocksize from label block */ | ||
422 | bsize = (unsigned int) label->block_size; | ||
423 | device->blocks = (unsigned long) label->block_count; | ||
424 | } else | ||
425 | device->blocks = end_block; | ||
426 | device->bp_block = bsize; | ||
427 | device->s2b_shift = 0; /* bits to shift 512 to get a block */ | ||
428 | for (sb = 512; sb < bsize; sb = sb << 1) | ||
429 | device->s2b_shift++; | ||
430 | |||
431 | DEV_MESSAGE(KERN_INFO, device, | 441 | DEV_MESSAGE(KERN_INFO, device, |
432 | "(%ld B/blk): %ldkB", | 442 | "(%ld B/blk): %ldkB", |
433 | (unsigned long) device->bp_block, | 443 | (unsigned long) device->bp_block, |
434 | (unsigned long) (device->blocks << | 444 | (unsigned long) (device->blocks << |
435 | device->s2b_shift) >> 1); | 445 | device->s2b_shift) >> 1); |
436 | rc = 0; | ||
437 | } | 446 | } |
447 | out: | ||
438 | free_page((long) label); | 448 | free_page((long) label); |
439 | return rc; | 449 | return rc; |
440 | } | 450 | } |
@@ -529,7 +539,7 @@ dasd_diag_build_cp(struct dasd_device * device, struct request *req) | |||
529 | memset(dbio, 0, sizeof (struct dasd_diag_bio)); | 539 | memset(dbio, 0, sizeof (struct dasd_diag_bio)); |
530 | dbio->type = rw_cmd; | 540 | dbio->type = rw_cmd; |
531 | dbio->block_number = recid + 1; | 541 | dbio->block_number = recid + 1; |
532 | dbio->buffer = __pa(dst); | 542 | dbio->buffer = dst; |
533 | dbio++; | 543 | dbio++; |
534 | dst += blksize; | 544 | dst += blksize; |
535 | recid++; | 545 | recid++; |
diff --git a/drivers/s390/block/dasd_diag.h b/drivers/s390/block/dasd_diag.h index b26eb28df4bf..df31484d73a7 100644 --- a/drivers/s390/block/dasd_diag.h +++ b/drivers/s390/block/dasd_diag.h | |||
@@ -6,7 +6,7 @@ | |||
6 | * Bugreports.to..: <Linux390@de.ibm.com> | 6 | * Bugreports.to..: <Linux390@de.ibm.com> |
7 | * (C) IBM Corporation, IBM Deutschland Entwicklung GmbH, 1999,2000 | 7 | * (C) IBM Corporation, IBM Deutschland Entwicklung GmbH, 1999,2000 |
8 | * | 8 | * |
9 | * $Revision: 1.7 $ | 9 | * $Revision: 1.8 $ |
10 | */ | 10 | */ |
11 | 11 | ||
12 | #define MDSK_WRITE_REQ 0x01 | 12 | #define MDSK_WRITE_REQ 0x01 |
@@ -78,7 +78,7 @@ struct dasd_diag_bio { | |||
78 | u8 spare1[2]; | 78 | u8 spare1[2]; |
79 | u32 alet; | 79 | u32 alet; |
80 | blocknum_t block_number; | 80 | blocknum_t block_number; |
81 | u64 buffer; | 81 | void *buffer; |
82 | } __attribute__ ((packed, aligned(8))); | 82 | } __attribute__ ((packed, aligned(8))); |
83 | 83 | ||
84 | struct dasd_diag_init_io { | 84 | struct dasd_diag_init_io { |
@@ -104,7 +104,7 @@ struct dasd_diag_rw_io { | |||
104 | u32 alet; | 104 | u32 alet; |
105 | u8 spare3[4]; | 105 | u8 spare3[4]; |
106 | u64 interrupt_params; | 106 | u64 interrupt_params; |
107 | u64 bio_list; | 107 | struct dasd_diag_bio *bio_list; |
108 | u8 spare4[8]; | 108 | u8 spare4[8]; |
109 | } __attribute__ ((packed, aligned(8))); | 109 | } __attribute__ ((packed, aligned(8))); |
110 | #else /* CONFIG_ARCH_S390X */ | 110 | #else /* CONFIG_ARCH_S390X */ |
@@ -119,7 +119,7 @@ struct dasd_diag_bio { | |||
119 | u16 spare1; | 119 | u16 spare1; |
120 | blocknum_t block_number; | 120 | blocknum_t block_number; |
121 | u32 alet; | 121 | u32 alet; |
122 | u32 buffer; | 122 | void *buffer; |
123 | } __attribute__ ((packed, aligned(8))); | 123 | } __attribute__ ((packed, aligned(8))); |
124 | 124 | ||
125 | struct dasd_diag_init_io { | 125 | struct dasd_diag_init_io { |
@@ -142,7 +142,7 @@ struct dasd_diag_rw_io { | |||
142 | u8 spare2[2]; | 142 | u8 spare2[2]; |
143 | u32 block_count; | 143 | u32 block_count; |
144 | u32 alet; | 144 | u32 alet; |
145 | u32 bio_list; | 145 | struct dasd_diag_bio *bio_list; |
146 | u32 interrupt_params; | 146 | u32 interrupt_params; |
147 | u8 spare3[20]; | 147 | u8 spare3[20]; |
148 | } __attribute__ ((packed, aligned(8))); | 148 | } __attribute__ ((packed, aligned(8))); |