idle: introduce cpuidle generic module

This module will load the various lowlevel cpuidle modules' implementations
during initialiation. If it finds one available module, it will change
the global gCpuIdleFunc as its own better one.

When idle, cpuidle module will select the best cstate and enter it by
calling the lowlevel module's implementation.

Signed-off-by: Yongcong Du <ycdu.vmcore@gmail.com>
Signed-off-by: Fredrik Holmqvist <fredrik.holmqvist@gmail.com>
cpuidle: add intel native cpuidle module

Currently, it only supports intel sandy bridge processors.

Signed-off-by: Yongcong Du <ycdu.vmcore@gmail.com>
Signed-off-by: Fredrik Holmqvist <fredrik.holmqvist@gmail.com>
driver: add cpuidle device driver

Currently, it's only used to load generic cpuidle module. But in the
future, we will add some features such as stats reporting etc.

Signed-off-by: Yongcong Du <ycdu.vmcore@gmail.com>
Signed-off-by: Fredrik Holmqvist <fredrik.holmqvist@gmail.com>
enable cpuidle module and device driver

Signed-off-by: Fredrik Holmqvist <fredrik.holmqvist@gmail.com>
cpuidle: rename CpuidleStats to CpuidleStat

Signed-off-by: Fredrik Holmqvist <fredrik.holmqvist@gmail.com>
intel_cpuidle: apply strict cpu checking to see it's snb or not

we need to check cpu vendor, family, and model

Signed-off-by: Fredrik Holmqvist <fredrik.holmqvist@gmail.com>
cpuidle: add stats reporting support

Signed-off-by: Fredrik Holmqvist <fredrik.holmqvist@gmail.com>
cpuidle: we should exit when cStateCount is less than 3

If only C0, C1 are available, it doesn't make any sense to enable
cpuidle

Signed-off-by: Fredrik Holmqvist <fredrik.holmqvist@gmail.com>
acpi: add ACPI_ALLOCATE_LOCAL_BUFFER to ACPI.h

Signed-off-by: Fredrik Holmqvist <fredrik.holmqvist@gmail.com>
cpuidle: move generic cpuidle to generic

After this change, low level cpuidle drivers load the generic cpuidle
module if they can support the underlying platform.

change the intel cpuidle driver accordingly, now it's loaded by acpi
bus manager during boot, although it doesn't depend on acpi

Signed-off-by: Fredrik Holmqvist <fredrik.holmqvist@gmail.com>
acpi: export read_bit_register and write_bit_register

acpi cpuidle needs such acpi functions

Signed-off-by: Fredrik Holmqvist <fredrik.holmqvist@gmail.com>
cpuidle: implement acpi cpuidle driver

we prefer intel native cpuidle driver on newer intel platforms --
sandybridge or later. we'll fall back to acpi cpuidle driver for other
platforms.

Signed-off-by: Fredrik Holmqvist <fredrik.holmqvist@gmail.com>
cpuidle: remove drivers/cpuidle

Since generic cpuidle module is loaded by lowlevel cpuidle drivers which
are loaded dynamically during boot, we don't need drivers/cpuidle any
more

Signed-off-by: Fredrik Holmqvist <fredrik.holmqvist@gmail.com>
x86_cpuidle: use module_dependencies rather than get_module()

Signed-off-by: Fredrik Holmqvist <fredrik.holmqvist@gmail.com>
x86_cpuidle: coding style fix according to Jerome

Signed-off-by: Fredrik Holmqvist <fredrik.holmqvist@gmail.com>
Add disabled cpuidle driver and module to haikuImage.

CPU idle still needs some polish, but it should work on
newer cpus.
Merge branch 'cpu_idle'

* cpu_idle:
  Add disabled cpuidle driver and module to haikuImage.
  x86_cpuidle: coding style fix according to Jerome
  x86_cpuidle: use module_dependencies rather than get_module()
  cpuidle: remove drivers/cpuidle
  cpuidle: implement acpi cpuidle driver
  acpi: export read_bit_register and write_bit_register
  cpuidle: move generic cpuidle to generic
  acpi: add ACPI_ALLOCATE_LOCAL_BUFFER to ACPI.h
  cpuidle: we should exit when cStateCount is less than 3
  cpuidle: add stats reporting support
  intel_cpuidle: apply strict cpu checking to see it's snb or not
  cpuidle: rename CpuidleStats to CpuidleStat
  enable cpuidle module and device driver
  driver: add cpuidle device driver
  cpuidle: add intel native cpuidle module
  idle: introduce cpuidle generic module