nb/amd/agesa: read 256 bytes to SPD buffer instead of 128
[coreboot.git] / src / northbridge / amd / agesa / family15tn / dimmSpd.c
blob6504d1475de6bc18023acc0afd867c730ded2bf5
1 /* SPDX-License-Identifier: GPL-2.0-only */
3 #include <device/pci_def.h>
4 #include <device/device.h>
6 /* warning: Porting.h includes an open #pragma pack(1) */
7 #include <Porting.h>
8 #include <AGESA.h>
9 #include "chip.h"
11 #include <northbridge/amd/agesa/dimmSpd.h>
13 /**
14 * Gets the SMBus address for an SPD from the array in devicetree.cb
15 * then read the SPD into the supplied buffer.
17 AGESA_STATUS AmdMemoryReadSPD (UINT32 unused1, UINTN unused2, AGESA_READ_SPD_PARAMS *info)
19 UINT8 spdAddress;
21 DEVTREE_CONST struct device *dev = pcidev_on_root(0x18, 2);
22 if (dev == NULL)
23 return AGESA_ERROR;
25 DEVTREE_CONST struct northbridge_amd_agesa_family15tn_config *config = dev->chip_info;
26 if (config == NULL)
27 return AGESA_ERROR;
29 if (info->SocketId >= ARRAY_SIZE(config->spdAddrLookup))
30 return AGESA_ERROR;
31 if (info->MemChannelId >= ARRAY_SIZE(config->spdAddrLookup[0]))
32 return AGESA_ERROR;
33 if (info->DimmId >= ARRAY_SIZE(config->spdAddrLookup[0][0]))
34 return AGESA_ERROR;
36 spdAddress = config->spdAddrLookup
37 [info->SocketId][info->MemChannelId][info->DimmId];
39 if (spdAddress == 0)
40 return AGESA_ERROR;
42 int err = hudson_readSpd(spdAddress, (void *) info->Buffer, 256);
43 if (err)
44 return AGESA_ERROR;
45 return AGESA_SUCCESS;