From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by mx.groups.io with SMTP id smtpd.web12.444.1644260588103486600 for ; Mon, 07 Feb 2022 11:03:08 -0800 Authentication-Results: mx.groups.io; dkim=fail reason="unable to parse pub key" header.i=@intel.com header.s=intel header.b=ePxzRgNo; spf=pass (domain: intel.com, ip: 134.134.136.65, mailfrom: isaac.w.oram@intel.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1644260588; x=1675796588; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=C1D4oqJ9HcvrDlZaUrhdl3mYq/bBS6gI5UVkrbqo6hs=; b=ePxzRgNo8/RHYG2xl9vapVJ6qxB/EqNZ38E5vfMoWqZrBUVMFcd0bQ2G mB5VhXIXZxHIjkTeao9zO0kFMA0OyY25wHoxRnjNpgv0hMRP+MSFcHRq0 /UWfSgUQ4BfMguq0TYMXzzo5QFEbldfz6mVcTUyA3taLqekAnmdB6Ii13 M0ewP1+BSS2I4GGwoEkx/5wmlGqrqXPvJdXw7AF22fGdZQ+sxeS94pKj/ 7oUFRcV7oV3kNxoTAGL2RULUwl13R7pQEkcKGNkY5bLL20F5Gmzjdg+vX EBf0xCfMSqcQU8ekAp4cbK+Bwgac1c1GwzDgFNM2UiBDBny4c8h4MFcFn w==; X-IronPort-AV: E=McAfee;i="6200,9189,10250"; a="248737314" X-IronPort-AV: E=Sophos;i="5.88,350,1635231600"; d="scan'208";a="248737314" Received: from orsmga001.jf.intel.com ([10.7.209.18]) by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 07 Feb 2022 11:02:52 -0800 X-IronPort-AV: E=Sophos;i="5.88,350,1635231600"; d="scan'208";a="567583960" Received: from iworam-desk.amr.corp.intel.com ([10.7.150.79]) by orsmga001-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 07 Feb 2022 11:02:52 -0800 From: "Oram, Isaac W" To: devel@edk2.groups.io Cc: Nate DeSimone , Chasel Chiu Subject: [edk2-devel][edk2-platforms][PATCH V1 7/8] WhitleyOpenBoardPkg/WilsonCityRvp: Generate AML offset table Date: Mon, 7 Feb 2022 11:02:44 -0800 Message-Id: <987586e418eca8caa7afd342ec344bf0897b444d.1644259969.git.isaac.w.oram@intel.com> X-Mailer: git-send-email 2.27.0.windows.1 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Add PreBuild step to generate the AML offset table for the ACPI tables. Cc: Nate DeSimone Cc: Chasel Chiu Signed-off-by: Isaac Oram --- Platform/Intel/.gitignore | 2 + Platform/Intel/WhitleyOpenBoardPkg/WilsonCityRvp/AmlOffsets.dsc | 41 +++++++++++++ Platform/Intel/WhitleyOpenBoardPkg/WilsonCityRvp/AmlOffsets/AmlOffsets.inf | 26 ++++++++ Platform/Intel/WhitleyOpenBoardPkg/WilsonCityRvp/build_board.py | 63 ++++++++++++++++++++ Platform/Intel/WhitleyOpenBoardPkg/WilsonCityRvp/build_config.cfg | 15 +++++ 5 files changed, 147 insertions(+) diff --git a/Platform/Intel/.gitignore b/Platform/Intel/.gitignore new file mode 100644 index 0000000000..548fee5bea --- /dev/null +++ b/Platform/Intel/.gitignore @@ -0,0 +1,2 @@ +WhitleyOpenBoardPkg/Uba/UbaMain/StaticSkuDataDxe/AmlOffsetTable.c +__init__.py diff --git a/Platform/Intel/WhitleyOpenBoardPkg/WilsonCityRvp/AmlOffsets.dsc b/Platform/Intel/WhitleyOpenBoardPkg/WilsonCityRvp/AmlOffsets.dsc new file mode 100644 index 0000000000..2e5ebf432a --- /dev/null +++ b/Platform/Intel/WhitleyOpenBoardPkg/WilsonCityRvp/AmlOffsets.dsc @@ -0,0 +1,41 @@ +## @file +# Build file for generating AML offset table +# +# @copyright +# Copyright (C) 2021 Intel Corporation. +# +# SPDX-License-Identifier: BSD-2-Clause-Patent +## + +[Defines] + PLATFORM_NAME = $(RP_PKG) + PLATFORM_GUID = D7EAF54D-C9B9-4075-89F0-71943DBCFA61 + PLATFORM_VERSION = 0.1 + DSC_SPECIFICATION = 0x00010005 + OUTPUT_DIRECTORY = Build/$(RP_PKG) + SUPPORTED_ARCHITECTURES = IA32|X64 + BUILD_TARGETS = DEBUG|RELEASE + PLATFORM_SI_PACKAGE = ClientOneSiliconPkg + DEFINE PLATFORM_SI_BIN_PACKAGE = WhitleySiliconBinPkg + PEI_ARCH = IA32 + DXE_ARCH = X64 + +!if $(CPUTARGET) == "CPX" + DEFINE FSP_BIN_PKG = CedarIslandFspBinPkg + DEFINE IIO_INSTANCE = Skx +!elseif $(CPUTARGET) == "ICX" + DEFINE FSP_BIN_PKG = WhitleyFspBinPkg + DEFINE IIO_INSTANCE = Icx +!else + DEFINE IIO_INSTANCE = UnknownCpu +!endif + + # + # Platform On/Off features are defined here + # + !include $(RP_PKG)/PlatformPkgConfig.dsc + +[Components.X64] + $(RP_PKG)/WilsonCityRvp/AmlOffsets/AmlOffsets.inf + +!include $(RP_PKG)/Include/Dsc/BuildOptions.dsc diff --git a/Platform/Intel/WhitleyOpenBoardPkg/WilsonCityRvp/AmlOffsets/AmlOffsets.inf b/Platform/Intel/WhitleyOpenBoardPkg/WilsonCityRvp/AmlOffsets/AmlOffsets.inf new file mode 100644 index 0000000000..8945f372e3 --- /dev/null +++ b/Platform/Intel/WhitleyOpenBoardPkg/WilsonCityRvp/AmlOffsets/AmlOffsets.inf @@ -0,0 +1,26 @@ +## @file +# Generate AML offset table EPRPPlatform10nm.offset.h via edk2 build +# +# @copyright +# Copyright (C) 2022 Intel Corporation. +# +# SPDX-License-Identifier: BSD-2-Clause-Patent +## + +[Defines] + INF_VERSION = 0x00010005 + BASE_NAME = AmlOffsets + FILE_GUID = d7641589-753a-44c5-91c2-bd09686205c6 + MODULE_TYPE = USER_DEFINED + VERSION_STRING = 1.0 + +[Sources] + WhitleyOpenBoardPkg/Features/Acpi/AcpiTables/Dsdt/EPRPPlatform10nm.asl + +[Packages] + MdePkg/MdePkg.dec + WhitleySiliconPkg/SiliconPkg.dec + +[BuildOptions] + # add -vr and -so to generate offset.h + *_*_*_ASL_FLAGS = -oi -vr -so diff --git a/Platform/Intel/WhitleyOpenBoardPkg/WilsonCityRvp/build_board.py b/Platform/Intel/WhitleyOpenBoardPkg/WilsonCityRvp/build_board.py index a0c31e4558..5f625f5f92 100644 --- a/Platform/Intel/WhitleyOpenBoardPkg/WilsonCityRvp/build_board.py +++ b/Platform/Intel/WhitleyOpenBoardPkg/WilsonCityRvp/build_board.py @@ -23,6 +23,7 @@ def pre_build_ex(config, functions): :returns: nothing """ print("pre_build_ex") + config["BUILD_DIR_PATH"] = os.path.join(config["WORKSPACE"], 'Build', config["PLATFORM_BOARD_PACKAGE"], @@ -53,6 +54,68 @@ def pre_build_ex(config, functions): if config.get("API_MODE_FSP_WRAPPER_BUILD", "FALSE") == "TRUE": raise ValueError("FSP API Mode is currently unsupported on Ice Lake Xeon Scalable") + + # Build the ACPI AML offset table *.offset.h + print("Info: re-generating PlatformOffset header files") + + execute_script = functions.get("execute_script") + + command = ["build", "-D", "MAX_SOCKET=" + config["MAX_SOCKET"]] + + if config["EXT_BUILD_FLAGS"] and config["EXT_BUILD_FLAGS"] != "": + ext_build_flags = config["EXT_BUILD_FLAGS"].split(" ") + ext_build_flags = [x.strip() for x in ext_build_flags] + ext_build_flags = [x for x in ext_build_flags if x != ""] + command.extend(ext_build_flags) + + aml_offsets_split = os.path.split(os.path.normpath(config["AML_OFFSETS_PATH"])) + command.append("-p") + command.append(os.path.normpath(config["AML_OFFSETS_PATH"]) + '.dsc') + command.append("-m") + command.append(os.path.join(aml_offsets_split[0], aml_offsets_split[1], aml_offsets_split[1] + '.inf')) + command.append("-y") + command.append(os.path.join(config["WORKSPACE"], "PreBuildReport.txt")) + command.append("--log=" + os.path.join(config["WORKSPACE"], "PreBuild.log")) + + _, _, _, code = execute_script(command, config) + if code != 0: + print(" ".join(command)) + print("Error re-generating PlatformOffset header files") + sys.exit(1) + + # Build AmlGenOffset command to consume the *.offset.h and produce AmlOffsetTable.c for StaticSkuDataDxe use. + + # Get destination path and filename from config + relative_file_path = os.path.normpath(config["STRIPPED_AML_OFFSETS_FILE_PATH"]) # get path relative to Platform/Intel + out_file_path = os.path.join(config["WORKSPACE_PLATFORM"], relative_file_path) # full path to output file + out_file_dir = os.path.dirname(out_file_path) # remove filename + + out_file_root_ext = os.path.splitext(os.path.basename(out_file_path)) # root and extension of output file + + # Get relative path for the generated offset.h file + relative_dsdt_file_path = os.path.normpath(config["DSDT_TABLE_FILE_PATH"]) # path relative to Platform/Intel + dsdt_file_root_ext = os.path.splitext(os.path.basename(relative_dsdt_file_path)) # root and extension of generated offset.h file + + # Generate output directory if it doesn't exist + if not os.path.exists(out_file_dir): + os.mkdir(out_file_dir) + + command = ["python", + os.path.join(config["MIN_PACKAGE_TOOLS"], "AmlGenOffset", "AmlGenOffset.py"), + "-d", "--aml_filter", config["AML_FILTER"], + "-o", out_file_path, + os.path.join(config["BUILD_X64"], aml_offsets_split[0], aml_offsets_split[1], aml_offsets_split[1], "OUTPUT", os.path.dirname(relative_dsdt_file_path), dsdt_file_root_ext[0] + ".offset.h")] + + # execute the command + _, _, _, code = execute_script(command, config) + if code != 0: + print(" ".join(command)) + print("Error re-generating PlatformOffset header files") + sys.exit(1) + + print("GenOffset done") + + return None def _merge_files(files, ofile): diff --git a/Platform/Intel/WhitleyOpenBoardPkg/WilsonCityRvp/build_config.cfg b/Platform/Intel/WhitleyOpenBoardPkg/WilsonCityRvp/build_config.cfg index 1676c08813..4cc9496153 100644 --- a/Platform/Intel/WhitleyOpenBoardPkg/WilsonCityRvp/build_config.cfg +++ b/Platform/Intel/WhitleyOpenBoardPkg/WilsonCityRvp/build_config.cfg @@ -34,3 +34,18 @@ FSP_BINARY_BUILD = FALSE FSP_TEST_RELEASE = FALSE SECURE_BOOT_ENABLE = FALSE BIOS_INFO_GUID = 4A4CA1C6-871C-45BB-8801-6910A7AA5807 + +# +# AML offset table generation configuration options +# All paths should use / and be relative to edk2-platforms/Platform/Intel +# +# AML_FILTER - AML filter is used to strip out unused AML offset data +# AML_OFFSETS_PATH - Path to INF file that builds AML offsets C source file +# The directory name, DSC file name, INF file name, and BASE_NAME must match identically +# DSDT_TABLE_FILE_PATH - Path to DSDT ASL file for the board +# STRIPPED_AML_OFFSETS_FILE_PATH - Target AML offset data file consumed by UBA driver +# +AML_FILTER = \"PSYS\" .\.DRVT\" .\.FIX[0-9,A-Z] BBI[0] BBU[0] CRCM BAR0 .\.CCT[0-9A-Z]\" .\.CFH[0-9A-Z]\" .\.FXCD\" .\.FXST\" .\.FXIN\" .\.FXOU\" .\.FXBS\" .\.FXFH\" .\.CENA\" .\.DRVT\" .\.CFIS\" {NULL }; +AML_OFFSETS_PATH = WhitleyOpenBoardPkg/WilsonCityRvp/AmlOffsets +DSDT_TABLE_FILE_PATH = WhitleyOpenBoardPkg/Features/Acpi/AcpiTables/Dsdt/EPRPPlatform10nm.asl +STRIPPED_AML_OFFSETS_FILE_PATH = WhitleyOpenBoardPkg/Uba/UbaMain/StaticSkuDataDxe/AmlOffsetTable.c -- 2.27.0.windows.1