[Is the quoting amount OK here? I'm trying to get a feeling for minimal quoting. Feedback appreciated.]
On 15.05.2009 17:57, Uwe Hermann wrote:
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.
Signed-off-by: Uwe Hermann uwe@hermann-uwe.de
Acked-by: Carl-Daniel Hailfinger c-d.hailfinger.devel.2006@gmx.net with the changes below.
Index: flash.h
--- flash.h (Revision 514) +++ flash.h (Arbeitskopie) @@ -551,6 +551,23 @@ struct pci_dev *pci_card_find(uint16_t vendor, uint16_t device, uint16_t card_vendor, uint16_t card_device);
+/* pcidev.c */ +#define OK 0 +#define NT 1 /* Not tested */
Please use PCI_OK and PCI_NT (or PCI_UNTESTED).
Index: pcidev.c
--- pcidev.c (Revision 0) +++ pcidev.c (Revision 0) @@ -0,0 +1,115 @@ +uint32_t pcidev_validate(struct pci_dev *dev, struct pcidev_status *devs) +{
- int i;
- uint32_t addr;
- for (i = 0; devs[i].device_name != NULL; i++) {
if (dev->device_id != devs[i].device_id)
continue;
addr = (uint32_t)(dev->base_addr[0] & ~0x03);
printf("Found \"%s %s\" (%04x:%04x, BDF %02x:%02x.%x)\n",
devs[i].vendor_name, devs[i].device_name, dev->vendor_id,
dev->device_id, dev->bus, dev->dev, dev->func);
if (devs[i].status == NT) {
Same comment as above.
+void print_supported_pcidevs(struct pcidev_status *devs) +{
- int i;
- for (i = 0; devs[i].vendor_name != NULL; i++) {
printf("%s %s [%02x:%02x]%s\n", devs[i].vendor_name,
devs[i].device_name, devs[i].vendor_id,
devs[i].device_id,
(devs[i].status == NT) ? " (untested)" : "");
Dito.
Regards, Carl-Daniel