Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

MIPS: Add support for Desktop Management Interface (DMI)

Enable DMI scanning on the MIPS architecture, this setups DMI identifiers
(dmi_system_id) for printing it out on task dumps and prepares DIMM entry
information (dmi_memdev_info) from the SMBIOS table. With this patch, the
driver can easily match various of mainboards.

In the SMBIOS reference specification, the table anchor string "_SM_" is
present in the address range 0xF0000 to 0xFFFFF on a 16-byte boundary,
but there exists a special case for Loongson platform, when call function
dmi_early_remap, it should specify the start address to 0xFFFE000 due to
it is reserved for SMBIOS and can be normally access in the BIOS.

This patch works fine on the Loongson 3A3000 platform which belongs to
MIPS architecture and has no influence on the other architectures such
as x86 and ARM.

Additionally, in order to avoid the unknown risks on the mips platform
which is not MACH_LOONGSON64, the DMI config is better to depend on
MACH_LOONGSON64. If other mips platform also needs this DMI feature in
the future, the "depends on" condition can be modified.

Co-developed-by: Yinglu Yang <yangyinglu@loongson.cn>
Signed-off-by: Yinglu Yang <yangyinglu@loongson.cn>
[jiaxun.yang@flygoat.com: Refine definitions and Kconfig]
Signed-off-by: Jiaxun Yang <jiaxun.yang@flygoat.com>
Signed-off-by: Tiezhu Yang <yangtiezhu@loongson.cn>
Reviewed-by: Huacai Chen <chenhc@lemote.com>
Signed-off-by: Thomas Bogendoerfer <tsbogend@alpha.franken.de>

authored by

Tiezhu Yang and committed by
Thomas Bogendoerfer
be8fa1cb 3da27a4e

+33
+11
arch/mips/Kconfig
··· 2758 2758 Enable hardware performance counter support for perf events. If 2759 2759 disabled, perf events will use software events only. 2760 2760 2761 + config DMI 2762 + bool "Enable DMI scanning" 2763 + depends on MACH_LOONGSON64 2764 + select DMI_SCAN_MACHINE_NON_EFI_FALLBACK 2765 + default y 2766 + help 2767 + Enabled scanning of DMI to identify machine quirks. Say Y 2768 + here unless you have verified that your setup is not 2769 + affected by entries in the DMI blacklist. Required by PNP 2770 + BIOS code. 2771 + 2761 2772 config SMP 2762 2773 bool "Multi-Processing support" 2763 2774 depends on SYS_SUPPORTS_SMP
+20
arch/mips/include/asm/dmi.h
··· 1 + /* SPDX-License-Identifier: GPL-2.0 */ 2 + #ifndef _ASM_DMI_H 3 + #define _ASM_DMI_H 4 + 5 + #include <linux/io.h> 6 + #include <linux/memblock.h> 7 + 8 + #define dmi_early_remap(x, l) ioremap_cache(x, l) 9 + #define dmi_early_unmap(x, l) iounmap(x) 10 + #define dmi_remap(x, l) ioremap_cache(x, l) 11 + #define dmi_unmap(x) iounmap(x) 12 + 13 + /* MIPS initialize DMI scan before SLAB is ready, so we use memblock here */ 14 + #define dmi_alloc(l) memblock_alloc_low(l, PAGE_SIZE) 15 + 16 + #if defined(CONFIG_MACH_LOONGSON64) 17 + #define SMBIOS_ENTRY_POINT_SCAN_START 0xFFFE000 18 + #endif 19 + 20 + #endif /* _ASM_DMI_H */
+2
arch/mips/kernel/setup.c
··· 28 28 #include <linux/decompress/generic.h> 29 29 #include <linux/of_fdt.h> 30 30 #include <linux/of_reserved_mem.h> 31 + #include <linux/dmi.h> 31 32 32 33 #include <asm/addrspace.h> 33 34 #include <asm/bootinfo.h> ··· 800 799 #endif 801 800 802 801 arch_mem_init(cmdline_p); 802 + dmi_setup(); 803 803 804 804 resource_init(); 805 805 plat_smp_setup();