2 * This file is part of the coreboot project.
4 * Copyright (C) 2012 Advanced Micro Devices, Inc.
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; version 2 of the License.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
16 #include <device/pci_def.h>
17 #include <device/device.h>
20 /* warning: Porting.h includes an open #pragma pack(1) */
25 #include <northbridge/amd/agesa/dimmSpd.h>
28 * Gets the SMBus address for an SPD from the array in devicetree.cb
29 * then read the SPD into the supplied buffer.
31 AGESA_STATUS
AmdMemoryReadSPD (UINT32 unused1
, UINTN unused2
, AGESA_READ_SPD_PARAMS
*info
)
35 DEVTREE_CONST
struct device
*dev
= dev_find_slot(0, PCI_DEVFN(0x18, 2));
39 DEVTREE_CONST
struct northbridge_amd_agesa_family15tn_config
*config
= dev
->chip_info
;
43 if (info
->SocketId
>= ARRAY_SIZE(config
->spdAddrLookup
))
45 if (info
->MemChannelId
>= ARRAY_SIZE(config
->spdAddrLookup
[0]))
47 if (info
->DimmId
>= ARRAY_SIZE(config
->spdAddrLookup
[0][0]))
50 spdAddress
= config
->spdAddrLookup
51 [info
->SocketId
][info
->MemChannelId
][info
->DimmId
];
56 int err
= hudson_readSpd(spdAddress
, (void *) info
->Buffer
, 128);