blob: 680c320363dbab47b45b8752c66c64cab95295a8 [file] [log] [blame]
Greg Kroah-Hartmanb2441312017-11-01 15:07:57 +01001/* SPDX-License-Identifier: GPL-2.0 */
H. Peter Anvin1965aae2008-10-22 22:26:29 -07002#ifndef _ASM_X86_BOOT_H
3#define _ASM_X86_BOOT_H
Linus Torvalds1da177e2005-04-16 15:20:36 -07004
Cyrill Gorcunov95c4bff2009-01-14 23:37:46 +03005
H. Peter Anvin658dbfe2009-06-25 15:16:06 -07006#include <asm/pgtable_types.h>
David Howellsaf170c52012-12-14 22:37:13 +00007#include <uapi/asm/boot.h>
H. Peter Anvin37ba7ab2009-05-11 15:56:08 -07008
Robert P. J. Daybeb7dd82007-05-09 07:14:03 +02009/* Physical address where kernel should be loaded. */
Vivek Goyaldd0ec162007-01-05 16:36:30 -080010#define LOAD_PHYSICAL_ADDR ((CONFIG_PHYSICAL_START \
11 + (CONFIG_PHYSICAL_ALIGN - 1)) \
Vivek Goyale69f2022006-12-07 02:14:04 +010012 & ~(CONFIG_PHYSICAL_ALIGN - 1))
13
H. Peter Anvin37ba7ab2009-05-11 15:56:08 -070014/* Minimum kernel alignment, as a power of two */
Robert P. J. Day22f43192009-06-25 16:20:48 -040015#ifdef CONFIG_X86_64
Kees Cook8665e6f2016-05-06 15:01:33 -070016# define MIN_KERNEL_ALIGN_LG2 PMD_SHIFT
H. Peter Anvin37ba7ab2009-05-11 15:56:08 -070017#else
Kees Cook8665e6f2016-05-06 15:01:33 -070018# define MIN_KERNEL_ALIGN_LG2 (PAGE_SHIFT + THREAD_SIZE_ORDER)
H. Peter Anvin37ba7ab2009-05-11 15:56:08 -070019#endif
20#define MIN_KERNEL_ALIGN (_AC(1, UL) << MIN_KERNEL_ALIGN_LG2)
21
22#if (CONFIG_PHYSICAL_ALIGN & (CONFIG_PHYSICAL_ALIGN-1)) || \
Jan Beulich6fc108a2010-04-21 15:23:44 +010023 (CONFIG_PHYSICAL_ALIGN < MIN_KERNEL_ALIGN)
Kees Cook8665e6f2016-05-06 15:01:33 -070024# error "Invalid value for CONFIG_PHYSICAL_ALIGN"
H. Peter Anvin37ba7ab2009-05-11 15:56:08 -070025#endif
26
Cyrill Gorcunov95c4bff2009-01-14 23:37:46 +030027#ifdef CONFIG_KERNEL_BZIP2
Kees Cook8665e6f2016-05-06 15:01:33 -070028# define BOOT_HEAP_SIZE 0x400000
Cyrill Gorcunov95c4bff2009-01-14 23:37:46 +030029#else /* !CONFIG_KERNEL_BZIP2 */
Kees Cook8665e6f2016-05-06 15:01:33 -070030# define BOOT_HEAP_SIZE 0x10000
31#endif
Alain Knaffae03c492009-01-04 22:46:17 +010032
33#ifdef CONFIG_X86_64
Kees Cook8665e6f2016-05-06 15:01:33 -070034# define BOOT_STACK_SIZE 0x4000
Kees Cook3a947072016-05-06 15:01:35 -070035
36# define BOOT_INIT_PGT_SIZE (6*4096)
37# ifdef CONFIG_RANDOMIZE_BASE
38/*
39 * Assuming all cross the 512GB boundary:
40 * 1 page for level4
41 * (2+2)*4 pages for kernel, param, cmd_line, and randomized kernel
42 * 2 pages for first 2M (video RAM: CONFIG_X86_VERBOSE_BOOTUP).
43 * Total is 19 pages.
44 */
45# ifdef CONFIG_X86_VERBOSE_BOOTUP
46# define BOOT_PGT_SIZE (19*4096)
47# else /* !CONFIG_X86_VERBOSE_BOOTUP */
48# define BOOT_PGT_SIZE (17*4096)
49# endif
50# else /* !CONFIG_RANDOMIZE_BASE */
51# define BOOT_PGT_SIZE BOOT_INIT_PGT_SIZE
52# endif
53
Kees Cook8665e6f2016-05-06 15:01:33 -070054#else /* !CONFIG_X86_64 */
55# define BOOT_STACK_SIZE 0x1000
Alexander van Heukelum7c539762008-04-08 12:54:30 +020056#endif
57
H. Peter Anvin1965aae2008-10-22 22:26:29 -070058#endif /* _ASM_X86_BOOT_H */