HV: move dmar info definition to board.c

The DMAR info is board specific so move the structure definition to board.c.
As a configruation file, the whole board.c could be generated by acrn-config
tool for each board.

Please note we only provide DMAR info MACROs for nuc7i7dnb board. For other
boards, ACPI_PARSE_ENABLED must be set to y in Kconfig to let hypervisor parse
DMAR info, or use acrn-config tool to generate DMAR info MACROs if user won't
enable ACPI parse code for FuSa consideration.

The patch also moves the function of get_dmar_info() to vtd.c, so dmar_info.c
could be removed.

Tracked-On: #3977

Signed-off-by: Victor Sun <victor.sun@intel.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
This commit is contained in:
Victor Sun
2019-10-29 19:49:52 +08:00
committed by wenlingz
parent e9a1ace1cc
commit 2ba1848980
14 changed files with 124 additions and 134 deletions

View File

@@ -1,84 +0,0 @@
/*
* Copyright (C) 2018 Intel Corporation. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
#include <vtd.h>
#include <platform_acpi_info.h>
static struct dmar_dev_scope drhd0_dev_scope[MAX_DRHD_DEVSCOPES] = {
{
.bus = DRHD0_DEVSCOPE0_BUS,
.devfun = DRHD0_DEVSCOPE0_PATH
},
{
.bus = DRHD0_DEVSCOPE1_BUS,
.devfun = DRHD0_DEVSCOPE1_PATH
},
{
.bus = DRHD0_DEVSCOPE2_BUS,
.devfun = DRHD0_DEVSCOPE2_PATH
},
{
.bus = DRHD0_DEVSCOPE3_BUS,
.devfun = DRHD0_DEVSCOPE3_PATH
}
};
static struct dmar_dev_scope drhd1_dev_scope[MAX_DRHD_DEVSCOPES] = {
{
.type = ACPI_DMAR_SCOPE_TYPE_IOAPIC,
.id = DRHD1_IOAPIC_ID,
.bus = DRHD1_DEVSCOPE0_BUS,
.devfun = DRHD1_DEVSCOPE0_PATH
},
{
.bus = DRHD1_DEVSCOPE1_BUS,
.devfun = DRHD1_DEVSCOPE1_PATH
},
{
.bus = DRHD1_DEVSCOPE2_BUS,
.devfun = DRHD1_DEVSCOPE2_PATH
},
{
.bus = DRHD1_DEVSCOPE3_BUS,
.devfun = DRHD1_DEVSCOPE3_PATH
}
};
static struct dmar_drhd drhd_info_array[MAX_DRHDS] = {
{
.dev_cnt = DRHD0_DEV_CNT,
.segment = DRHD0_SEGMENT,
.flags = DRHD0_FLAGS,
.reg_base_addr = DRHD0_REG_BASE,
.ignore = DRHD0_IGNORE,
.devices = drhd0_dev_scope
},
{
.dev_cnt = DRHD1_DEV_CNT,
.segment = DRHD1_SEGMENT,
.flags = DRHD1_FLAGS,
.reg_base_addr = DRHD1_REG_BASE,
.ignore = DRHD1_IGNORE,
.devices = drhd1_dev_scope
},
};
static struct dmar_info plat_dmar_info = {
.drhd_count = DRHD_COUNT,
.drhd_units = drhd_info_array,
};
/**
* @post return != NULL
* @post return->drhd_count > 0U
*/
struct dmar_info *get_dmar_info(void)
{
#ifdef CONFIG_ACPI_PARSE_ENABLED
parse_dmar_table(&plat_dmar_info);
#endif
return &plat_dmar_info;
}