xref: /rk3399_rockchip-uboot/lib/asm-offsets.c (revision f1896c45cb2f7d8dbed27e784a6459a129fc0762)
116a354f9SWolfgang Denk /*
216a354f9SWolfgang Denk  * Adapted from Linux v2.6.36 kernel: arch/powerpc/kernel/asm-offsets.c
316a354f9SWolfgang Denk  *
416a354f9SWolfgang Denk  * This program is used to generate definitions needed by
516a354f9SWolfgang Denk  * assembly language modules.
616a354f9SWolfgang Denk  *
716a354f9SWolfgang Denk  * We use the technique used in the OSF Mach kernel code:
816a354f9SWolfgang Denk  * generate asm statements containing #defines,
916a354f9SWolfgang Denk  * compile this file to assembler, and then extract the
1016a354f9SWolfgang Denk  * #defines from the assembly-language output.
1116a354f9SWolfgang Denk  *
121a459660SWolfgang Denk  * SPDX-License-Identifier:	GPL-2.0+
1316a354f9SWolfgang Denk  */
1416a354f9SWolfgang Denk 
1516a354f9SWolfgang Denk #include <common.h>
1616a354f9SWolfgang Denk 
1716a354f9SWolfgang Denk #include <linux/kbuild.h>
1816a354f9SWolfgang Denk 
1916a354f9SWolfgang Denk int main(void)
2016a354f9SWolfgang Denk {
2125ddd1fbSWolfgang Denk 	/* Round up to make sure size gives nice stack alignment */
2225ddd1fbSWolfgang Denk 	DEFINE(GENERATED_GBL_DATA_SIZE,
2325ddd1fbSWolfgang Denk 		(sizeof(struct global_data) + 15) & ~15);
2425ddd1fbSWolfgang Denk 
2589c95f0cSMike Frysinger 	DEFINE(GENERATED_BD_INFO_SIZE,
2689c95f0cSMike Frysinger 		(sizeof(struct bd_info) + 15) & ~15);
2789c95f0cSMike Frysinger 
28e05e5de7SAlbert ARIBAUD 	DEFINE(GD_SIZE, sizeof(struct global_data));
29e05e5de7SAlbert ARIBAUD 
30e05e5de7SAlbert ARIBAUD 	DEFINE(GD_BD, offsetof(struct global_data, bd));
31*f1896c45SAndy Yan #if CONFIG_VAL(SYS_MALLOC_F_LEN)
32d59476b6SSimon Glass 	DEFINE(GD_MALLOC_BASE, offsetof(struct global_data, malloc_base));
33d59476b6SSimon Glass #endif
34e05e5de7SAlbert ARIBAUD 
35e05e5de7SAlbert ARIBAUD 	DEFINE(GD_RELOCADDR, offsetof(struct global_data, relocaddr));
36e05e5de7SAlbert ARIBAUD 
37e05e5de7SAlbert ARIBAUD 	DEFINE(GD_RELOC_OFF, offsetof(struct global_data, reloc_off));
38e05e5de7SAlbert ARIBAUD 
39e05e5de7SAlbert ARIBAUD 	DEFINE(GD_START_ADDR_SP, offsetof(struct global_data, start_addr_sp));
40e05e5de7SAlbert ARIBAUD 
4116a354f9SWolfgang Denk 	return 0;
4216a354f9SWolfgang Denk }
43