[fixed]#!/sbin/runscript # This shell script takes care of starting and stopping the northbridge "cool" bits # /etc/init.d/athlon_cool_bit by SteveB, email: tp22a@softhome.net checkconfig() { if [ ! -f /sbin/lspci ]; then eerror "You need \"sys-apps/grep\" for this to work" return 1 fi if [ ! -f /bin/grep ]; then eerror "You need \"sys-apps/grep\" for this to work" return 1 fi } start() { PCI_Class="" PCI_Vendor="" PCI_Devic="" PCI_SVendor="" PCI_SDevice="" lspci -m -v -s 0:0.0 | grep -i "^[A-Za-z0-9]" | while true do read LSPCI_LINE LSPCI_LINE_RC="$?" LSPCI_KEY="" LSPCI_VALUE="" LSPCI_KEY="${LSPCI_LINE%%:*}" LSPCI_VALUE="${LSPCI_LINE#*:}" if [ "${LSPCI_KEY}" = "Class" ]; then PCI_Class="${LSPCI_VALUE}" elif [ "${LSPCI_KEY}" = "Vendor" ]; then PCI_Vendor="${LSPCI_VALUE}" elif [ "${LSPCI_KEY}" = "Device" ]; then PCI_Device="${LSPCI_VALUE}" elif [ "${LSPCI_KEY}" = "SVendor" ]; then PCI_SVendor="${LSPCI_VALUE}" elif [ "${LSPCI_KEY}" = "SDevice" ]; then PCI_SDevice="${LSPCI_VALUE}" fi if [ "${LSPCI_LINE_RC}" -ne "0" ]; then if (echo "${PCI_SVendor}" | grep -iq "Asustek" ) && (echo "${PCI_SDevice}" | grep -iq "A7V333" ); then # Asus A7V333 Mainboard ebegin "Starting KT266/266a NB cool bit [A7V333]" setpci -H1 -s 0:0.0 92=EB >/dev/null 2>&1 eend $? elif (echo "${PCI_SVendor}" | grep -iq "Microstar" ) && (echo "${PCI_SDevice}" | grep -iq "K7T266Pro" ); then # MSI K7T266Pro (MS-6380) ebegin "Starting KT266 NB cool bit [K7T266Pro]" setpci -H1 -s 0:0.0 70=86 >/dev/null 2>&1 && setpci -H1 -s 0:0.0 95=1E >/dev/null 2>&1 eend $? elif (echo "${PCI_Vendor}" | grep -iq "VIA Technologies" ) && (echo "${PCI_Device}" | grep -iq "KT133" ); then # Generic KT133 Mainboard ebegin "Starting KT133/133a NB cool bit [generic]" setpci -H1 -s 0:0.0 52=EB >/dev/null 2>&1 eend $? elif (echo "${PCI_Vendor}" | grep -iq "VIA Technologies" ) && (echo "${PCI_Device}" | grep -iq "KT266" ); then # Generic KT266 Mainboard ebegin "Starting KT266/266a NB cool bit [generic]" setpci -H1 -s 0:0.0 92=EB >/dev/null 2>&1 eend $? elif (echo "${PCI_Vendor}" | grep -iq "VIA Technologies" ) && (echo "${PCI_Device}" | grep -iq "KT333" ); then # Generic KT333 Mainboard ebegin "Starting KT333 NB cool bit [generic]" setpci -H1 -s 0:0.0 70=86 >/dev/null 2>&1 && setpci -H1 -s 0:0.0 95=1E >/dev/null 2>&1 eend $? elif (echo "${PCI_Vendor}" | grep -iq "VIA Technologies" ) && (echo "${PCI_Device}" | grep -iq "KT400" ); then # Generic KT400 Mainboard (experimental: plz mail me if it works, maybee someone could test this for the other chip$ ebegin "Starting KT400 NB cool bit [generic]" setpci -H1 -s 0:0.0 D2=EB >/dev/null 2>&1 eend $? elif (echo "${PCI_Vendor}" | grep -iq "VIA Technologies" ) && (echo "${PCI_Class}" | grep -iq "Host bridge" ); then # Unknown VIA host bridge [[ "${PCI_Vendor}" != "" ]] && einfo "Vendor: ${PCI_Vendor}" [[ "${PCI_Device}" != "" ]] && einfo "Device: ${PCI_Device}" [[ "${PCI_SVendor}" != "" ]] && einfo "SVendor: ${PCI_SVendor}" [[ "${PCI_SDevice}" != "" ]] && einfo "SDevice: ${PCI_SDevice}" eend 1 "Unknown VIA host bridge" return 1 else # Unknown host bridge # on AMD760/AMD761: # enable: setpci -s 0:0.0 0x62=0xb7 # disable: setpci -s 0:0.0 0x62=0xb1 # on sis730: (experimental: plz mail me if it works, maybee someone could test this for the other chipsets also ?) # enable: setpci -s 0:0.0 6b=0x19 # disbale: setpci -s 0:0.0 6b=0x18 # Athlon XP (experimental: plz mail me if it works) # enable: setpci -v -H1 -s 0:0.0 92=EB # disable: setpci -v -H1 -s 0:0.0 92=6B [[ "${PCI_Vendor}" != "" ]] && einfo "Vendor: ${PCI_Vendor}" [[ "${PCI_Device}" != "" ]] && einfo "Device: ${PCI_Device}" [[ "${PCI_SVendor}" != "" ]] && einfo "SVendor: ${PCI_SVendor}" [[ "${PCI_SDevice}" != "" ]] && einfo "SDevice: ${PCI_SDevice}" eend 1 "Unknown host bridge" return 1 fi # exit while true loop break fi done } stop() { PCI_Class="" PCI_Vendor="" PCI_Devic="" PCI_SVendor="" PCI_SDevice="" lspci -m -v -s 0:0.0 | grep -i "^[A-Za-z0-9]" | while true do read LSPCI_LINE LSPCI_LINE_RC="$?" LSPCI_KEY="" LSPCI_VALUE="" LSPCI_KEY="${LSPCI_LINE%%:*}" LSPCI_VALUE="${LSPCI_LINE#*:}" if [ "${LSPCI_KEY}" = "Class" ]; then PCI_Class="${LSPCI_VALUE}" elif [ "${LSPCI_KEY}" = "Vendor" ]; then PCI_Vendor="${LSPCI_VALUE}" elif [ "${LSPCI_KEY}" = "Device" ]; then PCI_Device="${LSPCI_VALUE}" elif [ "${LSPCI_KEY}" = "SVendor" ]; then PCI_SVendor="${LSPCI_VALUE}" elif [ "${LSPCI_KEY}" = "SDevice" ]; then PCI_SDevice="${LSPCI_VALUE}" fi if [ "${LSPCI_LINE_RC}" -ne "0" ]; then if (echo "${PCI_SVendor}" | grep -iq "Asustek" ) && (echo "${PCI_SDevice}" | grep -iq "A7V333" ); then # Asus A7V333 Mainboard ebegin "Resetting KT266/266a NB cool bit [A7V333]" setpci -H1 -s 0:0.0 92=6B >/dev/null 2>&1 eend $? elif (echo "${PCI_SVendor}" | grep -iq "Microstar" ) && (echo "${PCI_SDevice}" | grep -iq "K7T266Pro" ); then # MSI K7T266Pro (MS-6380) ebegin "Resetting KT266 NB cool bit [K7T266Pro]" setpci -H1 -s 0:0.0 70=82 >/dev/null 2>&1 && setpci -H1 -s 0:0.0 95=1C >/dev/null 2>&1 eend $? elif (echo "${PCI_Vendor}" | grep -iq "VIA Technologies" ) && (echo "${PCI_Device}" | grep -iq "KT133\|KX133" ); then # Generic KT133 Mainboard ebegin "Resetting KT133/133a and KX133 NB cool bit [generic]" setpci -H1 -s 0:0.0 52=6B >/dev/null 2>&1 eend $? elif (echo "${PCI_Vendor}" | grep -iq "VIA Technologies" ) && (echo "${PCI_Device}" | grep -iq "KT266" ); then # Generic KT266 Mainboard ebegin "Resetting KT266/266a NB cool bit [generic]" setpci -H1 -s 0:0.0 92=6B >/dev/null 2>&1 eend $? elif (echo "${PCI_Vendor}" | grep -iq "VIA Technologies" ) && (echo "${PCI_Device}" | grep -iq "KT333" ); then # Generic KT333 Mainboard ebegin "Resetting KT333 NB cool bit [generic]" setpci -H1 -s 0:0.0 70=82 >/dev/null 2>&1 && setpci -H1 -s 0:0.0 95=1C >/dev/null 2>&1 eend $? elif (echo "${PCI_Vendor}" | grep -iq "VIA Technologies" ) && (echo "${PCI_Device}" | grep -iq "KT400" ); then # Generic KT400 Mainboard (experimental: plz mail me if it works, maybee someone could test this for the other chipsets also ?) ebegin "Resetting KT400 NB cool bit [generic]" setpci -H1 -s 0:0.0 D2=6B >/dev/null 2>&1 eend $? elif (echo "${PCI_Vendor}" | grep -iq "VIA Technologies" ) && (echo "${PCI_Class}" | grep -iq "Host bridge" ); then # Unknown VIA host bridge [[ "${PCI_Vendor}" != "" ]] && einfo "Vendor: ${PCI_Vendor}" [[ "${PCI_Device}" != "" ]] && einfo "Device: ${PCI_Device}" [[ "${PCI_SVendor}" != "" ]] && einfo "SVendor: ${PCI_SVendor}" [[ "${PCI_SDevice}" != "" ]] && einfo "SDevice: ${PCI_SDevice}" eend 1 "Unknown VIA host bridge" return 1 else # Unknown host bridge # on AMD760/AMD761: # enable: setpci -s 0:0.0 0x62=0xb7 # disable: setpci -s 0:0.0 0x62=0xb1 # on sis730: (experimental: plz mail me if it works, maybee someone could test this for the other chipsets also ?) # enable: setpci -s 0:0.0 6b=0x19 # disbale: setpci -s 0:0.0 6b=0x18 # Athlon XP (experimental: plz mail me if it works) # enable: setpci -v -H1 -s 0:0.0 92=EB # disable: setpci -v -H1 -s 0:0.0 92=6B [[ "${PCI_Vendor}" != "" ]] && einfo "Vendor: ${PCI_Vendor}" [[ "${PCI_Device}" != "" ]] && einfo "Device: ${PCI_Device}" [[ "${PCI_SVendor}" != "" ]] && einfo "SVendor: ${PCI_SVendor}" [[ "${PCI_SDevice}" != "" ]] && einfo "SDevice: ${PCI_SDevice}" eend 1 "Unknown host bridge" return 1 fi # exit while true loop break fi done } |