Thomas Jourdan | 1a692d8 | 2009-07-01 17:01:17 +0000 | [diff] [blame] | 1 | /* |
| 2 | * This file is part of the coreboot project. |
| 3 | * |
| 4 | * Copyright (C) 2007-2008 coresystems GmbH |
| 5 | * Copyright (C) 2009 Thomas Jourdan <thomas.jourdan@gmail.com> |
| 6 | * |
| 7 | * This program is free software; you can redistribute it and/or |
| 8 | * modify it under the terms of the GNU General Public License as |
| 9 | * published by the Free Software Foundation; version 2 of |
| 10 | * the License. |
| 11 | * |
| 12 | * This program is distributed in the hope that it will be useful, |
| 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 15 | * GNU General Public License for more details. |
Thomas Jourdan | 1a692d8 | 2009-07-01 17:01:17 +0000 | [diff] [blame] | 16 | */ |
| 17 | |
Uwe Hermann | d773fd3 | 2010-11-20 20:23:08 +0000 | [diff] [blame] | 18 | #include <spd.h> |
Thomas Jourdan | 1a692d8 | 2009-07-01 17:01:17 +0000 | [diff] [blame] | 19 | |
| 20 | static void print_reg(unsigned char index) |
| 21 | { |
| 22 | unsigned char data; |
| 23 | |
| 24 | outb(index, 0x2e); |
| 25 | data = inb(0x2f); |
Stefan Reinauer | 069f476 | 2015-01-05 13:02:32 -0800 | [diff] [blame] | 26 | printk(BIOS_DEBUG, "0x%02x: 0x%02x\n", index, data); |
Thomas Jourdan | 1a692d8 | 2009-07-01 17:01:17 +0000 | [diff] [blame] | 27 | return; |
| 28 | } |
| 29 | |
Stefan Reinauer | 23836e2 | 2010-04-15 12:39:29 +0000 | [diff] [blame] | 30 | static inline void xbus_en(void) |
Thomas Jourdan | 1a692d8 | 2009-07-01 17:01:17 +0000 | [diff] [blame] | 31 | { |
| 32 | /* select the XBUS function in the SIO */ |
| 33 | outb(0x07, 0x2e); |
| 34 | outb(0x0f, 0x2f); |
| 35 | outb(0x30, 0x2e); |
| 36 | outb(0x01, 0x2f); |
| 37 | return; |
| 38 | } |
| 39 | |
| 40 | static void setup_func(unsigned char func) |
| 41 | { |
| 42 | /* select the function in the SIO */ |
| 43 | outb(0x07, 0x2e); |
| 44 | outb(func, 0x2f); |
| 45 | /* print out the regs */ |
| 46 | print_reg(0x30); |
| 47 | print_reg(0x60); |
| 48 | print_reg(0x61); |
| 49 | print_reg(0x62); |
| 50 | print_reg(0x63); |
| 51 | print_reg(0x70); |
| 52 | print_reg(0x71); |
| 53 | print_reg(0x74); |
| 54 | print_reg(0x75); |
| 55 | return; |
| 56 | } |
| 57 | |
Stefan Reinauer | 23836e2 | 2010-04-15 12:39:29 +0000 | [diff] [blame] | 58 | static inline void siodump(void) |
Thomas Jourdan | 1a692d8 | 2009-07-01 17:01:17 +0000 | [diff] [blame] | 59 | { |
| 60 | int i; |
| 61 | unsigned char data; |
| 62 | |
Stefan Reinauer | 069f476 | 2015-01-05 13:02:32 -0800 | [diff] [blame] | 63 | printk(BIOS_DEBUG, "\n*** SERVER I/O REGISTERS ***\n"); |
Thomas Jourdan | 1a692d8 | 2009-07-01 17:01:17 +0000 | [diff] [blame] | 64 | for (i=0x10; i<=0x2d; i++) { |
| 65 | print_reg((unsigned char)i); |
| 66 | } |
| 67 | #if 0 |
Stefan Reinauer | 069f476 | 2015-01-05 13:02:32 -0800 | [diff] [blame] | 68 | printk(BIOS_DEBUG, "\n*** XBUS REGISTERS ***\n"); |
Thomas Jourdan | 1a692d8 | 2009-07-01 17:01:17 +0000 | [diff] [blame] | 69 | setup_func(0x0f); |
| 70 | for (i=0xf0; i<=0xff; i++) { |
| 71 | print_reg((unsigned char)i); |
| 72 | } |
| 73 | |
Stefan Reinauer | 069f476 | 2015-01-05 13:02:32 -0800 | [diff] [blame] | 74 | printk(BIOS_DEBUG, "\n*** SERIAL 1 CONFIG REGISTERS ***\n"); |
Thomas Jourdan | 1a692d8 | 2009-07-01 17:01:17 +0000 | [diff] [blame] | 75 | setup_func(0x03); |
| 76 | print_reg(0xf0); |
| 77 | |
Stefan Reinauer | 069f476 | 2015-01-05 13:02:32 -0800 | [diff] [blame] | 78 | printk(BIOS_DEBUG, "\n*** SERIAL 2 CONFIG REGISTERS ***\n"); |
Thomas Jourdan | 1a692d8 | 2009-07-01 17:01:17 +0000 | [diff] [blame] | 79 | setup_func(0x02); |
| 80 | print_reg(0xf0); |
| 81 | |
| 82 | #endif |
Stefan Reinauer | 069f476 | 2015-01-05 13:02:32 -0800 | [diff] [blame] | 83 | printk(BIOS_DEBUG, "\n*** GPIO REGISTERS ***\n"); |
Thomas Jourdan | 1a692d8 | 2009-07-01 17:01:17 +0000 | [diff] [blame] | 84 | setup_func(0x07); |
| 85 | for (i=0xf0; i<=0xf8; i++) { |
| 86 | print_reg((unsigned char)i); |
| 87 | } |
Stefan Reinauer | 069f476 | 2015-01-05 13:02:32 -0800 | [diff] [blame] | 88 | printk(BIOS_DEBUG, "\n*** GPIO VALUES ***\n"); |
Thomas Jourdan | 1a692d8 | 2009-07-01 17:01:17 +0000 | [diff] [blame] | 89 | data = inb(0x68a); |
Stefan Reinauer | 069f476 | 2015-01-05 13:02:32 -0800 | [diff] [blame] | 90 | printk(BIOS_DEBUG, "\nGPDO 4: 0x%02x", data); |
Thomas Jourdan | 1a692d8 | 2009-07-01 17:01:17 +0000 | [diff] [blame] | 91 | data = inb(0x68b); |
Stefan Reinauer | 069f476 | 2015-01-05 13:02:32 -0800 | [diff] [blame] | 92 | printk(BIOS_DEBUG, "\nGPDI 4: 0x%02x\n", data); |
Thomas Jourdan | 1a692d8 | 2009-07-01 17:01:17 +0000 | [diff] [blame] | 93 | |
| 94 | #if 0 |
| 95 | |
Stefan Reinauer | 069f476 | 2015-01-05 13:02:32 -0800 | [diff] [blame] | 96 | printk(BIOS_DEBUG, "\n*** WATCHDOG TIMER REGISTERS ***\n"); |
Thomas Jourdan | 1a692d8 | 2009-07-01 17:01:17 +0000 | [diff] [blame] | 97 | setup_func(0x0a); |
| 98 | print_reg(0xf0); |
| 99 | |
Stefan Reinauer | 069f476 | 2015-01-05 13:02:32 -0800 | [diff] [blame] | 100 | printk(BIOS_DEBUG, "\n*** FAN CONTROL REGISTERS ***\n"); |
Thomas Jourdan | 1a692d8 | 2009-07-01 17:01:17 +0000 | [diff] [blame] | 101 | setup_func(0x09); |
| 102 | print_reg(0xf0); |
| 103 | print_reg(0xf1); |
| 104 | |
Stefan Reinauer | 069f476 | 2015-01-05 13:02:32 -0800 | [diff] [blame] | 105 | printk(BIOS_DEBUG, "\n*** RTC REGISTERS ***\n"); |
Thomas Jourdan | 1a692d8 | 2009-07-01 17:01:17 +0000 | [diff] [blame] | 106 | setup_func(0x10); |
| 107 | print_reg(0xf0); |
| 108 | print_reg(0xf1); |
| 109 | print_reg(0xf3); |
| 110 | print_reg(0xf6); |
| 111 | print_reg(0xf7); |
| 112 | print_reg(0xfe); |
| 113 | print_reg(0xff); |
| 114 | |
Stefan Reinauer | 069f476 | 2015-01-05 13:02:32 -0800 | [diff] [blame] | 115 | printk(BIOS_DEBUG, "\n*** HEALTH MONITORING & CONTROL REGISTERS ***\n"); |
Thomas Jourdan | 1a692d8 | 2009-07-01 17:01:17 +0000 | [diff] [blame] | 116 | setup_func(0x14); |
| 117 | print_reg(0xf0); |
| 118 | #endif |
| 119 | return; |
| 120 | } |
| 121 | |
Stefan Reinauer | 23836e2 | 2010-04-15 12:39:29 +0000 | [diff] [blame] | 122 | static inline void dump_bar14(unsigned dev) |
Thomas Jourdan | 1a692d8 | 2009-07-01 17:01:17 +0000 | [diff] [blame] | 123 | { |
| 124 | int i; |
| 125 | unsigned long bar; |
| 126 | |
Stefan Reinauer | 069f476 | 2015-01-05 13:02:32 -0800 | [diff] [blame] | 127 | printk(BIOS_DEBUG, "BAR 14 Dump\n"); |
Thomas Jourdan | 1a692d8 | 2009-07-01 17:01:17 +0000 | [diff] [blame] | 128 | |
| 129 | bar = pci_read_config32(dev, 0x14); |
| 130 | for(i = 0; i <= 0x300; i+=4) { |
| 131 | #if 0 |
| 132 | unsigned char val; |
Stefan Reinauer | 069f476 | 2015-01-05 13:02:32 -0800 | [diff] [blame] | 133 | if ((i & 0x0f) == 0) |
| 134 | printk(BIOS_DEBUG, "%02x:", i); |
Thomas Jourdan | 1a692d8 | 2009-07-01 17:01:17 +0000 | [diff] [blame] | 135 | val = pci_read_config8(dev, i); |
| 136 | #endif |
Stefan Reinauer | 069f476 | 2015-01-05 13:02:32 -0800 | [diff] [blame] | 137 | if((i%4)==0) |
| 138 | printk(BIOS_DEBUG, "\n%04x ", i); |
| 139 | printk(BIOS_DEBUG, "%08x ", read32(bar + i)); |
Thomas Jourdan | 1a692d8 | 2009-07-01 17:01:17 +0000 | [diff] [blame] | 140 | } |
Stefan Reinauer | 069f476 | 2015-01-05 13:02:32 -0800 | [diff] [blame] | 141 | printk(BIOS_DEBUG, "\n"); |
Thomas Jourdan | 1a692d8 | 2009-07-01 17:01:17 +0000 | [diff] [blame] | 142 | } |
| 143 | |
Stefan Reinauer | 23836e2 | 2010-04-15 12:39:29 +0000 | [diff] [blame] | 144 | static inline void dump_spd_registers(void) |
Thomas Jourdan | 1a692d8 | 2009-07-01 17:01:17 +0000 | [diff] [blame] | 145 | { |
| 146 | unsigned device; |
Uwe Hermann | d773fd3 | 2010-11-20 20:23:08 +0000 | [diff] [blame] | 147 | device = DIMM0; |
| 148 | while(device <= DIMM7) { |
Thomas Jourdan | 1a692d8 | 2009-07-01 17:01:17 +0000 | [diff] [blame] | 149 | int status = 0; |
| 150 | int i; |
Stefan Reinauer | 069f476 | 2015-01-05 13:02:32 -0800 | [diff] [blame] | 151 | printk(BIOS_DEBUG, "\ndimm %02x", device); |
Thomas Jourdan | 1a692d8 | 2009-07-01 17:01:17 +0000 | [diff] [blame] | 152 | |
| 153 | for(i = 0; (i < 256) ; i++) { |
Stefan Reinauer | 069f476 | 2015-01-05 13:02:32 -0800 | [diff] [blame] | 154 | if ((i % 16) == 0) |
| 155 | printk(BIOS_DEBUG, "\n%02x: ", i); |
Thomas Jourdan | 1a692d8 | 2009-07-01 17:01:17 +0000 | [diff] [blame] | 156 | status = smbus_read_byte(device, i); |
| 157 | if (status < 0) { |
Stefan Reinauer | 069f476 | 2015-01-05 13:02:32 -0800 | [diff] [blame] | 158 | printk(BIOS_DEBUG, "bad device: %d\n", -status); |
Thomas Jourdan | 1a692d8 | 2009-07-01 17:01:17 +0000 | [diff] [blame] | 159 | break; |
| 160 | } |
Stefan Reinauer | 069f476 | 2015-01-05 13:02:32 -0800 | [diff] [blame] | 161 | printk(BIOS_DEBUG, "%02x ", status); |
Thomas Jourdan | 1a692d8 | 2009-07-01 17:01:17 +0000 | [diff] [blame] | 162 | } |
Uwe Hermann | d773fd3 | 2010-11-20 20:23:08 +0000 | [diff] [blame] | 163 | device++; |
Stefan Reinauer | 069f476 | 2015-01-05 13:02:32 -0800 | [diff] [blame] | 164 | printk(BIOS_DEBUG, "\n"); |
Thomas Jourdan | 1a692d8 | 2009-07-01 17:01:17 +0000 | [diff] [blame] | 165 | } |
| 166 | } |
| 167 | |
Stefan Reinauer | 23836e2 | 2010-04-15 12:39:29 +0000 | [diff] [blame] | 168 | static inline void dump_ipmi_registers(void) |
Thomas Jourdan | 1a692d8 | 2009-07-01 17:01:17 +0000 | [diff] [blame] | 169 | { |
| 170 | unsigned device; |
| 171 | device = 0x42; |
| 172 | while(device <= 0x42) { |
| 173 | int status = 0; |
| 174 | int i; |
Stefan Reinauer | 069f476 | 2015-01-05 13:02:32 -0800 | [diff] [blame] | 175 | printk(BIOS_DEBUG, "\nipmi %02x", device); |
Thomas Jourdan | 1a692d8 | 2009-07-01 17:01:17 +0000 | [diff] [blame] | 176 | |
| 177 | for(i = 0; (i < 8) ; i++) { |
| 178 | status = smbus_read_byte(device, 2); |
| 179 | if (status < 0) { |
Stefan Reinauer | 069f476 | 2015-01-05 13:02:32 -0800 | [diff] [blame] | 180 | printk(BIOS_DEBUG, "bad device: %d\n", -status); |
Thomas Jourdan | 1a692d8 | 2009-07-01 17:01:17 +0000 | [diff] [blame] | 181 | break; |
| 182 | } |
Stefan Reinauer | 069f476 | 2015-01-05 13:02:32 -0800 | [diff] [blame] | 183 | printk(BIOS_DEBUG, "%02x ", status); |
Thomas Jourdan | 1a692d8 | 2009-07-01 17:01:17 +0000 | [diff] [blame] | 184 | } |
Uwe Hermann | d773fd3 | 2010-11-20 20:23:08 +0000 | [diff] [blame] | 185 | device++; |
Stefan Reinauer | 069f476 | 2015-01-05 13:02:32 -0800 | [diff] [blame] | 186 | printk(BIOS_DEBUG, "\n"); |
Thomas Jourdan | 1a692d8 | 2009-07-01 17:01:17 +0000 | [diff] [blame] | 187 | } |
| 188 | } |