nb/amdk8/debug.c Fix building with CONFIG_DEBUG_SMBUS

Problem was introduced by fb2f667da2 "nb/amd/amdk8: Link raminit_f.c"
which linked debug.c and was not tested with this option.

Change-Id: I8597a6915c65ea783a864110cb23ecb34ea0611b
Signed-off-by: Arthur Heymans <arthur@aheymans.xyz>
Reviewed-on: https://review.coreboot.org/19653
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Swift Geek <swiftgeek@gmail.com>
Reviewed-by: Paul Menzel <paulepanter@users.sourceforge.net>
Reviewed-by: Stefan Reinauer <stefan.reinauer@coreboot.org>
This commit is contained in:
Arthur Heymans 2017-05-10 16:28:38 +02:00 committed by Stefan Reinauer
parent 4988af8ca8
commit 8eb55bbfe7
2 changed files with 8 additions and 4 deletions

View File

@ -8,6 +8,7 @@
#include <arch/io.h> #include <arch/io.h>
#include <device/pci_def.h> #include <device/pci_def.h>
#include <delay.h> #include <delay.h>
#include "raminit.h"
void print_debug_addr(const char *str, void *val) void print_debug_addr(const char *str, void *val)
{ {
@ -153,7 +154,7 @@ void dump_spd_registers(const struct mem_controller *ctrl)
if ((j & 0xf) == 0) { if ((j & 0xf) == 0) {
printk(BIOS_DEBUG, "\n%02x: ", j); printk(BIOS_DEBUG, "\n%02x: ", j);
} }
status = smbus_read_byte(device, j); status = spd_read_byte(device, j);
if (status < 0) { if (status < 0) {
break; break;
} }
@ -172,7 +173,7 @@ void dump_spd_registers(const struct mem_controller *ctrl)
if ((j & 0xf) == 0) { if ((j & 0xf) == 0) {
printk(BIOS_DEBUG, "\n%02x: ", j); printk(BIOS_DEBUG, "\n%02x: ", j);
} }
status = smbus_read_byte(device, j); status = spd_read_byte(device, j);
if (status < 0) { if (status < 0) {
break; break;
} }
@ -189,12 +190,13 @@ void dump_smbus_registers(void)
printk(BIOS_DEBUG, "\n"); printk(BIOS_DEBUG, "\n");
for (device = 1; device < 0x80; device++) { for (device = 1; device < 0x80; device++) {
int j; int j;
if (smbus_read_byte(device, 0) < 0) continue; if (spd_read_byte(device, 0) < 0)
continue;
printk(BIOS_DEBUG, "smbus: %02x", device); printk(BIOS_DEBUG, "smbus: %02x", device);
for (j = 0; j < 256; j++) { for (j = 0; j < 256; j++) {
int status; int status;
unsigned char byte; unsigned char byte;
status = smbus_read_byte(device, j); status = spd_read_byte(device, j);
if (status < 0) { if (status < 0) {
break; break;
} }

View File

@ -33,6 +33,8 @@ void sdram_enable(int controllers, const struct mem_controller *ctrl,
void sdram_set_registers(const struct mem_controller *ctrl, struct sys_info *sysinfo); void sdram_set_registers(const struct mem_controller *ctrl, struct sys_info *sysinfo);
void sdram_set_spd_registers(const struct mem_controller *ctrl, void sdram_set_spd_registers(const struct mem_controller *ctrl,
struct sys_info *sysinfo); struct sys_info *sysinfo);
void dump_spd_registers(const struct mem_controller *ctrl);
void dump_smbus_registers(void);
#else #else
void sdram_set_registers(const struct mem_controller *ctrl); void sdram_set_registers(const struct mem_controller *ctrl);
void sdram_set_spd_registers(const struct mem_controller *ctrl); void sdram_set_spd_registers(const struct mem_controller *ctrl);