From: David van Moolenbroek Date: Mon, 16 Jan 2017 14:05:45 +0000 (+0000) Subject: printconfig(8): print PCI sub-VID/DID when set X-Git-Url: http://zhaoyanbai.com/repos/%22http:/www.isc.org/icons/zlib_tech.html?a=commitdiff_plain;h=0c6b4c6127c34f3ef55d8136384d369b787acaf8;p=minix.git 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 --- diff --git a/minix/commands/service/print.c b/minix/commands/service/print.c index 7f42396ba..b8ba367b9 100644 --- a/minix/commands/service/print.c +++ b/minix/commands/service/print.c @@ -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"); }