soc/amd/stoneyridge: Add mainboard call for SPD values
Add a mainboard function call to write the AGESA SPD buffer. Removes the unneccesary dimm_spd.c file. BUG=b:67845441 Change-Id: Id42622008b49b4559e648a7fa1bfd9f26e1f56a4 Signed-off-by: Marc Jones <marcj303@gmail.com> Reviewed-on: https://review.coreboot.org/22485 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Aaron Durbin <adurbin@chromium.org> Reviewed-by: Marshall Dawson <marshalldawson3rd@gmail.com>
This commit is contained in:
parent
fede56bf81
commit
a9f72776bd
|
@ -20,10 +20,12 @@
|
|||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
|
||||
AGESA_STATUS
|
||||
AmdMemoryReadSPD(IN UINT32 Func, IN UINTN Data,
|
||||
IN OUT AGESA_READ_SPD_PARAMS *SpdData);
|
||||
|
||||
/*
|
||||
* Fill the buf and returns 0 on success.
|
||||
* Return -1 on failure and the the caller tries sb_read_spd()
|
||||
* to get the SPD from I2C.
|
||||
*/
|
||||
int mainboard_read_spd(uint8_t spdAddress, char *buf, size_t len);
|
||||
int sb_read_spd(uint8_t spdAddress, char *buf, size_t len);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
* This file is part of the coreboot project.
|
||||
*
|
||||
* Copyright (C) 2011 Advanced Micro Devices, Inc.
|
||||
* Copyright (C) 2011, 2017 Advanced Micro Devices, Inc.
|
||||
* Copyright (C) 2013 Sage Electronic Engineering, LLC
|
||||
* Copyright (C) 2017 Google Inc.
|
||||
*
|
||||
|
@ -15,13 +15,17 @@
|
|||
* GNU General Public License for more details.
|
||||
*/
|
||||
|
||||
#include <device/device.h>
|
||||
#include <device/pci_def.h>
|
||||
#include <BiosCallOuts.h>
|
||||
#include <soc/southbridge.h>
|
||||
#include <soc/pci_devs.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <agesawrapper.h>
|
||||
#include <amdlib.h>
|
||||
#include <amdblocks/dimm_spd.h>
|
||||
#include "chip.h"
|
||||
|
||||
AGESA_STATUS agesa_fch_initreset(UINT32 Func, UINTN FchData, VOID *ConfigPtr)
|
||||
{
|
||||
|
@ -91,24 +95,53 @@ AGESA_STATUS agesa_fch_initenv(UINT32 Func, UINTN FchData, VOID *ConfigPtr)
|
|||
|
||||
AGESA_STATUS agesa_ReadSpd(UINT32 Func, UINTN Data, VOID *ConfigPtr)
|
||||
{
|
||||
AGESA_STATUS Status = AGESA_UNSUPPORTED;
|
||||
uint8_t spd_address;
|
||||
int err;
|
||||
DEVTREE_CONST struct device *dev;
|
||||
DEVTREE_CONST struct soc_amd_stoneyridge_config *conf;
|
||||
AGESA_READ_SPD_PARAMS *info = ConfigPtr;
|
||||
|
||||
if (!ENV_ROMSTAGE)
|
||||
return Status;
|
||||
return AGESA_UNSUPPORTED;
|
||||
|
||||
if (IS_ENABLED(CONFIG_GENERIC_SPD_BIN)) {
|
||||
AGESA_READ_SPD_PARAMS *info = ConfigPtr;
|
||||
if (info->MemChannelId > 0)
|
||||
return AGESA_UNSUPPORTED;
|
||||
if (info->SocketId != 0)
|
||||
return AGESA_UNSUPPORTED;
|
||||
if (info->DimmId > 1)
|
||||
return AGESA_UNSUPPORTED;
|
||||
dev = dev_find_slot(0, DCT_DEVFN);
|
||||
if (dev == NULL)
|
||||
return AGESA_ERROR;
|
||||
|
||||
die("SPD in cbfs not yet supported.\n");
|
||||
} else {
|
||||
Status = AmdMemoryReadSPD(Func, Data, ConfigPtr);
|
||||
}
|
||||
conf = dev->chip_info;
|
||||
if (conf == NULL)
|
||||
return AGESA_ERROR;
|
||||
|
||||
return Status;
|
||||
if (info->SocketId >= ARRAY_SIZE(conf->spd_addr_lookup))
|
||||
return AGESA_ERROR;
|
||||
if (info->MemChannelId >= ARRAY_SIZE(conf->spd_addr_lookup[0]))
|
||||
return AGESA_ERROR;
|
||||
if (info->DimmId >= ARRAY_SIZE(conf->spd_addr_lookup[0][0]))
|
||||
return AGESA_ERROR;
|
||||
|
||||
spd_address = conf->spd_addr_lookup
|
||||
[info->SocketId][info->MemChannelId][info->DimmId];
|
||||
if (spd_address == 0)
|
||||
return AGESA_ERROR;
|
||||
|
||||
err = mainboard_read_spd(spd_address, (void *)info->Buffer,
|
||||
CONFIG_DIMM_SPD_SIZE);
|
||||
|
||||
/* Read the SPD if the mainboard didn't fill the buffer */
|
||||
if (err || (*info->Buffer == 0))
|
||||
err = sb_read_spd(spd_address, (void *)info->Buffer,
|
||||
CONFIG_DIMM_SPD_SIZE);
|
||||
|
||||
if (err)
|
||||
return AGESA_ERROR;
|
||||
|
||||
return AGESA_SUCCESS;
|
||||
}
|
||||
|
||||
/* Allow mainboards to fill the SPD buffer */
|
||||
__attribute__((weak)) int mainboard_read_spd(uint8_t spdAddress, char *buf,
|
||||
size_t len)
|
||||
{
|
||||
printk(BIOS_DEBUG, "WEAK: %s/%s called\n", __FILE__, __func__);
|
||||
return -1; /* SPD not read */
|
||||
}
|
||||
|
|
|
@ -47,7 +47,6 @@ bootblock-y += tsc_freq.c
|
|||
romstage-y += BiosCallOuts.c
|
||||
romstage-y += romstage.c
|
||||
romstage-y += early_setup.c
|
||||
romstage-y += dimm_spd.c
|
||||
romstage-$(CONFIG_USBDEBUG_IN_ROMSTAGE) += enable_usbdebug.c
|
||||
romstage-y += gpio.c
|
||||
romstage-$(CONFIG_STONEYRIDGE_IMC_FWM) += imc.c
|
||||
|
|
|
@ -1,48 +0,0 @@
|
|||
/*
|
||||
* This file is part of the coreboot project.
|
||||
*
|
||||
* Copyright (C) 2015 - 2017 Advanced Micro Devices, Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; version 2 of the License.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*/
|
||||
|
||||
#include <agesawrapper.h>
|
||||
#include <device/pci_def.h>
|
||||
#include <device/device.h>
|
||||
#include <soc/pci_devs.h>
|
||||
#include <stdlib.h>
|
||||
#include "chip.h"
|
||||
#include <amdblocks/dimm_spd.h>
|
||||
|
||||
AGESA_STATUS AmdMemoryReadSPD(UINT32 unused1, UINTN unused2,
|
||||
AGESA_READ_SPD_PARAMS *info)
|
||||
{
|
||||
uint8_t spd_address;
|
||||
DEVTREE_CONST struct device *dev = dev_find_slot(0, DCT_DEVFN);
|
||||
DEVTREE_CONST struct soc_amd_stoneyridge_config *conf = dev->chip_info;
|
||||
|
||||
if ((dev == 0) || (conf == 0))
|
||||
return AGESA_ERROR;
|
||||
if (info->SocketId >= ARRAY_SIZE(conf->spd_addr_lookup))
|
||||
return AGESA_ERROR;
|
||||
if (info->MemChannelId >= ARRAY_SIZE(conf->spd_addr_lookup[0]))
|
||||
return AGESA_ERROR;
|
||||
if (info->DimmId >= ARRAY_SIZE(conf->spd_addr_lookup[0][0]))
|
||||
return AGESA_ERROR;
|
||||
spd_address = conf->spd_addr_lookup
|
||||
[info->SocketId][info->MemChannelId][info->DimmId];
|
||||
if (spd_address == 0)
|
||||
return AGESA_ERROR;
|
||||
int err = sb_read_spd(spd_address, (void *)info->Buffer,
|
||||
CONFIG_DIMM_SPD_SIZE);
|
||||
if (err)
|
||||
return AGESA_ERROR;
|
||||
return AGESA_SUCCESS;
|
||||
}
|
Loading…
Reference in New Issue