aboutsummaryrefslogtreecommitdiff
path: root/src/northbridge/amd/agesa/family16kb
diff options
context:
space:
mode:
Diffstat (limited to 'src/northbridge/amd/agesa/family16kb')
-rw-r--r--src/northbridge/amd/agesa/family16kb/Kconfig2
-rw-r--r--src/northbridge/amd/agesa/family16kb/chip.h4
-rw-r--r--src/northbridge/amd/agesa/family16kb/dimmSpd.c26
-rw-r--r--src/northbridge/amd/agesa/family16kb/northbridge.c4
-rw-r--r--src/northbridge/amd/agesa/family16kb/northbridge.h8
5 files changed, 25 insertions, 19 deletions
diff --git a/src/northbridge/amd/agesa/family16kb/Kconfig b/src/northbridge/amd/agesa/family16kb/Kconfig
index 466414c8a3..91b94c646c 100644
--- a/src/northbridge/amd/agesa/family16kb/Kconfig
+++ b/src/northbridge/amd/agesa/family16kb/Kconfig
@@ -46,4 +46,4 @@ config VGA_BIOS_ID
The default VGA BIOS PCI vendor/device ID should be set to the
result of the map_oprom_vendev() function in northbridge.c.
-endif
+endif # NORTHBRIDGE_AMD_AGESA_FAMILY16_KB
diff --git a/src/northbridge/amd/agesa/family16kb/chip.h b/src/northbridge/amd/agesa/family16kb/chip.h
index 82e56b4fc6..d2cb873932 100644
--- a/src/northbridge/amd/agesa/family16kb/chip.h
+++ b/src/northbridge/amd/agesa/family16kb/chip.h
@@ -17,8 +17,8 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
-#ifndef _AGESA_FAM16KB_CHIP_H_
-#define _AGESA_FAM16KB_CHIP_H_
+#ifndef _NB_AGESA_CHIP_H_
+#define _NB_AGESA_CHIP_H_
struct northbridge_amd_agesa_family16kb_config
{
diff --git a/src/northbridge/amd/agesa/family16kb/dimmSpd.c b/src/northbridge/amd/agesa/family16kb/dimmSpd.c
index 8991bdb69e..6ffdf5d985 100644
--- a/src/northbridge/amd/agesa/family16kb/dimmSpd.c
+++ b/src/northbridge/amd/agesa/family16kb/dimmSpd.c
@@ -19,6 +19,7 @@
#include <device/pci_def.h>
#include <device/device.h>
+#include <stdlib.h>
/* warning: Porting.h includes an open #pragma pack(1) */
#include "Porting.h"
@@ -26,28 +27,33 @@
#include "amdlib.h"
#include "chip.h"
-#include "northbridge/amd/agesa/dimmSpd.h"
-
-#define DIMENSION(array)(sizeof (array)/ sizeof (array [0]))
+#include <northbridge/amd/agesa/dimmSpd.h>
+/**
+ * Gets the SMBus address for an SPD from the array in devicetree.cb
+ * then read the SPD into the supplied buffer.
+ */
AGESA_STATUS AmdMemoryReadSPD (UINT32 unused1, UINT32 unused2, AGESA_READ_SPD_PARAMS *info)
{
- int spdAddress;
+ UINT8 spdAddress;
+
ROMSTAGE_CONST struct device *dev = dev_find_slot(0, PCI_DEVFN(0x18, 2));
- ROMSTAGE_CONST struct northbridge_amd_agesa_family16kb_config *config = dev->chip_info;
+ if (dev == NULL)
+ return AGESA_ERROR;
- if ((dev == 0) || (config == 0))
+ ROMSTAGE_CONST struct northbridge_amd_agesa_family16kb_config *config = dev->chip_info;
+ if (config == NULL)
return AGESA_ERROR;
- if (info->SocketId >= DIMENSION(config->spdAddrLookup ))
+ if (info->SocketId >= ARRAY_SIZE(config->spdAddrLookup))
return AGESA_ERROR;
- if (info->MemChannelId >= DIMENSION(config->spdAddrLookup[0] ))
+ if (info->MemChannelId >= ARRAY_SIZE(config->spdAddrLookup[0]))
return AGESA_ERROR;
- if (info->DimmId >= DIMENSION(config->spdAddrLookup[0][0]))
+ if (info->DimmId >= ARRAY_SIZE(config->spdAddrLookup[0][0]))
return AGESA_ERROR;
spdAddress = config->spdAddrLookup
- [info->SocketId] [info->MemChannelId] [info->DimmId];
+ [info->SocketId][info->MemChannelId][info->DimmId];
if (spdAddress == 0)
return AGESA_ERROR;
diff --git a/src/northbridge/amd/agesa/family16kb/northbridge.c b/src/northbridge/amd/agesa/family16kb/northbridge.c
index 74a72f4d36..01eaa208f0 100644
--- a/src/northbridge/amd/agesa/family16kb/northbridge.c
+++ b/src/northbridge/amd/agesa/family16kb/northbridge.c
@@ -379,7 +379,7 @@ static void set_resource(device_t dev, struct resource *resource, u32 nodeid)
set_io_addr_reg(dev, nodeid, link_num, reg, rbase>>8, rend>>8);
}
else if (resource->flags & IORESOURCE_MEM) {
- set_mmio_addr_reg(nodeid, link_num, reg, (resource->index >>24), rbase>>8, rend>>8, node_nums) ;// [39:8]
+ set_mmio_addr_reg(nodeid, link_num, reg, (resource->index >>24), rbase>>8, rend>>8, node_nums);// [39:8]
}
resource->flags |= IORESOURCE_STORED;
snprintf(buf, sizeof (buf), " <node %x link %x>",
@@ -757,7 +757,7 @@ static void domain_set_resources(device_t dev)
if (!(d.mask & 1)) continue;
basek = ((resource_t)(d.base & 0x1fffff00)) << 9; // could overflow, we may lost 6 bit here
- limitk = ((resource_t)(((d.mask & ~1) + 0x000FF) & 0x1fffff00)) << 9 ;
+ limitk = ((resource_t)(((d.mask & ~1) + 0x000FF) & 0x1fffff00)) << 9;
sizek = limitk - basek;
diff --git a/src/northbridge/amd/agesa/family16kb/northbridge.h b/src/northbridge/amd/agesa/family16kb/northbridge.h
index 0161ae676b..38501c865a 100644
--- a/src/northbridge/amd/agesa/family16kb/northbridge.h
+++ b/src/northbridge/amd/agesa/family16kb/northbridge.h
@@ -14,13 +14,13 @@
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
-#ifndef NORTHBRIDGE_AMD_AGESA_FAM16H_H
-#define NORTHBRIDGE_AMD_AGESA_FAM16H_H
+#ifndef NORTHBRIDGE_AMD_AGESA_FAM16_H
+#define NORTHBRIDGE_AMD_AGESA_FAM16_H
static struct device_operations pci_domain_ops;
static struct device_operations cpu_bus_ops;
-#endif /* NORTHBRIDGE_AMD_AGESA_FAM16H_H */
+#endif /* NORTHBRIDGE_AMD_AGESA_FAM16_H */