printconfig(8): print PCI sub-VID/DID when set

In order to allow for proper matching of available drivers to system
hardware, the output of this utility should reflect the full details
of the input from configuration files.  In particular, that includes
sub-IDs of PCI devices when those have been specified.

Change-Id: Iea24d72795cd714268dbdb95df998eb74de8f2bd
This commit is contained in:
David van Moolenbroek 2017-01-16 14:05:45 +00:00
parent 5f6c420586
commit 0c6b4c6127

View File

@ -68,6 +68,7 @@ int main(int argc, char **argv)
{
struct rs_config config;
const char *label;
uint16_t sub_vid, sub_did;
int id;
if(argc != 2) {
@ -87,9 +88,25 @@ int main(int argc, char **argv)
printstack();
printf("%s %s ", KW_PCI, KW_DEVICE);
for(id = 0; id < config.rs_start.rss_nr_pci_id; id++) {
printf("%04X:%04X ",
config.rs_start.rss_pci_id[id].vid,
config.rs_start.rss_pci_id[id].did);
sub_vid = config.rs_start.rss_pci_id[id].sub_vid;
sub_did = config.rs_start.rss_pci_id[id].sub_did;
/*
* The PCI driver interprets each of these two fields
* individually, so we must print them even if just one
* of them is set. Correct matching of just one of
* the fields may be hard to do from a script though,
* so driver writers are advised to specify either both
* or neither of these two fields.
*/
if (sub_vid != NO_SUB_VID || sub_did != NO_SUB_DID)
printf("%04X:%04X/%04X:%04X ",
config.rs_start.rss_pci_id[id].vid,
config.rs_start.rss_pci_id[id].did,
sub_vid, sub_did);
else
printf("%04X:%04X ",
config.rs_start.rss_pci_id[id].vid,
config.rs_start.rss_pci_id[id].did);
}
printf("\n");
}