Re: [lm-sensors] Could the k8temp driver be interfering with ACPI?

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Jean Delvare
Date: Tuesday, March 6, 2007 - 2:28 pm

Hi Matthew,

On Fri, 2 Mar 2007 21:46:43 +0000, Matthew Garrett wrote:

Here is what I have come up with, by mixing your patch with Rudolf
Marek's one. Again this is only a reporting patch, but now it only
reports real unreserved accesses. I plan to use it for debugging
purposes.

Signed-off-by: Jean Delvare <khali@linux-fr.org>
---
 drivers/acpi/osl.c |   72 ++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 72 insertions(+)

--- linux-2.6.21-rc2.orig/drivers/acpi/osl.c	2007-03-06 20:59:00.000000000 +0100
+++ linux-2.6.21-rc2/drivers/acpi/osl.c	2007-03-06 21:33:13.000000000 +0100
@@ -35,6 +35,7 @@
 #include <linux/kmod.h>
 #include <linux/delay.h>
 #include <linux/workqueue.h>
+#include <linux/ioport.h>
 #include <linux/nmi.h>
 #include <linux/acpi.h>
 #include <acpi/acpi.h>
@@ -370,6 +371,7 @@ u64 acpi_os_get_timer(void)
 acpi_status acpi_os_read_port(acpi_io_address port, u32 * value, u32 width)
 {
 	u32 dummy;
+	struct resource *conflict, res;
 
 	if (!value)
 		value = &dummy;
@@ -388,6 +390,23 @@ acpi_status acpi_os_read_port(acpi_io_ad
 		BUG();
 	}
 
+	res.flags = IORESOURCE_IO;
+	res.name = "_ACPI Access";
+	res.start = port;
+	res.end = port + width/8 - 1;
+
+	conflict = ____request_resource(&ioport_resource, &res);
+	while (conflict && conflict->child)
+		conflict = ____request_resource(conflict, &res);
+
+	if (conflict && strncmp(conflict->name, "ACPI ", 5)) {
+		printk (KERN_INFO "ACPI read from allocated ioport %lx, value %lx, width %d\n",
+			(unsigned long)port, (unsigned long)(*value), (int)width);
+	}
+
+	if (conflict == NULL)
+		release_resource(&res);
+
 	return AE_OK;
 }
 
@@ -395,6 +414,25 @@ EXPORT_SYMBOL(acpi_os_read_port);
 
 acpi_status acpi_os_write_port(acpi_io_address port, u32 value, u32 width)
 {
+	struct resource *conflict, res;
+
+	res.flags = IORESOURCE_IO;
+	res.name = "_ACPI Access";
+	res.start = port;
+	res.end = port + width/8 - 1;
+
+	conflict = ____request_resource(&ioport_resource, &res);
+	while (conflict && conflict->child)
+		conflict = ____request_resource(conflict, &res);
+
+	if (conflict && strncmp(conflict->name, "ACPI ", 5)) {
+		printk (KERN_INFO "ACPI write to allocated ioport %lx, value %lx, width %d\n",
+			(unsigned long)port, (unsigned long)(value), (int)width);
+	}
+
+	if (conflict == NULL)
+		release_resource(&res);
+
 	switch (width) {
 	case 8:
 		outb(value, port);
@@ -419,6 +457,7 @@ acpi_os_read_memory(acpi_physical_addres
 {
 	u32 dummy;
 	void __iomem *virt_addr;
+	struct resource *conflict, res;
 
 	virt_addr = ioremap(phys_addr, width);
 	if (!value)
@@ -440,6 +479,22 @@ acpi_os_read_memory(acpi_physical_addres
 
 	iounmap(virt_addr);
 
+	res.flags = IORESOURCE_MEM;
+	res.name = "_ACPI Access";
+	res.start = phys_addr;
+	res.end = phys_addr + width/8 - 1;
+
+	conflict = ____request_resource(&iomem_resource, &res);
+	while (conflict && conflict->child)
+		conflict = ____request_resource(conflict, &res);
+
+	if (conflict && strncmp(conflict->name, "ACPI ", 5))
+		pr_info("ACPI read from allocated iomem %lx, value %lx, width %d\n",
+			(unsigned long)phys_addr, (unsigned long)(*value), (int)width);
+
+	if (conflict == NULL)
+		release_resource(&res);
+
 	return AE_OK;
 }
 
@@ -447,6 +502,23 @@ acpi_status
 acpi_os_write_memory(acpi_physical_address phys_addr, u32 value, u32 width)
 {
 	void __iomem *virt_addr;
+	struct resource *conflict, res;
+
+	res.flags = IORESOURCE_MEM;
+	res.name = "_ACPI Access";
+	res.start = phys_addr;
+	res.end = phys_addr + width/8 - 1;
+
+	conflict = ____request_resource(&iomem_resource, &res);
+	while (conflict && conflict->child)
+		conflict = ____request_resource(conflict, &res);
+
+	if (conflict && strncmp(conflict->name, "ACPI ", 5))
+		pr_info("ACPI write to allocated iomem %lx, value %lx, width %d\n",
+			(unsigned long)phys_addr, (unsigned long)value, (int)width);
+
+	if (conflict == NULL)
+		release_resource(&res);
 
 	virt_addr = ioremap(phys_addr, width);
 


-- 
Jean Delvare
-
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
Could the k8temp driver be interfering with ACPI?, Chuck Ebbert, (Fri Feb 16, 10:31 am)
Re: Could the k8temp driver be interfering with ACPI?, Chuck Ebbert, (Fri Feb 16, 11:14 am)
Re: Could the k8temp driver be interfering with ACPI?, Chuck Ebbert, (Fri Feb 16, 12:31 pm)
Re: Could the k8temp driver be interfering with ACPI?, Andi Kleen, (Fri Feb 16, 12:59 pm)
Re: [lm-sensors] Could the k8temp driver be interfering wi ..., Henrique de Moraes H ..., (Fri Mar 2, 6:47 am)
Re: [lm-sensors] Could the k8temp driver be interfering wi ..., Henrique de Moraes H ..., (Fri Mar 2, 2:22 pm)
Re: [lm-sensors] Could the k8temp driver be interfering wi ..., Jean Delvare, (Tue Mar 6, 2:28 pm)
Re: [lm-sensors] Could the k8temp driver be interfering wi ..., Alexey Starikovskiy, (Fri Mar 9, 3:39 am)
Re: [lm-sensors] Could the k8temp driver be interfering wi ..., Alexey Starikovskiy, (Fri Mar 9, 10:35 am)
Re: [lm-sensors] Could the k8temp driver be interfering wi ..., richardvoigt@gmail.com, (Sun Mar 18, 12:36 pm)
Re: Could the k8temp driver be interfering with ACPI?, Jean Delvare, (Mon Apr 2, 8:48 am)
RE: Could the k8temp driver be interfering with ACPI?, Moore, Robert, (Mon Apr 2, 1:55 pm)
Re: Could the k8temp driver be interfering with ACPI?, Jean Delvare, (Mon Apr 2, 10:49 pm)
Re: Could the k8temp driver be interfering with ACPI?, Jean Delvare, (Tue Apr 3, 12:21 am)
RE: Could the k8temp driver be interfering with ACPI?, Moore, Robert, (Wed Apr 4, 2:35 pm)