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