Before moving the lifecycle to OEM closed, confirm the lifecycle is
OEM open, otherwise cancel to move forward the lifecycle.
Signed-off-by: Ye Li <ye.li@nxp.com>
Reviewed-by: Peng Fan <peng.fan@nxp.com>
{
int err;
u32 resp;
+ u32 lc;
if (!confirm_close())
return -EACCES;
+ lc = readl(FSB_BASE_ADDR + 0x41c);
+ lc &= 0x3ff;
+
+ if (lc != 0x8) {
+ puts("Current lifecycle is NOT OEM open, can't move to OEM closed\n");
+ display_life_cycle(lc);
+ return -EPERM;
+ }
+
err = ahab_forward_lifecycle(8, &resp);
if (err != 0) {
printf("Error in forward lifecycle to OEM closed\n");