mirror of
https://github.com/projectacrn/acrn-hypervisor.git
synced 2025-08-13 13:56:19 +00:00
HV: add multiboot2 header info
Add multiboot2 header info in HV image so that bootloader could recognize it. Tracked-On: #4419 Signed-off-by: Victor Sun <victor.sun@intel.com> Acked-by: Eddie Dong <eddie.dong@intel.com>
This commit is contained in:
parent
19ffaa50dc
commit
d008b72fdd
@ -107,6 +107,9 @@ CFLAGS += -fcf-protection=none
|
|||||||
endif
|
endif
|
||||||
|
|
||||||
ASFLAGS += -m64 -nostdinc -nostdlib
|
ASFLAGS += -m64 -nostdinc -nostdlib
|
||||||
|
ifeq (y, $(CONFIG_MULTIBOOT2))
|
||||||
|
ASFLAGS += -DCONFIG_MULTIBOOT2
|
||||||
|
endif
|
||||||
|
|
||||||
LDFLAGS += -Wl,--gc-sections -nostartfiles -nostdlib
|
LDFLAGS += -Wl,--gc-sections -nostartfiles -nostdlib
|
||||||
LDFLAGS += -Wl,-n,-z,max-page-size=0x1000
|
LDFLAGS += -Wl,-n,-z,max-page-size=0x1000
|
||||||
|
@ -37,6 +37,14 @@ config HYBRID
|
|||||||
|
|
||||||
endchoice
|
endchoice
|
||||||
|
|
||||||
|
config MULTIBOOT2
|
||||||
|
bool "Multiboot2 support"
|
||||||
|
default n
|
||||||
|
help
|
||||||
|
Support boot ACRN from multiboot2 protocol. Multiboot2 support is needed for
|
||||||
|
some EFI platforms to get correct ACPI RSDP, it also could provide host efi
|
||||||
|
information for hypervisor.
|
||||||
|
|
||||||
choice
|
choice
|
||||||
prompt "ACRN Scheduler"
|
prompt "ACRN Scheduler"
|
||||||
default SCHED_NOOP
|
default SCHED_NOOP
|
||||||
|
@ -22,6 +22,10 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include <multiboot.h>
|
#include <multiboot.h>
|
||||||
|
#ifdef CONFIG_MULTIBOOT2
|
||||||
|
#include <multiboot2.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
/* MULTIBOOT HEADER */
|
/* MULTIBOOT HEADER */
|
||||||
#define MULTIBOOT_HEADER_FLAGS MULTIBOOT_HEADER_NEED_MEMINFO
|
#define MULTIBOOT_HEADER_FLAGS MULTIBOOT_HEADER_NEED_MEMINFO
|
||||||
|
|
||||||
@ -38,6 +42,33 @@
|
|||||||
/* header checksum = -(magic + flags) */
|
/* header checksum = -(magic + flags) */
|
||||||
.long -(MULTIBOOT_HEADER_MAGIC + MULTIBOOT_HEADER_FLAGS)
|
.long -(MULTIBOOT_HEADER_MAGIC + MULTIBOOT_HEADER_FLAGS)
|
||||||
|
|
||||||
|
#ifdef CONFIG_MULTIBOOT2
|
||||||
|
.align MULTIBOOT2_HEADER_ALIGN
|
||||||
|
mb2_header_start:
|
||||||
|
/* Magic number indicating a Multiboot2 header. */
|
||||||
|
.long MULTIBOOT2_HEADER_MAGIC
|
||||||
|
/* Architecture: i386. */
|
||||||
|
.long MULTIBOOT2_ARCHITECTURE_I386
|
||||||
|
/* Multiboot2 header length. */
|
||||||
|
.long mb2_header_end - mb2_header_start
|
||||||
|
/* Multiboot2 header checksum. */
|
||||||
|
.long -(MULTIBOOT2_HEADER_MAGIC + MULTIBOOT2_ARCHITECTURE_I386 + (mb2_header_end - mb2_header_start))
|
||||||
|
|
||||||
|
/* please be aware that each tag should be 8 bytes aligned */
|
||||||
|
.align MULTIBOOT2_TAG_ALIGN
|
||||||
|
info_req_tag_start:
|
||||||
|
.short MULTIBOOT2_HEADER_TAG_INFORMATION_REQUEST
|
||||||
|
.short 0
|
||||||
|
.long info_req_tag_end - info_req_tag_start
|
||||||
|
.long MULTIBOOT2_TAG_TYPE_MMAP
|
||||||
|
info_req_tag_end:
|
||||||
|
|
||||||
|
.align MULTIBOOT2_TAG_ALIGN
|
||||||
|
.short MULTIBOOT2_HEADER_TAG_END
|
||||||
|
.short 0
|
||||||
|
.long 8
|
||||||
|
mb2_header_end:
|
||||||
|
#endif
|
||||||
.section entry, "ax"
|
.section entry, "ax"
|
||||||
|
|
||||||
.align 8
|
.align 8
|
||||||
|
131
hypervisor/boot/include/multiboot2.h
Normal file
131
hypervisor/boot/include/multiboot2.h
Normal file
@ -0,0 +1,131 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2020 Intel Corporation. All rights reserved.
|
||||||
|
*
|
||||||
|
* SPDX-License-Identifier: BSD-3-Clause
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* multiboot2.h - Multiboot 2 header file. */
|
||||||
|
/* Copyright (C) 1999,2003,2007,2008,2009,2010 Free Software Foundation, Inc.
|
||||||
|
*
|
||||||
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
* of this software and associated documentation files (the "Software"), to
|
||||||
|
* deal in the Software without restriction, including without limitation the
|
||||||
|
* rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
||||||
|
* sell copies of the Software, and to permit persons to whom the Software is
|
||||||
|
* furnished to do so, subject to the following conditions:
|
||||||
|
*
|
||||||
|
* The above copyright notice and this permission notice shall be included in
|
||||||
|
* all copies or substantial portions of the Software.
|
||||||
|
*
|
||||||
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL ANY
|
||||||
|
* DEVELOPER OR DISTRIBUTOR BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||||
|
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
|
||||||
|
* IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef MULTIBOOT2_H
|
||||||
|
#define MULTIBOOT2_H
|
||||||
|
|
||||||
|
#define MULTIBOOT2_HEADER_ALIGN 8
|
||||||
|
|
||||||
|
#define MULTIBOOT2_HEADER_MAGIC 0xe85250d6U
|
||||||
|
|
||||||
|
/* This should be in %eax. */
|
||||||
|
#define MULTIBOOT2_INFO_MAGIC 0x36d76289U
|
||||||
|
|
||||||
|
/* Alignment of the multiboot info structure. */
|
||||||
|
#define MULTIBOOT2_INFO_ALIGN 0x00000008U
|
||||||
|
|
||||||
|
/* Flags set in the 'flags' member of the multiboot header. */
|
||||||
|
|
||||||
|
#define MULTIBOOT2_TAG_ALIGN 8U
|
||||||
|
#define MULTIBOOT2_TAG_TYPE_END 0U
|
||||||
|
#define MULTIBOOT2_TAG_TYPE_CMDLINE 1U
|
||||||
|
#define MULTIBOOT2_TAG_TYPE_BOOT_LOADER_NAME 2U
|
||||||
|
#define MULTIBOOT2_TAG_TYPE_MODULE 3U
|
||||||
|
#define MULTIBOOT2_TAG_TYPE_BASIC_MEMINFO 4U
|
||||||
|
#define MULTIBOOT2_TAG_TYPE_BOOTDEV 5U
|
||||||
|
#define MULTIBOOT2_TAG_TYPE_MMAP 6U
|
||||||
|
#define MULTIBOOT2_TAG_TYPE_VBE 7U
|
||||||
|
#define MULTIBOOT2_TAG_TYPE_FRAMEBUFFER 8U
|
||||||
|
#define MULTIBOOT2_TAG_TYPE_ELF_SECTIONS 9U
|
||||||
|
#define MULTIBOOT2_TAG_TYPE_APM 10U
|
||||||
|
#define MULTIBOOT2_TAG_TYPE_EFI32 11U
|
||||||
|
#define MULTIBOOT2_TAG_TYPE_EFI64 12U
|
||||||
|
#define MULTIBOOT2_TAG_TYPE_SMBIOS 13U
|
||||||
|
#define MULTIBOOT2_TAG_TYPE_ACPI_OLD 14U
|
||||||
|
#define MULTIBOOT2_TAG_TYPE_ACPI_NEW 15U
|
||||||
|
#define MULTIBOOT2_TAG_TYPE_NETWORK 16U
|
||||||
|
#define MULTIBOOT2_TAG_TYPE_EFI_MMAP 17U
|
||||||
|
#define MULTIBOOT2_TAG_TYPE_EFI_BS 18U
|
||||||
|
#define MULTIBOOT2_TAG_TYPE_EFI32_IH 19U
|
||||||
|
#define MULTIBOOT2_TAG_TYPE_EFI64_IH 20U
|
||||||
|
#define MULTIBOOT2_TAG_TYPE_LOAD_BASE_ADDR 21U
|
||||||
|
|
||||||
|
#define MULTIBOOT2_HEADER_TAG_END 0
|
||||||
|
#define MULTIBOOT2_HEADER_TAG_INFORMATION_REQUEST 1
|
||||||
|
#define MULTIBOOT2_HEADER_TAG_ADDRESS 2
|
||||||
|
#define MULTIBOOT2_HEADER_TAG_ENTRY_ADDRESS 3
|
||||||
|
#define MULTIBOOT2_HEADER_TAG_CONSOLE_FLAGS 4
|
||||||
|
#define MULTIBOOT2_HEADER_TAG_FRAMEBUFFER 5
|
||||||
|
#define MULTIBOOT2_HEADER_TAG_MODULE_ALIGN 6
|
||||||
|
#define MULTIBOOT2_HEADER_TAG_EFI_BS 7
|
||||||
|
#define MULTIBOOT2_HEADER_TAG_ENTRY_ADDRESS_EFI32 8
|
||||||
|
#define MULTIBOOT2_HEADER_TAG_ENTRY_ADDRESS_EFI64 9
|
||||||
|
#define MULTIBOOT2_HEADER_TAG_RELOCATABLE 10
|
||||||
|
|
||||||
|
#define MULTIBOOT2_ARCHITECTURE_I386 0
|
||||||
|
#define MULTIBOOT2_ARCHITECTURE_MIPS32 4
|
||||||
|
|
||||||
|
#ifndef ASSEMBLER
|
||||||
|
struct multiboot2_mmap_entry
|
||||||
|
{
|
||||||
|
uint64_t addr;
|
||||||
|
uint64_t len;
|
||||||
|
uint32_t type;
|
||||||
|
uint32_t zero;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct multiboot2_tag
|
||||||
|
{
|
||||||
|
uint32_t type;
|
||||||
|
uint32_t size;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct multiboot2_tag_string
|
||||||
|
{
|
||||||
|
uint32_t type;
|
||||||
|
uint32_t size;
|
||||||
|
char string[0];
|
||||||
|
};
|
||||||
|
|
||||||
|
struct multiboot2_tag_module
|
||||||
|
{
|
||||||
|
uint32_t type;
|
||||||
|
uint32_t size;
|
||||||
|
uint32_t mod_start;
|
||||||
|
uint32_t mod_end;
|
||||||
|
char cmdline[0];
|
||||||
|
};
|
||||||
|
|
||||||
|
struct multiboot2_tag_mmap
|
||||||
|
{
|
||||||
|
uint32_t type;
|
||||||
|
uint32_t size;
|
||||||
|
uint32_t entry_size;
|
||||||
|
uint32_t entry_version;
|
||||||
|
struct multiboot2_mmap_entry entries[0];
|
||||||
|
};
|
||||||
|
|
||||||
|
struct multiboot2_tag_new_acpi
|
||||||
|
{
|
||||||
|
uint32_t type;
|
||||||
|
uint32_t size;
|
||||||
|
uint8_t rsdp[0];
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif /* ASSEMBLER */
|
||||||
|
|
||||||
|
#endif /* MULTIBOOT2_H */
|
Loading…
Reference in New Issue
Block a user