Stefan Reinauer | 080038b | 2003-10-07 14:56:48 +0000 | [diff] [blame] | 1 | /* |
| 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 | |
| 6 | static void dump_spd_registers(const struct mem_controller *ctrl) |
| 7 | { |
| 8 | int i; |
Stefan Reinauer | d686522 | 2015-01-05 13:12:38 -0800 | [diff] [blame] | 9 | printk(BIOS_DEBUG, "\n"); |
Lee Leahy | 45fde70 | 2017-03-08 18:02:24 -0800 | [diff] [blame] | 10 | for (i = 0; i < 4; i++) { |
Lee Leahy | 75b8599 | 2017-03-08 16:34:12 -0800 | [diff] [blame] | 11 | unsigned int device; |
Stefan Reinauer | 080038b | 2003-10-07 14:56:48 +0000 | [diff] [blame] | 12 | device = ctrl->channel0[i]; |
| 13 | if (device) { |
| 14 | int j; |
Stefan Reinauer | d686522 | 2015-01-05 13:12:38 -0800 | [diff] [blame] | 15 | printk(BIOS_DEBUG, "dimm: %02x.0: %02x", i, device); |
Lee Leahy | 45fde70 | 2017-03-08 18:02:24 -0800 | [diff] [blame] | 16 | for (j = 0; j < 256; j++) { |
Stefan Reinauer | 080038b | 2003-10-07 14:56:48 +0000 | [diff] [blame] | 17 | int status; |
Lee Leahy | 75b8599 | 2017-03-08 16:34:12 -0800 | [diff] [blame] | 18 | unsigned int char byte; |
Stefan Reinauer | d686522 | 2015-01-05 13:12:38 -0800 | [diff] [blame] | 19 | if ((j & 0xf) == 0) |
| 20 | printk(BIOS_DEBUG, "\n%02x: ", j); |
Stefan Reinauer | 080038b | 2003-10-07 14:56:48 +0000 | [diff] [blame] | 21 | status = spd_read_byte(device, j); |
| 22 | if (status < 0) { |
Stefan Reinauer | d686522 | 2015-01-05 13:12:38 -0800 | [diff] [blame] | 23 | printk(BIOS_DEBUG, "bad device\n"); |
Stefan Reinauer | 080038b | 2003-10-07 14:56:48 +0000 | [diff] [blame] | 24 | break; |
| 25 | } |
| 26 | byte = status & 0xff; |
Stefan Reinauer | d686522 | 2015-01-05 13:12:38 -0800 | [diff] [blame] | 27 | printk(BIOS_DEBUG, "%02x ", byte); |
Stefan Reinauer | 080038b | 2003-10-07 14:56:48 +0000 | [diff] [blame] | 28 | } |
Stefan Reinauer | d686522 | 2015-01-05 13:12:38 -0800 | [diff] [blame] | 29 | printk(BIOS_DEBUG, "\n"); |
Stefan Reinauer | 080038b | 2003-10-07 14:56:48 +0000 | [diff] [blame] | 30 | } |
| 31 | device = ctrl->channel1[i]; |
| 32 | if (device) { |
| 33 | int j; |
Stefan Reinauer | d686522 | 2015-01-05 13:12:38 -0800 | [diff] [blame] | 34 | printk(BIOS_DEBUG, "dimm: %02x.1: %02x", i, device); |
Lee Leahy | 45fde70 | 2017-03-08 18:02:24 -0800 | [diff] [blame] | 35 | for (j = 0; j < 256; j++) { |
Stefan Reinauer | 080038b | 2003-10-07 14:56:48 +0000 | [diff] [blame] | 36 | int status; |
Lee Leahy | 75b8599 | 2017-03-08 16:34:12 -0800 | [diff] [blame] | 37 | unsigned int char byte; |
Stefan Reinauer | d686522 | 2015-01-05 13:12:38 -0800 | [diff] [blame] | 38 | if ((j & 0xf) == 0) |
| 39 | printk(BIOS_DEBUG, "\n%02x: "); |
Stefan Reinauer | 080038b | 2003-10-07 14:56:48 +0000 | [diff] [blame] | 40 | status = spd_read_byte(device, j); |
| 41 | if (status < 0) { |
Stefan Reinauer | d686522 | 2015-01-05 13:12:38 -0800 | [diff] [blame] | 42 | printk(BIOS_DEBUG, "bad device\n"); |
Stefan Reinauer | 080038b | 2003-10-07 14:56:48 +0000 | [diff] [blame] | 43 | break; |
| 44 | } |
| 45 | byte = status & 0xff; |
Stefan Reinauer | d686522 | 2015-01-05 13:12:38 -0800 | [diff] [blame] | 46 | printk(BIOS_DEBUG, "%02x ", byte); |
Stefan Reinauer | 080038b | 2003-10-07 14:56:48 +0000 | [diff] [blame] | 47 | } |
Stefan Reinauer | d686522 | 2015-01-05 13:12:38 -0800 | [diff] [blame] | 48 | printk(BIOS_DEBUG, "\n"); |
Stefan Reinauer | 080038b | 2003-10-07 14:56:48 +0000 | [diff] [blame] | 49 | } |
| 50 | } |
| 51 | } |
| 52 | |
| 53 | #if 0 |
Eric Biederman | 8ca8d76 | 2003-04-22 19:02:15 +0000 | [diff] [blame] | 54 | void dump_spd_registers(void) |
| 55 | { |
Lee Leahy | 75b8599 | 2017-03-08 16:34:12 -0800 | [diff] [blame] | 56 | unsigned int device; |
Eric Biederman | 8ca8d76 | 2003-04-22 19:02:15 +0000 | [diff] [blame] | 57 | device = SMBUS_MEM_DEVICE_START; |
Stefan Reinauer | c02b4fc | 2010-03-22 11:42:32 +0000 | [diff] [blame] | 58 | printk(BIOS_DEBUG, "\n"); |
Lee Leahy | 45fde70 | 2017-03-08 18:02:24 -0800 | [diff] [blame] | 59 | while (device <= SMBUS_MEM_DEVICE_END) { |
Eric Biederman | 8ca8d76 | 2003-04-22 19:02:15 +0000 | [diff] [blame] | 60 | int status = 0; |
| 61 | int i; |
Stefan Reinauer | c02b4fc | 2010-03-22 11:42:32 +0000 | [diff] [blame] | 62 | printk(BIOS_DEBUG, "dimm %02x", device); |
Lee Leahy | 45fde70 | 2017-03-08 18:02:24 -0800 | [diff] [blame] | 63 | for (i = 0; (i < 256) && (status == 0); i++) { |
Lee Leahy | 75b8599 | 2017-03-08 16:34:12 -0800 | [diff] [blame] | 64 | unsigned int char byte; |
Lee Leahy | 2f919ec | 2017-03-08 17:37:06 -0800 | [diff] [blame] | 65 | if ((i % 20) == 0) |
Stefan Reinauer | c02b4fc | 2010-03-22 11:42:32 +0000 | [diff] [blame] | 66 | printk(BIOS_DEBUG, "\n%3d: ", i); |
Eric Biederman | 8ca8d76 | 2003-04-22 19:02:15 +0000 | [diff] [blame] | 67 | status = smbus_read_byte(device, i, &byte); |
| 68 | if (status != 0) { |
Stefan Reinauer | c02b4fc | 2010-03-22 11:42:32 +0000 | [diff] [blame] | 69 | printk(BIOS_DEBUG, "bad device\n"); |
Eric Biederman | 8ca8d76 | 2003-04-22 19:02:15 +0000 | [diff] [blame] | 70 | continue; |
| 71 | } |
Stefan Reinauer | c02b4fc | 2010-03-22 11:42:32 +0000 | [diff] [blame] | 72 | printk(BIOS_DEBUG, "%02x ", byte); |
Eric Biederman | 8ca8d76 | 2003-04-22 19:02:15 +0000 | [diff] [blame] | 73 | } |
| 74 | device += SMBUS_MEM_DEVICE_INC; |
Stefan Reinauer | c02b4fc | 2010-03-22 11:42:32 +0000 | [diff] [blame] | 75 | printk(BIOS_DEBUG, "\n"); |
Eric Biederman | 8ca8d76 | 2003-04-22 19:02:15 +0000 | [diff] [blame] | 76 | } |
| 77 | } |
Stefan Reinauer | 080038b | 2003-10-07 14:56:48 +0000 | [diff] [blame] | 78 | #endif |