summaryrefslogtreecommitdiff
path: root/internal.c
diff options
context:
space:
mode:
authorhailfinger <hailfinger@2b7e53f0-3cfb-0310-b3e9-8179ed1497e1>2009-11-15 17:13:29 +0000
committerhailfinger <hailfinger@2b7e53f0-3cfb-0310-b3e9-8179ed1497e1>2009-11-15 17:13:29 +0000
commitc703fc277d45284f11a4f0083d8fdcd45bb39c49 (patch)
tree78f6e15401905632b29a18e08700772a5e380f4b /internal.c
parentd22a15aee8d4d3c577c118ef72f4f046d193d57e (diff)
downloadflashrom-c703fc277d45284f11a4f0083d8fdcd45bb39c49.tar.gz
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. Signed-off-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net> Acked-by: Adrian Glaubitz <glaubitz@physik.fu-berlin.de> git-svn-id: https://code.coreboot.org/svn/flashrom/trunk@759 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1
Diffstat (limited to 'internal.c')
-rw-r--r--internal.c20
1 files changed, 20 insertions, 0 deletions
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;