Skip to contentSkip to conversation

PCI: Quirk for hwmon access on MSI MS-7031 board

lm-sensors Jean Delvare 2 participants 5 messages May 25, 2009 – May 31, 2009 PCI

lore
Share & tools
lore
#0 lore raw

The MSI MS-7031 is based on an ATI IXP300 south bridge. On this south bridge, accessible I/O ports must be enabled explicitly. Unfortunately the BIOS forgets to enable access to the hardware monitoring chip I/O ports, so hardware monitoring fails.

Add a quirk enabling access to the required ports (0x295-0x296). This is exactly what MSI's own hardware monitoring application is doing, so it has to be the right way.

---
 drivers/pci/quirks.c |   24 ++++++++++++++++++++++++
 1 file changed, 24 insertions(+)
drivers/pci/quirks.c +24 -0
@@ -2464,6 +2464,30 @@ DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_I
 
 #endif	/* CONFIG_PCI_IOV */
 
+#if defined CONFIG_X86 && (defined CONFIG_HWMON || defined CONFIG_HWMON_MODULE)
+/* Open access to 0x295-0x296 (hardware monitoring chip) on MSI MS-7031 */
+static void __devinit ati_ixp300_open_ioport(struct pci_dev *dev)
+{
+	u16 base;
+	u8 enable;
+
+	if (!(dev->subsystem_vendor = 0x1462 &&	/* MSI */
+	      dev->subsystem_device = 0x0031))		/* MS-7031 */
+		return;
+
+	pci_read_config_byte(dev, 0x48, &enable);
+	pci_read_config_word(dev, 0x64, &base);
+
+	if (base = 0 && !(enable & BIT(2))) {
+		dev_info(&dev->dev, "Opening wide generic port at 0x295\n");
+		pci_write_config_word(dev, 0x64, 0x295);
+		pci_write_config_byte(dev, 0x48, enable | BIT(2));
+	}
+}
+
+DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_ATI, 0x436c, ati_ixp300_open_ioport);
+#endif	/* CONFIG_X86 && CONFIG_HWMON */
+
 static void pci_do_fixups(struct pci_dev *dev, struct pci_fixup *f,
 			  struct pci_fixup *end)
 {
Signature · 6 lines
Jean Delvare

_______________________________________________
lm-sensors mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors
#1 lore raw
Quoted 10 lines · Jean Delvare

The MSI MS-7031 is based on an ATI IXP300 south bridge. On this south bridge, accessible I/O ports must be enabled explicitly. Unfortunately the BIOS forgets to enable access to the hardware monitoring chip I/O ports, so hardware monitoring fails.

Add a quirk enabling access to the required ports (0x295-0x296). This is exactly what MSI's own hardware monitoring application is doing, so it has to be the right way.

+#if defined CONFIG_X86 && (defined CONFIG_HWMON || defined CONFIG_HWMON_MODULE)

I don't like this. It goes against the principle that enabling a module shouldn't cause the base kernel to get rebuilt. Is there a reason that the hardware monitoring code can't contain this quirk instead of the generic PCI code?

Quoted 34 lines
drivers/pci/quirks.c +23 -0
+/* Open access to 0x295-0x296 (hardware monitoring chip) on MSI MS-7031 */
+static void __devinit ati_ixp300_open_ioport(struct pci_dev *dev)
+{
+	u16 base;
+	u8 enable;
+
+	if (!(dev->subsystem_vendor = 0x1462 &&	/* MSI */
+	      dev->subsystem_device = 0x0031))		/* MS-7031 */
+		return;
+
+	pci_read_config_byte(dev, 0x48, &enable);
+	pci_read_config_word(dev, 0x64, &base);
+
+	if (base = 0 && !(enable & BIT(2))) {
+		dev_info(&dev->dev, "Opening wide generic port at 0x295\n");
+		pci_write_config_word(dev, 0x64, 0x295);
+		pci_write_config_byte(dev, 0x48, enable | BIT(2));
+	}
+}
+
+DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_ATI, 0x436c, ati_ixp300_open_ioport);
+#endif	/* CONFIG_X86 && CONFIG_HWMON */
+
 static void pci_do_fixups(struct pci_dev *dev, struct pci_fixup *f,
 			  struct pci_fixup *end)
 {
Signature · 6 lines
-- 
Jean Delvare
--
To unsubscribe from this list: send the line "unsubscribe linux-pci" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Signature · 9 lines
Matthew Wilcox				Intel Open Source Technology Centre
"Bill, look, we understand that you're interested in selling us this
operating system, but compare it to ours.  We can't possibly take such
a retrograde step."

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

Hi Matthew,

Quoted 10 lines · Matthew Wilcox
Quoted 8 lines · Jean Delvare

The MSI MS-7031 is based on an ATI IXP300 south bridge. On this south bridge, accessible I/O ports must be enabled explicitly. Unfortunately the BIOS forgets to enable access to the hardware monitoring chip I/O ports, so hardware monitoring fails.

Add a quirk enabling access to the required ports (0x295-0x296). This is exactly what MSI's own hardware monitoring application is doing, so it has to be the right way.

Quoted 6 lines
Quoted 1 line

+#if defined CONFIG_X86 && (defined CONFIG_HWMON || defined CONFIG_HWMON_MODULE)

I don't like this. It goes against the principle that enabling a module shouldn't cause the base kernel to get rebuilt. Is there a reason that the hardware monitoring code can't contain this quirk instead of the generic PCI code?

No reason other than the fact that putting it in pci/quirks.c was easier. I can certainly move the quirk to hwmon/hwmon.c, but as far as I can see you have the exact same problem there: enabling or disabling PCI support will cause the base hwmon module to be rebuilt. If hwmon is built into the kernel then you have to relink the kernel.

Quoted 26 lines
Quoted 26 lines
drivers/pci/quirks.c +23 -0
+/* Open access to 0x295-0x296 (hardware monitoring chip) on MSI MS-7031 */
+static void __devinit ati_ixp300_open_ioport(struct pci_dev *dev)
+{
+	u16 base;
+	u8 enable;
+
+	if (!(dev->subsystem_vendor = 0x1462 &&	/* MSI */
+	      dev->subsystem_device = 0x0031))		/* MS-7031 */
+		return;
+
+	pci_read_config_byte(dev, 0x48, &enable);
+	pci_read_config_word(dev, 0x64, &base);
+
+	if (base = 0 && !(enable & BIT(2))) {
+		dev_info(&dev->dev, "Opening wide generic port at 0x295\n");
+		pci_write_config_word(dev, 0x64, 0x295);
+		pci_write_config_byte(dev, 0x48, enable | BIT(2));
+	}
+}
+
+DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_ATI, 0x436c, ati_ixp300_open_ioport);
+#endif	/* CONFIG_X86 && CONFIG_HWMON */
+
 static void pci_do_fixups(struct pci_dev *dev, struct pci_fixup *f,
 			  struct pci_fixup *end)
 {
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 Jean Delvare
Quoted 7 lines · Jean Delvare
Quoted 6 lines
Quoted 1 line

+#if defined CONFIG_X86 && (defined CONFIG_HWMON || defined CONFIG_HWMON_MODULE)

I don't like this. It goes against the principle that enabling a module shouldn't cause the base kernel to get rebuilt. Is there a reason that the hardware monitoring code can't contain this quirk instead of the generic PCI code?

Quoted 5 lines

No reason other than the fact that putting it in pci/quirks.c was easier. I can certainly move the quirk to hwmon/hwmon.c, but as far as I can see you have the exact same problem there: enabling or disabling PCI support will cause the base hwmon module to be rebuilt. If hwmon is built into the kernel then you have to relink the kernel.

Trust me, if you enable or disable PCI support, you already have to relink the kernel ;-)

Signature · 9 lines
Matthew Wilcox				Intel Open Source Technology Centre
"Bill, look, we understand that you're interested in selling us this
operating system, but compare it to ours.  We can't possibly take such
a retrograde step."

_______________________________________________
lm-sensors mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors
#4 lore raw
In reply to Jean Delvare
Quoted 8 lines · Matthew Wilcox
Quoted 7 lines · Jean Delvare
Quoted 6 lines
Quoted 1 line

+#if defined CONFIG_X86 && (defined CONFIG_HWMON || defined CONFIG_HWMON_MODULE)

I don't like this. It goes against the principle that enabling a module shouldn't cause the base kernel to get rebuilt. Is there a reason that the hardware monitoring code can't contain this quirk instead of the generic PCI code?

Quoted 8 lines
Quoted 5 lines

No reason other than the fact that putting it in pci/quirks.c was easier. I can certainly move the quirk to hwmon/hwmon.c, but as far as I can see you have the exact same problem there: enabling or disabling PCI support will cause the base hwmon module to be rebuilt. If hwmon is built into the kernel then you have to relink the kernel.

Trust me, if you enable or disable PCI support, you already have to relink the kernel ;-)

I can't really disagree... I'll send an updated patch, to be merged through the hwmon tree this time.

Signature · 6 lines
Jean Delvare

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