Angel Pons | 4b42983 | 2020-04-02 23:48:50 +0200 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0-only */ |
| 2 | /* This file is part of the coreboot project. */ |
Martin Roth | 5474eb1 | 2018-05-26 19:22:33 -0600 | [diff] [blame] | 3 | |
Stefan Reinauer | 3c0bfaf | 2010-12-27 11:34:57 +0000 | [diff] [blame] | 4 | #include <console/console.h> |
Kyösti Mälkki | f1b58b7 | 2019-03-01 13:43:02 +0200 | [diff] [blame] | 5 | #include <device/pci_ops.h> |
Stefan Reinauer | 3c0bfaf | 2010-12-27 11:34:57 +0000 | [diff] [blame] | 6 | #include <spd.h> |
Keith Hui | 4444ea54 | 2020-01-12 19:09:24 -0500 | [diff] [blame] | 7 | #include <southbridge/intel/i82371eb/i82371eb.h> |
Uwe Hermann | 115c5b9 | 2010-10-09 17:00:18 +0000 | [diff] [blame] | 8 | #include "raminit.h" |
| 9 | |
| 10 | void dump_spd_registers(void) |
Richard Smith | 924f92f | 2006-07-29 17:40:36 +0000 | [diff] [blame] | 11 | { |
| 12 | int i; |
Keith Hui | 09f5a74 | 2010-12-23 17:12:03 +0000 | [diff] [blame] | 13 | printk(BIOS_DEBUG, "\n"); |
Elyes HAOUAS | 12df950 | 2016-08-23 21:29:48 +0200 | [diff] [blame] | 14 | for (i = 0; i < DIMM_SOCKETS; i++) { |
Martin Roth | 468d02c | 2019-10-23 21:44:42 -0600 | [diff] [blame] | 15 | unsigned int device; |
Uwe Hermann | d773fd3 | 2010-11-20 20:23:08 +0000 | [diff] [blame] | 16 | device = DIMM0 + i; |
Richard Smith | 924f92f | 2006-07-29 17:40:36 +0000 | [diff] [blame] | 17 | if (device) { |
| 18 | int j; |
Keith Hui | 09f5a74 | 2010-12-23 17:12:03 +0000 | [diff] [blame] | 19 | printk(BIOS_DEBUG, "DIMM %d: %02x", i, device); |
Elyes HAOUAS | 12df950 | 2016-08-23 21:29:48 +0200 | [diff] [blame] | 20 | for (j = 0; j < 256; j++) { |
Richard Smith | 924f92f | 2006-07-29 17:40:36 +0000 | [diff] [blame] | 21 | int status; |
| 22 | unsigned char byte; |
| 23 | if ((j & 0xf) == 0) { |
Keith Hui | 09f5a74 | 2010-12-23 17:12:03 +0000 | [diff] [blame] | 24 | printk(BIOS_DEBUG, "\n%02x: ", j); |
Richard Smith | 924f92f | 2006-07-29 17:40:36 +0000 | [diff] [blame] | 25 | } |
Keith Hui | 4444ea54 | 2020-01-12 19:09:24 -0500 | [diff] [blame] | 26 | status = smbus_read_byte(device, j); |
Richard Smith | 924f92f | 2006-07-29 17:40:36 +0000 | [diff] [blame] | 27 | if (status < 0) { |
Keith Hui | 09f5a74 | 2010-12-23 17:12:03 +0000 | [diff] [blame] | 28 | printk(BIOS_DEBUG, "bad device\n"); |
Richard Smith | 924f92f | 2006-07-29 17:40:36 +0000 | [diff] [blame] | 29 | break; |
| 30 | } |
| 31 | byte = status & 0xff; |
Keith Hui | 09f5a74 | 2010-12-23 17:12:03 +0000 | [diff] [blame] | 32 | printk(BIOS_DEBUG, "%02x ", byte); |
Richard Smith | 924f92f | 2006-07-29 17:40:36 +0000 | [diff] [blame] | 33 | } |
Keith Hui | 09f5a74 | 2010-12-23 17:12:03 +0000 | [diff] [blame] | 34 | printk(BIOS_DEBUG, "\n"); |
Richard Smith | 924f92f | 2006-07-29 17:40:36 +0000 | [diff] [blame] | 35 | } |
Richard Smith | 924f92f | 2006-07-29 17:40:36 +0000 | [diff] [blame] | 36 | } |
| 37 | } |
Stefan Reinauer | 3c0bfaf | 2010-12-27 11:34:57 +0000 | [diff] [blame] | 38 | |
Martin Roth | 468d02c | 2019-10-23 21:44:42 -0600 | [diff] [blame] | 39 | void dump_pci_device(unsigned int dev) |
Stefan Reinauer | 3c0bfaf | 2010-12-27 11:34:57 +0000 | [diff] [blame] | 40 | { |
| 41 | int i; |
Stefan Reinauer | 65b72ab | 2015-01-05 12:59:54 -0800 | [diff] [blame] | 42 | printk(BIOS_DEBUG, "PCI: %02x:%02x.%02x\n", (dev >> 20) & 0xff, (dev >> 15) & 0x1f, (dev >> 12) & 7); |
Stefan Reinauer | 3c0bfaf | 2010-12-27 11:34:57 +0000 | [diff] [blame] | 43 | |
| 44 | for (i = 0; i <= 255; i++) { |
| 45 | unsigned char val; |
Stefan Reinauer | 3c0bfaf | 2010-12-27 11:34:57 +0000 | [diff] [blame] | 46 | val = pci_read_config8(dev, i); |
Stefan Reinauer | 65b72ab | 2015-01-05 12:59:54 -0800 | [diff] [blame] | 47 | if ((i & 0x0f) == 0) |
Keith Hui | f516dd8 | 2017-08-25 12:51:14 -0400 | [diff] [blame] | 48 | printk(BIOS_DEBUG, "%02x:", i); |
| 49 | printk(BIOS_DEBUG, " %02x", val); |
Stefan Reinauer | 65b72ab | 2015-01-05 12:59:54 -0800 | [diff] [blame] | 50 | if ((i & 0x0f) == 0x0f) |
| 51 | printk(BIOS_DEBUG, "\n"); |
Stefan Reinauer | 3c0bfaf | 2010-12-27 11:34:57 +0000 | [diff] [blame] | 52 | } |
| 53 | } |