hv: remove unused de-privilege and vboot wrapper code

Remove deprivilege_boot.c, direct_boot.c, vboot_wrapper.c and their
header fioles.

Tracked-On: #5197
Signed-off-by: Zide Chen <zide.chen@intel.com>
This commit is contained in:
Zide Chen 2020-08-23 21:09:51 -07:00 committed by wenlingz
parent bebffb29fc
commit 6a0a3233c3
7 changed files with 0 additions and 292 deletions

View File

@ -1,77 +0,0 @@
/*
* Copyright (C) 2019 Intel Corporation. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
/* this is for de-privilege guest vboot method */
#include <types.h>
#include <acrn_common.h>
#include <pgtable.h>
#include <logmsg.h>
#include <rtl.h>
#include <vlapic.h>
#include <lapic.h>
#include <per_cpu.h>
#include <guest/vm.h>
#include <boot.h>
#include <deprivilege_boot.h>
static struct depri_boot_context depri_boot_ctx;
static struct lapic_regs depri_boot_lapic_regs;
static void init_depri_boot(void)
{
static bool depri_initialized = false;
struct acrn_multiboot_info *mbi = get_multiboot_info();
if (!depri_initialized) {
if ((mbi->mi_flags & MULTIBOOT_INFO_HAS_DRIVES) == 0U) {
pr_err("no multiboot drivers for depri_boot found");
} else {
(void)memcpy_s(&depri_boot_ctx, sizeof(struct depri_boot_context),
hpa2hva((uint64_t)mbi->mi_drives_addr),
sizeof(struct depri_boot_context));
save_lapic(&depri_boot_lapic_regs);
}
depri_initialized = true;
}
}
const struct depri_boot_context *get_depri_boot_ctx(void)
{
return &depri_boot_ctx;
}
const struct lapic_regs *get_depri_boot_lapic_regs(void)
{
return &depri_boot_lapic_regs;
}
static uint64_t get_depri_boot_ap_trampoline(void)
{
return depri_boot_ctx.ap_trampoline_buf;
}
static const void* get_depri_boot_rsdp(void)
{
return (const void*)hpa2hva((uint64_t)(depri_boot_ctx.rsdp));
}
static void init_depri_boot_irq(void)
{
/* nothing to do for now */
}
static struct vboot_operations depri_boot_ops = {
.init = init_depri_boot,
.get_ap_trampoline = get_depri_boot_ap_trampoline,
.get_rsdp = get_depri_boot_rsdp,
.init_irq = init_depri_boot_irq,
};
struct vboot_operations* get_deprivilege_boot_ops(void)
{
return &depri_boot_ops;
}

View File

@ -1,56 +0,0 @@
/*
* Copyright (C) 2019 Intel Corporation. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
/* this is for direct guest_boot method */
#include <types.h>
#include <e820.h>
#include <cpu.h>
#include <boot.h>
#include <direct_boot.h>
#include <mmu.h>
/* AP trampoline code buffer base address. */
static uint64_t ap_trampoline_buf;
static void init_direct_boot(void)
{
ap_trampoline_buf = e820_alloc_memory(CONFIG_LOW_RAM_SIZE, MEM_1M);
}
/* @post: return != 0UL */
static uint64_t get_direct_boot_ap_trampoline(void)
{
return ap_trampoline_buf;
}
static const void* get_direct_boot_rsdp(void)
{
#ifdef CONFIG_MULTIBOOT2
struct acrn_multiboot_info *mbi = get_multiboot_info();
return mbi->mi_acpi_rsdp_va;
#else
return NULL;
#endif
}
static void init_direct_boot_irq(void)
{
CPU_IRQ_ENABLE();
}
static struct vboot_operations direct_boot_ops = {
.init = init_direct_boot,
.get_ap_trampoline = get_direct_boot_ap_trampoline,
.get_rsdp = get_direct_boot_rsdp,
.init_irq = init_direct_boot_irq,
};
struct vboot_operations* get_direct_boot_ops(void)
{
return &direct_boot_ops;
}

View File

@ -17,7 +17,6 @@
#include <mmu.h>
#include <vm.h>
#include <logmsg.h>
#include <deprivilege_boot.h>
#include <vboot_info.h>
#include <vacpi.h>

View File

@ -1,90 +0,0 @@
/*
* Copyright (C) 2019 Intel Corporation. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
#include <vm.h>
#include <types.h>
#include <pgtable.h>
#include <acpi.h>
#include <boot.h>
#include <vboot.h>
#include <direct_boot.h>
#include <deprivilege_boot.h>
#include <logmsg.h>
#define BOOTLOADER_NUM 5U
#define BOOTLOADER_NAME_SIZE 20U
struct vboot_bootloader_map {
const char bootloader_name[BOOTLOADER_NAME_SIZE];
enum vboot_mode mode;
};
static struct vboot_operations *vboot_ops;
static enum vboot_mode sos_boot_mode;
/**
* @pre: this function is called during detect mode which is very early stage,
* other exported interfaces should not be called beforehand.
*/
void init_vboot(void)
{
struct acrn_multiboot_info *mbi = get_multiboot_info();
uint32_t i;
const struct vboot_bootloader_map vboot_bootloader_maps[BOOTLOADER_NUM] = {
{"Slim BootLoader", DIRECT_BOOT_MODE},
{"Intel IOTG/TSD ABL", DIRECT_BOOT_MODE},
{"ACRN UEFI loader", DEPRI_BOOT_MODE},
{"GRUB", DIRECT_BOOT_MODE},
{"PXELINUX", DIRECT_BOOT_MODE},
};
for (i = 0U; i < BOOTLOADER_NUM; i++) {
if (strncmp(mbi->mi_loader_name, vboot_bootloader_maps[i].bootloader_name,
strnlen_s(vboot_bootloader_maps[i].bootloader_name, BOOTLOADER_NAME_SIZE)) == 0) {
/* Only support two vboot mode */
if (vboot_bootloader_maps[i].mode == DEPRI_BOOT_MODE) {
vboot_ops = get_deprivilege_boot_ops();
sos_boot_mode = DEPRI_BOOT_MODE;
} else {
vboot_ops = get_direct_boot_ops();
sos_boot_mode = DIRECT_BOOT_MODE;
}
break;
}
}
/*
* vboot_ops is mandatory and it will be initialized correctly.
* The vboot_ops->init is called to assure that the boot env is
* initialized before calling other vboot_ops interface.
*/
vboot_ops->init();
}
/* @pre: vboot_ops != NULL */
enum vboot_mode get_sos_boot_mode(void)
{
return sos_boot_mode;
}
/* @pre: vboot_ops->get_ap_trampoline != NULL */
uint64_t get_ap_trampoline_buf(void)
{
return vboot_ops->get_ap_trampoline();
}
/* @pre: vboot_ops->get_rsdp != NULL */
const void *get_rsdp_ptr(void)
{
return vboot_ops->get_rsdp();
}
/* @pre: vboot_ops->init_irq != NULL */
void init_vboot_irq(void)
{
return vboot_ops->init_irq();
}

View File

@ -1,23 +0,0 @@
/*
* Copyright (C) 2019 Intel Corporation. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
#ifndef DEPRIVILEGE_BOOT_H
#define DEPRIVILEGE_BOOT_H
#include <vboot.h>
struct depri_boot_context {
struct acrn_vcpu_regs vcpu_regs;
void *rsdp;
uint64_t ap_trampoline_buf;
} __packed;
const struct depri_boot_context *get_depri_boot_ctx(void);
const struct lapic_regs *get_depri_boot_lapic_regs(void);
struct vboot_operations* get_deprivilege_boot_ops(void);
#endif /* end of include guard: DEPRIVILEGE_BOOT_H */

View File

@ -1,15 +0,0 @@
/*
* Copyright (C) 2019 Intel Corporation. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
#ifndef DIRECT_BOOT_H
#define DIRECT_BOOT_H
#include <vboot.h>
struct vboot_operations* get_direct_boot_ops(void);
#endif /* end of include guard: DIRECT_BOOT_H */

View File

@ -1,30 +0,0 @@
/*
* Copyright (C) 2019 Intel Corporation. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
#ifndef VBOOT_H
#define VBOOT_H
enum vboot_mode {
DIRECT_BOOT_MODE,
DEPRI_BOOT_MODE
};
struct vboot_operations {
void (*init)(void);
uint64_t (*get_ap_trampoline)(void);
const void *(*get_rsdp)(void);
void (*init_irq)(void);
};
void init_vboot(void);
void init_vboot_irq(void);
uint64_t get_ap_trampoline_buf(void);
const void *get_rsdp_ptr(void);
enum vboot_mode get_sos_boot_mode(void);
#endif /* end of include guard: VBOOT_H */