2 * The PCI Utilities -- Show Capabilities
4 * Copyright (c) 1997--2018 Martin Mares <mj@ucw.cz>
6 * Can be freely distributed and used under the terms of the GNU GPL.
15 cap_pm(struct device *d, int where, int cap)
18 static int pm_aux_current[8] = { 0, 55, 100, 160, 220, 270, 320, 375 };
20 printf("Power Management version %d\n", cap & PCI_PM_CAP_VER_MASK);
23 printf("\t\tFlags: PMEClk%c DSI%c D1%c D2%c AuxCurrent=%dmA PME(D0%c,D1%c,D2%c,D3hot%c,D3cold%c)\n",
24 FLAG(cap, PCI_PM_CAP_PME_CLOCK),
25 FLAG(cap, PCI_PM_CAP_DSI),
26 FLAG(cap, PCI_PM_CAP_D1),
27 FLAG(cap, PCI_PM_CAP_D2),
28 pm_aux_current[(cap & PCI_PM_CAP_AUX_C_MASK) >> 6],
29 FLAG(cap, PCI_PM_CAP_PME_D0),
30 FLAG(cap, PCI_PM_CAP_PME_D1),
31 FLAG(cap, PCI_PM_CAP_PME_D2),
32 FLAG(cap, PCI_PM_CAP_PME_D3_HOT),
33 FLAG(cap, PCI_PM_CAP_PME_D3_COLD));
34 if (!config_fetch(d, where + PCI_PM_CTRL, PCI_PM_SIZEOF - PCI_PM_CTRL))
36 t = get_conf_word(d, where + PCI_PM_CTRL);
37 printf("\t\tStatus: D%d NoSoftRst%c PME-Enable%c DSel=%d DScale=%d PME%c\n",
38 t & PCI_PM_CTRL_STATE_MASK,
39 FLAG(t, PCI_PM_CTRL_NO_SOFT_RST),
40 FLAG(t, PCI_PM_CTRL_PME_ENABLE),
41 (t & PCI_PM_CTRL_DATA_SEL_MASK) >> 9,
42 (t & PCI_PM_CTRL_DATA_SCALE_MASK) >> 13,
43 FLAG(t, PCI_PM_CTRL_PME_STATUS));
44 b = get_conf_byte(d, where + PCI_PM_PPB_EXTENSIONS);
46 printf("\t\tBridge: PM%c B3%c\n",
47 FLAG(b, PCI_PM_BPCC_ENABLE),
48 FLAG(~b, PCI_PM_PPB_B2_B3));
52 format_agp_rate(int rate, char *buf, int agp3)
62 c += sprintf(c, "x%d", 1 << (i + 2*agp3));
67 strcpy(buf, "<none>");
71 cap_agp(struct device *d, int where, int cap)
78 ver = (cap >> 4) & 0x0f;
80 printf("AGP version %x.%x\n", ver, rev);
83 if (!config_fetch(d, where + PCI_AGP_STATUS, PCI_AGP_SIZEOF - PCI_AGP_STATUS))
85 t = get_conf_long(d, where + PCI_AGP_STATUS);
86 if (ver >= 3 && (t & PCI_AGP_STATUS_AGP3))
88 format_agp_rate(t & 7, rate, agp3);
89 printf("\t\tStatus: RQ=%d Iso%c ArqSz=%d Cal=%d SBA%c ITACoh%c GART64%c HTrans%c 64bit%c FW%c AGP3%c Rate=%s\n",
90 ((t & PCI_AGP_STATUS_RQ_MASK) >> 24U) + 1,
91 FLAG(t, PCI_AGP_STATUS_ISOCH),
92 ((t & PCI_AGP_STATUS_ARQSZ_MASK) >> 13),
93 ((t & PCI_AGP_STATUS_CAL_MASK) >> 10),
94 FLAG(t, PCI_AGP_STATUS_SBA),
95 FLAG(t, PCI_AGP_STATUS_ITA_COH),
96 FLAG(t, PCI_AGP_STATUS_GART64),
97 FLAG(t, PCI_AGP_STATUS_HTRANS),
98 FLAG(t, PCI_AGP_STATUS_64BIT),
99 FLAG(t, PCI_AGP_STATUS_FW),
100 FLAG(t, PCI_AGP_STATUS_AGP3),
102 t = get_conf_long(d, where + PCI_AGP_COMMAND);
103 format_agp_rate(t & 7, rate, agp3);
104 printf("\t\tCommand: RQ=%d ArqSz=%d Cal=%d SBA%c AGP%c GART64%c 64bit%c FW%c Rate=%s\n",
105 ((t & PCI_AGP_COMMAND_RQ_MASK) >> 24U) + 1,
106 ((t & PCI_AGP_COMMAND_ARQSZ_MASK) >> 13),
107 ((t & PCI_AGP_COMMAND_CAL_MASK) >> 10),
108 FLAG(t, PCI_AGP_COMMAND_SBA),
109 FLAG(t, PCI_AGP_COMMAND_AGP),
110 FLAG(t, PCI_AGP_COMMAND_GART64),
111 FLAG(t, PCI_AGP_COMMAND_64BIT),
112 FLAG(t, PCI_AGP_COMMAND_FW),
117 cap_pcix_nobridge(struct device *d, int where)
121 static const byte max_outstanding[8] = { 1, 2, 3, 4, 8, 12, 16, 32 };
123 printf("PCI-X non-bridge device\n");
128 if (!config_fetch(d, where + PCI_PCIX_STATUS, 4))
131 command = get_conf_word(d, where + PCI_PCIX_COMMAND);
132 status = get_conf_long(d, where + PCI_PCIX_STATUS);
133 printf("\t\tCommand: DPERE%c ERO%c RBC=%d OST=%d\n",
134 FLAG(command, PCI_PCIX_COMMAND_DPERE),
135 FLAG(command, PCI_PCIX_COMMAND_ERO),
136 1 << (9 + ((command & PCI_PCIX_COMMAND_MAX_MEM_READ_BYTE_COUNT) >> 2U)),
137 max_outstanding[(command & PCI_PCIX_COMMAND_MAX_OUTSTANDING_SPLIT_TRANS) >> 4U]);
138 printf("\t\tStatus: Dev=%02x:%02x.%d 64bit%c 133MHz%c SCD%c USC%c DC=%s DMMRBC=%u DMOST=%u DMCRS=%u RSCEM%c 266MHz%c 533MHz%c\n",
139 (status & PCI_PCIX_STATUS_BUS) >> 8,
140 (status & PCI_PCIX_STATUS_DEVICE) >> 3,
141 (status & PCI_PCIX_STATUS_FUNCTION),
142 FLAG(status, PCI_PCIX_STATUS_64BIT),
143 FLAG(status, PCI_PCIX_STATUS_133MHZ),
144 FLAG(status, PCI_PCIX_STATUS_SC_DISCARDED),
145 FLAG(status, PCI_PCIX_STATUS_UNEXPECTED_SC),
146 ((status & PCI_PCIX_STATUS_DEVICE_COMPLEXITY) ? "bridge" : "simple"),
147 1 << (9 + ((status & PCI_PCIX_STATUS_DESIGNED_MAX_MEM_READ_BYTE_COUNT) >> 21)),
148 max_outstanding[(status & PCI_PCIX_STATUS_DESIGNED_MAX_OUTSTANDING_SPLIT_TRANS) >> 23],
149 1 << (3 + ((status & PCI_PCIX_STATUS_DESIGNED_MAX_CUMULATIVE_READ_SIZE) >> 26)),
150 FLAG(status, PCI_PCIX_STATUS_RCVD_SC_ERR_MESS),
151 FLAG(status, PCI_PCIX_STATUS_266MHZ),
152 FLAG(status, PCI_PCIX_STATUS_533MHZ));
156 cap_pcix_bridge(struct device *d, int where)
158 static const char * const sec_clock_freq[8] = { "conv", "66MHz", "100MHz", "133MHz", "?4", "?5", "?6", "?7" };
160 u32 status, upstcr, downstcr;
162 printf("PCI-X bridge device\n");
167 if (!config_fetch(d, where + PCI_PCIX_BRIDGE_STATUS, 12))
170 secstatus = get_conf_word(d, where + PCI_PCIX_BRIDGE_SEC_STATUS);
171 printf("\t\tSecondary Status: 64bit%c 133MHz%c SCD%c USC%c SCO%c SRD%c Freq=%s\n",
172 FLAG(secstatus, PCI_PCIX_BRIDGE_SEC_STATUS_64BIT),
173 FLAG(secstatus, PCI_PCIX_BRIDGE_SEC_STATUS_133MHZ),
174 FLAG(secstatus, PCI_PCIX_BRIDGE_SEC_STATUS_SC_DISCARDED),
175 FLAG(secstatus, PCI_PCIX_BRIDGE_SEC_STATUS_UNEXPECTED_SC),
176 FLAG(secstatus, PCI_PCIX_BRIDGE_SEC_STATUS_SC_OVERRUN),
177 FLAG(secstatus, PCI_PCIX_BRIDGE_SEC_STATUS_SPLIT_REQUEST_DELAYED),
178 sec_clock_freq[(secstatus & PCI_PCIX_BRIDGE_SEC_STATUS_CLOCK_FREQ) >> 6]);
179 status = get_conf_long(d, where + PCI_PCIX_BRIDGE_STATUS);
180 printf("\t\tStatus: Dev=%02x:%02x.%d 64bit%c 133MHz%c SCD%c USC%c SCO%c SRD%c\n",
181 (status & PCI_PCIX_BRIDGE_STATUS_BUS) >> 8,
182 (status & PCI_PCIX_BRIDGE_STATUS_DEVICE) >> 3,
183 (status & PCI_PCIX_BRIDGE_STATUS_FUNCTION),
184 FLAG(status, PCI_PCIX_BRIDGE_STATUS_64BIT),
185 FLAG(status, PCI_PCIX_BRIDGE_STATUS_133MHZ),
186 FLAG(status, PCI_PCIX_BRIDGE_STATUS_SC_DISCARDED),
187 FLAG(status, PCI_PCIX_BRIDGE_STATUS_UNEXPECTED_SC),
188 FLAG(status, PCI_PCIX_BRIDGE_STATUS_SC_OVERRUN),
189 FLAG(status, PCI_PCIX_BRIDGE_STATUS_SPLIT_REQUEST_DELAYED));
190 upstcr = get_conf_long(d, where + PCI_PCIX_BRIDGE_UPSTREAM_SPLIT_TRANS_CTRL);
191 printf("\t\tUpstream: Capacity=%u CommitmentLimit=%u\n",
192 (upstcr & PCI_PCIX_BRIDGE_STR_CAPACITY),
193 (upstcr >> 16) & 0xffff);
194 downstcr = get_conf_long(d, where + PCI_PCIX_BRIDGE_DOWNSTREAM_SPLIT_TRANS_CTRL);
195 printf("\t\tDownstream: Capacity=%u CommitmentLimit=%u\n",
196 (downstcr & PCI_PCIX_BRIDGE_STR_CAPACITY),
197 (downstcr >> 16) & 0xffff);
201 cap_pcix(struct device *d, int where)
203 switch (get_conf_byte(d, PCI_HEADER_TYPE) & 0x7f)
205 case PCI_HEADER_TYPE_NORMAL:
206 cap_pcix_nobridge(d, where);
208 case PCI_HEADER_TYPE_BRIDGE:
209 cap_pcix_bridge(d, where);
215 ht_link_width(unsigned width)
217 static char * const widths[8] = { "8bit", "16bit", "[2]", "32bit", "2bit", "4bit", "[6]", "N/C" };
218 return widths[width];
222 ht_link_freq(unsigned freq)
224 static char * const freqs[16] = { "200MHz", "300MHz", "400MHz", "500MHz", "600MHz", "800MHz", "1.0GHz", "1.2GHz",
225 "1.4GHz", "1.6GHz", "[a]", "[b]", "[c]", "[d]", "[e]", "Vend" };
230 cap_ht_pri(struct device *d, int where, int cmd)
232 u16 lctr0, lcnf0, lctr1, lcnf1, eh;
233 u8 rid, lfrer0, lfcap0, ftr, lfrer1, lfcap1, mbu, mlu, bn;
235 printf("HyperTransport: Slave or Primary Interface\n");
239 if (!config_fetch(d, where + PCI_HT_PRI_LCTR0, PCI_HT_PRI_SIZEOF - PCI_HT_PRI_LCTR0))
241 rid = get_conf_byte(d, where + PCI_HT_PRI_RID);
242 if (rid < 0x22 && rid > 0x11)
243 printf("\t\t!!! Possibly incomplete decoding\n");
245 printf("\t\tCommand: BaseUnitID=%u UnitCnt=%u MastHost%c DefDir%c",
246 (cmd & PCI_HT_PRI_CMD_BUID),
247 (cmd & PCI_HT_PRI_CMD_UC) >> 5,
248 FLAG(cmd, PCI_HT_PRI_CMD_MH),
249 FLAG(cmd, PCI_HT_PRI_CMD_DD));
251 printf(" DUL%c", FLAG(cmd, PCI_HT_PRI_CMD_DUL));
254 lctr0 = get_conf_word(d, where + PCI_HT_PRI_LCTR0);
255 printf("\t\tLink Control 0: CFlE%c CST%c CFE%c <LkFail%c Init%c EOC%c TXO%c <CRCErr=%x",
256 FLAG(lctr0, PCI_HT_LCTR_CFLE),
257 FLAG(lctr0, PCI_HT_LCTR_CST),
258 FLAG(lctr0, PCI_HT_LCTR_CFE),
259 FLAG(lctr0, PCI_HT_LCTR_LKFAIL),
260 FLAG(lctr0, PCI_HT_LCTR_INIT),
261 FLAG(lctr0, PCI_HT_LCTR_EOC),
262 FLAG(lctr0, PCI_HT_LCTR_TXO),
263 (lctr0 & PCI_HT_LCTR_CRCERR) >> 8);
265 printf(" IsocEn%c LSEn%c ExtCTL%c 64b%c",
266 FLAG(lctr0, PCI_HT_LCTR_ISOCEN),
267 FLAG(lctr0, PCI_HT_LCTR_LSEN),
268 FLAG(lctr0, PCI_HT_LCTR_EXTCTL),
269 FLAG(lctr0, PCI_HT_LCTR_64B));
272 lcnf0 = get_conf_word(d, where + PCI_HT_PRI_LCNF0);
274 printf("\t\tLink Config 0: MLWI=%s MLWO=%s LWI=%s LWO=%s\n",
275 ht_link_width(lcnf0 & PCI_HT_LCNF_MLWI),
276 ht_link_width((lcnf0 & PCI_HT_LCNF_MLWO) >> 4),
277 ht_link_width((lcnf0 & PCI_HT_LCNF_LWI) >> 8),
278 ht_link_width((lcnf0 & PCI_HT_LCNF_LWO) >> 12));
280 printf("\t\tLink Config 0: MLWI=%s DwFcIn%c MLWO=%s DwFcOut%c LWI=%s DwFcInEn%c LWO=%s DwFcOutEn%c\n",
281 ht_link_width(lcnf0 & PCI_HT_LCNF_MLWI),
282 FLAG(lcnf0, PCI_HT_LCNF_DFI),
283 ht_link_width((lcnf0 & PCI_HT_LCNF_MLWO) >> 4),
284 FLAG(lcnf0, PCI_HT_LCNF_DFO),
285 ht_link_width((lcnf0 & PCI_HT_LCNF_LWI) >> 8),
286 FLAG(lcnf0, PCI_HT_LCNF_DFIE),
287 ht_link_width((lcnf0 & PCI_HT_LCNF_LWO) >> 12),
288 FLAG(lcnf0, PCI_HT_LCNF_DFOE));
290 lctr1 = get_conf_word(d, where + PCI_HT_PRI_LCTR1);
291 printf("\t\tLink Control 1: CFlE%c CST%c CFE%c <LkFail%c Init%c EOC%c TXO%c <CRCErr=%x",
292 FLAG(lctr1, PCI_HT_LCTR_CFLE),
293 FLAG(lctr1, PCI_HT_LCTR_CST),
294 FLAG(lctr1, PCI_HT_LCTR_CFE),
295 FLAG(lctr1, PCI_HT_LCTR_LKFAIL),
296 FLAG(lctr1, PCI_HT_LCTR_INIT),
297 FLAG(lctr1, PCI_HT_LCTR_EOC),
298 FLAG(lctr1, PCI_HT_LCTR_TXO),
299 (lctr1 & PCI_HT_LCTR_CRCERR) >> 8);
301 printf(" IsocEn%c LSEn%c ExtCTL%c 64b%c",
302 FLAG(lctr1, PCI_HT_LCTR_ISOCEN),
303 FLAG(lctr1, PCI_HT_LCTR_LSEN),
304 FLAG(lctr1, PCI_HT_LCTR_EXTCTL),
305 FLAG(lctr1, PCI_HT_LCTR_64B));
308 lcnf1 = get_conf_word(d, where + PCI_HT_PRI_LCNF1);
310 printf("\t\tLink Config 1: MLWI=%s MLWO=%s LWI=%s LWO=%s\n",
311 ht_link_width(lcnf1 & PCI_HT_LCNF_MLWI),
312 ht_link_width((lcnf1 & PCI_HT_LCNF_MLWO) >> 4),
313 ht_link_width((lcnf1 & PCI_HT_LCNF_LWI) >> 8),
314 ht_link_width((lcnf1 & PCI_HT_LCNF_LWO) >> 12));
316 printf("\t\tLink Config 1: MLWI=%s DwFcIn%c MLWO=%s DwFcOut%c LWI=%s DwFcInEn%c LWO=%s DwFcOutEn%c\n",
317 ht_link_width(lcnf1 & PCI_HT_LCNF_MLWI),
318 FLAG(lcnf1, PCI_HT_LCNF_DFI),
319 ht_link_width((lcnf1 & PCI_HT_LCNF_MLWO) >> 4),
320 FLAG(lcnf1, PCI_HT_LCNF_DFO),
321 ht_link_width((lcnf1 & PCI_HT_LCNF_LWI) >> 8),
322 FLAG(lcnf1, PCI_HT_LCNF_DFIE),
323 ht_link_width((lcnf1 & PCI_HT_LCNF_LWO) >> 12),
324 FLAG(lcnf1, PCI_HT_LCNF_DFOE));
326 printf("\t\tRevision ID: %u.%02u\n",
327 (rid & PCI_HT_RID_MAJ) >> 5, (rid & PCI_HT_RID_MIN));
331 lfrer0 = get_conf_byte(d, where + PCI_HT_PRI_LFRER0);
332 printf("\t\tLink Frequency 0: %s\n", ht_link_freq(lfrer0 & PCI_HT_LFRER_FREQ));
333 printf("\t\tLink Error 0: <Prot%c <Ovfl%c <EOC%c CTLTm%c\n",
334 FLAG(lfrer0, PCI_HT_LFRER_PROT),
335 FLAG(lfrer0, PCI_HT_LFRER_OV),
336 FLAG(lfrer0, PCI_HT_LFRER_EOC),
337 FLAG(lfrer0, PCI_HT_LFRER_CTLT));
339 lfcap0 = get_conf_byte(d, where + PCI_HT_PRI_LFCAP0);
340 printf("\t\tLink Frequency Capability 0: 200MHz%c 300MHz%c 400MHz%c 500MHz%c 600MHz%c 800MHz%c 1.0GHz%c 1.2GHz%c 1.4GHz%c 1.6GHz%c Vend%c\n",
341 FLAG(lfcap0, PCI_HT_LFCAP_200),
342 FLAG(lfcap0, PCI_HT_LFCAP_300),
343 FLAG(lfcap0, PCI_HT_LFCAP_400),
344 FLAG(lfcap0, PCI_HT_LFCAP_500),
345 FLAG(lfcap0, PCI_HT_LFCAP_600),
346 FLAG(lfcap0, PCI_HT_LFCAP_800),
347 FLAG(lfcap0, PCI_HT_LFCAP_1000),
348 FLAG(lfcap0, PCI_HT_LFCAP_1200),
349 FLAG(lfcap0, PCI_HT_LFCAP_1400),
350 FLAG(lfcap0, PCI_HT_LFCAP_1600),
351 FLAG(lfcap0, PCI_HT_LFCAP_VEND));
353 ftr = get_conf_byte(d, where + PCI_HT_PRI_FTR);
354 printf("\t\tFeature Capability: IsocFC%c LDTSTOP%c CRCTM%c ECTLT%c 64bA%c UIDRD%c\n",
355 FLAG(ftr, PCI_HT_FTR_ISOCFC),
356 FLAG(ftr, PCI_HT_FTR_LDTSTOP),
357 FLAG(ftr, PCI_HT_FTR_CRCTM),
358 FLAG(ftr, PCI_HT_FTR_ECTLT),
359 FLAG(ftr, PCI_HT_FTR_64BA),
360 FLAG(ftr, PCI_HT_FTR_UIDRD));
362 lfrer1 = get_conf_byte(d, where + PCI_HT_PRI_LFRER1);
363 printf("\t\tLink Frequency 1: %s\n", ht_link_freq(lfrer1 & PCI_HT_LFRER_FREQ));
364 printf("\t\tLink Error 1: <Prot%c <Ovfl%c <EOC%c CTLTm%c\n",
365 FLAG(lfrer1, PCI_HT_LFRER_PROT),
366 FLAG(lfrer1, PCI_HT_LFRER_OV),
367 FLAG(lfrer1, PCI_HT_LFRER_EOC),
368 FLAG(lfrer1, PCI_HT_LFRER_CTLT));
370 lfcap1 = get_conf_byte(d, where + PCI_HT_PRI_LFCAP1);
371 printf("\t\tLink Frequency Capability 1: 200MHz%c 300MHz%c 400MHz%c 500MHz%c 600MHz%c 800MHz%c 1.0GHz%c 1.2GHz%c 1.4GHz%c 1.6GHz%c Vend%c\n",
372 FLAG(lfcap1, PCI_HT_LFCAP_200),
373 FLAG(lfcap1, PCI_HT_LFCAP_300),
374 FLAG(lfcap1, PCI_HT_LFCAP_400),
375 FLAG(lfcap1, PCI_HT_LFCAP_500),
376 FLAG(lfcap1, PCI_HT_LFCAP_600),
377 FLAG(lfcap1, PCI_HT_LFCAP_800),
378 FLAG(lfcap1, PCI_HT_LFCAP_1000),
379 FLAG(lfcap1, PCI_HT_LFCAP_1200),
380 FLAG(lfcap1, PCI_HT_LFCAP_1400),
381 FLAG(lfcap1, PCI_HT_LFCAP_1600),
382 FLAG(lfcap1, PCI_HT_LFCAP_VEND));
384 eh = get_conf_word(d, where + PCI_HT_PRI_EH);
385 printf("\t\tError Handling: PFlE%c OFlE%c PFE%c OFE%c EOCFE%c RFE%c CRCFE%c SERRFE%c CF%c RE%c PNFE%c ONFE%c EOCNFE%c RNFE%c CRCNFE%c SERRNFE%c\n",
386 FLAG(eh, PCI_HT_EH_PFLE),
387 FLAG(eh, PCI_HT_EH_OFLE),
388 FLAG(eh, PCI_HT_EH_PFE),
389 FLAG(eh, PCI_HT_EH_OFE),
390 FLAG(eh, PCI_HT_EH_EOCFE),
391 FLAG(eh, PCI_HT_EH_RFE),
392 FLAG(eh, PCI_HT_EH_CRCFE),
393 FLAG(eh, PCI_HT_EH_SERRFE),
394 FLAG(eh, PCI_HT_EH_CF),
395 FLAG(eh, PCI_HT_EH_RE),
396 FLAG(eh, PCI_HT_EH_PNFE),
397 FLAG(eh, PCI_HT_EH_ONFE),
398 FLAG(eh, PCI_HT_EH_EOCNFE),
399 FLAG(eh, PCI_HT_EH_RNFE),
400 FLAG(eh, PCI_HT_EH_CRCNFE),
401 FLAG(eh, PCI_HT_EH_SERRNFE));
403 mbu = get_conf_byte(d, where + PCI_HT_PRI_MBU);
404 mlu = get_conf_byte(d, where + PCI_HT_PRI_MLU);
405 printf("\t\tPrefetchable memory behind bridge Upper: %02x-%02x\n", mbu, mlu);
407 bn = get_conf_byte(d, where + PCI_HT_PRI_BN);
408 printf("\t\tBus Number: %02x\n", bn);
412 cap_ht_sec(struct device *d, int where, int cmd)
414 u16 lctr, lcnf, ftr, eh;
415 u8 rid, lfrer, lfcap, mbu, mlu;
418 printf("HyperTransport: Host or Secondary Interface\n");
422 if (!config_fetch(d, where + PCI_HT_SEC_LCTR, PCI_HT_SEC_SIZEOF - PCI_HT_SEC_LCTR))
424 rid = get_conf_byte(d, where + PCI_HT_SEC_RID);
425 if (rid < 0x22 && rid > 0x11)
426 printf("\t\t!!! Possibly incomplete decoding\n");
429 fmt = "\t\tCommand: WarmRst%c DblEnd%c DevNum=%u ChainSide%c HostHide%c Slave%c <EOCErr%c DUL%c\n";
431 fmt = "\t\tCommand: WarmRst%c DblEnd%c\n";
433 FLAG(cmd, PCI_HT_SEC_CMD_WR),
434 FLAG(cmd, PCI_HT_SEC_CMD_DE),
435 (cmd & PCI_HT_SEC_CMD_DN) >> 2,
436 FLAG(cmd, PCI_HT_SEC_CMD_CS),
437 FLAG(cmd, PCI_HT_SEC_CMD_HH),
438 FLAG(cmd, PCI_HT_SEC_CMD_AS),
439 FLAG(cmd, PCI_HT_SEC_CMD_HIECE),
440 FLAG(cmd, PCI_HT_SEC_CMD_DUL));
441 lctr = get_conf_word(d, where + PCI_HT_SEC_LCTR);
443 fmt = "\t\tLink Control: CFlE%c CST%c CFE%c <LkFail%c Init%c EOC%c TXO%c <CRCErr=%x IsocEn%c LSEn%c ExtCTL%c 64b%c\n";
445 fmt = "\t\tLink Control: CFlE%c CST%c CFE%c <LkFail%c Init%c EOC%c TXO%c <CRCErr=%x\n";
447 FLAG(lctr, PCI_HT_LCTR_CFLE),
448 FLAG(lctr, PCI_HT_LCTR_CST),
449 FLAG(lctr, PCI_HT_LCTR_CFE),
450 FLAG(lctr, PCI_HT_LCTR_LKFAIL),
451 FLAG(lctr, PCI_HT_LCTR_INIT),
452 FLAG(lctr, PCI_HT_LCTR_EOC),
453 FLAG(lctr, PCI_HT_LCTR_TXO),
454 (lctr & PCI_HT_LCTR_CRCERR) >> 8,
455 FLAG(lctr, PCI_HT_LCTR_ISOCEN),
456 FLAG(lctr, PCI_HT_LCTR_LSEN),
457 FLAG(lctr, PCI_HT_LCTR_EXTCTL),
458 FLAG(lctr, PCI_HT_LCTR_64B));
459 lcnf = get_conf_word(d, where + PCI_HT_SEC_LCNF);
461 fmt = "\t\tLink Config: MLWI=%1$s DwFcIn%5$c MLWO=%2$s DwFcOut%6$c LWI=%3$s DwFcInEn%7$c LWO=%4$s DwFcOutEn%8$c\n";
463 fmt = "\t\tLink Config: MLWI=%s MLWO=%s LWI=%s LWO=%s\n";
465 ht_link_width(lcnf & PCI_HT_LCNF_MLWI),
466 ht_link_width((lcnf & PCI_HT_LCNF_MLWO) >> 4),
467 ht_link_width((lcnf & PCI_HT_LCNF_LWI) >> 8),
468 ht_link_width((lcnf & PCI_HT_LCNF_LWO) >> 12),
469 FLAG(lcnf, PCI_HT_LCNF_DFI),
470 FLAG(lcnf, PCI_HT_LCNF_DFO),
471 FLAG(lcnf, PCI_HT_LCNF_DFIE),
472 FLAG(lcnf, PCI_HT_LCNF_DFOE));
473 printf("\t\tRevision ID: %u.%02u\n",
474 (rid & PCI_HT_RID_MAJ) >> 5, (rid & PCI_HT_RID_MIN));
477 lfrer = get_conf_byte(d, where + PCI_HT_SEC_LFRER);
478 printf("\t\tLink Frequency: %s\n", ht_link_freq(lfrer & PCI_HT_LFRER_FREQ));
479 printf("\t\tLink Error: <Prot%c <Ovfl%c <EOC%c CTLTm%c\n",
480 FLAG(lfrer, PCI_HT_LFRER_PROT),
481 FLAG(lfrer, PCI_HT_LFRER_OV),
482 FLAG(lfrer, PCI_HT_LFRER_EOC),
483 FLAG(lfrer, PCI_HT_LFRER_CTLT));
484 lfcap = get_conf_byte(d, where + PCI_HT_SEC_LFCAP);
485 printf("\t\tLink Frequency Capability: 200MHz%c 300MHz%c 400MHz%c 500MHz%c 600MHz%c 800MHz%c 1.0GHz%c 1.2GHz%c 1.4GHz%c 1.6GHz%c Vend%c\n",
486 FLAG(lfcap, PCI_HT_LFCAP_200),
487 FLAG(lfcap, PCI_HT_LFCAP_300),
488 FLAG(lfcap, PCI_HT_LFCAP_400),
489 FLAG(lfcap, PCI_HT_LFCAP_500),
490 FLAG(lfcap, PCI_HT_LFCAP_600),
491 FLAG(lfcap, PCI_HT_LFCAP_800),
492 FLAG(lfcap, PCI_HT_LFCAP_1000),
493 FLAG(lfcap, PCI_HT_LFCAP_1200),
494 FLAG(lfcap, PCI_HT_LFCAP_1400),
495 FLAG(lfcap, PCI_HT_LFCAP_1600),
496 FLAG(lfcap, PCI_HT_LFCAP_VEND));
497 ftr = get_conf_word(d, where + PCI_HT_SEC_FTR);
498 printf("\t\tFeature Capability: IsocFC%c LDTSTOP%c CRCTM%c ECTLT%c 64bA%c UIDRD%c ExtRS%c UCnfE%c\n",
499 FLAG(ftr, PCI_HT_FTR_ISOCFC),
500 FLAG(ftr, PCI_HT_FTR_LDTSTOP),
501 FLAG(ftr, PCI_HT_FTR_CRCTM),
502 FLAG(ftr, PCI_HT_FTR_ECTLT),
503 FLAG(ftr, PCI_HT_FTR_64BA),
504 FLAG(ftr, PCI_HT_FTR_UIDRD),
505 FLAG(ftr, PCI_HT_SEC_FTR_EXTRS),
506 FLAG(ftr, PCI_HT_SEC_FTR_UCNFE));
507 if (ftr & PCI_HT_SEC_FTR_EXTRS)
509 eh = get_conf_word(d, where + PCI_HT_SEC_EH);
510 printf("\t\tError Handling: PFlE%c OFlE%c PFE%c OFE%c EOCFE%c RFE%c CRCFE%c SERRFE%c CF%c RE%c PNFE%c ONFE%c EOCNFE%c RNFE%c CRCNFE%c SERRNFE%c\n",
511 FLAG(eh, PCI_HT_EH_PFLE),
512 FLAG(eh, PCI_HT_EH_OFLE),
513 FLAG(eh, PCI_HT_EH_PFE),
514 FLAG(eh, PCI_HT_EH_OFE),
515 FLAG(eh, PCI_HT_EH_EOCFE),
516 FLAG(eh, PCI_HT_EH_RFE),
517 FLAG(eh, PCI_HT_EH_CRCFE),
518 FLAG(eh, PCI_HT_EH_SERRFE),
519 FLAG(eh, PCI_HT_EH_CF),
520 FLAG(eh, PCI_HT_EH_RE),
521 FLAG(eh, PCI_HT_EH_PNFE),
522 FLAG(eh, PCI_HT_EH_ONFE),
523 FLAG(eh, PCI_HT_EH_EOCNFE),
524 FLAG(eh, PCI_HT_EH_RNFE),
525 FLAG(eh, PCI_HT_EH_CRCNFE),
526 FLAG(eh, PCI_HT_EH_SERRNFE));
527 mbu = get_conf_byte(d, where + PCI_HT_SEC_MBU);
528 mlu = get_conf_byte(d, where + PCI_HT_SEC_MLU);
529 printf("\t\tPrefetchable memory behind bridge Upper: %02x-%02x\n", mbu, mlu);
534 cap_ht(struct device *d, int where, int cmd)
538 switch (cmd & PCI_HT_CMD_TYP_HI)
540 case PCI_HT_CMD_TYP_HI_PRI:
541 cap_ht_pri(d, where, cmd);
543 case PCI_HT_CMD_TYP_HI_SEC:
544 cap_ht_sec(d, where, cmd);
548 type = cmd & PCI_HT_CMD_TYP;
551 case PCI_HT_CMD_TYP_SW:
552 printf("HyperTransport: Switch\n");
554 case PCI_HT_CMD_TYP_IDC:
555 printf("HyperTransport: Interrupt Discovery and Configuration\n");
557 case PCI_HT_CMD_TYP_RID:
558 printf("HyperTransport: Revision ID: %u.%02u\n",
559 (cmd & PCI_HT_RID_MAJ) >> 5, (cmd & PCI_HT_RID_MIN));
561 case PCI_HT_CMD_TYP_UIDC:
562 printf("HyperTransport: UnitID Clumping\n");
564 case PCI_HT_CMD_TYP_ECSA:
565 printf("HyperTransport: Extended Configuration Space Access\n");
567 case PCI_HT_CMD_TYP_AM:
568 printf("HyperTransport: Address Mapping\n");
570 case PCI_HT_CMD_TYP_MSIM:
571 printf("HyperTransport: MSI Mapping Enable%c Fixed%c\n",
572 FLAG(cmd, PCI_HT_MSIM_CMD_EN),
573 FLAG(cmd, PCI_HT_MSIM_CMD_FIXD));
574 if (verbose >= 2 && !(cmd & PCI_HT_MSIM_CMD_FIXD))
577 if (!config_fetch(d, where + PCI_HT_MSIM_ADDR_LO, 8))
579 offl = get_conf_long(d, where + PCI_HT_MSIM_ADDR_LO);
580 offh = get_conf_long(d, where + PCI_HT_MSIM_ADDR_HI);
581 printf("\t\tMapping Address Base: %016" PCI_U64_FMT_X "\n", ((u64)offh << 32) | (offl & ~0xfffff));
584 case PCI_HT_CMD_TYP_DR:
585 printf("HyperTransport: DirectRoute\n");
587 case PCI_HT_CMD_TYP_VCS:
588 printf("HyperTransport: VCSet\n");
590 case PCI_HT_CMD_TYP_RM:
591 printf("HyperTransport: Retry Mode\n");
593 case PCI_HT_CMD_TYP_X86:
594 printf("HyperTransport: X86 (reserved)\n");
597 printf("HyperTransport: #%02x\n", type >> 11);
602 cap_msi(struct device *d, int where, int cap)
608 printf("MSI: Enable%c Count=%d/%d Maskable%c 64bit%c\n",
609 FLAG(cap, PCI_MSI_FLAGS_ENABLE),
610 1 << ((cap & PCI_MSI_FLAGS_QSIZE) >> 4),
611 1 << ((cap & PCI_MSI_FLAGS_QMASK) >> 1),
612 FLAG(cap, PCI_MSI_FLAGS_MASK_BIT),
613 FLAG(cap, PCI_MSI_FLAGS_64BIT));
616 is64 = cap & PCI_MSI_FLAGS_64BIT;
617 if (!config_fetch(d, where + PCI_MSI_ADDRESS_LO, (is64 ? PCI_MSI_DATA_64 : PCI_MSI_DATA_32) + 2 - PCI_MSI_ADDRESS_LO))
619 printf("\t\tAddress: ");
622 t = get_conf_long(d, where + PCI_MSI_ADDRESS_HI);
623 w = get_conf_word(d, where + PCI_MSI_DATA_64);
627 w = get_conf_word(d, where + PCI_MSI_DATA_32);
628 t = get_conf_long(d, where + PCI_MSI_ADDRESS_LO);
629 printf("%08x Data: %04x\n", t, w);
630 if (cap & PCI_MSI_FLAGS_MASK_BIT)
636 if (!config_fetch(d, where + PCI_MSI_MASK_BIT_64, 8))
638 mask = get_conf_long(d, where + PCI_MSI_MASK_BIT_64);
639 pending = get_conf_long(d, where + PCI_MSI_PENDING_64);
643 if (!config_fetch(d, where + PCI_MSI_MASK_BIT_32, 8))
645 mask = get_conf_long(d, where + PCI_MSI_MASK_BIT_32);
646 pending = get_conf_long(d, where + PCI_MSI_PENDING_32);
648 printf("\t\tMasking: %08x Pending: %08x\n", mask, pending);
652 static int exp_downstream_port(int type)
654 return type == PCI_EXP_TYPE_ROOT_PORT ||
655 type == PCI_EXP_TYPE_DOWNSTREAM ||
656 type == PCI_EXP_TYPE_PCIE_BRIDGE; /* PCI/PCI-X to PCIe Bridge */
659 static void show_power_limit(int value, int scale)
661 static const float scales[4] = { 1.0, 0.1, 0.01, 0.001 };
663 if (scale == 0 && value == 0xFF)
669 if (scale == 0 && value >= 0xF0 && value <= 0xFE)
670 value = 250 + 25 * (value - 0xF0);
672 printf("%gW", value * scales[scale]);
675 static const char *latency_l0s(int value)
677 static const char *latencies[] = { "<64ns", "<128ns", "<256ns", "<512ns", "<1us", "<2us", "<4us", "unlimited" };
678 return latencies[value];
681 static const char *latency_l1(int value)
683 static const char *latencies[] = { "<1us", "<2us", "<4us", "<8us", "<16us", "<32us", "<64us", "unlimited" };
684 return latencies[value];
687 static void cap_express_dev(struct device *d, int where, int type)
692 t = get_conf_long(d, where + PCI_EXP_DEVCAP);
693 printf("\t\tDevCap:\tMaxPayload %d bytes, PhantFunc %d",
694 128 << (t & PCI_EXP_DEVCAP_PAYLOAD),
695 (1 << ((t & PCI_EXP_DEVCAP_PHANTOM) >> 3)) - 1);
696 if ((type == PCI_EXP_TYPE_ENDPOINT) || (type == PCI_EXP_TYPE_LEG_END))
697 printf(", Latency L0s %s, L1 %s",
698 latency_l0s((t & PCI_EXP_DEVCAP_L0S) >> 6),
699 latency_l1((t & PCI_EXP_DEVCAP_L1) >> 9));
701 printf("\t\t\tExtTag%c", FLAG(t, PCI_EXP_DEVCAP_EXT_TAG));
702 if ((type == PCI_EXP_TYPE_ENDPOINT) || (type == PCI_EXP_TYPE_LEG_END) ||
703 (type == PCI_EXP_TYPE_UPSTREAM) || (type == PCI_EXP_TYPE_PCI_BRIDGE))
704 printf(" AttnBtn%c AttnInd%c PwrInd%c",
705 FLAG(t, PCI_EXP_DEVCAP_ATN_BUT),
706 FLAG(t, PCI_EXP_DEVCAP_ATN_IND), FLAG(t, PCI_EXP_DEVCAP_PWR_IND));
708 FLAG(t, PCI_EXP_DEVCAP_RBE));
709 if ((type == PCI_EXP_TYPE_ENDPOINT) || (type == PCI_EXP_TYPE_LEG_END) || (type == PCI_EXP_TYPE_ROOT_INT_EP))
711 FLAG(t, PCI_EXP_DEVCAP_FLRESET));
712 if ((type == PCI_EXP_TYPE_ENDPOINT) || (type == PCI_EXP_TYPE_UPSTREAM) ||
713 (type == PCI_EXP_TYPE_PCI_BRIDGE))
715 printf(" SlotPowerLimit ");
716 show_power_limit((t & PCI_EXP_DEVCAP_PWR_VAL) >> 18, (t & PCI_EXP_DEVCAP_PWR_SCL) >> 26);
720 w = get_conf_word(d, where + PCI_EXP_DEVCTL);
721 printf("\t\tDevCtl:\tCorrErr%c NonFatalErr%c FatalErr%c UnsupReq%c\n",
722 FLAG(w, PCI_EXP_DEVCTL_CERE),
723 FLAG(w, PCI_EXP_DEVCTL_NFERE),
724 FLAG(w, PCI_EXP_DEVCTL_FERE),
725 FLAG(w, PCI_EXP_DEVCTL_URRE));
726 printf("\t\t\tRlxdOrd%c ExtTag%c PhantFunc%c AuxPwr%c NoSnoop%c",
727 FLAG(w, PCI_EXP_DEVCTL_RELAXED),
728 FLAG(w, PCI_EXP_DEVCTL_EXT_TAG),
729 FLAG(w, PCI_EXP_DEVCTL_PHANTOM),
730 FLAG(w, PCI_EXP_DEVCTL_AUX_PME),
731 FLAG(w, PCI_EXP_DEVCTL_NOSNOOP));
732 if (type == PCI_EXP_TYPE_PCI_BRIDGE)
733 printf(" BrConfRtry%c", FLAG(w, PCI_EXP_DEVCTL_BCRE));
734 if (((type == PCI_EXP_TYPE_ENDPOINT) || (type == PCI_EXP_TYPE_LEG_END) || (type == PCI_EXP_TYPE_ROOT_INT_EP)) &&
735 (t & PCI_EXP_DEVCAP_FLRESET))
736 printf(" FLReset%c", FLAG(w, PCI_EXP_DEVCTL_FLRESET));
737 printf("\n\t\t\tMaxPayload %d bytes, MaxReadReq %d bytes\n",
738 128 << ((w & PCI_EXP_DEVCTL_PAYLOAD) >> 5),
739 128 << ((w & PCI_EXP_DEVCTL_READRQ) >> 12));
741 w = get_conf_word(d, where + PCI_EXP_DEVSTA);
742 printf("\t\tDevSta:\tCorrErr%c NonFatalErr%c FatalErr%c UnsupReq%c AuxPwr%c TransPend%c\n",
743 FLAG(w, PCI_EXP_DEVSTA_CED),
744 FLAG(w, PCI_EXP_DEVSTA_NFED),
745 FLAG(w, PCI_EXP_DEVSTA_FED),
746 FLAG(w, PCI_EXP_DEVSTA_URD),
747 FLAG(w, PCI_EXP_DEVSTA_AUXPD),
748 FLAG(w, PCI_EXP_DEVSTA_TRPND));
751 static char *link_speed(int speed)
772 static char *link_compare(int type, int sta, int cap)
775 return " (overdriven)";
778 if ((type == PCI_EXP_TYPE_ROOT_PORT) || (type == PCI_EXP_TYPE_DOWNSTREAM) ||
779 (type == PCI_EXP_TYPE_PCIE_BRIDGE))
781 return " (downgraded)";
784 static char *aspm_support(int code)
789 return "not supported";
801 static const char *aspm_enabled(int code)
803 static const char *desc[] = { "Disabled", "L0s Enabled", "L1 Enabled", "L0s L1 Enabled" };
807 static void cap_express_link(struct device *d, int where, int type)
809 u32 t, aspm, cap_speed, cap_width, sta_speed, sta_width;
812 t = get_conf_long(d, where + PCI_EXP_LNKCAP);
813 aspm = (t & PCI_EXP_LNKCAP_ASPM) >> 10;
814 cap_speed = t & PCI_EXP_LNKCAP_SPEED;
815 cap_width = (t & PCI_EXP_LNKCAP_WIDTH) >> 4;
816 printf("\t\tLnkCap:\tPort #%d, Speed %s, Width x%d, ASPM %s",
818 link_speed(cap_speed), cap_width,
822 printf(", Exit Latency ");
824 printf("L0s %s", latency_l0s((t & PCI_EXP_LNKCAP_L0S) >> 12));
826 printf("%sL1 %s", (aspm & 1) ? ", " : "",
827 latency_l1((t & PCI_EXP_LNKCAP_L1) >> 15));
830 printf("\t\t\tClockPM%c Surprise%c LLActRep%c BwNot%c ASPMOptComp%c\n",
831 FLAG(t, PCI_EXP_LNKCAP_CLOCKPM),
832 FLAG(t, PCI_EXP_LNKCAP_SURPRISE),
833 FLAG(t, PCI_EXP_LNKCAP_DLLA),
834 FLAG(t, PCI_EXP_LNKCAP_LBNC),
835 FLAG(t, PCI_EXP_LNKCAP_AOC));
837 w = get_conf_word(d, where + PCI_EXP_LNKCTL);
838 printf("\t\tLnkCtl:\tASPM %s;", aspm_enabled(w & PCI_EXP_LNKCTL_ASPM));
839 if ((type == PCI_EXP_TYPE_ROOT_PORT) || (type == PCI_EXP_TYPE_ENDPOINT) ||
840 (type == PCI_EXP_TYPE_LEG_END) || (type == PCI_EXP_TYPE_PCI_BRIDGE))
841 printf(" RCB %d bytes,", w & PCI_EXP_LNKCTL_RCB ? 128 : 64);
842 printf(" Disabled%c CommClk%c\n\t\t\tExtSynch%c ClockPM%c AutWidDis%c BWInt%c AutBWInt%c\n",
843 FLAG(w, PCI_EXP_LNKCTL_DISABLE),
844 FLAG(w, PCI_EXP_LNKCTL_CLOCK),
845 FLAG(w, PCI_EXP_LNKCTL_XSYNCH),
846 FLAG(w, PCI_EXP_LNKCTL_CLOCKPM),
847 FLAG(w, PCI_EXP_LNKCTL_HWAUTWD),
848 FLAG(w, PCI_EXP_LNKCTL_BWMIE),
849 FLAG(w, PCI_EXP_LNKCTL_AUTBWIE));
851 w = get_conf_word(d, where + PCI_EXP_LNKSTA);
852 sta_speed = w & PCI_EXP_LNKSTA_SPEED;
853 sta_width = (w & PCI_EXP_LNKSTA_WIDTH) >> 4;
854 printf("\t\tLnkSta:\tSpeed %s%s, Width x%d%s\n",
855 link_speed(sta_speed),
856 link_compare(type, sta_speed, cap_speed),
858 link_compare(type, sta_width, cap_width));
859 printf("\t\t\tTrErr%c Train%c SlotClk%c DLActive%c BWMgmt%c ABWMgmt%c\n",
860 FLAG(w, PCI_EXP_LNKSTA_TR_ERR),
861 FLAG(w, PCI_EXP_LNKSTA_TRAIN),
862 FLAG(w, PCI_EXP_LNKSTA_SL_CLK),
863 FLAG(w, PCI_EXP_LNKSTA_DL_ACT),
864 FLAG(w, PCI_EXP_LNKSTA_BWMGMT),
865 FLAG(w, PCI_EXP_LNKSTA_AUTBW));
868 static const char *indicator(int code)
870 static const char *names[] = { "Unknown", "On", "Blink", "Off" };
874 static void cap_express_slot(struct device *d, int where)
879 t = get_conf_long(d, where + PCI_EXP_SLTCAP);
880 printf("\t\tSltCap:\tAttnBtn%c PwrCtrl%c MRL%c AttnInd%c PwrInd%c HotPlug%c Surprise%c\n",
881 FLAG(t, PCI_EXP_SLTCAP_ATNB),
882 FLAG(t, PCI_EXP_SLTCAP_PWRC),
883 FLAG(t, PCI_EXP_SLTCAP_MRL),
884 FLAG(t, PCI_EXP_SLTCAP_ATNI),
885 FLAG(t, PCI_EXP_SLTCAP_PWRI),
886 FLAG(t, PCI_EXP_SLTCAP_HPC),
887 FLAG(t, PCI_EXP_SLTCAP_HPS));
888 printf("\t\t\tSlot #%d, PowerLimit ",
889 (t & PCI_EXP_SLTCAP_PSN) >> 19);
890 show_power_limit((t & PCI_EXP_SLTCAP_PWR_VAL) >> 7, (t & PCI_EXP_SLTCAP_PWR_SCL) >> 15);
891 printf("; Interlock%c NoCompl%c\n",
892 FLAG(t, PCI_EXP_SLTCAP_INTERLOCK),
893 FLAG(t, PCI_EXP_SLTCAP_NOCMDCOMP));
895 w = get_conf_word(d, where + PCI_EXP_SLTCTL);
896 printf("\t\tSltCtl:\tEnable: AttnBtn%c PwrFlt%c MRL%c PresDet%c CmdCplt%c HPIrq%c LinkChg%c\n",
897 FLAG(w, PCI_EXP_SLTCTL_ATNB),
898 FLAG(w, PCI_EXP_SLTCTL_PWRF),
899 FLAG(w, PCI_EXP_SLTCTL_MRLS),
900 FLAG(w, PCI_EXP_SLTCTL_PRSD),
901 FLAG(w, PCI_EXP_SLTCTL_CMDC),
902 FLAG(w, PCI_EXP_SLTCTL_HPIE),
903 FLAG(w, PCI_EXP_SLTCTL_LLCHG));
904 printf("\t\t\tControl: AttnInd %s, PwrInd %s, Power%c Interlock%c\n",
905 indicator((w & PCI_EXP_SLTCTL_ATNI) >> 6),
906 indicator((w & PCI_EXP_SLTCTL_PWRI) >> 8),
907 FLAG(w, PCI_EXP_SLTCTL_PWRC),
908 FLAG(w, PCI_EXP_SLTCTL_INTERLOCK));
910 w = get_conf_word(d, where + PCI_EXP_SLTSTA);
911 printf("\t\tSltSta:\tStatus: AttnBtn%c PowerFlt%c MRL%c CmdCplt%c PresDet%c Interlock%c\n",
912 FLAG(w, PCI_EXP_SLTSTA_ATNB),
913 FLAG(w, PCI_EXP_SLTSTA_PWRF),
914 FLAG(w, PCI_EXP_SLTSTA_MRL_ST),
915 FLAG(w, PCI_EXP_SLTSTA_CMDC),
916 FLAG(w, PCI_EXP_SLTSTA_PRES),
917 FLAG(w, PCI_EXP_SLTSTA_INTERLOCK));
918 printf("\t\t\tChanged: MRL%c PresDet%c LinkState%c\n",
919 FLAG(w, PCI_EXP_SLTSTA_MRLS),
920 FLAG(w, PCI_EXP_SLTSTA_PRSD),
921 FLAG(w, PCI_EXP_SLTSTA_LLCHG));
924 static void cap_express_root(struct device *d, int where)
928 w = get_conf_word(d, where + PCI_EXP_RTCAP);
929 printf("\t\tRootCap: CRSVisible%c\n",
930 FLAG(w, PCI_EXP_RTCAP_CRSVIS));
932 w = get_conf_word(d, where + PCI_EXP_RTCTL);
933 printf("\t\tRootCtl: ErrCorrectable%c ErrNon-Fatal%c ErrFatal%c PMEIntEna%c CRSVisible%c\n",
934 FLAG(w, PCI_EXP_RTCTL_SECEE),
935 FLAG(w, PCI_EXP_RTCTL_SENFEE),
936 FLAG(w, PCI_EXP_RTCTL_SEFEE),
937 FLAG(w, PCI_EXP_RTCTL_PMEIE),
938 FLAG(w, PCI_EXP_RTCTL_CRSVIS));
940 w = get_conf_long(d, where + PCI_EXP_RTSTA);
941 printf("\t\tRootSta: PME ReqID %04x, PMEStatus%c PMEPending%c\n",
942 w & PCI_EXP_RTSTA_PME_REQID,
943 FLAG(w, PCI_EXP_RTSTA_PME_STATUS),
944 FLAG(w, PCI_EXP_RTSTA_PME_PENDING));
947 static const char *cap_express_dev2_timeout_range(int type)
949 /* Decode Completion Timeout Ranges. */
953 return "Not Supported";
973 static const char *cap_express_dev2_timeout_value(int type)
975 /* Decode Completion Timeout Value. */
979 return "50us to 50ms";
981 return "50us to 100us";
983 return "1ms to 10ms";
985 return "16ms to 55ms";
987 return "65ms to 210ms";
989 return "260ms to 900ms";
1001 static const char *cap_express_devcap2_obff(int obff)
1006 return "Via message";
1010 return "Via message/WAKE#";
1012 return "Not Supported";
1016 static const char *cap_express_devcap2_epr(int epr)
1021 return "Dev Specific";
1023 return "Form Factor Dev Specific";
1027 return "Not Supported";
1031 static const char *cap_express_devcap2_lncls(int lncls)
1036 return "64byte cachelines";
1038 return "128byte cachelines";
1042 return "Not Supported";
1046 static const char *cap_express_devcap2_tphcomp(int tph)
1051 return "TPHComp+ ExtTPHComp-";
1053 /* Reserved; intentionally left blank */
1056 return "TPHComp+ ExtTPHComp+";
1058 return "TPHComp- ExtTPHComp-";
1062 static const char *cap_express_devctl2_obff(int obff)
1069 return "Via message A";
1071 return "Via message B";
1080 device_has_memory_space_bar(struct device *d)
1082 struct pci_dev *p = d->dev;
1086 if (p->base_addr[i] || p->size[i])
1088 if (!(p->base_addr[i] & PCI_BASE_ADDRESS_SPACE_IO))
1097 static void cap_express_dev2(struct device *d, int where, int type)
1101 int has_mem_bar = device_has_memory_space_bar(d);
1103 l = get_conf_long(d, where + PCI_EXP_DEVCAP2);
1104 printf("\t\tDevCap2: Completion Timeout: %s, TimeoutDis%c NROPrPrP%c LTR%c",
1105 cap_express_dev2_timeout_range(PCI_EXP_DEVCAP2_TIMEOUT_RANGE(l)),
1106 FLAG(l, PCI_EXP_DEVCAP2_TIMEOUT_DIS),
1107 FLAG(l, PCI_EXP_DEVCAP2_NROPRPRP),
1108 FLAG(l, PCI_EXP_DEVCAP2_LTR));
1109 printf("\n\t\t\t 10BitTagComp%c 10BitTagReq%c OBFF %s, ExtFmt%c EETLPPrefix%c",
1110 FLAG(l, PCI_EXP_DEVCAP2_10BIT_TAG_COMP),
1111 FLAG(l, PCI_EXP_DEVCAP2_10BIT_TAG_REQ),
1112 cap_express_devcap2_obff(PCI_EXP_DEVCAP2_OBFF(l)),
1113 FLAG(l, PCI_EXP_DEVCAP2_EXTFMT),
1114 FLAG(l, PCI_EXP_DEVCAP2_EE_TLP));
1116 if (PCI_EXP_DEVCAP2_EE_TLP == (l & PCI_EXP_DEVCAP2_EE_TLP))
1118 printf(", MaxEETLPPrefixes %d",
1119 PCI_EXP_DEVCAP2_MEE_TLP(l) ? PCI_EXP_DEVCAP2_MEE_TLP(l) : 4);
1122 printf("\n\t\t\t EmergencyPowerReduction %s, EmergencyPowerReductionInit%c",
1123 cap_express_devcap2_epr(PCI_EXP_DEVCAP2_EPR(l)),
1124 FLAG(l, PCI_EXP_DEVCAP2_EPR_INIT));
1125 printf("\n\t\t\t FRS%c", FLAG(l, PCI_EXP_DEVCAP2_FRS));
1127 if (type == PCI_EXP_TYPE_ROOT_PORT)
1128 printf(" LN System CLS %s,",
1129 cap_express_devcap2_lncls(PCI_EXP_DEVCAP2_LN_CLS(l)));
1131 if (type == PCI_EXP_TYPE_ROOT_PORT || type == PCI_EXP_TYPE_ENDPOINT)
1132 printf(" %s", cap_express_devcap2_tphcomp(PCI_EXP_DEVCAP2_TPH_COMP(l)));
1134 if (type == PCI_EXP_TYPE_ROOT_PORT || type == PCI_EXP_TYPE_DOWNSTREAM)
1135 printf(" ARIFwd%c\n", FLAG(l, PCI_EXP_DEVCAP2_ARI));
1138 if (type == PCI_EXP_TYPE_ROOT_PORT || type == PCI_EXP_TYPE_UPSTREAM ||
1139 type == PCI_EXP_TYPE_DOWNSTREAM || has_mem_bar)
1141 printf("\t\t\t AtomicOpsCap:");
1142 if (type == PCI_EXP_TYPE_ROOT_PORT || type == PCI_EXP_TYPE_UPSTREAM ||
1143 type == PCI_EXP_TYPE_DOWNSTREAM)
1144 printf(" Routing%c", FLAG(l, PCI_EXP_DEVCAP2_ATOMICOP_ROUTING));
1145 if (type == PCI_EXP_TYPE_ROOT_PORT || has_mem_bar)
1146 printf(" 32bit%c 64bit%c 128bitCAS%c",
1147 FLAG(l, PCI_EXP_DEVCAP2_32BIT_ATOMICOP_COMP),
1148 FLAG(l, PCI_EXP_DEVCAP2_64BIT_ATOMICOP_COMP),
1149 FLAG(l, PCI_EXP_DEVCAP2_128BIT_CAS_COMP));
1153 w = get_conf_word(d, where + PCI_EXP_DEVCTL2);
1154 printf("\t\tDevCtl2: Completion Timeout: %s, TimeoutDis%c LTR%c 10BitTagReq%c OBFF %s,",
1155 cap_express_dev2_timeout_value(PCI_EXP_DEVCTL2_TIMEOUT_VALUE(w)),
1156 FLAG(w, PCI_EXP_DEVCTL2_TIMEOUT_DIS),
1157 FLAG(w, PCI_EXP_DEVCTL2_LTR),
1158 FLAG(w, PCI_EXP_DEVCTL2_10BIT_TAG_REQ),
1159 cap_express_devctl2_obff(PCI_EXP_DEVCTL2_OBFF(w)));
1160 if (type == PCI_EXP_TYPE_ROOT_PORT || type == PCI_EXP_TYPE_DOWNSTREAM)
1161 printf(" ARIFwd%c\n", FLAG(w, PCI_EXP_DEVCTL2_ARI));
1164 if (type == PCI_EXP_TYPE_ROOT_PORT || type == PCI_EXP_TYPE_UPSTREAM ||
1165 type == PCI_EXP_TYPE_DOWNSTREAM || type == PCI_EXP_TYPE_ENDPOINT ||
1166 type == PCI_EXP_TYPE_ROOT_INT_EP || type == PCI_EXP_TYPE_LEG_END)
1168 printf("\t\t\t AtomicOpsCtl:");
1169 if (type == PCI_EXP_TYPE_ROOT_PORT || type == PCI_EXP_TYPE_ENDPOINT ||
1170 type == PCI_EXP_TYPE_ROOT_INT_EP || type == PCI_EXP_TYPE_LEG_END)
1171 printf(" ReqEn%c", FLAG(w, PCI_EXP_DEVCTL2_ATOMICOP_REQUESTER_EN));
1172 if (type == PCI_EXP_TYPE_ROOT_PORT || type == PCI_EXP_TYPE_UPSTREAM ||
1173 type == PCI_EXP_TYPE_DOWNSTREAM)
1174 printf(" EgressBlck%c", FLAG(w, PCI_EXP_DEVCTL2_ATOMICOP_EGRESS_BLOCK));
1179 static const char *cap_express_link2_speed_cap(int vector)
1182 * Per PCIe r5.0, sec 8.2.1, a device must support 2.5GT/s and is not
1183 * permitted to skip support for any data rates between 2.5GT/s and the
1184 * highest supported rate.
1189 return "2.5-32GT/s";
1191 return "2.5-16GT/s";
1202 static const char *cap_express_link2_speed(int type)
1206 case 0: /* hardwire to 0 means only the 2.5GT/s is supported */
1224 static const char *cap_express_link2_deemphasis(int type)
1237 static const char *cap_express_link2_compliance_preset(int type)
1242 return "-6dB de-emphasis, 0dB preshoot";
1244 return "-3.5dB de-emphasis, 0dB preshoot";
1246 return "-4.4dB de-emphasis, 0dB preshoot";
1248 return "-2.5dB de-emphasis, 0dB preshoot";
1250 return "0dB de-emphasis, 0dB preshoot";
1252 return "0dB de-emphasis, 1.9dB preshoot";
1254 return "0dB de-emphasis, 2.5dB preshoot";
1256 return "-6.0dB de-emphasis, 3.5dB preshoot";
1258 return "-3.5dB de-emphasis, 3.5dB preshoot";
1260 return "0dB de-emphasis, 3.5dB preshoot";
1266 static const char *cap_express_link2_transmargin(int type)
1271 return "Normal Operating Range";
1273 return "800-1200mV(full-swing)/400-700mV(half-swing)";
1278 return "200-400mV(full-swing)/100-200mV(half-swing)";
1284 static const char *cap_express_link2_crosslink_res(int crosslink)
1289 return "unsupported";
1291 return "Upstream Port";
1293 return "Downstream Port";
1295 return "incomplete";
1299 static const char *cap_express_link2_component(int presence)
1304 return "Link Down - Not Determined";
1306 return "Link Down - Not Present";
1308 return "Link Down - Present";
1310 return "Link Up - Present";
1312 return "Link Up - Present and DRS Received";
1318 static void cap_express_link2(struct device *d, int where, int type)
1323 if (!((type == PCI_EXP_TYPE_ENDPOINT || type == PCI_EXP_TYPE_LEG_END) &&
1324 (d->dev->dev != 0 || d->dev->func != 0))) {
1325 /* Link Capabilities 2 was reserved before PCIe r3.0 */
1326 l = get_conf_long(d, where + PCI_EXP_LNKCAP2);
1328 printf("\t\tLnkCap2: Supported Link Speeds: %s, Crosslink%c "
1329 "Retimer%c 2Retimers%c DRS%c\n",
1330 cap_express_link2_speed_cap(PCI_EXP_LNKCAP2_SPEED(l)),
1331 FLAG(l, PCI_EXP_LNKCAP2_CROSSLINK),
1332 FLAG(l, PCI_EXP_LNKCAP2_RETIMER),
1333 FLAG(l, PCI_EXP_LNKCAP2_2RETIMERS),
1334 FLAG(l, PCI_EXP_LNKCAP2_DRS));
1337 w = get_conf_word(d, where + PCI_EXP_LNKCTL2);
1338 printf("\t\tLnkCtl2: Target Link Speed: %s, EnterCompliance%c SpeedDis%c",
1339 cap_express_link2_speed(PCI_EXP_LNKCTL2_SPEED(w)),
1340 FLAG(w, PCI_EXP_LNKCTL2_CMPLNC),
1341 FLAG(w, PCI_EXP_LNKCTL2_SPEED_DIS));
1342 if (type == PCI_EXP_TYPE_DOWNSTREAM)
1343 printf(", Selectable De-emphasis: %s",
1344 cap_express_link2_deemphasis(PCI_EXP_LNKCTL2_DEEMPHASIS(w)));
1346 "\t\t\t Transmit Margin: %s, EnterModifiedCompliance%c ComplianceSOS%c\n"
1347 "\t\t\t Compliance Preset/De-emphasis: %s\n",
1348 cap_express_link2_transmargin(PCI_EXP_LNKCTL2_MARGIN(w)),
1349 FLAG(w, PCI_EXP_LNKCTL2_MOD_CMPLNC),
1350 FLAG(w, PCI_EXP_LNKCTL2_CMPLNC_SOS),
1351 cap_express_link2_compliance_preset(PCI_EXP_LNKCTL2_COM_DEEMPHASIS(w)));
1354 w = get_conf_word(d, where + PCI_EXP_LNKSTA2);
1355 printf("\t\tLnkSta2: Current De-emphasis Level: %s, EqualizationComplete%c EqualizationPhase1%c\n"
1356 "\t\t\t EqualizationPhase2%c EqualizationPhase3%c LinkEqualizationRequest%c\n"
1357 "\t\t\t Retimer%c 2Retimers%c CrosslinkRes: %s",
1358 cap_express_link2_deemphasis(PCI_EXP_LINKSTA2_DEEMPHASIS(w)),
1359 FLAG(w, PCI_EXP_LINKSTA2_EQU_COMP),
1360 FLAG(w, PCI_EXP_LINKSTA2_EQU_PHASE1),
1361 FLAG(w, PCI_EXP_LINKSTA2_EQU_PHASE2),
1362 FLAG(w, PCI_EXP_LINKSTA2_EQU_PHASE3),
1363 FLAG(w, PCI_EXP_LINKSTA2_EQU_REQ),
1364 FLAG(w, PCI_EXP_LINKSTA2_RETIMER),
1365 FLAG(w, PCI_EXP_LINKSTA2_2RETIMERS),
1366 cap_express_link2_crosslink_res(PCI_EXP_LINKSTA2_CROSSLINK(w)));
1368 if (exp_downstream_port(type) && (l & PCI_EXP_LNKCAP2_DRS)) {
1370 "\t\t\t DownstreamComp: %s\n",
1371 FLAG(w, PCI_EXP_LINKSTA2_DRS_RCVD),
1372 cap_express_link2_component(PCI_EXP_LINKSTA2_COMPONENT(w)));
1377 static void cap_express_slot2(struct device *d UNUSED, int where UNUSED)
1379 /* No capabilities that require this field in PCIe rev2.0 spec. */
1383 cap_express(struct device *d, int where, int cap)
1385 int type = (cap & PCI_EXP_FLAGS_TYPE) >> 4;
1392 printf("(v%d) ", cap & PCI_EXP_FLAGS_VERS);
1395 case PCI_EXP_TYPE_ENDPOINT:
1398 case PCI_EXP_TYPE_LEG_END:
1399 printf("Legacy Endpoint");
1401 case PCI_EXP_TYPE_ROOT_PORT:
1402 slot = cap & PCI_EXP_FLAGS_SLOT;
1403 printf("Root Port (Slot%c)", FLAG(cap, PCI_EXP_FLAGS_SLOT));
1405 case PCI_EXP_TYPE_UPSTREAM:
1406 printf("Upstream Port");
1408 case PCI_EXP_TYPE_DOWNSTREAM:
1409 slot = cap & PCI_EXP_FLAGS_SLOT;
1410 printf("Downstream Port (Slot%c)", FLAG(cap, PCI_EXP_FLAGS_SLOT));
1412 case PCI_EXP_TYPE_PCI_BRIDGE:
1413 printf("PCI-Express to PCI/PCI-X Bridge");
1415 case PCI_EXP_TYPE_PCIE_BRIDGE:
1416 slot = cap & PCI_EXP_FLAGS_SLOT;
1417 printf("PCI/PCI-X to PCI-Express Bridge (Slot%c)",
1418 FLAG(cap, PCI_EXP_FLAGS_SLOT));
1420 case PCI_EXP_TYPE_ROOT_INT_EP:
1422 printf("Root Complex Integrated Endpoint");
1424 case PCI_EXP_TYPE_ROOT_EC:
1426 printf("Root Complex Event Collector");
1429 printf("Unknown type %d", type);
1431 printf(", MSI %02x\n", (cap & PCI_EXP_FLAGS_IRQ) >> 9);
1438 if (type == PCI_EXP_TYPE_ROOT_PORT || type == PCI_EXP_TYPE_ROOT_EC)
1440 if (!config_fetch(d, where + PCI_EXP_DEVCAP, size))
1443 cap_express_dev(d, where, type);
1445 cap_express_link(d, where, type);
1447 cap_express_slot(d, where);
1448 if (type == PCI_EXP_TYPE_ROOT_PORT || type == PCI_EXP_TYPE_ROOT_EC)
1449 cap_express_root(d, where);
1451 if ((cap & PCI_EXP_FLAGS_VERS) < 2)
1457 if (!config_fetch(d, where + PCI_EXP_DEVCAP2, size))
1460 cap_express_dev2(d, where, type);
1462 cap_express_link2(d, where, type);
1464 cap_express_slot2(d, where);
1469 cap_msix(struct device *d, int where, int cap)
1473 printf("MSI-X: Enable%c Count=%d Masked%c\n",
1474 FLAG(cap, PCI_MSIX_ENABLE),
1475 (cap & PCI_MSIX_TABSIZE) + 1,
1476 FLAG(cap, PCI_MSIX_MASK));
1477 if (verbose < 2 || !config_fetch(d, where + PCI_MSIX_TABLE, 8))
1480 off = get_conf_long(d, where + PCI_MSIX_TABLE);
1481 printf("\t\tVector table: BAR=%d offset=%08x\n",
1482 off & PCI_MSIX_BIR, off & ~PCI_MSIX_BIR);
1483 off = get_conf_long(d, where + PCI_MSIX_PBA);
1484 printf("\t\tPBA: BAR=%d offset=%08x\n",
1485 off & PCI_MSIX_BIR, off & ~PCI_MSIX_BIR);
1491 int esr = cap & 0xff;
1494 printf("Slot ID: %d slots, First%c, chassis %02x\n",
1495 esr & PCI_SID_ESR_NSLOTS,
1496 FLAG(esr, PCI_SID_ESR_FIC),
1501 cap_ssvid(struct device *d, int where)
1503 u16 subsys_v, subsys_d;
1504 char ssnamebuf[256];
1506 if (!config_fetch(d, where, 8))
1508 subsys_v = get_conf_word(d, where + PCI_SSVID_VENDOR);
1509 subsys_d = get_conf_word(d, where + PCI_SSVID_DEVICE);
1510 printf("Subsystem: %s\n",
1511 pci_lookup_name(pacc, ssnamebuf, sizeof(ssnamebuf),
1512 PCI_LOOKUP_SUBSYSTEM | PCI_LOOKUP_VENDOR | PCI_LOOKUP_DEVICE,
1513 d->dev->vendor_id, d->dev->device_id, subsys_v, subsys_d));
1517 cap_debug_port(int cap)
1519 int bar = cap >> 13;
1520 int pos = cap & 0x1fff;
1521 printf("Debug port: BAR=%d offset=%04x\n", bar, pos);
1525 cap_af(struct device *d, int where)
1529 printf("PCI Advanced Features\n");
1530 if (verbose < 2 || !config_fetch(d, where + PCI_AF_CAP, 3))
1533 reg = get_conf_byte(d, where + PCI_AF_CAP);
1534 printf("\t\tAFCap: TP%c FLR%c\n", FLAG(reg, PCI_AF_CAP_TP),
1535 FLAG(reg, PCI_AF_CAP_FLR));
1536 reg = get_conf_byte(d, where + PCI_AF_CTRL);
1537 printf("\t\tAFCtrl: FLR%c\n", FLAG(reg, PCI_AF_CTRL_FLR));
1538 reg = get_conf_byte(d, where + PCI_AF_STATUS);
1539 printf("\t\tAFStatus: TP%c\n", FLAG(reg, PCI_AF_STATUS_TP));
1543 cap_sata_hba(struct device *d, int where, int cap)
1548 printf("SATA HBA v%d.%d", BITS(cap, 4, 4), BITS(cap, 0, 4));
1549 if (verbose < 2 || !config_fetch(d, where + PCI_SATA_HBA_BARS, 4))
1555 bars = get_conf_long(d, where + PCI_SATA_HBA_BARS);
1556 bar = BITS(bars, 0, 4);
1557 if (bar >= 4 && bar <= 9)
1558 printf(" BAR%d Offset=%08x\n", bar - 4, BITS(bars, 4, 20));
1560 printf(" InCfgSpace\n");
1562 printf(" BAR??%d\n", bar);
1565 static const char *cap_ea_property(int p, int is_secondary)
1569 return "memory space, non-prefetchable";
1571 return "memory space, prefetchable";
1575 return "VF memory space, prefetchable";
1577 return "VF memory space, non-prefetchable";
1579 return "allocation behind bridge, non-prefetchable memory";
1581 return "allocation behind bridge, prefetchable memory";
1583 return "allocation behind bridge, I/O space";
1585 return "memory space resource unavailable for use";
1587 return "I/O space resource unavailable for use";
1590 return "entry unavailable for use, PrimaryProperties should be used";
1592 return "entry unavailable for use";
1598 static void cap_ea(struct device *d, int where, int cap)
1601 int entry_base = where + 4;
1602 int num_entries = BITS(cap, 0, 6);
1603 u8 htype = get_conf_byte(d, PCI_HEADER_TYPE) & 0x7f;
1605 printf("Enhanced Allocation (EA): NumEntries=%u", num_entries);
1606 if (htype == PCI_HEADER_TYPE_BRIDGE) {
1607 byte fixed_sub, fixed_sec;
1610 if (!config_fetch(d, where + 4, 2)) {
1614 fixed_sec = get_conf_byte(d, where + PCI_EA_CAP_TYPE1_SECONDARY);
1615 fixed_sub = get_conf_byte(d, where + PCI_EA_CAP_TYPE1_SUBORDINATE);
1616 printf(", secondary=%d, subordinate=%d", fixed_sec, fixed_sub);
1622 for (entry = 0; entry < num_entries; entry++) {
1623 int max_offset_high_pos, has_base_high, has_max_offset_high;
1625 u32 base, max_offset;
1626 int es, bei, pp, sp;
1627 const char *prop_text;
1629 if (!config_fetch(d, entry_base, 4))
1631 entry_header = get_conf_long(d, entry_base);
1632 es = BITS(entry_header, 0, 3);
1633 bei = BITS(entry_header, 4, 4);
1634 pp = BITS(entry_header, 8, 8);
1635 sp = BITS(entry_header, 16, 8);
1636 if (!config_fetch(d, entry_base + 4, es * 4))
1638 printf("\t\tEntry %u: Enable%c Writable%c EntrySize=%u\n", entry,
1639 FLAG(entry_header, PCI_EA_CAP_ENT_ENABLE),
1640 FLAG(entry_header, PCI_EA_CAP_ENT_WRITABLE), es);
1641 printf("\t\t\t BAR Equivalent Indicator: ");
1649 printf("BAR %u", bei);
1652 printf("resource behind function");
1655 printf("not indicated");
1658 printf("expansion ROM");
1666 printf("VF-BAR %u", bei - 9);
1674 prop_text = cap_ea_property(pp, 0);
1675 printf("\t\t\t PrimaryProperties: ");
1677 printf("%s\n", prop_text);
1679 printf("[%02x]\n", pp);
1681 prop_text = cap_ea_property(sp, 1);
1682 printf("\t\t\t SecondaryProperties: ");
1684 printf("%s\n", prop_text);
1686 printf("[%02x]\n", sp);
1688 base = get_conf_long(d, entry_base + 4);
1689 has_base_high = ((base & 2) != 0);
1692 max_offset = get_conf_long(d, entry_base + 8);
1693 has_max_offset_high = ((max_offset & 2) != 0);
1695 max_offset_high_pos = entry_base + 12;
1697 printf("\t\t\t Base: ");
1698 if (has_base_high) {
1699 u32 base_high = get_conf_long(d, entry_base + 12);
1701 printf("%x", base_high);
1702 max_offset_high_pos += 4;
1704 printf("%08x\n", base);
1706 printf("\t\t\t MaxOffset: ");
1707 if (has_max_offset_high) {
1708 u32 max_offset_high = get_conf_long(d, max_offset_high_pos);
1710 printf("%x", max_offset_high);
1712 printf("%08x\n", max_offset);
1714 entry_base += 4 + 4 * es;
1719 show_caps(struct device *d, int where)
1721 int can_have_ext_caps = 0;
1724 if (get_conf_word(d, PCI_STATUS) & PCI_STATUS_CAP_LIST)
1726 byte been_there[256];
1727 where = get_conf_byte(d, where) & ~3;
1728 memset(been_there, 0, 256);
1732 printf("\tCapabilities: ");
1733 if (!config_fetch(d, where, 4))
1735 puts("<access denied>");
1738 id = get_conf_byte(d, where + PCI_CAP_LIST_ID);
1739 next = get_conf_byte(d, where + PCI_CAP_LIST_NEXT) & ~3;
1740 cap = get_conf_word(d, where + PCI_CAP_FLAGS);
1741 printf("[%02x] ", where);
1742 if (been_there[where]++)
1744 printf("<chain looped>\n");
1749 printf("<chain broken>\n");
1754 case PCI_CAP_ID_NULL:
1758 cap_pm(d, where, cap);
1760 case PCI_CAP_ID_AGP:
1761 cap_agp(d, where, cap);
1763 case PCI_CAP_ID_VPD:
1766 case PCI_CAP_ID_SLOTID:
1769 case PCI_CAP_ID_MSI:
1770 cap_msi(d, where, cap);
1772 case PCI_CAP_ID_CHSWP:
1773 printf("CompactPCI hot-swap <?>\n");
1775 case PCI_CAP_ID_PCIX:
1777 can_have_ext_caps = 1;
1780 cap_ht(d, where, cap);
1782 case PCI_CAP_ID_VNDR:
1783 show_vendor_caps(d, where, cap);
1785 case PCI_CAP_ID_DBG:
1786 cap_debug_port(cap);
1788 case PCI_CAP_ID_CCRC:
1789 printf("CompactPCI central resource control <?>\n");
1791 case PCI_CAP_ID_HOTPLUG:
1792 printf("Hot-plug capable\n");
1794 case PCI_CAP_ID_SSVID:
1795 cap_ssvid(d, where);
1797 case PCI_CAP_ID_AGP3:
1798 printf("AGP3 <?>\n");
1800 case PCI_CAP_ID_SECURE:
1801 printf("Secure device <?>\n");
1803 case PCI_CAP_ID_EXP:
1804 type = cap_express(d, where, cap);
1805 can_have_ext_caps = 1;
1807 case PCI_CAP_ID_MSIX:
1808 cap_msix(d, where, cap);
1810 case PCI_CAP_ID_SATA:
1811 cap_sata_hba(d, where, cap);
1817 cap_ea(d, where, cap);
1820 printf("Capability ID %#02x [%04x]\n", id, cap);
1825 if (can_have_ext_caps)
1826 show_ext_caps(d, type);