History log of /openbsd-current/sys/arch/i386/i386/powernow-k7.c
Revision (<<< Hide revision tags) (Show revision tags >>>) Date Author Comments
# 1.44 30-Jan-2023 jsg

remove unneeded includes in arch/i386
ok krw@ miod@


Revision tags: OPENBSD_6_4_BASE OPENBSD_6_5_BASE OPENBSD_6_6_BASE OPENBSD_6_7_BASE OPENBSD_6_8_BASE OPENBSD_6_9_BASE OPENBSD_7_0_BASE OPENBSD_7_1_BASE OPENBSD_7_2_BASE
# 1.43 30-Jul-2018 kettenis

Use the MI interrupt enable/distable API instead of the MD one on i386 and
remove the MD API.

ok deraadt@


# 1.42 04-Jul-2018 mlarkin

Fix a wrong memcmp in k7/k8 powernow code.

ok brynet


# 1.41 31-Mar-2018 bluhm

Recommit preparation for i386 Meltdown fix after OpenBSD 6.3 release.

- provide a cpu_softc for cpu_attach() etc.
- replace per PCB TSS with per CPU TSS

The first change prepares for cpu_info being embedded in a
cpu_full_info. Therefore during autoconf/cpu_attach we hand down
a softc.

The second change removes the per PCB TSS. We now have one TSS per
CPU, thus in cpu_switchto() we only have to patch the ring 0 stack
pointer instead of loading a new TSS. This also allows for cleaning
up the GDT, so we only have a single slot for the TSS.

from hshoexer@; OK deraadt@


Revision tags: OPENBSD_6_3_BASE
# 1.40 22-Mar-2018 bluhm

iBackout the preparations for fixing Meltdown on i386. The task was
only halfway done and the current state does not help anybody. For
OpenBSD 6.3 release go back to the original code before 2018/03/13.
This gives us a stable release and the changes will come back later.
discussed with guenther@ deraadt@ hshoexer@


# 1.39 13-Mar-2018 bluhm

Preparation for i386 Meltdown fix:

- provide a cpu_softc for cpu_attach() etc.
- replace per PCB TSS with per CPU TSS

The first change prepares for cpu_info being embedded in a
cpu_full_info. Therefore during autoconf/cpu_attach we hand down
a softc.

The second change removes the per PCB TSS. We now have one TSS per
CPU, thus in cpu_switchto() we only have to patch the ring 0 stack
pointer instead of loading a new TSS. This also allows for cleaning
up the GDT, so we only have a single slot for the TSS.

from hshoexer@; OK deraadt@


Revision tags: OPENBSD_6_2_BASE
# 1.38 08-Sep-2017 deraadt

If you use sys/param.h, you don't need sys/types.h


Revision tags: OPENBSD_5_9_BASE OPENBSD_6_0_BASE OPENBSD_6_1_BASE
# 1.37 08-Sep-2015 deraadt

sizes for free(); ok semarie


Revision tags: OPENBSD_5_7_BASE OPENBSD_5_8_BASE
# 1.36 14-Sep-2014 jsg

remove uneeded proc.h includes
ok mpi@ kspillner@


Revision tags: OPENBSD_5_6_BASE
# 1.35 12-Jul-2014 tedu

add a size argument to free. will be used soon, but for now default to 0.
after discussions with beck deraadt kettenis.


Revision tags: OPENBSD_4_8_BASE OPENBSD_4_9_BASE OPENBSD_5_0_BASE OPENBSD_5_1_BASE OPENBSD_5_2_BASE OPENBSD_5_3_BASE OPENBSD_5_4_BASE OPENBSD_5_5_BASE
# 1.34 20-Apr-2010 tedu

remove proc.h include from uvm_map.h. This has far reaching effects, as
sysctl.h was reliant on this particular include, and many drivers included
sysctl.h unnecessarily. remove sysctl.h or add proc.h as needed.
ok deraadt


Revision tags: OPENBSD_4_3_BASE OPENBSD_4_4_BASE OPENBSD_4_5_BASE OPENBSD_4_6_BASE OPENBSD_4_7_BASE
# 1.33 07-Sep-2007 gwk

Based upon a diff orignally submitted by devin smith, Do two things run the
check that the maxfid and the highest reported acpi p_state frequency agree only
after actually getting the acpi p_state. Secondly prefer the legacy powernow
table over ACPI because machines of this vintage of are likely to have broken
ACPI implementations.

Tested by devin smith and tilo stritzky.
ok beck@


Revision tags: OPENBSD_4_2_BASE
# 1.32 27-Jul-2007 gwk

Adapt powernow-k7.c driver to use the ACPI _PSS table for retreiving
p_state data based on similar work done to powernow-k8.c. This work was
done by Devin Smith <devin at devinsmith dot net> and this commit is a
slightly modified verson of his last diff to tech@, thanks again for your
work.


# 1.31 24-Apr-2007 gwk

Choose the state for a request performance level based on calculations
involving the number of states and not the frequencies of the states,
which can lead to strange distributions of the states over the hw.setperf
range (0-100). Tested by many.

ok canacar, tedu


Revision tags: OPENBSD_4_1_BASE
# 1.30 20-Dec-2006 gwk

"#ifdef is a tool of the weak!"
Rename pentium_mhz to cpuspeed which is consistant with amd64 making
shared ACPI code less nasty.
ok marco, deraadt


# 1.29 12-Dec-2006 dim

Complete gwk's previous patch to stop setperf methods from returning
errors to userland: make all cpu_setperf functions return void.

Tested by many, ok gwk@


# 1.28 19-Oct-2006 tom

Fix the spellings of Cool'n'Quiet and PowerNow! in a couple of places.

ok deraadt@


# 1.27 19-Oct-2006 tom

s/Mhz/MHz/ in comments and printf() strings

ok jsg@


# 1.26 29-Sep-2006 gwk

If we don't find a matching CPU signature using the base CPUID call, try
matching against the extended CPUID (0x80000001) signature. Problem
found by, and patch based on work by jason@.
ok jason@


# 1.25 25-Sep-2006 gwk

Martin V�giard <deadbug AT gmail.com> has been kind enough to rescind the
third clause of his license and strike the phrase "All rights reserved", so we
can consolidate both license blocks into one. Thanks!


Revision tags: OPENBSD_4_0_BASE
# 1.24 16-Jun-2006 gwk

From k*_powernow_setperf() always return 0, i.e.
Do not return low level errors to userspace where they will not/can not be
coped with.
: ----------------------------------------------------------------------


# 1.23 13-Jun-2006 gwk

Change the value returned if the CPU fails to honor a request to
adjust frequency from 1 (EPERM) to EIO.
Suggested by and ok tedu@


# 1.22 27-May-2006 gwk

Teach powernow about setperf prioritys, add a setperf_prio to amd64.
ok uwe@, "good" tedu@


# 1.21 11-May-2006 mickey

kill trainling spaces


# 1.20 02-May-2006 pat

* Plug memory leak if init fails; ok gwk@


# 1.19 18-Apr-2006 gwk

Correct the heuristic to determin Cool`n'Quiet vs. Powernow! spotted in
the linux driver.
Correct the the cpu signature used to determin if the chip is affected
by errata a0, verified in the linux driver.
Some demagification and KNF.
ok dlg@


# 1.18 18-Apr-2006 gwk

Ensure that we check if the transition succeeded before we adjust
pentium_mhz on K7, and print a usefull diagnostic message if it does
not on K7 and K8.
"makes sense to me" dlg@


# 1.17 15-Apr-2006 gwk

Don't bother setting the frequency entry in the available states table
to -1 we never check for it. (As has been the case on K8 for a long time).
ok dlg@


# 1.16 15-Apr-2006 gwk

Eliminate some pointers we dont use, originally for multiprocessor support,
K7 MP parts do not support Cool'N'Quiet.
"also makes sense" dlg@


# 1.15 15-Apr-2006 gwk

Rid k7_powernow_setperf() of some bad math, this code expected the values
to be expressed in hertz not megahertz.
"makes sense to me" dlg@


# 1.14 15-Apr-2006 gwk

Change the return value in k7_powernow_setperf() from 1 to 0 so that it
does not print "operation not permitted" even though the operation was
successful.
ok dlg@


# 1.13 15-Apr-2006 gwk

Loop on the number of PST reported by the bios not a magic number.
Fixes PR 5075.
"go for it" dlg@


# 1.12 04-Apr-2006 uwe

Small hex-vs-decimal typo from gwk, and tested by me (with cpusig check
disabled because my BIOS sucks).


# 1.11 20-Mar-2006 dlg

a bit of demagification. this moves the checks for the cpu scaling features
out of machdep and into powernow-k7 and -k8. machdep now just figures out
if its the right type of cpu before calling the powernow code which
figures out if the scaling is supported.

from gwk


# 1.10 15-Mar-2006 deraadt

spacing


Revision tags: OPENBSD_3_9_BASE
# 1.9 28-Nov-2005 mickey

another dangling semicolon from Matthias Bauer


# 1.8 26-Nov-2005 tedu

some cleanup from gordon


# 1.7 28-Oct-2005 tedu

lost a diff from gordon, only attach if we can do something useful


# 1.6 28-Oct-2005 tedu

malloc(M_WAITOK) is bad in init code, M_DEVBUF is nicer than M_TEMP,
and if the cpu gets stuck, don't spin too long.


# 1.5 28-Oct-2005 tedu

update support for powernow (cool and quiet) on k7, and add support
for k8. preliminary and not well tested yet. from freebsd via
gordon klok.


# 1.4 20-Oct-2005 mickey

fix addr range in the comments


Revision tags: OPENBSD_3_6_BASE OPENBSD_3_7_BASE OPENBSD_3_8_BASE
# 1.3 05-Aug-2004 tedu

unmap bios when done. from form@pdp-11.org.ru via grange


# 1.2 14-Jul-2004 tedu

names of frequencies aren't interesting, and require ugly snprintf
manipulation theo doesn't like. just print number of states.
this way doesn't leak the memory for the string either.


# 1.1 14-Jul-2004 tedu

setperf driver for powernow in amd k7 cpus. derived from a diff to
tech-i386@netbsd by martin vegiard, and adapted to fit in here.
as yet untested. ok deraadt@


# 1.43 30-Jul-2018 kettenis

Use the MI interrupt enable/distable API instead of the MD one on i386 and
remove the MD API.

ok deraadt@


# 1.42 04-Jul-2018 mlarkin

Fix a wrong memcmp in k7/k8 powernow code.

ok brynet


# 1.41 31-Mar-2018 bluhm

Recommit preparation for i386 Meltdown fix after OpenBSD 6.3 release.

- provide a cpu_softc for cpu_attach() etc.
- replace per PCB TSS with per CPU TSS

The first change prepares for cpu_info being embedded in a
cpu_full_info. Therefore during autoconf/cpu_attach we hand down
a softc.

The second change removes the per PCB TSS. We now have one TSS per
CPU, thus in cpu_switchto() we only have to patch the ring 0 stack
pointer instead of loading a new TSS. This also allows for cleaning
up the GDT, so we only have a single slot for the TSS.

from hshoexer@; OK deraadt@


Revision tags: OPENBSD_6_3_BASE
# 1.40 22-Mar-2018 bluhm

iBackout the preparations for fixing Meltdown on i386. The task was
only halfway done and the current state does not help anybody. For
OpenBSD 6.3 release go back to the original code before 2018/03/13.
This gives us a stable release and the changes will come back later.
discussed with guenther@ deraadt@ hshoexer@


# 1.39 13-Mar-2018 bluhm

Preparation for i386 Meltdown fix:

- provide a cpu_softc for cpu_attach() etc.
- replace per PCB TSS with per CPU TSS

The first change prepares for cpu_info being embedded in a
cpu_full_info. Therefore during autoconf/cpu_attach we hand down
a softc.

The second change removes the per PCB TSS. We now have one TSS per
CPU, thus in cpu_switchto() we only have to patch the ring 0 stack
pointer instead of loading a new TSS. This also allows for cleaning
up the GDT, so we only have a single slot for the TSS.

from hshoexer@; OK deraadt@


Revision tags: OPENBSD_6_2_BASE
# 1.38 08-Sep-2017 deraadt

If you use sys/param.h, you don't need sys/types.h


Revision tags: OPENBSD_5_9_BASE OPENBSD_6_0_BASE OPENBSD_6_1_BASE
# 1.37 08-Sep-2015 deraadt

sizes for free(); ok semarie


Revision tags: OPENBSD_5_7_BASE OPENBSD_5_8_BASE
# 1.36 14-Sep-2014 jsg

remove uneeded proc.h includes
ok mpi@ kspillner@


Revision tags: OPENBSD_5_6_BASE
# 1.35 12-Jul-2014 tedu

add a size argument to free. will be used soon, but for now default to 0.
after discussions with beck deraadt kettenis.


Revision tags: OPENBSD_4_8_BASE OPENBSD_4_9_BASE OPENBSD_5_0_BASE OPENBSD_5_1_BASE OPENBSD_5_2_BASE OPENBSD_5_3_BASE OPENBSD_5_4_BASE OPENBSD_5_5_BASE
# 1.34 20-Apr-2010 tedu

remove proc.h include from uvm_map.h. This has far reaching effects, as
sysctl.h was reliant on this particular include, and many drivers included
sysctl.h unnecessarily. remove sysctl.h or add proc.h as needed.
ok deraadt


Revision tags: OPENBSD_4_3_BASE OPENBSD_4_4_BASE OPENBSD_4_5_BASE OPENBSD_4_6_BASE OPENBSD_4_7_BASE
# 1.33 07-Sep-2007 gwk

Based upon a diff orignally submitted by devin smith, Do two things run the
check that the maxfid and the highest reported acpi p_state frequency agree only
after actually getting the acpi p_state. Secondly prefer the legacy powernow
table over ACPI because machines of this vintage of are likely to have broken
ACPI implementations.

Tested by devin smith and tilo stritzky.
ok beck@


Revision tags: OPENBSD_4_2_BASE
# 1.32 27-Jul-2007 gwk

Adapt powernow-k7.c driver to use the ACPI _PSS table for retreiving
p_state data based on similar work done to powernow-k8.c. This work was
done by Devin Smith <devin at devinsmith dot net> and this commit is a
slightly modified verson of his last diff to tech@, thanks again for your
work.


# 1.31 24-Apr-2007 gwk

Choose the state for a request performance level based on calculations
involving the number of states and not the frequencies of the states,
which can lead to strange distributions of the states over the hw.setperf
range (0-100). Tested by many.

ok canacar, tedu


Revision tags: OPENBSD_4_1_BASE
# 1.30 20-Dec-2006 gwk

"#ifdef is a tool of the weak!"
Rename pentium_mhz to cpuspeed which is consistant with amd64 making
shared ACPI code less nasty.
ok marco, deraadt


# 1.29 12-Dec-2006 dim

Complete gwk's previous patch to stop setperf methods from returning
errors to userland: make all cpu_setperf functions return void.

Tested by many, ok gwk@


# 1.28 19-Oct-2006 tom

Fix the spellings of Cool'n'Quiet and PowerNow! in a couple of places.

ok deraadt@


# 1.27 19-Oct-2006 tom

s/Mhz/MHz/ in comments and printf() strings

ok jsg@


# 1.26 29-Sep-2006 gwk

If we don't find a matching CPU signature using the base CPUID call, try
matching against the extended CPUID (0x80000001) signature. Problem
found by, and patch based on work by jason@.
ok jason@


# 1.25 25-Sep-2006 gwk

Martin V�giard <deadbug AT gmail.com> has been kind enough to rescind the
third clause of his license and strike the phrase "All rights reserved", so we
can consolidate both license blocks into one. Thanks!


Revision tags: OPENBSD_4_0_BASE
# 1.24 16-Jun-2006 gwk

From k*_powernow_setperf() always return 0, i.e.
Do not return low level errors to userspace where they will not/can not be
coped with.
: ----------------------------------------------------------------------


# 1.23 13-Jun-2006 gwk

Change the value returned if the CPU fails to honor a request to
adjust frequency from 1 (EPERM) to EIO.
Suggested by and ok tedu@


# 1.22 27-May-2006 gwk

Teach powernow about setperf prioritys, add a setperf_prio to amd64.
ok uwe@, "good" tedu@


# 1.21 11-May-2006 mickey

kill trainling spaces


# 1.20 02-May-2006 pat

* Plug memory leak if init fails; ok gwk@


# 1.19 18-Apr-2006 gwk

Correct the heuristic to determin Cool`n'Quiet vs. Powernow! spotted in
the linux driver.
Correct the the cpu signature used to determin if the chip is affected
by errata a0, verified in the linux driver.
Some demagification and KNF.
ok dlg@


# 1.18 18-Apr-2006 gwk

Ensure that we check if the transition succeeded before we adjust
pentium_mhz on K7, and print a usefull diagnostic message if it does
not on K7 and K8.
"makes sense to me" dlg@


# 1.17 15-Apr-2006 gwk

Don't bother setting the frequency entry in the available states table
to -1 we never check for it. (As has been the case on K8 for a long time).
ok dlg@


# 1.16 15-Apr-2006 gwk

Eliminate some pointers we dont use, originally for multiprocessor support,
K7 MP parts do not support Cool'N'Quiet.
"also makes sense" dlg@


# 1.15 15-Apr-2006 gwk

Rid k7_powernow_setperf() of some bad math, this code expected the values
to be expressed in hertz not megahertz.
"makes sense to me" dlg@


# 1.14 15-Apr-2006 gwk

Change the return value in k7_powernow_setperf() from 1 to 0 so that it
does not print "operation not permitted" even though the operation was
successful.
ok dlg@


# 1.13 15-Apr-2006 gwk

Loop on the number of PST reported by the bios not a magic number.
Fixes PR 5075.
"go for it" dlg@


# 1.12 04-Apr-2006 uwe

Small hex-vs-decimal typo from gwk, and tested by me (with cpusig check
disabled because my BIOS sucks).


# 1.11 20-Mar-2006 dlg

a bit of demagification. this moves the checks for the cpu scaling features
out of machdep and into powernow-k7 and -k8. machdep now just figures out
if its the right type of cpu before calling the powernow code which
figures out if the scaling is supported.

from gwk


# 1.10 15-Mar-2006 deraadt

spacing


Revision tags: OPENBSD_3_9_BASE
# 1.9 28-Nov-2005 mickey

another dangling semicolon from Matthias Bauer


# 1.8 26-Nov-2005 tedu

some cleanup from gordon


# 1.7 28-Oct-2005 tedu

lost a diff from gordon, only attach if we can do something useful


# 1.6 28-Oct-2005 tedu

malloc(M_WAITOK) is bad in init code, M_DEVBUF is nicer than M_TEMP,
and if the cpu gets stuck, don't spin too long.


# 1.5 28-Oct-2005 tedu

update support for powernow (cool and quiet) on k7, and add support
for k8. preliminary and not well tested yet. from freebsd via
gordon klok.


# 1.4 20-Oct-2005 mickey

fix addr range in the comments


Revision tags: OPENBSD_3_6_BASE OPENBSD_3_7_BASE OPENBSD_3_8_BASE
# 1.3 05-Aug-2004 tedu

unmap bios when done. from form@pdp-11.org.ru via grange


# 1.2 14-Jul-2004 tedu

names of frequencies aren't interesting, and require ugly snprintf
manipulation theo doesn't like. just print number of states.
this way doesn't leak the memory for the string either.


# 1.1 14-Jul-2004 tedu

setperf driver for powernow in amd k7 cpus. derived from a diff to
tech-i386@netbsd by martin vegiard, and adapted to fit in here.
as yet untested. ok deraadt@


# 1.42 04-Jul-2018 mlarkin

Fix a wrong memcmp in k7/k8 powernow code.

ok brynet


# 1.41 31-Mar-2018 bluhm

Recommit preparation for i386 Meltdown fix after OpenBSD 6.3 release.

- provide a cpu_softc for cpu_attach() etc.
- replace per PCB TSS with per CPU TSS

The first change prepares for cpu_info being embedded in a
cpu_full_info. Therefore during autoconf/cpu_attach we hand down
a softc.

The second change removes the per PCB TSS. We now have one TSS per
CPU, thus in cpu_switchto() we only have to patch the ring 0 stack
pointer instead of loading a new TSS. This also allows for cleaning
up the GDT, so we only have a single slot for the TSS.

from hshoexer@; OK deraadt@


Revision tags: OPENBSD_6_3_BASE
# 1.40 22-Mar-2018 bluhm

iBackout the preparations for fixing Meltdown on i386. The task was
only halfway done and the current state does not help anybody. For
OpenBSD 6.3 release go back to the original code before 2018/03/13.
This gives us a stable release and the changes will come back later.
discussed with guenther@ deraadt@ hshoexer@


# 1.39 13-Mar-2018 bluhm

Preparation for i386 Meltdown fix:

- provide a cpu_softc for cpu_attach() etc.
- replace per PCB TSS with per CPU TSS

The first change prepares for cpu_info being embedded in a
cpu_full_info. Therefore during autoconf/cpu_attach we hand down
a softc.

The second change removes the per PCB TSS. We now have one TSS per
CPU, thus in cpu_switchto() we only have to patch the ring 0 stack
pointer instead of loading a new TSS. This also allows for cleaning
up the GDT, so we only have a single slot for the TSS.

from hshoexer@; OK deraadt@


Revision tags: OPENBSD_6_2_BASE
# 1.38 08-Sep-2017 deraadt

If you use sys/param.h, you don't need sys/types.h


Revision tags: OPENBSD_5_9_BASE OPENBSD_6_0_BASE OPENBSD_6_1_BASE
# 1.37 08-Sep-2015 deraadt

sizes for free(); ok semarie


Revision tags: OPENBSD_5_7_BASE OPENBSD_5_8_BASE
# 1.36 14-Sep-2014 jsg

remove uneeded proc.h includes
ok mpi@ kspillner@


Revision tags: OPENBSD_5_6_BASE
# 1.35 12-Jul-2014 tedu

add a size argument to free. will be used soon, but for now default to 0.
after discussions with beck deraadt kettenis.


Revision tags: OPENBSD_4_8_BASE OPENBSD_4_9_BASE OPENBSD_5_0_BASE OPENBSD_5_1_BASE OPENBSD_5_2_BASE OPENBSD_5_3_BASE OPENBSD_5_4_BASE OPENBSD_5_5_BASE
# 1.34 20-Apr-2010 tedu

remove proc.h include from uvm_map.h. This has far reaching effects, as
sysctl.h was reliant on this particular include, and many drivers included
sysctl.h unnecessarily. remove sysctl.h or add proc.h as needed.
ok deraadt


Revision tags: OPENBSD_4_3_BASE OPENBSD_4_4_BASE OPENBSD_4_5_BASE OPENBSD_4_6_BASE OPENBSD_4_7_BASE
# 1.33 07-Sep-2007 gwk

Based upon a diff orignally submitted by devin smith, Do two things run the
check that the maxfid and the highest reported acpi p_state frequency agree only
after actually getting the acpi p_state. Secondly prefer the legacy powernow
table over ACPI because machines of this vintage of are likely to have broken
ACPI implementations.

Tested by devin smith and tilo stritzky.
ok beck@


Revision tags: OPENBSD_4_2_BASE
# 1.32 27-Jul-2007 gwk

Adapt powernow-k7.c driver to use the ACPI _PSS table for retreiving
p_state data based on similar work done to powernow-k8.c. This work was
done by Devin Smith <devin at devinsmith dot net> and this commit is a
slightly modified verson of his last diff to tech@, thanks again for your
work.


# 1.31 24-Apr-2007 gwk

Choose the state for a request performance level based on calculations
involving the number of states and not the frequencies of the states,
which can lead to strange distributions of the states over the hw.setperf
range (0-100). Tested by many.

ok canacar, tedu


Revision tags: OPENBSD_4_1_BASE
# 1.30 20-Dec-2006 gwk

"#ifdef is a tool of the weak!"
Rename pentium_mhz to cpuspeed which is consistant with amd64 making
shared ACPI code less nasty.
ok marco, deraadt


# 1.29 12-Dec-2006 dim

Complete gwk's previous patch to stop setperf methods from returning
errors to userland: make all cpu_setperf functions return void.

Tested by many, ok gwk@


# 1.28 19-Oct-2006 tom

Fix the spellings of Cool'n'Quiet and PowerNow! in a couple of places.

ok deraadt@


# 1.27 19-Oct-2006 tom

s/Mhz/MHz/ in comments and printf() strings

ok jsg@


# 1.26 29-Sep-2006 gwk

If we don't find a matching CPU signature using the base CPUID call, try
matching against the extended CPUID (0x80000001) signature. Problem
found by, and patch based on work by jason@.
ok jason@


# 1.25 25-Sep-2006 gwk

Martin V�giard <deadbug AT gmail.com> has been kind enough to rescind the
third clause of his license and strike the phrase "All rights reserved", so we
can consolidate both license blocks into one. Thanks!


Revision tags: OPENBSD_4_0_BASE
# 1.24 16-Jun-2006 gwk

From k*_powernow_setperf() always return 0, i.e.
Do not return low level errors to userspace where they will not/can not be
coped with.
: ----------------------------------------------------------------------


# 1.23 13-Jun-2006 gwk

Change the value returned if the CPU fails to honor a request to
adjust frequency from 1 (EPERM) to EIO.
Suggested by and ok tedu@


# 1.22 27-May-2006 gwk

Teach powernow about setperf prioritys, add a setperf_prio to amd64.
ok uwe@, "good" tedu@


# 1.21 11-May-2006 mickey

kill trainling spaces


# 1.20 02-May-2006 pat

* Plug memory leak if init fails; ok gwk@


# 1.19 18-Apr-2006 gwk

Correct the heuristic to determin Cool`n'Quiet vs. Powernow! spotted in
the linux driver.
Correct the the cpu signature used to determin if the chip is affected
by errata a0, verified in the linux driver.
Some demagification and KNF.
ok dlg@


# 1.18 18-Apr-2006 gwk

Ensure that we check if the transition succeeded before we adjust
pentium_mhz on K7, and print a usefull diagnostic message if it does
not on K7 and K8.
"makes sense to me" dlg@


# 1.17 15-Apr-2006 gwk

Don't bother setting the frequency entry in the available states table
to -1 we never check for it. (As has been the case on K8 for a long time).
ok dlg@


# 1.16 15-Apr-2006 gwk

Eliminate some pointers we dont use, originally for multiprocessor support,
K7 MP parts do not support Cool'N'Quiet.
"also makes sense" dlg@


# 1.15 15-Apr-2006 gwk

Rid k7_powernow_setperf() of some bad math, this code expected the values
to be expressed in hertz not megahertz.
"makes sense to me" dlg@


# 1.14 15-Apr-2006 gwk

Change the return value in k7_powernow_setperf() from 1 to 0 so that it
does not print "operation not permitted" even though the operation was
successful.
ok dlg@


# 1.13 15-Apr-2006 gwk

Loop on the number of PST reported by the bios not a magic number.
Fixes PR 5075.
"go for it" dlg@


# 1.12 04-Apr-2006 uwe

Small hex-vs-decimal typo from gwk, and tested by me (with cpusig check
disabled because my BIOS sucks).


# 1.11 20-Mar-2006 dlg

a bit of demagification. this moves the checks for the cpu scaling features
out of machdep and into powernow-k7 and -k8. machdep now just figures out
if its the right type of cpu before calling the powernow code which
figures out if the scaling is supported.

from gwk


# 1.10 15-Mar-2006 deraadt

spacing


Revision tags: OPENBSD_3_9_BASE
# 1.9 28-Nov-2005 mickey

another dangling semicolon from Matthias Bauer


# 1.8 26-Nov-2005 tedu

some cleanup from gordon


# 1.7 28-Oct-2005 tedu

lost a diff from gordon, only attach if we can do something useful


# 1.6 28-Oct-2005 tedu

malloc(M_WAITOK) is bad in init code, M_DEVBUF is nicer than M_TEMP,
and if the cpu gets stuck, don't spin too long.


# 1.5 28-Oct-2005 tedu

update support for powernow (cool and quiet) on k7, and add support
for k8. preliminary and not well tested yet. from freebsd via
gordon klok.


# 1.4 20-Oct-2005 mickey

fix addr range in the comments


Revision tags: OPENBSD_3_6_BASE OPENBSD_3_7_BASE OPENBSD_3_8_BASE
# 1.3 05-Aug-2004 tedu

unmap bios when done. from form@pdp-11.org.ru via grange


# 1.2 14-Jul-2004 tedu

names of frequencies aren't interesting, and require ugly snprintf
manipulation theo doesn't like. just print number of states.
this way doesn't leak the memory for the string either.


# 1.1 14-Jul-2004 tedu

setperf driver for powernow in amd k7 cpus. derived from a diff to
tech-i386@netbsd by martin vegiard, and adapted to fit in here.
as yet untested. ok deraadt@


# 1.41 31-Mar-2018 bluhm

Recommit preparation for i386 Meltdown fix after OpenBSD 6.3 release.

- provide a cpu_softc for cpu_attach() etc.
- replace per PCB TSS with per CPU TSS

The first change prepares for cpu_info being embedded in a
cpu_full_info. Therefore during autoconf/cpu_attach we hand down
a softc.

The second change removes the per PCB TSS. We now have one TSS per
CPU, thus in cpu_switchto() we only have to patch the ring 0 stack
pointer instead of loading a new TSS. This also allows for cleaning
up the GDT, so we only have a single slot for the TSS.

from hshoexer@; OK deraadt@


Revision tags: OPENBSD_6_3_BASE
# 1.40 22-Mar-2018 bluhm

iBackout the preparations for fixing Meltdown on i386. The task was
only halfway done and the current state does not help anybody. For
OpenBSD 6.3 release go back to the original code before 2018/03/13.
This gives us a stable release and the changes will come back later.
discussed with guenther@ deraadt@ hshoexer@


# 1.39 13-Mar-2018 bluhm

Preparation for i386 Meltdown fix:

- provide a cpu_softc for cpu_attach() etc.
- replace per PCB TSS with per CPU TSS

The first change prepares for cpu_info being embedded in a
cpu_full_info. Therefore during autoconf/cpu_attach we hand down
a softc.

The second change removes the per PCB TSS. We now have one TSS per
CPU, thus in cpu_switchto() we only have to patch the ring 0 stack
pointer instead of loading a new TSS. This also allows for cleaning
up the GDT, so we only have a single slot for the TSS.

from hshoexer@; OK deraadt@


Revision tags: OPENBSD_6_2_BASE
# 1.38 08-Sep-2017 deraadt

If you use sys/param.h, you don't need sys/types.h


Revision tags: OPENBSD_5_9_BASE OPENBSD_6_0_BASE OPENBSD_6_1_BASE
# 1.37 08-Sep-2015 deraadt

sizes for free(); ok semarie


Revision tags: OPENBSD_5_7_BASE OPENBSD_5_8_BASE
# 1.36 14-Sep-2014 jsg

remove uneeded proc.h includes
ok mpi@ kspillner@


Revision tags: OPENBSD_5_6_BASE
# 1.35 12-Jul-2014 tedu

add a size argument to free. will be used soon, but for now default to 0.
after discussions with beck deraadt kettenis.


Revision tags: OPENBSD_4_8_BASE OPENBSD_4_9_BASE OPENBSD_5_0_BASE OPENBSD_5_1_BASE OPENBSD_5_2_BASE OPENBSD_5_3_BASE OPENBSD_5_4_BASE OPENBSD_5_5_BASE
# 1.34 20-Apr-2010 tedu

remove proc.h include from uvm_map.h. This has far reaching effects, as
sysctl.h was reliant on this particular include, and many drivers included
sysctl.h unnecessarily. remove sysctl.h or add proc.h as needed.
ok deraadt


Revision tags: OPENBSD_4_3_BASE OPENBSD_4_4_BASE OPENBSD_4_5_BASE OPENBSD_4_6_BASE OPENBSD_4_7_BASE
# 1.33 07-Sep-2007 gwk

Based upon a diff orignally submitted by devin smith, Do two things run the
check that the maxfid and the highest reported acpi p_state frequency agree only
after actually getting the acpi p_state. Secondly prefer the legacy powernow
table over ACPI because machines of this vintage of are likely to have broken
ACPI implementations.

Tested by devin smith and tilo stritzky.
ok beck@


Revision tags: OPENBSD_4_2_BASE
# 1.32 27-Jul-2007 gwk

Adapt powernow-k7.c driver to use the ACPI _PSS table for retreiving
p_state data based on similar work done to powernow-k8.c. This work was
done by Devin Smith <devin at devinsmith dot net> and this commit is a
slightly modified verson of his last diff to tech@, thanks again for your
work.


# 1.31 24-Apr-2007 gwk

Choose the state for a request performance level based on calculations
involving the number of states and not the frequencies of the states,
which can lead to strange distributions of the states over the hw.setperf
range (0-100). Tested by many.

ok canacar, tedu


Revision tags: OPENBSD_4_1_BASE
# 1.30 20-Dec-2006 gwk

"#ifdef is a tool of the weak!"
Rename pentium_mhz to cpuspeed which is consistant with amd64 making
shared ACPI code less nasty.
ok marco, deraadt


# 1.29 12-Dec-2006 dim

Complete gwk's previous patch to stop setperf methods from returning
errors to userland: make all cpu_setperf functions return void.

Tested by many, ok gwk@


# 1.28 19-Oct-2006 tom

Fix the spellings of Cool'n'Quiet and PowerNow! in a couple of places.

ok deraadt@


# 1.27 19-Oct-2006 tom

s/Mhz/MHz/ in comments and printf() strings

ok jsg@


# 1.26 29-Sep-2006 gwk

If we don't find a matching CPU signature using the base CPUID call, try
matching against the extended CPUID (0x80000001) signature. Problem
found by, and patch based on work by jason@.
ok jason@


# 1.25 25-Sep-2006 gwk

Martin V�giard <deadbug AT gmail.com> has been kind enough to rescind the
third clause of his license and strike the phrase "All rights reserved", so we
can consolidate both license blocks into one. Thanks!


Revision tags: OPENBSD_4_0_BASE
# 1.24 16-Jun-2006 gwk

From k*_powernow_setperf() always return 0, i.e.
Do not return low level errors to userspace where they will not/can not be
coped with.
: ----------------------------------------------------------------------


# 1.23 13-Jun-2006 gwk

Change the value returned if the CPU fails to honor a request to
adjust frequency from 1 (EPERM) to EIO.
Suggested by and ok tedu@


# 1.22 27-May-2006 gwk

Teach powernow about setperf prioritys, add a setperf_prio to amd64.
ok uwe@, "good" tedu@


# 1.21 11-May-2006 mickey

kill trainling spaces


# 1.20 02-May-2006 pat

* Plug memory leak if init fails; ok gwk@


# 1.19 18-Apr-2006 gwk

Correct the heuristic to determin Cool`n'Quiet vs. Powernow! spotted in
the linux driver.
Correct the the cpu signature used to determin if the chip is affected
by errata a0, verified in the linux driver.
Some demagification and KNF.
ok dlg@


# 1.18 18-Apr-2006 gwk

Ensure that we check if the transition succeeded before we adjust
pentium_mhz on K7, and print a usefull diagnostic message if it does
not on K7 and K8.
"makes sense to me" dlg@


# 1.17 15-Apr-2006 gwk

Don't bother setting the frequency entry in the available states table
to -1 we never check for it. (As has been the case on K8 for a long time).
ok dlg@


# 1.16 15-Apr-2006 gwk

Eliminate some pointers we dont use, originally for multiprocessor support,
K7 MP parts do not support Cool'N'Quiet.
"also makes sense" dlg@


# 1.15 15-Apr-2006 gwk

Rid k7_powernow_setperf() of some bad math, this code expected the values
to be expressed in hertz not megahertz.
"makes sense to me" dlg@


# 1.14 15-Apr-2006 gwk

Change the return value in k7_powernow_setperf() from 1 to 0 so that it
does not print "operation not permitted" even though the operation was
successful.
ok dlg@


# 1.13 15-Apr-2006 gwk

Loop on the number of PST reported by the bios not a magic number.
Fixes PR 5075.
"go for it" dlg@


# 1.12 04-Apr-2006 uwe

Small hex-vs-decimal typo from gwk, and tested by me (with cpusig check
disabled because my BIOS sucks).


# 1.11 20-Mar-2006 dlg

a bit of demagification. this moves the checks for the cpu scaling features
out of machdep and into powernow-k7 and -k8. machdep now just figures out
if its the right type of cpu before calling the powernow code which
figures out if the scaling is supported.

from gwk


# 1.10 15-Mar-2006 deraadt

spacing


Revision tags: OPENBSD_3_9_BASE
# 1.9 28-Nov-2005 mickey

another dangling semicolon from Matthias Bauer


# 1.8 26-Nov-2005 tedu

some cleanup from gordon


# 1.7 28-Oct-2005 tedu

lost a diff from gordon, only attach if we can do something useful


# 1.6 28-Oct-2005 tedu

malloc(M_WAITOK) is bad in init code, M_DEVBUF is nicer than M_TEMP,
and if the cpu gets stuck, don't spin too long.


# 1.5 28-Oct-2005 tedu

update support for powernow (cool and quiet) on k7, and add support
for k8. preliminary and not well tested yet. from freebsd via
gordon klok.


# 1.4 20-Oct-2005 mickey

fix addr range in the comments


Revision tags: OPENBSD_3_6_BASE OPENBSD_3_7_BASE OPENBSD_3_8_BASE
# 1.3 05-Aug-2004 tedu

unmap bios when done. from form@pdp-11.org.ru via grange


# 1.2 14-Jul-2004 tedu

names of frequencies aren't interesting, and require ugly snprintf
manipulation theo doesn't like. just print number of states.
this way doesn't leak the memory for the string either.


# 1.1 14-Jul-2004 tedu

setperf driver for powernow in amd k7 cpus. derived from a diff to
tech-i386@netbsd by martin vegiard, and adapted to fit in here.
as yet untested. ok deraadt@


Revision tags: OPENBSD_6_2_BASE
# 1.38 08-Sep-2017 deraadt

If you use sys/param.h, you don't need sys/types.h


Revision tags: OPENBSD_5_9_BASE OPENBSD_6_0_BASE OPENBSD_6_1_BASE
# 1.37 08-Sep-2015 deraadt

sizes for free(); ok semarie


Revision tags: OPENBSD_5_7_BASE OPENBSD_5_8_BASE
# 1.36 14-Sep-2014 jsg

remove uneeded proc.h includes
ok mpi@ kspillner@


Revision tags: OPENBSD_5_6_BASE
# 1.35 12-Jul-2014 tedu

add a size argument to free. will be used soon, but for now default to 0.
after discussions with beck deraadt kettenis.


Revision tags: OPENBSD_4_8_BASE OPENBSD_4_9_BASE OPENBSD_5_0_BASE OPENBSD_5_1_BASE OPENBSD_5_2_BASE OPENBSD_5_3_BASE OPENBSD_5_4_BASE OPENBSD_5_5_BASE
# 1.34 20-Apr-2010 tedu

remove proc.h include from uvm_map.h. This has far reaching effects, as
sysctl.h was reliant on this particular include, and many drivers included
sysctl.h unnecessarily. remove sysctl.h or add proc.h as needed.
ok deraadt


Revision tags: OPENBSD_4_3_BASE OPENBSD_4_4_BASE OPENBSD_4_5_BASE OPENBSD_4_6_BASE OPENBSD_4_7_BASE
# 1.33 07-Sep-2007 gwk

Based upon a diff orignally submitted by devin smith, Do two things run the
check that the maxfid and the highest reported acpi p_state frequency agree only
after actually getting the acpi p_state. Secondly prefer the legacy powernow
table over ACPI because machines of this vintage of are likely to have broken
ACPI implementations.

Tested by devin smith and tilo stritzky.
ok beck@


Revision tags: OPENBSD_4_2_BASE
# 1.32 27-Jul-2007 gwk

Adapt powernow-k7.c driver to use the ACPI _PSS table for retreiving
p_state data based on similar work done to powernow-k8.c. This work was
done by Devin Smith <devin at devinsmith dot net> and this commit is a
slightly modified verson of his last diff to tech@, thanks again for your
work.


# 1.31 24-Apr-2007 gwk

Choose the state for a request performance level based on calculations
involving the number of states and not the frequencies of the states,
which can lead to strange distributions of the states over the hw.setperf
range (0-100). Tested by many.

ok canacar, tedu


Revision tags: OPENBSD_4_1_BASE
# 1.30 20-Dec-2006 gwk

"#ifdef is a tool of the weak!"
Rename pentium_mhz to cpuspeed which is consistant with amd64 making
shared ACPI code less nasty.
ok marco, deraadt


# 1.29 12-Dec-2006 dim

Complete gwk's previous patch to stop setperf methods from returning
errors to userland: make all cpu_setperf functions return void.

Tested by many, ok gwk@


# 1.28 19-Oct-2006 tom

Fix the spellings of Cool'n'Quiet and PowerNow! in a couple of places.

ok deraadt@


# 1.27 19-Oct-2006 tom

s/Mhz/MHz/ in comments and printf() strings

ok jsg@


# 1.26 29-Sep-2006 gwk

If we don't find a matching CPU signature using the base CPUID call, try
matching against the extended CPUID (0x80000001) signature. Problem
found by, and patch based on work by jason@.
ok jason@


# 1.25 25-Sep-2006 gwk

Martin V�giard <deadbug AT gmail.com> has been kind enough to rescind the
third clause of his license and strike the phrase "All rights reserved", so we
can consolidate both license blocks into one. Thanks!


Revision tags: OPENBSD_4_0_BASE
# 1.24 16-Jun-2006 gwk

From k*_powernow_setperf() always return 0, i.e.
Do not return low level errors to userspace where they will not/can not be
coped with.
: ----------------------------------------------------------------------


# 1.23 13-Jun-2006 gwk

Change the value returned if the CPU fails to honor a request to
adjust frequency from 1 (EPERM) to EIO.
Suggested by and ok tedu@


# 1.22 27-May-2006 gwk

Teach powernow about setperf prioritys, add a setperf_prio to amd64.
ok uwe@, "good" tedu@


# 1.21 11-May-2006 mickey

kill trainling spaces


# 1.20 02-May-2006 pat

* Plug memory leak if init fails; ok gwk@


# 1.19 18-Apr-2006 gwk

Correct the heuristic to determin Cool`n'Quiet vs. Powernow! spotted in
the linux driver.
Correct the the cpu signature used to determin if the chip is affected
by errata a0, verified in the linux driver.
Some demagification and KNF.
ok dlg@


# 1.18 18-Apr-2006 gwk

Ensure that we check if the transition succeeded before we adjust
pentium_mhz on K7, and print a usefull diagnostic message if it does
not on K7 and K8.
"makes sense to me" dlg@


# 1.17 15-Apr-2006 gwk

Don't bother setting the frequency entry in the available states table
to -1 we never check for it. (As has been the case on K8 for a long time).
ok dlg@


# 1.16 15-Apr-2006 gwk

Eliminate some pointers we dont use, originally for multiprocessor support,
K7 MP parts do not support Cool'N'Quiet.
"also makes sense" dlg@


# 1.15 15-Apr-2006 gwk

Rid k7_powernow_setperf() of some bad math, this code expected the values
to be expressed in hertz not megahertz.
"makes sense to me" dlg@


# 1.14 15-Apr-2006 gwk

Change the return value in k7_powernow_setperf() from 1 to 0 so that it
does not print "operation not permitted" even though the operation was
successful.
ok dlg@


# 1.13 15-Apr-2006 gwk

Loop on the number of PST reported by the bios not a magic number.
Fixes PR 5075.
"go for it" dlg@


# 1.12 04-Apr-2006 uwe

Small hex-vs-decimal typo from gwk, and tested by me (with cpusig check
disabled because my BIOS sucks).


# 1.11 20-Mar-2006 dlg

a bit of demagification. this moves the checks for the cpu scaling features
out of machdep and into powernow-k7 and -k8. machdep now just figures out
if its the right type of cpu before calling the powernow code which
figures out if the scaling is supported.

from gwk


# 1.10 15-Mar-2006 deraadt

spacing


Revision tags: OPENBSD_3_9_BASE
# 1.9 28-Nov-2005 mickey

another dangling semicolon from Matthias Bauer


# 1.8 26-Nov-2005 tedu

some cleanup from gordon


# 1.7 28-Oct-2005 tedu

lost a diff from gordon, only attach if we can do something useful


# 1.6 28-Oct-2005 tedu

malloc(M_WAITOK) is bad in init code, M_DEVBUF is nicer than M_TEMP,
and if the cpu gets stuck, don't spin too long.


# 1.5 28-Oct-2005 tedu

update support for powernow (cool and quiet) on k7, and add support
for k8. preliminary and not well tested yet. from freebsd via
gordon klok.


# 1.4 20-Oct-2005 mickey

fix addr range in the comments


Revision tags: OPENBSD_3_6_BASE OPENBSD_3_7_BASE OPENBSD_3_8_BASE
# 1.3 05-Aug-2004 tedu

unmap bios when done. from form@pdp-11.org.ru via grange


# 1.2 14-Jul-2004 tedu

names of frequencies aren't interesting, and require ugly snprintf
manipulation theo doesn't like. just print number of states.
this way doesn't leak the memory for the string either.


# 1.1 14-Jul-2004 tedu

setperf driver for powernow in amd k7 cpus. derived from a diff to
tech-i386@netbsd by martin vegiard, and adapted to fit in here.
as yet untested. ok deraadt@