blob: ce808cf4211b4709ea92157484319aec8b3bb041 [file] [log] [blame]
Angel Pons4b429832020-04-02 23:48:50 +02001/* SPDX-License-Identifier: GPL-2.0-only */
Martin Roth5474eb12018-05-26 19:22:33 -06002
Stefan Reinauer3c0bfaf2010-12-27 11:34:57 +00003#include <console/console.h>
Kyösti Mälkkif1b58b72019-03-01 13:43:02 +02004#include <device/pci_ops.h>
Kyösti Mälkki1a1b04e2020-01-07 22:34:33 +02005#include <device/smbus_host.h>
Stefan Reinauer3c0bfaf2010-12-27 11:34:57 +00006#include <spd.h>
Uwe Hermann115c5b92010-10-09 17:00:18 +00007#include "raminit.h"
8
9void dump_spd_registers(void)
Richard Smith924f92f2006-07-29 17:40:36 +000010{
11 int i;
Keith Hui09f5a742010-12-23 17:12:03 +000012 printk(BIOS_DEBUG, "\n");
Elyes HAOUAS12df9502016-08-23 21:29:48 +020013 for (i = 0; i < DIMM_SOCKETS; i++) {
Martin Roth468d02c2019-10-23 21:44:42 -060014 unsigned int device;
Uwe Hermannd773fd32010-11-20 20:23:08 +000015 device = DIMM0 + i;
Richard Smith924f92f2006-07-29 17:40:36 +000016 if (device) {
17 int j;
Keith Hui09f5a742010-12-23 17:12:03 +000018 printk(BIOS_DEBUG, "DIMM %d: %02x", i, device);
Elyes HAOUAS12df9502016-08-23 21:29:48 +020019 for (j = 0; j < 256; j++) {
Richard Smith924f92f2006-07-29 17:40:36 +000020 int status;
21 unsigned char byte;
22 if ((j & 0xf) == 0) {
Keith Hui09f5a742010-12-23 17:12:03 +000023 printk(BIOS_DEBUG, "\n%02x: ", j);
Richard Smith924f92f2006-07-29 17:40:36 +000024 }
Keith Hui4444ea542020-01-12 19:09:24 -050025 status = smbus_read_byte(device, j);
Richard Smith924f92f2006-07-29 17:40:36 +000026 if (status < 0) {
Keith Hui09f5a742010-12-23 17:12:03 +000027 printk(BIOS_DEBUG, "bad device\n");
Richard Smith924f92f2006-07-29 17:40:36 +000028 break;
29 }
30 byte = status & 0xff;
Keith Hui09f5a742010-12-23 17:12:03 +000031 printk(BIOS_DEBUG, "%02x ", byte);
Richard Smith924f92f2006-07-29 17:40:36 +000032 }
Keith Hui09f5a742010-12-23 17:12:03 +000033 printk(BIOS_DEBUG, "\n");
Richard Smith924f92f2006-07-29 17:40:36 +000034 }
Richard Smith924f92f2006-07-29 17:40:36 +000035 }
36}
Stefan Reinauer3c0bfaf2010-12-27 11:34:57 +000037
Martin Roth468d02c2019-10-23 21:44:42 -060038void dump_pci_device(unsigned int dev)
Stefan Reinauer3c0bfaf2010-12-27 11:34:57 +000039{
40 int i;
Keith Huib1cb8952023-03-18 08:29:12 -040041 printk(BIOS_DEBUG, "PCI: %02x:%02x.%02x", (dev >> 20) & 0xff, (dev >> 15) & 0x1f,
42 (dev >> 12) & 7);
Stefan Reinauer3c0bfaf2010-12-27 11:34:57 +000043
44 for (i = 0; i <= 255; i++) {
Stefan Reinauer65b72ab2015-01-05 12:59:54 -080045 if ((i & 0x0f) == 0)
Keith Huib1cb8952023-03-18 08:29:12 -040046 printk(BIOS_DEBUG, "\n%02x:", i);
47 printk(BIOS_DEBUG, " %02x", pci_read_config8(dev, i));
Stefan Reinauer3c0bfaf2010-12-27 11:34:57 +000048 }
Keith Huib1cb8952023-03-18 08:29:12 -040049 printk(BIOS_DEBUG, "\n");
Stefan Reinauer3c0bfaf2010-12-27 11:34:57 +000050}