Fix includes: do not include intel_cpus.h inside cpu.h

The file "cpu.h" is generic (unlike "intel_cpus.h"), so the existing order seems
illogical.

Signed-off-by: Ivan Shapovalov <intelfx100@gmail.com>
Deduplication: move is_turbo() function to lib

Trivial: remove 4 identical static definitions of is_turbo().

Signed-off-by: Ivan Shapovalov <intelfx100@gmail.com>
Deduplication: move all instances of account_freq() to abstract_cpu::account_freq()

Trivial: unify identical in-class private definitions in the common base class.

The only override left is nhm_cpu::account_freq() which is almost identical but
ignores the "Turbo Mode" state.
Seems like a hidden bug to me, but will remove it in a separate commit so one can revert
it easily in case something goes wrong.

Signed-off-by: Ivan Shapovalov <intelfx100@gmail.com>
Deduplication: remove nhm_cpu::account_freq() almost identical to abstract_cpu::account_freq()

See previous commit for explanation.

Signed-off-by: Ivan Shapovalov <intelfx100@gmail.com>
Deduplication: remove nhm_{cpu, core, package}::change_effective_frequency() identical to cpu_{linux, core, package}::change_effective_frequency()

Trivial: remove identical overrides wrt. direct base classes.

Signed-off-by: Ivan Shapovalov <intelfx100@gmail.com>
Deduplication: merge cpu_{core, linux, package}::change_effective_frequency() into abstract_cpu::change_effective_frequency()

The mentioned overrides differ only in assigning 0 to effective_frequency
prior to calling abstract_cpu::change_effective_frequency(), which reassigns real frequency
to the same field.
Moreover, the field value is never used between assignments.

So it shall be safe to merge these overrides into the base definition as shown:
* immediately assign real frequency to field effective_frequency;
* remove post-assignment to the same field.

Signed-off-by: Ivan Shapovalov <intelfx100@gmail.com>
Deduplication: remove {cpu, nhm}_core::calculate_freq() identical to abstract_cpu::calculate_freq()

Trivial: remove identical overrides wrt. direct base class.

Signed-off-by: Ivan Shapovalov <intelfx100@gmail.com>
Deduplication: remove nhm_package::calculate_freq() identical to cpu_package::calculate_freq()

Trivial - remove an identical override wrt. direct base class.

Signed-off-by: Ivan Shapovalov <intelfx100@gmail.com>
Deduplication: properly merge cpu_package::calculate_freq() into abstract_cpu::calculate_freq()

The overridden method "cpu_package::calculate_freq()" differs from a generic implementation in
that it propagates the package's frequency to all in-package cores by
calling change_effective_frequency().

Instead of duplicating the code, introduce a small virtual function
freq_updated() which normally propagates frequency changes upwards and
override it for cpu_package, retaining the correct behavior. Then remove the override of
calculate_freq().

Signed-off-by: Ivan Shapovalov <intelfx100@gmail.com>
Deduplication: merge go_idle()/go_unidle()/change_freq() overrides into abstract_cpu() class

When merging, also (while at it) use the new freq_updated() method in
these functions.

Signed-off-by: Ivan Shapovalov <intelfx100@gmail.com>