mb/prodrive/hermes: Drop EEPROM address function parameters
Only one EEPROM is used to store the board settings, and its I2C address is constant. Thus, there's no need to pass its address as a parameter. In addition, reduce the scope of the `I2C_ADDR_EEPROM` definition, since using it outside of eeprom.c would bypass the API's abstraction layer. Change-Id: I958304e6ed6df05af923139d44ff4fd1de204738 Signed-off-by: Patrick Rudolph <patrick.rudolph@9elements.com> Signed-off-by: Angel Pons <th3fanbus@gmail.com> Reviewed-on: https://review.coreboot.org/c/coreboot/+/46565 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Patrick Rudolph <siro@das-labor.org>
This commit is contained in:
parent
707e03d8b9
commit
f651022df3
|
@ -6,15 +6,17 @@
|
||||||
#include <soc/intel/common/block/smbus/smbuslib.h>
|
#include <soc/intel/common/block/smbus/smbuslib.h>
|
||||||
#include "variants/baseboard/include/eeprom.h"
|
#include "variants/baseboard/include/eeprom.h"
|
||||||
|
|
||||||
|
#define I2C_ADDR_EEPROM 0x57
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Check Signature in EEPROM (M24C32-FMN6TP)
|
* Check Signature in EEPROM (M24C32-FMN6TP)
|
||||||
* If signature is there we assume that that the content is valid
|
* If signature is there we assume that that the content is valid
|
||||||
*/
|
*/
|
||||||
int check_signature(u8 addr, const size_t offset, const uint64_t signature)
|
int check_signature(const size_t offset, const uint64_t signature)
|
||||||
{
|
{
|
||||||
u8 blob[8] = {0};
|
u8 blob[8] = {0};
|
||||||
|
|
||||||
if (!read_write_config(addr, blob, offset, 0, ARRAY_SIZE(blob))) {
|
if (!read_write_config(blob, offset, 0, ARRAY_SIZE(blob))) {
|
||||||
/* Check signature */
|
/* Check signature */
|
||||||
if (*(uint64_t *)blob == signature) {
|
if (*(uint64_t *)blob == signature) {
|
||||||
printk(BIOS_DEBUG, "CFG EEPROM: Signature valid.\n");
|
printk(BIOS_DEBUG, "CFG EEPROM: Signature valid.\n");
|
||||||
|
@ -27,8 +29,7 @@ int check_signature(u8 addr, const size_t offset, const uint64_t signature)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Read data from offset and write it to offset in UPD */
|
/* Read data from offset and write it to offset in UPD */
|
||||||
bool read_write_config(u8 addr, void *blob, size_t read_offset, size_t write_offset,
|
bool read_write_config(void *blob, size_t read_offset, size_t write_offset, size_t size)
|
||||||
size_t size)
|
|
||||||
{
|
{
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
|
|
||||||
|
@ -42,7 +43,7 @@ bool read_write_config(u8 addr, void *blob, size_t read_offset, size_t write_off
|
||||||
for (size_t i = 0; i < size; i = i + 2) {
|
for (size_t i = 0; i < size; i = i + 2) {
|
||||||
u8 tmp[2] = {0};
|
u8 tmp[2] = {0};
|
||||||
|
|
||||||
ret = do_smbus_process_call(SMBUS_IO_BASE, addr, 0,
|
ret = do_smbus_process_call(SMBUS_IO_BASE, I2C_ADDR_EEPROM, 0,
|
||||||
swab16(read_offset + i), (uint16_t *)&tmp[0]);
|
swab16(read_offset + i), (uint16_t *)&tmp[0]);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -19,13 +19,13 @@ void mainboard_silicon_init_params(FSPS_UPD *supd)
|
||||||
params->SataLedEnable = 1;
|
params->SataLedEnable = 1;
|
||||||
|
|
||||||
/* Overwrite params */
|
/* Overwrite params */
|
||||||
if (!check_signature(I2C_ADDR_EEPROM, EEPROM_OFFSET_FSP_SIGNATURE, FSP_UPD_SIGNATURE))
|
if (!check_signature(EEPROM_OFFSET_FSP_SIGNATURE, FSP_UPD_SIGNATURE))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
for (u8 i = 0; i <= ARRAY_SIZE(parmas_list); i++) {
|
for (u8 i = 0; i <= ARRAY_SIZE(parmas_list); i++) {
|
||||||
if (ARRAY_SIZE(parmas_list) == 0)
|
if (ARRAY_SIZE(parmas_list) == 0)
|
||||||
break;
|
break;
|
||||||
read_write_config(I2C_ADDR_EEPROM, params, EEPROM_OFFSET_FSP_CONFIG +
|
read_write_config(params, EEPROM_OFFSET_FSP_CONFIG +
|
||||||
parmas_list[i].offset,
|
parmas_list[i].offset,
|
||||||
EEPROM_OFFSET_FSP_CONFIG + parmas_list[i].offset,
|
EEPROM_OFFSET_FSP_CONFIG + parmas_list[i].offset,
|
||||||
parmas_list[i].size);
|
parmas_list[i].size);
|
||||||
|
|
|
@ -19,11 +19,11 @@ void mainboard_memory_init_params(FSPM_UPD *memupd)
|
||||||
cannonlake_memcfg_init(&memupd->FspmConfig, variant_memcfg_config());
|
cannonlake_memcfg_init(&memupd->FspmConfig, variant_memcfg_config());
|
||||||
|
|
||||||
/* Overwrite memupd */
|
/* Overwrite memupd */
|
||||||
if (!check_signature(I2C_ADDR_EEPROM, EEPROM_OFFSET_FSP_SIGNATURE, FSP_UPD_SIGNATURE))
|
if (!check_signature(EEPROM_OFFSET_FSP_SIGNATURE, FSP_UPD_SIGNATURE))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
for (size_t i = 0; i < ARRAY_SIZE(parmas_list); i++) {
|
for (size_t i = 0; i < ARRAY_SIZE(parmas_list); i++) {
|
||||||
read_write_config(I2C_ADDR_EEPROM, memupd, EEPROM_OFFSET_FSP_CONFIG +
|
read_write_config(memupd, EEPROM_OFFSET_FSP_CONFIG +
|
||||||
parmas_list[i].offset,
|
parmas_list[i].offset,
|
||||||
EEPROM_OFFSET_FSP_CONFIG + parmas_list[i].offset,
|
EEPROM_OFFSET_FSP_CONFIG + parmas_list[i].offset,
|
||||||
parmas_list[i].size);
|
parmas_list[i].size);
|
||||||
|
|
|
@ -2,8 +2,6 @@
|
||||||
|
|
||||||
#include <soc/ramstage.h>
|
#include <soc/ramstage.h>
|
||||||
|
|
||||||
#define I2C_ADDR_EEPROM 0x57
|
|
||||||
|
|
||||||
#if ENV_ROMSTAGE
|
#if ENV_ROMSTAGE
|
||||||
#define FSP_UPD_SIGNATURE FSPM_UPD_SIGNATURE
|
#define FSP_UPD_SIGNATURE FSPM_UPD_SIGNATURE
|
||||||
#define EEPROM_OFFSET_FSP_SIGNATURE 0
|
#define EEPROM_OFFSET_FSP_SIGNATURE 0
|
||||||
|
@ -25,6 +23,5 @@ typedef struct {
|
||||||
size_t size;
|
size_t size;
|
||||||
} fsp_params;
|
} fsp_params;
|
||||||
|
|
||||||
bool read_write_config(u8 addr, void *blob, size_t read_offset, size_t write_offset,
|
bool read_write_config(void *blob, size_t read_offset, size_t write_offset, size_t size);
|
||||||
size_t size);
|
int check_signature(const size_t offset, const uint64_t signature);
|
||||||
int check_signature(u8 addr, const size_t offset, const uint64_t signature);
|
|
||||||
|
|
Loading…
Reference in New Issue