root/lm-sensors/trunk/prog/hotplug/unhide_ICH_SMBus

Revision 5985, 1.8 KB (checked in by khali, 7 months ago)

Major kernel version number was bumped to 3.

  • Property svn:executable set to *
Line 
1#!/bin/bash
2# (C) Rudolf Marek <r.marek@assembler.cz>,
3#     Jean Delvare <khali@linux-fr.org>
4#
5#    Thanks Jean Delvare and Oliver Dreier <oliver@dinux.de> for testing.
6#
7#    This program is free software; you can redistribute it and/or modify
8#    it under the terms of the GNU General Public License version 2
9#    as published by the Free Software Foundation
10#
11# Supports the following Intel ICH chipsets:
12#              PCI ID
13#   ICH       8086:2410
14#   ICH2      8086:2440
15#   ICH2-M    8086:244C
16#   ICH3      8086:2480
17#   ICH3-M    8086:248C
18#   ICH4      8086:24C0
19#   ICH4-M    8086:24CC
20#   ICH5      8086:24D0
21
22pcibus="/sys/bus/pci/slots"
23device="00:1f"
24
25if [ "$UID" -ne 0 ] ; then
26        echo "You need to be root to run this script!"
27        exit 252
28fi
29
30smbus=`lspci -n -s $device.3 | grep -i '0c05: *8086'`
31if [ -n "$smbus" ] ; then
32        echo "ICH SMBus is already there!"
33        lspci -s $device.3
34        exit
35fi
36
37intel=`lspci -n -s $device.0 | grep -i '8086:24[148CD][0C]'`
38if [ -z "$intel" ] ; then
39        echo "Not for your chipset - Intel (ICH) only"
40        echo "Supported: ICH, ICH2, ICH2-M, ICH3, ICH3-M, ICH4, ICH4-M, ICH5"
41        exit 255;
42fi
43modprobe fakephp &> /dev/null
44
45if [ ! -d "$pcibus" ] ; then
46        echo "You need the fake PCI hotplug driver! (fakephp.ko, kernel 2.6.5 or later)"
47        exit 255;
48fi
49
50echo "Enabling SMBus PCI device ..."
51
52newval=$( printf '%x' $((0x$(setpci -s $device.0 f2.w) & 0xfff7)))
53setpci -s $device.0 f2.w=$newval
54
55echo "Rescanning the bus ..."
56echo 1 > $pcibus/0000:$device.0/power 2>/dev/null
57if [ ! -d "$pcibus/0000:$device.3" ] ; then
58        echo "Failed to enable the SMBUS"
59        exit 253;
60fi
61
62if [ ! -d "/sys/bus/pci/drivers/i801_smbus" ] ; then
63        echo "Loading i2c-i801 ..."
64        modprobe i2c-i801
65        if [ $? -ne 0 ] ; then
66                exit 251
67        fi
68fi
69
70lspci -s $device.3
71echo "Done!"
72echo "Remember: system suspend/resume is no longer safe to use."
Note: See TracBrowser for help on using the browser.