18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */
28c2ecf20Sopenharmony_ci#ifndef _S390_SECTIONS_H
38c2ecf20Sopenharmony_ci#define _S390_SECTIONS_H
48c2ecf20Sopenharmony_ci
58c2ecf20Sopenharmony_ci#define arch_is_kernel_initmem_freed arch_is_kernel_initmem_freed
68c2ecf20Sopenharmony_ci
78c2ecf20Sopenharmony_ci#include <asm-generic/sections.h>
88c2ecf20Sopenharmony_ci
98c2ecf20Sopenharmony_ciextern bool initmem_freed;
108c2ecf20Sopenharmony_ci
118c2ecf20Sopenharmony_cistatic inline int arch_is_kernel_initmem_freed(unsigned long addr)
128c2ecf20Sopenharmony_ci{
138c2ecf20Sopenharmony_ci	if (!initmem_freed)
148c2ecf20Sopenharmony_ci		return 0;
158c2ecf20Sopenharmony_ci	return addr >= (unsigned long)__init_begin &&
168c2ecf20Sopenharmony_ci	       addr < (unsigned long)__init_end;
178c2ecf20Sopenharmony_ci}
188c2ecf20Sopenharmony_ci
198c2ecf20Sopenharmony_ci/*
208c2ecf20Sopenharmony_ci * .boot.data section contains variables "shared" between the decompressor and
218c2ecf20Sopenharmony_ci * the decompressed kernel. The decompressor will store values in them, and
228c2ecf20Sopenharmony_ci * copy over to the decompressed image before starting it.
238c2ecf20Sopenharmony_ci *
248c2ecf20Sopenharmony_ci * Each variable end up in its own intermediate section .boot.data.<var name>,
258c2ecf20Sopenharmony_ci * those sections are later sorted by alignment + name and merged together into
268c2ecf20Sopenharmony_ci * final .boot.data section, which should be identical in the decompressor and
278c2ecf20Sopenharmony_ci * the decompressed kernel (that is checked during the build).
288c2ecf20Sopenharmony_ci */
298c2ecf20Sopenharmony_ci#define __bootdata(var) __section(".boot.data." #var) var
308c2ecf20Sopenharmony_ci
318c2ecf20Sopenharmony_ci/*
328c2ecf20Sopenharmony_ci * .boot.preserved.data is similar to .boot.data, but it is not part of the
338c2ecf20Sopenharmony_ci * .init section and thus will be preserved for later use in the decompressed
348c2ecf20Sopenharmony_ci * kernel.
358c2ecf20Sopenharmony_ci */
368c2ecf20Sopenharmony_ci#define __bootdata_preserved(var) __section(".boot.preserved.data." #var) var
378c2ecf20Sopenharmony_ci
388c2ecf20Sopenharmony_ciextern unsigned long __sdma, __edma;
398c2ecf20Sopenharmony_ciextern unsigned long __stext_dma, __etext_dma;
408c2ecf20Sopenharmony_ci
418c2ecf20Sopenharmony_ci#endif
42