blob: 63e47a2d28147efd5e55750cf178da0affe4d2b2 [file] [log] [blame]
Stefan Reinauer080038b2003-10-07 14:56:48 +00001/*
2 * This code is derived from the Opteron boards' debug.c.
3 * It should go away either there or here, depending what fits better.
4 */
5
6static void dump_spd_registers(const struct mem_controller *ctrl)
7{
8 int i;
Stefan Reinauerd6865222015-01-05 13:12:38 -08009 printk(BIOS_DEBUG, "\n");
Lee Leahy45fde702017-03-08 18:02:24 -080010 for (i = 0; i < 4; i++) {
Lee Leahy75b85992017-03-08 16:34:12 -080011 unsigned int device;
Stefan Reinauer080038b2003-10-07 14:56:48 +000012 device = ctrl->channel0[i];
13 if (device) {
14 int j;
Stefan Reinauerd6865222015-01-05 13:12:38 -080015 printk(BIOS_DEBUG, "dimm: %02x.0: %02x", i, device);
Lee Leahy45fde702017-03-08 18:02:24 -080016 for (j = 0; j < 256; j++) {
Stefan Reinauer080038b2003-10-07 14:56:48 +000017 int status;
Lee Leahy75b85992017-03-08 16:34:12 -080018 unsigned int char byte;
Stefan Reinauerd6865222015-01-05 13:12:38 -080019 if ((j & 0xf) == 0)
20 printk(BIOS_DEBUG, "\n%02x: ", j);
Stefan Reinauer080038b2003-10-07 14:56:48 +000021 status = spd_read_byte(device, j);
22 if (status < 0) {
Stefan Reinauerd6865222015-01-05 13:12:38 -080023 printk(BIOS_DEBUG, "bad device\n");
Stefan Reinauer080038b2003-10-07 14:56:48 +000024 break;
25 }
26 byte = status & 0xff;
Stefan Reinauerd6865222015-01-05 13:12:38 -080027 printk(BIOS_DEBUG, "%02x ", byte);
Stefan Reinauer080038b2003-10-07 14:56:48 +000028 }
Stefan Reinauerd6865222015-01-05 13:12:38 -080029 printk(BIOS_DEBUG, "\n");
Stefan Reinauer080038b2003-10-07 14:56:48 +000030 }
31 device = ctrl->channel1[i];
32 if (device) {
33 int j;
Stefan Reinauerd6865222015-01-05 13:12:38 -080034 printk(BIOS_DEBUG, "dimm: %02x.1: %02x", i, device);
Lee Leahy45fde702017-03-08 18:02:24 -080035 for (j = 0; j < 256; j++) {
Stefan Reinauer080038b2003-10-07 14:56:48 +000036 int status;
Lee Leahy75b85992017-03-08 16:34:12 -080037 unsigned int char byte;
Stefan Reinauerd6865222015-01-05 13:12:38 -080038 if ((j & 0xf) == 0)
39 printk(BIOS_DEBUG, "\n%02x: ");
Stefan Reinauer080038b2003-10-07 14:56:48 +000040 status = spd_read_byte(device, j);
41 if (status < 0) {
Stefan Reinauerd6865222015-01-05 13:12:38 -080042 printk(BIOS_DEBUG, "bad device\n");
Stefan Reinauer080038b2003-10-07 14:56:48 +000043 break;
44 }
45 byte = status & 0xff;
Stefan Reinauerd6865222015-01-05 13:12:38 -080046 printk(BIOS_DEBUG, "%02x ", byte);
Stefan Reinauer080038b2003-10-07 14:56:48 +000047 }
Stefan Reinauerd6865222015-01-05 13:12:38 -080048 printk(BIOS_DEBUG, "\n");
Stefan Reinauer080038b2003-10-07 14:56:48 +000049 }
50 }
51}
52
53#if 0
Eric Biederman8ca8d762003-04-22 19:02:15 +000054void dump_spd_registers(void)
55{
Lee Leahy75b85992017-03-08 16:34:12 -080056 unsigned int device;
Eric Biederman8ca8d762003-04-22 19:02:15 +000057 device = SMBUS_MEM_DEVICE_START;
Stefan Reinauerc02b4fc2010-03-22 11:42:32 +000058 printk(BIOS_DEBUG, "\n");
Lee Leahy45fde702017-03-08 18:02:24 -080059 while (device <= SMBUS_MEM_DEVICE_END) {
Eric Biederman8ca8d762003-04-22 19:02:15 +000060 int status = 0;
61 int i;
Stefan Reinauerc02b4fc2010-03-22 11:42:32 +000062 printk(BIOS_DEBUG, "dimm %02x", device);
Lee Leahy45fde702017-03-08 18:02:24 -080063 for (i = 0; (i < 256) && (status == 0); i++) {
Lee Leahy75b85992017-03-08 16:34:12 -080064 unsigned int char byte;
Lee Leahy2f919ec2017-03-08 17:37:06 -080065 if ((i % 20) == 0)
Stefan Reinauerc02b4fc2010-03-22 11:42:32 +000066 printk(BIOS_DEBUG, "\n%3d: ", i);
Eric Biederman8ca8d762003-04-22 19:02:15 +000067 status = smbus_read_byte(device, i, &byte);
68 if (status != 0) {
Stefan Reinauerc02b4fc2010-03-22 11:42:32 +000069 printk(BIOS_DEBUG, "bad device\n");
Eric Biederman8ca8d762003-04-22 19:02:15 +000070 continue;
71 }
Stefan Reinauerc02b4fc2010-03-22 11:42:32 +000072 printk(BIOS_DEBUG, "%02x ", byte);
Eric Biederman8ca8d762003-04-22 19:02:15 +000073 }
74 device += SMBUS_MEM_DEVICE_INC;
Stefan Reinauerc02b4fc2010-03-22 11:42:32 +000075 printk(BIOS_DEBUG, "\n");
Eric Biederman8ca8d762003-04-22 19:02:15 +000076 }
77}
Stefan Reinauer080038b2003-10-07 14:56:48 +000078#endif