diff --git a/anolis/configs/L0-MANDATORY/riscv/CONFIG_DMI b/anolis/configs/L0-MANDATORY/riscv/CONFIG_DMI deleted file mode 100644 index 36b8a5b447aaeeb3bc73260b59fcd548c3603dd9..0000000000000000000000000000000000000000 --- a/anolis/configs/L0-MANDATORY/riscv/CONFIG_DMI +++ /dev/null @@ -1 +0,0 @@ -# CONFIG_DMI is not set diff --git a/anolis/configs/L1-RECOMMEND/riscv/CONFIG_DMI_SYSFS b/anolis/configs/L1-RECOMMEND/riscv/CONFIG_DMI_SYSFS deleted file mode 100644 index 04200dd8e5ff6406bbcdaacce9ca0737682fe70b..0000000000000000000000000000000000000000 --- a/anolis/configs/L1-RECOMMEND/riscv/CONFIG_DMI_SYSFS +++ /dev/null @@ -1 +0,0 @@ -# CONFIG_DMI_SYSFS is not set diff --git a/anolis/configs/L1-RECOMMEND/riscv/CONFIG_IPMI_DMI_DECODE b/anolis/configs/L1-RECOMMEND/riscv/CONFIG_IPMI_DMI_DECODE deleted file mode 100644 index a7acc7de0c5d28f69ac46ba37e474e8845b0016d..0000000000000000000000000000000000000000 --- a/anolis/configs/L1-RECOMMEND/riscv/CONFIG_IPMI_DMI_DECODE +++ /dev/null @@ -1 +0,0 @@ -# CONFIG_IPMI_DMI_DECODE is not set diff --git a/arch/riscv/Kconfig b/arch/riscv/Kconfig index c3c4394976585a1d676954c11649c93307434398..e50b8c381ea4a91bcd56f06ab1d4e76863a54826 100644 --- a/arch/riscv/Kconfig +++ b/arch/riscv/Kconfig @@ -848,6 +848,17 @@ config EFI allow the kernel to be booted as an EFI application. This is only useful on systems that have UEFI firmware. +config DMI + bool "Enable support for SMBIOS (DMI) tables" + depends on EFI + default y + help + This enables SMBIOS/DMI feature for systems. + + This option is only useful on systems that have UEFI firmware. + However, even with this option, the resultant kernel should + continue to boot on existing non-UEFI platforms. + config CC_HAVE_STACKPROTECTOR_TLS def_bool $(cc-option,-mstack-protector-guard=tls -mstack-protector-guard-reg=tp -mstack-protector-guard-offset=0) diff --git a/arch/riscv/include/asm/dmi.h b/arch/riscv/include/asm/dmi.h new file mode 100644 index 0000000000000000000000000000000000000000..ca7cce557ef7d81a2a7eb2d1e502719651bd4ea1 --- /dev/null +++ b/arch/riscv/include/asm/dmi.h @@ -0,0 +1,24 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* + * Copyright (C) 2024 Intel Corporation + * + * based on arch/arm64/include/asm/dmi.h + * + * This file is subject to the terms and conditions of the GNU General Public + * License. See the file "COPYING" in the main directory of this archive + * for more details. + */ + +#ifndef __ASM_DMI_H +#define __ASM_DMI_H + +#include +#include + +#define dmi_early_remap(x, l) memremap(x, l, MEMREMAP_WB) +#define dmi_early_unmap(x, l) memunmap(x) +#define dmi_remap(x, l) memremap(x, l, MEMREMAP_WB) +#define dmi_unmap(x) memunmap(x) +#define dmi_alloc(l) kzalloc(l, GFP_KERNEL) + +#endif diff --git a/drivers/firmware/efi/riscv-runtime.c b/drivers/firmware/efi/riscv-runtime.c index 01f0f90ea4183119b0a4eedf82a3fe81f1b2f480..fa71cd898120302c8e8787f1032c9f60733b02c6 100644 --- a/drivers/firmware/efi/riscv-runtime.c +++ b/drivers/firmware/efi/riscv-runtime.c @@ -152,3 +152,16 @@ void arch_efi_call_virt_teardown(void) { efi_virtmap_unload(); } + +static int __init riscv_dmi_init(void) +{ + /* + * On riscv, DMI depends on UEFI, and dmi_setup() needs to + * be called early because dmi_id_init(), which is an arch_initcall + * itself, depends on dmi_scan_machine() having been called already. + */ + dmi_setup(); + + return 0; +} +core_initcall(riscv_dmi_init);