+static void print_partition(const void *ptr, const struct partition_header *ph)
+{
+ uint32_t attr = le32_to_cpu(ph->attributes);
+ unsigned long len = le32_to_cpu(ph->len) * 4;
+ const char *part_owner;
+ const char *dest_devs[0x8] = {
+ "none", "PS", "PL", "PMU", "unknown", "unknown", "unknown",
+ "unknown"
+ };
+
+ switch (attr & PART_ATTR_PART_OWNER_MASK) {
+ case PART_ATTR_PART_OWNER_FSBL:
+ part_owner = "FSBL";
+ break;
+ case PART_ATTR_PART_OWNER_UBOOT:
+ part_owner = "U-Boot";
+ break;
+ default:
+ part_owner = "Unknown";
+ break;
+ }
+
+ printf("%s payload on CPU %s (%s):\n", part_owner,
+ dest_cpus[(attr & PART_ATTR_DEST_CPU_MASK) >> 8],
+ dest_devs[(attr & PART_ATTR_DEST_DEVICE_MASK) >> 4]);
+
+ printf(" Offset : 0x%08x\n", le32_to_cpu(ph->offset) * 4);
+ printf(" Size : %lu (0x%lx) bytes\n", len, len);
+ printf(" Load : 0x%08llx",
+ (unsigned long long)le64_to_cpu(ph->load_address));
+ if (ph->load_address != ph->entry_point)
+ printf(" (entry=0x%08llx)\n",
+ (unsigned long long)le64_to_cpu(ph->entry_point));
+ else
+ printf("\n");
+ printf(" Attributes : ");
+
+ if (attr & PART_ATTR_VEC_LOCATION)
+ printf("vec ");
+
+ if (attr & PART_ATTR_ENCRYPTED)
+ printf("encrypted ");
+
+ switch (attr & PART_ATTR_CHECKSUM_MASK) {
+ case PART_ATTR_CHECKSUM_MD5:
+ printf("md5 ");
+ break;
+ case PART_ATTR_CHECKSUM_SHA2:
+ printf("sha2 ");
+ break;
+ case PART_ATTR_CHECKSUM_SHA3:
+ printf("sha3 ");
+ break;
+ }
+
+ if (attr & PART_ATTR_BIG_ENDIAN)
+ printf("BigEndian ");
+
+ if (attr & PART_ATTR_RSA_SIG)
+ printf("RSA ");
+
+ if (attr & PART_ATTR_A53_EXEC_AARCH32)
+ printf("AArch32 ");
+
+ if (attr & PART_ATTR_TARGET_EL_MASK)
+ printf("EL%d ", (attr & PART_ATTR_TARGET_EL_MASK) >> 1);
+
+ if (attr & PART_ATTR_TZ_SECURE)
+ printf("secure ");
+ printf("\n");
+
+ printf(" Checksum : 0x%08x\n", le32_to_cpu(ph->checksum));
+}
+
+void zynqmpimage_print_header(const void *ptr)