root/lm-sensors/branches/lm-sensors-3.0.0/prog/hotplug/unhide_ICH_SMBus @ 4944

Revision 4944, 1.8 KB (checked in by khali, 6 years ago)

Drop extra slash.

  • 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#   ICH2      8086:2440
14#   ICH2-M    8086:244C
15#   ICH3      8086:2480
16#   ICH3-M    8086:248C
17#   ICH4      8086:24C0
18#   ICH4-M    8086:24CC
19#   ICH5      8086:24D0
20
21pcibus="/sys/bus/pci/slots"
22device="00:1f"
23
24if [ "$UID" -ne 0 ] ; then
25        echo "You need to be root to run this script!"
26        exit 252
27fi
28
29smbus=`lspci -n -s $device.3 | grep -i '0c05: *8086'`
30if [ -n "$smbus" ] ; then
31        echo "ICH SMBus is already there!"
32        lspci -s $device.3
33        exit
34fi
35
36intel=`lspci -n -s $device.0 | grep -i '8086:24[48CD][0C]'`
37if [ -z "$intel" ] ; then
38        echo "Not for your chipset - Intel (ICH) only"
39        echo "Supported: ICH2, ICH2-M, ICH3, ICH3-M, ICH4, ICH4-M, ICH5"
40        exit 255;
41fi
42modprobe fakephp &> /dev/null
43
44if [ ! -d "$pcibus" ] ; then
45        echo "You need the fake PCI hotplug driver! (fakephp.ko and 2.6 kernel)"
46        exit 255;
47fi
48
49echo "Enabling SMBus PCI device ..."
50
51newval=$( printf '%x' $((0x$(setpci -s $device.0 f2.w) & 0xfff7)))
52setpci -s $device.0 f2.w=$newval
53
54echo "Rescanning the bus ..."
55echo 1 > $pcibus/0000:$device.0/power 2>/dev/null
56if [ ! -d "$pcibus/0000:$device.3" ] ; then
57        echo "Failed to enable the SMBUS"
58        exit 253;
59fi
60
61if [ ! -d "/sys/bus/pci/drivers/i801_smbus" ] ; then
62        echo "Loading i2c-i801 ..."
63        modprobe i2c-i801
64        if [ $? -ne 0 ] ; then
65                exit 251
66        fi
67fi
68
69lspci -s $device.3
70echo "Done!"
71echo "Remember: system suspend/resume is no longer safe to use."
Note: See TracBrowser for help on using the browser.