Refactor parts of the 3COM NIC code

Move the reusable PCI specific parts into pcidev.c, they'll be usable
for other NIC code (Realtek, VIA, ...) and also for SATA/IDE controller
cards as external programmers (for every PCI device which can program
EEPROMs basically).

Also add print_supported_pcidevs() to show the supported PCI devices
(currently only NICs, soon more) in the 'flashrom -L' output.

Corresponding to flashrom svn r515.

Signed-off-by: Uwe Hermann <uwe@hermann-uwe.de>
Acked-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
diff --git a/flashrom.c b/flashrom.c
index 9c26b59..e00e678 100644
--- a/flashrom.c
+++ b/flashrom.c
@@ -35,7 +35,6 @@
 int exclude_start_page, exclude_end_page;
 int verbose = 0;
 int programmer = PROGRAMMER_INTERNAL;
-char *nic_pcidev = NULL;
 
 const struct programmer_entry programmer_table[] = {
 	{
@@ -446,6 +445,9 @@
 			print_supported_chips();
 			print_supported_chipsets();
 			print_supported_boards();
+			printf("\nSupported PCI devices flashrom can use "
+			       "as programmer:\n\n");
+			print_supported_pcidevs(nics_3com);
 			exit(0);
 			break;
 		case 'p':
@@ -456,7 +458,7 @@
 			} else if (strncmp(optarg, "nic3com", 7) == 0) {
 				programmer = PROGRAMMER_NIC3COM;
 				if (optarg[7] == '=')
-					nic_pcidev = strdup(optarg + 8);
+					pcidev_bdf = strdup(optarg + 8);
 			} else {
 				printf("Error: Unknown programmer.\n");
 				exit(1);