From c00d959d43e1f9cf23c15838c58b7cae8f2350b2 Mon Sep 17 00:00:00 2001 From: Minggui Cao Date: Wed, 2 Jan 2019 16:23:01 +0800 Subject: [PATCH] HV: separate const dmar table definition from sbl const dmar table is used for sbl board, and it can be a single/independable file. Tracked-On: #1842 Signed-off-by: Minggui Cao Acked-by: Eddie Dong --- hypervisor/Makefile | 1 + hypervisor/bsp/sbl/const_dmar.c | 134 ++++++++++++++++++++++++++++++++ hypervisor/bsp/sbl/sbl.c | 127 ------------------------------ 3 files changed, 135 insertions(+), 127 deletions(-) create mode 100644 hypervisor/bsp/sbl/const_dmar.c diff --git a/hypervisor/Makefile b/hypervisor/Makefile index 941c110fb..cb9bbe218 100644 --- a/hypervisor/Makefile +++ b/hypervisor/Makefile @@ -221,6 +221,7 @@ TEMPLATE_ACPI_INFO_HEADER := bsp/include/uefi/platform_acpi_info.h else ifeq ($(CONFIG_PLATFORM_SBL),y) C_SRCS += bsp/sbl/sbl.c +C_SRCS += bsp/sbl/const_dmar.c C_SRCS += boot/sbl/multiboot.c C_SRCS += boot/sbl/sbl_seed_parse.c C_SRCS += boot/sbl/abl_seed_parse.c diff --git a/hypervisor/bsp/sbl/const_dmar.c b/hypervisor/bsp/sbl/const_dmar.c new file mode 100644 index 000000000..dfebb8999 --- /dev/null +++ b/hypervisor/bsp/sbl/const_dmar.c @@ -0,0 +1,134 @@ +/* + * Copyright (C) 2018 Intel Corporation. All rights reserved. + * + * SPDX-License-Identifier: BSD-3-Clause + */ + +#include + +#ifndef CONFIG_DMAR_PARSE_ENABLED + +#define MAX_DRHDS 4 +#define MAX_DRHD_DEVSCOPES 4 + +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] = { + { + .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_dev_scope drhd2_dev_scope[MAX_DRHD_DEVSCOPES] = { + { + .bus = DRHD2_DEVSCOPE0_BUS, + .devfun = DRHD2_DEVSCOPE0_PATH + }, + { + .bus = DRHD2_DEVSCOPE1_BUS, + .devfun = DRHD2_DEVSCOPE1_PATH + }, + { + .bus = DRHD2_DEVSCOPE2_BUS, + .devfun = DRHD2_DEVSCOPE2_PATH + }, + { + .bus = DRHD2_DEVSCOPE3_BUS, + .devfun = DRHD2_DEVSCOPE3_PATH + } +}; + +static struct dmar_dev_scope drhd3_dev_scope[MAX_DRHD_DEVSCOPES] = { + { + .bus = DRHD3_DEVSCOPE0_BUS, + .devfun = DRHD3_DEVSCOPE0_PATH + }, + { + .bus = DRHD3_DEVSCOPE1_BUS, + .devfun = DRHD3_DEVSCOPE1_PATH + }, + { + .bus = DRHD3_DEVSCOPE2_BUS, + .devfun = DRHD3_DEVSCOPE2_PATH + }, + { + .bus = DRHD3_DEVSCOPE3_BUS, + .devfun = DRHD3_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 + }, + { + .dev_cnt = DRHD2_DEV_CNT, + .segment = DRHD2_SEGMENT, + .flags = DRHD2_FLAGS, + .reg_base_addr = DRHD2_REG_BASE, + .ignore = DRHD2_IGNORE, + .devices = drhd2_dev_scope + }, + { + .dev_cnt = DRHD3_DEV_CNT, + .segment = DRHD3_SEGMENT, + .flags = DRHD3_FLAGS, + .reg_base_addr = DRHD3_REG_BASE, + .ignore = DRHD3_IGNORE, + .devices = drhd3_dev_scope + } +}; + +static struct dmar_info sbl_dmar_info = { + .drhd_count = DRHD_COUNT, + .drhd_units = drhd_info_array, +}; + +struct dmar_info *get_dmar_info(void) +{ + return &sbl_dmar_info; +} +#endif diff --git a/hypervisor/bsp/sbl/sbl.c b/hypervisor/bsp/sbl/sbl.c index edd37851c..f8ab7d751 100644 --- a/hypervisor/bsp/sbl/sbl.c +++ b/hypervisor/bsp/sbl/sbl.c @@ -6,133 +6,6 @@ #include -#ifndef CONFIG_DMAR_PARSE_ENABLED - -#define MAX_DRHDS 4 -#define MAX_DRHD_DEVSCOPES 4 - -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] = { - { - .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_dev_scope drhd2_dev_scope[MAX_DRHD_DEVSCOPES] = { - { - .bus = DRHD2_DEVSCOPE0_BUS, - .devfun = DRHD2_DEVSCOPE0_PATH - }, - { - .bus = DRHD2_DEVSCOPE1_BUS, - .devfun = DRHD2_DEVSCOPE1_PATH - }, - { - .bus = DRHD2_DEVSCOPE2_BUS, - .devfun = DRHD2_DEVSCOPE2_PATH - }, - { - .bus = DRHD2_DEVSCOPE3_BUS, - .devfun = DRHD2_DEVSCOPE3_PATH - } -}; - -static struct dmar_dev_scope drhd3_dev_scope[MAX_DRHD_DEVSCOPES] = { - { - .bus = DRHD3_DEVSCOPE0_BUS, - .devfun = DRHD3_DEVSCOPE0_PATH - }, - { - .bus = DRHD3_DEVSCOPE1_BUS, - .devfun = DRHD3_DEVSCOPE1_PATH - }, - { - .bus = DRHD3_DEVSCOPE2_BUS, - .devfun = DRHD3_DEVSCOPE2_PATH - }, - { - .bus = DRHD3_DEVSCOPE3_BUS, - .devfun = DRHD3_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 - }, - { - .dev_cnt = DRHD2_DEV_CNT, - .segment = DRHD2_SEGMENT, - .flags = DRHD2_FLAGS, - .reg_base_addr = DRHD2_REG_BASE, - .ignore = DRHD2_IGNORE, - .devices = drhd2_dev_scope - }, - { - .dev_cnt = DRHD3_DEV_CNT, - .segment = DRHD3_SEGMENT, - .flags = DRHD3_FLAGS, - .reg_base_addr = DRHD3_REG_BASE, - .ignore = DRHD3_IGNORE, - .devices = drhd3_dev_scope - } -}; - -static struct dmar_info sbl_dmar_info = { - .drhd_count = DRHD_COUNT, - .drhd_units = drhd_info_array, -}; - -struct dmar_info *get_dmar_info(void) -{ - return &sbl_dmar_info; -} -#endif - void init_bsp(void) { #ifndef CONFIG_CONSTANT_ACPI