summaryrefslogtreecommitdiff
path: root/util/superiotool/pci.c
diff options
context:
space:
mode:
Diffstat (limited to 'util/superiotool/pci.c')
-rw-r--r--util/superiotool/pci.c39
1 files changed, 39 insertions, 0 deletions
diff --git a/util/superiotool/pci.c b/util/superiotool/pci.c
new file mode 100644
index 0000000000..0548bc7ce0
--- /dev/null
+++ b/util/superiotool/pci.c
@@ -0,0 +1,39 @@
+/*
+ * This file is part of the superiotool project.
+ *
+ * Copyright (C) 2010 Uwe Hermann <uwe@hermann-uwe.de>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include "superiotool.h"
+
+struct pci_access *pacc;
+
+struct pci_dev *pci_dev_find(uint16_t vendor, uint16_t device)
+{
+ struct pci_dev *temp;
+ struct pci_filter filter;
+
+ pci_filter_init(NULL, &filter);
+ filter.vendor = vendor;
+ filter.device = device;
+
+ for (temp = pacc->devices; temp; temp = temp->next)
+ if (pci_filter_match(&filter, temp))
+ return temp;
+
+ return NULL;
+}