AMD Fam10h: sanity check some CPU data

If a certain register returns crap values, we
determine core_power using an uninitialized variable.
That doesn't sound healthy.

Change-Id: I1e890b78bfcc3bf0255a3d4f6561a783134b1719
Signed-off-by: Patrick Georgi <patrick@georgi-clan.de>
Found-by: Coverity Scan
Reviewed-on: http://review.coreboot.org/8508
Reviewed-by: Timothy Pearson <tpearson@raptorengineeringinc.com>
Tested-by: build bot (Jenkins)
Reviewed-by: Kyösti Mälkki <kyosti.malkki@gmail.com>
This commit is contained in:
Patrick Georgi 2015-02-22 16:27:56 +01:00 committed by Patrick Georgi
parent f752d013b0
commit aab66b1dc7
1 changed files with 5 additions and 0 deletions

View File

@ -223,6 +223,11 @@ static void pstates_algorithm(u32 pcontrol_blk, u8 plen, u8 onlyBSP)
case 0x3:
expanded_cpuidv = 1000;
break;
default:
printk(BIOS_ERR, "%s:%s:%d: Invalid cpuidv, "
"not generating pstate tables.\n",
__FILE__, __func__, __LINE__);
return;
}
core_power = (core_voltage * cpuidd) / (expanded_cpuidv * 10);