From: Michael Opdenacker <zumbi3@free.fr>
To: Dominik Brodowski <linux@dominikbrodowski.de>
Cc: cpufreq mailing list <cpufreq@www.linux.org.uk>
Subject: Re: Shell script to select the right cpufreq module?
Date: Tue, 30 Mar 2004 23:02:32 +0200 [thread overview]
Message-ID: <4069E068.9010408@free.fr> (raw)
In-Reply-To: <20040330203109.GA7141@dominikbrodowski.de>
Hi Dominik!
That's a very good start... thanks a lot!
I will modify it according to my needs (just need something that sets a
variable to the right module name, or leaves it with an empty value
otherwise), and will post it to this list for testing, in particular on
non Intel processors.
:-)
Michael.
>On Tue, Mar 30, 2004 at 09:27:33PM +0200, Michael Opdenacker wrote:
>
>
>>Does anyone here already have a shell script that reads /proc/cpuinfo
>>and returns the name of the corresponding cpufreq module if the
>>processor is supported?
>>
>>Otherwise, I'll start to write one and ask you guys to test it, as I can
>>only make tests on P4.
>>
>>
>
>I proposed one such shell script a couple of weeks ago and submitted a
>draft, which I can't locate in the archives ATM so here it is again:
>
>#!/bin/sh
>
># Copyright (C) 2004 Dominik Brodowski <linux@brodo.de>
>#
># This script 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.
>#
># This script tries to detect the best suited x86 cpufreq driver, and
># load it using "modprobe" commands.
>#
>#
>
>DEBUG=1
>
>KV="$(uname -r | cut -c1-3)"
>
>if [ "$KV" != "2.6" ]; then
> echo "Wrong kernel version"
> exit 1
>fi
>
># the cpufreq drivers
>ACPI=0
>P4CLOCKMOD=0
>SPEEDSTEP_SMI=0
>SPEEDSTEP_ICH=0
>SPEEDSTEP_CENTRINO=0
>FLAG_EST=0
>FLAG_ACPI=0
>FLAG_ACC=0
>
># parse /proc/cpuinfo
>FAMILY="$(cat /proc/cpuinfo | grep "cpu family" | cut -c14-)"
>MODEL="$(cat /proc/cpuinfo | grep "model" | grep -v "model name" | cut -c10-)"
>STEPPING="$(cat /proc/cpuinfo | grep "stepping" | cut -c12-)"
>
># parse for vendor
>cat /proc/cpuinfo | grep vendor_id | grep Intel &> /dev/null && INTEL=1
>
># parse flags
>cat /proc/cpuinfo | grep "flags" | grep " est" &> /dev/null && FLAG_EST=1
>cat /proc/cpuinfo | grep "flags" | grep " acpi" &> /dev/null && FLAG_ACPI=1
>cat /proc/cpuinfo | grep "flags" | grep " tm" &> /dev/null && FLAG_ACC=1
>
>
>if [ $DEBUG -eq 1 ]; then
> echo "CPU family is $FAMILY"
> echo "CPU model is $MODEL"
> echo "CPU stepping is $STEPPING"
> echo "CPU vendor: Intel? $INTEL"
>fi
>
>
>if [ $INTEL -eq 1 ]; then
> case "$FAMILY" in
> "6")
> if [ $DEBUG -eq 1 ]; then
> echo "Pentium 3 or Pentium M detected."
> fi
> case "$MODEL" in
> "9")
> if [ "$STEPPING" == "5" ] ; then
> if [ $FLAG_EST -eq 1 ]; then
> SPEEDSTEP_CENTRINO=1
> fi
> fi
> ;;
> "8")
> SPEEDSTEP_SMI=1
> SPEEDSTEP_ICH=1
> ;;
> "11")
> SPEEDSTEP_ICH=1
> ;;
> *)
> echo "Unknown CPU."
> ;;
> esac
> ;;
> "15")
> if [ $DEBUG -eq 1 ]; then
> echo "Pentium 4 detected."
> fi
> if [ "$MODEL" == "2" ]; then
> case "$STEPPING" in
> "4")
> SPEEDSTEP_ICH=1
> ;;
> "7")
> SPEEDSTEP_ICH=1
> ;;
> "9")
> SPEEDSTEP_ICH=1
> ;;
> *)
> true
> ;;
> esac
> fi
> ;;
> *)
> echo "unknown Intel Processor. Aborting."
> exit 1
> ;;
> esac
> if [ $FLAG_ACPI -eq 1 ]; then
> if [ $FLAG_ACC -eq 1 ]; then
> P4CLOCKMOD=1;
> fi
> fi
> ACPI=1
>fi
>
>if [ $DEBUG -eq 1 ]; then
> echo "ACPI? $ACPI"
> echo "P4CLOCKMOD? $P4CLOCKMOD"
> echo "SPEEDSTEP_CENTRINO? $SPEEDSTEP_CENTRINO"
> echo "SPEEDSTEP_ICH? $SPEEDSTEP_ICH"
> echo "SPEEDSTEP_SMI? $SPEEDSTEP_SMI"
>fi
>
>if [ $SPEEDSTEP_CENTRINO -eq 1 ]; then
> modprobe speedstep-centrino
>fi
>
>if [ $SPEEDSTEP_ICH -eq 1 ]; then
> modprobe speedstep-ich
>fi
>
>if [ $ACPI -eq 1 ]; then
> modprobe acpi
>fi
>
>if [ $P4CLOCKMOD -eq 1 ]; then
> modprobe p4-clockmod
>fi
>
>if [ $SPEEDSTEP_SMI -eq 1 ]; then
> modprobe speedstep-smi
>fi
>
>
>
>end of script... and as I'm more interested in the kernel side of cpufreq
>anyways, I'd be glad if somebody else would finish this script and make it
>ready for prime-time usage. Are you willing to do so? Would be great!
>
> Dominik
>
>
>
>
--
Michael Opdenacker
http://opdenacker.org/
next prev parent reply other threads:[~2004-03-30 21:02 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-03-30 19:27 Shell script to select the right cpufreq module? Michael Opdenacker
2004-03-30 20:31 ` Dominik Brodowski
2004-03-30 21:02 ` Michael Opdenacker [this message]
2004-03-31 15:34 ` Carl Thompson
2004-03-31 15:44 ` Dominik Brodowski
2004-03-31 15:59 ` Dave Jones
2004-04-01 4:52 ` Carl Thompson
2004-04-01 7:53 ` Mattia Dongili
2004-04-01 12:48 ` Dave Jones
2004-04-02 22:15 ` Carl Thompson
2004-04-02 22:36 ` Dave Jones
2004-04-02 23:42 ` Carl Thompson
2004-03-31 15:48 ` Michael Opdenacker
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4069E068.9010408@free.fr \
--to=zumbi3@free.fr \
--cc=cpufreq@www.linux.org.uk \
--cc=linux@dominikbrodowski.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox