Martin Schwidefsky | 6684af1 | 2006-09-20 15:58:32 +0200 | [diff] [blame] | 1 | /* |
Ralph Wuerthner | 5432114 | 2006-09-20 15:58:36 +0200 | [diff] [blame] | 2 | * zcrypt 2.1.0 |
Martin Schwidefsky | 6684af1 | 2006-09-20 15:58:32 +0200 | [diff] [blame] | 3 | * |
Holger Dengler | 5e55a48 | 2012-08-28 16:45:36 +0200 | [diff] [blame] | 4 | * Copyright IBM Corp. 2001, 2012 |
Martin Schwidefsky | 6684af1 | 2006-09-20 15:58:32 +0200 | [diff] [blame] | 5 | * Author(s): Robert Burroughs |
| 6 | * Eric Rossman (edrossma@us.ibm.com) |
| 7 | * |
| 8 | * Hotplug & misc device support: Jochen Roehrig (roehrig@de.ibm.com) |
| 9 | * Major cleanup & driver split: Martin Schwidefsky <schwidefsky@de.ibm.com> |
| 10 | * Ralph Wuerthner <rwuerthn@de.ibm.com> |
Holger Dengler | 5e55a48 | 2012-08-28 16:45:36 +0200 | [diff] [blame] | 11 | * MSGTYPE restruct: Holger Dengler <hd@linux.vnet.ibm.com> |
Martin Schwidefsky | 6684af1 | 2006-09-20 15:58:32 +0200 | [diff] [blame] | 12 | * |
| 13 | * This program is free software; you can redistribute it and/or modify |
| 14 | * it under the terms of the GNU General Public License as published by |
| 15 | * the Free Software Foundation; either version 2, or (at your option) |
| 16 | * any later version. |
| 17 | * |
| 18 | * This program is distributed in the hope that it will be useful, |
| 19 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 20 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 21 | * GNU General Public License for more details. |
| 22 | * |
| 23 | * You should have received a copy of the GNU General Public License |
| 24 | * along with this program; if not, write to the Free Software |
| 25 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
| 26 | */ |
| 27 | |
| 28 | #include <linux/module.h> |
| 29 | #include <linux/init.h> |
| 30 | #include <linux/err.h> |
| 31 | #include <linux/delay.h> |
Tejun Heo | 5a0e3ad | 2010-03-24 17:04:11 +0900 | [diff] [blame] | 32 | #include <linux/slab.h> |
Arun Sharma | 60063497 | 2011-07-26 16:09:06 -0700 | [diff] [blame] | 33 | #include <linux/atomic.h> |
Linus Torvalds | 7c0f6ba | 2016-12-24 11:46:01 -0800 | [diff] [blame] | 34 | #include <linux/uaccess.h> |
Ingo Tuchscherer | e28d2af | 2016-08-25 11:16:03 +0200 | [diff] [blame] | 35 | #include <linux/mod_devicetable.h> |
Martin Schwidefsky | 6684af1 | 2006-09-20 15:58:32 +0200 | [diff] [blame] | 36 | |
| 37 | #include "ap_bus.h" |
| 38 | #include "zcrypt_api.h" |
| 39 | #include "zcrypt_error.h" |
Holger Dengler | 5e55a48 | 2012-08-28 16:45:36 +0200 | [diff] [blame] | 40 | #include "zcrypt_msgtype6.h" |
Martin Schwidefsky | 6684af1 | 2006-09-20 15:58:32 +0200 | [diff] [blame] | 41 | #include "zcrypt_pcixcc.h" |
| 42 | #include "zcrypt_cca_key.h" |
| 43 | |
| 44 | #define PCIXCC_MIN_MOD_SIZE 16 /* 128 bits */ |
| 45 | #define PCIXCC_MIN_MOD_SIZE_OLD 64 /* 512 bits */ |
| 46 | #define PCIXCC_MAX_MOD_SIZE 256 /* 2048 bits */ |
Felix Beck | 8e89b6b | 2009-12-07 12:51:57 +0100 | [diff] [blame] | 47 | #define CEX3C_MIN_MOD_SIZE PCIXCC_MIN_MOD_SIZE |
Felix Beck | 2ade1fa | 2011-01-05 12:47:46 +0100 | [diff] [blame] | 48 | #define CEX3C_MAX_MOD_SIZE 512 /* 4096 bits */ |
Martin Schwidefsky | 6684af1 | 2006-09-20 15:58:32 +0200 | [diff] [blame] | 49 | |
Martin Schwidefsky | 6684af1 | 2006-09-20 15:58:32 +0200 | [diff] [blame] | 50 | #define PCIXCC_MAX_ICA_MESSAGE_SIZE 0x77c /* max size type6 v2 crt message */ |
| 51 | #define PCIXCC_MAX_ICA_RESPONSE_SIZE 0x77c /* max size type86 v2 reply */ |
| 52 | |
| 53 | #define PCIXCC_MAX_XCRB_MESSAGE_SIZE (12*1024) |
Martin Schwidefsky | 6684af1 | 2006-09-20 15:58:32 +0200 | [diff] [blame] | 54 | |
| 55 | #define PCIXCC_CLEANUP_TIME (15*HZ) |
| 56 | |
Ralph Wuerthner | 5432114 | 2006-09-20 15:58:36 +0200 | [diff] [blame] | 57 | #define CEIL4(x) ((((x)+3)/4)*4) |
| 58 | |
| 59 | struct response_type { |
| 60 | struct completion work; |
| 61 | int type; |
| 62 | }; |
| 63 | #define PCIXCC_RESPONSE_TYPE_ICA 0 |
| 64 | #define PCIXCC_RESPONSE_TYPE_XCRB 1 |
| 65 | |
Martin Schwidefsky | 6684af1 | 2006-09-20 15:58:32 +0200 | [diff] [blame] | 66 | MODULE_AUTHOR("IBM Corporation"); |
Holger Dengler | 5e55a48 | 2012-08-28 16:45:36 +0200 | [diff] [blame] | 67 | MODULE_DESCRIPTION("PCIXCC Cryptographic Coprocessor device driver, " \ |
| 68 | "Copyright IBM Corp. 2001, 2012"); |
Martin Schwidefsky | 6684af1 | 2006-09-20 15:58:32 +0200 | [diff] [blame] | 69 | MODULE_LICENSE("GPL"); |
Martin Schwidefsky | 6684af1 | 2006-09-20 15:58:32 +0200 | [diff] [blame] | 70 | |
Ingo Tuchscherer | e28d2af | 2016-08-25 11:16:03 +0200 | [diff] [blame] | 71 | static struct ap_device_id zcrypt_pcixcc_card_ids[] = { |
| 72 | { .dev_type = AP_DEVICE_TYPE_PCIXCC, |
| 73 | .match_flags = AP_DEVICE_ID_MATCH_CARD_TYPE }, |
| 74 | { .dev_type = AP_DEVICE_TYPE_CEX2C, |
| 75 | .match_flags = AP_DEVICE_ID_MATCH_CARD_TYPE }, |
| 76 | { .dev_type = AP_DEVICE_TYPE_CEX3C, |
| 77 | .match_flags = AP_DEVICE_ID_MATCH_CARD_TYPE }, |
| 78 | { /* end of list */ }, |
Martin Schwidefsky | 6684af1 | 2006-09-20 15:58:32 +0200 | [diff] [blame] | 79 | }; |
| 80 | |
Ingo Tuchscherer | e28d2af | 2016-08-25 11:16:03 +0200 | [diff] [blame] | 81 | MODULE_DEVICE_TABLE(ap, zcrypt_pcixcc_card_ids); |
Martin Schwidefsky | 6684af1 | 2006-09-20 15:58:32 +0200 | [diff] [blame] | 82 | |
Ingo Tuchscherer | e28d2af | 2016-08-25 11:16:03 +0200 | [diff] [blame] | 83 | static struct ap_device_id zcrypt_pcixcc_queue_ids[] = { |
| 84 | { .dev_type = AP_DEVICE_TYPE_PCIXCC, |
| 85 | .match_flags = AP_DEVICE_ID_MATCH_QUEUE_TYPE }, |
| 86 | { .dev_type = AP_DEVICE_TYPE_CEX2C, |
| 87 | .match_flags = AP_DEVICE_ID_MATCH_QUEUE_TYPE }, |
| 88 | { .dev_type = AP_DEVICE_TYPE_CEX3C, |
| 89 | .match_flags = AP_DEVICE_ID_MATCH_QUEUE_TYPE }, |
| 90 | { /* end of list */ }, |
| 91 | }; |
Martin Schwidefsky | 6684af1 | 2006-09-20 15:58:32 +0200 | [diff] [blame] | 92 | |
Ingo Tuchscherer | e28d2af | 2016-08-25 11:16:03 +0200 | [diff] [blame] | 93 | MODULE_DEVICE_TABLE(ap, zcrypt_pcixcc_queue_ids); |
Martin Schwidefsky | 6684af1 | 2006-09-20 15:58:32 +0200 | [diff] [blame] | 94 | |
| 95 | /** |
Ralph Wuerthner | 2f7c8bd | 2008-04-17 07:46:15 +0200 | [diff] [blame] | 96 | * Large random number detection function. Its sends a message to a pcixcc |
| 97 | * card to find out if large random numbers are supported. |
| 98 | * @ap_dev: pointer to the AP device. |
| 99 | * |
| 100 | * Returns 1 if large random numbers are supported, 0 if not and < 0 on error. |
| 101 | */ |
Ingo Tuchscherer | e28d2af | 2016-08-25 11:16:03 +0200 | [diff] [blame] | 102 | static int zcrypt_pcixcc_rng_supported(struct ap_queue *aq) |
Ralph Wuerthner | 2f7c8bd | 2008-04-17 07:46:15 +0200 | [diff] [blame] | 103 | { |
| 104 | struct ap_message ap_msg; |
| 105 | unsigned long long psmid; |
Ingo Tuchscherer | e28d2af | 2016-08-25 11:16:03 +0200 | [diff] [blame] | 106 | unsigned int domain; |
Ralph Wuerthner | 2f7c8bd | 2008-04-17 07:46:15 +0200 | [diff] [blame] | 107 | struct { |
| 108 | struct type86_hdr hdr; |
| 109 | struct type86_fmt2_ext fmt2; |
| 110 | struct CPRBX cprbx; |
| 111 | } __attribute__((packed)) *reply; |
Ingo Tuchscherer | 34a1516 | 2016-08-25 11:14:15 +0200 | [diff] [blame] | 112 | struct { |
| 113 | struct type6_hdr hdr; |
| 114 | struct CPRBX cprbx; |
| 115 | char function_code[2]; |
| 116 | short int rule_length; |
| 117 | char rule[8]; |
| 118 | short int verb_length; |
| 119 | short int key_length; |
| 120 | } __packed * msg; |
Ralph Wuerthner | 2f7c8bd | 2008-04-17 07:46:15 +0200 | [diff] [blame] | 121 | int rc, i; |
| 122 | |
Felix Beck | 468ffdd | 2009-12-07 12:51:54 +0100 | [diff] [blame] | 123 | ap_init_message(&ap_msg); |
Ralph Wuerthner | 2f7c8bd | 2008-04-17 07:46:15 +0200 | [diff] [blame] | 124 | ap_msg.message = (void *) get_zeroed_page(GFP_KERNEL); |
| 125 | if (!ap_msg.message) |
| 126 | return -ENOMEM; |
| 127 | |
Ingo Tuchscherer | e28d2af | 2016-08-25 11:16:03 +0200 | [diff] [blame] | 128 | rng_type6CPRB_msgX(&ap_msg, 4, &domain); |
Ingo Tuchscherer | 34a1516 | 2016-08-25 11:14:15 +0200 | [diff] [blame] | 129 | |
| 130 | msg = ap_msg.message; |
Ingo Tuchscherer | e28d2af | 2016-08-25 11:16:03 +0200 | [diff] [blame] | 131 | msg->cprbx.domain = AP_QID_QUEUE(aq->qid); |
Ingo Tuchscherer | 34a1516 | 2016-08-25 11:14:15 +0200 | [diff] [blame] | 132 | |
Ingo Tuchscherer | e28d2af | 2016-08-25 11:16:03 +0200 | [diff] [blame] | 133 | rc = ap_send(aq->qid, 0x0102030405060708ULL, ap_msg.message, |
Ralph Wuerthner | 2f7c8bd | 2008-04-17 07:46:15 +0200 | [diff] [blame] | 134 | ap_msg.length); |
| 135 | if (rc) |
| 136 | goto out_free; |
| 137 | |
| 138 | /* Wait for the test message to complete. */ |
| 139 | for (i = 0; i < 2 * HZ; i++) { |
| 140 | msleep(1000 / HZ); |
Ingo Tuchscherer | e28d2af | 2016-08-25 11:16:03 +0200 | [diff] [blame] | 141 | rc = ap_recv(aq->qid, &psmid, ap_msg.message, 4096); |
Ralph Wuerthner | 2f7c8bd | 2008-04-17 07:46:15 +0200 | [diff] [blame] | 142 | if (rc == 0 && psmid == 0x0102030405060708ULL) |
| 143 | break; |
| 144 | } |
| 145 | |
| 146 | if (i >= 2 * HZ) { |
| 147 | /* Got no answer. */ |
| 148 | rc = -ENODEV; |
| 149 | goto out_free; |
| 150 | } |
| 151 | |
| 152 | reply = ap_msg.message; |
| 153 | if (reply->cprbx.ccp_rtcode == 0 && reply->cprbx.ccp_rscode == 0) |
| 154 | rc = 1; |
| 155 | else |
| 156 | rc = 0; |
| 157 | out_free: |
| 158 | free_page((unsigned long) ap_msg.message); |
| 159 | return rc; |
| 160 | } |
| 161 | |
| 162 | /** |
Ingo Tuchscherer | e28d2af | 2016-08-25 11:16:03 +0200 | [diff] [blame] | 163 | * Probe function for PCIXCC/CEX2C card devices. It always accepts the |
| 164 | * AP device since the bus_match already checked the hardware type. The |
| 165 | * PCIXCC cards come in two flavours: micro code level 2 and micro code |
| 166 | * level 3. This is checked by sending a test message to the device. |
| 167 | * @ap_dev: pointer to the AP card device. |
Martin Schwidefsky | 6684af1 | 2006-09-20 15:58:32 +0200 | [diff] [blame] | 168 | */ |
Ingo Tuchscherer | e28d2af | 2016-08-25 11:16:03 +0200 | [diff] [blame] | 169 | static int zcrypt_pcixcc_card_probe(struct ap_device *ap_dev) |
Martin Schwidefsky | 6684af1 | 2006-09-20 15:58:32 +0200 | [diff] [blame] | 170 | { |
Ingo Tuchscherer | 34a1516 | 2016-08-25 11:14:15 +0200 | [diff] [blame] | 171 | /* |
| 172 | * Normalized speed ratings per crypto adapter |
| 173 | * MEX_1k, MEX_2k, MEX_4k, CRT_1k, CRT_2k, CRT_4k, RNG, SECKEY |
| 174 | */ |
Ingo Tuchscherer | e28d2af | 2016-08-25 11:16:03 +0200 | [diff] [blame] | 175 | static const int CEX2C_SPEED_IDX[] = { |
| 176 | 1000, 1400, 2400, 1100, 1500, 2600, 100, 12}; |
| 177 | static const int CEX3C_SPEED_IDX[] = { |
| 178 | 500, 700, 1400, 550, 800, 1500, 80, 10}; |
| 179 | |
| 180 | struct ap_card *ac = to_ap_card(&ap_dev->device); |
| 181 | struct zcrypt_card *zc; |
Felix Beck | 8e89b6b | 2009-12-07 12:51:57 +0100 | [diff] [blame] | 182 | int rc = 0; |
Martin Schwidefsky | 6684af1 | 2006-09-20 15:58:32 +0200 | [diff] [blame] | 183 | |
Ingo Tuchscherer | e28d2af | 2016-08-25 11:16:03 +0200 | [diff] [blame] | 184 | zc = zcrypt_card_alloc(); |
| 185 | if (!zc) |
Martin Schwidefsky | 6684af1 | 2006-09-20 15:58:32 +0200 | [diff] [blame] | 186 | return -ENOMEM; |
Ingo Tuchscherer | e28d2af | 2016-08-25 11:16:03 +0200 | [diff] [blame] | 187 | zc->card = ac; |
| 188 | ac->private = zc; |
| 189 | switch (ac->ap_dev.device_type) { |
Felix Beck | 8e89b6b | 2009-12-07 12:51:57 +0100 | [diff] [blame] | 190 | case AP_DEVICE_TYPE_CEX2C: |
Ingo Tuchscherer | e28d2af | 2016-08-25 11:16:03 +0200 | [diff] [blame] | 191 | zc->user_space_type = ZCRYPT_CEX2C; |
| 192 | zc->type_string = "CEX2C"; |
| 193 | memcpy(zc->speed_rating, CEX2C_SPEED_IDX, |
Ingo Tuchscherer | 34a1516 | 2016-08-25 11:14:15 +0200 | [diff] [blame] | 194 | sizeof(CEX2C_SPEED_IDX)); |
Ingo Tuchscherer | e28d2af | 2016-08-25 11:16:03 +0200 | [diff] [blame] | 195 | zc->min_mod_size = PCIXCC_MIN_MOD_SIZE; |
| 196 | zc->max_mod_size = PCIXCC_MAX_MOD_SIZE; |
| 197 | zc->max_exp_bit_length = PCIXCC_MAX_MOD_SIZE; |
Felix Beck | 8e89b6b | 2009-12-07 12:51:57 +0100 | [diff] [blame] | 198 | break; |
| 199 | case AP_DEVICE_TYPE_CEX3C: |
Ingo Tuchscherer | e28d2af | 2016-08-25 11:16:03 +0200 | [diff] [blame] | 200 | zc->user_space_type = ZCRYPT_CEX3C; |
| 201 | zc->type_string = "CEX3C"; |
| 202 | memcpy(zc->speed_rating, CEX3C_SPEED_IDX, |
Ingo Tuchscherer | 34a1516 | 2016-08-25 11:14:15 +0200 | [diff] [blame] | 203 | sizeof(CEX3C_SPEED_IDX)); |
Ingo Tuchscherer | e28d2af | 2016-08-25 11:16:03 +0200 | [diff] [blame] | 204 | zc->min_mod_size = CEX3C_MIN_MOD_SIZE; |
| 205 | zc->max_mod_size = CEX3C_MAX_MOD_SIZE; |
| 206 | zc->max_exp_bit_length = CEX3C_MAX_MOD_SIZE; |
Felix Beck | 8e89b6b | 2009-12-07 12:51:57 +0100 | [diff] [blame] | 207 | break; |
| 208 | default: |
Ingo Tuchscherer | e28d2af | 2016-08-25 11:16:03 +0200 | [diff] [blame] | 209 | zcrypt_card_free(zc); |
| 210 | return -ENODEV; |
Martin Schwidefsky | 6684af1 | 2006-09-20 15:58:32 +0200 | [diff] [blame] | 211 | } |
Ingo Tuchscherer | e28d2af | 2016-08-25 11:16:03 +0200 | [diff] [blame] | 212 | zc->online = 1; |
Felix Beck | 8e89b6b | 2009-12-07 12:51:57 +0100 | [diff] [blame] | 213 | |
Ingo Tuchscherer | e28d2af | 2016-08-25 11:16:03 +0200 | [diff] [blame] | 214 | rc = zcrypt_card_register(zc); |
| 215 | if (rc) { |
| 216 | ac->private = NULL; |
| 217 | zcrypt_card_free(zc); |
Ralph Wuerthner | 2f7c8bd | 2008-04-17 07:46:15 +0200 | [diff] [blame] | 218 | } |
Martin Schwidefsky | 6684af1 | 2006-09-20 15:58:32 +0200 | [diff] [blame] | 219 | |
Martin Schwidefsky | 6684af1 | 2006-09-20 15:58:32 +0200 | [diff] [blame] | 220 | return rc; |
| 221 | } |
| 222 | |
| 223 | /** |
Ingo Tuchscherer | e28d2af | 2016-08-25 11:16:03 +0200 | [diff] [blame] | 224 | * This is called to remove the PCIXCC/CEX2C card driver information |
| 225 | * if an AP card device is removed. |
Martin Schwidefsky | 6684af1 | 2006-09-20 15:58:32 +0200 | [diff] [blame] | 226 | */ |
Ingo Tuchscherer | e28d2af | 2016-08-25 11:16:03 +0200 | [diff] [blame] | 227 | static void zcrypt_pcixcc_card_remove(struct ap_device *ap_dev) |
Martin Schwidefsky | 6684af1 | 2006-09-20 15:58:32 +0200 | [diff] [blame] | 228 | { |
Ingo Tuchscherer | e28d2af | 2016-08-25 11:16:03 +0200 | [diff] [blame] | 229 | struct zcrypt_card *zc = to_ap_card(&ap_dev->device)->private; |
Martin Schwidefsky | 6684af1 | 2006-09-20 15:58:32 +0200 | [diff] [blame] | 230 | |
Ingo Tuchscherer | e28d2af | 2016-08-25 11:16:03 +0200 | [diff] [blame] | 231 | if (zc) |
| 232 | zcrypt_card_unregister(zc); |
Martin Schwidefsky | 6684af1 | 2006-09-20 15:58:32 +0200 | [diff] [blame] | 233 | } |
| 234 | |
Ingo Tuchscherer | e28d2af | 2016-08-25 11:16:03 +0200 | [diff] [blame] | 235 | static struct ap_driver zcrypt_pcixcc_card_driver = { |
| 236 | .probe = zcrypt_pcixcc_card_probe, |
| 237 | .remove = zcrypt_pcixcc_card_remove, |
| 238 | .ids = zcrypt_pcixcc_card_ids, |
| 239 | }; |
| 240 | |
| 241 | /** |
| 242 | * Probe function for PCIXCC/CEX2C queue devices. It always accepts the |
| 243 | * AP device since the bus_match already checked the hardware type. The |
| 244 | * PCIXCC cards come in two flavours: micro code level 2 and micro code |
| 245 | * level 3. This is checked by sending a test message to the device. |
| 246 | * @ap_dev: pointer to the AP card device. |
| 247 | */ |
| 248 | static int zcrypt_pcixcc_queue_probe(struct ap_device *ap_dev) |
| 249 | { |
| 250 | struct ap_queue *aq = to_ap_queue(&ap_dev->device); |
| 251 | struct zcrypt_queue *zq; |
| 252 | int rc; |
| 253 | |
| 254 | zq = zcrypt_queue_alloc(PCIXCC_MAX_XCRB_MESSAGE_SIZE); |
| 255 | if (!zq) |
| 256 | return -ENOMEM; |
| 257 | zq->queue = aq; |
| 258 | zq->online = 1; |
| 259 | atomic_set(&zq->load, 0); |
| 260 | rc = zcrypt_pcixcc_rng_supported(aq); |
| 261 | if (rc < 0) { |
| 262 | zcrypt_queue_free(zq); |
| 263 | return rc; |
| 264 | } |
| 265 | if (rc) |
| 266 | zq->ops = zcrypt_msgtype(MSGTYPE06_NAME, |
| 267 | MSGTYPE06_VARIANT_DEFAULT); |
| 268 | else |
| 269 | zq->ops = zcrypt_msgtype(MSGTYPE06_NAME, |
| 270 | MSGTYPE06_VARIANT_NORNG); |
| 271 | ap_queue_init_reply(aq, &zq->reply); |
| 272 | aq->request_timeout = PCIXCC_CLEANUP_TIME, |
| 273 | aq->private = zq; |
| 274 | rc = zcrypt_queue_register(zq); |
| 275 | if (rc) { |
| 276 | aq->private = NULL; |
| 277 | zcrypt_queue_free(zq); |
| 278 | } |
| 279 | return rc; |
| 280 | } |
| 281 | |
| 282 | /** |
| 283 | * This is called to remove the PCIXCC/CEX2C queue driver information |
| 284 | * if an AP queue device is removed. |
| 285 | */ |
| 286 | static void zcrypt_pcixcc_queue_remove(struct ap_device *ap_dev) |
| 287 | { |
| 288 | struct ap_queue *aq = to_ap_queue(&ap_dev->device); |
| 289 | struct zcrypt_queue *zq = aq->private; |
| 290 | |
| 291 | ap_queue_remove(aq); |
| 292 | if (zq) |
| 293 | zcrypt_queue_unregister(zq); |
| 294 | } |
| 295 | |
| 296 | static struct ap_driver zcrypt_pcixcc_queue_driver = { |
| 297 | .probe = zcrypt_pcixcc_queue_probe, |
| 298 | .remove = zcrypt_pcixcc_queue_remove, |
| 299 | .suspend = ap_queue_suspend, |
| 300 | .resume = ap_queue_resume, |
| 301 | .ids = zcrypt_pcixcc_queue_ids, |
| 302 | }; |
| 303 | |
Martin Schwidefsky | 6684af1 | 2006-09-20 15:58:32 +0200 | [diff] [blame] | 304 | int __init zcrypt_pcixcc_init(void) |
| 305 | { |
Ingo Tuchscherer | e28d2af | 2016-08-25 11:16:03 +0200 | [diff] [blame] | 306 | int rc; |
| 307 | |
| 308 | rc = ap_driver_register(&zcrypt_pcixcc_card_driver, |
| 309 | THIS_MODULE, "pcixcccard"); |
| 310 | if (rc) |
| 311 | return rc; |
| 312 | |
| 313 | rc = ap_driver_register(&zcrypt_pcixcc_queue_driver, |
| 314 | THIS_MODULE, "pcixccqueue"); |
| 315 | if (rc) |
| 316 | ap_driver_unregister(&zcrypt_pcixcc_card_driver); |
| 317 | |
| 318 | return rc; |
Martin Schwidefsky | 6684af1 | 2006-09-20 15:58:32 +0200 | [diff] [blame] | 319 | } |
| 320 | |
| 321 | void zcrypt_pcixcc_exit(void) |
| 322 | { |
Ingo Tuchscherer | e28d2af | 2016-08-25 11:16:03 +0200 | [diff] [blame] | 323 | ap_driver_unregister(&zcrypt_pcixcc_queue_driver); |
| 324 | ap_driver_unregister(&zcrypt_pcixcc_card_driver); |
Martin Schwidefsky | 6684af1 | 2006-09-20 15:58:32 +0200 | [diff] [blame] | 325 | } |
| 326 | |
Martin Schwidefsky | 6684af1 | 2006-09-20 15:58:32 +0200 | [diff] [blame] | 327 | module_init(zcrypt_pcixcc_init); |
| 328 | module_exit(zcrypt_pcixcc_exit); |