2 * The PCI Utilities -- List All PCI Devices
4 * Copyright (c) 1997--2003 Martin Mares <mj@ucw.cz>
6 * Can be freely distributed and used under the terms of the GNU GPL.
19 static int verbose; /* Show detailed information */
20 static int buscentric_view; /* Show bus addresses/IRQ's instead of CPU-visible ones */
21 static int show_hex; /* Show contents of config space as hexadecimal numbers */
22 static struct pci_filter filter; /* Device filter */
23 static int show_tree; /* Show bus tree */
24 static int machine_readable; /* Generate machine-readable output */
25 static int map_mode; /* Bus mapping mode enabled */
27 static char options[] = "nvbxs:d:ti:mgM" GENERIC_OPTIONS ;
29 static char help_msg[] = "\
30 Usage: lspci [<switches>]\n\
33 -n\t\tShow numeric ID's\n\
34 -b\t\tBus-centric view (PCI addresses and IRQ's instead of those seen by the CPU)\n\
35 -x\t\tShow hex-dump of the standard portion of config space\n\
36 -xxx\t\tShow hex-dump of the whole config space (dangerous; root only)\n\
37 -s [[[[<domain>]:]<bus>]:][<slot>][.[<func>]]\tShow only devices in selected slots\n\
38 -d [<vendor>]:[<device>]\tShow only selected devices\n\
39 -t\t\tShow bus tree\n\
40 -m\t\tProduce machine-readable output\n\
41 -i <file>\tUse specified ID database instead of %s\n\
42 -M\t\tEnable `bus mapping' mode (dangerous; root only)\n"
46 /* Communication with libpci */
48 static struct pci_access *pacc;
51 * If we aren't being compiled by GCC, use malloc() instead of alloca().
52 * This increases our memory footprint, but only slightly since we don't
60 /* Our view of the PCI bus */
65 unsigned int config_cnt;
69 static struct device *first_dev;
71 static struct device *
72 scan_device(struct pci_dev *p)
74 int how_much = (show_hex > 2) ? 256 : 64;
77 if (!pci_filter_match(&filter, p))
79 d = xmalloc(sizeof(struct device));
82 if (!pci_read_block(p, 0, d->config, how_much))
83 die("Unable to read %d bytes of configuration space.", how_much);
84 if (how_much < 128 && (d->config[PCI_HEADER_TYPE] & 0x7f) == PCI_HEADER_TYPE_CARDBUS)
86 /* For cardbus bridges, we need to fetch 64 bytes more to get the full standard header... */
87 if (!pci_read_block(p, 64, d->config+64, 64))
88 die("Unable to read cardbus bridge extension data.");
91 d->config_cnt = how_much;
92 pci_setup_cache(p, d->config, d->config_cnt);
93 pci_fill_info(p, PCI_FILL_IDENT | PCI_FILL_IRQ | PCI_FILL_BASES | PCI_FILL_ROM_BASE | PCI_FILL_SIZES);
104 for(p=pacc->devices; p; p=p->next)
105 if (d = scan_device(p))
115 static int is_root = -1;
118 is_root = !geteuid();
123 config_fetch(struct device *d, unsigned int pos, unsigned int len)
125 if (pos + len < d->config_cnt)
127 if (pacc->method != PCI_ACCESS_DUMP && !check_root())
129 return pci_read_block(d->dev, pos, d->config + pos, len);
132 /* Config space accesses */
135 get_conf_byte(struct device *d, unsigned int pos)
137 return d->config[pos];
141 get_conf_word(struct device *d, unsigned int pos)
143 return d->config[pos] | (d->config[pos+1] << 8);
147 get_conf_long(struct device *d, unsigned int pos)
149 return d->config[pos] |
150 (d->config[pos+1] << 8) |
151 (d->config[pos+2] << 16) |
152 (d->config[pos+3] << 24);
158 compare_them(const void *A, const void *B)
160 const struct pci_dev *a = (*(const struct device **)A)->dev;
161 const struct pci_dev *b = (*(const struct device **)B)->dev;
163 if (a->domain < b->domain)
165 if (a->domain > b->domain)
175 if (a->func < b->func)
177 if (a->func > b->func)
185 struct device **index, **h, **last_dev;
190 for(d=first_dev; d; d=d->next)
192 h = index = alloca(sizeof(struct device *) * cnt);
193 for(d=first_dev; d; d=d->next)
195 qsort(index, cnt, sizeof(struct device *), compare_them);
196 last_dev = &first_dev;
201 last_dev = &(*h)->next;
209 #define FLAG(x,y) ((x & y) ? '+' : '-')
212 show_slot_name(struct device *d)
214 struct pci_dev *p = d->dev;
217 printf("%04x:", p->domain);
218 printf("%02x:%02x.%d", p->bus, p->dev, p->func);
222 show_terse(struct device *d)
225 struct pci_dev *p = d->dev;
226 byte classbuf[128], devbuf[128];
230 pci_lookup_name(pacc, classbuf, sizeof(classbuf),
232 get_conf_word(d, PCI_CLASS_DEVICE), 0, 0, 0),
233 pci_lookup_name(pacc, devbuf, sizeof(devbuf),
234 PCI_LOOKUP_VENDOR | PCI_LOOKUP_DEVICE,
235 p->vendor_id, p->device_id, 0, 0));
236 if (c = get_conf_byte(d, PCI_REVISION_ID))
237 printf(" (rev %02x)", c);
241 c = get_conf_byte(d, PCI_CLASS_PROG);
242 x = pci_lookup_name(pacc, devbuf, sizeof(devbuf),
244 get_conf_word(d, PCI_CLASS_DEVICE), c, 0, 0);
247 printf(" (prog-if %02x", c);
257 show_size(pciaddr_t x)
263 printf("%d", (int) x);
264 else if (x < 1048576)
265 printf("%dK", (int)(x / 1024));
266 else if (x < 0x80000000)
267 printf("%dM", (int)(x / 1048576));
269 printf(PCIADDR_T_FMT, x);
274 show_bases(struct device *d, int cnt)
276 struct pci_dev *p = d->dev;
277 word cmd = get_conf_word(d, PCI_COMMAND);
282 pciaddr_t pos = p->base_addr[i];
283 pciaddr_t len = (p->known_fields & PCI_FILL_SIZES) ? p->size[i] : 0;
284 u32 flg = get_conf_long(d, PCI_BASE_ADDRESS_0 + 4*i);
285 if (flg == 0xffffffff)
287 if (!pos && !flg && !len)
290 printf("\tRegion %d: ", i);
293 if (pos && !flg) /* Reported by the OS, but not by the device */
295 printf("[virtual] ");
298 if (flg & PCI_BASE_ADDRESS_SPACE_IO)
300 pciaddr_t a = pos & PCI_BASE_ADDRESS_IO_MASK;
301 printf("I/O ports at ");
303 printf(PCIADDR_PORT_FMT, a);
304 else if (flg & PCI_BASE_ADDRESS_IO_MASK)
307 printf("<unassigned>");
308 if (!(cmd & PCI_COMMAND_IO))
309 printf(" [disabled]");
313 int t = flg & PCI_BASE_ADDRESS_MEM_TYPE_MASK;
314 pciaddr_t a = pos & PCI_ADDR_MEM_MASK;
318 printf("Memory at ");
319 if (t == PCI_BASE_ADDRESS_MEM_TYPE_64)
323 printf("<invalid-64bit-slot>");
329 z = get_conf_long(d, PCI_BASE_ADDRESS_0 + 4*i);
333 printf("%08x" PCIADDR_T_FMT, z, a);
335 printf("<unassigned>");
343 printf(PCIADDR_T_FMT, a);
345 printf(((flg & PCI_BASE_ADDRESS_MEM_MASK) || z) ? "<ignored>" : "<unassigned>");
347 printf(" (%s, %sprefetchable)",
348 (t == PCI_BASE_ADDRESS_MEM_TYPE_32) ? "32-bit" :
349 (t == PCI_BASE_ADDRESS_MEM_TYPE_64) ? "64-bit" :
350 (t == PCI_BASE_ADDRESS_MEM_TYPE_1M) ? "low-1M" : "type 3",
351 (flg & PCI_BASE_ADDRESS_MEM_PREFETCH) ? "" : "non-");
352 if (!(cmd & PCI_COMMAND_MEMORY))
353 printf(" [disabled]");
361 show_pm(struct device *d, int where, int cap)
364 static int pm_aux_current[8] = { 0, 55, 100, 160, 220, 270, 320, 375 };
366 printf("Power Management version %d\n", cap & PCI_PM_CAP_VER_MASK);
369 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",
370 FLAG(cap, PCI_PM_CAP_PME_CLOCK),
371 FLAG(cap, PCI_PM_CAP_DSI),
372 FLAG(cap, PCI_PM_CAP_D1),
373 FLAG(cap, PCI_PM_CAP_D2),
374 pm_aux_current[(cap >> 6) & 7],
375 FLAG(cap, PCI_PM_CAP_PME_D0),
376 FLAG(cap, PCI_PM_CAP_PME_D1),
377 FLAG(cap, PCI_PM_CAP_PME_D2),
378 FLAG(cap, PCI_PM_CAP_PME_D3_HOT),
379 FLAG(cap, PCI_PM_CAP_PME_D3_COLD));
380 if (!config_fetch(d, where + PCI_PM_CTRL, PCI_PM_SIZEOF - PCI_PM_CTRL))
382 t = get_conf_word(d, where + PCI_PM_CTRL);
383 printf("\t\tStatus: D%d PME-Enable%c DSel=%d DScale=%d PME%c\n",
384 t & PCI_PM_CTRL_STATE_MASK,
385 FLAG(t, PCI_PM_CTRL_PME_ENABLE),
386 (t & PCI_PM_CTRL_DATA_SEL_MASK) >> 9,
387 (t & PCI_PM_CTRL_DATA_SCALE_MASK) >> 13,
388 FLAG(t, PCI_PM_CTRL_PME_STATUS));
389 b = get_conf_byte(d, where + PCI_PM_PPB_EXTENSIONS);
391 printf("\t\tBridge: PM%c B3%c\n",
392 FLAG(t, PCI_PM_BPCC_ENABLE),
393 FLAG(~t, PCI_PM_PPB_B2_B3));
397 format_agp_rate(int rate, char *buf, int agp3)
408 *c++ = '0' + (1 << (i + 2*agp3));
413 strcpy(buf, "<none>");
417 show_agp(struct device *d, int where, int cap)
424 ver = (cap >> 4) & 0x0f;
426 printf("AGP version %x.%x\n", ver, rev);
429 if (!config_fetch(d, where + PCI_AGP_STATUS, PCI_AGP_SIZEOF - PCI_AGP_STATUS))
431 t = get_conf_long(d, where + PCI_AGP_STATUS);
432 if (ver >= 3 && (t & PCI_AGP_STATUS_AGP3))
434 format_agp_rate(t & 7, rate, agp3);
435 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",
436 ((t & PCI_AGP_STATUS_RQ_MASK) >> 24U) + 1,
437 FLAG(t, PCI_AGP_STATUS_ISOCH),
438 ((t & PCI_AGP_STATUS_ARQSZ_MASK) >> 13),
439 ((t & PCI_AGP_STATUS_CAL_MASK) >> 10),
440 FLAG(t, PCI_AGP_STATUS_SBA),
441 FLAG(t, PCI_AGP_STATUS_ITA_COH),
442 FLAG(t, PCI_AGP_STATUS_GART64),
443 FLAG(t, PCI_AGP_STATUS_HTRANS),
444 FLAG(t, PCI_AGP_STATUS_64BIT),
445 FLAG(t, PCI_AGP_STATUS_FW),
446 FLAG(t, PCI_AGP_STATUS_AGP3),
448 t = get_conf_long(d, where + PCI_AGP_COMMAND);
449 format_agp_rate(t & 7, rate, agp3);
450 printf("\t\tCommand: RQ=%d ArqSz=%d Cal=%d SBA%c AGP%c GART64%c 64bit%c FW%c Rate=%s\n",
451 ((t & PCI_AGP_COMMAND_RQ_MASK) >> 24U) + 1,
452 ((t & PCI_AGP_COMMAND_ARQSZ_MASK) >> 13),
453 ((t & PCI_AGP_COMMAND_CAL_MASK) >> 10),
454 FLAG(t, PCI_AGP_COMMAND_SBA),
455 FLAG(t, PCI_AGP_COMMAND_AGP),
456 FLAG(t, PCI_AGP_COMMAND_GART64),
457 FLAG(t, PCI_AGP_COMMAND_64BIT),
458 FLAG(t, PCI_AGP_COMMAND_FW),
463 show_pcix_nobridge(struct device *d, int where)
468 printf("PCI-X non-bridge device.\n");
473 if (!config_fetch(d, where + PCI_PCIX_STATUS, 4))
476 command = get_conf_word(d, where + PCI_PCIX_COMMAND);
477 status = get_conf_long(d, where + PCI_PCIX_STATUS);
478 printf("\t\tCommand: DPERE%c ERO%c RBC=%d OST=%d\n",
479 FLAG(command, PCI_PCIX_COMMAND_DPERE),
480 FLAG(command, PCI_PCIX_COMMAND_ERO),
481 ((command & PCI_PCIX_COMMAND_MAX_MEM_READ_BYTE_COUNT) >> 2U),
482 ((command & PCI_PCIX_COMMAND_MAX_OUTSTANDING_SPLIT_TRANS) >> 4U));
483 printf("\t\tStatus: Bus=%u Dev=%u Func=%u 64bit%c 133MHz%c SCD%c USC%c, DC=%s, DMMRBC=%u, DMOST=%u, DMCRS=%u, RSCEM%c\n",
484 ((status >> 8) & 0xffU), // bus
485 ((status >> 3) & 0x1fU), // dev
486 (status & PCI_PCIX_STATUS_FUNCTION), // function
487 FLAG(status, PCI_PCIX_STATUS_64BIT),
488 FLAG(status, PCI_PCIX_STATUS_133MHZ),
489 FLAG(status, PCI_PCIX_STATUS_SC_DISCARDED),
490 FLAG(status, PCI_PCIX_STATUS_UNEXPECTED_SC),
491 ((status & PCI_PCIX_STATUS_DEVICE_COMPLEXITY) ? "bridge" : "simple"),
492 ((status >> 21) & 3U),
493 ((status >> 23) & 7U),
494 ((status >> 26) & 7U),
495 FLAG(status, PCI_PCIX_STATUS_RCVD_SC_ERR_MESS));
499 show_pcix_bridge(struct device *d, int where)
503 u32 status, upstcr, downstcr;
505 printf("PCI-X bridge device.\n");
510 if (!config_fetch(d, where + PCI_PCIX_BRIDGE_STATUS, 12))
513 secstatus = get_conf_word(d, where + PCI_PCIX_BRIDGE_SEC_STATUS);
514 printf("\t\tSecondary Status: 64bit%c, 133MHz%c, SCD%c, USC%c, SCO%c, SRD%c Freq=%d\n",
515 FLAG(secstatus, PCI_PCIX_BRIDGE_SEC_STATUS_64BIT),
516 FLAG(secstatus, PCI_PCIX_BRIDGE_SEC_STATUS_133MHZ),
517 FLAG(secstatus, PCI_PCIX_BRIDGE_SEC_STATUS_SC_DISCARDED),
518 FLAG(secstatus, PCI_PCIX_BRIDGE_SEC_STATUS_UNEXPECTED_SC),
519 FLAG(secstatus, PCI_PCIX_BRIDGE_SEC_STATUS_SC_OVERRUN),
520 FLAG(secstatus, PCI_PCIX_BRIDGE_SEC_STATUS_SPLIT_REQUEST_DELAYED),
521 ((secstatus >> 6) & 7));
522 status = get_conf_long(d, where + PCI_PCIX_BRIDGE_STATUS);
523 printf("\t\tStatus: Bus=%u Dev=%u Func=%u 64bit%c 133MHz%c SCD%c USC%c, SCO%c, SRD%c\n",
524 ((status >> 8) & 0xff), // bus
525 ((status >> 3) & 0x1f), // dev
526 (status & PCI_PCIX_BRIDGE_STATUS_FUNCTION), // function
527 FLAG(status, PCI_PCIX_BRIDGE_STATUS_64BIT),
528 FLAG(status, PCI_PCIX_BRIDGE_STATUS_133MHZ),
529 FLAG(status, PCI_PCIX_BRIDGE_STATUS_SC_DISCARDED),
530 FLAG(status, PCI_PCIX_BRIDGE_STATUS_UNEXPECTED_SC),
531 FLAG(status, PCI_PCIX_BRIDGE_STATUS_SC_OVERRUN),
532 FLAG(status, PCI_PCIX_BRIDGE_STATUS_SPLIT_REQUEST_DELAYED));
533 upstcr = get_conf_long(d, where + PCI_PCIX_BRIDGE_UPSTREAM_SPLIT_TRANS_CTRL);
534 printf("\t\t: Upstream: Capacity=%u, Commitment Limit=%u\n",
535 (upstcr & PCI_PCIX_BRIDGE_STR_CAPACITY),
536 (upstcr >> 16) & 0xffff);
537 downstcr = get_conf_long(d, where + PCI_PCIX_BRIDGE_DOWNSTREAM_SPLIT_TRANS_CTRL);
538 printf("\t\t: Downstream: Capacity=%u, Commitment Limit=%u\n",
539 (downstcr & PCI_PCIX_BRIDGE_STR_CAPACITY),
540 (downstcr >> 16) & 0xffff);
544 show_pcix(struct device *d, int where)
546 switch (get_conf_byte(d, PCI_HEADER_TYPE) & 0x7f)
548 case PCI_HEADER_TYPE_NORMAL:
549 show_pcix_nobridge(d, where);
551 case PCI_HEADER_TYPE_BRIDGE:
552 show_pcix_bridge(d, where);
558 show_rom(struct device *d)
560 struct pci_dev *p = d->dev;
561 pciaddr_t rom = p->rom_base_addr;
562 pciaddr_t len = (p->known_fields & PCI_FILL_SIZES) ? p->rom_size : 0;
566 printf("\tExpansion ROM at ");
567 if (rom & PCI_ROM_ADDRESS_MASK)
568 printf(PCIADDR_T_FMT, rom & PCI_ROM_ADDRESS_MASK);
570 printf("<unassigned>");
571 if (!(rom & PCI_ROM_ADDRESS_ENABLE))
572 printf(" [disabled]");
578 show_msi(struct device *d, int where, int cap)
584 printf("Message Signalled Interrupts: 64bit%c Queue=%d/%d Enable%c\n",
585 FLAG(cap, PCI_MSI_FLAGS_64BIT),
586 (cap & PCI_MSI_FLAGS_QSIZE) >> 4,
587 (cap & PCI_MSI_FLAGS_QMASK) >> 1,
588 FLAG(cap, PCI_MSI_FLAGS_ENABLE));
591 is64 = cap & PCI_MSI_FLAGS_64BIT;
592 if (!config_fetch(d, where + PCI_MSI_ADDRESS_LO, (is64 ? PCI_MSI_DATA_64 : PCI_MSI_DATA_32) + 2 - PCI_MSI_ADDRESS_LO))
594 printf("\t\tAddress: ");
597 t = get_conf_long(d, where + PCI_MSI_ADDRESS_HI);
598 w = get_conf_word(d, where + PCI_MSI_DATA_64);
602 w = get_conf_word(d, where + PCI_MSI_DATA_32);
603 t = get_conf_long(d, where + PCI_MSI_ADDRESS_LO);
604 printf("%08x Data: %04x\n", t, w);
610 int esr = cap & 0xff;
613 printf("Slot ID: %d slots, First%c, chassis %02x\n",
614 esr & PCI_SID_ESR_NSLOTS,
615 FLAG(esr, PCI_SID_ESR_FIC),
620 show_caps(struct device *d)
622 if (get_conf_word(d, PCI_STATUS) & PCI_STATUS_CAP_LIST)
624 int where = get_conf_byte(d, PCI_CAPABILITY_LIST) & ~3;
628 printf("\tCapabilities: ");
629 if (!config_fetch(d, where, 4))
631 puts("<available only to root>");
634 id = get_conf_byte(d, where + PCI_CAP_LIST_ID);
635 next = get_conf_byte(d, where + PCI_CAP_LIST_NEXT) & ~3;
636 cap = get_conf_word(d, where + PCI_CAP_FLAGS);
637 printf("[%02x] ", where);
640 printf("<chain broken>\n");
646 show_pm(d, where, cap);
649 show_agp(d, where, cap);
652 printf("Vital Product Data\n");
654 case PCI_CAP_ID_SLOTID:
658 show_msi(d, where, cap);
660 case PCI_CAP_ID_PCIX:
664 printf("#%02x [%04x]\n", id, cap);
672 show_htype0(struct device *d)
680 show_htype1(struct device *d)
682 u32 io_base = get_conf_byte(d, PCI_IO_BASE);
683 u32 io_limit = get_conf_byte(d, PCI_IO_LIMIT);
684 u32 io_type = io_base & PCI_IO_RANGE_TYPE_MASK;
685 u32 mem_base = get_conf_word(d, PCI_MEMORY_BASE);
686 u32 mem_limit = get_conf_word(d, PCI_MEMORY_LIMIT);
687 u32 mem_type = mem_base & PCI_MEMORY_RANGE_TYPE_MASK;
688 u32 pref_base = get_conf_word(d, PCI_PREF_MEMORY_BASE);
689 u32 pref_limit = get_conf_word(d, PCI_PREF_MEMORY_LIMIT);
690 u32 pref_type = pref_base & PCI_PREF_RANGE_TYPE_MASK;
691 word brc = get_conf_word(d, PCI_BRIDGE_CONTROL);
692 int verb = verbose > 2;
695 printf("\tBus: primary=%02x, secondary=%02x, subordinate=%02x, sec-latency=%d\n",
696 get_conf_byte(d, PCI_PRIMARY_BUS),
697 get_conf_byte(d, PCI_SECONDARY_BUS),
698 get_conf_byte(d, PCI_SUBORDINATE_BUS),
699 get_conf_byte(d, PCI_SEC_LATENCY_TIMER));
701 if (io_type != (io_limit & PCI_IO_RANGE_TYPE_MASK) ||
702 (io_type != PCI_IO_RANGE_TYPE_16 && io_type != PCI_IO_RANGE_TYPE_32))
703 printf("\t!!! Unknown I/O range types %x/%x\n", io_base, io_limit);
706 io_base = (io_base & PCI_IO_RANGE_MASK) << 8;
707 io_limit = (io_limit & PCI_IO_RANGE_MASK) << 8;
708 if (io_type == PCI_IO_RANGE_TYPE_32)
710 io_base |= (get_conf_word(d, PCI_IO_BASE_UPPER16) << 16);
711 io_limit |= (get_conf_word(d, PCI_IO_LIMIT_UPPER16) << 16);
713 if (io_base <= io_limit || verb)
714 printf("\tI/O behind bridge: %08x-%08x\n", io_base, io_limit+0xfff);
717 if (mem_type != (mem_limit & PCI_MEMORY_RANGE_TYPE_MASK) ||
719 printf("\t!!! Unknown memory range types %x/%x\n", mem_base, mem_limit);
722 mem_base = (mem_base & PCI_MEMORY_RANGE_MASK) << 16;
723 mem_limit = (mem_limit & PCI_MEMORY_RANGE_MASK) << 16;
724 if (mem_base <= mem_limit || verb)
725 printf("\tMemory behind bridge: %08x-%08x\n", mem_base, mem_limit + 0xfffff);
728 if (pref_type != (pref_limit & PCI_PREF_RANGE_TYPE_MASK) ||
729 (pref_type != PCI_PREF_RANGE_TYPE_32 && pref_type != PCI_PREF_RANGE_TYPE_64))
730 printf("\t!!! Unknown prefetchable memory range types %x/%x\n", pref_base, pref_limit);
733 pref_base = (pref_base & PCI_PREF_RANGE_MASK) << 16;
734 pref_limit = (pref_limit & PCI_PREF_RANGE_MASK) << 16;
735 if (pref_base <= pref_limit || verb)
737 if (pref_type == PCI_PREF_RANGE_TYPE_32)
738 printf("\tPrefetchable memory behind bridge: %08x-%08x\n", pref_base, pref_limit + 0xfffff);
740 printf("\tPrefetchable memory behind bridge: %08x%08x-%08x%08x\n",
741 get_conf_long(d, PCI_PREF_BASE_UPPER32),
743 get_conf_long(d, PCI_PREF_LIMIT_UPPER32),
748 if (get_conf_word(d, PCI_SEC_STATUS) & PCI_STATUS_SIG_SYSTEM_ERROR)
749 printf("\tSecondary status: SERR\n");
754 printf("\tBridgeCtl: Parity%c SERR%c NoISA%c VGA%c MAbort%c >Reset%c FastB2B%c\n",
755 FLAG(brc, PCI_BRIDGE_CTL_PARITY),
756 FLAG(brc, PCI_BRIDGE_CTL_SERR),
757 FLAG(brc, PCI_BRIDGE_CTL_NO_ISA),
758 FLAG(brc, PCI_BRIDGE_CTL_VGA),
759 FLAG(brc, PCI_BRIDGE_CTL_MASTER_ABORT),
760 FLAG(brc, PCI_BRIDGE_CTL_BUS_RESET),
761 FLAG(brc, PCI_BRIDGE_CTL_FAST_BACK));
767 show_htype2(struct device *d)
770 word cmd = get_conf_word(d, PCI_COMMAND);
771 word brc = get_conf_word(d, PCI_CB_BRIDGE_CONTROL);
772 word exca = get_conf_word(d, PCI_CB_LEGACY_MODE_BASE);
773 int verb = verbose > 2;
776 printf("\tBus: primary=%02x, secondary=%02x, subordinate=%02x, sec-latency=%d\n",
777 get_conf_byte(d, PCI_CB_PRIMARY_BUS),
778 get_conf_byte(d, PCI_CB_CARD_BUS),
779 get_conf_byte(d, PCI_CB_SUBORDINATE_BUS),
780 get_conf_byte(d, PCI_CB_LATENCY_TIMER));
784 u32 base = get_conf_long(d, PCI_CB_MEMORY_BASE_0 + p);
785 u32 limit = get_conf_long(d, PCI_CB_MEMORY_LIMIT_0 + p);
786 if (limit > base || verb)
787 printf("\tMemory window %d: %08x-%08x%s%s\n", i, base, limit,
788 (cmd & PCI_COMMAND_MEMORY) ? "" : " [disabled]",
789 (brc & (PCI_CB_BRIDGE_CTL_PREFETCH_MEM0 << i)) ? " (prefetchable)" : "");
794 u32 base = get_conf_long(d, PCI_CB_IO_BASE_0 + p);
795 u32 limit = get_conf_long(d, PCI_CB_IO_LIMIT_0 + p);
796 if (!(base & PCI_IO_RANGE_TYPE_32))
801 base &= PCI_CB_IO_RANGE_MASK;
802 limit = (limit & PCI_CB_IO_RANGE_MASK) + 3;
803 if (base <= limit || verb)
804 printf("\tI/O window %d: %08x-%08x%s\n", i, base, limit,
805 (cmd & PCI_COMMAND_IO) ? "" : " [disabled]");
808 if (get_conf_word(d, PCI_CB_SEC_STATUS) & PCI_STATUS_SIG_SYSTEM_ERROR)
809 printf("\tSecondary status: SERR\n");
811 printf("\tBridgeCtl: Parity%c SERR%c ISA%c VGA%c MAbort%c >Reset%c 16bInt%c PostWrite%c\n",
812 FLAG(brc, PCI_CB_BRIDGE_CTL_PARITY),
813 FLAG(brc, PCI_CB_BRIDGE_CTL_SERR),
814 FLAG(brc, PCI_CB_BRIDGE_CTL_ISA),
815 FLAG(brc, PCI_CB_BRIDGE_CTL_VGA),
816 FLAG(brc, PCI_CB_BRIDGE_CTL_MASTER_ABORT),
817 FLAG(brc, PCI_CB_BRIDGE_CTL_CB_RESET),
818 FLAG(brc, PCI_CB_BRIDGE_CTL_16BIT_INT),
819 FLAG(brc, PCI_CB_BRIDGE_CTL_POST_WRITES));
821 printf("\t16-bit legacy interface ports at %04x\n", exca);
825 show_verbose(struct device *d)
827 struct pci_dev *p = d->dev;
828 word status = get_conf_word(d, PCI_STATUS);
829 word cmd = get_conf_word(d, PCI_COMMAND);
830 word class = get_conf_word(d, PCI_CLASS_DEVICE);
831 byte bist = get_conf_byte(d, PCI_BIST);
832 byte htype = get_conf_byte(d, PCI_HEADER_TYPE) & 0x7f;
833 byte latency = get_conf_byte(d, PCI_LATENCY_TIMER);
834 byte cache_line = get_conf_byte(d, PCI_CACHE_LINE_SIZE);
835 byte max_lat, min_gnt;
836 byte int_pin = get_conf_byte(d, PCI_INTERRUPT_PIN);
837 unsigned int irq = p->irq;
838 word subsys_v, subsys_d;
845 case PCI_HEADER_TYPE_NORMAL:
846 if (class == PCI_CLASS_BRIDGE_PCI)
847 printf("\t!!! Invalid class %04x for header type %02x\n", class, htype);
848 max_lat = get_conf_byte(d, PCI_MAX_LAT);
849 min_gnt = get_conf_byte(d, PCI_MIN_GNT);
850 subsys_v = get_conf_word(d, PCI_SUBSYSTEM_VENDOR_ID);
851 subsys_d = get_conf_word(d, PCI_SUBSYSTEM_ID);
853 case PCI_HEADER_TYPE_BRIDGE:
854 if (class != PCI_CLASS_BRIDGE_PCI)
855 printf("\t!!! Invalid class %04x for header type %02x\n", class, htype);
856 irq = int_pin = min_gnt = max_lat = 0;
857 subsys_v = subsys_d = 0;
859 case PCI_HEADER_TYPE_CARDBUS:
860 if ((class >> 8) != PCI_BASE_CLASS_BRIDGE)
861 printf("\t!!! Invalid class %04x for header type %02x\n", class, htype);
862 min_gnt = max_lat = 0;
863 subsys_v = get_conf_word(d, PCI_CB_SUBSYSTEM_VENDOR_ID);
864 subsys_d = get_conf_word(d, PCI_CB_SUBSYSTEM_ID);
867 printf("\t!!! Unknown header type %02x\n", htype);
871 if (subsys_v && subsys_v != 0xffff)
872 printf("\tSubsystem: %s\n",
873 pci_lookup_name(pacc, ssnamebuf, sizeof(ssnamebuf),
874 PCI_LOOKUP_SUBSYSTEM | PCI_LOOKUP_VENDOR | PCI_LOOKUP_DEVICE,
875 p->vendor_id, p->device_id, subsys_v, subsys_d));
879 printf("\tControl: I/O%c Mem%c BusMaster%c SpecCycle%c MemWINV%c VGASnoop%c ParErr%c Stepping%c SERR%c FastB2B%c\n",
880 FLAG(cmd, PCI_COMMAND_IO),
881 FLAG(cmd, PCI_COMMAND_MEMORY),
882 FLAG(cmd, PCI_COMMAND_MASTER),
883 FLAG(cmd, PCI_COMMAND_SPECIAL),
884 FLAG(cmd, PCI_COMMAND_INVALIDATE),
885 FLAG(cmd, PCI_COMMAND_VGA_PALETTE),
886 FLAG(cmd, PCI_COMMAND_PARITY),
887 FLAG(cmd, PCI_COMMAND_WAIT),
888 FLAG(cmd, PCI_COMMAND_SERR),
889 FLAG(cmd, PCI_COMMAND_FAST_BACK));
890 printf("\tStatus: Cap%c 66Mhz%c UDF%c FastB2B%c ParErr%c DEVSEL=%s >TAbort%c <TAbort%c <MAbort%c >SERR%c <PERR%c\n",
891 FLAG(status, PCI_STATUS_CAP_LIST),
892 FLAG(status, PCI_STATUS_66MHZ),
893 FLAG(status, PCI_STATUS_UDF),
894 FLAG(status, PCI_STATUS_FAST_BACK),
895 FLAG(status, PCI_STATUS_PARITY),
896 ((status & PCI_STATUS_DEVSEL_MASK) == PCI_STATUS_DEVSEL_SLOW) ? "slow" :
897 ((status & PCI_STATUS_DEVSEL_MASK) == PCI_STATUS_DEVSEL_MEDIUM) ? "medium" :
898 ((status & PCI_STATUS_DEVSEL_MASK) == PCI_STATUS_DEVSEL_FAST) ? "fast" : "??",
899 FLAG(status, PCI_STATUS_SIG_TARGET_ABORT),
900 FLAG(status, PCI_STATUS_REC_TARGET_ABORT),
901 FLAG(status, PCI_STATUS_REC_MASTER_ABORT),
902 FLAG(status, PCI_STATUS_SIG_SYSTEM_ERROR),
903 FLAG(status, PCI_STATUS_DETECTED_PARITY));
904 if (cmd & PCI_COMMAND_MASTER)
906 printf("\tLatency: %d", latency);
907 if (min_gnt || max_lat)
911 printf("%dns min", min_gnt*250);
912 if (min_gnt && max_lat)
915 printf("%dns max", max_lat*250);
919 printf(", Cache Line Size %02x", cache_line);
923 printf("\tInterrupt: pin %c routed to IRQ " PCIIRQ_FMT "\n",
924 (int_pin ? 'A' + int_pin - 1 : '?'), irq);
929 if (cmd & PCI_COMMAND_MASTER)
930 printf("bus master, ");
931 if (cmd & PCI_COMMAND_VGA_PALETTE)
932 printf("VGA palette snoop, ");
933 if (cmd & PCI_COMMAND_WAIT)
934 printf("stepping, ");
935 if (cmd & PCI_COMMAND_FAST_BACK)
936 printf("fast Back2Back, ");
937 if (status & PCI_STATUS_66MHZ)
939 if (status & PCI_STATUS_UDF)
940 printf("user-definable features, ");
942 ((status & PCI_STATUS_DEVSEL_MASK) == PCI_STATUS_DEVSEL_SLOW) ? "slow" :
943 ((status & PCI_STATUS_DEVSEL_MASK) == PCI_STATUS_DEVSEL_MEDIUM) ? "medium" :
944 ((status & PCI_STATUS_DEVSEL_MASK) == PCI_STATUS_DEVSEL_FAST) ? "fast" : "??");
945 if (cmd & PCI_COMMAND_MASTER)
946 printf(", latency %d", latency);
948 printf(", IRQ " PCIIRQ_FMT, irq);
952 if (bist & PCI_BIST_CAPABLE)
954 if (bist & PCI_BIST_START)
955 printf("\tBIST is running\n");
957 printf("\tBIST result: %02x\n", bist & PCI_BIST_CODE_MASK);
962 case PCI_HEADER_TYPE_NORMAL:
965 case PCI_HEADER_TYPE_BRIDGE:
968 case PCI_HEADER_TYPE_CARDBUS:
975 show_hex_dump(struct device *d)
979 for(i=0; i<d->config_cnt; i++)
983 printf(" %02x", get_conf_byte(d, i));
990 show_machine(struct device *d)
992 struct pci_dev *p = d->dev;
994 word sv_id=0, sd_id=0;
995 char classbuf[128], vendbuf[128], devbuf[128], svbuf[128], sdbuf[128];
997 switch (get_conf_byte(d, PCI_HEADER_TYPE) & 0x7f)
999 case PCI_HEADER_TYPE_NORMAL:
1000 sv_id = get_conf_word(d, PCI_SUBSYSTEM_VENDOR_ID);
1001 sd_id = get_conf_word(d, PCI_SUBSYSTEM_ID);
1003 case PCI_HEADER_TYPE_CARDBUS:
1004 sv_id = get_conf_word(d, PCI_CB_SUBSYSTEM_VENDOR_ID);
1005 sd_id = get_conf_word(d, PCI_CB_SUBSYSTEM_ID);
1011 printf("Device:\t");
1014 printf("Class:\t%s\n",
1015 pci_lookup_name(pacc, classbuf, sizeof(classbuf), PCI_LOOKUP_CLASS, get_conf_word(d, PCI_CLASS_DEVICE), 0, 0, 0));
1016 printf("Vendor:\t%s\n",
1017 pci_lookup_name(pacc, vendbuf, sizeof(vendbuf), PCI_LOOKUP_VENDOR, p->vendor_id, p->device_id, 0, 0));
1018 printf("Device:\t%s\n",
1019 pci_lookup_name(pacc, devbuf, sizeof(devbuf), PCI_LOOKUP_DEVICE, p->vendor_id, p->device_id, 0, 0));
1020 if (sv_id && sv_id != 0xffff)
1022 printf("SVendor:\t%s\n",
1023 pci_lookup_name(pacc, svbuf, sizeof(svbuf), PCI_LOOKUP_SUBSYSTEM | PCI_LOOKUP_VENDOR, p->vendor_id, p->device_id, sv_id, sd_id));
1024 printf("SDevice:\t%s\n",
1025 pci_lookup_name(pacc, sdbuf, sizeof(sdbuf), PCI_LOOKUP_SUBSYSTEM | PCI_LOOKUP_DEVICE, p->vendor_id, p->device_id, sv_id, sd_id));
1027 if (c = get_conf_byte(d, PCI_REVISION_ID))
1028 printf("Rev:\t%02x\n", c);
1029 if (c = get_conf_byte(d, PCI_CLASS_PROG))
1030 printf("ProgIf:\t%02x\n", c);
1035 printf(" \"%s\" \"%s\" \"%s\"",
1036 pci_lookup_name(pacc, classbuf, sizeof(classbuf), PCI_LOOKUP_CLASS,
1037 get_conf_word(d, PCI_CLASS_DEVICE), 0, 0, 0),
1038 pci_lookup_name(pacc, vendbuf, sizeof(vendbuf), PCI_LOOKUP_VENDOR,
1039 p->vendor_id, p->device_id, 0, 0),
1040 pci_lookup_name(pacc, devbuf, sizeof(devbuf), PCI_LOOKUP_DEVICE,
1041 p->vendor_id, p->device_id, 0, 0));
1042 if (c = get_conf_byte(d, PCI_REVISION_ID))
1043 printf(" -r%02x", c);
1044 if (c = get_conf_byte(d, PCI_CLASS_PROG))
1045 printf(" -p%02x", c);
1046 if (sv_id && sv_id != 0xffff)
1047 printf(" \"%s\" \"%s\"",
1048 pci_lookup_name(pacc, svbuf, sizeof(svbuf), PCI_LOOKUP_SUBSYSTEM | PCI_LOOKUP_VENDOR, p->vendor_id, p->device_id, sv_id, sd_id),
1049 pci_lookup_name(pacc, sdbuf, sizeof(sdbuf), PCI_LOOKUP_SUBSYSTEM | PCI_LOOKUP_DEVICE, p->vendor_id, p->device_id, sv_id, sd_id));
1051 printf(" \"\" \"\"");
1057 show_device(struct device *d)
1059 if (machine_readable)
1067 if (verbose || show_hex)
1076 for(d=first_dev; d; d=d->next)
1083 struct bridge *chain; /* Single-linked list of bridges */
1084 struct bridge *next, *child; /* Tree of bridges */
1085 struct bus *first_bus; /* List of busses connected to this bridge */
1086 unsigned int primary, secondary, subordinate; /* Bus numbers */
1087 struct device *br_dev;
1091 unsigned int number;
1092 struct bus *sibling;
1093 struct device *first_dev, **last_dev;
1096 static struct bridge host_bridge = { NULL, NULL, NULL, NULL, ~0, 0, ~0, NULL };
1099 find_bus(struct bridge *b, unsigned int n)
1103 for(bus=b->first_bus; bus; bus=bus->sibling)
1104 if (bus->number == n)
1110 new_bus(struct bridge *b, unsigned int n)
1112 struct bus *bus = xmalloc(sizeof(struct bus));
1114 bus = xmalloc(sizeof(struct bus));
1116 bus->sibling = b->first_bus;
1117 bus->first_dev = NULL;
1118 bus->last_dev = &bus->first_dev;
1124 insert_dev(struct device *d, struct bridge *b)
1126 struct pci_dev *p = d->dev;
1129 if (! (bus = find_bus(b, p->bus)))
1132 for(c=b->child; c; c=c->next)
1133 if (c->secondary <= p->bus && p->bus <= c->subordinate)
1138 bus = new_bus(b, p->bus);
1140 /* Simple insertion at the end _does_ guarantee the correct order as the
1141 * original device list was sorted by (bus, devfn) lexicographically
1142 * and all devices on the new list have the same bus number.
1145 bus->last_dev = &d->next;
1152 struct device *d, *d2;
1153 struct bridge **last_br, *b;
1155 /* Build list of bridges */
1157 last_br = &host_bridge.chain;
1158 for(d=first_dev; d; d=d->next)
1160 word class = get_conf_word(d, PCI_CLASS_DEVICE);
1161 byte ht = get_conf_byte(d, PCI_HEADER_TYPE) & 0x7f;
1162 if (class == PCI_CLASS_BRIDGE_PCI &&
1163 (ht == PCI_HEADER_TYPE_BRIDGE || ht == PCI_HEADER_TYPE_CARDBUS))
1165 b = xmalloc(sizeof(struct bridge));
1166 if (ht == PCI_HEADER_TYPE_BRIDGE)
1168 b->primary = get_conf_byte(d, PCI_CB_PRIMARY_BUS);
1169 b->secondary = get_conf_byte(d, PCI_CB_CARD_BUS);
1170 b->subordinate = get_conf_byte(d, PCI_CB_SUBORDINATE_BUS);
1174 b->primary = get_conf_byte(d, PCI_PRIMARY_BUS);
1175 b->secondary = get_conf_byte(d, PCI_SECONDARY_BUS);
1176 b->subordinate = get_conf_byte(d, PCI_SUBORDINATE_BUS);
1179 last_br = &b->chain;
1180 b->next = b->child = NULL;
1181 b->first_bus = NULL;
1187 /* Create a bridge tree */
1189 for(b=&host_bridge; b; b=b->chain)
1191 struct bridge *c, *best;
1193 for(c=&host_bridge; c; c=c->chain)
1194 if (c != b && b->primary >= c->secondary && b->primary <= c->subordinate &&
1195 (!best || best->subordinate - best->primary > c->subordinate - c->primary))
1199 b->next = best->child;
1204 /* Insert secondary bus for each bridge */
1206 for(b=&host_bridge; b; b=b->chain)
1207 if (!find_bus(b, b->secondary))
1208 new_bus(b, b->secondary);
1210 /* Create bus structs and link devices */
1212 for(d=first_dev; d;)
1215 insert_dev(d, &host_bridge);
1221 print_it(byte *line, byte *p)
1225 fputs(line, stdout);
1226 for(p=line; *p; p++)
1227 if (*p == '+' || *p == '|')
1233 static void show_tree_bridge(struct bridge *, byte *, byte *);
1236 show_tree_dev(struct device *d, byte *line, byte *p)
1238 struct pci_dev *q = d->dev;
1242 p += sprintf(p, "%02x.%x", q->dev, q->func);
1243 for(b=&host_bridge; b; b=b->chain)
1246 if (b->secondary == b->subordinate)
1247 p += sprintf(p, "-[%02x]-", b->secondary);
1249 p += sprintf(p, "-[%02x-%02x]-", b->secondary, b->subordinate);
1250 show_tree_bridge(b, line, p);
1254 p += sprintf(p, " %s",
1255 pci_lookup_name(pacc, namebuf, sizeof(namebuf),
1256 PCI_LOOKUP_VENDOR | PCI_LOOKUP_DEVICE,
1257 q->vendor_id, q->device_id, 0, 0));
1262 show_tree_bus(struct bus *b, byte *line, byte *p)
1266 else if (!b->first_dev->next)
1270 show_tree_dev(b->first_dev, line, p);
1274 struct device *d = b->first_dev;
1279 show_tree_dev(d, line, p+2);
1284 show_tree_dev(d, line, p+2);
1289 show_tree_bridge(struct bridge *b, byte *line, byte *p)
1292 if (!b->first_bus->sibling)
1294 if (b == &host_bridge)
1295 p += sprintf(p, "[%02x]-", b->first_bus->number);
1296 show_tree_bus(b->first_bus, line, p);
1300 struct bus *u = b->first_bus;
1305 k = p + sprintf(p, "+-[%02x]-", u->number);
1306 show_tree_bus(u, line, k);
1309 k = p + sprintf(p, "\\-[%02x]-", u->number);
1310 show_tree_bus(u, line, k);
1320 show_tree_bridge(&host_bridge, line, line);
1323 /* Bus mapping mode */
1326 struct bus_bridge *next;
1327 byte this, dev, func, first, last, bug;
1333 struct bus_bridge *bridges, *via;
1336 static struct bus_info *bus_info;
1339 map_bridge(struct bus_info *bi, struct device *d, int np, int ns, int nl)
1341 struct bus_bridge *b = xmalloc(sizeof(struct bus_bridge));
1342 struct pci_dev *p = d->dev;
1344 b->next = bi->bridges;
1346 b->this = get_conf_byte(d, np);
1349 b->first = get_conf_byte(d, ns);
1350 b->last = get_conf_byte(d, nl);
1351 printf("## %02x.%02x:%d is a bridge from %02x to %02x-%02x\n",
1352 p->bus, p->dev, p->func, b->this, b->first, b->last);
1353 if (b->this != p->bus)
1354 printf("!!! Bridge points to invalid primary bus.\n");
1355 if (b->first > b->last)
1357 printf("!!! Bridge points to invalid bus range.\n");
1366 int verbose = pacc->debugging;
1367 struct bus_info *bi = bus_info + bus;
1371 printf("Mapping bus %02x\n", bus);
1372 for(dev = 0; dev < 32; dev++)
1373 if (filter.slot < 0 || filter.slot == dev)
1376 for(func = 0; func < func_limit; func++)
1377 if (filter.func < 0 || filter.func == func)
1379 struct pci_dev *p = pci_get_dev(pacc, 0, bus, dev, func);
1380 u16 vendor = pci_read_word(p, PCI_VENDOR_ID);
1381 if (vendor && vendor != 0xffff)
1383 if (!func && (pci_read_byte(p, PCI_HEADER_TYPE) & 0x80))
1386 printf("Discovered device %02x:%02x.%d\n", bus, dev, func);
1388 if (d = scan_device(p))
1391 switch (get_conf_byte(d, PCI_HEADER_TYPE) & 0x7f)
1393 case PCI_HEADER_TYPE_BRIDGE:
1394 map_bridge(bi, d, PCI_PRIMARY_BUS, PCI_SECONDARY_BUS, PCI_SUBORDINATE_BUS);
1396 case PCI_HEADER_TYPE_CARDBUS:
1397 map_bridge(bi, d, PCI_CB_PRIMARY_BUS, PCI_CB_CARD_BUS, PCI_CB_SUBORDINATE_BUS);
1403 printf("But it was filtered out.\n");
1411 do_map_bridges(int bus, int min, int max)
1413 struct bus_info *bi = bus_info + bus;
1414 struct bus_bridge *b;
1417 for(b=bi->bridges; b; b=b->next)
1419 if (bus_info[b->first].guestbook)
1421 else if (b->first < min || b->last > max)
1425 bus_info[b->first].via = b;
1426 do_map_bridges(b->first, b->first, b->last);
1436 printf("\nSummary of buses:\n\n");
1437 for(i=0; i<256; i++)
1438 if (bus_info[i].exists && !bus_info[i].guestbook)
1439 do_map_bridges(i, 0, 255);
1440 for(i=0; i<256; i++)
1442 struct bus_info *bi = bus_info + i;
1443 struct bus_bridge *b = bi->via;
1447 printf("%02x: ", i);
1449 printf("Entered via %02x:%02x.%d\n", b->this, b->dev, b->func);
1451 printf("Primary host bus\n");
1453 printf("Secondary host bus (?)\n");
1455 for(b=bi->bridges; b; b=b->next)
1457 printf("\t%02x.%d Bridge to %02x-%02x", b->dev, b->func, b->first, b->last);
1461 printf(" <overlap bug>");
1464 printf(" <crossing bug>");
1475 if (pacc->method == PCI_ACCESS_PROC_BUS_PCI ||
1476 pacc->method == PCI_ACCESS_DUMP)
1477 printf("WARNING: Bus mapping can be reliable only with direct hardware access enabled.\n\n");
1478 else if (!check_root())
1479 die("Only root can map the bus.");
1480 bus_info = xmalloc(sizeof(struct bus_info) * 256);
1481 bzero(bus_info, sizeof(struct bus_info) * 256);
1482 if (filter.bus >= 0)
1483 do_map_bus(filter.bus);
1487 for(bus=0; bus<256; bus++)
1496 main(int argc, char **argv)
1501 if (argc == 2 && !strcmp(argv[1], "--version"))
1503 puts("lspci version " PCIUTILS_VERSION);
1509 pci_filter_init(pacc, &filter);
1511 while ((i = getopt(argc, argv, options)) != -1)
1515 pacc->numeric_ids = 1;
1521 pacc->buscentric = 1;
1522 buscentric_view = 1;
1525 if (msg = pci_filter_parse_slot(&filter, optarg))
1529 if (msg = pci_filter_parse_id(&filter, optarg))
1539 pacc->id_file_name = optarg;
1548 if (parse_generic_option(i, pacc, optarg))
1551 fprintf(stderr, help_msg, pacc->id_file_name);