diff options
author | Patrick Georgi <patrick.georgi@coresystems.de> | 2010-06-24 14:15:49 +0000 |
---|---|---|
committer | Patrick Georgi <patrick.georgi@coresystems.de> | 2010-06-24 14:15:49 +0000 |
commit | c9f705b12195b7c1ff9814f76c78c76d4b8498b1 (patch) | |
tree | 5b0d1bd4e32ecbe6e6dc22fd61c38f39b6277aa4 /payloads/libpayload/include | |
parent | 9bb0438535d29329f6a01a136caa2f2ad79fdceb (diff) | |
download | coreboot-c9f705b12195b7c1ff9814f76c78c76d4b8498b1.tar.xz |
Incomplete implementation of libpci's (of pciutils) interface.
No pciutils code was harmed in its production - this code was written by
looking at flashrom's expectations, so there's no license pollution.
Signed-off-by: Patrick Georgi <patrick.georgi@coresystems.de>
Acked-by: Peter Stuge <peter@stuge.se>
git-svn-id: svn://svn.coreboot.org/coreboot/trunk@5645 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1
Diffstat (limited to 'payloads/libpayload/include')
-rw-r--r-- | payloads/libpayload/include/pci/pci.h | 76 |
1 files changed, 76 insertions, 0 deletions
diff --git a/payloads/libpayload/include/pci/pci.h b/payloads/libpayload/include/pci/pci.h new file mode 100644 index 0000000000..0a06604e5d --- /dev/null +++ b/payloads/libpayload/include/pci/pci.h @@ -0,0 +1,76 @@ +/*
+ * This file is part of the libpayload project.
+ *
+ * Copyright (C) 2010 coresystems GmbH
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. The name of the author may not be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#ifndef _PCI_PCI_H
+#define _PCI_PCI_H
+
+#include <pci.h>
+
+#define PCI_CLASS_DEVICE REG_CLASS_DEV
+#define PCI_SUBSYSTEM_VENDOR_ID REG_SUBSYS_VENDOR_ID
+#define PCI_SUBSYSTEM_ID REG_SUBSYS_ID
+
+struct pci_dev {
+ u16 domain;
+ u8 bus, dev, func;
+ u16 vendor_id, device_id;
+ struct pci_dev *next;
+};
+
+/*
+ * values to match devices against.
+ * "-1" means "don't care", everything else requires an exact match
+ */
+struct pci_filter {
+ int domain, bus, dev, func;
+ int vendor, device;
+ struct pci_dev *devices;
+};
+
+struct pci_access {
+ struct pci_dev *devices;
+};
+
+u8 pci_read_byte(struct pci_dev *dev, int pos);
+u16 pci_read_word(struct pci_dev *dev, int pos);
+u32 pci_read_long(struct pci_dev *dev, int pos);
+
+int pci_write_byte(struct pci_dev *dev, int pos, u8 data);
+int pci_write_word(struct pci_dev *dev, int pos, u16 data);
+int pci_write_long(struct pci_dev *dev, int pos, u32 data);
+
+struct pci_access *pci_alloc(void);
+void pci_init(struct pci_access*);
+char *pci_filter_parse_slot(struct pci_filter*, const char*);
+int pci_filter_match(struct pci_filter*, struct pci_dev*);
+void pci_filter_init(struct pci_access*, struct pci_filter*);
+void pci_scan_bus(struct pci_access*);
+struct pci_dev *pci_get_dev(struct pci_access*, u16, u8, u8, u8);
+
+#endif
|