HV: modularization: remove multiboot_priv.h

Leave a multiboot_priv.h in multiboot folder is redundant, so remove it.
Also, as a public interface, boot.h need not to include multiboot_std.h;

Tracked-On: #5661

Signed-off-by: Victor Sun <victor.sun@intel.com>
Reviewed-by: Jason Chen CJ <jason.cj.chen@intel.com>
This commit is contained in:
Victor Sun 2021-06-03 19:40:50 +08:00 committed by wenlingz
parent 33c864fae6
commit 655511932f
4 changed files with 23 additions and 43 deletions

View File

@ -7,7 +7,6 @@
#ifndef BOOT_H
#define BOOT_H
#include <multiboot_std.h>
#include <efi.h>
#include <vm_configurations.h>

View File

@ -8,12 +8,12 @@
#include <errno.h>
#include <asm/pgtable.h>
#include <boot.h>
#include "multiboot_priv.h"
#include <multiboot_std.h>
/**
* @pre abi != NULL
*/
int32_t multiboot_to_acrn_bi(struct acrn_boot_info *abi, void *mb_info) {
static int32_t multiboot_to_acrn_bi(struct acrn_boot_info *abi, void *mb_info) {
uint32_t i;
struct multiboot_info *mbi = (struct multiboot_info *)(hpa2hva_early((uint64_t)mb_info));
struct multiboot_mmap *mmap = (struct multiboot_mmap *)hpa2hva_early((uint64_t)mbi->mi_mmap_addr);
@ -65,6 +65,11 @@ int32_t multiboot_to_acrn_bi(struct acrn_boot_info *abi, void *mb_info) {
return 0;
}
static inline bool boot_from_multiboot(uint32_t magic, uint32_t info)
{
return ((magic == MULTIBOOT_INFO_MAGIC) && (info != 0U));
}
int32_t init_multiboot_info(uint32_t *registers)
{
int32_t ret = -ENODEV;

View File

@ -7,8 +7,8 @@
#include <types.h>
#include <errno.h>
#include <boot.h>
#include <multiboot_std.h>
#include <asm/pgtable.h>
#include "multiboot_priv.h"
/**
* @pre abi != NULL && mb2_tag_mmap != NULL
@ -62,7 +62,7 @@ static void mb2_efimmap_to_abi(struct acrn_boot_info *abi,
/**
* @pre abi != NULL
*/
int32_t multiboot2_to_acrn_bi(struct acrn_boot_info *abi, void *mb2_info)
static int32_t multiboot2_to_acrn_bi(struct acrn_boot_info *abi, void *mb2_info)
{
int32_t ret = 0;
struct multiboot2_tag *mb2_tag, *mb2_tag_end;
@ -130,6 +130,20 @@ int32_t multiboot2_to_acrn_bi(struct acrn_boot_info *abi, void *mb2_info)
return ret;
}
static inline bool boot_from_multiboot2(uint32_t magic)
{
/*
* 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.
*/
return (magic == MULTIBOOT2_INFO_MAGIC);
}
int32_t init_multiboot2_info(uint32_t *registers)
{
int32_t ret = -ENODEV;

View File

@ -1,38 +0,0 @@
/*
* Copyright (C) 2020 Intel Corporation. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
#ifndef MULTIBOOT_PRIV_H
#define MULTIBOOT_PRIV_H
static inline bool boot_from_multiboot(uint32_t magic, uint32_t info)
{
return ((magic == MULTIBOOT_INFO_MAGIC) && (info != 0U));
}
int32_t multiboot_to_acrn_bi(struct acrn_boot_info *abi, void *mb_info);
#ifdef CONFIG_MULTIBOOT2
/*
* @post boot_regs[1] stores the address pointer that point to a valid multiboot2 info
*/
static inline bool boot_from_multiboot2(uint32_t magic)
{
/*
* 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.
*/
return (magic == MULTIBOOT2_INFO_MAGIC);
}
int32_t multiboot2_to_acrn_bi(struct acrn_boot_info *abi, void *mb2_info);
#endif
#endif /* MULTIBOOT_PRIV_H */