Skip to contentSkip to conversation

PATCH: abituguru3-fix-detect.patch

lm-sensors Hans de Goede 5 participants 14 messages May 23, 2008 – Jul 31, 2008

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

Hi All,

It has been reported that the abituguru3 driver fails to load after a BIOS update. This patch fixes this by loosening the detection routine so that it will work after the BIOS update too. To compensate for the now very loose detection an additional check is added on the DMI Base Board vendor string to make sure we only load on Abit motherboards, this is the same as the check in the abituguru (1 / 2) driver.

Regards,

Hans

p.s.

Alistair can you test the abituguru3 driver compiled with this patch on your motherboard and confirm that it fixes the issue (and still works).

It has been reported that the abituguru3 driver fails to load after a BIOS update. This patch fixes this by loosening the detection routine so that it will work after the BIOS update too. To compensate for the now very loose detection an additional check is added on the DMI Base Board vendor string to make sure we only load on Abit motherboards, this is the same as the check in the abituguru (1 / 2) driver.

drivers/hwmon/abituguru3.c renamed from drivers/hwmon/abituguru3.c~ +13 -2
diff -up vanilla-2.6.26-rc3-git4/drivers/hwmon/abituguru3.c~ vanilla-2.6.26-rc3-git4/drivers/hwmon/abituguru3.c
@@ -30,6 +30,7 @@
 #include <linux/platform_device.h>
 #include <linux/hwmon.h>
 #include <linux/hwmon-sysfs.h>
+#include <linux/dmi.h>
 #include <asm/io.h>
 
 /* uGuru3 bank addresses */
@@ -1111,11 +1112,12 @@ static int __init abituguru3_detect(void
 {
 	/* See if there is an uguru3 there. An idle uGuru3 will hold 0x00 or
 	   0x08 at DATA and 0xAC at CMD. Sometimes the uGuru3 will hold 0x05
-	   at CMD instead, why is unknown. So we test for 0x05 too. */
+	   or 0x55 at CMD instead, why is unknown. */
 	u8 data_val = inb_p(ABIT_UGURU3_BASE + ABIT_UGURU3_DATA);
 	u8 cmd_val = inb_p(ABIT_UGURU3_BASE + ABIT_UGURU3_CMD);
 	if (((data_val == 0x00) || (data_val == 0x08)) &&
-			((cmd_val == 0xAC) || (cmd_val == 0x05)))
+			((cmd_val == 0xAC) || (cmd_val == 0x05) ||
+			 (cmd_val == 0x55)))
 		return ABIT_UGURU3_BASE;
 
 	ABIT_UGURU3_DEBUG("no Abit uGuru3 found, data = 0x%02X, cmd = "
@@ -1138,6 +1140,15 @@ static int __init abituguru3_init(void)
 	int address, err;
 	struct resource res = { .flags = IORESOURCE_IO };
 
+#ifdef CONFIG_DMI
+	const char *board_vendor = dmi_get_system_info(DMI_BOARD_VENDOR);
+
+	/* safety check, refuse to load on non Abit motherboards */
+	if (!force && (!board_vendor ||
+			strcmp(board_vendor, "http://www.abit.com.tw/")))
+		return -ENODEV;
+#endif
+
 	address = abituguru3_detect();
 	if (address < 0)
 		return address;

_______________________________________________
lm-sensors mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors

#1 lore raw

On Friday 23 May 2008 15:10:41 Hans de Goede wrote:
[snip]

Quoted 2 lines

Alistair can you test the abituguru3 driver compiled with this patch on your motherboard and confirm that it fixes the issue (and still works).

Confirmed. Thanks a lot for doing this.

Signature · 9 lines
Cheers,
Alistair.

137/1 Warrender Park Road, Edinburgh, UK.

_______________________________________________
lm-sensors mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors
#2 lore raw
In reply to Hans de Goede

Hi Hans,

Quoted 8 lines · Hans de Goede

It has been reported that the abituguru3 driver fails to load after a BIOS update. This patch fixes this by loosening the detection routine so that it will work after the BIOS update too. To compensate for the now very loose detection an additional check is added on the DMI Base Board vendor string to make sure we only load on Abit motherboards, this is the same as the check in the abituguru (1 / 2) driver.

I'm trading the review of this patch for the review of one of mine, for example:
http://lists.lm-sensors.org/pipermail/lm-sensors/2008-April/022998.html
Or any other you'd like. Deal?

Thanks,

Signature · 6 lines
Jean Delvare

_______________________________________________
lm-sensors mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors
#3 lore raw
In reply to Hans de Goede
Quoted 10 lines · Jean Delvare

Hi Hans,

Quoted 7 lines · Hans de Goede

It has been reported that the abituguru3 driver fails to load after a BIOS update. This patch fixes this by loosening the detection routine so that it will work after the BIOS update too. To compensate for the now very loose detection an additional check is added on the DMI Base Board vendor string to make sure we only load on Abit motherboards, this is the same as the check in the abituguru (1 / 2) driver.

Quoted 7 lines
Quoted 1 line

I'm trading the review of this patch for the review of one of mine, for example:
http://lists.lm-sensors.org/pipermail/lm-sensors/2008-April/022998.html
Or any other you'd like. Deal?

Deal!

Regards,

Hans

_______________________________________________
lm-sensors mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors

Acked-by
#4 lore raw
In reply to Hans de Goede

Hi Hans,

Quoted 8 lines · Hans de Goede

It has been reported that the abituguru3 driver fails to load after a BIOS update. This patch fixes this by loosening the detection routine so that it will work after the BIOS update too. To compensate for the now very loose detection an additional check is added on the DMI Base Board vendor string to make sure we only load on Abit motherboards, this is the same as the check in the abituguru (1 / 2) driver.

Missing "f".

Quoted 32 lines

diff -up vanilla-2.6.26-rc3-git4/drivers/hwmon/abituguru3.c~ vanilla-2.6.26-rc3-git4/drivers/hwmon/abituguru3.c

drivers/hwmon/abituguru3.c renamed from drivers/hwmon/abituguru3.c~ +6 -2
@@ -30,6 +30,7 @@
 #include <linux/platform_device.h>
 #include <linux/hwmon.h>
 #include <linux/hwmon-sysfs.h>
+#include <linux/dmi.h>
 #include <asm/io.h>
 
 /* uGuru3 bank addresses */
@@ -1111,11 +1112,12 @@ static int __init abituguru3_detect(void
 {
 	/* See if there is an uguru3 there. An idle uGuru3 will hold 0x00 or
 	   0x08 at DATA and 0xAC at CMD. Sometimes the uGuru3 will hold 0x05
-	   at CMD instead, why is unknown. So we test for 0x05 too. */
+	   or 0x55 at CMD instead, why is unknown. */
 	u8 data_val = inb_p(ABIT_UGURU3_BASE + ABIT_UGURU3_DATA);
 	u8 cmd_val = inb_p(ABIT_UGURU3_BASE + ABIT_UGURU3_CMD);
 	if (((data_val = 0x00) || (data_val = 0x08)) &&
-			((cmd_val = 0xAC) || (cmd_val = 0x05)))
+			((cmd_val = 0xAC) || (cmd_val = 0x05) ||
+			 (cmd_val = 0x55)))
 		return ABIT_UGURU3_BASE;
 
 	ABIT_UGURU3_DEBUG("no Abit uGuru3 found, data = 0x%02X, cmd = "
@@ -1138,6 +1140,15 @@ static int __init abituguru3_init(void)
 	int address, err;
 	struct resource res = { .flags = IORESOURCE_IO };
 
+#ifdef CONFIG_DMI
+	const char *board_vendor = dmi_get_system_info(DMI_BOARD_VENDOR);

drivers/hwmon/abituguru3.c static int __init abituguru3_init(void) · line 1154

Quoted 10 lines
drivers/hwmon/abituguru3.c renamed from drivers/hwmon/abituguru3.c~ +7 -0
+
+	/* safety check, refuse to load on non Abit motherboards */
+	if (!force && (!board_vendor ||
+			strcmp(board_vendor, "http://www.abit.com.tw/")))
+		return -ENODEV;
+#endif
+
 	address = abituguru3_detect();
 	if (address < 0)
 		return address;

Looks good to me.

Note though that the #ifdef is not needed as far as I can see. Without DMI, dmi_get_system_info() will simply return NULL and your code handles this case properly.

Signature · 6 lines
Jean Delvare

_______________________________________________
lm-sensors mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors
#5 lore raw
In reply to Hans de Goede

Hi Hans:

* Hans de Goede <[email protected]> [2008-05-23 16:10:41 +0200]:
(...)

Quoted 8 lines

It has been reported that the abituguru3 driver fails to load after a BIOS update. This patch fixes this by loosening the detection routine so that it will work after the BIOS update too. To compensate for the now very loose detection an additional check is added on the DMI Base Board vendor string to make sure we only load on Abit motherboards, this is the same as the check in the abituguru (1 / 2) driver.

Applied to hwmon-2.6.git/testing, thanks.

(will include in final batch to Linus for 2.6.26 also)

Signature · 8 lines
Mark M. Hoffman
[email protected]


_______________________________________________
lm-sensors mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors
#6 lore raw
In reply to Hans de Goede

Hi,

Quoted 7 lines · On Sunday 08 June 2008 16:16:33 Mark M. Hoffman wrote:
Quoted 7 lines

It has been reported that the abituguru3 driver fails to load after a BIOS update. This patch fixes this by loosening the detection routine so that it will work after the BIOS update too. To compensate for the now very loose detection an additional check is added on the DMI Base Board vendor string to make sure we only load on Abit motherboards, this is the same as the check in the abituguru (1 / 2) driver.

Quoted 5 lines
Quoted 1 line

Applied to hwmon-2.6.git/testing, thanks.

(will include in final batch to Linus for 2.6.26 also)

After updating my BIOS (from 16 to 17) the driver has stopped loading again. This is with 2.6.26-rc8. The reason is that the command byte has changed value to 0xFF (this is reproducible across cold and warm starts).

The following diff fixes it, but the "probe" is now looking even more creaky..

---

Fix loading of abituguru3 on Abit IP35 Pro with BIOS 17. The magic bytes have changed value (again).

drivers/hwmon/abituguru3.c +1 -1
index f00f497..53ee148 100644
@@ -1118,7 +1118,7 @@ static int __init abituguru3_detect(void)
 	u8 cmd_val = inb_p(ABIT_UGURU3_BASE + ABIT_UGURU3_CMD);
 	if (((data_val = 0x00) || (data_val = 0x08)) &&
 			((cmd_val = 0xAC) || (cmd_val = 0x05) ||
-			 (cmd_val = 0x55)))
+			 (cmd_val = 0x55) || (cmd_val = 0xFF)))
 		return ABIT_UGURU3_BASE;
 
 	ABIT_UGURU3_DEBUG("no Abit uGuru3 found, data = 0x%02X, cmd = "
Signature · 9 lines
Cheers,
Alistair.

137/1 Warrender Park Road, Edinburgh, UK.

_______________________________________________
lm-sensors mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors
author Acked-by
#7 lore raw
In reply to Hans de Goede
Quoted 13 lines · Alistair John Strachan

Hi,

Quoted 10 lines · On Sunday 08 June 2008 16:16:33 Mark M. Hoffman wrote:
Quoted 8 lines

It has been reported that the abituguru3 driver fails to load after a BIOS update. This patch fixes this by loosening the detection routine so that it will work after the BIOS update too. To compensate for the now very loose detection an additional check is added on the DMI Base Board vendor string to make sure we only load on Abit motherboards, this is the same as the check in the abituguru (1 / 2) driver.

Applied to hwmon-2.6.git/testing, thanks.

Quoted 8 lines
Quoted 1 line

(will include in final batch to Linus for 2.6.26 also)

After updating my BIOS (from 16 to 17) the driver has stopped loading again. This is with 2.6.26-rc8. The reason is that the command byte has changed value to 0xFF (this is reproducible across cold and warm starts).

The following diff fixes it, but the "probe" is now looking even more creaky..

Ah what fun, well luckily I've added the DMI based check so the detection routine is less important now.

Mark, please apply.

Regards,

Hans

Quoted 14 lines

---

Fix loading of abituguru3 on Abit IP35 Pro with BIOS 17. The magic bytes have changed value (again).

drivers/hwmon/abituguru3.c +0 -0
index f00f497..53ee148 100644

drivers/hwmon/abituguru3.c static int __init abituguru3_detect(void) · line 1124

Quoted 8 lines
drivers/hwmon/abituguru3.c +1 -1
@@ -1118,7 +1118,7 @@ static int __init abituguru3_detect(void)
 	u8 cmd_val = inb_p(ABIT_UGURU3_BASE + ABIT_UGURU3_CMD);
 	if (((data_val = 0x00) || (data_val = 0x08)) &&
 			((cmd_val = 0xAC) || (cmd_val = 0x05) ||
-			 (cmd_val = 0x55)))
+			 (cmd_val = 0x55) || (cmd_val = 0xFF)))
 		return ABIT_UGURU3_BASE;
 
 	ABIT_UGURU3_DEBUG("no Abit uGuru3 found, data = 0x%02X, cmd = "

_______________________________________________
lm-sensors mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors

#8 lore raw
In reply to Hans de Goede

Hi Hans,

Quoted 20 lines · Hans de Goede
Quoted 19 lines · Alistair John Strachan

Hi,

Quoted 11 lines · On Sunday 08 June 2008 16:16:33 Mark M. Hoffman wrote:
Quoted 8 lines

It has been reported that the abituguru3 driver fails to load after a BIOS update. This patch fixes this by loosening the detection routine so that it will work after the BIOS update too. To compensate for the now very loose detection an additional check is added on the DMI Base Board vendor string to make sure we only load on Abit motherboards, this is the same as the check in the abituguru (1 / 2) driver.

Applied to hwmon-2.6.git/testing, thanks.

(will include in final batch to Linus for 2.6.26 also)

After updating my BIOS (from 16 to 17) the driver has stopped loading again. This is with 2.6.26-rc8. The reason is that the command byte has changed value to 0xFF (this is reproducible across cold and warm starts).

Quoted 7 lines
Quoted 2 lines

The following diff fixes it, but the "probe" is now looking even more creaky..

Ah what fun, well luckily I've added the DMI based check so the detection routine is less important now.

Mark, please apply.

I have to object. 0xff is the value you would get without a chip at this address. So the change is roughly equivalent to not testing the port at all... Plus, if the possible values change with every BIOS update, we have to admit that the detection method isn't reliable. What about switching to a DMI-based check? Not only checking the board manufacturer but also the board product name. The abituguru3 driver requires board-specific data anyway, so that's not a big change. And there's always the "force" parameter to bypass the check for new boards.

Quoted 24 lines
Quoted 22 lines

---

Fix loading of abituguru3 on Abit IP35 Pro with BIOS 17. The magic bytes have changed value (again).

drivers/hwmon/abituguru3.c +1 -1
index f00f497..53ee148 100644
@@ -1118,7 +1118,7 @@ static int __init abituguru3_detect(void)
 	u8 cmd_val = inb_p(ABIT_UGURU3_BASE + ABIT_UGURU3_CMD);
 	if (((data_val = 0x00) || (data_val = 0x08)) &&
 			((cmd_val = 0xAC) || (cmd_val = 0x05) ||
-			 (cmd_val = 0x55)))
+			 (cmd_val = 0x55) || (cmd_val = 0xFF)))
 		return ABIT_UGURU3_BASE;
 
 	ABIT_UGURU3_DEBUG("no Abit uGuru3 found, data = 0x%02X, cmd = "
Signature · 6 lines
Jean Delvare

_______________________________________________
lm-sensors mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors
#9 lore raw
In reply to Hans de Goede
Quoted 29 lines · Jean Delvare

Hi Hans,

Quoted 19 lines · Hans de Goede
Quoted 18 lines · Alistair John Strachan

Hi,

Quoted 11 lines · On Sunday 08 June 2008 16:16:33 Mark M. Hoffman wrote:
Quoted 8 lines

It has been reported that the abituguru3 driver fails to load after a BIOS update. This patch fixes this by loosening the detection routine so that it will work after the BIOS update too. To compensate for the now very loose detection an additional check is added on the DMI Base Board vendor string to make sure we only load on Abit motherboards, this is the same as the check in the abituguru (1 / 2) driver.

Applied to hwmon-2.6.git/testing, thanks.

(will include in final batch to Linus for 2.6.26 also)

After updating my BIOS (from 16 to 17) the driver has stopped loading again. This is with 2.6.26-rc8. The reason is that the command byte has changed value to 0xFF (this is reproducible across cold and warm starts).

Quoted 6 lines
Quoted 2 lines

The following diff fixes it, but the "probe" is now looking even more creaky..

Ah what fun, well luckily I've added the DMI based check so the detection routine is less important now.

Mark, please apply.

Quoted 9 lines

I have to object. 0xff is the value you would get without a chip at this address. So the change is roughly equivalent to not testing the port at all... Plus, if the possible values change with every BIOS update, we have to admit that the detection method isn't reliable. What about switching to a DMI-based check? Not only checking the board manufacturer but also the board product name. The abituguru3 driver requires board-specific data anyway, so that's not a big change. And there's always the "force" parameter to bypass the check for new boards.

I understand where you're coming from, but I have to object to switching to DMI based detection. I would be happy to make that switch if and when I've got DMI strings for all currently supporting motherboards. I can start working on collecting those, but without those, switching to DMI based detection would cause regressions which IMHO is unacceptable.

I agree that the 0xff check is not pretty, but please keep in mind that:
1) This driver normally is never autoloaded, so it either has to be compiled in or explicitly loaded by the user (this is something where dmi based detection would be a win as dmi based autoloading is possible).

2) If someone has either compiled the driver in and/or loads it deliberately it will still only load (without the force parameter) on Abit motherboards.

3) After this simple read check, the driver does some reads from the chip (which involve isa writes) and if these fail the driver doesn't load. Note that these reads will most likely fail if there is no uguru3, as the uguru3 has a quite complex handshaking scheme.

So move to DMI based detection in the future, sure. But for now I would like to see this patch applied.

Regards,

Hans

Quoted 21 lines
Quoted 21 lines
Quoted 19 lines

---

Fix loading of abituguru3 on Abit IP35 Pro with BIOS 17. The magic bytes have changed value (again).

drivers/hwmon/abituguru3.c +1 -1
index f00f497..53ee148 100644
@@ -1118,7 +1118,7 @@ static int __init abituguru3_detect(void)
 	u8 cmd_val = inb_p(ABIT_UGURU3_BASE + ABIT_UGURU3_CMD);
 	if (((data_val = 0x00) || (data_val = 0x08)) &&
 			((cmd_val = 0xAC) || (cmd_val = 0x05) ||
-			 (cmd_val = 0x55)))
+			 (cmd_val = 0x55) || (cmd_val = 0xFF)))
 		return ABIT_UGURU3_BASE;
 
Quoted 4 lines
Quoted 3 lines

drivers/hwmon/abituguru3.c static int __init abituguru3_detect(void · line 1123

Quoted 3 lines
drivers/hwmon/abituguru3.c +0 -0
 	ABIT_UGURU3_DEBUG("no Abit uGuru3 found, data = 0x%02X, cmd = "

_______________________________________________
lm-sensors mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors

#10 lore raw
In reply to Hans de Goede
Quoted 40 lines · Hans de Goede
Quoted 15 lines · Jean Delvare

Hi Hans,

Quoted 11 lines · Hans de Goede
Quoted 6 lines · Alistair John Strachan

After updating my BIOS (from 16 to 17) the driver has stopped loading again. This is with 2.6.26-rc8. The reason is that the command byte has changed value to 0xFF (this is reproducible across cold and warm starts).

The following diff fixes it, but the "probe" is now looking even more creaky..

Ah what fun, well luckily I've added the DMI based check so the detection routine is less important now.

Mark, please apply.

Quoted 9 lines

I have to object. 0xff is the value you would get without a chip at this address. So the change is roughly equivalent to not testing the port at all... Plus, if the possible values change with every BIOS update, we have to admit that the detection method isn't reliable. What about switching to a DMI-based check? Not only checking the board manufacturer but also the board product name. The abituguru3 driver requires board-specific data anyway, so that's not a big change. And there's always the "force" parameter to bypass the check for new boards.

I understand where you're coming from, but I have to object to switching to DMI based detection. I would be happy to make that switch if and when I've got DMI strings for all currently supporting motherboards. I can start working on collecting those, but without those, switching to DMI based detection would cause regressions which IMHO is unacceptable.

I agree that the 0xff check is not pretty, but please keep in mind that:
1) This driver normally is never autoloaded, so it either has to be compiled in or explicitly loaded by the user (this is something where dmi based detection would be a win as dmi based autoloading is possible).

2) If someone has either compiled the driver in and/or loads it deliberately it will still only load (without the force parameter) on Abit motherboards.

Quoted 7 lines

3) After this simple read check, the driver does some reads from the chip (which involve isa writes) and if these fail the driver doesn't load. Note that these reads will most likely fail if there is no uguru3, as the uguru3 has a quite complex handshaking scheme.

So move to DMI based detection in the future, sure. But for now I would like to see this patch applied.

Hmm, OK. I thought that you had these DMI strings handy already. If not, please start collecting them now, so that the driver can be switched to DMI-based detection in the future.

Signature · 6 lines
Jean Delvare

_______________________________________________
lm-sensors mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors
#11 lore raw
In reply to Hans de Goede

Hi Andrew,

As discussed I'm sending this patch directly to you for 2.6.27 inclusion as Mark seems to be out of the loop at the moment.

Alistair John Strachan wrote:

"After updating my BIOS (from 16 to 17) the driver has stopped loading again. This is with 2.6.26-rc8. The reason is that the command byte has changed value to 0xFF (this is reproducible across cold and warm starts).

The following diff fixes it."

Regards,

Hans

Fix loading of abituguru3 on Abit IP35 Pro with BIOS 17. The magic bytes have changed value (again).

drivers/hwmon/abituguru3.c +1 -1
@@ -1118,7 +1118,7 @@ static int __init abituguru3_detect(void)
 	u8 cmd_val = inb_p(ABIT_UGURU3_BASE + ABIT_UGURU3_CMD);
 	if (((data_val == 0x00) || (data_val == 0x08)) &&
 			((cmd_val == 0xAC) || (cmd_val == 0x05) ||
-			 (cmd_val == 0x55)))
+			 (cmd_val == 0x55) || (cmd_val == 0xFF)))
 		return ABIT_UGURU3_BASE;
 
 	ABIT_UGURU3_DEBUG("no Abit uGuru3 found, data = 0x%02X, cmd = "

_______________________________________________
lm-sensors mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors

#12 lore raw
In reply to Hans de Goede
Quoted 5 lines · On Thu, 31 Jul 2008 12:30:05 +0200 Hans de Goede <[email protected]> wrote:

Hi Andrew,

As discussed I'm sending this patch directly to you for 2.6.27 inclusion as Mark seems to be out of the loop at the moment.

Quoted 8 lines

Alistair John Strachan wrote:

"After updating my BIOS (from 16 to 17) the driver has stopped loading again. This is with 2.6.26-rc8. The reason is that the command byte has changed value to 0xFF (this is reproducible across cold and warm starts).

The following diff fixes it."

OK, I'll prepare a hwmon patchbombing over the next few days.

Regarding this patch:

a) "abituguru3-fix-detect.patch" isn't a nice title. I retitled it to "hwmon: fix loading of abituguru3 on Abit IP35 Pro with BIOS 17"

b) The way you presented this email would cause the patch to be attributed to yourself. However I have a suspicion that Alistair wrote it.

If this was the case then the way to communicate that authorship is to put his From: line right at the start of the changelog.

_______________________________________________
lm-sensors mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors