linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Matt Domsch <Matt_Domsch@dell.com>
To: linux-ia64@vger.kernel.org, ak@suse.de,
	openipmi-developer@lists.sourceforge.net, akpm@osdl.org
Cc: linux-kernel@vger.kernel.org
Subject: [PATCH 2.6.15] ia64: use i386 dmi_scan.c
Date: Fri, 6 Jan 2006 11:21:40 -0600	[thread overview]
Message-ID: <20060106172140.GB19605@lists.us.dell.com> (raw)
In-Reply-To: <20060104221627.GA26064@lists.us.dell.com>

Enable DMI table parsing on ia64.

Andi Kleen has a patch in his x86_64 tree which enables the use of
i386 dmi_scan.c on x86_64.  dmi_scan.c functions are being used by the
drivers/char/ipmi/ipmi_si_intf.c driver for autodetecting the ports or
memory spaces where the IPMI controllers may be found.
 
This patch adds equivalent changes for ia64 as to what is in the
x86_64 tree.  In addition, I reworked the DMI detection, such that on
EFI-capable systems, it uses the efi.smbios pointer to find the table,
rather than brute-force searching from 0xF0000.  On non-EFI systems,
it continues the brute-force search.

My test system, an Intel S870BN4 'Tiger4', aka Dell PowerEdge 7250,
with latest BIOS, does not list the IPMI controller in the ACPI
namespace, nor does it have an ACPI SPMI table.  Also note, currently
shipping Dell x8xx EM64T servers don't have these either, so DMI is
the only method for obtaining the address of the IPMI controller.

Tested on ia64 with 2.6.15, plus the 'dmi' patch from
ftp://ftp.firstfloor.org/pub/ak/x86_64/quilt which Andi has queued for
submission for 2.6.16, plus a patch to ipmi_si_intf.c which will
follow separately.
 
Signed-off-by: Matt Domsch <Matt_Domsch@dell.com>

-- 
Matt Domsch
Software Architect
Dell Linux Solutions linux.dell.com & www.dell.com/linux
Linux on Dell mailing lists @ http://lists.us.dell.com

diff --git a/arch/i386/kernel/dmi_scan.c b/arch/i386/kernel/dmi_scan.c
index 6a93d75..87fd0a1 100644
--- a/arch/i386/kernel/dmi_scan.c
+++ b/arch/i386/kernel/dmi_scan.c
@@ -5,6 +5,7 @@
 #include <linux/dmi.h>
 #include <linux/bootmem.h>
 #include <linux/slab.h>
+#include <linux/efi.h>
 
 static char * __init dmi_string(struct dmi_header *dm, u8 s)
 {
@@ -184,10 +185,36 @@ static void __init dmi_decode(struct dmi
 	}
 }
 
-void __init dmi_scan_machine(void)
+static int __init dmi_present(char __iomem *p)
 {
 	u8 buf[15];
+	memcpy_fromio(buf, p, 15);
+	if ((memcmp(buf, "_DMI_", 5) == 0) && dmi_checksum(buf)) {
+		u16 num = (buf[13] << 8) | buf[12];
+		u16 len = (buf[7] << 8) | buf[6];
+		u32 base = (buf[11] << 24) | (buf[10] << 16) |
+			(buf[9] << 8) | buf[8];
+
+		/*
+		 * DMI version 0.0 means that the real version is taken from
+		 * the SMBIOS version, which we don't know at this point.
+		 */
+		if (buf[14] != 0)
+			printk(KERN_INFO "DMI %d.%d present.\n",
+			       buf[14] >> 4, buf[14] & 0xF);
+		else
+			printk(KERN_INFO "DMI present.\n");
+		if (dmi_table(base,len, num, dmi_decode) == 0)
+			return 0;
+	}
+	return 1;
+}
+
+#ifndef CONFIG_EFI
+void __init dmi_scan_machine(void)
+{
 	char __iomem *p, *q;
+	int rc;
 
 	/*
 	 * no iounmap() for that ioremap(); it would be a no-op, but it's
@@ -199,30 +226,39 @@ void __init dmi_scan_machine(void)
 		goto out;
 
 	for (q = p; q < p + 0x10000; q += 16) {
-		memcpy_fromio(buf, q, 15);
-		if ((memcmp(buf, "_DMI_", 5) == 0) && dmi_checksum(buf)) {
-			u16 num = (buf[13] << 8) | buf[12];
-			u16 len = (buf[7] << 8) | buf[6];
-			u32 base = (buf[11] << 24) | (buf[10] << 16) |
-				   (buf[9] << 8) | buf[8];
-
-			/*
-			 * DMI version 0.0 means that the real version is taken from
-			 * the SMBIOS version, which we don't know at this point.
-			 */
-			if (buf[14] != 0)
-				printk(KERN_INFO "DMI %d.%d present.\n",
-					buf[14] >> 4, buf[14] & 0xF);
-			else
-				printk(KERN_INFO "DMI present.\n");
-
-			if (dmi_table(base,len, num, dmi_decode) == 0)
-				return;
-		}
+		rc = dmi_present(q);
+		if (!rc)
+			return;
 	}
+ out:	printk(KERN_INFO "DMI not present or invalid.\n");
+}
 
-out:	printk(KERN_INFO "DMI not present or invalid.\n");
+#else /* CONFIG_EFI */
+/* This is called as a core_initcall() because it isn't needed
+ * during early boot.  This also means we can iounmap the space
+ * when we're done with it.
+ */
+void __init dmi_scan_machine(void)
+{
+	char __iomem *p;
+	int rc;
+
+	if (!efi.smbios)
+		goto out;
+
+	p = ioremap((unsigned long)efi.smbios, 0x10000);
+	if (p == NULL)
+		goto out;
+
+	rc = dmi_present(p + 0x10); /* offset of _DMI_ string */
+	iounmap(p);
+	if (!rc)
+		return;
+
+ out:	printk(KERN_INFO "DMI not present or invalid.\n");
 }
+
+#endif /* CONFIG_EFI */
 
 
 /**
diff --git a/arch/ia64/Kconfig b/arch/ia64/Kconfig
index 199eeaf..51ac4e0 100644
--- a/arch/ia64/Kconfig
+++ b/arch/ia64/Kconfig
@@ -42,6 +42,10 @@ config TIME_INTERPOLATION
 	bool
 	default y
 
+config DMI
+	bool
+	default y
+
 config EFI
 	bool
 	default y
diff --git a/arch/ia64/kernel/Makefile b/arch/ia64/kernel/Makefile
index 307514f..6fc59ed 100644
--- a/arch/ia64/kernel/Makefile
+++ b/arch/ia64/kernel/Makefile
@@ -7,7 +7,7 @@ extra-y	:= head.o init_task.o vmlinux.ld
 obj-y := acpi.o entry.o efi.o efi_stub.o gate-data.o fsys.o ia64_ksyms.o irq.o irq_ia64.o	\
 	 irq_lsapic.o ivt.o machvec.o pal.o patch.o process.o perfmon.o ptrace.o sal.o		\
 	 salinfo.o semaphore.o setup.o signal.o sys_ia64.o time.o traps.o unaligned.o \
-	 unwind.o mca.o mca_asm.o topology.o
+	 unwind.o mca.o mca_asm.o topology.o dmi_scan.o
 
 obj-$(CONFIG_IA64_BRL_EMU)	+= brl_emu.o
 obj-$(CONFIG_IA64_GENERIC)	+= acpi-ext.o
@@ -25,6 +25,7 @@ obj-$(CONFIG_IA64_MCA_RECOVERY)	+= mca_r
 obj-$(CONFIG_KPROBES)		+= kprobes.o jprobes.o
 obj-$(CONFIG_IA64_UNCACHED_ALLOCATOR)	+= uncached.o
 mca_recovery-y			+= mca_drv.o mca_drv_asm.o
+dmi_scan-y			+= ../../i386/kernel/dmi_scan.o
 
 # The gate DSO image is built using a special linker script.
 targets += gate.so gate-syms.o
diff --git a/arch/ia64/kernel/setup.c b/arch/ia64/kernel/setup.c
index 5add0bc..03e0c60 100644
--- a/arch/ia64/kernel/setup.c
+++ b/arch/ia64/kernel/setup.c
@@ -43,6 +43,7 @@
 #include <linux/initrd.h>
 #include <linux/platform.h>
 #include <linux/pm.h>
+#include <linux/dmi.h>
 
 #include <asm/ia32.h>
 #include <asm/machvec.h>
@@ -870,3 +871,10 @@ check_bugs (void)
 	ia64_patch_mckinley_e9((unsigned long) __start___mckinley_e9_bundles,
 			       (unsigned long) __end___mckinley_e9_bundles);
 }
+
+static int __init run_dmi_scan(void)
+{
+	dmi_scan_machine();
+	return 0;
+}
+core_initcall(run_dmi_scan);
diff --git a/include/asm-ia64/io.h b/include/asm-ia64/io.h
index cf772a6..54f7457 100644
--- a/include/asm-ia64/io.h
+++ b/include/asm-ia64/io.h
@@ -434,6 +434,11 @@ iounmap (volatile void __iomem *addr)
 
 #define ioremap_nocache(o,s)	ioremap(o,s)
 
+/* Use normal IO mappings for DMI */
+#define dmi_ioremap ioremap
+#define dmi_iounmap(x,l) iounmap(x)
+#define dmi_alloc(l) kmalloc(l, GFP_ATOMIC)
+
 # ifdef __KERNEL__
 
 /*

  parent reply	other threads:[~2006-01-06 17:22 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-01-04 22:16 [PATCH 2.6.15 1/2] ia64: use i386 dmi_scan.c Matt Domsch
2006-01-04 22:36 ` Alex Williamson
2006-01-04 23:29   ` Matt Domsch
2006-01-05 16:41     ` Bjorn Helgaas
2006-01-05 17:37       ` Matt Domsch
2006-01-05 17:54         ` Bjorn Helgaas
2006-01-06  0:02           ` Bjorn Helgaas
2006-01-06 17:15             ` Matt Domsch
2006-01-04 22:55 ` Alan Cox
2006-01-06 17:21 ` Matt Domsch [this message]
2006-01-06 22:39   ` [PATCH 2.6.15] " Matt Domsch
2006-01-14  0:24     ` Bjorn Helgaas
2006-01-14  0:45       ` Alan Cox
2006-01-14  1:19       ` Andi Kleen
2006-01-14  5:05         ` Bjorn Helgaas
2006-01-18  0:17       ` Bjorn Helgaas
2006-01-18  2:32         ` Andi Kleen
2006-01-18 15:53           ` Bjorn Helgaas
2006-01-18 17:29         ` Bjorn Helgaas
2006-01-18 18:11           ` [Openipmi-developer] " Matt Domsch
2006-01-19 20:10             ` [PATCH 0/5] ia64 ioremap, DMI, EFI system table Bjorn Helgaas
2006-01-19 20:12               ` [PATCH 1/5] EFI, /dev/mem: simplify efi_mem_attribute_range() Bjorn Helgaas
2006-01-19 20:12               ` [PATCH 2/5] ia64: ioremap: check EFI for valid memory attributes Bjorn Helgaas
2006-01-19 20:13               ` [PATCH 3/5] DMI: only ioremap stuff we actually need Bjorn Helgaas
2006-01-19 20:13               ` [PATCH 4/5] EFI: keep physical table addresses in efi structure Bjorn Helgaas
2006-01-19 20:14               ` [PATCH 5/5] ACPI: clean up memory attribute checking for map/read/write Bjorn Helgaas
2006-01-30 17:11               ` [Openipmi-developer] [PATCH 0/5] ia64 ioremap, DMI, EFI system table Matt Domsch
2006-03-17 23:54     ` [PATCH 2.6.15] ia64: use i386 dmi_scan.c Andrew Morton
2006-03-18 14:56       ` Matt Domsch
2006-03-18 15:43         ` Matt Domsch
2006-03-18 19:51           ` Andrew Morton
2006-01-06 19:03 Tolentino, Matthew E
2006-01-06 22:36 ` Matt Domsch
2006-01-19 14:19 Tolentino, Matthew E

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20060106172140.GB19605@lists.us.dell.com \
    --to=matt_domsch@dell.com \
    --cc=ak@suse.de \
    --cc=akpm@osdl.org \
    --cc=linux-ia64@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=openipmi-developer@lists.sourceforge.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).