summaryrefslogtreecommitdiff
path: root/src/pci.h
diff options
context:
space:
mode:
authorBob Gilligan <gilligan@vyatta.com>2010-02-05 09:54:11 -0800
committerBob Gilligan <gilligan@vyatta.com>2010-02-05 09:54:11 -0800
commite1971e4774a6ebb5ed33a09bdd60afa2c0534b6f (patch)
treef4fc5aaccb4d9dac43ae7a825df9006532c1a059 /src/pci.h
downloadvyatta-biosdevname-e1971e4774a6ebb5ed33a09bdd60afa2c0534b6f.tar.gz
vyatta-biosdevname-e1971e4774a6ebb5ed33a09bdd60afa2c0534b6f.zip
Initial commit.debian/0.1
Diffstat (limited to 'src/pci.h')
-rw-r--r--src/pci.h53
1 files changed, 53 insertions, 0 deletions
diff --git a/src/pci.h b/src/pci.h
new file mode 100644
index 0000000..fbd195a
--- /dev/null
+++ b/src/pci.h
@@ -0,0 +1,53 @@
+/*
+ * Copyright (c) 2006 Dell, Inc.
+ * by Matt Domsch <Matt_Domsch@dell.com>
+ * Licensed under the GNU General Public license, version 2.
+ */
+
+#ifndef PCI_H_INCLUDED
+#define PCI_H_INCLUDED
+
+#include <pci/pci.h>
+#include "list.h"
+#include "state.h"
+#include "config.h"
+
+struct pci_device {
+ struct list_head node;
+ struct pci_dev pci_dev;
+ int physical_slot;
+ unsigned int index_in_slot;
+ unsigned short int class;
+ unsigned char smbios_type;
+ unsigned char smbios_instance;
+ unsigned char smbios_enabled;
+};
+
+extern int get_pci_devices(struct libbiosdevname_state *state);
+extern void free_pci_devices(struct libbiosdevname_state *state);
+
+extern struct pci_device * find_dev_by_pci(const struct libbiosdevname_state *state, const struct pci_dev *p);
+extern struct pci_device * find_pci_dev_by_pci_addr(const struct libbiosdevname_state *state, const int domain, const int bus, const int device, const int func);
+extern struct pci_device * find_dev_by_pci_name(const struct libbiosdevname_state *state, const char *s);
+extern int unparse_pci_device(char *buf, const int size, const struct pci_device *p);
+extern int unparse_pci_name(char *buf, int size, const struct pci_dev *pdev);
+
+static inline int is_pci_network(struct pci_device *dev)
+{
+ return (dev->class & 0xFF00) == 0x0200;
+}
+
+#ifdef HAVE_STRUCT_PCI_DEV_DOMAIN
+static inline int pci_domain_nr(const struct pci_dev *dev)
+{
+ return dev->domain;
+}
+#else
+static inline int pci_domain_nr(const struct pci_dev *dev)
+{
+ return 0;
+}
+#endif
+
+
+#endif /* PCI_H_INCLUDED */