blob: cff3ade0f59314021dab4feab822559ebe32c365 [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>
15#include <arch/io.h>
Stefan Reinauer3c0bfaf2010-12-27 11:34:57 +000016#include <spd.h>
Uwe Hermann115c5b92010-10-09 17:00:18 +000017#include "raminit.h"
18
19void dump_spd_registers(void)
Richard Smith924f92f2006-07-29 17:40:36 +000020{
21 int i;
Keith Hui09f5a742010-12-23 17:12:03 +000022 printk(BIOS_DEBUG, "\n");
Elyes HAOUAS12df9502016-08-23 21:29:48 +020023 for (i = 0; i < DIMM_SOCKETS; i++) {
Richard Smith924f92f2006-07-29 17:40:36 +000024 unsigned device;
Uwe Hermannd773fd32010-11-20 20:23:08 +000025 device = DIMM0 + i;
Richard Smith924f92f2006-07-29 17:40:36 +000026 if (device) {
27 int j;
Keith Hui09f5a742010-12-23 17:12:03 +000028 printk(BIOS_DEBUG, "DIMM %d: %02x", i, device);
Elyes HAOUAS12df9502016-08-23 21:29:48 +020029 for (j = 0; j < 256; j++) {
Richard Smith924f92f2006-07-29 17:40:36 +000030 int status;
31 unsigned char byte;
32 if ((j & 0xf) == 0) {
Keith Hui09f5a742010-12-23 17:12:03 +000033 printk(BIOS_DEBUG, "\n%02x: ", j);
Richard Smith924f92f2006-07-29 17:40:36 +000034 }
35 status = spd_read_byte(device, j);
36 if (status < 0) {
Keith Hui09f5a742010-12-23 17:12:03 +000037 printk(BIOS_DEBUG, "bad device\n");
Richard Smith924f92f2006-07-29 17:40:36 +000038 break;
39 }
40 byte = status & 0xff;
Keith Hui09f5a742010-12-23 17:12:03 +000041 printk(BIOS_DEBUG, "%02x ", byte);
Richard Smith924f92f2006-07-29 17:40:36 +000042 }
Keith Hui09f5a742010-12-23 17:12:03 +000043 printk(BIOS_DEBUG, "\n");
Richard Smith924f92f2006-07-29 17:40:36 +000044 }
Richard Smith924f92f2006-07-29 17:40:36 +000045 }
46}
Stefan Reinauer3c0bfaf2010-12-27 11:34:57 +000047
Stefan Reinauer3c0bfaf2010-12-27 11:34:57 +000048void dump_pci_device(unsigned dev)
49{
50 int i;
Stefan Reinauer65b72ab2015-01-05 12:59:54 -080051 printk(BIOS_DEBUG, "PCI: %02x:%02x.%02x\n", (dev >> 20) & 0xff, (dev >> 15) & 0x1f, (dev >> 12) & 7);
Stefan Reinauer3c0bfaf2010-12-27 11:34:57 +000052
53 for (i = 0; i <= 255; i++) {
54 unsigned char val;
Stefan Reinauer3c0bfaf2010-12-27 11:34:57 +000055 val = pci_read_config8(dev, i);
Stefan Reinauer65b72ab2015-01-05 12:59:54 -080056 if ((i & 0x0f) == 0)
Keith Huif516dd82017-08-25 12:51:14 -040057 printk(BIOS_DEBUG, "%02x:", i);
58 printk(BIOS_DEBUG, " %02x", val);
Stefan Reinauer65b72ab2015-01-05 12:59:54 -080059 if ((i & 0x0f) == 0x0f)
60 printk(BIOS_DEBUG, "\n");
Stefan Reinauer3c0bfaf2010-12-27 11:34:57 +000061 }
62}