feat(ff-a): add HOB list FF-A boot info descriptor

The HOB structure is provided to the SP as part of the FF-A
Boot info descriptors.

Signed-off-by: Kathleen Capella <kathleen.capella@arm.com>
Signed-off-by: J-Alves <joao.alves@arm.com>
Change-Id: Idd7a302455b76b34c746f7a2b2e71949d9185a80
diff --git a/src/boot_info.c b/src/boot_info.c
index 47ff26a..129d7be 100644
--- a/src/boot_info.c
+++ b/src/boot_info.c
@@ -102,6 +102,7 @@
 		(boot_info_size -
 		 offsetof(struct ffa_boot_info_header, boot_info)) /
 		sizeof(struct ffa_boot_info_desc);
+	bool ret = false;
 
 	assert(boot_info_node != NULL);
 	assert(pkg != NULL);
@@ -127,7 +128,8 @@
 		return false;
 	}
 
-	dlog_verbose("  FF-A Boot Info:\n");
+	dlog_verbose("  FF-A Boot Info: base %lx\n",
+		     (uintptr_t)ptr_from_va(va_from_pa(pkg->boot_info.begin)));
 
 	if (fdt_read_property(boot_info_node, "ffa_manifest", &data) &&
 	    memiter_size(&data) == 0U) {
@@ -135,7 +137,8 @@
 		const uint32_t pm_size =
 			pa_difference(pkg->pm.begin, pkg->pm.end);
 
-		dlog_verbose("    FF-A Manifest\n");
+		dlog_verbose("    FF-A Manifest: %lx\n",
+			     ipa_addr(manifest_address));
 		boot_info_write_desc(boot_info_header,
 				     FFA_BOOT_INFO_FLAG_CONTENT_FORMAT_ADDR,
 				     true, FFA_BOOT_INFO_TYPE_ID_FDT, pm_size,
@@ -148,14 +151,40 @@
 		 */
 		boot_info_header->info_blob_size += pm_size;
 
+		ret = true;
+	}
+
+	if (fdt_read_property(boot_info_node, "hob_list", &data) &&
+	    memiter_size(&data) == 0U) {
+		ipaddr_t hob_address = ipa_from_pa(pkg->hob.begin);
+		const uint32_t hob_size =
+			pa_difference(pkg->hob.begin, pkg->hob.end);
+
+		dlog_verbose("    Hob List: %lx, size: %x\n",
+			     ipa_addr(hob_address), hob_size);
+		boot_info_write_desc(boot_info_header,
+				     FFA_BOOT_INFO_FLAG_CONTENT_FORMAT_ADDR,
+				     true, FFA_BOOT_INFO_TYPE_ID_HOB, hob_size,
+				     ipa_addr(hob_address),
+				     max_boot_info_desc_count);
+
+		/*
+		 * Incrementing the size of the boot information blob with the
+		 * size of the partition's manifest.
+		 */
+		boot_info_header->info_blob_size += hob_size;
+
+		ret = true;
+	}
+
+	if (ret == true) {
 		/*
 		 * Flush the data cache in case partition initializes with
 		 * caches disabled.
 		 */
 		arch_mm_flush_dcache((void *)boot_info_header,
 				     boot_info_header->info_blob_size);
-		return true;
 	}
 
-	return false;
+	return ret;
 }
diff --git a/src/partition_pkg.c b/src/partition_pkg.c
index f0b8ac4..4fb476b 100644
--- a/src/partition_pkg.c
+++ b/src/partition_pkg.c
@@ -67,9 +67,12 @@
 	pkg->hob.begin = pa_init(0);
 	pkg->hob.end = pa_init(0);
 
-	/* Map the whole package as RO. */
-	CHECK(mm_identity_map(stage1_locked, pkg->total.begin, pkg->total.end,
-			      MM_MODE_R, ppool) != NULL);
+	if (ret) {
+		/* Map the whole package as RO. */
+		CHECK(mm_identity_map(stage1_locked, pkg->total.begin,
+				      pkg->total.end, MM_MODE_R,
+				      ppool) != NULL);
+	}
 
 	return ret;
 }