lib/sw_apps/zynqmp_pmufw/src/pm_system.c
static void PmSystemRestoreContext(void)
{
	u32 i, start, size;
	u32 address = DDR_STORE_BASE;
	bool haltRpu = false;

	/* Restore system data regions */
	for (i = 0U; i < ARRAY_SIZE(pmSystemMemory); i++) {
		start = pmSystemMemory[i].startAddr;
		size = pmSystemMemory[i].endAddr - start + 1U;
		(void)memcpy((void*)start, (void*)address, size);
		address += size;
		if ((address % 4U) != 0U) {
			address += 4U - (address % 4U);
		}
	}

	/* Restore system registers */
	for (i = 0U; i < ARRAY_SIZE(pmSystemRegs); i++) {
		XPfw_Write32(pmSystemRegs[i].addr, pmSystemRegs[i].value);
	}

	/* Restore FPD context */
	PmFpdRestoreContext();

	/* Restore TCM data regions */
	for (i = 0U; i < ARRAY_SIZE(pmSystemTcmMemory); i++) {
		if (TCM_SAVE_MEMORY == pmSystemTcmMemory[i].save) {
			u32 reg;

			/* Halt RPU cores if TCM restoring is required */
			if (!haltRpu) {
				PmSystemPosHaltRpu();
				haltRpu = true;
			}
			start = pmSystemTcmMemory[i].section.startAddr;
			size = pmSystemTcmMemory[i].section.endAddr - start + 1U;
			/* Check TCM configuration */
			reg = XPfw_Read32(RPU_RPU_GLBL_CNTL);
			reg &= RPU_RPU_GLBL_CNTL_TCM_COMB_MASK;
			if (reg != 0U && start >= TCM_1A_START_ADDR) {
				start -= TCM_BANK_OFFSET;
			}
			memcpy((void*)start, (void*)address, size);
			address += size;
		}
	}
}
/**
 * PmSystemRestoreContext() - Restore system context after resume from Power Off
 * 			      Suspend
 */
Restore system context after resume from Power Off
Suspend
Restore system context after resume from Power Off Suspend
static void PmSystemRestoreContext(void)
{
	u32 i, start, size;
	u32 address = DDR_STORE_BASE;
	bool haltRpu = false;
	for (i = 0U; i < ARRAY_SIZE(pmSystemMemory); i++) {
		start = pmSystemMemory[i].startAddr;
		size = pmSystemMemory[i].endAddr - start + 1U;
		(void)memcpy((void*)start, (void*)address, size);
		address += size;
		if ((address % 4U) != 0U) {
			address += 4U - (address % 4U);
		}
	}
	for (i = 0U; i < ARRAY_SIZE(pmSystemRegs); i++) {
		XPfw_Write32(pmSystemRegs[i].addr, pmSystemRegs[i].value);
	}
	PmFpdRestoreContext();
	for (i = 0U; i < ARRAY_SIZE(pmSystemTcmMemory); i++) {
		if (TCM_SAVE_MEMORY == pmSystemTcmMemory[i].save) {
			u32 reg;
			if (!haltRpu) {
				PmSystemPosHaltRpu();
				haltRpu = true;
			}
			start = pmSystemTcmMemory[i].section.startAddr;
			size = pmSystemTcmMemory[i].section.endAddr - start + 1U;
			reg = XPfw_Read32(RPU_RPU_GLBL_CNTL);
			reg &= RPU_RPU_GLBL_CNTL_TCM_COMB_MASK;
			if (reg != 0U && start >= TCM_1A_START_ADDR) {
				start -= TCM_BANK_OFFSET;
			}
			memcpy((void*)start, (void*)address, size);
			address += size;
		}
	}
}
static void PmSystemRestoreContext ( void ) { u32 i , start , size ; u32 address = DDR_STORE_BASE ; bool haltRpu = false ; for ( i = 0U ; i < ARRAY_SIZE ( pmSystemMemory ) ; i ++ ) { start = pmSystemMemory [ i ] . startAddr ; size = pmSystemMemory [ i ] . endAddr - start + 1U ; ( void ) memcpy ( ( void * ) start , ( void * ) address , size ) ; address += size ; if ( ( address % 4U ) != 0U ) { address += 4U - ( address % 4U ) ; } } for ( i = 0U ; i < ARRAY_SIZE ( pmSystemRegs ) ; i ++ ) { XPfw_Write32 ( pmSystemRegs [ i ] . addr , pmSystemRegs [ i ] . value ) ; } PmFpdRestoreContext ( ) ; for ( i = 0U ; i < ARRAY_SIZE ( pmSystemTcmMemory ) ; i ++ ) { if ( TCM_SAVE_MEMORY == pmSystemTcmMemory [ i ] . save ) { u32 reg ; if ( ! haltRpu ) { PmSystemPosHaltRpu ( ) ; haltRpu = true ; } start = pmSystemTcmMemory [ i ] . section . startAddr ; size = pmSystemTcmMemory [ i ] . section . endAddr - start + 1U ; reg = XPfw_Read32 ( RPU_RPU_GLBL_CNTL ) ; reg &= RPU_RPU_GLBL_CNTL_TCM_COMB_MASK ; if ( reg != 0U && start >= TCM_1A_START_ADDR ) { start -= TCM_BANK_OFFSET ; } memcpy ( ( void * ) start , ( void * ) address , size ) ; address += size ; } } }
PmSystemRestoreContext() - Restore system context after resume from Power Off
                            Suspend
PmSystemRestoreContext () - Restore system context after resume from Power Off Suspend
/* Restore system data regions */ /* Restore system registers */ /* Restore FPD context */ /* Restore TCM data regions */ /* Halt RPU cores if TCM restoring is required */ /* Check TCM configuration */