1 /* SPDX-License-Identifier: GPL-2.0-only */
3 #include <commonlib/helpers.h>
4 #include <device/pci_def.h>
5 #include <device/device.h>
7 /* warning: Porting.h includes an open #pragma pack(1) */
12 #include <northbridge/amd/pi/dimmSpd.h>
14 AGESA_STATUS
AmdMemoryReadSPD(UINT32 unused1
, UINTN unused2
, AGESA_READ_SPD_PARAMS
*info
)
17 DEVTREE_CONST
struct device
*dev
= pcidev_on_root(0x18, 2);
22 DEVTREE_CONST
struct northbridge_amd_pi_00730F01_config
*config
= dev
->chip_info
;
27 if (info
->SocketId
>= ARRAY_SIZE(config
->spdAddrLookup
))
29 if (info
->MemChannelId
>= ARRAY_SIZE(config
->spdAddrLookup
[0]))
31 if (info
->DimmId
>= ARRAY_SIZE(config
->spdAddrLookup
[0][0]))
34 spdAddress
= config
->spdAddrLookup
35 [info
->SocketId
] [info
->MemChannelId
] [info
->DimmId
];
40 int err
= hudson_readSpd(spdAddress
, (void *)info
->Buffer
, 128);