From 9f46cfca38fad1c35c02bddfaa1f5325e5cd5354 Mon Sep 17 00:00:00 2001 From: Carl-Daniel Hailfinger Date: Sun, 15 Nov 2009 17:13:29 +0000 Subject: Add support for every single SiS chipset out there The two existing SiS chipset enables (compared to the 28 in this patch) were refactored, and one of them was fixed. A function to match PCI vendor/class combinations was added to generic code. Tested on the "Elitegroup K7S5A". Results are somewhat unexpected (some PCI settings seem to be inaccessible, but it still works). This is not based on any docs, but rather on detailed analysis of existing opensource code for some of the chipsets. Thanks to for Adrian Glaubitz testing. Corresponding to flashrom svn r759. Signed-off-by: Carl-Daniel Hailfinger Acked-by: Adrian Glaubitz --- internal.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'internal.c') diff --git a/internal.c b/internal.c index ea12bbc..fc662c5 100644 --- a/internal.c +++ b/internal.c @@ -42,6 +42,26 @@ struct pci_dev *pci_dev_find_filter(struct pci_filter filter) return NULL; } +struct pci_dev *pci_dev_find_vendorclass(uint16_t vendor, uint16_t class) +{ + struct pci_dev *temp; + struct pci_filter filter; + uint16_t tmp2; + + pci_filter_init(NULL, &filter); + filter.vendor = vendor; + + for (temp = pacc->devices; temp; temp = temp->next) + if (pci_filter_match(&filter, temp)) { + /* Read PCI class */ + tmp2 = pci_read_word(temp, 0x0a); + if (tmp2 == class) + return temp; + } + + return NULL; +} + struct pci_dev *pci_dev_find(uint16_t vendor, uint16_t device) { struct pci_dev *temp; -- cgit v1.1