diff options
author | Ingo Tuchscherer <ingo.tuchscherer@de.ibm.com> | 2015-01-23 08:56:25 -0500 |
---|---|---|
committer | Martin Schwidefsky <schwidefsky@de.ibm.com> | 2015-01-23 09:17:14 -0500 |
commit | bdea1f1bb273383312f0eca56241794b06ed4205 (patch) | |
tree | 174bf6818320b4e3683eb790958571a0d76883a0 /drivers/s390/crypto | |
parent | 5bc334bff9a6e189113140ed6dce0ce61d768943 (diff) |
s390/zcrypt: Add support for new crypto express (CEX5S) adapter.
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>
Diffstat (limited to 'drivers/s390/crypto')
-rw-r--r-- | drivers/s390/crypto/ap_bus.c | 3 | ||||
-rw-r--r-- | drivers/s390/crypto/ap_bus.h | 1 | ||||
-rw-r--r-- | drivers/s390/crypto/zcrypt_api.h | 1 | ||||
-rw-r--r-- | drivers/s390/crypto/zcrypt_cex4.c | 33 |
4 files changed, 29 insertions, 9 deletions
diff --git a/drivers/s390/crypto/ap_bus.c b/drivers/s390/crypto/ap_bus.c index faa058016b5c..a60fc2f9f4b2 100644 --- a/drivers/s390/crypto/ap_bus.c +++ b/drivers/s390/crypto/ap_bus.c | |||
@@ -1489,9 +1489,6 @@ static void ap_scan_bus(struct work_struct *unused) | |||
1489 | continue; | 1489 | continue; |
1490 | } | 1490 | } |
1491 | break; | 1491 | break; |
1492 | case 11: | ||
1493 | ap_dev->device_type = 10; | ||
1494 | break; | ||
1495 | default: | 1492 | default: |
1496 | ap_dev->device_type = device_type; | 1493 | ap_dev->device_type = device_type; |
1497 | } | 1494 | } |
diff --git a/drivers/s390/crypto/ap_bus.h b/drivers/s390/crypto/ap_bus.h index 055a0f956d17..2737d261a324 100644 --- a/drivers/s390/crypto/ap_bus.h +++ b/drivers/s390/crypto/ap_bus.h | |||
@@ -117,6 +117,7 @@ static inline int ap_test_bit(unsigned int *ptr, unsigned int nr) | |||
117 | #define AP_DEVICE_TYPE_CEX3A 8 | 117 | #define AP_DEVICE_TYPE_CEX3A 8 |
118 | #define AP_DEVICE_TYPE_CEX3C 9 | 118 | #define AP_DEVICE_TYPE_CEX3C 9 |
119 | #define AP_DEVICE_TYPE_CEX4 10 | 119 | #define AP_DEVICE_TYPE_CEX4 10 |
120 | #define AP_DEVICE_TYPE_CEX5 11 | ||
120 | 121 | ||
121 | /* | 122 | /* |
122 | * Known function facilities | 123 | * Known function facilities |
diff --git a/drivers/s390/crypto/zcrypt_api.h b/drivers/s390/crypto/zcrypt_api.h index b3d496bfaa7e..750876891931 100644 --- a/drivers/s390/crypto/zcrypt_api.h +++ b/drivers/s390/crypto/zcrypt_api.h | |||
@@ -75,6 +75,7 @@ struct ica_z90_status { | |||
75 | #define ZCRYPT_CEX3C 7 | 75 | #define ZCRYPT_CEX3C 7 |
76 | #define ZCRYPT_CEX3A 8 | 76 | #define ZCRYPT_CEX3A 8 |
77 | #define ZCRYPT_CEX4 10 | 77 | #define ZCRYPT_CEX4 10 |
78 | #define ZCRYPT_CEX5 11 | ||
78 | 79 | ||
79 | /** | 80 | /** |
80 | * Large random numbers are pulled in 4096 byte chunks from the crypto cards | 81 | * Large random numbers are pulled in 4096 byte chunks from the crypto cards |
diff --git a/drivers/s390/crypto/zcrypt_cex4.c b/drivers/s390/crypto/zcrypt_cex4.c index 569f8b1d86c0..71e698b85772 100644 --- a/drivers/s390/crypto/zcrypt_cex4.c +++ b/drivers/s390/crypto/zcrypt_cex4.c | |||
@@ -26,6 +26,10 @@ | |||
26 | 26 | ||
27 | #define CEX4A_SPEED_RATING 900 /* TODO new card, new speed rating */ | 27 | #define CEX4A_SPEED_RATING 900 /* TODO new card, new speed rating */ |
28 | #define CEX4C_SPEED_RATING 6500 /* TODO new card, new speed rating */ | 28 | #define CEX4C_SPEED_RATING 6500 /* TODO new card, new speed rating */ |
29 | #define CEX4P_SPEED_RATING 7000 /* TODO new card, new speed rating */ | ||
30 | #define CEX5A_SPEED_RATING 450 /* TODO new card, new speed rating */ | ||
31 | #define CEX5C_SPEED_RATING 3250 /* TODO new card, new speed rating */ | ||
32 | #define CEX5P_SPEED_RATING 3500 /* TODO new card, new speed rating */ | ||
29 | 33 | ||
30 | #define CEX4A_MAX_MESSAGE_SIZE MSGTYPE50_CRB3_MAX_MSG_SIZE | 34 | #define CEX4A_MAX_MESSAGE_SIZE MSGTYPE50_CRB3_MAX_MSG_SIZE |
31 | #define CEX4C_MAX_MESSAGE_SIZE MSGTYPE06_MAX_MSG_SIZE | 35 | #define CEX4C_MAX_MESSAGE_SIZE MSGTYPE06_MAX_MSG_SIZE |
@@ -39,6 +43,7 @@ | |||
39 | 43 | ||
40 | static struct ap_device_id zcrypt_cex4_ids[] = { | 44 | static struct ap_device_id zcrypt_cex4_ids[] = { |
41 | { AP_DEVICE(AP_DEVICE_TYPE_CEX4) }, | 45 | { AP_DEVICE(AP_DEVICE_TYPE_CEX4) }, |
46 | { AP_DEVICE(AP_DEVICE_TYPE_CEX5) }, | ||
42 | { /* end of list */ }, | 47 | { /* end of list */ }, |
43 | }; | 48 | }; |
44 | 49 | ||
@@ -70,11 +75,18 @@ static int zcrypt_cex4_probe(struct ap_device *ap_dev) | |||
70 | 75 | ||
71 | switch (ap_dev->device_type) { | 76 | switch (ap_dev->device_type) { |
72 | case AP_DEVICE_TYPE_CEX4: | 77 | case AP_DEVICE_TYPE_CEX4: |
78 | case AP_DEVICE_TYPE_CEX5: | ||
73 | if (ap_test_bit(&ap_dev->functions, AP_FUNC_ACCEL)) { | 79 | if (ap_test_bit(&ap_dev->functions, AP_FUNC_ACCEL)) { |
74 | zdev = zcrypt_device_alloc(CEX4A_MAX_MESSAGE_SIZE); | 80 | zdev = zcrypt_device_alloc(CEX4A_MAX_MESSAGE_SIZE); |
75 | if (!zdev) | 81 | if (!zdev) |
76 | return -ENOMEM; | 82 | return -ENOMEM; |
77 | zdev->type_string = "CEX4A"; | 83 | if (ap_dev->device_type == AP_DEVICE_TYPE_CEX4) { |
84 | zdev->type_string = "CEX4A"; | ||
85 | zdev->speed_rating = CEX4A_SPEED_RATING; | ||
86 | } else { | ||
87 | zdev->type_string = "CEX5A"; | ||
88 | zdev->speed_rating = CEX5A_SPEED_RATING; | ||
89 | } | ||
78 | zdev->user_space_type = ZCRYPT_CEX3A; | 90 | zdev->user_space_type = ZCRYPT_CEX3A; |
79 | zdev->min_mod_size = CEX4A_MIN_MOD_SIZE; | 91 | zdev->min_mod_size = CEX4A_MIN_MOD_SIZE; |
80 | if (ap_test_bit(&ap_dev->functions, AP_FUNC_MEX4K) && | 92 | if (ap_test_bit(&ap_dev->functions, AP_FUNC_MEX4K) && |
@@ -90,33 +102,42 @@ static int zcrypt_cex4_probe(struct ap_device *ap_dev) | |||
90 | CEX4A_MAX_MOD_SIZE_2K; | 102 | CEX4A_MAX_MOD_SIZE_2K; |
91 | } | 103 | } |
92 | zdev->short_crt = 1; | 104 | zdev->short_crt = 1; |
93 | zdev->speed_rating = CEX4A_SPEED_RATING; | ||
94 | zdev->ops = zcrypt_msgtype_request(MSGTYPE50_NAME, | 105 | zdev->ops = zcrypt_msgtype_request(MSGTYPE50_NAME, |
95 | MSGTYPE50_VARIANT_DEFAULT); | 106 | MSGTYPE50_VARIANT_DEFAULT); |
96 | } else if (ap_test_bit(&ap_dev->functions, AP_FUNC_COPRO)) { | 107 | } else if (ap_test_bit(&ap_dev->functions, AP_FUNC_COPRO)) { |
97 | zdev = zcrypt_device_alloc(CEX4C_MAX_MESSAGE_SIZE); | 108 | zdev = zcrypt_device_alloc(CEX4C_MAX_MESSAGE_SIZE); |
98 | if (!zdev) | 109 | if (!zdev) |
99 | return -ENOMEM; | 110 | return -ENOMEM; |
100 | zdev->type_string = "CEX4C"; | 111 | if (ap_dev->device_type == AP_DEVICE_TYPE_CEX4) { |
112 | zdev->type_string = "CEX4C"; | ||
113 | zdev->speed_rating = CEX4C_SPEED_RATING; | ||
114 | } else { | ||
115 | zdev->type_string = "CEX5C"; | ||
116 | zdev->speed_rating = CEX5C_SPEED_RATING; | ||
117 | } | ||
101 | zdev->user_space_type = ZCRYPT_CEX3C; | 118 | zdev->user_space_type = ZCRYPT_CEX3C; |
102 | zdev->min_mod_size = CEX4C_MIN_MOD_SIZE; | 119 | zdev->min_mod_size = CEX4C_MIN_MOD_SIZE; |
103 | zdev->max_mod_size = CEX4C_MAX_MOD_SIZE; | 120 | zdev->max_mod_size = CEX4C_MAX_MOD_SIZE; |
104 | zdev->max_exp_bit_length = CEX4C_MAX_MOD_SIZE; | 121 | zdev->max_exp_bit_length = CEX4C_MAX_MOD_SIZE; |
105 | zdev->short_crt = 0; | 122 | zdev->short_crt = 0; |
106 | zdev->speed_rating = CEX4C_SPEED_RATING; | ||
107 | zdev->ops = zcrypt_msgtype_request(MSGTYPE06_NAME, | 123 | zdev->ops = zcrypt_msgtype_request(MSGTYPE06_NAME, |
108 | MSGTYPE06_VARIANT_DEFAULT); | 124 | MSGTYPE06_VARIANT_DEFAULT); |
109 | } else if (ap_test_bit(&ap_dev->functions, AP_FUNC_EP11)) { | 125 | } else if (ap_test_bit(&ap_dev->functions, AP_FUNC_EP11)) { |
110 | zdev = zcrypt_device_alloc(CEX4C_MAX_MESSAGE_SIZE); | 126 | zdev = zcrypt_device_alloc(CEX4C_MAX_MESSAGE_SIZE); |
111 | if (!zdev) | 127 | if (!zdev) |
112 | return -ENOMEM; | 128 | return -ENOMEM; |
113 | zdev->type_string = "CEX4P"; | 129 | if (ap_dev->device_type == AP_DEVICE_TYPE_CEX4) { |
130 | zdev->type_string = "CEX4P"; | ||
131 | zdev->speed_rating = CEX4P_SPEED_RATING; | ||
132 | } else { | ||
133 | zdev->type_string = "CEX5P"; | ||
134 | zdev->speed_rating = CEX5P_SPEED_RATING; | ||
135 | } | ||
114 | zdev->user_space_type = ZCRYPT_CEX4; | 136 | zdev->user_space_type = ZCRYPT_CEX4; |
115 | zdev->min_mod_size = CEX4C_MIN_MOD_SIZE; | 137 | zdev->min_mod_size = CEX4C_MIN_MOD_SIZE; |
116 | zdev->max_mod_size = CEX4C_MAX_MOD_SIZE; | 138 | zdev->max_mod_size = CEX4C_MAX_MOD_SIZE; |
117 | zdev->max_exp_bit_length = CEX4C_MAX_MOD_SIZE; | 139 | zdev->max_exp_bit_length = CEX4C_MAX_MOD_SIZE; |
118 | zdev->short_crt = 0; | 140 | zdev->short_crt = 0; |
119 | zdev->speed_rating = CEX4C_SPEED_RATING; | ||
120 | zdev->ops = zcrypt_msgtype_request(MSGTYPE06_NAME, | 141 | zdev->ops = zcrypt_msgtype_request(MSGTYPE06_NAME, |
121 | MSGTYPE06_VARIANT_EP11); | 142 | MSGTYPE06_VARIANT_EP11); |
122 | } | 143 | } |