]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - drivers/s390/crypto/zcrypt_pcixcc.c
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/shaggy...
[linux-2.6-omap-h63xx.git] / drivers / s390 / crypto / zcrypt_pcixcc.c
index 0bc9b3188e64964ab2b98049e8f8ff518f3209b6..d8ad36f8154032ae5fab9e4cd998a2752aded0fb 100644 (file)
@@ -72,6 +72,7 @@ struct response_type {
 static struct ap_device_id zcrypt_pcixcc_ids[] = {
        { AP_DEVICE(AP_DEVICE_TYPE_PCIXCC) },
        { AP_DEVICE(AP_DEVICE_TYPE_CEX2C) },
+       { AP_DEVICE(AP_DEVICE_TYPE_CEX2C2) },
        { /* end of list */ },
 };
 
@@ -289,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 */
@@ -339,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));
 
@@ -471,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. */
        }
@@ -569,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;
 }
@@ -598,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. */
        }
@@ -627,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. */
@@ -653,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. */
        }
@@ -700,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);