diff options
Diffstat (limited to 'drivers/s390')
-rw-r--r-- | drivers/s390/char/tape.h | 1 | ||||
-rw-r--r-- | drivers/s390/char/tape_3590.c | 29 | ||||
-rw-r--r-- | drivers/s390/char/tape_3590.h | 4 | ||||
-rw-r--r-- | drivers/s390/char/tape_core.c | 3 |
4 files changed, 32 insertions, 5 deletions
diff --git a/drivers/s390/char/tape.h b/drivers/s390/char/tape.h index bb4ff537729d..3b52f5c1dbef 100644 --- a/drivers/s390/char/tape.h +++ b/drivers/s390/char/tape.h | |||
@@ -103,6 +103,7 @@ enum tape_op { | |||
103 | TO_CRYPT_OFF, /* Disable encrpytion */ | 103 | TO_CRYPT_OFF, /* Disable encrpytion */ |
104 | TO_KEKL_SET, /* Set KEK label */ | 104 | TO_KEKL_SET, /* Set KEK label */ |
105 | TO_KEKL_QUERY, /* Query KEK label */ | 105 | TO_KEKL_QUERY, /* Query KEK label */ |
106 | TO_RDC, /* Read device characteristics */ | ||
106 | TO_SIZE, /* #entries in tape_op_t */ | 107 | TO_SIZE, /* #entries in tape_op_t */ |
107 | }; | 108 | }; |
108 | 109 | ||
diff --git a/drivers/s390/char/tape_3590.c b/drivers/s390/char/tape_3590.c index 50f5edab83d7..7e2b2ab49264 100644 --- a/drivers/s390/char/tape_3590.c +++ b/drivers/s390/char/tape_3590.c | |||
@@ -788,6 +788,7 @@ tape_3590_done(struct tape_device *device, struct tape_request *request) | |||
788 | case TO_SIZE: | 788 | case TO_SIZE: |
789 | case TO_KEKL_SET: | 789 | case TO_KEKL_SET: |
790 | case TO_KEKL_QUERY: | 790 | case TO_KEKL_QUERY: |
791 | case TO_RDC: | ||
791 | break; | 792 | break; |
792 | } | 793 | } |
793 | return TAPE_IO_SUCCESS; | 794 | return TAPE_IO_SUCCESS; |
@@ -1549,6 +1550,26 @@ tape_3590_irq(struct tape_device *device, struct tape_request *request, | |||
1549 | return TAPE_IO_STOP; | 1550 | return TAPE_IO_STOP; |
1550 | } | 1551 | } |
1551 | 1552 | ||
1553 | |||
1554 | static int tape_3590_read_dev_chars(struct tape_device *device, | ||
1555 | struct tape_3590_rdc_data *rdc_data) | ||
1556 | { | ||
1557 | int rc; | ||
1558 | struct tape_request *request; | ||
1559 | |||
1560 | request = tape_alloc_request(1, sizeof(*rdc_data)); | ||
1561 | if (IS_ERR(request)) | ||
1562 | return PTR_ERR(request); | ||
1563 | request->op = TO_RDC; | ||
1564 | tape_ccw_end(request->cpaddr, CCW_CMD_RDC, sizeof(*rdc_data), | ||
1565 | request->cpdata); | ||
1566 | rc = tape_do_io(device, request); | ||
1567 | if (rc == 0) | ||
1568 | memcpy(rdc_data, request->cpdata, sizeof(*rdc_data)); | ||
1569 | tape_free_request(request); | ||
1570 | return rc; | ||
1571 | } | ||
1572 | |||
1552 | /* | 1573 | /* |
1553 | * Setup device function | 1574 | * Setup device function |
1554 | */ | 1575 | */ |
@@ -1557,7 +1578,7 @@ tape_3590_setup_device(struct tape_device *device) | |||
1557 | { | 1578 | { |
1558 | int rc; | 1579 | int rc; |
1559 | struct tape_3590_disc_data *data; | 1580 | struct tape_3590_disc_data *data; |
1560 | char *rdc_data; | 1581 | struct tape_3590_rdc_data *rdc_data; |
1561 | 1582 | ||
1562 | DBF_EVENT(6, "3590 device setup\n"); | 1583 | DBF_EVENT(6, "3590 device setup\n"); |
1563 | data = kzalloc(sizeof(struct tape_3590_disc_data), GFP_KERNEL | GFP_DMA); | 1584 | data = kzalloc(sizeof(struct tape_3590_disc_data), GFP_KERNEL | GFP_DMA); |
@@ -1566,12 +1587,12 @@ tape_3590_setup_device(struct tape_device *device) | |||
1566 | data->read_back_op = READ_PREVIOUS; | 1587 | data->read_back_op = READ_PREVIOUS; |
1567 | device->discdata = data; | 1588 | device->discdata = data; |
1568 | 1589 | ||
1569 | rdc_data = kmalloc(64, GFP_KERNEL | GFP_DMA); | 1590 | rdc_data = kmalloc(sizeof(*rdc_data), GFP_KERNEL | GFP_DMA); |
1570 | if (!rdc_data) { | 1591 | if (!rdc_data) { |
1571 | rc = -ENOMEM; | 1592 | rc = -ENOMEM; |
1572 | goto fail_kmalloc; | 1593 | goto fail_kmalloc; |
1573 | } | 1594 | } |
1574 | rc = read_dev_chars(device->cdev, (void**)&rdc_data, 64); | 1595 | rc = tape_3590_read_dev_chars(device, rdc_data); |
1575 | if (rc) { | 1596 | if (rc) { |
1576 | DBF_LH(3, "Read device characteristics failed!\n"); | 1597 | DBF_LH(3, "Read device characteristics failed!\n"); |
1577 | goto fail_kmalloc; | 1598 | goto fail_kmalloc; |
@@ -1579,7 +1600,7 @@ tape_3590_setup_device(struct tape_device *device) | |||
1579 | rc = tape_std_assign(device); | 1600 | rc = tape_std_assign(device); |
1580 | if (rc) | 1601 | if (rc) |
1581 | goto fail_rdc_data; | 1602 | goto fail_rdc_data; |
1582 | if (rdc_data[31] == 0x13) { | 1603 | if (rdc_data->data[31] == 0x13) { |
1583 | PRINT_INFO("Device has crypto support\n"); | 1604 | PRINT_INFO("Device has crypto support\n"); |
1584 | data->crypt_info.capability |= TAPE390_CRYPT_SUPPORTED_MASK; | 1605 | data->crypt_info.capability |= TAPE390_CRYPT_SUPPORTED_MASK; |
1585 | tape_3592_disable_crypt(device); | 1606 | tape_3592_disable_crypt(device); |
diff --git a/drivers/s390/char/tape_3590.h b/drivers/s390/char/tape_3590.h index aa5138807af1..4534055f1376 100644 --- a/drivers/s390/char/tape_3590.h +++ b/drivers/s390/char/tape_3590.h | |||
@@ -129,6 +129,10 @@ struct tape_3590_med_sense { | |||
129 | char pad2[116]; | 129 | char pad2[116]; |
130 | } __attribute__ ((packed)); | 130 | } __attribute__ ((packed)); |
131 | 131 | ||
132 | struct tape_3590_rdc_data { | ||
133 | char data[64]; | ||
134 | } __attribute__ ((packed)); | ||
135 | |||
132 | /* Datastructures for 3592 encryption support */ | 136 | /* Datastructures for 3592 encryption support */ |
133 | 137 | ||
134 | struct tape3592_kekl { | 138 | struct tape3592_kekl { |
diff --git a/drivers/s390/char/tape_core.c b/drivers/s390/char/tape_core.c index e2a8a1a04bab..2fae6338ee1c 100644 --- a/drivers/s390/char/tape_core.c +++ b/drivers/s390/char/tape_core.c | |||
@@ -73,7 +73,7 @@ const char *tape_op_verbose[TO_SIZE] = | |||
73 | [TO_DIS] = "DIS", [TO_ASSIGN] = "ASS", | 73 | [TO_DIS] = "DIS", [TO_ASSIGN] = "ASS", |
74 | [TO_UNASSIGN] = "UAS", [TO_CRYPT_ON] = "CON", | 74 | [TO_UNASSIGN] = "UAS", [TO_CRYPT_ON] = "CON", |
75 | [TO_CRYPT_OFF] = "COF", [TO_KEKL_SET] = "KLS", | 75 | [TO_CRYPT_OFF] = "COF", [TO_KEKL_SET] = "KLS", |
76 | [TO_KEKL_QUERY] = "KLQ", | 76 | [TO_KEKL_QUERY] = "KLQ",[TO_RDC] = "RDC", |
77 | }; | 77 | }; |
78 | 78 | ||
79 | static int | 79 | static int |
@@ -911,6 +911,7 @@ __tape_start_request(struct tape_device *device, struct tape_request *request) | |||
911 | case TO_ASSIGN: | 911 | case TO_ASSIGN: |
912 | case TO_UNASSIGN: | 912 | case TO_UNASSIGN: |
913 | case TO_READ_ATTMSG: | 913 | case TO_READ_ATTMSG: |
914 | case TO_RDC: | ||
914 | if (device->tape_state == TS_INIT) | 915 | if (device->tape_state == TS_INIT) |
915 | break; | 916 | break; |
916 | if (device->tape_state == TS_UNUSED) | 917 | if (device->tape_state == TS_UNUSED) |