mirror of
https://github.com/adulau/aha.git
synced 2024-12-27 19:26:25 +00:00
[S390] Cleanup zcrypt printk messages.
Signed-off-by: Felix Beck <felix.beck@de.ibm.com> Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com> Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
This commit is contained in:
parent
26348f78e8
commit
1a89dd8f0b
7 changed files with 17 additions and 130 deletions
|
@ -1068,10 +1068,8 @@ static int zcrypt_status_write(struct file *file, const char __user *buffer,
|
|||
|
||||
#define LBUFSIZE 1200UL
|
||||
lbuf = kmalloc(LBUFSIZE, GFP_KERNEL);
|
||||
if (!lbuf) {
|
||||
PRINTK("kmalloc failed!\n");
|
||||
if (!lbuf)
|
||||
return 0;
|
||||
}
|
||||
|
||||
local_count = min(LBUFSIZE - 1, count);
|
||||
if (copy_from_user(lbuf, buffer, local_count) != 0) {
|
||||
|
@ -1081,23 +1079,15 @@ static int zcrypt_status_write(struct file *file, const char __user *buffer,
|
|||
lbuf[local_count] = '\0';
|
||||
|
||||
ptr = strstr(lbuf, "Online devices");
|
||||
if (!ptr) {
|
||||
PRINTK("Unable to parse data (missing \"Online devices\")\n");
|
||||
if (!ptr)
|
||||
goto out;
|
||||
}
|
||||
ptr = strstr(ptr, "\n");
|
||||
if (!ptr) {
|
||||
PRINTK("Unable to parse data (missing newline "
|
||||
"after \"Online devices\")\n");
|
||||
if (!ptr)
|
||||
goto out;
|
||||
}
|
||||
ptr++;
|
||||
|
||||
if (strstr(ptr, "Waiting work element counts") == NULL) {
|
||||
PRINTK("Unable to parse data (missing "
|
||||
"\"Waiting work element counts\")\n");
|
||||
if (strstr(ptr, "Waiting work element counts") == NULL)
|
||||
goto out;
|
||||
}
|
||||
|
||||
for (j = 0; j < 64 && *ptr; ptr++) {
|
||||
/*
|
||||
|
@ -1197,16 +1187,12 @@ int __init zcrypt_api_init(void)
|
|||
|
||||
/* Register the request sprayer. */
|
||||
rc = misc_register(&zcrypt_misc_device);
|
||||
if (rc < 0) {
|
||||
PRINTKW(KERN_ERR "misc_register (minor %d) failed with %d\n",
|
||||
zcrypt_misc_device.minor, rc);
|
||||
if (rc < 0)
|
||||
goto out;
|
||||
}
|
||||
|
||||
/* Set up the proc file system */
|
||||
zcrypt_entry = create_proc_entry("driver/z90crypt", 0644, NULL);
|
||||
if (!zcrypt_entry) {
|
||||
PRINTK("Couldn't create z90crypt proc entry\n");
|
||||
rc = -ENOMEM;
|
||||
goto out_misc;
|
||||
}
|
||||
|
|
|
@ -30,34 +30,6 @@
|
|||
#ifndef _ZCRYPT_API_H_
|
||||
#define _ZCRYPT_API_H_
|
||||
|
||||
/**
|
||||
* Macro definitions
|
||||
*
|
||||
* PDEBUG debugs in the form "zcrypt: function_name -> message"
|
||||
*
|
||||
* PRINTK is like PDEBUG, except that it is always enabled
|
||||
* PRINTKN is like PRINTK, except that it does not include the function name
|
||||
* PRINTKW is like PRINTK, except that it uses KERN_WARNING
|
||||
* PRINTKC is like PRINTK, except that it uses KERN_CRIT
|
||||
*/
|
||||
#define DEV_NAME "zcrypt"
|
||||
|
||||
#define PRINTK(fmt, args...) \
|
||||
printk(KERN_DEBUG DEV_NAME ": %s -> " fmt, __func__ , ## args)
|
||||
#define PRINTKN(fmt, args...) \
|
||||
printk(KERN_DEBUG DEV_NAME ": " fmt, ## args)
|
||||
#define PRINTKW(fmt, args...) \
|
||||
printk(KERN_WARNING DEV_NAME ": %s -> " fmt, __func__ , ## args)
|
||||
#define PRINTKC(fmt, args...) \
|
||||
printk(KERN_CRIT DEV_NAME ": %s -> " fmt, __func__ , ## args)
|
||||
|
||||
#ifdef ZCRYPT_DEBUG
|
||||
#define PDEBUG(fmt, args...) \
|
||||
printk(KERN_DEBUG DEV_NAME ": %s -> " fmt, __func__ , ## args)
|
||||
#else
|
||||
#define PDEBUG(fmt, args...) do {} while (0)
|
||||
#endif
|
||||
|
||||
#include "ap_bus.h"
|
||||
#include <asm/zcrypt.h>
|
||||
|
||||
|
|
|
@ -243,9 +243,6 @@ static int convert_response(struct zcrypt_device *zdev,
|
|||
return convert_type80(zdev, reply,
|
||||
outputdata, outputdatalength);
|
||||
default: /* Unknown response type, this should NEVER EVER happen */
|
||||
PRINTK("Unrecognized Message Header: %08x%08x\n",
|
||||
*(unsigned int *) reply->message,
|
||||
*(unsigned int *) (reply->message+4));
|
||||
zdev->online = 0;
|
||||
return -EAGAIN; /* repeat the request on a different device. */
|
||||
}
|
||||
|
|
|
@ -92,10 +92,6 @@ static inline int convert_error(struct zcrypt_device *zdev,
|
|||
{
|
||||
struct error_hdr *ehdr = reply->message;
|
||||
|
||||
PRINTK("Hardware error : Type %02x Message Header: %08x%08x\n",
|
||||
ehdr->type, *(unsigned int *) reply->message,
|
||||
*(unsigned int *) (reply->message + 4));
|
||||
|
||||
switch (ehdr->reply_code) {
|
||||
case REP82_ERROR_OPERAND_INVALID:
|
||||
case REP82_ERROR_OPERAND_SIZE:
|
||||
|
@ -123,8 +119,6 @@ static inline int convert_error(struct zcrypt_device *zdev,
|
|||
zdev->online = 0;
|
||||
return -EAGAIN;
|
||||
default:
|
||||
PRINTKW("unknown type %02x reply code = %d\n",
|
||||
ehdr->type, ehdr->reply_code);
|
||||
zdev->online = 0;
|
||||
return -EAGAIN; /* repeat the request on a different device. */
|
||||
}
|
||||
|
|
|
@ -226,9 +226,6 @@ static int convert_response(struct zcrypt_device *zdev,
|
|||
return convert_type84(zdev, reply,
|
||||
outputdata, outputdatalength);
|
||||
default: /* Unknown response type, this should NEVER EVER happen */
|
||||
PRINTK("Unrecognized Message Header: %08x%08x\n",
|
||||
*(unsigned int *) reply->message,
|
||||
*(unsigned int *) (reply->message+4));
|
||||
zdev->online = 0;
|
||||
return -EAGAIN; /* repeat the request on a different device. */
|
||||
}
|
||||
|
|
|
@ -361,26 +361,18 @@ static int convert_type86(struct zcrypt_device *zdev,
|
|||
service_rc = le16_to_cpu(msg->cprb.ccp_rtcode);
|
||||
if (unlikely(service_rc != 0)) {
|
||||
service_rs = le16_to_cpu(msg->cprb.ccp_rscode);
|
||||
if (service_rc == 8 && service_rs == 66) {
|
||||
PDEBUG("Bad block format on PCICC\n");
|
||||
if (service_rc == 8 && service_rs == 66)
|
||||
return -EINVAL;
|
||||
}
|
||||
if (service_rc == 8 && service_rs == 65) {
|
||||
PDEBUG("Probably an even modulus on PCICC\n");
|
||||
if (service_rc == 8 && service_rs == 65)
|
||||
return -EINVAL;
|
||||
}
|
||||
if (service_rc == 8 && service_rs == 770) {
|
||||
PDEBUG("Invalid key length on PCICC\n");
|
||||
zdev->max_mod_size = PCICC_MAX_MOD_SIZE_OLD;
|
||||
return -EAGAIN;
|
||||
}
|
||||
if (service_rc == 8 && service_rs == 783) {
|
||||
PDEBUG("Extended bitlengths not enabled on PCICC\n");
|
||||
zdev->max_mod_size = PCICC_MAX_MOD_SIZE_OLD;
|
||||
return -EAGAIN;
|
||||
}
|
||||
PRINTK("Unknown service rc/rs (PCICC): %d/%d\n",
|
||||
service_rc, service_rs);
|
||||
zdev->online = 0;
|
||||
return -EAGAIN; /* repeat the request on a different device. */
|
||||
}
|
||||
|
@ -434,9 +426,6 @@ static int convert_response(struct zcrypt_device *zdev,
|
|||
outputdata, outputdatalength);
|
||||
/* no break, incorrect cprb version is an unknown response */
|
||||
default: /* Unknown response type, this should NEVER EVER happen */
|
||||
PRINTK("Unrecognized Message Header: %08x%08x\n",
|
||||
*(unsigned int *) reply->message,
|
||||
*(unsigned int *) (reply->message+4));
|
||||
zdev->online = 0;
|
||||
return -EAGAIN; /* repeat the request on a different device. */
|
||||
}
|
||||
|
|
|
@ -290,38 +290,19 @@ static int XCRB_msg_to_type6CPRB_msgX(struct zcrypt_device *zdev,
|
|||
ap_msg->length = sizeof(struct type6_hdr) +
|
||||
CEIL4(xcRB->request_control_blk_length) +
|
||||
xcRB->request_data_length;
|
||||
if (ap_msg->length > PCIXCC_MAX_XCRB_MESSAGE_SIZE) {
|
||||
PRINTK("Combined message is too large (%ld/%d/%d).\n",
|
||||
sizeof(struct type6_hdr),
|
||||
xcRB->request_control_blk_length,
|
||||
xcRB->request_data_length);
|
||||
if (ap_msg->length > PCIXCC_MAX_XCRB_MESSAGE_SIZE)
|
||||
return -EFAULT;
|
||||
}
|
||||
if (CEIL4(xcRB->reply_control_blk_length) >
|
||||
PCIXCC_MAX_XCRB_REPLY_SIZE) {
|
||||
PDEBUG("Reply CPRB length is too large (%d).\n",
|
||||
xcRB->request_control_blk_length);
|
||||
if (CEIL4(xcRB->reply_control_blk_length) > PCIXCC_MAX_XCRB_REPLY_SIZE)
|
||||
return -EFAULT;
|
||||
}
|
||||
if (CEIL4(xcRB->reply_data_length) > PCIXCC_MAX_XCRB_DATA_SIZE) {
|
||||
PDEBUG("Reply data block length is too large (%d).\n",
|
||||
xcRB->reply_data_length);
|
||||
if (CEIL4(xcRB->reply_data_length) > PCIXCC_MAX_XCRB_DATA_SIZE)
|
||||
return -EFAULT;
|
||||
}
|
||||
replylen = CEIL4(xcRB->reply_control_blk_length) +
|
||||
CEIL4(xcRB->reply_data_length) +
|
||||
sizeof(struct type86_fmt2_msg);
|
||||
if (replylen > PCIXCC_MAX_XCRB_RESPONSE_SIZE) {
|
||||
PDEBUG("Reply CPRB + data block > PCIXCC_MAX_XCRB_RESPONSE_SIZE"
|
||||
" (%d/%d/%d).\n",
|
||||
sizeof(struct type86_fmt2_msg),
|
||||
xcRB->reply_control_blk_length,
|
||||
xcRB->reply_data_length);
|
||||
xcRB->reply_control_blk_length = PCIXCC_MAX_XCRB_RESPONSE_SIZE -
|
||||
(sizeof(struct type86_fmt2_msg) +
|
||||
CEIL4(xcRB->reply_data_length));
|
||||
PDEBUG("Capping Reply CPRB length at %d\n",
|
||||
xcRB->reply_control_blk_length);
|
||||
}
|
||||
|
||||
/* prepare type6 header */
|
||||
|
@ -340,11 +321,8 @@ static int XCRB_msg_to_type6CPRB_msgX(struct zcrypt_device *zdev,
|
|||
xcRB->request_control_blk_length))
|
||||
return -EFAULT;
|
||||
if (msg->cprbx.cprb_len + sizeof(msg->hdr.function_code) >
|
||||
xcRB->request_control_blk_length) {
|
||||
PDEBUG("cprb_len too large (%d/%d)\n", msg->cprbx.cprb_len,
|
||||
xcRB->request_control_blk_length);
|
||||
xcRB->request_control_blk_length)
|
||||
return -EFAULT;
|
||||
}
|
||||
function_code = ((unsigned char *)&msg->cprbx) + msg->cprbx.cprb_len;
|
||||
memcpy(msg->hdr.function_code, function_code, sizeof(msg->hdr.function_code));
|
||||
|
||||
|
@ -472,29 +450,18 @@ static int convert_type86_ica(struct zcrypt_device *zdev,
|
|||
service_rc = msg->cprbx.ccp_rtcode;
|
||||
if (unlikely(service_rc != 0)) {
|
||||
service_rs = msg->cprbx.ccp_rscode;
|
||||
if (service_rc == 8 && service_rs == 66) {
|
||||
PDEBUG("Bad block format on PCIXCC/CEX2C\n");
|
||||
if (service_rc == 8 && service_rs == 66)
|
||||
return -EINVAL;
|
||||
}
|
||||
if (service_rc == 8 && service_rs == 65) {
|
||||
PDEBUG("Probably an even modulus on PCIXCC/CEX2C\n");
|
||||
if (service_rc == 8 && service_rs == 65)
|
||||
return -EINVAL;
|
||||
}
|
||||
if (service_rc == 8 && service_rs == 770) {
|
||||
PDEBUG("Invalid key length on PCIXCC/CEX2C\n");
|
||||
if (service_rc == 8 && service_rs == 770)
|
||||
return -EINVAL;
|
||||
}
|
||||
if (service_rc == 8 && service_rs == 783) {
|
||||
PDEBUG("Extended bitlengths not enabled on PCIXCC/CEX2C\n");
|
||||
zdev->min_mod_size = PCIXCC_MIN_MOD_SIZE_OLD;
|
||||
return -EAGAIN;
|
||||
}
|
||||
if (service_rc == 12 && service_rs == 769) {
|
||||
PDEBUG("Invalid key on PCIXCC/CEX2C\n");
|
||||
if (service_rc == 12 && service_rs == 769)
|
||||
return -EINVAL;
|
||||
}
|
||||
PRINTK("Unknown service rc/rs (PCIXCC/CEX2C): %d/%d\n",
|
||||
service_rc, service_rs);
|
||||
zdev->online = 0;
|
||||
return -EAGAIN; /* repeat the request on a different device. */
|
||||
}
|
||||
|
@ -570,11 +537,8 @@ static int convert_type86_rng(struct zcrypt_device *zdev,
|
|||
} __attribute__((packed)) *msg = reply->message;
|
||||
char *data = reply->message;
|
||||
|
||||
if (msg->cprbx.ccp_rtcode != 0 || msg->cprbx.ccp_rscode != 0) {
|
||||
PDEBUG("RNG response error on PCIXCC/CEX2C rc=%hu/rs=%hu\n",
|
||||
rc, rs);
|
||||
if (msg->cprbx.ccp_rtcode != 0 || msg->cprbx.ccp_rscode != 0)
|
||||
return -EINVAL;
|
||||
}
|
||||
memcpy(buffer, data + msg->fmt2.offset2, msg->fmt2.count2);
|
||||
return msg->fmt2.count2;
|
||||
}
|
||||
|
@ -599,9 +563,6 @@ static int convert_response_ica(struct zcrypt_device *zdev,
|
|||
outputdata, outputdatalength);
|
||||
/* no break, incorrect cprb version is an unknown response */
|
||||
default: /* Unknown response type, this should NEVER EVER happen */
|
||||
PRINTK("Unrecognized Message Header: %08x%08x\n",
|
||||
*(unsigned int *) reply->message,
|
||||
*(unsigned int *) (reply->message+4));
|
||||
zdev->online = 0;
|
||||
return -EAGAIN; /* repeat the request on a different device. */
|
||||
}
|
||||
|
@ -628,9 +589,6 @@ static int convert_response_xcrb(struct zcrypt_device *zdev,
|
|||
return convert_type86_xcrb(zdev, reply, xcRB);
|
||||
/* no break, incorrect cprb version is an unknown response */
|
||||
default: /* Unknown response type, this should NEVER EVER happen */
|
||||
PRINTK("Unrecognized Message Header: %08x%08x\n",
|
||||
*(unsigned int *) reply->message,
|
||||
*(unsigned int *) (reply->message+4));
|
||||
xcRB->status = 0x0008044DL; /* HDD_InvalidParm */
|
||||
zdev->online = 0;
|
||||
return -EAGAIN; /* repeat the request on a different device. */
|
||||
|
@ -654,9 +612,6 @@ static int convert_response_rng(struct zcrypt_device *zdev,
|
|||
return convert_type86_rng(zdev, reply, data);
|
||||
/* no break, incorrect cprb version is an unknown response */
|
||||
default: /* Unknown response type, this should NEVER EVER happen */
|
||||
PRINTK("Unrecognized Message Header: %08x%08x\n",
|
||||
*(unsigned int *) reply->message,
|
||||
*(unsigned int *) (reply->message+4));
|
||||
zdev->online = 0;
|
||||
return -EAGAIN; /* repeat the request on a different device. */
|
||||
}
|
||||
|
@ -701,10 +656,7 @@ static void zcrypt_pcixcc_receive(struct ap_device *ap_dev,
|
|||
memcpy(msg->message, reply->message, length);
|
||||
break;
|
||||
default:
|
||||
PRINTK("Invalid internal response type: %i\n",
|
||||
resp_type->type);
|
||||
memcpy(msg->message, &error_reply,
|
||||
sizeof error_reply);
|
||||
memcpy(msg->message, &error_reply, sizeof error_reply);
|
||||
}
|
||||
} else
|
||||
memcpy(msg->message, reply->message, sizeof error_reply);
|
||||
|
|
Loading…
Reference in a new issue