Commit e2963062 authored by Michael Holzheu's avatar Michael Holzheu Committed by Martin Schwidefsky

[S390] tape: New read configuration data.

Instead of the deprecated read_conf_data(), implement a new function
tape_3590_read_dev_chars().
Signed-off-by: default avatarMichael Holzheu <holzheu@de.ibm.com>
Signed-off-by: default avatarMartin Schwidefsky <schwidefsky@de.ibm.com>
parent 6c82a8af
...@@ -103,6 +103,7 @@ enum tape_op { ...@@ -103,6 +103,7 @@ enum tape_op {
TO_CRYPT_OFF, /* Disable encrpytion */ TO_CRYPT_OFF, /* Disable encrpytion */
TO_KEKL_SET, /* Set KEK label */ TO_KEKL_SET, /* Set KEK label */
TO_KEKL_QUERY, /* Query KEK label */ TO_KEKL_QUERY, /* Query KEK label */
TO_RDC, /* Read device characteristics */
TO_SIZE, /* #entries in tape_op_t */ TO_SIZE, /* #entries in tape_op_t */
}; };
......
...@@ -788,6 +788,7 @@ tape_3590_done(struct tape_device *device, struct tape_request *request) ...@@ -788,6 +788,7 @@ tape_3590_done(struct tape_device *device, struct tape_request *request)
case TO_SIZE: case TO_SIZE:
case TO_KEKL_SET: case TO_KEKL_SET:
case TO_KEKL_QUERY: case TO_KEKL_QUERY:
case TO_RDC:
break; break;
} }
return TAPE_IO_SUCCESS; return TAPE_IO_SUCCESS;
...@@ -1549,6 +1550,26 @@ tape_3590_irq(struct tape_device *device, struct tape_request *request, ...@@ -1549,6 +1550,26 @@ tape_3590_irq(struct tape_device *device, struct tape_request *request,
return TAPE_IO_STOP; return TAPE_IO_STOP;
} }
static int tape_3590_read_dev_chars(struct tape_device *device,
struct tape_3590_rdc_data *rdc_data)
{
int rc;
struct tape_request *request;
request = tape_alloc_request(1, sizeof(*rdc_data));
if (IS_ERR(request))
return PTR_ERR(request);
request->op = TO_RDC;
tape_ccw_end(request->cpaddr, CCW_CMD_RDC, sizeof(*rdc_data),
request->cpdata);
rc = tape_do_io(device, request);
if (rc == 0)
memcpy(rdc_data, request->cpdata, sizeof(*rdc_data));
tape_free_request(request);
return rc;
}
/* /*
* Setup device function * Setup device function
*/ */
...@@ -1557,7 +1578,7 @@ tape_3590_setup_device(struct tape_device *device) ...@@ -1557,7 +1578,7 @@ tape_3590_setup_device(struct tape_device *device)
{ {
int rc; int rc;
struct tape_3590_disc_data *data; struct tape_3590_disc_data *data;
char *rdc_data; struct tape_3590_rdc_data *rdc_data;
DBF_EVENT(6, "3590 device setup\n"); DBF_EVENT(6, "3590 device setup\n");
data = kzalloc(sizeof(struct tape_3590_disc_data), GFP_KERNEL | GFP_DMA); 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,12 +1587,12 @@ tape_3590_setup_device(struct tape_device *device)
data->read_back_op = READ_PREVIOUS; data->read_back_op = READ_PREVIOUS;
device->discdata = data; device->discdata = data;
rdc_data = kmalloc(64, GFP_KERNEL | GFP_DMA); rdc_data = kmalloc(sizeof(*rdc_data), GFP_KERNEL | GFP_DMA);
if (!rdc_data) { if (!rdc_data) {
rc = -ENOMEM; rc = -ENOMEM;
goto fail_kmalloc; goto fail_kmalloc;
} }
rc = read_dev_chars(device->cdev, (void**)&rdc_data, 64); rc = tape_3590_read_dev_chars(device, rdc_data);
if (rc) { if (rc) {
DBF_LH(3, "Read device characteristics failed!\n"); DBF_LH(3, "Read device characteristics failed!\n");
goto fail_kmalloc; goto fail_kmalloc;
...@@ -1579,7 +1600,7 @@ tape_3590_setup_device(struct tape_device *device) ...@@ -1579,7 +1600,7 @@ tape_3590_setup_device(struct tape_device *device)
rc = tape_std_assign(device); rc = tape_std_assign(device);
if (rc) if (rc)
goto fail_rdc_data; goto fail_rdc_data;
if (rdc_data[31] == 0x13) { if (rdc_data->data[31] == 0x13) {
PRINT_INFO("Device has crypto support\n"); PRINT_INFO("Device has crypto support\n");
data->crypt_info.capability |= TAPE390_CRYPT_SUPPORTED_MASK; data->crypt_info.capability |= TAPE390_CRYPT_SUPPORTED_MASK;
tape_3592_disable_crypt(device); tape_3592_disable_crypt(device);
......
...@@ -129,6 +129,10 @@ struct tape_3590_med_sense { ...@@ -129,6 +129,10 @@ struct tape_3590_med_sense {
char pad2[116]; char pad2[116];
} __attribute__ ((packed)); } __attribute__ ((packed));
struct tape_3590_rdc_data {
char data[64];
} __attribute__ ((packed));
/* Datastructures for 3592 encryption support */ /* Datastructures for 3592 encryption support */
struct tape3592_kekl { struct tape3592_kekl {
......
...@@ -73,7 +73,7 @@ const char *tape_op_verbose[TO_SIZE] = ...@@ -73,7 +73,7 @@ const char *tape_op_verbose[TO_SIZE] =
[TO_DIS] = "DIS", [TO_ASSIGN] = "ASS", [TO_DIS] = "DIS", [TO_ASSIGN] = "ASS",
[TO_UNASSIGN] = "UAS", [TO_CRYPT_ON] = "CON", [TO_UNASSIGN] = "UAS", [TO_CRYPT_ON] = "CON",
[TO_CRYPT_OFF] = "COF", [TO_KEKL_SET] = "KLS", [TO_CRYPT_OFF] = "COF", [TO_KEKL_SET] = "KLS",
[TO_KEKL_QUERY] = "KLQ", [TO_KEKL_QUERY] = "KLQ",[TO_RDC] = "RDC",
}; };
static int static int
...@@ -911,6 +911,7 @@ __tape_start_request(struct tape_device *device, struct tape_request *request) ...@@ -911,6 +911,7 @@ __tape_start_request(struct tape_device *device, struct tape_request *request)
case TO_ASSIGN: case TO_ASSIGN:
case TO_UNASSIGN: case TO_UNASSIGN:
case TO_READ_ATTMSG: case TO_READ_ATTMSG:
case TO_RDC:
if (device->tape_state == TS_INIT) if (device->tape_state == TS_INIT)
break; break;
if (device->tape_state == TS_UNUSED) if (device->tape_state == TS_UNUSED)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment