Alexander Couzens | aa3dd5d | 2015-01-03 02:52:10 +0100 | [diff] [blame] | 1 | |
| 2 | #include <stdio.h> |
| 3 | #include <stdlib.h> |
| 4 | #include "inteltool.h" |
| 5 | |
Arthur Heymans | 7ff4fe1 | 2016-12-28 14:00:57 +0100 | [diff] [blame] | 6 | static const io_register_t ich6_bios_cntl_registers[] = { |
| 7 | { 0x0, 1, "BIOSWE - write enable" }, |
| 8 | { 0x1, 1, "BLE - lock enable" }, |
| 9 | { 0x2, 6, "reserved" }, |
| 10 | }; |
| 11 | |
| 12 | static const io_register_t ich7_bios_cntl_registers[] = { |
| 13 | { 0x0, 1, "BIOSWE - write enable" }, |
| 14 | { 0x1, 1, "BLE - lock enable" }, |
| 15 | { 0x2, 2, "SPI Read configuration" }, |
| 16 | { 0x4, 1, "TopSwapStatus" }, |
| 17 | { 0x5, 3, "reserved" }, |
| 18 | }; |
| 19 | |
Alexander Couzens | aa3dd5d | 2015-01-03 02:52:10 +0100 | [diff] [blame] | 20 | static const io_register_t pch_bios_cntl_registers[] = { |
| 21 | { 0x0, 1, "BIOSWE - write enable" }, |
| 22 | { 0x1, 1, "BLE - lock enable" }, |
| 23 | { 0x2, 2, "SPI Read configuration" }, |
| 24 | { 0x4, 1, "TopSwapStatus" }, |
Elyes HAOUAS | 6dc9d03 | 2020-02-16 16:22:52 +0100 | [diff] [blame] | 25 | { 0x5, 1, "SMM BIOS Write Protect Disable" }, |
Alexander Couzens | aa3dd5d | 2015-01-03 02:52:10 +0100 | [diff] [blame] | 26 | { 0x6, 2, "reserved" }, |
| 27 | }; |
| 28 | |
Arthur Heymans | a5798a9b | 2016-12-28 13:55:23 +0100 | [diff] [blame] | 29 | #define ICH9_SPIBAR 0x3800 |
| 30 | #define ICH78_SPIBAR 0x3020 |
Alexander Couzens | aa3dd5d | 2015-01-03 02:52:10 +0100 | [diff] [blame] | 31 | |
| 32 | static const io_register_t spi_bar_registers[] = { |
Arthur Heymans | a5798a9b | 2016-12-28 13:55:23 +0100 | [diff] [blame] | 33 | { 0x00, 4, "BFPR - BIOS Flash primary region" }, |
| 34 | { 0x04, 2, "HSFSTS - Hardware Sequencing Flash Status" }, |
| 35 | { 0x06, 2, "HSFCTL - Hardware Sequencing Flash Control" }, |
| 36 | { 0x08, 4, "FADDR - Flash Address" }, |
| 37 | { 0x0c, 4, "Reserved" }, |
| 38 | { 0x10, 4, "FDATA0" }, |
Alexander Couzens | aa3dd5d | 2015-01-03 02:52:10 +0100 | [diff] [blame] | 39 | /* 0x10 .. 0x4f are filled with data */ |
Arthur Heymans | a5798a9b | 2016-12-28 13:55:23 +0100 | [diff] [blame] | 40 | { 0x50, 4, "FRACC - Flash Region Access Permissions" }, |
| 41 | { 0x54, 4, "Flash Region 0" }, |
| 42 | { 0x58, 4, "Flash Region 1" }, |
| 43 | { 0x5c, 4, "Flash Region 2" }, |
| 44 | { 0x60, 4, "Flash Region 3" }, |
| 45 | { 0x64, 4, "Flash Region 4" }, |
| 46 | { 0x74, 4, "FPR0 Flash Protected Range 0" }, |
| 47 | { 0x78, 4, "FPR0 Flash Protected Range 1" }, |
| 48 | { 0x7c, 4, "FPR0 Flash Protected Range 2" }, |
| 49 | { 0x80, 4, "FPR0 Flash Protected Range 3" }, |
| 50 | { 0x84, 4, "FPR0 Flash Protected Range 4" }, |
| 51 | { 0x90, 1, "SSFSTS - Software Sequencing Flash Status" }, |
| 52 | { 0x91, 3, "SSFSTS - Software Sequencing Flash Status" }, |
| 53 | { 0x94, 2, "PREOP - Prefix opcode Configuration" }, |
| 54 | { 0x96, 2, "OPTYPE - Opcode Type Configuration" }, |
| 55 | { 0x98, 8, "OPMENU - Opcode Menu Configuration" }, |
| 56 | { 0xa0, 1, "BBAR - BIOS Base Address Configuration" }, |
| 57 | { 0xb0, 4, "FDOC - Flash Descriptor Observability Control" }, |
| 58 | { 0xb8, 4, "Reserved" }, |
| 59 | { 0xc0, 4, "AFC - Additional Flash Control" }, |
| 60 | { 0xc4, 4, "LVSCC - Host Lower Vendor Specific Component Capabilities" }, |
| 61 | { 0xc8, 4, "UVSCC - Host Upper Vendor Specific Component Capabilities" }, |
| 62 | { 0xd0, 4, "FPB - Flash Partition Boundary" }, |
| 63 | }; |
| 64 | |
| 65 | static const io_register_t ich7_spi_bar_registers[] = { |
| 66 | { 0x00, 2, "SPIS - SPI Status" }, |
| 67 | { 0x02, 2, "SPIC - SPI Control" }, |
| 68 | { 0x04, 4, "SPIA - SPI Address" }, |
| 69 | /* |
| 70 | *0x08 .. 0x47 are filled with data |
| 71 | *0x48 .. 0x4f is not mentioned by datasheet |
| 72 | */ |
| 73 | { 0x50, 4, "BBAR - BIOS Base Address Configuration" }, |
| 74 | { 0x54, 2, "PREOP Prefix Opcode Configuration" }, |
| 75 | { 0x56, 2, "OPTYPE Opcode Type Configuration" }, |
| 76 | { 0x58, 8, "OPMENU Opcode Menu Configuration" }, |
| 77 | { 0x60, 4, "PBR0 Protected BIOS Range 0" }, |
| 78 | { 0x64, 4, "PBR1 Protected BIOS Range 1" }, |
| 79 | { 0x68, 4, "PBR2 Protected BIOS Range 2" }, |
Alexander Couzens | aa3dd5d | 2015-01-03 02:52:10 +0100 | [diff] [blame] | 80 | }; |
| 81 | |
Jacob Garber | 6faccd1 | 2019-07-01 11:21:55 -0600 | [diff] [blame] | 82 | static int print_bioscntl(struct pci_dev *sb) |
Alexander Couzens | aa3dd5d | 2015-01-03 02:52:10 +0100 | [diff] [blame] | 83 | { |
| 84 | int i, size = 0; |
| 85 | unsigned char bios_cntl = 0xff; |
| 86 | const io_register_t *bios_cntl_register = NULL; |
| 87 | |
| 88 | printf("\n============= SPI / BIOS CNTL =============\n\n"); |
| 89 | |
| 90 | switch (sb->device_id) { |
Arthur Heymans | 7ff4fe1 | 2016-12-28 14:00:57 +0100 | [diff] [blame] | 91 | case PCI_DEVICE_ID_INTEL_ICH6: |
| 92 | bios_cntl = pci_read_byte(sb, 0xdc); |
| 93 | bios_cntl_register = ich6_bios_cntl_registers; |
| 94 | size = ARRAY_SIZE(ich6_bios_cntl_registers); |
| 95 | break; |
| 96 | case PCI_DEVICE_ID_INTEL_ICH7: |
| 97 | case PCI_DEVICE_ID_INTEL_ICH7M: |
| 98 | case PCI_DEVICE_ID_INTEL_ICH7DH: |
| 99 | case PCI_DEVICE_ID_INTEL_ICH7MDH: |
| 100 | case PCI_DEVICE_ID_INTEL_ICH8: |
| 101 | case PCI_DEVICE_ID_INTEL_ICH8M: |
| 102 | case PCI_DEVICE_ID_INTEL_ICH8ME: |
| 103 | case PCI_DEVICE_ID_INTEL_ICH9DH: |
| 104 | case PCI_DEVICE_ID_INTEL_ICH9DO: |
| 105 | case PCI_DEVICE_ID_INTEL_ICH9R: |
| 106 | case PCI_DEVICE_ID_INTEL_ICH9: |
| 107 | case PCI_DEVICE_ID_INTEL_ICH9M: |
| 108 | case PCI_DEVICE_ID_INTEL_ICH9ME: |
Arthur Heymans | 026f7df | 2017-04-10 22:26:13 +0200 | [diff] [blame] | 109 | case PCI_DEVICE_ID_INTEL_ICH10: |
Angel Pons | 65adc70 | 2021-11-14 15:34:02 +0100 | [diff] [blame] | 110 | case PCI_DEVICE_ID_INTEL_ICH10D: |
Idwer Vollering | 66dcda9 | 2020-07-09 14:16:39 +0200 | [diff] [blame] | 111 | case PCI_DEVICE_ID_INTEL_ICH10DO: |
Arthur Heymans | 7ff4fe1 | 2016-12-28 14:00:57 +0100 | [diff] [blame] | 112 | case PCI_DEVICE_ID_INTEL_ICH10R: |
| 113 | case PCI_DEVICE_ID_INTEL_NM10: |
| 114 | bios_cntl = pci_read_byte(sb, 0xdc); |
| 115 | bios_cntl_register = ich7_bios_cntl_registers; |
| 116 | size = ARRAY_SIZE(ich7_bios_cntl_registers); |
| 117 | break; |
Alexander Couzens | aa3dd5d | 2015-01-03 02:52:10 +0100 | [diff] [blame] | 118 | case PCI_DEVICE_ID_INTEL_3400: |
| 119 | case PCI_DEVICE_ID_INTEL_3420: |
| 120 | case PCI_DEVICE_ID_INTEL_3450: |
| 121 | case PCI_DEVICE_ID_INTEL_3400_DESKTOP: |
| 122 | case PCI_DEVICE_ID_INTEL_B55_A: |
| 123 | case PCI_DEVICE_ID_INTEL_B55_B: |
| 124 | case PCI_DEVICE_ID_INTEL_H55: |
| 125 | case PCI_DEVICE_ID_INTEL_H57: |
| 126 | case PCI_DEVICE_ID_INTEL_P55: |
| 127 | case PCI_DEVICE_ID_INTEL_Q57: |
| 128 | case PCI_DEVICE_ID_INTEL_3400_MOBILE: |
| 129 | case PCI_DEVICE_ID_INTEL_3400_MOBILE_SFF: |
| 130 | case PCI_DEVICE_ID_INTEL_HM55: |
| 131 | case PCI_DEVICE_ID_INTEL_HM57: |
| 132 | case PCI_DEVICE_ID_INTEL_PM55: |
| 133 | case PCI_DEVICE_ID_INTEL_QM57: |
| 134 | case PCI_DEVICE_ID_INTEL_QS57: |
Arthur Heymans | 485c0ad0 | 2018-01-28 20:27:31 +0100 | [diff] [blame] | 135 | case PCI_DEVICE_ID_INTEL_Z68: |
| 136 | case PCI_DEVICE_ID_INTEL_P67: |
| 137 | case PCI_DEVICE_ID_INTEL_UM67: |
| 138 | case PCI_DEVICE_ID_INTEL_HM65: |
| 139 | case PCI_DEVICE_ID_INTEL_H67: |
| 140 | case PCI_DEVICE_ID_INTEL_HM67: |
| 141 | case PCI_DEVICE_ID_INTEL_Q65: |
| 142 | case PCI_DEVICE_ID_INTEL_QS67: |
| 143 | case PCI_DEVICE_ID_INTEL_Q67: |
| 144 | case PCI_DEVICE_ID_INTEL_QM67: |
| 145 | case PCI_DEVICE_ID_INTEL_B65: |
| 146 | case PCI_DEVICE_ID_INTEL_C202: |
| 147 | case PCI_DEVICE_ID_INTEL_C204: |
| 148 | case PCI_DEVICE_ID_INTEL_C206: |
| 149 | case PCI_DEVICE_ID_INTEL_H61: |
| 150 | case PCI_DEVICE_ID_INTEL_Z77: |
| 151 | case PCI_DEVICE_ID_INTEL_Z75: |
| 152 | case PCI_DEVICE_ID_INTEL_Q77: |
| 153 | case PCI_DEVICE_ID_INTEL_Q75: |
| 154 | case PCI_DEVICE_ID_INTEL_B75: |
| 155 | case PCI_DEVICE_ID_INTEL_H77: |
| 156 | case PCI_DEVICE_ID_INTEL_C216: |
| 157 | case PCI_DEVICE_ID_INTEL_QM77: |
| 158 | case PCI_DEVICE_ID_INTEL_QS77: |
| 159 | case PCI_DEVICE_ID_INTEL_HM77: |
| 160 | case PCI_DEVICE_ID_INTEL_UM77: |
| 161 | case PCI_DEVICE_ID_INTEL_HM76: |
| 162 | case PCI_DEVICE_ID_INTEL_HM75: |
| 163 | case PCI_DEVICE_ID_INTEL_HM70: |
| 164 | case PCI_DEVICE_ID_INTEL_NM70: |
qeed | b775a62 | 2018-06-19 19:52:19 -0400 | [diff] [blame] | 165 | case PCI_DEVICE_ID_INTEL_C8_MOBILE: |
| 166 | case PCI_DEVICE_ID_INTEL_C8_DESKTOP: |
| 167 | case PCI_DEVICE_ID_INTEL_Z87: |
| 168 | case PCI_DEVICE_ID_INTEL_Z85: |
| 169 | case PCI_DEVICE_ID_INTEL_HM86: |
| 170 | case PCI_DEVICE_ID_INTEL_H87: |
| 171 | case PCI_DEVICE_ID_INTEL_HM87: |
| 172 | case PCI_DEVICE_ID_INTEL_Q85: |
| 173 | case PCI_DEVICE_ID_INTEL_Q87: |
| 174 | case PCI_DEVICE_ID_INTEL_QM87: |
| 175 | case PCI_DEVICE_ID_INTEL_B85: |
| 176 | case PCI_DEVICE_ID_INTEL_C222: |
| 177 | case PCI_DEVICE_ID_INTEL_C224: |
| 178 | case PCI_DEVICE_ID_INTEL_C226: |
| 179 | case PCI_DEVICE_ID_INTEL_H81: |
Michael Niewöhner | d3dab12 | 2020-03-13 18:58:44 +0100 | [diff] [blame] | 180 | case PCI_DEVICE_ID_INTEL_H110: |
| 181 | case PCI_DEVICE_ID_INTEL_H170: |
| 182 | case PCI_DEVICE_ID_INTEL_Z170: |
| 183 | case PCI_DEVICE_ID_INTEL_Q170: |
| 184 | case PCI_DEVICE_ID_INTEL_Q150: |
| 185 | case PCI_DEVICE_ID_INTEL_B150: |
| 186 | case PCI_DEVICE_ID_INTEL_C236: |
| 187 | case PCI_DEVICE_ID_INTEL_C232: |
| 188 | case PCI_DEVICE_ID_INTEL_QM170: |
| 189 | case PCI_DEVICE_ID_INTEL_HM170: |
| 190 | case PCI_DEVICE_ID_INTEL_CM236: |
| 191 | case PCI_DEVICE_ID_INTEL_HM175: |
| 192 | case PCI_DEVICE_ID_INTEL_QM175: |
| 193 | case PCI_DEVICE_ID_INTEL_CM238: |
Felix Singer | 0a7543d | 2019-02-19 23:49:11 +0100 | [diff] [blame] | 194 | case PCI_DEVICE_ID_INTEL_SUNRISEPOINT_LP_PRE: |
| 195 | case PCI_DEVICE_ID_INTEL_SUNRISEPOINT_LP_U_BASE_SKL: |
| 196 | case PCI_DEVICE_ID_INTEL_SUNRISEPOINT_LP_Y_PREM_SKL: |
| 197 | case PCI_DEVICE_ID_INTEL_SUNRISEPOINT_LP_U_PREM_SKL: |
| 198 | case PCI_DEVICE_ID_INTEL_SUNRISEPOINT_LP_U_BASE_KBL: |
| 199 | case PCI_DEVICE_ID_INTEL_SUNRISEPOINT_LP_U_PREM_KBL: |
| 200 | case PCI_DEVICE_ID_INTEL_SUNRISEPOINT_LP_Y_PREM_KBL: |
Matthew Garrett | 2bf28e5 | 2018-07-23 21:09:47 -0700 | [diff] [blame] | 201 | case PCI_DEVICE_ID_INTEL_SUNRISEPOINT_LP_U_IHDCP_BASE: |
| 202 | case PCI_DEVICE_ID_INTEL_SUNRISEPOINT_LP_U_IHDCP_PREM: |
| 203 | case PCI_DEVICE_ID_INTEL_SUNRISEPOINT_LP_Y_IHDCP_PREM: |
Alexander Couzens | aa3dd5d | 2015-01-03 02:52:10 +0100 | [diff] [blame] | 204 | bios_cntl = pci_read_byte(sb, 0xdc); |
| 205 | bios_cntl_register = pch_bios_cntl_registers; |
| 206 | size = ARRAY_SIZE(pch_bios_cntl_registers); |
| 207 | break; |
| 208 | default: |
| 209 | printf("Error: Dumping SPI on this southbridge is not (yet) supported.\n"); |
| 210 | return 1; |
| 211 | } |
| 212 | |
| 213 | printf("BIOS_CNTL = 0x%04x (IO)\n\n", bios_cntl); |
| 214 | |
| 215 | if (bios_cntl_register) { |
| 216 | for (i = 0; i < size; i++) { |
| 217 | unsigned int val = bios_cntl >> bios_cntl_register[i].addr; |
| 218 | val &= ((1 << bios_cntl_register[i].size) -1); |
| 219 | printf("0x%04x = %s\n", val, bios_cntl_register[i].name); |
| 220 | } |
| 221 | } |
| 222 | |
| 223 | return 0; |
| 224 | } |
| 225 | |
Jacob Garber | 6faccd1 | 2019-07-01 11:21:55 -0600 | [diff] [blame] | 226 | static int print_spibar(struct pci_dev *sb) { |
Alexander Couzens | aa3dd5d | 2015-01-03 02:52:10 +0100 | [diff] [blame] | 227 | int i, size = 0, rcba_size = 0x4000; |
| 228 | volatile uint8_t *rcba; |
| 229 | uint32_t rcba_phys; |
| 230 | const io_register_t *spi_register = NULL; |
Arthur Heymans | a5798a9b | 2016-12-28 13:55:23 +0100 | [diff] [blame] | 231 | uint32_t spibaroffset; |
Alexander Couzens | aa3dd5d | 2015-01-03 02:52:10 +0100 | [diff] [blame] | 232 | |
| 233 | printf("\n============= SPI Bar ==============\n\n"); |
| 234 | |
| 235 | switch (sb->device_id) { |
| 236 | case PCI_DEVICE_ID_INTEL_ICH6: |
Arthur Heymans | a5798a9b | 2016-12-28 13:55:23 +0100 | [diff] [blame] | 237 | printf("This southbridge does not have a SPI controller.\n"); |
| 238 | return 1; |
Alexander Couzens | aa3dd5d | 2015-01-03 02:52:10 +0100 | [diff] [blame] | 239 | case PCI_DEVICE_ID_INTEL_ICH7: |
| 240 | case PCI_DEVICE_ID_INTEL_ICH7M: |
| 241 | case PCI_DEVICE_ID_INTEL_ICH7DH: |
| 242 | case PCI_DEVICE_ID_INTEL_ICH7MDH: |
Arthur Heymans | a5798a9b | 2016-12-28 13:55:23 +0100 | [diff] [blame] | 243 | spibaroffset = ICH78_SPIBAR; |
| 244 | rcba_phys = pci_read_long(sb, 0xf0) & 0xfffffffe; |
| 245 | size = ARRAY_SIZE(ich7_spi_bar_registers); |
| 246 | spi_register = ich7_spi_bar_registers; |
| 247 | break; |
Alexander Couzens | aa3dd5d | 2015-01-03 02:52:10 +0100 | [diff] [blame] | 248 | case PCI_DEVICE_ID_INTEL_ICH8: |
Arthur Heymans | a5798a9b | 2016-12-28 13:55:23 +0100 | [diff] [blame] | 249 | spibaroffset = ICH78_SPIBAR; |
| 250 | rcba_phys = pci_read_long(sb, 0xf0) & 0xfffffffe; |
| 251 | size = ARRAY_SIZE(spi_bar_registers); |
| 252 | spi_register = spi_bar_registers; |
| 253 | break; |
Alexander Couzens | aa3dd5d | 2015-01-03 02:52:10 +0100 | [diff] [blame] | 254 | case PCI_DEVICE_ID_INTEL_ICH8M: |
Lubomir Rintel | 2a13bad | 2015-03-01 10:14:15 +0100 | [diff] [blame] | 255 | case PCI_DEVICE_ID_INTEL_ICH8ME: |
Alexander Couzens | aa3dd5d | 2015-01-03 02:52:10 +0100 | [diff] [blame] | 256 | case PCI_DEVICE_ID_INTEL_ICH9DH: |
| 257 | case PCI_DEVICE_ID_INTEL_ICH9DO: |
| 258 | case PCI_DEVICE_ID_INTEL_ICH9R: |
| 259 | case PCI_DEVICE_ID_INTEL_ICH9: |
| 260 | case PCI_DEVICE_ID_INTEL_ICH9M: |
| 261 | case PCI_DEVICE_ID_INTEL_ICH9ME: |
Arthur Heymans | 026f7df | 2017-04-10 22:26:13 +0200 | [diff] [blame] | 262 | case PCI_DEVICE_ID_INTEL_ICH10: |
Angel Pons | 65adc70 | 2021-11-14 15:34:02 +0100 | [diff] [blame] | 263 | case PCI_DEVICE_ID_INTEL_ICH10D: |
Idwer Vollering | 66dcda9 | 2020-07-09 14:16:39 +0200 | [diff] [blame] | 264 | case PCI_DEVICE_ID_INTEL_ICH10DO: |
Alexander Couzens | aa3dd5d | 2015-01-03 02:52:10 +0100 | [diff] [blame] | 265 | case PCI_DEVICE_ID_INTEL_ICH10R: |
| 266 | case PCI_DEVICE_ID_INTEL_NM10: |
| 267 | case PCI_DEVICE_ID_INTEL_I63XX: |
| 268 | case PCI_DEVICE_ID_INTEL_3400: |
| 269 | case PCI_DEVICE_ID_INTEL_3420: |
| 270 | case PCI_DEVICE_ID_INTEL_3450: |
| 271 | case PCI_DEVICE_ID_INTEL_3400_DESKTOP: |
| 272 | case PCI_DEVICE_ID_INTEL_3400_MOBILE: |
| 273 | case PCI_DEVICE_ID_INTEL_3400_MOBILE_SFF: |
| 274 | case PCI_DEVICE_ID_INTEL_B55_A: |
| 275 | case PCI_DEVICE_ID_INTEL_B55_B: |
| 276 | case PCI_DEVICE_ID_INTEL_H55: |
| 277 | case PCI_DEVICE_ID_INTEL_H57: |
| 278 | case PCI_DEVICE_ID_INTEL_HM55: |
| 279 | case PCI_DEVICE_ID_INTEL_HM57: |
| 280 | case PCI_DEVICE_ID_INTEL_P55: |
| 281 | case PCI_DEVICE_ID_INTEL_PM55: |
| 282 | case PCI_DEVICE_ID_INTEL_Q57: |
| 283 | case PCI_DEVICE_ID_INTEL_QM57: |
| 284 | case PCI_DEVICE_ID_INTEL_QS57: |
| 285 | case PCI_DEVICE_ID_INTEL_Z68: |
| 286 | case PCI_DEVICE_ID_INTEL_P67: |
| 287 | case PCI_DEVICE_ID_INTEL_UM67: |
| 288 | case PCI_DEVICE_ID_INTEL_HM65: |
| 289 | case PCI_DEVICE_ID_INTEL_H67: |
| 290 | case PCI_DEVICE_ID_INTEL_HM67: |
| 291 | case PCI_DEVICE_ID_INTEL_Q65: |
| 292 | case PCI_DEVICE_ID_INTEL_QS67: |
| 293 | case PCI_DEVICE_ID_INTEL_Q67: |
| 294 | case PCI_DEVICE_ID_INTEL_QM67: |
| 295 | case PCI_DEVICE_ID_INTEL_B65: |
| 296 | case PCI_DEVICE_ID_INTEL_C202: |
| 297 | case PCI_DEVICE_ID_INTEL_C204: |
| 298 | case PCI_DEVICE_ID_INTEL_C206: |
| 299 | case PCI_DEVICE_ID_INTEL_H61: |
| 300 | case PCI_DEVICE_ID_INTEL_Z77: |
| 301 | case PCI_DEVICE_ID_INTEL_Z75: |
| 302 | case PCI_DEVICE_ID_INTEL_Q77: |
| 303 | case PCI_DEVICE_ID_INTEL_Q75: |
| 304 | case PCI_DEVICE_ID_INTEL_B75: |
| 305 | case PCI_DEVICE_ID_INTEL_H77: |
| 306 | case PCI_DEVICE_ID_INTEL_C216: |
| 307 | case PCI_DEVICE_ID_INTEL_QM77: |
| 308 | case PCI_DEVICE_ID_INTEL_QS77: |
| 309 | case PCI_DEVICE_ID_INTEL_HM77: |
| 310 | case PCI_DEVICE_ID_INTEL_UM77: |
| 311 | case PCI_DEVICE_ID_INTEL_HM76: |
| 312 | case PCI_DEVICE_ID_INTEL_HM75: |
| 313 | case PCI_DEVICE_ID_INTEL_HM70: |
| 314 | case PCI_DEVICE_ID_INTEL_LYNXPOINT_LP_FULL: |
| 315 | case PCI_DEVICE_ID_INTEL_LYNXPOINT_LP_PREM: |
| 316 | case PCI_DEVICE_ID_INTEL_LYNXPOINT_LP_BASE: |
Youness Alaoui | 1244a51 | 2017-04-13 13:22:33 -0400 | [diff] [blame] | 317 | case PCI_DEVICE_ID_INTEL_WILDCATPOINT_LP_PREM: |
Matt DeVillier | 5b667df | 2015-05-14 21:58:33 -0500 | [diff] [blame] | 318 | case PCI_DEVICE_ID_INTEL_WILDCATPOINT_LP: |
qeed | b775a62 | 2018-06-19 19:52:19 -0400 | [diff] [blame] | 319 | case PCI_DEVICE_ID_INTEL_C8_MOBILE: |
| 320 | case PCI_DEVICE_ID_INTEL_C8_DESKTOP: |
| 321 | case PCI_DEVICE_ID_INTEL_Z87: |
| 322 | case PCI_DEVICE_ID_INTEL_Z85: |
| 323 | case PCI_DEVICE_ID_INTEL_HM86: |
| 324 | case PCI_DEVICE_ID_INTEL_H87: |
| 325 | case PCI_DEVICE_ID_INTEL_HM87: |
| 326 | case PCI_DEVICE_ID_INTEL_Q85: |
| 327 | case PCI_DEVICE_ID_INTEL_Q87: |
| 328 | case PCI_DEVICE_ID_INTEL_QM87: |
| 329 | case PCI_DEVICE_ID_INTEL_B85: |
| 330 | case PCI_DEVICE_ID_INTEL_C222: |
| 331 | case PCI_DEVICE_ID_INTEL_C224: |
| 332 | case PCI_DEVICE_ID_INTEL_C226: |
| 333 | case PCI_DEVICE_ID_INTEL_H81: |
Felix Singer | 0a7543d | 2019-02-19 23:49:11 +0100 | [diff] [blame] | 334 | case PCI_DEVICE_ID_INTEL_SUNRISEPOINT_LP_PRE: |
| 335 | case PCI_DEVICE_ID_INTEL_SUNRISEPOINT_LP_U_BASE_SKL: |
| 336 | case PCI_DEVICE_ID_INTEL_SUNRISEPOINT_LP_Y_PREM_SKL: |
| 337 | case PCI_DEVICE_ID_INTEL_SUNRISEPOINT_LP_U_PREM_SKL: |
| 338 | case PCI_DEVICE_ID_INTEL_SUNRISEPOINT_LP_U_BASE_KBL: |
| 339 | case PCI_DEVICE_ID_INTEL_SUNRISEPOINT_LP_U_PREM_KBL: |
| 340 | case PCI_DEVICE_ID_INTEL_SUNRISEPOINT_LP_Y_PREM_KBL: |
Matthew Garrett | 2bf28e5 | 2018-07-23 21:09:47 -0700 | [diff] [blame] | 341 | case PCI_DEVICE_ID_INTEL_SUNRISEPOINT_LP_U_IHDCP_BASE: |
| 342 | case PCI_DEVICE_ID_INTEL_SUNRISEPOINT_LP_U_IHDCP_PREM: |
| 343 | case PCI_DEVICE_ID_INTEL_SUNRISEPOINT_LP_Y_IHDCP_PREM: |
Arthur Heymans | a5798a9b | 2016-12-28 13:55:23 +0100 | [diff] [blame] | 344 | spibaroffset = ICH9_SPIBAR; |
Alexander Couzens | aa3dd5d | 2015-01-03 02:52:10 +0100 | [diff] [blame] | 345 | rcba_phys = pci_read_long(sb, 0xf0) & 0xfffffffe; |
| 346 | size = ARRAY_SIZE(spi_bar_registers); |
| 347 | spi_register = spi_bar_registers; |
| 348 | break; |
| 349 | case PCI_DEVICE_ID_INTEL_ICH: |
| 350 | case PCI_DEVICE_ID_INTEL_ICH0: |
| 351 | case PCI_DEVICE_ID_INTEL_ICH2: |
| 352 | case PCI_DEVICE_ID_INTEL_ICH4: |
| 353 | case PCI_DEVICE_ID_INTEL_ICH4M: |
| 354 | case PCI_DEVICE_ID_INTEL_ICH5: |
| 355 | printf("This southbridge does not have RCBA.\n"); |
| 356 | return 1; |
| 357 | default: |
| 358 | printf("Error: Dumping RCBA on this southbridge is not (yet) supported.\n"); |
| 359 | return 1; |
| 360 | } |
| 361 | |
| 362 | rcba = map_physical(rcba_phys, rcba_size); |
| 363 | if (rcba == NULL) { |
| 364 | perror("Error mapping RCBA"); |
| 365 | exit(1); |
| 366 | } |
| 367 | |
| 368 | for (i = 0; i < size; i++) { |
| 369 | switch(spi_register[i].size) { |
| 370 | case 1: |
Michael Niewöhner | 10d5221 | 2020-03-13 19:08:21 +0100 | [diff] [blame] | 371 | printf("0x%08x = %s\n", read8(rcba + spibaroffset + spi_register[i].addr), spi_register[i].name); |
Alexander Couzens | aa3dd5d | 2015-01-03 02:52:10 +0100 | [diff] [blame] | 372 | break; |
| 373 | case 2: |
Michael Niewöhner | 10d5221 | 2020-03-13 19:08:21 +0100 | [diff] [blame] | 374 | printf("0x%08x = %s\n", read16(rcba + spibaroffset + spi_register[i].addr), spi_register[i].name); |
Alexander Couzens | aa3dd5d | 2015-01-03 02:52:10 +0100 | [diff] [blame] | 375 | break; |
| 376 | case 4: |
Michael Niewöhner | 10d5221 | 2020-03-13 19:08:21 +0100 | [diff] [blame] | 377 | printf("0x%08x = %s\n", read32(rcba + spibaroffset + spi_register[i].addr), spi_register[i].name); |
Alexander Couzens | aa3dd5d | 2015-01-03 02:52:10 +0100 | [diff] [blame] | 378 | break; |
| 379 | case 8: |
Michael Niewöhner | 10d5221 | 2020-03-13 19:08:21 +0100 | [diff] [blame] | 380 | printf("0x%08x%08x = %s\n", read32(rcba + spibaroffset + spi_register[i].addr + 4), |
| 381 | read32(rcba + spibaroffset + spi_register[i].addr), spi_register[i].name); |
Alexander Couzens | aa3dd5d | 2015-01-03 02:52:10 +0100 | [diff] [blame] | 382 | break; |
| 383 | } |
| 384 | } |
| 385 | |
| 386 | unmap_physical((void *)rcba, rcba_size); |
| 387 | return 0; |
| 388 | } |
| 389 | |
| 390 | int print_spi(struct pci_dev *sb) { |
| 391 | return (print_bioscntl(sb) || print_spibar(sb)); |
| 392 | } |