__u8 pif, __u8 sts, __u64 reftag, __u64 storage_tag)
{
__u32 cdw2 = 0, cdw3 = 0, cdw14;
+ beint64_t be_reftag = cpu_to_be64(reftag);
+ beint64_t be_storage_tag = cpu_to_be64(storage_tag);
switch (pif) {
/* 16b Protection Information */
case 0:
- cdw14 = reftag & 0xffffffff;
- cdw14 |= ((storage_tag << (32 - sts)) & 0xffffffff);
+ cdw14 = be_reftag & 0xffffffff;
+ cdw14 |= ((be_storage_tag << (32 - sts)) & 0xffffffff);
break;
/* 32b Protection Information */
case 1:
- cdw14 = reftag & 0xffffffff;
- cdw3 = reftag >> 32;
- cdw14 |= ((storage_tag << (80 - sts)) & 0xffff0000);
+ cdw14 = be_reftag & 0xffffffff;
+ cdw3 = be_reftag >> 32;
+ cdw14 |= ((be_storage_tag << (80 - sts)) & 0xffff0000);
if (sts >= 48)
- cdw3 |= ((storage_tag >> (sts - 48)) & 0xffffffff);
+ cdw3 |= ((be_storage_tag >> (sts - 48)) & 0xffffffff);
else
- cdw3 |= ((storage_tag << (48 - sts)) & 0xffffffff);
- cdw2 = (storage_tag >> (sts - 16)) & 0xffff;
+ cdw3 |= ((be_storage_tag << (48 - sts)) & 0xffffffff);
+ cdw2 = (be_storage_tag >> (sts - 16)) & 0xffff;
break;
/* 64b Protection Information */
case 2:
- cdw14 = reftag & 0xffffffff;
- cdw3 = (reftag >> 32) & 0xffff;
- cdw14 |= ((storage_tag << (48 - sts)) & 0xffffffff);
+ cdw14 = be_reftag & 0xffffffff;
+ cdw3 = (be_reftag >> 32) & 0xffff;
+ cdw14 |= ((be_storage_tag << (48 - sts)) & 0xffffffff);
if (sts >= 16)
- cdw3 |= ((storage_tag >> (sts - 16)) & 0xffff);
+ cdw3 |= ((be_storage_tag >> (sts - 16)) & 0xffff);
else
- cdw3 |= ((storage_tag << (16 - sts)) & 0xffff);
+ cdw3 |= ((be_storage_tag << (16 - sts)) & 0xffff);
break;
default:
perror("Unsupported Protection Information Format");