From 515ab3de05f81253b94e7dd659f09c50724fb830 Mon Sep 17 00:00:00 2001 From: Uwe Hermann Date: Fri, 15 May 2009 17:02:34 +0000 Subject: 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 Acked-by: Carl-Daniel Hailfinger --- flash.h | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) (limited to 'flash.h') diff --git a/flash.h b/flash.h index e25f31e..11e14c6 100644 --- a/flash.h +++ b/flash.h @@ -551,6 +551,23 @@ struct pci_dev *pci_dev_find(uint16_t vendor, uint16_t device); struct pci_dev *pci_card_find(uint16_t vendor, uint16_t device, uint16_t card_vendor, uint16_t card_device); +/* pcidev.c */ +#define PCI_OK 0 +#define PCI_NT 1 /* Not tested */ +extern uint32_t io_base_addr; +extern struct pci_access *pacc; +extern struct pci_filter filter; +struct pcidev_status { + uint16_t vendor_id; + uint16_t device_id; + int status; + const char *vendor_name; + const char *device_name; +}; +uint32_t pcidev_validate(struct pci_dev *dev, struct pcidev_status *devs); +uint32_t pcidev_init(uint16_t vendor_id, struct pcidev_status *devs); +void print_supported_pcidevs(struct pcidev_status *devs); + /* board_enable.c */ void w836xx_ext_enter(uint16_t port); void w836xx_ext_leave(uint16_t port); @@ -623,13 +640,14 @@ void nic3com_chip_writel(uint32_t val, volatile void *addr); uint8_t nic3com_chip_readb(const volatile void *addr); uint16_t nic3com_chip_readw(const volatile void *addr); uint32_t nic3com_chip_readl(const volatile void *addr); +extern struct pcidev_status nics_3com[]; /* flashrom.c */ extern int verbose; #define printf_debug(x...) { if (verbose) printf(x); } void map_flash_registers(struct flashchip *flash); int read_memmapped(struct flashchip *flash, uint8_t *buf); -extern char *nic_pcidev; +extern char *pcidev_bdf; /* layout.c */ int show_id(uint8_t *bios, int size, int force); -- cgit v1.1