/* This function is called from the AP bus code after a crypto request "msg" has finished with the reply message "reply". It is called from tasklet context. @ap_dev: pointer to the AP device @msg: pointer to the AP message @reply: pointer to the AP reply message  */
static void zcrypt_pcicc_receive(struct ap_device *, struct ap_message *, struct ap_message *)
/* This function is called from the AP bus code after a crypto request "msg" has finished with the reply message "reply". It is called from tasklet context. @ap_dev: pointer to the AP device @msg: pointer to the AP message @reply: pointer to the AP reply message  */
static void zcrypt_pcicc_receive(struct ap_device *, struct ap_message *, struct ap_message *)
{
	static struct error_hdr error_reply = {
		.type = TYPE82_RSP_CODE,
		.reply_code = REP82_ERROR_MACHINE_FAILURE,
	};
	struct type86_reply *t86r;
	int length;
	if (IS_ERR(reply)) {
		memcpy(msg->message, &error_reply, sizeof(error_reply));
		goto out;
	}
	t86r = reply->message;
	if (t86r->hdr.type == TYPE86_RSP_CODE &&
		 t86r->cprb.cprb_ver_id == 0x01) {
		length = sizeof(struct type86_reply) + t86r->length - 2;
		length = min(PCICC_MAX_RESPONSE_SIZE, length);
		memcpy(msg->message, reply->message, length);
	} else
		memcpy(msg->message, reply->message, sizeof error_reply);
out:
	complete((struct completion *) msg->private);
}