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) */
11 #include <northbridge/amd/agesa/dimmSpd.h>
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
)
21 DEVTREE_CONST
struct device
*dev
= pcidev_on_root(0x18, 2);
25 DEVTREE_CONST
struct northbridge_amd_agesa_family15tn_config
*config
= dev
->chip_info
;
29 if (info
->SocketId
>= ARRAY_SIZE(config
->spdAddrLookup
))
31 if (info
->MemChannelId
>= ARRAY_SIZE(config
->spdAddrLookup
[0]))
33 if (info
->DimmId
>= ARRAY_SIZE(config
->spdAddrLookup
[0][0]))
36 spdAddress
= config
->spdAddrLookup
37 [info
->SocketId
][info
->MemChannelId
][info
->DimmId
];
42 int err
= hudson_readSpd(spdAddress
, (void *) info
->Buffer
, 256);