OSDN Git Service

s390/zcrypt: Add support for new crypto express (CEX5S) adapter.
authorIngo Tuchscherer <ingo.tuchscherer@de.ibm.com>
Fri, 23 Jan 2015 13:56:25 +0000 (14:56 +0100)
committerMartin Schwidefsky <schwidefsky@de.ibm.com>
Fri, 23 Jan 2015 14:17:14 +0000 (15:17 +0100)
Extends the generic cryptographic device driver (zcrypt)
to support the Crypto Express 5S adapter.

Signed-off-by: Ingo Tuchscherer <ingo.tuchscherer@de.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
drivers/s390/crypto/ap_bus.c
drivers/s390/crypto/ap_bus.h
drivers/s390/crypto/zcrypt_api.h
drivers/s390/crypto/zcrypt_cex4.c

index faa0580..a60fc2f 100644 (file)
@@ -1489,9 +1489,6 @@ static void ap_scan_bus(struct work_struct *unused)
                                continue;
                        }
                        break;
-               case 11:
-                       ap_dev->device_type = 10;
-                       break;
                default:
                        ap_dev->device_type = device_type;
                }
index 055a0f9..2737d26 100644 (file)
@@ -117,6 +117,7 @@ static inline int ap_test_bit(unsigned int *ptr, unsigned int nr)
 #define AP_DEVICE_TYPE_CEX3A   8
 #define AP_DEVICE_TYPE_CEX3C   9
 #define AP_DEVICE_TYPE_CEX4    10
+#define AP_DEVICE_TYPE_CEX5    11
 
 /*
  * Known function facilities
index b3d496b..7508768 100644 (file)
@@ -75,6 +75,7 @@ struct ica_z90_status {
 #define ZCRYPT_CEX3C           7
 #define ZCRYPT_CEX3A           8
 #define ZCRYPT_CEX4           10
+#define ZCRYPT_CEX5           11
 
 /**
  * Large random numbers are pulled in 4096 byte chunks from the crypto cards
index 569f8b1..71e698b 100644 (file)
 
 #define CEX4A_SPEED_RATING     900      /* TODO new card, new speed rating */
 #define CEX4C_SPEED_RATING     6500     /* TODO new card, new speed rating */
+#define CEX4P_SPEED_RATING     7000     /* TODO new card, new speed rating */
+#define CEX5A_SPEED_RATING     450      /* TODO new card, new speed rating */
+#define CEX5C_SPEED_RATING     3250     /* TODO new card, new speed rating */
+#define CEX5P_SPEED_RATING     3500     /* TODO new card, new speed rating */
 
 #define CEX4A_MAX_MESSAGE_SIZE MSGTYPE50_CRB3_MAX_MSG_SIZE
 #define CEX4C_MAX_MESSAGE_SIZE MSGTYPE06_MAX_MSG_SIZE
@@ -39,6 +43,7 @@
 
 static struct ap_device_id zcrypt_cex4_ids[] = {
        { AP_DEVICE(AP_DEVICE_TYPE_CEX4)  },
+       { AP_DEVICE(AP_DEVICE_TYPE_CEX5)  },
        { /* end of list */ },
 };
 
@@ -70,11 +75,18 @@ static int zcrypt_cex4_probe(struct ap_device *ap_dev)
 
        switch (ap_dev->device_type) {
        case AP_DEVICE_TYPE_CEX4:
+       case AP_DEVICE_TYPE_CEX5:
                if (ap_test_bit(&ap_dev->functions, AP_FUNC_ACCEL)) {
                        zdev = zcrypt_device_alloc(CEX4A_MAX_MESSAGE_SIZE);
                        if (!zdev)
                                return -ENOMEM;
-                       zdev->type_string = "CEX4A";
+                       if (ap_dev->device_type == AP_DEVICE_TYPE_CEX4) {
+                               zdev->type_string = "CEX4A";
+                               zdev->speed_rating = CEX4A_SPEED_RATING;
+                       } else {
+                               zdev->type_string = "CEX5A";
+                               zdev->speed_rating = CEX5A_SPEED_RATING;
+                       }
                        zdev->user_space_type = ZCRYPT_CEX3A;
                        zdev->min_mod_size = CEX4A_MIN_MOD_SIZE;
                        if (ap_test_bit(&ap_dev->functions, AP_FUNC_MEX4K) &&
@@ -90,33 +102,42 @@ static int zcrypt_cex4_probe(struct ap_device *ap_dev)
                                        CEX4A_MAX_MOD_SIZE_2K;
                        }
                        zdev->short_crt = 1;
-                       zdev->speed_rating = CEX4A_SPEED_RATING;
                        zdev->ops = zcrypt_msgtype_request(MSGTYPE50_NAME,
                                                           MSGTYPE50_VARIANT_DEFAULT);
                } else if (ap_test_bit(&ap_dev->functions, AP_FUNC_COPRO)) {
                        zdev = zcrypt_device_alloc(CEX4C_MAX_MESSAGE_SIZE);
                        if (!zdev)
                                return -ENOMEM;
-                       zdev->type_string = "CEX4C";
+                       if (ap_dev->device_type == AP_DEVICE_TYPE_CEX4) {
+                               zdev->type_string = "CEX4C";
+                               zdev->speed_rating = CEX4C_SPEED_RATING;
+                       } else {
+                               zdev->type_string = "CEX5C";
+                               zdev->speed_rating = CEX5C_SPEED_RATING;
+                       }
                        zdev->user_space_type = ZCRYPT_CEX3C;
                        zdev->min_mod_size = CEX4C_MIN_MOD_SIZE;
                        zdev->max_mod_size = CEX4C_MAX_MOD_SIZE;
                        zdev->max_exp_bit_length = CEX4C_MAX_MOD_SIZE;
                        zdev->short_crt = 0;
-                       zdev->speed_rating = CEX4C_SPEED_RATING;
                        zdev->ops = zcrypt_msgtype_request(MSGTYPE06_NAME,
                                                           MSGTYPE06_VARIANT_DEFAULT);
                } else if (ap_test_bit(&ap_dev->functions, AP_FUNC_EP11)) {
                        zdev = zcrypt_device_alloc(CEX4C_MAX_MESSAGE_SIZE);
                        if (!zdev)
                                return -ENOMEM;
-                       zdev->type_string = "CEX4P";
+                       if (ap_dev->device_type == AP_DEVICE_TYPE_CEX4) {
+                               zdev->type_string = "CEX4P";
+                               zdev->speed_rating = CEX4P_SPEED_RATING;
+                       } else {
+                               zdev->type_string = "CEX5P";
+                               zdev->speed_rating = CEX5P_SPEED_RATING;
+                       }
                        zdev->user_space_type = ZCRYPT_CEX4;
                        zdev->min_mod_size = CEX4C_MIN_MOD_SIZE;
                        zdev->max_mod_size = CEX4C_MAX_MOD_SIZE;
                        zdev->max_exp_bit_length = CEX4C_MAX_MOD_SIZE;
                        zdev->short_crt = 0;
-                       zdev->speed_rating = CEX4C_SPEED_RATING;
                        zdev->ops = zcrypt_msgtype_request(MSGTYPE06_NAME,
                                                        MSGTYPE06_VARIANT_EP11);
                }