From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751982Ab1CQN57 (ORCPT ); Thu, 17 Mar 2011 09:57:59 -0400 Received: from mx1.redhat.com ([209.132.183.28]:5119 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750779Ab1CQN54 (ORCPT ); Thu, 17 Mar 2011 09:57:56 -0400 Date: Thu, 17 Mar 2011 09:57:54 -0400 From: Prarit Bhargava To: linux-kernel@vger.kernel.org, dzickus@redhat.com Cc: Prarit Bhargava Message-Id: <20110317135754.25241.88177.sendpatchset@prarit.bos.redhat.com> Content-Type: text/plain; charset=us-ascii Subject: [PATCH]: SMBIOS: Add initial code and export version via sysfs Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The existing DMI code, drivers/firmware/dmi.c, is not really parsing DMI. It is actually SMBIOS code that is using the old DMI infrastructure to expose SMBIOS entries. We should be doing the following: 1. Looking for SMBIOS (either EFI or mapped to it's standard location, 0xF0000) 2. If found, look for the SMBIOS' Intermediate Structure (aka "DMI" entry) 3. If not found, look for an "old" DMI structure. DMI is a predecessor of SMBIOS, so we should start treating it as such. For this patch I have introduced drivers/firmware/smbios.c, exported the SMBIOS version through sysfs, and modified the DMI code such that a) dmi_scan_machine() is now called from init_smbios(), and b) if an SMBIOS is found, the values in the SMBIOS STEP structure are used in dmi_scan_machine(). Right now, removing the DMI code is not an option. It is used by common initscripts, etc., to bringup the system. Later modifications in this area will include additional parsing of the SMBIOS structs and a simultaneous cleanup of the DMI code. Signed-off-by: Prarit Bhargava diff --git a/arch/ia64/Kconfig b/arch/ia64/Kconfig index fcf3b43..ff2f1a3 100644 --- a/arch/ia64/Kconfig +++ b/arch/ia64/Kconfig @@ -94,6 +94,11 @@ config HAVE_SETUP_PER_CPU_AREA config DMI bool + depends on SMBIOS + default y + +config SMBIOS + bool default y config EFI diff --git a/arch/ia64/include/asm/smbios.h b/arch/ia64/include/asm/smbios.h new file mode 100644 index 0000000..cf04e8a --- /dev/null +++ b/arch/ia64/include/asm/smbios.h @@ -0,0 +1,12 @@ +#ifndef _ASM_SMBIOS_H +#define _ASM_SMBIOS_H + +#include +#include + +/* Use normal IO mappings for SMBIOS */ +#define smbios_ioremap ioremap +#define smbios_iounmap(x, l) iounmap(x) +#define smbios_alloc(l) kmalloc(l, GFP_ATOMIC) + +#endif diff --git a/arch/ia64/kernel/setup.c b/arch/ia64/kernel/setup.c index 911cf97..1bdb320 100644 --- a/arch/ia64/kernel/setup.c +++ b/arch/ia64/kernel/setup.c @@ -1061,9 +1061,9 @@ check_bugs (void) (unsigned long) __end___mckinley_e9_bundles); } -static int __init run_dmi_scan(void) +static int __init run_smbios_scan(void) { - dmi_scan_machine(); + init_smbios(); return 0; } -core_initcall(run_dmi_scan); +core_initcall(run_smbios_scan); diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig index f8958b0..9d70dcd 100644 --- a/arch/x86/Kconfig +++ b/arch/x86/Kconfig @@ -637,6 +637,7 @@ config APB_TIMER # The code disables itself when not needed. config DMI default y + depends on SMBIOS bool "Enable DMI scanning" if EXPERT ---help--- Enabled scanning of DMI to identify machine quirks. Say Y @@ -644,6 +645,17 @@ config DMI affected by entries in the DMI blacklist. Required by PNP BIOS code. +# Mark as expert because too many people got it wrong. +# The code disables itself when not needed. +config SMBIOS + default y + bool "Enable SMBIOS scan" if EXPERT + ---help--- + Enables scanning of SMBIOS to identify machine quirks. Say Y + here unless you have verified that your setup is not + affected by entries in the DMI and SMBIOS blacklists. Required by + PNP BIOS code + config GART_IOMMU bool "GART IOMMU support" if EXPERT default y diff --git a/arch/x86/include/asm/smbios.h b/arch/x86/include/asm/smbios.h new file mode 100644 index 0000000..c5819ce --- /dev/null +++ b/arch/x86/include/asm/smbios.h @@ -0,0 +1,19 @@ +#ifndef _ASM_X86_SMBIOS_H +#define _ASM_X86_SMBIOS_H + +#include +#include + +#include +#include + +static __always_inline __init void *smbios_alloc(unsigned len) +{ + return extend_brk(len, sizeof(int)); +} + +/* Use early IO mappings for SMIBIOS because it's initialized early */ +#define smbios_ioremap early_ioremap +#define smbios_iounmap early_iounmap + +#endif /* _ASM_X86_SMBIOS_H */ diff --git a/arch/x86/kernel/setup.c b/arch/x86/kernel/setup.c index b176f2b..a84930f 100644 --- a/arch/x86/kernel/setup.c +++ b/arch/x86/kernel/setup.c @@ -68,6 +68,7 @@ #include #include #include +#include #include