From afd03d8a28df60a058e73e4f1f4e0e89f8373bd1 Mon Sep 17 00:00:00 2001 From: Marc Jones Date: Thu, 16 Nov 2017 10:01:08 -0700 Subject: amd/stoneyridge: Fix SPD files and functions camel case Remove ugly camel case in the soc/amd/common and Stoney Ridge SPD files and functions. Update the related mainboards. Also, remove a unreferenced function prototype, smbus_readSpd(). Change-Id: I51045b6621f0708d61a570acbdcb4e6522baa1ea Signed-off-by: Marc Jones Reviewed-on: https://review.coreboot.org/22483 Tested-by: build bot (Jenkins) Reviewed-by: Aaron Durbin --- src/mainboard/amd/gardenia/devicetree.cb | 2 +- .../google/kahlee/variants/kahlee/devicetree.cb | 2 +- .../amd/common/block/include/amdblocks/dimm_spd.h | 25 ++++++++++++ src/soc/amd/common/dimmSpd.h | 26 ------------ src/soc/amd/stoneyridge/BiosCallOuts.c | 2 +- src/soc/amd/stoneyridge/Makefile.inc | 2 +- src/soc/amd/stoneyridge/chip.h | 2 +- src/soc/amd/stoneyridge/dimmSpd.c | 47 ---------------------- src/soc/amd/stoneyridge/dimm_spd.c | 47 ++++++++++++++++++++++ src/soc/amd/stoneyridge/smbus_spd.c | 14 +++---- 10 files changed, 84 insertions(+), 85 deletions(-) create mode 100644 src/soc/amd/common/block/include/amdblocks/dimm_spd.h delete mode 100644 src/soc/amd/common/dimmSpd.h delete mode 100644 src/soc/amd/stoneyridge/dimmSpd.c create mode 100644 src/soc/amd/stoneyridge/dimm_spd.c diff --git a/src/mainboard/amd/gardenia/devicetree.cb b/src/mainboard/amd/gardenia/devicetree.cb index 38bf86fb09..e9946adc55 100644 --- a/src/mainboard/amd/gardenia/devicetree.cb +++ b/src/mainboard/amd/gardenia/devicetree.cb @@ -14,7 +14,7 @@ # chip soc/amd/stoneyridge - register "spdAddrLookup" = " + register "spd_addr_lookup" = " { { {0xA2, 0x00} }, // socket 0 - Channel 0, slots 0 & 1 }" diff --git a/src/mainboard/google/kahlee/variants/kahlee/devicetree.cb b/src/mainboard/google/kahlee/variants/kahlee/devicetree.cb index 28f22a4c79..409e09e1b4 100644 --- a/src/mainboard/google/kahlee/variants/kahlee/devicetree.cb +++ b/src/mainboard/google/kahlee/variants/kahlee/devicetree.cb @@ -14,7 +14,7 @@ # chip soc/amd/stoneyridge - register "spdAddrLookup" = " + register "spd_addr_lookup" = " { { {0xA0, 0x00} }, // socket 0 - Channel 0, slot 0 }" diff --git a/src/soc/amd/common/block/include/amdblocks/dimm_spd.h b/src/soc/amd/common/block/include/amdblocks/dimm_spd.h new file mode 100644 index 0000000000..8683caa6a9 --- /dev/null +++ b/src/soc/amd/common/block/include/amdblocks/dimm_spd.h @@ -0,0 +1,25 @@ +/* + * This file is part of the coreboot project. + * + * Copyright (C) 2012, 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. + */ + +#ifndef __DIMMSPD_H__ +#define __DIMMSPD_H__ + +AGESA_STATUS +AmdMemoryReadSPD(IN UINT32 Func, IN UINTN Data, + IN OUT AGESA_READ_SPD_PARAMS *SpdData); + +int sb_read_spd(uint8_t spdAddress, char *buf, size_t len); + +#endif diff --git a/src/soc/amd/common/dimmSpd.h b/src/soc/amd/common/dimmSpd.h deleted file mode 100644 index 9abdb984d4..0000000000 --- a/src/soc/amd/common/dimmSpd.h +++ /dev/null @@ -1,26 +0,0 @@ -/* - * This file is part of the coreboot project. - * - * Copyright (C) 2012 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. - */ - -#ifndef __DIMMSPD_H__ -#define __DIMMSPD_H__ - -AGESA_STATUS -AmdMemoryReadSPD(IN UINT32 Func, IN UINTN Data, - IN OUT AGESA_READ_SPD_PARAMS *SpdData); - -int sb_readSpd(uint8_t spdAddress, char *buf, size_t len); -int smbus_readSpd(int spdAddress, char *buf, size_t len); - -#endif diff --git a/src/soc/amd/stoneyridge/BiosCallOuts.c b/src/soc/amd/stoneyridge/BiosCallOuts.c index 9110338aba..2c68f38d9e 100644 --- a/src/soc/amd/stoneyridge/BiosCallOuts.c +++ b/src/soc/amd/stoneyridge/BiosCallOuts.c @@ -21,7 +21,7 @@ #include #include -#include +#include AGESA_STATUS agesa_fch_initreset(UINT32 Func, UINTN FchData, VOID *ConfigPtr) { diff --git a/src/soc/amd/stoneyridge/Makefile.inc b/src/soc/amd/stoneyridge/Makefile.inc index f2a9d8d4f5..a50511d36f 100644 --- a/src/soc/amd/stoneyridge/Makefile.inc +++ b/src/soc/amd/stoneyridge/Makefile.inc @@ -47,7 +47,7 @@ bootblock-y += tsc_freq.c romstage-y += BiosCallOuts.c romstage-y += romstage.c romstage-y += early_setup.c -romstage-y += dimmSpd.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 diff --git a/src/soc/amd/stoneyridge/chip.h b/src/soc/amd/stoneyridge/chip.h index f50851b44b..5688a7397d 100644 --- a/src/soc/amd/stoneyridge/chip.h +++ b/src/soc/amd/stoneyridge/chip.h @@ -25,7 +25,7 @@ #define MAX_DIMMS_PER_CH 2 struct soc_amd_stoneyridge_config { - u8 spdAddrLookup[MAX_NODES][MAX_DRAM_CH][MAX_DIMMS_PER_CH]; + u8 spd_addr_lookup[MAX_NODES][MAX_DRAM_CH][MAX_DIMMS_PER_CH]; enum { DRAM_CONTENTS_KEEP, DRAM_CONTENTS_CLEAR diff --git a/src/soc/amd/stoneyridge/dimmSpd.c b/src/soc/amd/stoneyridge/dimmSpd.c deleted file mode 100644 index 163779d95f..0000000000 --- a/src/soc/amd/stoneyridge/dimmSpd.c +++ /dev/null @@ -1,47 +0,0 @@ -/* - * This file is part of the coreboot project. - * - * Copyright (C) 2015 - 2016 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 -#include -#include -#include -#include -#include "chip.h" -#include - -AGESA_STATUS AmdMemoryReadSPD(UINT32 unused1, UINTN unused2, - AGESA_READ_SPD_PARAMS *info) -{ - uint8_t spdAddress; - 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->spdAddrLookup)) - return AGESA_ERROR; - if (info->MemChannelId >= ARRAY_SIZE(conf->spdAddrLookup[0])) - return AGESA_ERROR; - if (info->DimmId >= ARRAY_SIZE(conf->spdAddrLookup[0][0])) - return AGESA_ERROR; - spdAddress = conf->spdAddrLookup - [info->SocketId][info->MemChannelId][info->DimmId]; - if (spdAddress == 0) - return AGESA_ERROR; - int err = sb_readSpd(spdAddress, (void *)info->Buffer, 128); - if (err) - return AGESA_ERROR; - return AGESA_SUCCESS; -} diff --git a/src/soc/amd/stoneyridge/dimm_spd.c b/src/soc/amd/stoneyridge/dimm_spd.c new file mode 100644 index 0000000000..13fd72fe25 --- /dev/null +++ b/src/soc/amd/stoneyridge/dimm_spd.c @@ -0,0 +1,47 @@ +/* + * 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 +#include +#include +#include +#include +#include "chip.h" +#include + +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, 128); + if (err) + return AGESA_ERROR; + return AGESA_SUCCESS; +} diff --git a/src/soc/amd/stoneyridge/smbus_spd.c b/src/soc/amd/stoneyridge/smbus_spd.c index f5c77c9baa..acd907e55b 100644 --- a/src/soc/amd/stoneyridge/smbus_spd.c +++ b/src/soc/amd/stoneyridge/smbus_spd.c @@ -1,7 +1,7 @@ /* * This file is part of the coreboot project. * - * Copyright (C) 2012 Advanced Micro Devices, Inc. + * Copyright (C) 2012, 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 @@ -18,7 +18,7 @@ #include #include #include -#include +#include /* * readspd - Read one or more SPD bytes from a DIMM. @@ -72,24 +72,24 @@ static int readspd(uint16_t iobase, uint8_t SmbusSlaveAddress, return 0; } -static void writePmReg(int reg, int data) +static void write_pm_reg(int reg, int data) { outb(reg, PM_INDEX); outb(data, PM_DATA); } -static void setupFch(uint16_t ioBase) +static void setup_fch(uint16_t ioBase) { - writePmReg(SMB_ASF_IO_BASE, ioBase >> 8); + write_pm_reg(SMB_ASF_IO_BASE, ioBase >> 8); outb(SMB_SPEED_400KHZ, ioBase + SMBTIMING); /* Clear all SMBUS status bits */ outb(SMBHST_STAT_CLEAR, ioBase + SMBHSTSTAT); outb(SMBSLV_STAT_CLEAR, ioBase + SMBSLVSTAT); } -int sb_readSpd(uint8_t spdAddress, char *buf, size_t len) +int sb_read_spd(uint8_t spdAddress, char *buf, size_t len) { uint16_t ioBase = SMB_BASE_ADDR; - setupFch(ioBase); + setup_fch(ioBase); return readspd(ioBase, spdAddress, buf, len); } -- cgit v1.2.3