SpeedStep New Driver for Pentium III (-M) using SMI interface
Hi,
I have tried to make the driver which use Intel Speedstep applet's SMI interface for 3 months.
This driver is based on the information from
1. Microsoft Windows XP Document.
we can get the SMI interface values from ax=E980/int15 BIOS call.
2. Intel SpeedStep Applet Document.(from HP.com)
http://h18007.www1.hp.com/support/files/evonotebook/us/download/10631.html
" Adds code to request transition ownership when processing
the system critical resume message. When a critical hibernate occurs, the Applet does not receive any system level notification. The change forces
the Applet to re-acquire transition ownership upon resume from a critical hibernate. "
This is informative. This saied that something 'ownership' call is needed on SMI interface first.
3. Grover, Andrew's int 15h patch posted to cpufreq ml
Message-ID: <[email protected]> code which call BIOS to get SMI values. I included it.
4. Malik Martin's rev engineering results. call is made with BX, CX, EDI register values. and need signature 'ISG' when call. find function values. bx=1(get) and bx=2(set)
5. Marc Lehmann's 'speedstep' utility,
sample of assembler code to call SMI.
6. My work.
find function to return max/min freq which system supportd. (bx=4) more values are gotten, but I cannot understand...
find 'ownership' function value(bx=0, which is other than 1 2 4..).
ToDo(in pregress)
support governor "auto" and using smi_event call, imprement auto freq change fearture.
test on 440BX/ZX platform.
Memo
module parameters are override result of an int 15h/eax=E890h call. these parameter value are gotten from Windows XP registory. HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\P3\Parameters\SmiCmdPort== smi_port HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\P3\Parameters\SmiCmdData== smi_cmd If there are no values in the registory, you don't need to set module parameters.
It's just an alpha status. This may be useful with PIIX4 or ICH based M-P-III. This patch (changeset) is against 2.6.0-test4.
Signature · 4 lines
Hiroshi Miura --- http://www.da-cha.org/ NTTDATA Corp. Marketing & Business Strategy Planning Dept. --- [email protected] Key fingerprint = 9117 9407 5684 FBF1 4063 15B4 401D D077 04AB 8617 -- My hacking life is happy as the day is long
_______________________________________________
Cpufreq mailing list
[email protected]
http://www.linux.org.uk/mailman/listinfo/cpufreq
Quoted 1 line · Hiroshi Miura
It's just an alpha status. This may be useful with PIIX4 or ICH based M-P-III.
I am ready to try it, but need a patch against 2.4(22,23pre):
model name : Mobile Intel(R) Pentium(R) 4 - M CPU 2.20GHz
stepping : 7
cpufreq: Intel(R) SpeedStep(TM) for this chipset not (yet) available.
cpufreq: P4/Xeon(TM) CPU On-Demand Clock Modulation available
Best wishes
Norbert
-------------------------------------------------------------------------------
Norbert Preining <preining AT logic DOT at> Technische Universität Wien
gpg DSA: 0x09C5B094 fp: 14DF 2E6C 0307 BE6D AD76 A9C0 D2BF 4AA3 09C5 B094
-------------------------------------------------------------------------------
BEREPPER
The irrevocable and sturdy fart released in the presence of royalty, which sounds quite like a small motorbike passing by (but not enough to be confused with one).
--- Douglas Adams, The Meaning of Liff
Hi,
I think you can use speedstep-centrino driver or acpi P-state instead.
At Tue, 2 Sep 2003 07:35:57 +0200,
Quoted 8 lines · Norbert Preining
I am ready to try it, but need a patch against 2.4(22,23pre):
model name : Mobile Intel(R) Pentium(R) 4 - M CPU 2.20GHz
stepping : 7cpufreq: Intel(R) SpeedStep(TM) for this chipset not (yet) available.
cpufreq: P4/Xeon(TM) CPU On-Demand Clock Modulation available
Signature · 4 lines
Hiroshi Miura --- http://www.da-cha.org/ NTTDATA Corp. Marketing & Business Strategy Planning Dept. --- [email protected] Key fingerprint = 9117 9407 5684 FBF1 4063 15B4 401D D077 04AB 8617 -- My hacking life is happy as the day is long
Quoted 1 line · Hiroshi Miura
I think you can use speedstep-centrino driver or acpi P-state instead.
no, either p4-clockmod or speedstep-ich
Best wishes
Norbert
-------------------------------------------------------------------------------
Norbert Preining <preining AT logic DOT at> Technische Universität Wien
gpg DSA: 0x09C5B094 fp: 14DF 2E6C 0307 BE6D AD76 A9C0 D2BF 4AA3 09C5 B094
-------------------------------------------------------------------------------
KETTERING (n.)
The marks left on your bottom or thighs after sunbathing on a wickerwork chair.
--- Douglas Adams, The Meaning of Liff
Quoted 7 lines · Hiroshi Miura
At Tue, 2 Sep 2003 07:35:57 +0200,
Quoted 3 lines · Norbert Preining
I am ready to try it, but need a patch against 2.4(22,23pre):
Quoted 7 lines
Quoted 5 lines
model name : Mobile Intel(R) Pentium(R) 4 - M CPU 2.20GHz
stepping : 7cpufreq: Intel(R) SpeedStep(TM) for this chipset not (yet) available.
cpufreq: P4/Xeon(TM) CPU On-Demand Clock Modulation availableI think you can use speedstep-centrino driver or acpi P-state instead.
No, it is not a banias. But speedstep-ich should work, though.
Signature · 4 lines
Ducrot Bruno -- Which is worse: ignorance or apathy? -- Don't know. Don't care.
Quoted 17 lines · Hiroshi Miura
Hi,
I have tried to make the driver which use Intel Speedstep applet's SMI interface for 3 months.
This driver is based on the information from
1. Microsoft Windows XP Document.
we can get the SMI interface values from ax=E980/int15 BIOS call.2. Intel SpeedStep Applet Document.(from HP.com)
http://h18007.www1.hp.com/support/files/evonotebook/us/download/10631.html
" Adds code to request transition ownership when processing
the system critical resume message. When a critical hibernate occurs, the Applet does not receive any system level notification. The change forces
the Applet to re-acquire transition ownership upon resume from a critical hibernate. "
Quoted 2 lines
This is informative. This saied that something 'ownership' call is needed on SMI interface first.
Fine, point 2 actually killed me. One little question though, the magic string need all that? Are you sure it can not be replaced by something else? After all, you have to download the applet from the OEM, not necessary from Intel.
I need probably to rewritte it a little though (some stuff in speedstep-lib.c should be used), but anyway, that one will be commited soon, eventually replacing speedstep-piix4 if all tests are ok.
Cheers,
Signature · 4 lines
Ducrot Bruno -- Which is worse: ignorance or apathy? -- Don't know. Don't care.
Thanks for this very interesting work. Unfortunately, it doesn't work on my aged notebook, but well, the GPO driver didn't work either....
Attached are a couple of patches for your driver:
fix-warnings
fixes a couple of warnings
core-update-followup
->policy shall not be set any longer in ->target cpufreq drivers [followup to the core patches I've posted previously]
less-verbose-and-export
to run as a module, we need to export ist_info. Also, only show the IST_INFO line in dmesg if speedstep_smi is enabled.
resume
use a new ->resume callback in the cpufreq core. Dominik
arch/i386/kernel/cpu/cpufreq/speedstep-smi.c +1 -2
@@ -243,8 +243,7 @@ (speed / 1000));/* cpuinfo and default policy values */ - policy->policy = (speed == speedstep_freqs[SPEEDSTEP_LOW ].frequency) ? -CPUFREQ_POLICY_POWERSAVE :CPUFREQ_POLICY_PERFORMANCE ; + policy->governor =CPUFREQ_DEFAULT_GOVERNOR ; policy->cpuinfo.transition_latency =CPUFREQ_ETERNAL ; policy->cur = speed;
fix warning: unsigned int format, long unsigned int arg (arg 2..4)
arch/i386/kernel/setup.c +1 -1
@@ -957,7 +957,7 @@ edid_info =EDID_INFO ; apm_info.bios =APM_BIOS_INFO ; ist_info =IST_INFO ; -printk ("IST_SMI: signature:0x%.8x, command:0x%.8x, event:0x%.8x, perf_level:0x%.8x.\n" , +printk ("IST_SMI: signature:0%.8lx, command:0lx%.8lx, event:0x%.8lx, perf_level:0x%.8lx.\n" , ist_info.signature, ist_info.command, ist_info.event, ist_info.perf_level); saved_videomode =VIDEO_MODE ;printk ("Video mode to be used for restore is %lx\n" , saved_videomode);
arch/i386/kernel/i386_ksyms.c +5 -0
@@ -33,6 +33,7 @@#include <asm/tlbflush.h> #include <asm/nmi.h> #include <asm/edd.h> +#include <asm/ist.h> extern void dump_thread (struct pt_regs *,struct user *);extern spinlock_t rtc_lock;
@@ -209,3 +210,7 @@EXPORT_SYMBOL (edd);EXPORT_SYMBOL (eddnr);#endif + +#if defined(CONFIG_X86_SPEEDSTEP_SMI ) || defined(CONFIG_X86_SPEEDSTEP_SMI_MODULE ) +EXPORT_SYMBOL (ist_info); +#endif
arch/i386/kernel/setup.c +2 -0
@@ -957,8 +957,10 @@ edid_info =EDID_INFO ; apm_info.bios =APM_BIOS_INFO ; ist_info =IST_INFO ; +#if defined(CONFIG_X86_SPEEDSTEP_SMI ) || defined(CONFIG_X86_SPEEDSTEP_SMI_MODULE )printk ("IST_SMI: signature:0%.8lx, command:0lx%.8lx, event:0x%.8lx, perf_level:0x%.8lx.\n" , ist_info.signature, ist_info.command, ist_info.event, ist_info.perf_level); +#endif saved_videomode =VIDEO_MODE ;printk ("Video mode to be used for restore is %lx\n" , saved_videomode);if (SYS_DESC_TABLE .length !=0 ) {
arch/i386/kernel/cpu/cpufreq/speedstep-smi.c +12 -25
@@ -18,7 +18,6 @@#include <linux/cpufreq.h> #include <linux/pci.h> #include <linux/slab.h> -#include <linux/pm.h> #include <asm/ist.h> /* speedstep system management interface port/command.
@@ -44,8 +43,6 @@ {0, CPUFREQ_TABLE_END}, }; -static struct pm_dev *smi_pm_dev; -#define GET_SPEEDSTEP_OWNER 0#define GET_SPEEDSTEP_STATE 1#define SET_SPEEDSTEP_STATE 2
@@ -251,31 +248,25 @@ } +static int speedstep_resume (struct cpufreq_policy *policy) +{ +int result =speedstep_smi_ownership (); + +if (result) +dprintk (KERN_INFO "cpufreq: fails an aquiring ownership of a SMI interface.\n" ); + +return result; +} + +static struct cpufreq_driver speedstep_driver = { .name ="speedstep" , .verify = speedstep_verify, .target = speedstep_target, .init = speedstep_cpu_init, + .resume = speedstep_resume, }; -static int speedstep_pm_resume (struct pm_dev *dev,pm_request_t rqst,void *data) -{ -int result =0 ; - -switch (rqst) { -case PM_RESUME : - result =speedstep_smi_ownership (); -if (result) -dprintk (KERN_INFO "cpufreq: fails an aquiring ownership of a SMI interface.\n" ); -break ; -case PM_SUSPEND : -default : -/* no need actions */ -break ; - } -return result; -} -/** * speedstep_init - initializes the SpeedStep CPUFreq driver *
@@ -304,8 +295,6 @@ smi_cmd = (ist_info.command >>16 ) &0xff ; } - smi_pm_dev =pm_register (PM_SYS_DEV ,PM_SYS_UNKNOWN , speedstep_pm_resume); -return cpufreq_register_driver (&speedstep_driver); }
@@ -317,8 +306,6 @@*/ static void __exit speedstep_exit(void) { -if (smi_pm_dev) -pm_unregister (smi_pm_dev);cpufreq_unregister_driver (&speedstep_driver); }
_______________________________________________
Cpufreq mailing list
[email protected]
http://www.linux.org.uk/mailman/listinfo/cpufreq
Quoted 3 lines · Dominik Brodowski
Thanks for this very interesting work. Unfortunately, it doesn't work on my aged notebook, but well, the GPO driver didn't work either....
I guess the ownership stuff need to be explained more. How to know the magic_string stuff for example? If that can be included in detect-speedstep utility...
Signature · 4 lines
Ducrot Bruno -- Which is worse: ignorance or apathy? -- Don't know. Don't care.
Quoted 3 lines · Dominik Brodowski
Thanks for this very interesting work. Unfortunately, it doesn't work on my aged notebook, but well, the GPO driver didn't work either....
Dominik, the command is 0x80 for you, but actually it should be 0x82. I do have the exact same trouble with my toshiba. Try then to pass the correct option in order to overide that value. Unfortunately, I don't have my toshiba handy (even though it is ICH based, it may be usefull to play with).
The flags stuff is not actually exploited.
For mine (and for Dominik) it is 0x07d00100
whereas Miura-san is 0x0x07d00000
When I receive report from speedstep-detect (and also send something called speedtep-bios privatly), if bit 8 == 1, then it do not work, but I don't have the ownership stuff, though. When that bit is 0, it may or may not work. I think it is related to state on battery.
More related to the driver: I don't see any special reason to disable interrupts in-between the smi call when setting the state. Also, you don't use the speedstep_get_freqs, but use a SMI function for that (which is probably more usefull), therefore, there is no need to do the notification stuff (it was done only at _init stage, and to avoid duplicating codes).
Signature · 4 lines
Ducrot Bruno -- Which is worse: ignorance or apathy? -- Don't know. Don't care.
Fantastic, speedstep finally works on my notebook!!! Wow... Congratulations to Bruno Ducrot and Hiroshi Miura.
Quoted 10 lines · Ducrot Bruno
Quoted 3 lines · Dominik Brodowski
Thanks for this very interesting work. Unfortunately, it doesn't work on my aged notebook, but well, the GPO driver didn't work either....
Dominik, the command is
0x80for you, but actually it should be0x82. I do have the exact same trouble with my toshiba. Try then to pass the correct option in order to overide that value. Unfortunately, I don't have my toshiba handy (even though it is ICH based, it may be usefull to play with).
0x82 was one part of the story...
Quoted 10 lines
The flags stuff is not actually exploited.
For mine (and for Dominik) it is0x07d00100
whereas Miura-san is 0x0x07d00000When I receive report from speedstep-detect (and also send something called speedtep-bios privatly), if bit 8 == 1, then it do not work, but I don't have the ownership stuff, though. When that bit is 0, it may or may not work. I think it is related to state on battery.
Quoted 6 lines
More related to the driver: I don't see any special reason to disable interrupts in-between the smi call when setting the state. Also, you don't use the
speedstep_get_freqs, but use a SMI function for that (which is probably more usefull), therefore, there is no need to do the notification stuff (it was done only at_initstage, and to avoid duplicating codes).
the other part of the story is here: the speedstep_smi_get_freqs call does not work on my system -- it returns the ist_info.signature as result, and "0" and "4" as high and low frequency which is obviously bogus. Replacing it with hard-coded values for testing made it go -- BTW, GPO 0 did indeed change again, but changing GPO _alone_ [which is what the speedstep-piix4 module does] did not work.
Dominik
Quoted 2 lines · Dominik Brodowski
Fantastic, speedstep finally works on my notebook!!! Wow... Congratulations to Bruno Ducrot and Hiroshi Miura.
Congratulations must go to Miura-san. He was the one who find at last the missing bits (the ownership call) for that work.
Still I am confused for the need to setup the esi to point to a string. That sound like at first as a strange way for obfuscating things.
I really would like some comments from Intel.
Signature · 4 lines
Ducrot Bruno -- Which is worse: ignorance or apathy? -- Don't know. Don't care.
Quoted 7 lines · Dominik Brodowski
the other part of the story is here: the
speedstep_smi_get_freqscall does not work on my system -- it returns the ist_info.signature as result, and "0" and "4" as high and low frequency which is obviously bogus. Replacing it with hard-coded values for testing made it go -- BTW, GPO 0 did indeed change again, but changing GPO _alone_ [which is what the speedstep-piix4 module does] did not work.
Changing GPO alone still require a read to LVL3. Think the same kind of techno like throttling (hint, hint :)
Signature · 4 lines
Ducrot Bruno -- Which is worse: ignorance or apathy? -- Don't know. Don't care.
Quoted 11 lines · Ducrot Bruno
Quoted 7 lines · Dominik Brodowski
the other part of the story is here: the
speedstep_smi_get_freqscall does not work on my system -- it returns the ist_info.signature as result, and "0" and "4" as high and low frequency which is obviously bogus. Replacing it with hard-coded values for testing made it go -- BTW, GPO 0 did indeed change again, but changing GPO _alone_ [which is what the speedstep-piix4 module does] did not work.Changing GPO alone still require a read to LVL3. Think the same kind of techno like throttling (hint, hint :)
Well, with "changing GPO _alone_" I meant your speedstep-piix4 driver ;-)
Dominik
Quoted 6 lines · Dominik Brodowski
Thanks for this very interesting work. Unfortunately, it doesn't work on my aged notebook, but well, the GPO driver didn't work either....
less-verbose-and-export
to run as a module, we need to exportist_info. Also, only show theIST_INFOline in dmesg ifspeedstep_smiis enabled.
Showing the IST_INFO line should be done in the driver, not in arch/i386/kernel/setup.c
Signature · 4 lines
Ducrot Bruno -- Which is worse: ignorance or apathy? -- Don't know. Don't care.
Yet more patches for your speedstep-smi driver:
naming
let's call this driver "speedstep-smi" in cpufreq_driver also
frequency_detection_fallback
if the smi_get_freqs call fails, fall back to the "let's try it out
and see what frequency we are at" mechanism. Needed on my notebook (at least).
Dominik
arch/i386/kernel/cpu/cpufreq/Kconfig +20 -20
@@ -99,19 +99,6 @@ If in doubt, say N. -config X86_SPEEDSTEP_ICH - tristate "Intel Speedstep" - depends on CPU_FREQ_TABLE - help - This adds the CPUFreq driver for certain mobile Intel Pentium III - (Coppermine), all mobile Intel Pentium III-M (Tualatin) and all - mobile Intel Pentium 4 P4-Ms, with an Intel ICH2, ICH3, - or ICH4 southbridge. - - For details, take a look at linux/Documentation/cpu-freq. - - If in doubt, say N. - config X86_SPEEDSTEP_CENTRINO tristate "Intel Enhanced SpeedStep" depends on CPU_FREQ_TABLE
@@ -123,23 +110,36 @@ If in doubt, say N. -config X86_SPEEDSTEP_LIB - tristate - depends on X86_SPEEDSTEP_ICH - default X86_SPEEDSTEP_ICH +config X86_SPEEDSTEP_ICH + tristate "Intel Speedstep on ICH-M chipsets (ioport interface)" + depends on CPU_FREQ_TABLE + help + This adds the CPUFreq driver for certain mobile Intel Pentium III + (Coppermine), all mobile Intel Pentium III-M (Tualatin) and all + mobile Intel Pentium 4 P4-M on systems which have an Intel ICH2, + ICH3 or ICH4 southbridge. + + For details, take a look at linux/Documentation/cpu-freq. + + If in doubt, say N. config X86_SPEEDSTEP_SMI - tristate "Intel SpeedStep with 440BX/MX" + tristate "Intel SpeedStep on 440BX/ZX/MX chipsets (SMI interface)" depends on CPU_FREQ help - This adds the CPUFreq driver for mobile Intel Pentium III + This adds the CPUFreq driver for certain mobile Intel Pentium III (Coppermine), all mobile Intel Pentium III-M (Tualatin) - with an Intel 440BX/ZX/MX southbridge. + on systems which have an Intel 440BX/ZX/MX southbridge. For details, take a look at linux/Documentation/cpu-freq. If in doubt, say N. +config X86_SPEEDSTEP_LIB + tristate + depends on (X86_SPEEDSTEP_ICH || X86_SPEEDSTEP_SMI) + default (X86_SPEEDSTEP_ICH || X86_SPEEDSTEP_SMI) + config X86_P4_CLOCKMOD tristate "Intel Pentium 4 clock modulation" depends on CPU_FREQ_TABLE
arch/i386/kernel/cpu/cpufreq/speedstep-smi.c +21 -2
@@ -20,6 +20,8 @@#include <linux/slab.h> #include <asm/ist.h> +#include "speedstep-lib.h" +/* speedstep system management interface port/command. * * These parameters are got from IST-SMI BIOS call.
@@ -228,8 +230,25 @@/* detect low and high frequency */ result =speedstep_smi_get_freqs (&speedstep_freqs[SPEEDSTEP_LOW ].frequency, &speedstep_freqs[SPEEDSTEP_HIGH ].frequency); -if (result) -return result; +if (result) { +/* fall back to speedstep_lib.c dection mechanism: try both states out */ +unsigned int speedstep_processor =speedstep_detect_processor (); + +dprintk (KERN_INFO "speedstep-smi: could not detect low and high frequencies by SMI call.\n" ); +if (!speedstep_processor) +return -ENODEV ; + + result = (int )speedstep_get_freqs (speedstep_processor, + &speedstep_freqs[SPEEDSTEP_LOW ].frequency, + &speedstep_freqs[SPEEDSTEP_HIGH ].frequency, + &speedstep_set_state); + +if (result) { +dprintk (KERN_INFO "speedstep-smi: could not detect two different speeds -- aborting.\n" ); +return result; + }else +dprintk (KERN_INFO "speedstep-smi: workaround worked.\n" ); + }/* get current speed setting */ state =speedstep_get_state ();
arch/i386/kernel/cpu/cpufreq/speedstep-smi.c +1 -1
@@ -260,7 +260,7 @@static struct cpufreq_driver speedstep_driver = { - .name ="speedstep" , + .name ="speedstep-smi" , .verify = speedstep_verify, .target = speedstep_target, .init = speedstep_cpu_init,
_______________________________________________
Cpufreq mailing list
[email protected]
http://www.linux.org.uk/mailman/listinfo/cpufreq
I have commited both in trunk and tag LINUX_2_4 your driver.
For tag LINUX_2_4, I have to update at first the core especially for resume stuff, so the .resume callback is not impletemented as it should.
Cheers,
Signature · 4 lines
Ducrot Bruno -- Which is worse: ignorance or apathy? -- Don't know. Don't care.
Ok, kernel 2.4 has no hibernation staff,
then not so big problem about it.
I didn't test it with apm, so I don't know
what happens. to work-around, user can unload/load the module.
At Thu, 4 Sep 2003 14:42:30 +0200,
Quoted 6 lines · Ducrot Bruno
I have commited both in trunk and tag
LINUX_2_4your driver.For tag
LINUX_2_4, I have to update at first the core especially for resume stuff, so the .resume callback is not impletemented as it should.
Signature · 4 lines
Hiroshi Miura --- http://www.da-cha.org/ NTTDATA Corp. Marketing & Business Strategy Planning Dept. --- [email protected] Key fingerprint = 9117 9407 5684 FBF1 4063 15B4 401D D077 04AB 8617 -- My hacking life is happy as the day is long
Quoted 6 lines · Hiroshi Miura
Ok, kernel 2.4 has no hibernation staff,
then not so big problem about it.I didn't test it with apm, so I don't know
what happens. to work-around, user can unload/load the module.
Most systems with a piii and piix4 are somehow 'old' and work like a charm with apm, so I have to fix it (but i need to update core at first).
S1 may work also, and is supported by acpi, I guest it should be ok, but who knows.
Signature · 4 lines
Ducrot Bruno -- Which is worse: ignorance or apathy? -- Don't know. Don't care.