1 /* inteltool - dump all registers on an Intel CPU + chipset based system */
2 /* SPDX-License-Identifier: GPL-2.0-only */
8 #define RCBA16(rcba, x) (*((volatile u16 *)((rcba) + (x))))
9 #define RCBA32(rcba, x) (*((volatile u32 *)((rcba) + (x))))
10 /* IO Buffer Programming */
11 #define IOBPIRI 0x2330
14 #define IOBPS_READY 0x0001
15 #define IOBPS_TX_MASK 0x0006
16 #define IOBPS_MASK 0xff00
17 #define IOBPS_READ 0x0600
18 #define IOBPS_WRITE 0x0700
20 #define IOBPU_MAGIC 0xf000
22 #define IOBP_RETRY 1000
23 static inline int iobp_poll(volatile uint8_t *rcba
)
25 for (int try = IOBP_RETRY
; try > 0; try--) {
26 u16 status
= RCBA16(rcba
, IOBPS
);
27 if ((status
& IOBPS_READY
) == 0)
32 printf("IOBP: timeout waiting for transaction to complete\n");
36 static u32
pch_iobp_read(volatile uint8_t *rcba
, u32 address
)
44 RCBA32(rcba
, IOBPIRI
) = address
;
47 status
= RCBA16(rcba
, IOBPS
);
48 status
&= ~IOBPS_MASK
;
50 RCBA16(rcba
, IOBPS
) = status
;
52 /* Undocumented magic */
53 RCBA16(rcba
, IOBPU
) = IOBPU_MAGIC
;
56 status
= RCBA16(rcba
, IOBPS
);
57 status
|= IOBPS_READY
;
58 RCBA16(rcba
, IOBPS
) = status
;
63 /* Check for successful transaction */
64 status
= RCBA16(rcba
, IOBPS
);
65 if (status
& IOBPS_TX_MASK
) {
66 printf("IOBP: read 0x%08x failed\n", address
);
71 return RCBA32(rcba
, IOBPD
);
74 struct iobp_register
{
79 static const struct iobp_register lynxpoint_iobp_registers
[] = {
80 /* SATA Electrical Control Register */
81 {0xea002488, "SECRT88P0"},
82 {0xea00248c, "SECRT8CP0"},
83 {0xea002490, "SECRT90P0"},
84 {0xea002498, "SECRT98P0"},
85 {0xea00251c, "SECRR1CP0"},
86 {0xea002550, "SECRR50P0"},
87 {0xea002554, "SECRR54P0"},
88 {0xea002558, "SECRR58P0"},
90 {0xea002688, "SECRT88P1"},
91 {0xea00268c, "SECRT8CP1"},
92 {0xea002690, "SECRT90P1"},
93 {0xea002698, "SECRT98P1"},
94 {0xea00271c, "SECRR1CP1"},
95 {0xea002750, "SECRR50P1"},
96 {0xea002754, "SECRR54P1"},
97 {0xea002758, "SECRR58P1"},
99 {0xea000888, "SECRT88P2"},
100 {0xea00088c, "SECRT8CP2"},
101 {0xea000890, "SECRT90P2"},
102 {0xea000898, "SECRT98P2"},
103 {0xea00091c, "SECRR1CP2"},
104 {0xea000950, "SECRR50P2"},
105 {0xea000954, "SECRR54P2"},
106 {0xea000958, "SECRR58P2"},
108 {0xea000a88, "SECRT88P3"},
109 {0xea000a8c, "SECRT8CP3"},
110 {0xea000a90, "SECRT90P3"},
111 {0xea000a98, "SECRT98P3"},
112 {0xea000b1c, "SECRR1CP3"},
113 {0xea000b50, "SECRR50P3"},
114 {0xea000b54, "SECRR54P3"},
115 {0xea000b58, "SECRR58P3"},
117 {0xea002088, "SECRT88P4"},
118 {0xea00208c, "SECRT8CP4"},
119 {0xea002090, "SECRT90P4"},
120 {0xea002098, "SECRT98P4"},
121 {0xea00211c, "SECRR1CP4"},
122 {0xea002150, "SECRR50P4"},
123 {0xea002154, "SECRR54P4"},
124 {0xea002158, "SECRR58P4"},
126 {0xea002288, "SECRT88P5"},
127 {0xea00228c, "SECRT8CP5"},
128 {0xea002290, "SECRT90P5"},
129 {0xea002298, "SECRT98P5"},
130 {0xea00231c, "SECRR1CP5"},
131 {0xea002350, "SECRR50P5"},
132 {0xea002354, "SECRR54P5"},
133 {0xea002358, "SECRR58P5"},
135 {0xea008100, "SECRF00"},
136 {0xea008104, "SECRF04"},
138 /* USB 2.0 Electrical Control Register */
139 {0xe5004100, "U2ECRP01"},
140 {0xe5004200, "U2ECRP02"},
141 {0xe5004300, "U2ECRP03"},
142 {0xe5004400, "U2ECRP04"},
143 {0xe5004500, "U2ECRP05"},
144 {0xe5004600, "U2ECRP06"},
145 {0xe5004700, "U2ECRP07"},
146 {0xe5004800, "U2ECRP08"},
147 {0xe5004900, "U2ECRP09"},
148 {0xe5004a00, "U2ECRP10"},
149 {0xe5004b00, "U2ECRP11"},
150 {0xe5004c00, "U2ECRP12"},
151 {0xe5004d00, "U2ECRP13"},
152 {0xe5004e00, "U2ECRP14"},
154 /* IOBP related to USB 3.0 ports */
193 static const struct iobp_register lynxpoint_lp_iobp_registers
[] = {
194 /* SATA Electrical Control Register */
195 {0xea002688, "SECRT88P0"},
196 {0xea00268c, "SECRT8CP0"},
197 {0xea002690, "SECRT90P0"},
198 {0xea002698, "SECRT98P0"},
199 {0xea00271c, "SECRR1CP0"},
200 {0xea002750, "SECRR50P0"},
201 {0xea002754, "SECRR54P0"},
202 {0xea002758, "SECRR58P0"},
204 {0xea002488, "SECRT88P1"},
205 {0xea00248c, "SECRT8CP1"},
206 {0xea002490, "SECRT90P1"},
207 {0xea002498, "SECRT98P1"},
208 {0xea00251c, "SECRR1CP1"},
209 {0xea002550, "SECRR50P1"},
210 {0xea002554, "SECRR54P1"},
211 {0xea002558, "SECRR58P1"},
213 {0xea002288, "SECRT88P2"},
214 {0xea00228c, "SECRT8CP2"},
215 {0xea002290, "SECRT90P2"},
216 {0xea002298, "SECRT98P2"},
217 {0xea00231c, "SECRR1CP2"},
218 {0xea002350, "SECRR50P2"},
219 {0xea002354, "SECRR54P2"},
220 {0xea002358, "SECRR58P2"},
222 {0xea002088, "SECRT88P3"},
223 {0xea00208c, "SECRT8CP3"},
224 {0xea002090, "SECRT90P3"},
225 {0xea002098, "SECRT98P3"},
226 {0xea00211c, "SECRR1CP3"},
227 {0xea002150, "SECRR50P3"},
228 {0xea002154, "SECRR54P3"},
229 {0xea002158, "SECRR58P3"},
231 {0xea008100, "SECRF00"},
232 {0xea008104, "SECRF04"},
234 /* USB 2.0 Electrical Control Register, 8 for -U SoC and 10 for Core-M */
235 {0xe5004100, "U2ECRP01"},
236 {0xe5004200, "U2ECRP02"},
237 {0xe5004300, "U2ECRP03"},
238 {0xe5004400, "U2ECRP04"},
239 {0xe5004500, "U2ECRP05"},
240 {0xe5004600, "U2ECRP06"},
241 {0xe5004700, "U2ECRP07"},
242 {0xe5004800, "U2ECRP08"},
243 {0xe5004900, "U2ECRP09"},
244 {0xe5004a00, "U2ECRP10"},
246 /* IOBP related to USB 3.0 ports */
273 void print_iobp(struct pci_dev
*sb
, volatile uint8_t *rcba
)
275 const struct iobp_register
*iobp_registers
= NULL
;
276 size_t iobp_size
= 0;
278 switch (sb
->device_id
) {
279 case PCI_DEVICE_ID_INTEL_C8_MOBILE
:
280 case PCI_DEVICE_ID_INTEL_C8_DESKTOP
:
281 case PCI_DEVICE_ID_INTEL_Z87
:
282 case PCI_DEVICE_ID_INTEL_Z85
:
283 case PCI_DEVICE_ID_INTEL_HM86
:
284 case PCI_DEVICE_ID_INTEL_H87
:
285 case PCI_DEVICE_ID_INTEL_HM87
:
286 case PCI_DEVICE_ID_INTEL_Q85
:
287 case PCI_DEVICE_ID_INTEL_Q87
:
288 case PCI_DEVICE_ID_INTEL_QM87
:
289 case PCI_DEVICE_ID_INTEL_B85
:
290 case PCI_DEVICE_ID_INTEL_C222
:
291 case PCI_DEVICE_ID_INTEL_C224
:
292 case PCI_DEVICE_ID_INTEL_C226
:
293 case PCI_DEVICE_ID_INTEL_H81
:
294 case PCI_DEVICE_ID_INTEL_C9_MOBILE
:
295 case PCI_DEVICE_ID_INTEL_C9_DESKTOP
:
296 case PCI_DEVICE_ID_INTEL_HM97
:
297 case PCI_DEVICE_ID_INTEL_Z97
:
298 case PCI_DEVICE_ID_INTEL_H97
:
299 iobp_registers
= lynxpoint_iobp_registers
;
300 iobp_size
= ARRAY_SIZE(lynxpoint_iobp_registers
);
302 case PCI_DEVICE_ID_INTEL_LYNXPOINT_LP_FULL
:
303 case PCI_DEVICE_ID_INTEL_LYNXPOINT_LP_PREM
:
304 case PCI_DEVICE_ID_INTEL_LYNXPOINT_LP_BASE
:
305 case PCI_DEVICE_ID_INTEL_WILDCATPOINT_LP_PREM
:
306 case PCI_DEVICE_ID_INTEL_WILDCATPOINT_LP
:
307 iobp_registers
= lynxpoint_lp_iobp_registers
;
308 iobp_size
= ARRAY_SIZE(lynxpoint_lp_iobp_registers
);
317 printf("\n============= IOBP ==============\n\n");
319 for (size_t i
= 0; i
< iobp_size
; i
++) {
320 u32 address
= iobp_registers
[i
].addr
;
321 const char *name
= iobp_registers
[i
].name
;
322 u32 v
= pch_iobp_read(rcba
, address
);
323 printf("0x%08x: 0x%08x (%s)\n", address
, v
, name
);