File: unhide_ICH_SMBus

package info (click to toggle)
lm-sensors 1%3A2.10.7-1
  • links: PTS
  • area: main
  • in suites: lenny
  • size: 5,324 kB
  • ctags: 10,814
  • sloc: ansic: 63,969; perl: 8,111; sh: 1,823; makefile: 399; lex: 371; yacc: 312; python: 11
file content (72 lines) | stat: -rwxr-xr-x 1,830 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
#!/bin/bash
# (C) Rudolf Marek <r.marek@assembler.cz>,
#     Jean Delvare <khali@linux-fr.org>
#
#    Thanks Jean Delvare and Oliver Dreier <oliver@dinux.de> for testing.
#
#    This program is free software; you can redistribute it and/or modify
#    it under the terms of the GNU General Public License version 2
#    as published by the Free Software Foundation
#
# Supports the following Intel ICH chipsets:
#              PCI ID
#   ICH       8086:2410
#   ICH2      8086:2440
#   ICH2-M    8086:244C
#   ICH3      8086:2480
#   ICH3-M    8086:248C
#   ICH4      8086:24C0
#   ICH4-M    8086:24CC
#   ICH5      8086:24D0

pcibus="/sys/bus/pci/slots"
device="00:1f"

if [ "$UID" -ne 0 ] ; then
	echo "You need to be root to run this script!"
	exit 252
fi

smbus=`lspci -n -s $device.3 | grep -i '0c05: *8086'`
if [ -n "$smbus" ] ; then
	echo "ICH SMBus is already there!"
	lspci -s $device.3
	exit
fi

intel=`lspci -n -s $device.0 | grep -i '8086:24[148CD][0C]'`
if [ -z "$intel" ] ; then
	echo "Not for your chipset - Intel (ICH) only"
	echo "Supported: ICH, ICH2, ICH2-M, ICH3, ICH3-M, ICH4, ICH4-M, ICH5"
	exit 255;
fi
modprobe fakephp &> /dev/null

if [ ! -d "$pcibus" ] ; then
	echo "You need the fake PCI hotplug driver! (fakephp.ko and 2.6 kernel)"
	exit 255;
fi

echo "Enabling SMBus PCI device ..."

newval=$( printf '%x' $((0x$(setpci -s $device.0 f2.w) & 0xfff7))) 
setpci -s $device.0 f2.w=$newval

echo "Rescanning the bus ..."
echo 1 > $pcibus/0000:$device.0/power 2>/dev/null
if [ ! -d "$pcibus/0000:$device.3" ] ; then
	echo "Failed to enable the SMBUS"
	exit 253;
fi

if [ ! -d "/sys/bus/pci/drivers/i801_smbus" ] ; then
	echo "Loading i2c-i801 ..."
	modprobe i2c-i801
	if [ $? -ne 0 ] ; then
		exit 251
	fi
fi

lspci -s $device.3
echo "Done!"
echo "Remember: system suspend/resume is no longer safe to use."