hwpstate: add CPPC support for pstate driver on AMD
Implement CPPC interface for AMD Pstate Driver.
This feature is only enabled when the CPUID shows it support CPPC.
The CPPC is implemneted by the following steps:
- Write MSR to enable it.
- Read capability registert which indicates binary value of levels
about lowest, best energy efficient, guarantee, and max performance.
- Write request register with epp in energy balanced mode. And let
CPU and firmware to enter autonomous mode.
Also, create a sysctl handler to allow userspace to change epp value.
In intel's hwpstate, The epp value can be in package level and core level.
However, in AMD's one, there is only core level. Thus, to sync with the
intel's code, we implement package level control in software and provide
another sysctl (machdep.hwpstate_pkg_ctrl) to control it.
Reviewed by: olce, khng
Approved by: lwhsu (mentor)
MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D49587