Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0 */
0002 #ifndef _ASM_X86_BOOT_H
0003 #define _ASM_X86_BOOT_H
0004 
0005 
0006 #include <asm/pgtable_types.h>
0007 #include <uapi/asm/boot.h>
0008 
0009 /* Physical address where kernel should be loaded. */
0010 #define LOAD_PHYSICAL_ADDR ((CONFIG_PHYSICAL_START \
0011                 + (CONFIG_PHYSICAL_ALIGN - 1)) \
0012                 & ~(CONFIG_PHYSICAL_ALIGN - 1))
0013 
0014 /* Minimum kernel alignment, as a power of two */
0015 #ifdef CONFIG_X86_64
0016 # define MIN_KERNEL_ALIGN_LG2   PMD_SHIFT
0017 #else
0018 # define MIN_KERNEL_ALIGN_LG2   (PAGE_SHIFT + THREAD_SIZE_ORDER)
0019 #endif
0020 #define MIN_KERNEL_ALIGN    (_AC(1, UL) << MIN_KERNEL_ALIGN_LG2)
0021 
0022 #if (CONFIG_PHYSICAL_ALIGN & (CONFIG_PHYSICAL_ALIGN-1)) || \
0023     (CONFIG_PHYSICAL_ALIGN < MIN_KERNEL_ALIGN)
0024 # error "Invalid value for CONFIG_PHYSICAL_ALIGN"
0025 #endif
0026 
0027 #if defined(CONFIG_KERNEL_BZIP2)
0028 # define BOOT_HEAP_SIZE     0x400000
0029 #elif defined(CONFIG_KERNEL_ZSTD)
0030 /*
0031  * Zstd needs to allocate the ZSTD_DCtx in order to decompress the kernel.
0032  * The ZSTD_DCtx is ~160KB, so set the heap size to 192KB because it is a
0033  * round number and to allow some slack.
0034  */
0035 # define BOOT_HEAP_SIZE      0x30000
0036 #else
0037 # define BOOT_HEAP_SIZE      0x10000
0038 #endif
0039 
0040 #ifdef CONFIG_X86_64
0041 # define BOOT_STACK_SIZE    0x4000
0042 
0043 # define BOOT_INIT_PGT_SIZE (6*4096)
0044 # ifdef CONFIG_RANDOMIZE_BASE
0045 /*
0046  * Assuming all cross the 512GB boundary:
0047  * 1 page for level4
0048  * (2+2)*4 pages for kernel, param, cmd_line, and randomized kernel
0049  * 2 pages for first 2M (video RAM: CONFIG_X86_VERBOSE_BOOTUP).
0050  * Total is 19 pages.
0051  */
0052 #  ifdef CONFIG_X86_VERBOSE_BOOTUP
0053 #   define BOOT_PGT_SIZE    (19*4096)
0054 #  else /* !CONFIG_X86_VERBOSE_BOOTUP */
0055 #   define BOOT_PGT_SIZE    (17*4096)
0056 #  endif
0057 # else /* !CONFIG_RANDOMIZE_BASE */
0058 #  define BOOT_PGT_SIZE     BOOT_INIT_PGT_SIZE
0059 # endif
0060 
0061 #else /* !CONFIG_X86_64 */
0062 # define BOOT_STACK_SIZE    0x1000
0063 #endif
0064 
0065 #endif /* _ASM_X86_BOOT_H */