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