Skip to content

Commit

Permalink
[S390] tape: New read configuration data.
Browse files Browse the repository at this point in the history
Instead of the deprecated read_conf_data(), implement a new function
tape_3590_read_dev_chars().

Signed-off-by: Michael Holzheu <[email protected]>
Signed-off-by: Martin Schwidefsky <[email protected]>
  • Loading branch information
Michael Holzheu authored and Martin Schwidefsky committed May 4, 2007
1 parent 6c82a8a commit e296306
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 5 deletions.
1 change: 1 addition & 0 deletions drivers/s390/char/tape.h
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ enum tape_op {
TO_CRYPT_OFF, /* Disable encrpytion */
TO_KEKL_SET, /* Set KEK label */
TO_KEKL_QUERY, /* Query KEK label */
TO_RDC, /* Read device characteristics */
TO_SIZE, /* #entries in tape_op_t */
};

Expand Down
29 changes: 25 additions & 4 deletions drivers/s390/char/tape_3590.c
Original file line number Diff line number Diff line change
Expand Up @@ -788,6 +788,7 @@ tape_3590_done(struct tape_device *device, struct tape_request *request)
case TO_SIZE:
case TO_KEKL_SET:
case TO_KEKL_QUERY:
case TO_RDC:
break;
}
return TAPE_IO_SUCCESS;
Expand Down Expand Up @@ -1549,6 +1550,26 @@ tape_3590_irq(struct tape_device *device, struct tape_request *request,
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
*/
Expand All @@ -1557,7 +1578,7 @@ tape_3590_setup_device(struct tape_device *device)
{
int rc;
struct tape_3590_disc_data *data;
char *rdc_data;
struct tape_3590_rdc_data *rdc_data;

DBF_EVENT(6, "3590 device setup\n");
data = kzalloc(sizeof(struct tape_3590_disc_data), GFP_KERNEL | GFP_DMA);
Expand All @@ -1566,20 +1587,20 @@ tape_3590_setup_device(struct tape_device *device)
data->read_back_op = READ_PREVIOUS;
device->discdata = data;

rdc_data = kmalloc(64, GFP_KERNEL | GFP_DMA);
rdc_data = kmalloc(sizeof(*rdc_data), GFP_KERNEL | GFP_DMA);
if (!rdc_data) {
rc = -ENOMEM;
goto fail_kmalloc;
}
rc = read_dev_chars(device->cdev, (void**)&rdc_data, 64);
rc = tape_3590_read_dev_chars(device, rdc_data);
if (rc) {
DBF_LH(3, "Read device characteristics failed!\n");
goto fail_kmalloc;
}
rc = tape_std_assign(device);
if (rc)
goto fail_rdc_data;
if (rdc_data[31] == 0x13) {
if (rdc_data->data[31] == 0x13) {
PRINT_INFO("Device has crypto support\n");
data->crypt_info.capability |= TAPE390_CRYPT_SUPPORTED_MASK;
tape_3592_disable_crypt(device);
Expand Down
4 changes: 4 additions & 0 deletions drivers/s390/char/tape_3590.h
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,10 @@ struct tape_3590_med_sense {
char pad2[116];
} __attribute__ ((packed));

struct tape_3590_rdc_data {
char data[64];
} __attribute__ ((packed));

/* Datastructures for 3592 encryption support */

struct tape3592_kekl {
Expand Down
3 changes: 2 additions & 1 deletion drivers/s390/char/tape_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ const char *tape_op_verbose[TO_SIZE] =
[TO_DIS] = "DIS", [TO_ASSIGN] = "ASS",
[TO_UNASSIGN] = "UAS", [TO_CRYPT_ON] = "CON",
[TO_CRYPT_OFF] = "COF", [TO_KEKL_SET] = "KLS",
[TO_KEKL_QUERY] = "KLQ",
[TO_KEKL_QUERY] = "KLQ",[TO_RDC] = "RDC",
};

static int
Expand Down Expand Up @@ -911,6 +911,7 @@ __tape_start_request(struct tape_device *device, struct tape_request *request)
case TO_ASSIGN:
case TO_UNASSIGN:
case TO_READ_ATTMSG:
case TO_RDC:
if (device->tape_state == TS_INIT)
break;
if (device->tape_state == TS_UNUSED)
Expand Down

0 comments on commit e296306

Please sign in to comment.