/* Waiting time for requests to be processed. * Currently there are some types of request which are not deterministic. * But the maximum time limit managed by the stomper code is set to 60sec. * Hence we have to wait at least that time period.
*/ #define CEX4_CLEANUP_TIME (900 * HZ)
static ssize_t ep11_card_op_modes_show(struct device *dev, struct device_attribute *attr, char *buf)
{ struct ap_card *ac = to_ap_card(dev); struct ep11_card_info ci; int i, n = 0;
memset(&ci, 0, sizeof(ci));
ep11_get_card_info(ac->id, &ci, 0);
for (i = 0; ep11_op_modes[i].mode_txt; i++) { if (ci.op_mode & (1ULL << ep11_op_modes[i].mode_bit)) { if (n > 0)
buf[n++] = ' ';
n += sysfs_emit_at(buf, n, "%s",
ep11_op_modes[i].mode_txt);
}
}
n += sysfs_emit_at(buf, n, "\n");
static ssize_t ep11_queue_op_modes_show(struct device *dev, struct device_attribute *attr, char *buf)
{ struct zcrypt_queue *zq = dev_get_drvdata(dev); int i, n = 0; struct ep11_domain_info di;
memset(&di, 0, sizeof(di));
if (zq->online)
ep11_get_domain_info(AP_QID_CARD(zq->queue->qid),
AP_QID_QUEUE(zq->queue->qid),
&di, 0);
for (i = 0; ep11_op_modes[i].mode_txt; i++) { if (di.op_mode & (1ULL << ep11_op_modes[i].mode_bit)) { if (n > 0)
buf[n++] = ' ';
n += sysfs_emit_at(buf, n, "%s",
ep11_op_modes[i].mode_txt);
}
}
n += sysfs_emit_at(buf, n, "\n");
zc = zcrypt_card_alloc(); if (!zc) return -ENOMEM;
zc->card = ac;
dev_set_drvdata(&ap_dev->device, zc); if (ac->hwinfo.accel) { if (ac->ap_dev.device_type == AP_DEVICE_TYPE_CEX4) {
zc->type_string = "CEX4A";
zc->user_space_type = ZCRYPT_CEX4;
zc->speed_rating = CEX4A_SPEED_IDX;
} elseif (ac->ap_dev.device_type == AP_DEVICE_TYPE_CEX5) {
zc->type_string = "CEX5A";
zc->user_space_type = ZCRYPT_CEX5;
zc->speed_rating = CEX5A_SPEED_IDX;
} elseif (ac->ap_dev.device_type == AP_DEVICE_TYPE_CEX6) {
zc->type_string = "CEX6A";
zc->user_space_type = ZCRYPT_CEX6;
zc->speed_rating = CEX6A_SPEED_IDX;
} elseif (ac->ap_dev.device_type == AP_DEVICE_TYPE_CEX7) {
zc->type_string = "CEX7A";
zc->speed_rating = CEX7A_SPEED_IDX; /* wrong user space type, just for compatibility * with the ZCRYPT_STATUS_MASK ioctl.
*/
zc->user_space_type = ZCRYPT_CEX6;
} else {
zc->type_string = "CEX8A";
zc->speed_rating = CEX8A_SPEED_IDX; /* wrong user space type, just for compatibility * with the ZCRYPT_STATUS_MASK ioctl.
*/
zc->user_space_type = ZCRYPT_CEX6;
}
zc->min_mod_size = CEX4A_MIN_MOD_SIZE; if (ac->hwinfo.mex4k && ac->hwinfo.crt4k) {
zc->max_mod_size = CEX4A_MAX_MOD_SIZE_4K;
zc->max_exp_bit_length =
CEX4A_MAX_MOD_SIZE_4K;
} else {
zc->max_mod_size = CEX4A_MAX_MOD_SIZE_2K;
zc->max_exp_bit_length =
CEX4A_MAX_MOD_SIZE_2K;
}
} elseif (ac->hwinfo.cca) { if (ac->ap_dev.device_type == AP_DEVICE_TYPE_CEX4) {
zc->type_string = "CEX4C";
zc->speed_rating = CEX4C_SPEED_IDX; /* wrong user space type, must be CEX3C * just keep it for cca compatibility
*/
zc->user_space_type = ZCRYPT_CEX3C;
} elseif (ac->ap_dev.device_type == AP_DEVICE_TYPE_CEX5) {
zc->type_string = "CEX5C";
zc->speed_rating = CEX5C_SPEED_IDX; /* wrong user space type, must be CEX3C * just keep it for cca compatibility
*/
zc->user_space_type = ZCRYPT_CEX3C;
} elseif (ac->ap_dev.device_type == AP_DEVICE_TYPE_CEX6) {
zc->type_string = "CEX6C";
zc->speed_rating = CEX6C_SPEED_IDX; /* wrong user space type, must be CEX3C * just keep it for cca compatibility
*/
zc->user_space_type = ZCRYPT_CEX3C;
} elseif (ac->ap_dev.device_type == AP_DEVICE_TYPE_CEX7) {
zc->type_string = "CEX7C";
zc->speed_rating = CEX7C_SPEED_IDX; /* wrong user space type, must be CEX3C * just keep it for cca compatibility
*/
zc->user_space_type = ZCRYPT_CEX3C;
} else {
zc->type_string = "CEX8C";
zc->speed_rating = CEX8C_SPEED_IDX; /* wrong user space type, must be CEX3C * just keep it for cca compatibility
*/
zc->user_space_type = ZCRYPT_CEX3C;
}
zc->min_mod_size = CEX4C_MIN_MOD_SIZE;
zc->max_mod_size = CEX4C_MAX_MOD_SIZE;
zc->max_exp_bit_length = CEX4C_MAX_MOD_SIZE;
} elseif (ac->hwinfo.ep11) { if (ac->ap_dev.device_type == AP_DEVICE_TYPE_CEX4) {
zc->type_string = "CEX4P";
zc->user_space_type = ZCRYPT_CEX4;
zc->speed_rating = CEX4P_SPEED_IDX;
} elseif (ac->ap_dev.device_type == AP_DEVICE_TYPE_CEX5) {
zc->type_string = "CEX5P";
zc->user_space_type = ZCRYPT_CEX5;
zc->speed_rating = CEX5P_SPEED_IDX;
} elseif (ac->ap_dev.device_type == AP_DEVICE_TYPE_CEX6) {
zc->type_string = "CEX6P";
zc->user_space_type = ZCRYPT_CEX6;
zc->speed_rating = CEX6P_SPEED_IDX;
} elseif (ac->ap_dev.device_type == AP_DEVICE_TYPE_CEX7) {
zc->type_string = "CEX7P";
zc->speed_rating = CEX7P_SPEED_IDX; /* wrong user space type, just for compatibility * with the ZCRYPT_STATUS_MASK ioctl.
*/
zc->user_space_type = ZCRYPT_CEX6;
} else {
zc->type_string = "CEX8P";
zc->speed_rating = CEX8P_SPEED_IDX; /* wrong user space type, just for compatibility * with the ZCRYPT_STATUS_MASK ioctl.
*/
zc->user_space_type = ZCRYPT_CEX6;
}
zc->min_mod_size = CEX4C_MIN_MOD_SIZE;
zc->max_mod_size = CEX4C_MAX_MOD_SIZE;
zc->max_exp_bit_length = CEX4C_MAX_MOD_SIZE;
} else {
zcrypt_card_free(zc); return -ENODEV;
}
zc->online = 1;
rc = zcrypt_card_register(zc); if (rc) {
zcrypt_card_free(zc); return rc;
}
if (ac->hwinfo.cca) {
rc = sysfs_create_group(&ap_dev->device.kobj,
&cca_card_attr_grp); if (rc) {
zcrypt_card_unregister(zc);
zcrypt_card_free(zc);
}
} elseif (ac->hwinfo.ep11) {
rc = sysfs_create_group(&ap_dev->device.kobj,
&ep11_card_attr_grp); if (rc) {
zcrypt_card_unregister(zc);
zcrypt_card_free(zc);
}
}
return rc;
}
/* * This is called to remove the CEX[45678] card driver * information if an AP card device is removed.
*/ staticvoid zcrypt_cex4_card_remove(struct ap_device *ap_dev)
{ struct zcrypt_card *zc = dev_get_drvdata(&ap_dev->device); struct ap_card *ac = to_ap_card(&ap_dev->device);
if (ac->hwinfo.cca)
sysfs_remove_group(&ap_dev->device.kobj, &cca_card_attr_grp); elseif (ac->hwinfo.ep11)
sysfs_remove_group(&ap_dev->device.kobj, &ep11_card_attr_grp);
/* * Probe function for CEX[45678] queue device. It always * accepts the AP device since the bus_match already checked * the hardware type. * @ap_dev: pointer to the AP device.
*/ staticint zcrypt_cex4_queue_probe(struct ap_device *ap_dev)
{ struct ap_queue *aq = to_ap_queue(&ap_dev->device); struct zcrypt_queue *zq; int rc;
if (aq->card->hwinfo.cca) {
rc = sysfs_create_group(&ap_dev->device.kobj,
&cca_queue_attr_grp); if (rc) {
zcrypt_queue_unregister(zq);
zcrypt_queue_free(zq);
}
} elseif (aq->card->hwinfo.ep11) {
rc = sysfs_create_group(&ap_dev->device.kobj,
&ep11_queue_attr_grp); if (rc) {
zcrypt_queue_unregister(zq);
zcrypt_queue_free(zq);
}
}
return rc;
}
/* * This is called to remove the CEX[45678] queue driver * information if an AP queue device is removed.
*/ staticvoid zcrypt_cex4_queue_remove(struct ap_device *ap_dev)
{ struct zcrypt_queue *zq = dev_get_drvdata(&ap_dev->device); struct ap_queue *aq = to_ap_queue(&ap_dev->device);
if (aq->card->hwinfo.cca)
sysfs_remove_group(&ap_dev->device.kobj, &cca_queue_attr_grp); elseif (aq->card->hwinfo.ep11)
sysfs_remove_group(&ap_dev->device.kobj, &ep11_queue_attr_grp);
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.