mb/intel/kblrvp: Fix unsigned val casting of smaller size

Signed-off-by: Praveen hodagatta pranesh <praveenx.hodagatta.pranesh@intel.com>
Change-Id: I519ed4b5b403622d6bb01ad0bdd04e01dedff7d8
Reviewed-on: https://review.coreboot.org/c/30794
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Arthur Heymans <arthur@aheymans.xyz>
This commit is contained in:
Praveen hodagatta pranesh
2019-01-10 18:23:58 +08:00
committed by Patrick Georgi
parent d6e00546a4
commit 0dbce4042f
3 changed files with 10 additions and 7 deletions

View File

@@ -36,12 +36,13 @@ int get_ec_boardinfo(void)
} }
/* Get spd index */ /* Get spd index */
int get_spd_index(void) int get_spd_index(u8 *spd_index)
{ {
int ec_info = get_ec_boardinfo(); int ec_info = get_ec_boardinfo();
if (ec_info >= 0) if (ec_info >= 0) {
return ((uint16_t)ec_info >> 5) & 0x7; *spd_index = ((uint16_t)ec_info >> 5) & 0x7;
return 0;
}
return -1; return -1;
} }

View File

@@ -16,6 +16,8 @@
#ifndef _MAINBOARD_BOARD_ID_H_ #ifndef _MAINBOARD_BOARD_ID_H_
#define _MAINBOARD_BOARD_ID_H_ #define _MAINBOARD_BOARD_ID_H_
#include <stdint.h>
/* Mobile Board Id 0x00 - 0xFF */ /* Mobile Board Id 0x00 - 0xFF */
#define BOARD_ID_SKL_A0_RVP3 0x04 #define BOARD_ID_SKL_A0_RVP3 0x04
#define BOARD_ID_SKL_RVP7 0x0B #define BOARD_ID_SKL_RVP7 0x0B
@@ -36,7 +38,7 @@
int get_ec_boardinfo(void); int get_ec_boardinfo(void);
/* Return spd index */ /* Return spd index */
int get_spd_index(void); int get_spd_index(u8 *spd_index);
/* Board id[15:8] */ /* Board id[15:8] */
int get_board_id(void); int get_board_id(void);

View File

@@ -31,8 +31,8 @@ void mainboard_memory_init_params(FSPM_UPD *mupd)
{ {
FSP_M_CONFIG *mem_cfg; FSP_M_CONFIG *mem_cfg;
mem_cfg = &mupd->FspmConfig; mem_cfg = &mupd->FspmConfig;
u8 spd_index = get_spd_index(); u8 spd_index;
if ((int)spd_index < 0) if (get_spd_index(&spd_index) < 0)
return; return;
printk(BIOS_INFO, "SPD index %d\n", spd_index); printk(BIOS_INFO, "SPD index %d\n", spd_index);