18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */
28c2ecf20Sopenharmony_ci#ifndef _ASM_X86_SPARSEMEM_H
38c2ecf20Sopenharmony_ci#define _ASM_X86_SPARSEMEM_H
48c2ecf20Sopenharmony_ci
58c2ecf20Sopenharmony_ci#ifdef CONFIG_SPARSEMEM
68c2ecf20Sopenharmony_ci/*
78c2ecf20Sopenharmony_ci * generic non-linear memory support:
88c2ecf20Sopenharmony_ci *
98c2ecf20Sopenharmony_ci * 1) we will not split memory into more chunks than will fit into the flags
108c2ecf20Sopenharmony_ci *    field of the struct page
118c2ecf20Sopenharmony_ci *
128c2ecf20Sopenharmony_ci * SECTION_SIZE_BITS		2^n: size of each section
138c2ecf20Sopenharmony_ci * MAX_PHYSMEM_BITS		2^n: max size of physical address space
148c2ecf20Sopenharmony_ci *
158c2ecf20Sopenharmony_ci */
168c2ecf20Sopenharmony_ci
178c2ecf20Sopenharmony_ci#ifdef CONFIG_X86_32
188c2ecf20Sopenharmony_ci# ifdef CONFIG_X86_PAE
198c2ecf20Sopenharmony_ci#  define SECTION_SIZE_BITS	29
208c2ecf20Sopenharmony_ci#  define MAX_PHYSMEM_BITS	36
218c2ecf20Sopenharmony_ci# else
228c2ecf20Sopenharmony_ci#  define SECTION_SIZE_BITS	26
238c2ecf20Sopenharmony_ci#  define MAX_PHYSMEM_BITS	32
248c2ecf20Sopenharmony_ci# endif
258c2ecf20Sopenharmony_ci#else /* CONFIG_X86_32 */
268c2ecf20Sopenharmony_ci# define SECTION_SIZE_BITS	27 /* matt - 128 is convenient right now */
278c2ecf20Sopenharmony_ci# define MAX_PHYSMEM_BITS	(pgtable_l5_enabled() ? 52 : 46)
288c2ecf20Sopenharmony_ci#endif
298c2ecf20Sopenharmony_ci
308c2ecf20Sopenharmony_ci#endif /* CONFIG_SPARSEMEM */
318c2ecf20Sopenharmony_ci
328c2ecf20Sopenharmony_ci#ifndef __ASSEMBLY__
338c2ecf20Sopenharmony_ci#ifdef CONFIG_NUMA_KEEP_MEMINFO
348c2ecf20Sopenharmony_ciextern int phys_to_target_node(phys_addr_t start);
358c2ecf20Sopenharmony_ci#define phys_to_target_node phys_to_target_node
368c2ecf20Sopenharmony_ciextern int memory_add_physaddr_to_nid(u64 start);
378c2ecf20Sopenharmony_ci#define memory_add_physaddr_to_nid memory_add_physaddr_to_nid
388c2ecf20Sopenharmony_ci#endif
398c2ecf20Sopenharmony_ci#endif /* __ASSEMBLY__ */
408c2ecf20Sopenharmony_ci
418c2ecf20Sopenharmony_ci#endif /* _ASM_X86_SPARSEMEM_H */
42