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

	/* Save FPD context */
	PmFpdSaveContext();

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

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

	/* Save TCM data regions */
	for (i = 0U; i < ARRAY_SIZE(pmSystemTcmMemory); i++) {
		if (TCM_SAVE_MEMORY == pmSystemTcmMemory[i].save) {
			u32 reg;
			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;
			}
			(void)memcpy((void*)address, (void*)start, size);
			address += size;
		}
	}
}
/**
 * PmSystemSaveContext() - Save system context before entering Power Off Suspend
 */
Save system context before entering Power Off Suspend
Save system context before entering Power Off Suspend
static void PmSystemSaveContext(void)
{
	u32 i, start, size;
	u32 address = DDR_STORE_BASE;
	PmFpdSaveContext();
	for (i = 0U; i < ARRAY_SIZE(pmSystemRegs); i++) {
		pmSystemRegs[i].value = XPfw_Read32(pmSystemRegs[i].addr);
	}
	for (i = 0U; i < ARRAY_SIZE(pmSystemMemory); i++) {
		start = pmSystemMemory[i].startAddr;
		size = pmSystemMemory[i].endAddr - start + 1U;
		(void)memcpy((void*)address, (void*)start, size);
		address += size;
		if ((address % 4U) != 0U) {
			address += 4U - (address % 4U);
		}
	}
	for (i = 0U; i < ARRAY_SIZE(pmSystemTcmMemory); i++) {
		if (TCM_SAVE_MEMORY == pmSystemTcmMemory[i].save) {
			u32 reg;
			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;
			}
			(void)memcpy((void*)address, (void*)start, size);
			address += size;
		}
	}
}
static void PmSystemSaveContext ( void ) { u32 i , start , size ; u32 address = DDR_STORE_BASE ; PmFpdSaveContext ( ) ; for ( i = 0U ; i < ARRAY_SIZE ( pmSystemRegs ) ; i ++ ) { pmSystemRegs [ i ] . value = XPfw_Read32 ( pmSystemRegs [ i ] . addr ) ; } for ( i = 0U ; i < ARRAY_SIZE ( pmSystemMemory ) ; i ++ ) { start = pmSystemMemory [ i ] . startAddr ; size = pmSystemMemory [ i ] . endAddr - start + 1U ; ( void ) memcpy ( ( void * ) address , ( void * ) start , size ) ; address += size ; if ( ( address % 4U ) != 0U ) { address += 4U - ( address % 4U ) ; } } for ( i = 0U ; i < ARRAY_SIZE ( pmSystemTcmMemory ) ; i ++ ) { if ( TCM_SAVE_MEMORY == pmSystemTcmMemory [ i ] . save ) { u32 reg ; 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 ; } ( void ) memcpy ( ( void * ) address , ( void * ) start , size ) ; address += size ; } } }
PmSystemSaveContext() - Save system context before entering Power Off Suspend
PmSystemSaveContext () - Save system context before entering Power Off Suspend
/* Save FPD context */ /* Save system registers */ /* Save system data regions */ /* Save TCM data regions */ /* Check TCM configuration */