Received: by 2002:a25:31c3:0:0:0:0:0 with SMTP id x186csp6198993ybx; Mon, 11 Nov 2019 05:32:43 -0800 (PST) X-Google-Smtp-Source: APXvYqwk5+85GpUzrPpYkns1pa77AUC8vbonbcDlxFjzIM4AUIONFpnrRQFxUTa+tz1/EpRQ7mZG X-Received: by 2002:aa7:c2c7:: with SMTP id m7mr26418315edp.295.1573479163052; Mon, 11 Nov 2019 05:32:43 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1573479163; cv=none; d=google.com; s=arc-20160816; b=AQYCazQsYxO5FO0p5TNCmnT8X/2jzj8qf4GVzbkPvhknPphljpA+GUEAur5nyP6Jpc DJ/BXeGTquoEc1OS9KBess1fu7AJt9PNySbU9hUXtlOBNkwd2i2B3EF8BaI2oEKxCDe9 vK8x0axJgRBsJJOYyFvQgrcrPlg1QMQ9w60IrENvfUW6quJfIjaDRA4KrfaVbm1SM3Go AE5DAUS7N6hHwS5C0JEXL5zpQTtCxYwoPuRKQf0Adj/nfVLK4iVw4onYQ68BkjYk5KoS d3XDeIXdvZLdBSTEzr1fUE7T0lURpLxJI7WZpCYwHSZUhMqchXPrCd8PwM3pjpvgc8QJ u/hw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from; bh=fNiLjD6zxXVtemVAPfd2iO44xcNBwE3jdibzifOpINo=; b=QdnHCENrnDVs7uwec4TpUd6au8I5y2H34E1KdIDwC3NP71ib3YoFDzV/NSU2MgNdnC +Gj7mf4g5AIYpkiBHhiMDp9dpX5OiMPiSNQmw/bamFoKEJBauKgAx33bVF0UNrc9rr1y WDURjF/1aJFKhH5bLA6zeDoGPPevu9o85KQ9t6x3XrA9ryUsLl2KBK0qAF3NVX9oYqOX FTbzacruEDBw2GX38Yf4OXl+gnX11qe4xpzA/JivjClHAZadc4S/PnCJonDL4XAdyApn q2rcBdgJtXKlGcaSFiU9YsW3spECupr8byMDlHluRFEtJfhwNelMHLarPpbSOV5HK5f/ jKZg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h53si11017987edh.200.2019.11.11.05.32.19; Mon, 11 Nov 2019 05:32:43 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727181AbfKKNaf (ORCPT + 99 others); Mon, 11 Nov 2019 08:30:35 -0500 Received: from mail.loongson.cn ([114.242.206.163]:38441 "EHLO mail.loongson.cn" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726986AbfKKNae (ORCPT ); Mon, 11 Nov 2019 08:30:34 -0500 Received: from linux.loongson.cn (unknown [10.20.41.27]) by mail (Coremail) with SMTP id QMiowPDx_1tI0sldUhcAAA--.3S2; Tue, 12 Nov 2019 05:27:36 +0800 (CST) From: Tiezhu Yang To: Paul Burton , Ralf Baechle , James Hogan , Jean Delvare Cc: linux-mips@vger.kernel.org, linux-kernel@vger.kernel.org, Xuefeng Li , Yinglu Yang , Jiaxun Yang Subject: [PATCH v2] MIPS: Scan the DMI system information Date: Mon, 11 Nov 2019 21:29:45 +0800 Message-Id: <1573478985-3535-1-git-send-email-yangtiezhu@loongson.cn> X-Mailer: git-send-email 2.1.0 X-CM-TRANSID: QMiowPDx_1tI0sldUhcAAA--.3S2 X-Coremail-Antispam: 1UD129KBjvJXoWxCr4xAw4rtFy7Zw45AF17GFg_yoWrCryrpF 4DA3Z5tr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kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. Co-developed-by: Yinglu Yang Signed-off-by: Yinglu Yang [jiaxun.yang@flygoat.com: Refine definitions and Kconfig] Signed-off-by: Jiaxun Yang Signed-off-by: Tiezhu Yang --- v2: - add SMBIOS_ENTRY_POINT_SCAN_START suggested by Jean - refine definitions and Kconfig by Jiaxun arch/mips/Kconfig | 10 ++++++++++ arch/mips/include/asm/dmi.h | 20 ++++++++++++++++++++ arch/mips/kernel/setup.c | 2 ++ drivers/firmware/dmi_scan.c | 6 +++++- 4 files changed, 37 insertions(+), 1 deletion(-) create mode 100644 arch/mips/include/asm/dmi.h diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig index 7cb8947..6393551 100644 --- a/arch/mips/Kconfig +++ b/arch/mips/Kconfig @@ -2757,6 +2757,16 @@ config HW_PERF_EVENTS Enable hardware performance counter support for perf events. If disabled, perf events will use software events only. +config DMI + default y if MACH_LOONGSON64 + select DMI_SCAN_MACHINE_NON_EFI_FALLBACK + bool "Enable DMI scanning" + help + Enabled scanning of DMI to identify machine quirks. Say Y + here unless you have verified that your setup is not + affected by entries in the DMI blacklist. Required by PNP + BIOS code. + config SMP bool "Multi-Processing support" depends on SYS_SUPPORTS_SMP diff --git a/arch/mips/include/asm/dmi.h b/arch/mips/include/asm/dmi.h new file mode 100644 index 0000000..27415a2 --- /dev/null +++ b/arch/mips/include/asm/dmi.h @@ -0,0 +1,20 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +#ifndef _ASM_DMI_H +#define _ASM_DMI_H + +#include +#include + +#define dmi_early_remap(x, l) ioremap_cache(x, l) +#define dmi_early_unmap(x, l) iounmap(x) +#define dmi_remap(x, l) ioremap_cache(x, l) +#define dmi_unmap(x) iounmap(x) + +/* MIPS initialize DMI scan before SLAB is ready, so we use memblock here */ +#define dmi_alloc(l) memblock_alloc_low(l, PAGE_SIZE) + +#if defined(CONFIG_MACH_LOONGSON64) +#define SMBIOS_ENTRY_POINT_SCAN_START 0xFFFE000 +#endif + +#endif /* _ASM_DMI_H */ diff --git a/arch/mips/kernel/setup.c b/arch/mips/kernel/setup.c index c3d4212..da7d312 100644 --- a/arch/mips/kernel/setup.c +++ b/arch/mips/kernel/setup.c @@ -28,6 +28,7 @@ #include #include #include +#include #include #include @@ -802,6 +803,7 @@ void __init setup_arch(char **cmdline_p) #endif arch_mem_init(cmdline_p); + dmi_setup(); resource_init(); plat_smp_setup(); diff --git a/drivers/firmware/dmi_scan.c b/drivers/firmware/dmi_scan.c index 35ed56b..161bbf1 100644 --- a/drivers/firmware/dmi_scan.c +++ b/drivers/firmware/dmi_scan.c @@ -11,6 +11,10 @@ #include #include +#ifndef SMBIOS_ENTRY_POINT_SCAN_START +#define SMBIOS_ENTRY_POINT_SCAN_START 0xF0000 +#endif + struct kobject *dmi_kobj; EXPORT_SYMBOL_GPL(dmi_kobj); @@ -661,7 +665,7 @@ static void __init dmi_scan_machine(void) return; } } else if (IS_ENABLED(CONFIG_DMI_SCAN_MACHINE_NON_EFI_FALLBACK)) { - p = dmi_early_remap(0xF0000, 0x10000); + p = dmi_early_remap(SMBIOS_ENTRY_POINT_SCAN_START, 0x10000); if (p == NULL) goto error; -- 2.1.0