免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 1888 | 回复: 1
打印 上一主题 下一主题

关于smbus(又要麻烦各位大牛了) [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2006-04-20 17:05 |只看该作者 |倒序浏览
最近需要通过smbus来读取一些信息,但是在一些机器上smbus好像被隐藏了.我google了好久就找到了一个linux内核得patch;我刚开始学习linux所以麻烦各位大牛解释一下
我想知道得是pci_read_config_word(dev, 0xF2, &val);读取得是这个设备得什么信息?


劳烦各位指点一下;不胜感激;


Asus hides the SMBus PCI bridge within the ICH2 or ICH4 southbridge on
Asus P4B/P4PE mainboards. The attached patch adds a quirk to re-enable the
SMBus PCI bridge for P4B533 and P4PE mainboards.

           Dominik

diff -ru linux-original/drivers/pci/quirks.c linux/drivers/pci/quirks.c
--- linux-original/drivers/pci/quirks.c        2003-03-19 22:13:57.000000000 +0100
+++ linux/drivers/pci/quirks.c        2003-03-19 22:14:52.000000000 +0100
@@ -647,6 +647,53 @@
}

/*
+ * On ASUS P4B boards, the SMBus PCI Device within the ICH2/4 southbridge
+ * is not activated. The myth is that Asus said that they do not want the
+ * users to be irritated by just another PCI Device in the Win98 device
+ * manager. (see the file prog/hotplug/README.p4b in the lm_sensors
+ * package 2.7.0 for details)
+ *
+ * The SMBus PCI Device can be activated by setting a bit in the ICH LPC
+ * bridge. Unfortunately, this device has no subvendor/subdevice ID. So it
+ * becomes necessary to do this tweak in two steps -- I've chosen the Host
+ * bridge as trigger.
+ */
+
+static int __initdata asus_hides_smbus = 0;
+
+static void __init asus_hides_smbus_hostbridge(struct pci_dev *dev)
+{
+        if (likely(dev->subsystem_vendor != PCI_VENDOR_ID_ASUSTEK))
+                return;
+
+        if ((dev->device == PCI_DEVICE_ID_INTEL_82845_HB) &&
+            (dev->subsystem_device == 0x808) /* P4B533 */
+                asus_hides_smbus = 1;
+        if ((dev->device == PCI_DEVICE_ID_INTEL_82845G_HB) &&
+            (dev->subsystem_device == 0x80b2)) /* P4PE */
+                asus_hides_smbus = 1;
+        return;
+}
+
+static void __init asus_hides_smbus_lpc(struct pci_dev *dev)
+{
+        u16 val;
+       
+        if (likely(!asus_hides_smbus))
+                return;
+
+        pci_read_config_word(dev, 0xF2, &val);
+        if (val & 0x {
+                pci_write_config_word(dev, 0xF2, val & (~0x);
+                pci_read_config_word(dev, 0xF2, &val);
+                if(val & 0x
+                        printk(KERN_INFO "CI: i801 SMBus device continues to play 'hide and seek'! 0x%x\n", val);
+                else
+                        printk(KERN_INFO "CI: Enabled i801 SMBus device\n";
+        }
+}
+
+/*
  *  The main table of quirks.
  */

@@ -724,6 +771,13 @@
       
        { PCI_FIXUP_HEADER,        PCI_VENDOR_ID_INTEL,        PCI_DEVICE_ID_INTEL_82375,        quirk_eisa_bridge },

+        /*
+         * on Asus P4B boards, the i801SMBus device is disabled at startup.
+         */
+        { PCI_FIXUP_HEADER,        PCI_VENDOR_ID_INTEL,        PCI_DEVICE_ID_INTEL_82845_HB,        asus_hides_smbus_hostbridge },
+        { PCI_FIXUP_HEADER,        PCI_VENDOR_ID_INTEL,        PCI_DEVICE_ID_INTEL_82845G_HB,        asus_hides_smbus_hostbridge },
+        { PCI_FIXUP_HEADER,        PCI_VENDOR_ID_INTEL,        PCI_DEVICE_ID_INTEL_82801DB_0,        asus_hides_smbus_lpc },
+
        { 0 }
};

论坛徽章:
5
2 [报告]
发表于 2006-04-21 10:10 |只看该作者
原帖由 haohao06 于 2006-4-20 17:05 发表
最近需要通过smbus来读取一些信息,但是在一些机器上smbus好像被隐藏了.我google了好久就找到了一个linux内核得patch;我刚开始学习linux所以麻烦各位大牛解释一下
我想知道得是pci_read_config_word(dev, 0xF2, & ...


读配置空间的内容. 至于具体的意义, 要参考硬件的spec, 有对配置空间的详细描述.
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP