Debian Codegraph @

src/northbridge/amd/pi/00730F01/dimmSpd.c

raw symbols SCIP
1 /* SPDX-License-Identifier: GPL-2.0-only */
2
3 #include <commonlib/helpers.h>
4 #include <device/pci_def.h>
5 #include <device/device.h>
6
7 /* warning: Porting.h includes an open #pragma pack(1) */
8 #include <Porting.h>
9 #include <AGESA.h>
10 #include "chip.h"
11
12 #include <northbridge/amd/pi/dimmSpd.h>
13
14 AGESA_STATUS AmdMemoryReadSPD(UINT32 unused1, UINTN unused2, AGESA_READ_SPD_PARAMS *info)
15 {
16 int spdAddress;
17 DEVTREE_CONST struct device *dev = pcidev_on_root(0x18, 2);
18
19 if (dev == NULL)
20 return AGESA_ERROR;
21
22 DEVTREE_CONST struct northbridge_amd_pi_00730F01_config *config = dev->chip_info;
23
24 if (config == NULL)
25 return AGESA_ERROR;
26
27 if (info->SocketId >= ARRAY_SIZE(config->spdAddrLookup))
28 return AGESA_ERROR;
29 if (info->MemChannelId >= ARRAY_SIZE(config->spdAddrLookup[0]))
30 return AGESA_ERROR;
31 if (info->DimmId >= ARRAY_SIZE(config->spdAddrLookup[0][0]))
32 return AGESA_ERROR;
33
34 spdAddress = config->spdAddrLookup
35 [info->SocketId] [info->MemChannelId] [info->DimmId];
36
37 if (spdAddress == 0)
38 return AGESA_ERROR;
39
40 int err = hudson_readSpd(spdAddress, (void *)info->Buffer, 128);
41 if (err)
42 return AGESA_ERROR;
43 return AGESA_SUCCESS;
44 }