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