From 97401d0dbcd71d34fee95e3d89736699e78a9c6b Mon Sep 17 00:00:00 2001 From: Heinrich Schuchardt Date: Sat, 20 Feb 2021 10:05:24 +0100 Subject: x86: sizeof-array-div error in lpc_common_early_init MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Building qemu-x86_64_defconfig with GCC 11.0 fails with: arch/x86/cpu/intel_common/lpc.c: In function ‘lpc_common_early_init’: arch/x86/cpu/intel_common/lpc.c:56:40: error: expression does not compute the number of elements in this array; element type is ‘struct reg_info’, not ‘u32’ {aka ‘unsigned int’} [-Werror=sizeof-array-div] 56 | sizeof(values) / sizeof(u32)); | ^ arch/x86/cpu/intel_common/lpc.c:56:40: note: add parentheses around the second ‘sizeof’ to silence this warning arch/x86/cpu/intel_common/lpc.c:50:11: note: array ‘values’ declared here 50 | } values[4], *ptr; | ^~~~~~ Add parentheses to silence warning. Signed-off-by: Heinrich Schuchardt Reviewed-by: Simon Glass Reviewed-by: Bin Meng --- arch/x86/cpu/intel_common/lpc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/x86/cpu/intel_common/lpc.c b/arch/x86/cpu/intel_common/lpc.c index 23befbef15f..f31fddb6fa8 100644 --- a/arch/x86/cpu/intel_common/lpc.c +++ b/arch/x86/cpu/intel_common/lpc.c @@ -53,7 +53,7 @@ int lpc_common_early_init(struct udevice *dev) count = fdtdec_get_int_array_count(gd->fdt_blob, dev_of_offset(dev), "intel,gen-dec", (u32 *)values, - sizeof(values) / sizeof(u32)); + sizeof(values) / (sizeof(u32))); if (count < 0) return -EINVAL; -- cgit v1.2.3 From 0b823e16b6b9443200faf9a51943642b3937ea99 Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Tue, 23 Feb 2021 05:35:40 -0500 Subject: x86: Fix member check in intel_gnvs When CONFIG_CHROMEOS is not enabled this currently does not build. Fix it. Reported-by: Heinrich Schuchardt Signed-off-by: Simon Glass Reviewed-by: Bin Meng --- arch/x86/include/asm/intel_gnvs.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/arch/x86/include/asm/intel_gnvs.h b/arch/x86/include/asm/intel_gnvs.h index 69a20812e5e..fc743dc9285 100644 --- a/arch/x86/include/asm/intel_gnvs.h +++ b/arch/x86/include/asm/intel_gnvs.h @@ -107,6 +107,10 @@ struct __packed acpi_global_nvs { u8 unused2[0x1000 - 0x100]; /* Pad out to 4096 bytes */ #endif }; +#ifdef CONFIG_CHROMEOS check_member(acpi_global_nvs, chromeos, GNVS_CHROMEOS_ACPI_OFFSET); +#else +check_member(acpi_global_nvs, unused2, GNVS_CHROMEOS_ACPI_OFFSET); +#endif #endif /* _INTEL_GNVS_H_ */ -- cgit v1.2.3 From 049c4dc677aa679593e1b2e9f0aa2452843dad5e Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Tue, 23 Feb 2021 05:35:41 -0500 Subject: x86: Move INTEL_ACPIGEN to arch/x86 This option is better placed in the x86 code since it is not generic enough to be in the core code. Move it. Reported-by: Heinrich Schuchardt Signed-off-by: Simon Glass Reviewed-by: Bin Meng [bmeng: fixed a typo in arch/x86/Kconfig] Signed-off-by: Bin Meng --- arch/x86/Kconfig | 9 +++++++++ drivers/core/Kconfig | 9 --------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig index eddf2a774ef..94081a1e9fc 100644 --- a/arch/x86/Kconfig +++ b/arch/x86/Kconfig @@ -1001,6 +1001,15 @@ config PCIEX_LENGTH_128MB config PCIEX_LENGTH_64MB bool +config INTEL_ACPIGEN + bool "Support ACPI table generation for Intel SoCs" + depends on ACPIGEN + help + This option adds some functions used for programmatic generation of + ACPI tables on Intel SoCs. This provides features for writing CPU + information such as P states and T stages. Also included is a way + to create a GNVS table and set it up. + config INTEL_GMA_ACPI bool "Generate ACPI table for Intel GMA graphics" help diff --git a/drivers/core/Kconfig b/drivers/core/Kconfig index 00554af4995..1eccac28c62 100644 --- a/drivers/core/Kconfig +++ b/drivers/core/Kconfig @@ -329,15 +329,6 @@ config ACPIGEN things like generating device-specific tables and returning the ACPI name of a device. -config INTEL_ACPIGEN - bool "Support ACPI table generation for Intel SoCs" - depends on ACPIGEN - help - This option adds some functions used for programatic generation of - ACPI tables on Intel SoCs. This provides features for writing CPU - information such as P states and T stages. Also included is a way - to create a GNVS table and set it up. - config BOUNCE_BUFFER bool "Include bounce buffer API" help -- cgit v1.2.3 From 736ecc643de4b329e2edcb3207edd58bf7ed0d9d Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Tue, 23 Feb 2021 05:35:42 -0500 Subject: x86: Select advanced Intel code only if allowed At present most of the Intel-specific code is built on all devices, even those which don't have software support for the features provided there. This means that any board can enable CONFIG_INTEL_ACPIGEN even if it does not have the required features. Add a new INTEL_SOC option to control this access. This must be selected by SoCs that can support the required features. Reported-by: Heinrich Schuchardt Signed-off-by: Simon Glass Reviewed-by: Bin Meng [bmeng: fixed a typo in arch/x86/Kconfig] Signed-off-by: Bin Meng --- arch/x86/Kconfig | 15 +++++++++++++++ arch/x86/cpu/apollolake/Kconfig | 1 + 2 files changed, 16 insertions(+) diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig index 94081a1e9fc..5b089af6994 100644 --- a/arch/x86/Kconfig +++ b/arch/x86/Kconfig @@ -1001,6 +1001,19 @@ config PCIEX_LENGTH_128MB config PCIEX_LENGTH_64MB bool +config INTEL_SOC + bool + help + This is enabled on Intel SoCs that can support various advanced + features such as power management (requiring asm/arch/pm.h), system + agent (asm/arch/systemagent.h) and an I/O map for ACPI + (asm/arch/iomap.h). + + This cannot be selected in a defconfig file. It must be enabled by a + 'select' in the SoC's Kconfig. + +if INTEL_SOC + config INTEL_ACPIGEN bool "Support ACPI table generation for Intel SoCs" depends on ACPIGEN @@ -1032,4 +1045,6 @@ config INTEL_GMA_SWSMISCI Select this option for Atom-based platforms which use the SWSMISCI register (0xe0) rather than the SWSCI register (0xe8). +endif # INTEL_SOC + endmenu diff --git a/arch/x86/cpu/apollolake/Kconfig b/arch/x86/cpu/apollolake/Kconfig index f5dbd6cbd34..590fe31dc4b 100644 --- a/arch/x86/cpu/apollolake/Kconfig +++ b/arch/x86/cpu/apollolake/Kconfig @@ -9,6 +9,7 @@ config INTEL_APOLLOLAKE select HAVE_FSP select ARCH_MISC_INIT select USE_CAR + select INTEL_SOC select INTEL_PMC select TPL_X86_TSC_TIMER_NATIVE select SPL_PCH_SUPPORT -- cgit v1.2.3