1 /*
2  * Copyright (C) 2020-2022 Intel Corporation.
3  *
4  * SPDX-License-Identifier: BSD-3-Clause
5  */
6 
7 #ifndef MULTIBOOT_PRIV_H
8 #define MULTIBOOT_PRIV_H
9 
10 #include <multiboot_std.h>
11 
12 #ifdef CONFIG_MULTIBOOT2
13 /*
14  * @post boot_regs[1] stores the address pointer that point to a valid multiboot2 info
15  */
boot_from_multiboot2(uint32_t magic)16 static inline bool boot_from_multiboot2(uint32_t magic)
17 {
18 	/*
19 	 * Multiboot spec states that the Multiboot information structure may be placed
20 	 * anywhere in memory by the boot loader.
21 	 *
22 	 * Seems both SBL and GRUB won't place multiboot1 MBI structure at 0 address,
23 	 * but GRUB could place Multiboot2 MBI structure at 0 address until commit
24 	 * 0f3f5b7c13fa9b67 ("multiboot2: Set min address for mbi allocation to 0x1000")
25 	 * which dates on Dec 26 2019.
26 	 */
27 	return (magic == MULTIBOOT2_INFO_MAGIC);
28 }
29 
30 int32_t multiboot2_to_acrn_bi(struct acrn_boot_info *abi, void *mb2_info);
31 #endif
32 
boot_from_multiboot(uint32_t magic,uint32_t info)33 static inline bool boot_from_multiboot(uint32_t magic, uint32_t info)
34 {
35 	return ((magic == MULTIBOOT_INFO_MAGIC) && (info != 0U));
36 }
37 
38 #endif /* MULTIBOOT_PRIV_H */
39