Patrick Georgi | ea063cb | 2020-05-08 19:28:13 +0200 | [diff] [blame] | 1 | /* inteltool - dump all registers on an Intel CPU + chipset based system */ |
Patrick Georgi | 7333a11 | 2020-05-08 20:48:04 +0200 | [diff] [blame] | 2 | /* SPDX-License-Identifier: GPL-2.0-only */ |
Stefan Reinauer | 2319027 | 2008-08-20 13:41:24 +0000 | [diff] [blame] | 3 | |
Stefan Reinauer | 2319027 | 2008-08-20 13:41:24 +0000 | [diff] [blame] | 4 | #include <stdio.h> |
Stefan Reinauer | 2319027 | 2008-08-20 13:41:24 +0000 | [diff] [blame] | 5 | #include <stdlib.h> |
Stefan Reinauer | 2319027 | 2008-08-20 13:41:24 +0000 | [diff] [blame] | 6 | #include "inteltool.h" |
| 7 | |
| 8 | int print_rcba(struct pci_dev *sb) |
| 9 | { |
| 10 | int i, size = 0x4000; |
| 11 | volatile uint8_t *rcba; |
| 12 | uint32_t rcba_phys; |
| 13 | |
| 14 | printf("\n============= RCBA ==============\n\n"); |
| 15 | |
| 16 | switch (sb->device_id) { |
Pat Erley | ca3548e | 2010-04-21 06:23:19 +0000 | [diff] [blame] | 17 | case PCI_DEVICE_ID_INTEL_ICH6: |
Stefan Reinauer | 2319027 | 2008-08-20 13:41:24 +0000 | [diff] [blame] | 18 | case PCI_DEVICE_ID_INTEL_ICH7: |
| 19 | case PCI_DEVICE_ID_INTEL_ICH7M: |
| 20 | case PCI_DEVICE_ID_INTEL_ICH7DH: |
| 21 | case PCI_DEVICE_ID_INTEL_ICH7MDH: |
Warren Turkal | f3d3ced | 2010-09-03 09:33:50 +0000 | [diff] [blame] | 22 | case PCI_DEVICE_ID_INTEL_ICH8: |
| 23 | case PCI_DEVICE_ID_INTEL_ICH8M: |
Lubomir Rintel | 2a13bad | 2015-03-01 10:14:15 +0100 | [diff] [blame] | 24 | case PCI_DEVICE_ID_INTEL_ICH8ME: |
Anton Kochkov | da0b456 | 2010-05-30 12:33:12 +0000 | [diff] [blame] | 25 | case PCI_DEVICE_ID_INTEL_ICH9DH: |
| 26 | case PCI_DEVICE_ID_INTEL_ICH9DO: |
| 27 | case PCI_DEVICE_ID_INTEL_ICH9R: |
| 28 | case PCI_DEVICE_ID_INTEL_ICH9: |
| 29 | case PCI_DEVICE_ID_INTEL_ICH9M: |
| 30 | case PCI_DEVICE_ID_INTEL_ICH9ME: |
Arthur Heymans | 026f7df | 2017-04-10 22:26:13 +0200 | [diff] [blame] | 31 | case PCI_DEVICE_ID_INTEL_ICH10: |
Angel Pons | 65adc70 | 2021-11-14 15:34:02 +0100 | [diff] [blame] | 32 | case PCI_DEVICE_ID_INTEL_ICH10D: |
Idwer Vollering | 66dcda9 | 2020-07-09 14:16:39 +0200 | [diff] [blame] | 33 | case PCI_DEVICE_ID_INTEL_ICH10DO: |
Warren Turkal | f3d3ced | 2010-09-03 09:33:50 +0000 | [diff] [blame] | 34 | case PCI_DEVICE_ID_INTEL_ICH10R: |
Corey Osgood | f366ce0 | 2010-08-17 08:33:44 +0000 | [diff] [blame] | 35 | case PCI_DEVICE_ID_INTEL_NM10: |
Sven Schnelle | 54a5aed | 2011-10-30 13:30:36 +0100 | [diff] [blame] | 36 | case PCI_DEVICE_ID_INTEL_I63XX: |
Stefan Tauner | 088f569 | 2013-05-28 11:30:25 +0200 | [diff] [blame] | 37 | case PCI_DEVICE_ID_INTEL_3400: |
| 38 | case PCI_DEVICE_ID_INTEL_3420: |
| 39 | case PCI_DEVICE_ID_INTEL_3450: |
Stefan Tauner | b75a39a | 2014-11-01 17:12:37 +0100 | [diff] [blame] | 40 | case PCI_DEVICE_ID_INTEL_3400_DESKTOP: |
| 41 | case PCI_DEVICE_ID_INTEL_3400_MOBILE: |
| 42 | case PCI_DEVICE_ID_INTEL_3400_MOBILE_SFF: |
| 43 | case PCI_DEVICE_ID_INTEL_B55_A: |
Stefan Tauner | 088f569 | 2013-05-28 11:30:25 +0200 | [diff] [blame] | 44 | case PCI_DEVICE_ID_INTEL_B55_B: |
Stefan Tauner | b75a39a | 2014-11-01 17:12:37 +0100 | [diff] [blame] | 45 | case PCI_DEVICE_ID_INTEL_H55: |
| 46 | case PCI_DEVICE_ID_INTEL_H57: |
| 47 | case PCI_DEVICE_ID_INTEL_HM55: |
| 48 | case PCI_DEVICE_ID_INTEL_HM57: |
| 49 | case PCI_DEVICE_ID_INTEL_P55: |
| 50 | case PCI_DEVICE_ID_INTEL_PM55: |
| 51 | case PCI_DEVICE_ID_INTEL_Q57: |
| 52 | case PCI_DEVICE_ID_INTEL_QM57: |
| 53 | case PCI_DEVICE_ID_INTEL_QS57: |
Nico Huber | 14290b3 | 2013-03-29 19:08:39 +0100 | [diff] [blame] | 54 | case PCI_DEVICE_ID_INTEL_Z68: |
| 55 | case PCI_DEVICE_ID_INTEL_P67: |
| 56 | case PCI_DEVICE_ID_INTEL_UM67: |
| 57 | case PCI_DEVICE_ID_INTEL_HM65: |
| 58 | case PCI_DEVICE_ID_INTEL_H67: |
| 59 | case PCI_DEVICE_ID_INTEL_HM67: |
| 60 | case PCI_DEVICE_ID_INTEL_Q65: |
| 61 | case PCI_DEVICE_ID_INTEL_QS67: |
| 62 | case PCI_DEVICE_ID_INTEL_Q67: |
| 63 | case PCI_DEVICE_ID_INTEL_QM67: |
| 64 | case PCI_DEVICE_ID_INTEL_B65: |
| 65 | case PCI_DEVICE_ID_INTEL_C202: |
| 66 | case PCI_DEVICE_ID_INTEL_C204: |
| 67 | case PCI_DEVICE_ID_INTEL_C206: |
| 68 | case PCI_DEVICE_ID_INTEL_H61: |
| 69 | case PCI_DEVICE_ID_INTEL_Z77: |
| 70 | case PCI_DEVICE_ID_INTEL_Z75: |
| 71 | case PCI_DEVICE_ID_INTEL_Q77: |
| 72 | case PCI_DEVICE_ID_INTEL_Q75: |
| 73 | case PCI_DEVICE_ID_INTEL_B75: |
| 74 | case PCI_DEVICE_ID_INTEL_H77: |
| 75 | case PCI_DEVICE_ID_INTEL_C216: |
| 76 | case PCI_DEVICE_ID_INTEL_QM77: |
| 77 | case PCI_DEVICE_ID_INTEL_QS77: |
| 78 | case PCI_DEVICE_ID_INTEL_HM77: |
| 79 | case PCI_DEVICE_ID_INTEL_UM77: |
| 80 | case PCI_DEVICE_ID_INTEL_HM76: |
| 81 | case PCI_DEVICE_ID_INTEL_HM75: |
| 82 | case PCI_DEVICE_ID_INTEL_HM70: |
Alexandru Gagniuc | f14bd79 | 2015-02-17 17:14:31 -0600 | [diff] [blame] | 83 | case PCI_DEVICE_ID_INTEL_NM70: |
Dennis Wassenberg | ae6685f | 2014-10-30 10:30:40 +0100 | [diff] [blame] | 84 | case PCI_DEVICE_ID_INTEL_LYNXPOINT_LP_FULL: |
| 85 | case PCI_DEVICE_ID_INTEL_LYNXPOINT_LP_PREM: |
| 86 | case PCI_DEVICE_ID_INTEL_LYNXPOINT_LP_BASE: |
Youness Alaoui | 1244a51 | 2017-04-13 13:22:33 -0400 | [diff] [blame] | 87 | case PCI_DEVICE_ID_INTEL_WILDCATPOINT_LP_PREM: |
Matt DeVillier | 5b667df | 2015-05-14 21:58:33 -0500 | [diff] [blame] | 88 | case PCI_DEVICE_ID_INTEL_WILDCATPOINT_LP: |
qeed | b775a62 | 2018-06-19 19:52:19 -0400 | [diff] [blame] | 89 | case PCI_DEVICE_ID_INTEL_C8_MOBILE: |
| 90 | case PCI_DEVICE_ID_INTEL_C8_DESKTOP: |
| 91 | case PCI_DEVICE_ID_INTEL_Z87: |
| 92 | case PCI_DEVICE_ID_INTEL_Z85: |
| 93 | case PCI_DEVICE_ID_INTEL_HM86: |
| 94 | case PCI_DEVICE_ID_INTEL_H87: |
| 95 | case PCI_DEVICE_ID_INTEL_HM87: |
| 96 | case PCI_DEVICE_ID_INTEL_Q85: |
| 97 | case PCI_DEVICE_ID_INTEL_Q87: |
| 98 | case PCI_DEVICE_ID_INTEL_QM87: |
| 99 | case PCI_DEVICE_ID_INTEL_B85: |
| 100 | case PCI_DEVICE_ID_INTEL_C222: |
| 101 | case PCI_DEVICE_ID_INTEL_C224: |
| 102 | case PCI_DEVICE_ID_INTEL_C226: |
| 103 | case PCI_DEVICE_ID_INTEL_H81: |
Felix Singer | 0a7543d | 2019-02-19 23:49:11 +0100 | [diff] [blame] | 104 | case PCI_DEVICE_ID_INTEL_SUNRISEPOINT_LP_PRE: |
| 105 | case PCI_DEVICE_ID_INTEL_SUNRISEPOINT_LP_U_BASE_SKL: |
| 106 | case PCI_DEVICE_ID_INTEL_SUNRISEPOINT_LP_Y_PREM_SKL: |
| 107 | case PCI_DEVICE_ID_INTEL_SUNRISEPOINT_LP_U_PREM_SKL: |
| 108 | case PCI_DEVICE_ID_INTEL_SUNRISEPOINT_LP_U_BASE_KBL: |
| 109 | case PCI_DEVICE_ID_INTEL_SUNRISEPOINT_LP_U_PREM_KBL: |
| 110 | case PCI_DEVICE_ID_INTEL_SUNRISEPOINT_LP_Y_PREM_KBL: |
Matthew Garrett | 2bf28e5 | 2018-07-23 21:09:47 -0700 | [diff] [blame] | 111 | case PCI_DEVICE_ID_INTEL_SUNRISEPOINT_LP_U_IHDCP_BASE: |
| 112 | case PCI_DEVICE_ID_INTEL_SUNRISEPOINT_LP_U_IHDCP_PREM: |
| 113 | case PCI_DEVICE_ID_INTEL_SUNRISEPOINT_LP_Y_IHDCP_PREM: |
Stefan Reinauer | 2319027 | 2008-08-20 13:41:24 +0000 | [diff] [blame] | 114 | rcba_phys = pci_read_long(sb, 0xf0) & 0xfffffffe; |
| 115 | break; |
| 116 | case PCI_DEVICE_ID_INTEL_ICH: |
| 117 | case PCI_DEVICE_ID_INTEL_ICH0: |
Joseph Smith | e10757e | 2010-06-16 22:21:19 +0000 | [diff] [blame] | 118 | case PCI_DEVICE_ID_INTEL_ICH2: |
Stefan Reinauer | 2319027 | 2008-08-20 13:41:24 +0000 | [diff] [blame] | 119 | case PCI_DEVICE_ID_INTEL_ICH4: |
| 120 | case PCI_DEVICE_ID_INTEL_ICH4M: |
Idwer Vollering | 312fc96 | 2010-12-17 22:34:58 +0000 | [diff] [blame] | 121 | case PCI_DEVICE_ID_INTEL_ICH5: |
Stefan Reinauer | 2319027 | 2008-08-20 13:41:24 +0000 | [diff] [blame] | 122 | printf("This southbridge does not have RCBA.\n"); |
| 123 | return 1; |
| 124 | default: |
| 125 | printf("Error: Dumping RCBA on this southbridge is not (yet) supported.\n"); |
| 126 | return 1; |
| 127 | } |
| 128 | |
Stefan Reinauer | 1162f25 | 2008-12-04 15:18:20 +0000 | [diff] [blame] | 129 | rcba = map_physical(rcba_phys, size); |
Stefan Reinauer | 14e2277 | 2010-04-27 06:56:47 +0000 | [diff] [blame] | 130 | |
Stefan Reinauer | 1162f25 | 2008-12-04 15:18:20 +0000 | [diff] [blame] | 131 | if (rcba == NULL) { |
Stefan Reinauer | 2319027 | 2008-08-20 13:41:24 +0000 | [diff] [blame] | 132 | perror("Error mapping RCBA"); |
| 133 | exit(1); |
| 134 | } |
| 135 | |
| 136 | printf("RCBA = 0x%08x (MEM)\n\n", rcba_phys); |
| 137 | |
| 138 | for (i = 0; i < size; i += 4) { |
Michael Niewöhner | 10d5221 | 2020-03-13 19:08:21 +0100 | [diff] [blame] | 139 | if (read32(rcba + i)) |
| 140 | printf("0x%04x: 0x%08x\n", i, read32(rcba + i)); |
Stefan Reinauer | 2319027 | 2008-08-20 13:41:24 +0000 | [diff] [blame] | 141 | } |
| 142 | |
Iru Cai | ab5cac2 | 2019-07-14 23:04:05 +0800 | [diff] [blame] | 143 | print_iobp(sb, rcba); |
| 144 | |
Stefan Reinauer | 1162f25 | 2008-12-04 15:18:20 +0000 | [diff] [blame] | 145 | unmap_physical((void *)rcba, size); |
Stefan Reinauer | 2319027 | 2008-08-20 13:41:24 +0000 | [diff] [blame] | 146 | return 0; |
| 147 | } |