diff options
author | Martin Mares <mj@ucw.cz> | 2008-11-09 21:16:14 +0100 |
---|---|---|
committer | Martin Mares <mj@ucw.cz> | 2008-11-09 21:16:14 +0100 |
commit | 15841b0a3441b84c0e20547ce893986822be96b2 (patch) | |
tree | 81e1cf8ac67e43c35c7cf25687f19e93a2c2bfaa | |
parent | d45531756b426fb883e78deb412be3c031bb7675 (diff) | |
download | pciutils-15841b0a3441b84c0e20547ce893986822be96b2.tar.gz |
Let `lspci -k' display subsystem names.
Several users have requested a `quick overview' mode that would display
everything needed to identify a device and its drivers. I believe that it
is better to extend the `-k' mode to include subsystems than to introduce
yet another mode.
-rw-r--r-- | lspci.c | 54 |
1 files changed, 29 insertions, 25 deletions
@@ -288,6 +288,25 @@ show_slot_name(struct device *d) } static void +get_subid(struct device *d, word *subvp, word *subdp) +{ + byte htype = get_conf_byte(d, PCI_HEADER_TYPE) & 0x7f; + + if (htype == PCI_HEADER_TYPE_NORMAL) + { + *subvp = get_conf_word(d, PCI_SUBSYSTEM_VENDOR_ID); + *subdp = get_conf_word(d, PCI_SUBSYSTEM_ID); + } + else if (htype == PCI_HEADER_TYPE_CARDBUS && d->config_cached >= 128) + { + *subvp = get_conf_word(d, PCI_CB_SUBSYSTEM_VENDOR_ID); + *subdp = get_conf_word(d, PCI_CB_SUBSYSTEM_ID); + } + else + *subvp = *subdp = 0xffff; +} + +static void show_terse(struct device *d) { int c; @@ -320,25 +339,19 @@ show_terse(struct device *d) } } putchar('\n'); -} -static void -get_subid(struct device *d, word *subvp, word *subdp) -{ - byte htype = get_conf_byte(d, PCI_HEADER_TYPE) & 0x7f; - - if (htype == PCI_HEADER_TYPE_NORMAL) + if (verbose || opt_kernel) { - *subvp = get_conf_word(d, PCI_SUBSYSTEM_VENDOR_ID); - *subdp = get_conf_word(d, PCI_SUBSYSTEM_ID); + word subsys_v, subsys_d; + char ssnamebuf[256]; + + get_subid(d, &subsys_v, &subsys_d); + if (subsys_v && subsys_v != 0xffff) + printf("\tSubsystem: %s\n", + pci_lookup_name(pacc, ssnamebuf, sizeof(ssnamebuf), + PCI_LOOKUP_SUBSYSTEM | PCI_LOOKUP_VENDOR | PCI_LOOKUP_DEVICE, + p->vendor_id, p->device_id, subsys_v, subsys_d)); } - else if (htype == PCI_HEADER_TYPE_CARDBUS && d->config_cached >= 128) - { - *subvp = get_conf_word(d, PCI_CB_SUBSYSTEM_VENDOR_ID); - *subdp = get_conf_word(d, PCI_CB_SUBSYSTEM_ID); - } - else - *subvp = *subdp = 0xffff; } /*** Capabilities ***/ @@ -2311,8 +2324,6 @@ show_verbose(struct device *d) byte max_lat, min_gnt; byte int_pin = get_conf_byte(d, PCI_INTERRUPT_PIN); unsigned int irq = p->irq; - word subsys_v, subsys_d; - char ssnamebuf[256]; show_terse(d); @@ -2339,13 +2350,6 @@ show_verbose(struct device *d) return; } - get_subid(d, &subsys_v, &subsys_d); - if (subsys_v && subsys_v != 0xffff) - printf("\tSubsystem: %s\n", - pci_lookup_name(pacc, ssnamebuf, sizeof(ssnamebuf), - PCI_LOOKUP_SUBSYSTEM | PCI_LOOKUP_VENDOR | PCI_LOOKUP_DEVICE, - p->vendor_id, p->device_id, subsys_v, subsys_d)); - if (verbose > 1) { printf("\tControl: I/O%c Mem%c BusMaster%c SpecCycle%c MemWINV%c VGASnoop%c ParErr%c Stepping%c SERR%c FastB2B%c DisINTx%c\n", |