xref: /OK3568_Linux_fs/kernel/arch/s390/include/asm/sections.h (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1*4882a593Smuzhiyun /* SPDX-License-Identifier: GPL-2.0 */
2*4882a593Smuzhiyun #ifndef _S390_SECTIONS_H
3*4882a593Smuzhiyun #define _S390_SECTIONS_H
4*4882a593Smuzhiyun 
5*4882a593Smuzhiyun #define arch_is_kernel_initmem_freed arch_is_kernel_initmem_freed
6*4882a593Smuzhiyun 
7*4882a593Smuzhiyun #include <asm-generic/sections.h>
8*4882a593Smuzhiyun 
9*4882a593Smuzhiyun extern bool initmem_freed;
10*4882a593Smuzhiyun 
arch_is_kernel_initmem_freed(unsigned long addr)11*4882a593Smuzhiyun static inline int arch_is_kernel_initmem_freed(unsigned long addr)
12*4882a593Smuzhiyun {
13*4882a593Smuzhiyun 	if (!initmem_freed)
14*4882a593Smuzhiyun 		return 0;
15*4882a593Smuzhiyun 	return addr >= (unsigned long)__init_begin &&
16*4882a593Smuzhiyun 	       addr < (unsigned long)__init_end;
17*4882a593Smuzhiyun }
18*4882a593Smuzhiyun 
19*4882a593Smuzhiyun /*
20*4882a593Smuzhiyun  * .boot.data section contains variables "shared" between the decompressor and
21*4882a593Smuzhiyun  * the decompressed kernel. The decompressor will store values in them, and
22*4882a593Smuzhiyun  * copy over to the decompressed image before starting it.
23*4882a593Smuzhiyun  *
24*4882a593Smuzhiyun  * Each variable end up in its own intermediate section .boot.data.<var name>,
25*4882a593Smuzhiyun  * those sections are later sorted by alignment + name and merged together into
26*4882a593Smuzhiyun  * final .boot.data section, which should be identical in the decompressor and
27*4882a593Smuzhiyun  * the decompressed kernel (that is checked during the build).
28*4882a593Smuzhiyun  */
29*4882a593Smuzhiyun #define __bootdata(var) __section(".boot.data." #var) var
30*4882a593Smuzhiyun 
31*4882a593Smuzhiyun /*
32*4882a593Smuzhiyun  * .boot.preserved.data is similar to .boot.data, but it is not part of the
33*4882a593Smuzhiyun  * .init section and thus will be preserved for later use in the decompressed
34*4882a593Smuzhiyun  * kernel.
35*4882a593Smuzhiyun  */
36*4882a593Smuzhiyun #define __bootdata_preserved(var) __section(".boot.preserved.data." #var) var
37*4882a593Smuzhiyun 
38*4882a593Smuzhiyun extern unsigned long __sdma, __edma;
39*4882a593Smuzhiyun extern unsigned long __stext_dma, __etext_dma;
40*4882a593Smuzhiyun 
41*4882a593Smuzhiyun #endif
42