xref: /openbmc/linux/kernel/bounds.c (revision c1e01cdbe0312d95b8c1542abd67fe786b534f57)
1b2441318SGreg Kroah-Hartman // SPDX-License-Identifier: GPL-2.0
21cdf25d7SChristoph Lameter /*
31cdf25d7SChristoph Lameter  * Generate definitions needed by the preprocessor.
41cdf25d7SChristoph Lameter  * This code generates raw asm output which is post-processed
51cdf25d7SChristoph Lameter  * to extract and format the required data.
61cdf25d7SChristoph Lameter  */
71cdf25d7SChristoph Lameter 
81cdf25d7SChristoph Lameter #define __GENERATING_BOUNDS_H
91cdf25d7SChristoph Lameter /* Include headers that define the enum constants of interest */
109223b419SChristoph Lameter #include <linux/page-flags.h>
1197965478SChristoph Lameter #include <linux/mmzone.h>
1237487a56SChristoph Lameter #include <linux/kbuild.h>
1390572890SPeter Zijlstra #include <linux/log2.h>
1424b9fdc5SKirill A. Shutemov #include <linux/spinlock_types.h>
151cdf25d7SChristoph Lameter 
main(void)166a32c246SArnd Bergmann int main(void)
171cdf25d7SChristoph Lameter {
1801fc0ac1SSam Ravnborg 	/* The enum constants to put into include/generated/bounds.h */
199223b419SChristoph Lameter 	DEFINE(NR_PAGEFLAGS, __NR_PAGEFLAGS);
2097965478SChristoph Lameter 	DEFINE(MAX_NR_ZONES, __MAX_NR_ZONES);
2190572890SPeter Zijlstra #ifdef CONFIG_SMP
22*15aa09d6SMatthew Wilcox (Oracle) 	DEFINE(NR_CPUS_BITS, order_base_2(CONFIG_NR_CPUS));
2390572890SPeter Zijlstra #endif
24597d795aSKirill A. Shutemov 	DEFINE(SPINLOCK_SIZE, sizeof(spinlock_t));
25ec1c86b2SYu Zhao #ifdef CONFIG_LRU_GEN
26ec1c86b2SYu Zhao 	DEFINE(LRU_GEN_WIDTH, order_base_2(MAX_NR_GENS + 1));
27ac35a490SYu Zhao 	DEFINE(__LRU_REFS_WIDTH, MAX_NR_TIERS - 2);
28ec1c86b2SYu Zhao #else
29ec1c86b2SYu Zhao 	DEFINE(LRU_GEN_WIDTH, 0);
30ac35a490SYu Zhao 	DEFINE(__LRU_REFS_WIDTH, 0);
31ec1c86b2SYu Zhao #endif
321cdf25d7SChristoph Lameter 	/* End of constants */
336a32c246SArnd Bergmann 
346a32c246SArnd Bergmann 	return 0;
351cdf25d7SChristoph Lameter }
36