[Skiboot] [PATCH 05/12] hw/phb3.c: Adjust offset to run CAPP containers

Claudio Carvalho cclaudio at linux.vnet.ibm.com
Thu Aug 11 16:30:13 AEST 2016


This adjusts the CAPP header offset if CAPP is a secure boot container.

Signed-off-by: Claudio Carvalho <cclaudio at linux.vnet.ibm.com>
---
 hw/phb3.c | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)

diff --git a/hw/phb3.c b/hw/phb3.c
index 0efd636..06f3e5a 100644
--- a/hw/phb3.c
+++ b/hw/phb3.c
@@ -34,6 +34,7 @@
 #include <fsp.h>
 #include <chip.h>
 #include <chiptod.h>
+#include <libstb/container.h>
 
 /* Enable this to disable error interrupts for debug purposes */
 #undef DISABLE_ERR_INTS
@@ -2302,7 +2303,28 @@ static int64_t capp_load_ucode(struct phb3 *p)
 
 	prlog(PR_INFO, "CHIP%i: CAPP ucode lid loaded at %p\n",
 	      p->chip_id, capp_ucode_info.lid);
+
 	lid = capp_ucode_info.lid;
+
+	/* skip secure boot headers */
+	if (stb_is_container(lid))
+		lid = (struct capp_lid_hdr*) ((uint8_t*)lid + SECURE_BOOT_HEADERS_SIZE);
+
+	/*
+	 * CAPP partition header may be present on BMC machines. It will tell
+	 * us what sub-partition should be used
+	 */
+	if (be64_to_cpu(lid->eyecatcher) == 0x4341505000000001) {
+		uint32_t subpart_offset=0, subpart_size=0;
+		flash_subpart_info(lid, CAPP_UCODE_MAX_SIZE,
+				   capp_ucode_info.ec_level,
+				   &subpart_offset, &subpart_size);
+		if (rc)
+			return rc;
+
+		lid = (struct capp_lid_hdr*) ((uint8_t*)lid + subpart_offset);
+	}
+
 	/*
 	 * If lid header is present (on FSP machines), it'll tell us where to
 	 * find the ucode.  Otherwise this is the ucode.
-- 
1.9.1



More information about the Skiboot mailing list