1 // SPDX-License-Identifier: GPL-2.0+ 2 /* 3 * Copyright 2020 NXP 4 */ 5 6 #include <common.h> 7 #include <spl.h> 8 9 char __data_save_start[0] __section(.__data_save_start); 10 char __data_save_end[0] __section(.__data_save_end); 11 12 u32 cold_reboot_flag = 1; 13 spl_save_restore_data(void)14void spl_save_restore_data(void) 15 { 16 u32 data_size = __data_save_end - __data_save_start; 17 18 if (cold_reboot_flag == 1) { 19 /* Save data section to data_save section */ 20 memcpy(__data_save_start, __data_save_start - data_size, 21 data_size); 22 } else { 23 /* Restore the data_save section to data section */ 24 memcpy(__data_save_start - data_size, __data_save_start, 25 data_size); 26 } 27 28 cold_reboot_flag++; 29 } 30