blob: d61ce1ea3c4d2f3af4deda7d1731d3709ab69953 [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");
Stefan Reinauer080038b2003-10-07 14:56:48 +000010 for(i = 0; i < 4; i++) {
11 unsigned device;
12 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);
Stefan Reinauer080038b2003-10-07 14:56:48 +000016 for(j = 0; j < 256; j++) {
17 int status;
18 unsigned 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);
Stefan Reinauer080038b2003-10-07 14:56:48 +000035 for(j = 0; j < 256; j++) {
36 int status;
37 unsigned 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{
56 unsigned device;
57 device = SMBUS_MEM_DEVICE_START;
Stefan Reinauerc02b4fc2010-03-22 11:42:32 +000058 printk(BIOS_DEBUG, "\n");
Eric Biederman8ca8d762003-04-22 19:02:15 +000059 while(device <= SMBUS_MEM_DEVICE_END) {
60 int status = 0;
61 int i;
Stefan Reinauerc02b4fc2010-03-22 11:42:32 +000062 printk(BIOS_DEBUG, "dimm %02x", device);
Eric Biederman8ca8d762003-04-22 19:02:15 +000063 for(i = 0; (i < 256) && (status == 0); i++) {
64 unsigned char byte;
65 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 }
68 status = smbus_read_byte(device, i, &byte);
69 if (status != 0) {
Stefan Reinauerc02b4fc2010-03-22 11:42:32 +000070 printk(BIOS_DEBUG, "bad device\n");
Eric Biederman8ca8d762003-04-22 19:02:15 +000071 continue;
72 }
Stefan Reinauerc02b4fc2010-03-22 11:42:32 +000073 printk(BIOS_DEBUG, "%02x ", byte);
Eric Biederman8ca8d762003-04-22 19:02:15 +000074 }
75 device += SMBUS_MEM_DEVICE_INC;
Stefan Reinauerc02b4fc2010-03-22 11:42:32 +000076 printk(BIOS_DEBUG, "\n");
Eric Biederman8ca8d762003-04-22 19:02:15 +000077 }
78}
Stefan Reinauer080038b2003-10-07 14:56:48 +000079#endif