blob: fe1f9c82b5eab6fd8ddc5a19468e508f3983c44b [file] [log] [blame]
Martin Roth5474eb12018-05-26 19:22:33 -06001/*
2 * This file is part of the coreboot project.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; version 2 of the License.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 */
13
Stefan Reinauer3c0bfaf2010-12-27 11:34:57 +000014#include <console/console.h>
Kyösti Mälkkif1b58b72019-03-01 13:43:02 +020015#include <device/pci_ops.h>
Stefan Reinauer3c0bfaf2010-12-27 11:34:57 +000016#include <spd.h>
Keith Hui4444ea542020-01-12 19:09:24 -050017#include <southbridge/intel/i82371eb/i82371eb.h>
Uwe Hermann115c5b92010-10-09 17:00:18 +000018#include "raminit.h"
19
20void dump_spd_registers(void)
Richard Smith924f92f2006-07-29 17:40:36 +000021{
22 int i;
Keith Hui09f5a742010-12-23 17:12:03 +000023 printk(BIOS_DEBUG, "\n");
Elyes HAOUAS12df9502016-08-23 21:29:48 +020024 for (i = 0; i < DIMM_SOCKETS; i++) {
Martin Roth468d02c2019-10-23 21:44:42 -060025 unsigned int device;
Uwe Hermannd773fd32010-11-20 20:23:08 +000026 device = DIMM0 + i;
Richard Smith924f92f2006-07-29 17:40:36 +000027 if (device) {
28 int j;
Keith Hui09f5a742010-12-23 17:12:03 +000029 printk(BIOS_DEBUG, "DIMM %d: %02x", i, device);
Elyes HAOUAS12df9502016-08-23 21:29:48 +020030 for (j = 0; j < 256; j++) {
Richard Smith924f92f2006-07-29 17:40:36 +000031 int status;
32 unsigned char byte;
33 if ((j & 0xf) == 0) {
Keith Hui09f5a742010-12-23 17:12:03 +000034 printk(BIOS_DEBUG, "\n%02x: ", j);
Richard Smith924f92f2006-07-29 17:40:36 +000035 }
Keith Hui4444ea542020-01-12 19:09:24 -050036 status = smbus_read_byte(device, j);
Richard Smith924f92f2006-07-29 17:40:36 +000037 if (status < 0) {
Keith Hui09f5a742010-12-23 17:12:03 +000038 printk(BIOS_DEBUG, "bad device\n");
Richard Smith924f92f2006-07-29 17:40:36 +000039 break;
40 }
41 byte = status & 0xff;
Keith Hui09f5a742010-12-23 17:12:03 +000042 printk(BIOS_DEBUG, "%02x ", byte);
Richard Smith924f92f2006-07-29 17:40:36 +000043 }
Keith Hui09f5a742010-12-23 17:12:03 +000044 printk(BIOS_DEBUG, "\n");
Richard Smith924f92f2006-07-29 17:40:36 +000045 }
Richard Smith924f92f2006-07-29 17:40:36 +000046 }
47}
Stefan Reinauer3c0bfaf2010-12-27 11:34:57 +000048
Martin Roth468d02c2019-10-23 21:44:42 -060049void dump_pci_device(unsigned int dev)
Stefan Reinauer3c0bfaf2010-12-27 11:34:57 +000050{
51 int i;
Stefan Reinauer65b72ab2015-01-05 12:59:54 -080052 printk(BIOS_DEBUG, "PCI: %02x:%02x.%02x\n", (dev >> 20) & 0xff, (dev >> 15) & 0x1f, (dev >> 12) & 7);
Stefan Reinauer3c0bfaf2010-12-27 11:34:57 +000053
54 for (i = 0; i <= 255; i++) {
55 unsigned char val;
Stefan Reinauer3c0bfaf2010-12-27 11:34:57 +000056 val = pci_read_config8(dev, i);
Stefan Reinauer65b72ab2015-01-05 12:59:54 -080057 if ((i & 0x0f) == 0)
Keith Huif516dd82017-08-25 12:51:14 -040058 printk(BIOS_DEBUG, "%02x:", i);
59 printk(BIOS_DEBUG, " %02x", val);
Stefan Reinauer65b72ab2015-01-05 12:59:54 -080060 if ((i & 0x0f) == 0x0f)
61 printk(BIOS_DEBUG, "\n");
Stefan Reinauer3c0bfaf2010-12-27 11:34:57 +000062 }
63}