hv:cpu-caps:refine processor family and model info

v3 -> v4:
Refine commit message and code stype

1.
SDM Vol. 2A 3-211 states DisplayFamily = Extended_Family_ID + Family_ID
when Family_ID == 0FH.
So it should be family += ((eax >> 20U) & 0xffU) when Family_ID == 0FH.

2.
IF (Family_ID = 06H or Family_ID = 0FH)
	THEN DisplayModel = (Extended_Model_ID « 4) + Model_ID;
While previous code this logic:
IF (DisplayFamily = 06H or DisplayFamily = 0FH)

Fix the bug about calculation of display family and
display model according to SDM definition.

3. use variable name to distinguish Family ID/Display Family/Model ID/Display Model,
then the code is more clear to avoid some mistake

Tracked-On:#3675

Signed-off-by: liujunming <junming.liu@intel.com>
Reviewed-by: Wu Xiangyang <xiangyang.wu@linux.intel.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
This commit is contained in:
liujunming
2020-08-10 17:07:10 +08:00
committed by wenlingz
parent 05a083c944
commit 538e7cf74d
4 changed files with 24 additions and 17 deletions

View File

@@ -32,7 +32,10 @@
#define FEATURE_WORDS 15U
struct cpuinfo_x86 {
uint8_t family, model;
/* SDM 2-2 Vol.4 Table 2-1 uses DisplayFamily_DisplayModel to
* distinguish Processor Families/Processor Number Series.
*/
uint8_t displayfamily, displaymodel;
uint8_t virt_bits;
uint8_t phys_bits;
uint32_t cpuid_level;