2021-01-18 03:28:39 +08:00
|
|
|
/*
|
2022-04-05 18:59:24 +08:00
|
|
|
* Copyright (C) 2020 Intel Corporation.
|
2021-01-18 03:28:39 +08:00
|
|
|
*
|
|
|
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef MULTIBOOT_PRIV_H
|
|
|
|
#define MULTIBOOT_PRIV_H
|
|
|
|
|
2021-02-09 10:23:36 +08:00
|
|
|
#ifdef CONFIG_MULTIBOOT2
|
2021-01-18 03:28:39 +08:00
|
|
|
/*
|
|
|
|
* @post boot_regs[1] stores the address pointer that point to a valid multiboot2 info
|
|
|
|
*/
|
2021-01-18 07:41:30 +08:00
|
|
|
static inline bool boot_from_multiboot2(uint32_t magic)
|
2021-01-18 03:28:39 +08:00
|
|
|
{
|
|
|
|
/*
|
|
|
|
* Multiboot spec states that the Multiboot information structure may be placed
|
|
|
|
* anywhere in memory by the boot loader.
|
|
|
|
*
|
|
|
|
* Seems both SBL and GRUB won't place multiboot1 MBI structure at 0 address,
|
|
|
|
* but GRUB could place Multiboot2 MBI structure at 0 address until commit
|
|
|
|
* 0f3f5b7c13fa9b67 ("multiboot2: Set min address for mbi allocation to 0x1000")
|
|
|
|
* which dates on Dec 26 2019.
|
|
|
|
*/
|
2021-01-18 07:41:30 +08:00
|
|
|
return (magic == MULTIBOOT2_INFO_MAGIC);
|
2021-01-18 03:28:39 +08:00
|
|
|
}
|
|
|
|
|
2021-05-21 11:12:24 +08:00
|
|
|
int32_t multiboot2_to_acrn_bi(struct acrn_boot_info *abi, void *mb2_info);
|
2021-01-18 03:28:39 +08:00
|
|
|
#endif
|
|
|
|
|
2021-06-08 15:11:18 +08:00
|
|
|
static inline bool boot_from_multiboot(uint32_t magic, uint32_t info)
|
2021-01-18 03:28:39 +08:00
|
|
|
{
|
2021-01-18 07:41:30 +08:00
|
|
|
return ((magic == MULTIBOOT_INFO_MAGIC) && (info != 0U));
|
2021-01-18 03:28:39 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
#endif /* MULTIBOOT_PRIV_H */
|