kconfig: optionally check if the ACPI info header is validated

Instead of using the ACPI info template in the source tree, this patch requires
a board-specific ACPI info header to be created by the user and placed under
bsp/include. Currently we'll fall back to the current platform-specific template
if such board-specific info is not available.

A configuration symbol ACPI_ENFORCE_VALIDATED_ACPI_INFO is also added to enforce
the existance of board-specific ACPI info header. Default configurations can set
this symbol if the template does not work on a board.

Updates to the getting started guide will be updated accordingly after the
offline tools to generate such header is available.

v2 -> v3:

* Rephrase the ACPI-info-related messages.

v1 -> v2:

* The generated header should depend on .config so that whenever any
  configuration changes, this header will be remade.

Tracked-On: #1520
Signed-off-by: Junjie Mao <junjie.mao@intel.com>
Reviewed-by: Victor Sun <victor.sun@intel.com>
Reviewed-by: Anthony Xu <anthony.xu@intel.com>
This commit is contained in:
Junjie Mao 2018-10-19 23:03:55 +08:00 committed by lijinxia
parent 5f6a10f1e1
commit 8873859ade
2 changed files with 38 additions and 2 deletions

View File

@ -101,7 +101,6 @@ INCLUDE_PATH += include/debug
INCLUDE_PATH += include/public
INCLUDE_PATH += include/dm
INCLUDE_PATH += bsp/include
INCLUDE_PATH += bsp/include/$(CONFIG_PLATFORM)
INCLUDE_PATH += boot/include
INCLUDE_PATH += $(HV_OBJDIR)/include
@ -227,6 +226,34 @@ S_OBJS := $(patsubst %.S,$(HV_OBJDIR)/%.o,$(S_SRCS))
DISTCLEAN_OBJS := $(shell find $(BASEDIR) -name '*.o')
VERSION := $(HV_OBJDIR)/include/version.h
# Create platform_acpi_info.h
SOURCE_ACPI_INFO_HEADER := bsp/include/$(CONFIG_BOARD)_acpi_info.h
TEMPLATE_ACPI_INFO_HEADER := bsp/include/$(CONFIG_PLATFORM)/platform_acpi_info.h
TARGET_ACPI_INFO_HEADER := $(HV_OBJDIR)/include/platform_acpi_info.h
$(TARGET_ACPI_INFO_HEADER): $(HV_OBJDIR)/$(HV_CONFIG)
ifeq (,$(wildcard $(SOURCE_ACPI_INFO_HEADER)))
@echo "******* No ACPI info found *******" && \
echo "Expected ACPI info header at $(SOURCE_ACPI_INFO_HEADER)" && \
echo "" && \
echo "The ACPI info header for this board is not available. Please use" && \
echo "an offline tool on the target board to generate a validated one." && \
echo "More details will be available soon."
ifdef CONFIG_ENFORCE_VALIDATED_ACPI_INFO
@echo "" && \
echo "If you want to build the hypervisor with the template ACPI info," && \
echo "unset ENFORCE_VALIDATED_ACPI_INFO using 'make menuconfig'." && \
false
else
@echo "" && \
echo "Using the template at $(TEMPLATE_ACPI_INFO_HEADER) instead" && \
echo "**********************************"
@cp $(TEMPLATE_ACPI_INFO_HEADER) $(TARGET_ACPI_INFO_HEADER)
endif
else
@cp $(SOURCE_ACPI_INFO_HEADER) $(TARGET_ACPI_INFO_HEADER)
endif
.PHONY: all
all: $(HV_OBJDIR)/$(HV_FILE).32.out $(HV_OBJDIR)/$(HV_FILE).bin
@ -301,7 +328,7 @@ $(VERSION):
-include $(C_OBJS:.o=.d)
-include $(S_OBJS:.o=.d)
$(HV_OBJDIR)/%.o: %.c $(VERSION) $(HV_OBJDIR)/$(HV_CONFIG_H)
$(HV_OBJDIR)/%.o: %.c $(VERSION) $(HV_OBJDIR)/$(HV_CONFIG_H) $(TARGET_ACPI_INFO_HEADER)
[ ! -e $@ ] && mkdir -p $(dir $@); \
$(CC) $(patsubst %, -I%, $(INCLUDE_PATH)) -I. -c $(CFLAGS) $(ARCH_CFLAGS) $< -o $@ -MMD -MT $@

View File

@ -291,3 +291,12 @@ config MAX_MSIX_TABLE_NUM
int "Maximum number of MSI-X Table per device"
range 1 2048
default 16
config ENFORCE_VALIDATED_ACPI_INFO
bool "Enforce validated ACPI info table"
default n
help
When set, validated ACPI info tables is enforced and using offline
tools to generate such data is required. Otherwise a warning will be
printed when validated ACPI info is unavailable, but a binary can
still be built with the ACPI info template.