static inline int convert_error(struct zcrypt_queue *zq,
struct ap_message *reply)
{
- struct error_hdr *ehdr = reply->msg;
- int card = AP_QID_CARD(zq->queue->qid);
int queue = AP_QID_QUEUE(zq->queue->qid);
+ int card = AP_QID_CARD(zq->queue->qid);
+ struct error_hdr *ehdr = reply->msg;
+ struct {
+ struct type86_hdr hdr;
+ struct type86_fmt2_ext fmt2;
+ } __packed * t86hdr = reply->msg;
switch (ehdr->reply_code) {
case REP82_ERROR_INVALID_MSG_LEN: /* 0x23 */
/* RY indicates malformed request */
if (ehdr->reply_code == REP82_ERROR_FILTERED_BY_HYPERVISOR &&
ehdr->type == TYPE86_RSP_CODE) {
- struct {
- struct type86_hdr hdr;
- struct type86_fmt2_ext fmt2;
- } __packed * head = reply->msg;
- unsigned int apfs = *((u32 *)head->fmt2.apfs);
-
ZCRYPT_DBF_WARN("%s dev=%02x.%04x RY=0x%02x apfs=0x%x => rc=EINVAL\n",
__func__, card, queue,
- ehdr->reply_code, apfs);
+ ehdr->reply_code, t86hdr->fmt2.apfs);
} else {
ZCRYPT_DBF_WARN("%s dev=%02x.%04x RY=0x%02x => rc=EINVAL\n",
- __func__, card, queue,
- ehdr->reply_code);
+ __func__, card, queue, ehdr->reply_code);
}
return -EINVAL;
case REP82_ERROR_MACHINE_FAILURE: /* 0x10 */
/* For type 86 response show the apfs value (failure reason) */
if (ehdr->reply_code == REP82_ERROR_TRANSPORT_FAIL &&
ehdr->type == TYPE86_RSP_CODE) {
- struct {
- struct type86_hdr hdr;
- struct type86_fmt2_ext fmt2;
- } __packed * head = reply->msg;
- unsigned int apfs = *((u32 *)head->fmt2.apfs);
-
ZCRYPT_DBF_WARN(
"%s dev=%02x.%04x RY=0x%02x apfs=0x%x => bus rescan, rc=EAGAIN\n",
- __func__, card, queue, ehdr->reply_code, apfs);
+ __func__, card, queue, ehdr->reply_code,
+ t86hdr->fmt2.apfs);
} else {
ZCRYPT_DBF_WARN("%s dev=%02x.%04x RY=0x%02x => bus rescan, rc=EAGAIN\n",
__func__, card, queue,
unsigned char right[4]; /* 0x00000000 */
unsigned char reserved3[2]; /* 0x0000 */
unsigned char reserved4[2]; /* 0x0000 */
- unsigned char apfs[4]; /* 0x00000000 */
+ unsigned int apfs; /* 0x00000000 */
unsigned int offset1; /* 0x00000058 (offset to CPRB) */
unsigned int offset2; /* 0x00000000 */
unsigned int offset3; /* 0x00000000 */
struct type86_fmt2_ext {
unsigned char reserved[4]; /* 0x00000000 */
- unsigned char apfs[4]; /* final status */
+ unsigned int apfs; /* final status */
unsigned int count1; /* length of CPRB + parameters */
unsigned int offset1; /* offset to CPRB */
unsigned int count2; /* 0x00000000 */