2 * $Id: lspci.c,v 1.12 1998/06/08 07:54:37 mj Exp $
4 * Linux PCI Utilities -- List All PCI Devices
6 * Copyright (c) 1997, 1998 Martin Mares <mj@atrey.karlin.mff.cuni.cz>
8 * Can be freely distributed and used under the terms of the GNU GPL.
21 static int verbose; /* Show detailed information */
22 static int buscentric_view; /* Show bus addresses/IRQ's instead of CPU-visible ones */
23 static int show_hex; /* Show contents of config space as hexadecimal numbers */
24 static struct pci_filter filter; /* Device filter */
25 static int show_tree; /* Show bus tree */
26 static int machine_readable; /* Generate machine-readable output */
27 static char *pci_dir = PROC_BUS_PCI;
29 static char options[] = "nvbxs:d:ti:p:m";
31 static char help_msg[] = "\
32 Usage: lspci [<switches>]\n\
35 -n\t\tShow numeric ID's\n\
36 -b\t\tBus-centric view (PCI addresses and IRQ's instead of those seen by the CPU)\n\
37 -x\t\tShow hex-dump of config space (-xx shows full 256 bytes)\n\
38 -s [[<bus>]:][<slot>][.[<func>]]\tShow only devices in selected slots\n\
39 -d [<vendor>]:[<device>]\tShow only selected devices\n\
40 -t\t\tShow bus tree\n\
41 -m\t\tProduce machine-readable output\n\
42 -i <file>\tUse specified ID database instead of " ETC_PCI_IDS "\n\
43 -p <dir>\tUse specified bus directory instead of " PROC_BUS_PCI "\n\
46 /* Format strings used for IRQ numbers */
49 #define IRQ_FORMAT "%08x"
51 #define IRQ_FORMAT "%d"
54 /* Our view of the PCI bus */
60 unsigned int kernel_irq;
61 unsigned long kernel_base_addr[6], kernel_rom_base_addr;
65 static struct device *first_dev, **last_dev = &first_dev;
67 /* Miscellaneous routines */
70 xmalloc(unsigned int howmuch)
72 void *p = malloc(howmuch);
75 fprintf(stderr, "lspci: Unable to allocate %d bytes of memory\n", howmuch);
81 /* Interface for /proc/bus/pci */
90 sprintf(name, "%s/devices", pci_dir);
91 if (! (f = fopen(name, "r")))
96 while (fgets(line, sizeof(line), f))
98 struct device *d = xmalloc(sizeof(struct device));
99 unsigned int dfn, vend;
101 bzero(d, sizeof(*d));
102 sscanf(line, "%x %x %x %lx %lx %lx %lx %lx %lx %lx",
106 &d->kernel_base_addr[0],
107 &d->kernel_base_addr[1],
108 &d->kernel_base_addr[2],
109 &d->kernel_base_addr[3],
110 &d->kernel_base_addr[4],
111 &d->kernel_base_addr[5],
112 &d->kernel_rom_base_addr);
114 d->devfn = dfn & 0xff;
115 d->vendid = vend >> 16U;
116 d->devid = vend & 0xffff;
117 if (filter_match(&filter, d->bus, d->devfn, d->vendid, d->devid))
128 make_proc_pci_name(struct device *d, char *p)
130 sprintf(p, "%s/%02x/%02x.%x",
131 pci_dir, d->bus, PCI_SLOT(d->devfn), PCI_FUNC(d->devfn));
140 int how_much = (show_hex > 1) ? 256 : 64;
142 for(d=first_dev; d; d=d->next)
144 make_proc_pci_name(d, name);
145 if ((fd = open(name, O_RDONLY)) < 0)
147 fprintf(stderr, "lspci: Unable to open %s: %m\n", name);
150 res = read(fd, d->config, how_much);
153 fprintf(stderr, "lspci: Error reading %s: %m\n", name);
158 fprintf(stderr, "lspci: Only %d bytes of config space available to you\n", res);
172 /* Config space accesses */
175 get_conf_byte(struct device *d, unsigned int pos)
177 return d->config[pos];
181 get_conf_word(struct device *d, unsigned int pos)
183 return d->config[pos] | (d->config[pos+1] << 8);
187 get_conf_long(struct device *d, unsigned int pos)
189 return d->config[pos] |
190 (d->config[pos+1] << 8) |
191 (d->config[pos+2] << 16) |
192 (d->config[pos+3] << 24);
198 compare_them(const void *A, const void *B)
200 const struct device *a = *(const struct device **)A;
201 const struct device *b = *(const struct device **)B;
207 if (a->devfn < b->devfn)
209 if (a->devfn > b->devfn)
217 struct device **index, **h;
222 for(d=first_dev; d; d=d->next)
224 h = index = alloca(sizeof(struct device *) * cnt);
225 for(d=first_dev; d; d=d->next)
227 qsort(index, cnt, sizeof(struct device *), compare_them);
228 last_dev = &first_dev;
233 last_dev = &(*h)->next;
242 show_terse(struct device *d)
246 printf("%02x:%02x.%x %s: %s",
250 lookup_class(get_conf_word(d, PCI_CLASS_DEVICE)),
251 lookup_device_full(d->vendid, d->devid));
252 if (c = get_conf_byte(d, PCI_REVISION_ID))
253 printf(" (rev %02x)", c);
254 if (verbose && (c = get_conf_byte(d, PCI_CLASS_PROG)))
255 printf(" (prog-if %02x)", c);
260 show_bases(struct device *d, int cnt)
262 word cmd = get_conf_word(d, PCI_COMMAND);
268 unsigned int flg = get_conf_long(d, PCI_BASE_ADDRESS_0 + 4*i);
272 pos = d->kernel_base_addr[i];
273 if (!pos || pos == 0xffffffff)
275 if (flg & PCI_BASE_ADDRESS_SPACE_IO)
277 if (cmd & PCI_COMMAND_IO)
280 printf("\tRegion %d: ", i);
283 printf("I/O ports at %04lx\n", pos & PCI_BASE_ADDRESS_IO_MASK);
286 else if (cmd & PCI_COMMAND_MEMORY)
288 int t = flg & PCI_BASE_ADDRESS_MEM_TYPE_MASK;
290 printf("\tRegion %d: ", i);
293 printf("Memory at ");
294 if (t == PCI_BASE_ADDRESS_MEM_TYPE_64)
299 if (!buscentric_view)
300 printf("%08x", get_conf_long(d, PCI_BASE_ADDRESS_0 + 4*i));
305 printf("%08lx (%s, %sprefetchable)\n",
306 pos & PCI_BASE_ADDRESS_MEM_MASK,
307 (t == PCI_BASE_ADDRESS_MEM_TYPE_32) ? "32-bit" :
308 (t == PCI_BASE_ADDRESS_MEM_TYPE_64) ? "64-bit" :
309 (t == PCI_BASE_ADDRESS_MEM_TYPE_1M) ? "low-1M 32-bit" : "???",
310 (flg & PCI_BASE_ADDRESS_MEM_PREFETCH) ? "" : "non-");
316 show_htype0(struct device *d)
318 unsigned long rom = buscentric_view ? get_conf_long(d, PCI_ROM_ADDRESS) : d->kernel_rom_base_addr;
323 printf("\tExpansion ROM at %08lx%s\n", rom & PCI_ROM_ADDRESS_MASK,
324 (rom & PCI_ROM_ADDRESS_ENABLE) ? "" : " [disabled]");
328 show_htype1(struct device *d)
330 u32 io_base = get_conf_byte(d, PCI_IO_BASE);
331 u32 io_limit = get_conf_byte(d, PCI_IO_LIMIT);
332 u32 io_type = io_base & PCI_IO_RANGE_TYPE_MASK;
333 u32 mem_base = get_conf_word(d, PCI_MEMORY_BASE);
334 u32 mem_limit = get_conf_word(d, PCI_MEMORY_LIMIT);
335 u32 mem_type = mem_base & PCI_MEMORY_RANGE_TYPE_MASK;
336 u32 pref_base = get_conf_word(d, PCI_PREF_MEMORY_BASE);
337 u32 pref_limit = get_conf_word(d, PCI_PREF_MEMORY_LIMIT);
338 u32 pref_type = pref_base & PCI_PREF_RANGE_TYPE_MASK;
339 unsigned long rom = buscentric_view ? get_conf_long(d, PCI_ROM_ADDRESS) : d->kernel_rom_base_addr;
340 word brc = get_conf_word(d, PCI_BRIDGE_CONTROL);
343 printf("\tBus: primary=%02x, secondary=%02x, subordinate=%02x, sec-latency=%d\n",
344 get_conf_byte(d, PCI_PRIMARY_BUS),
345 get_conf_byte(d, PCI_SECONDARY_BUS),
346 get_conf_byte(d, PCI_SUBORDINATE_BUS),
347 get_conf_byte(d, PCI_SEC_LATENCY_TIMER));
349 if (io_type != (io_limit & PCI_IO_RANGE_TYPE_MASK) ||
350 (io_type != PCI_IO_RANGE_TYPE_16 && io_type != PCI_IO_RANGE_TYPE_32))
351 printf("\t!!! Unknown I/O range types %x/%x\n", io_base, io_limit);
354 io_base = (io_base & PCI_IO_RANGE_MASK) << 8;
355 io_limit = (io_limit & PCI_IO_RANGE_MASK) << 8;
356 if (io_type == PCI_IO_RANGE_TYPE_32)
358 io_base |= (get_conf_word(d, PCI_IO_BASE_UPPER16) << 16);
359 io_limit |= (get_conf_word(d, PCI_IO_LIMIT_UPPER16) << 16);
362 printf("\tI/O behind bridge: %08x-%08x\n", io_base, io_limit+0xfff);
365 if (mem_type != (mem_limit & PCI_MEMORY_RANGE_TYPE_MASK) ||
367 printf("\t!!! Unknown memory range types %x/%x\n", mem_base, mem_limit);
370 mem_base = (mem_base & PCI_MEMORY_RANGE_MASK) << 16;
371 mem_limit = (mem_limit & PCI_MEMORY_RANGE_MASK) << 16;
372 printf("\tMemory behind bridge: %08x-%08x\n", mem_base, mem_limit + 0xfffff);
375 if (pref_type != (pref_limit & PCI_PREF_RANGE_TYPE_MASK) ||
376 (pref_type != PCI_PREF_RANGE_TYPE_32 && pref_type != PCI_PREF_RANGE_TYPE_64))
377 printf("\t!!! Unknown prefetchable memory range types %x/%x\n", pref_base, pref_limit);
380 pref_base = (pref_base & PCI_PREF_RANGE_MASK) << 16;
381 pref_limit = (pref_limit & PCI_PREF_RANGE_MASK) << 16;
382 if (pref_type == PCI_PREF_RANGE_TYPE_32)
383 printf("\tPrefetchable memory behind bridge: %08x-%08x\n", pref_base, pref_limit);
385 printf("\tPrefetchable memory behind bridge: %08x%08x-%08x%08x\n",
386 get_conf_long(d, PCI_PREF_BASE_UPPER32),
388 get_conf_long(d, PCI_PREF_LIMIT_UPPER32),
392 if (get_conf_word(d, PCI_SEC_STATUS) & PCI_STATUS_SIG_SYSTEM_ERROR)
393 printf("\tSecondary status: SERR\n");
396 printf("\tExpansion ROM at %08lx%s\n", rom & PCI_ROM_ADDRESS_MASK,
397 (rom & PCI_ROM_ADDRESS_ENABLE) ? "" : " [disabled]");
400 printf("\tBridgeCtl: Parity%c SERR%c NoISA%c VGA%c MAbort%c >Reset%c FastB2B%c\n",
401 (brc & PCI_BRIDGE_CTL_PARITY) ? '+' : '-',
402 (brc & PCI_BRIDGE_CTL_SERR) ? '+' : '-',
403 (brc & PCI_BRIDGE_CTL_NO_ISA) ? '+' : '-',
404 (brc & PCI_BRIDGE_CTL_VGA) ? '+' : '-',
405 (brc & PCI_BRIDGE_CTL_MASTER_ABORT) ? '+' : '-',
406 (brc & PCI_BRIDGE_CTL_BUS_RESET) ? '+' : '-',
407 (brc & PCI_BRIDGE_CTL_FAST_BACK) ? '+' : '-');
411 show_htype2(struct device *d)
416 show_verbose(struct device *d)
418 word status = get_conf_word(d, PCI_STATUS);
419 word cmd = get_conf_word(d, PCI_COMMAND);
420 word class = get_conf_word(d, PCI_CLASS_DEVICE);
421 byte bist = get_conf_byte(d, PCI_BIST);
422 byte htype = get_conf_byte(d, PCI_HEADER_TYPE) & 0x7f;
423 byte latency = get_conf_byte(d, PCI_LATENCY_TIMER);
424 byte cache_line = get_conf_byte(d, PCI_CACHE_LINE_SIZE);
425 byte max_lat, min_gnt;
426 byte int_pin = get_conf_byte(d, PCI_INTERRUPT_PIN);
427 byte int_line = get_conf_byte(d, PCI_INTERRUPT_LINE);
429 word subsys_v, subsys_d;
435 case PCI_HEADER_TYPE_NORMAL:
436 if (class == PCI_CLASS_BRIDGE_PCI)
439 printf("\t!!! Header type %02x doesn't match class code %04x\n", htype, class);
442 max_lat = get_conf_byte(d, PCI_MAX_LAT);
443 min_gnt = get_conf_byte(d, PCI_MIN_GNT);
444 subsys_v = get_conf_word(d, PCI_SUBSYSTEM_VENDOR_ID);
445 subsys_d = get_conf_word(d, PCI_SUBSYSTEM_ID);
447 case PCI_HEADER_TYPE_BRIDGE:
448 if (class != PCI_CLASS_BRIDGE_PCI)
450 irq = int_line = int_pin = min_gnt = max_lat = 0;
451 subsys_v = subsys_d = 0;
453 case PCI_HEADER_TYPE_CARDBUS:
454 if ((class >> 8) != PCI_BASE_CLASS_BRIDGE)
456 irq = int_line = int_pin = min_gnt = max_lat = 0;
457 subsys_v = subsys_d = 0;
460 printf("\t!!! Unknown header type %02x\n", htype);
472 printf("\tSubsystem ID: %04x:%04x\n", subsys_v, subsys_d);
473 printf("\tControl: I/O%c Mem%c BusMaster%c SpecCycle%c MemWINV%c VGASnoop%c ParErr%c Stepping%c SERR%c FastB2B%c\n",
474 (cmd & PCI_COMMAND_IO) ? '+' : '-',
475 (cmd & PCI_COMMAND_MEMORY) ? '+' : '-',
476 (cmd & PCI_COMMAND_MASTER) ? '+' : '-',
477 (cmd & PCI_COMMAND_SPECIAL) ? '+' : '-',
478 (cmd & PCI_COMMAND_INVALIDATE) ? '+' : '-',
479 (cmd & PCI_COMMAND_VGA_PALETTE) ? '+' : '-',
480 (cmd & PCI_COMMAND_PARITY) ? '+' : '-',
481 (cmd & PCI_COMMAND_WAIT) ? '+' : '-',
482 (cmd & PCI_COMMAND_SERR) ? '+' : '-',
483 (cmd & PCI_COMMAND_FAST_BACK) ? '+' : '-');
484 printf("\tStatus: 66Mhz%c UDF%c FastB2B%c ParErr%c DEVSEL=%s >TAbort%c <TAbort%c <MAbort%c >SERR%c <PERR%c\n",
485 (status & PCI_STATUS_66MHZ) ? '+' : '-',
486 (status & PCI_STATUS_UDF) ? '+' : '-',
487 (status & PCI_STATUS_FAST_BACK) ? '+' : '-',
488 (status & PCI_STATUS_PARITY) ? '+' : '-',
489 ((status & PCI_STATUS_DEVSEL_MASK) == PCI_STATUS_DEVSEL_SLOW) ? "slow" :
490 ((status & PCI_STATUS_DEVSEL_MASK) == PCI_STATUS_DEVSEL_MEDIUM) ? "medium" :
491 ((status & PCI_STATUS_DEVSEL_MASK) == PCI_STATUS_DEVSEL_FAST) ? "fast" : "??",
492 (status & PCI_STATUS_SIG_TARGET_ABORT) ? '+' : '-',
493 (status & PCI_STATUS_REC_TARGET_ABORT) ? '+' : '-',
494 (status & PCI_STATUS_REC_MASTER_ABORT) ? '+' : '-',
495 (status & PCI_STATUS_SIG_SYSTEM_ERROR) ? '+' : '-',
496 (status & PCI_STATUS_DETECTED_PARITY) ? '+' : '-');
497 if (cmd & PCI_COMMAND_MASTER)
499 printf("\tLatency: ");
501 printf("%d min, ", min_gnt);
503 printf("%d max, ", max_lat);
504 printf("%d set", latency);
506 printf(", cache line size %02x", cache_line);
510 printf("\tInterrupt: pin %c routed to IRQ " IRQ_FORMAT "\n", 'A' + int_pin - 1, irq);
515 if (cmd & PCI_COMMAND_MASTER)
516 printf("bus master, ");
517 if (cmd & PCI_COMMAND_VGA_PALETTE)
518 printf("VGA palette snoop, ");
519 if (cmd & PCI_COMMAND_WAIT)
520 printf("stepping, ");
521 if (cmd & PCI_COMMAND_FAST_BACK)
522 printf("fast Back2Back, ");
523 if (status & PCI_STATUS_66MHZ)
525 if (status & PCI_STATUS_UDF)
526 printf("user-definable features, ");
528 ((status & PCI_STATUS_DEVSEL_MASK) == PCI_STATUS_DEVSEL_SLOW) ? "slow" :
529 ((status & PCI_STATUS_DEVSEL_MASK) == PCI_STATUS_DEVSEL_MEDIUM) ? "medium" :
530 ((status & PCI_STATUS_DEVSEL_MASK) == PCI_STATUS_DEVSEL_FAST) ? "fast" : "??");
531 if (cmd & PCI_COMMAND_MASTER)
532 printf(", latency %d", latency);
535 printf(", IRQ " IRQ_FORMAT, irq);
541 if (bist & PCI_BIST_CAPABLE)
543 if (bist & PCI_BIST_START)
544 printf("\tBIST is running\n");
546 printf("\tBIST result: %02x\n", bist & PCI_BIST_CODE_MASK);
551 case PCI_HEADER_TYPE_NORMAL:
554 case PCI_HEADER_TYPE_BRIDGE:
557 case PCI_HEADER_TYPE_CARDBUS:
564 show_hex_dump(struct device *d)
567 int limit = (show_hex > 1) ? 256 : 64;
569 for(i=0; i<limit; i++)
573 printf(" %02x", get_conf_byte(d, i));
580 show_machine(struct device *d)
586 printf("Device:\t%02x:%02x.%x\n", d->bus, PCI_SLOT(d->devfn), PCI_FUNC(d->devfn));
587 printf("Class:\t%s\n", lookup_class(get_conf_word(d, PCI_CLASS_DEVICE)));
588 printf("Vendor:\t%s\n", lookup_vendor(d->vendid));
589 printf("Device:\t%s\n", lookup_device(d->vendid, d->devid));
590 if (c = get_conf_byte(d, PCI_REVISION_ID))
591 printf("Rev:\t%02x\n", c);
592 if (c = get_conf_byte(d, PCI_CLASS_PROG))
593 printf("ProgIf:\t%02x\n", c);
597 printf("%02x:%02x.%x ", d->bus, PCI_SLOT(d->devfn), PCI_FUNC(d->devfn));
598 printf("\"%s\" \"%s\" \"%s\"",
599 lookup_class(get_conf_word(d, PCI_CLASS_DEVICE)),
600 lookup_vendor(d->vendid),
601 lookup_device(d->vendid, d->devid));
602 if (c = get_conf_byte(d, PCI_REVISION_ID))
603 printf(" -r%02x", c);
604 if (c = get_conf_byte(d, PCI_CLASS_PROG))
605 printf(" -p%02x", c);
615 for(d=first_dev; d; d=d->next)
617 if (machine_readable)
625 if (verbose || show_hex)
633 struct bridge *chain; /* Single-linked list of bridges */
634 struct bridge *next, *child; /* Tree of bridges */
635 struct bus *first_bus; /* List of busses connected to this bridge */
636 unsigned int primary, secondary, subordinate; /* Bus numbers */
637 struct device *br_dev;
643 struct device *first_dev, **last_dev;
646 static struct bridge host_bridge = { NULL, NULL, NULL, NULL, ~0, 0, ~0, NULL };
649 find_bus(struct bridge *b, unsigned int n)
653 for(bus=b->first_bus; bus; bus=bus->sibling)
654 if (bus->number == n)
660 new_bus(struct bridge *b, unsigned int n)
662 struct bus *bus = xmalloc(sizeof(struct bus));
664 bus = xmalloc(sizeof(struct bus));
666 bus->sibling = b->first_bus;
667 bus->first_dev = NULL;
668 bus->last_dev = &bus->first_dev;
674 insert_dev(struct device *d, struct bridge *b)
678 if (! (bus = find_bus(b, d->bus)))
681 for(c=b->child; c; c=c->next)
682 if (c->secondary <= d->bus && d->bus <= c->subordinate)
683 return insert_dev(d, c);
684 bus = new_bus(b, d->bus);
686 /* Simple insertion at the end _does_ guarantee the correct order as the
687 * original device list was sorted by (bus, devfn) lexicographically
688 * and all devices on the new list have the same bus number.
691 bus->last_dev = &d->next;
698 struct device *d, *d2;
699 struct bridge **last_br, *b;
701 /* Build list of bridges */
703 last_br = &host_bridge.chain;
704 for(d=first_dev; d; d=d->next)
706 word class = get_conf_word(d, PCI_CLASS_DEVICE);
707 if (class == PCI_CLASS_BRIDGE_PCI && (get_conf_byte(d, PCI_HEADER_TYPE) & 0x7f) == 1)
709 b = xmalloc(sizeof(struct bridge));
710 b->primary = get_conf_byte(d, PCI_PRIMARY_BUS);
711 b->secondary = get_conf_byte(d, PCI_SECONDARY_BUS);
712 b->subordinate = get_conf_byte(d, PCI_SUBORDINATE_BUS);
715 b->next = b->child = NULL;
722 /* Create a bridge tree */
724 for(b=&host_bridge; b; b=b->chain)
726 struct bridge *c, *best;
728 for(c=&host_bridge; c; c=c->chain)
729 if (c != b && b->primary >= c->secondary && b->primary <= c->subordinate &&
730 (!best || best->subordinate - best->primary > c->subordinate - c->primary))
734 b->next = best->child;
739 /* Insert secondary bus for each bridge */
741 for(b=&host_bridge; b; b=b->chain)
742 if (!find_bus(b, b->secondary))
743 new_bus(b, b->secondary);
745 /* Create bus structs and link devices */
750 insert_dev(d, &host_bridge);
756 print_it(byte *line, byte *p)
762 if (*p == '+' || *p == '|')
768 static void show_tree_bridge(struct bridge *, byte *, byte *);
771 show_tree_dev(struct device *d, byte *line, byte *p)
775 p += sprintf(p, "%02x.%x", PCI_SLOT(d->devfn), PCI_FUNC(d->devfn));
776 for(b=&host_bridge; b; b=b->chain)
779 if (b->secondary == b->subordinate)
780 p += sprintf(p, "-[%02x]-", b->secondary);
782 p += sprintf(p, "-[%02x-%02x]-", b->secondary, b->subordinate);
783 show_tree_bridge(b, line, p);
787 p += sprintf(p, " %s", lookup_device_full(d->vendid, d->devid));
792 show_tree_bus(struct bus *b, byte *line, byte *p)
796 else if (!b->first_dev->next)
800 show_tree_dev(b->first_dev, line, p);
804 struct device *d = b->first_dev;
809 show_tree_dev(d, line, p+2);
814 show_tree_dev(d, line, p+2);
819 show_tree_bridge(struct bridge *b, byte *line, byte *p)
822 if (!b->first_bus->sibling)
824 if (b == &host_bridge)
825 p += sprintf(p, "[%02x]-", b->first_bus->number);
826 show_tree_bus(b->first_bus, line, p);
830 struct bus *u = b->first_bus;
835 k = p + sprintf(p, "+-[%02x]-", u->number);
836 show_tree_bus(u, line, k);
839 k = p + sprintf(p, "\\-[%02x]-", u->number);
840 show_tree_bus(u, line, k);
850 show_tree_bridge(&host_bridge, line, line);
856 main(int argc, char **argv)
861 if (argc == 2 && !strcmp(argv[1], "--version"))
863 puts("lspci version " PCIUTILS_VERSION);
866 filter_init(&filter);
867 while ((i = getopt(argc, argv, options)) != -1)
871 show_numeric_ids = 1;
880 if (msg = filter_parse_slot(&filter, optarg))
882 fprintf(stderr, "lspci: -f: %s\n", msg);
887 if (msg = filter_parse_id(&filter, optarg))
889 fprintf(stderr, "lspci: -d: %s\n", msg);
910 fprintf(stderr, help_msg);