2 * This file is part of the libpayload project.
\r
4 * Copyright (C) 2010 coresystems GmbH
\r
6 * Redistribution and use in source and binary forms, with or without
\r
7 * modification, are permitted provided that the following conditions
\r
9 * 1. Redistributions of source code must retain the above copyright
\r
10 * notice, this list of conditions and the following disclaimer.
\r
11 * 2. Redistributions in binary form must reproduce the above copyright
\r
12 * notice, this list of conditions and the following disclaimer in the
\r
13 * documentation and/or other materials provided with the distribution.
\r
14 * 3. The name of the author may not be used to endorse or promote products
\r
15 * derived from this software without specific prior written permission.
\r
17 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
\r
18 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
\r
19 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
\r
20 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
\r
21 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
\r
22 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
\r
23 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
\r
24 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
\r
25 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
\r
26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
\r
33 /* we implement at least this version */
\r
34 #define PCI_LIB_VERSION 0x020200
\r
38 #define PCI_CLASS_DEVICE REG_CLASS_DEV
\r
39 #define PCI_SUBSYSTEM_VENDOR_ID REG_SUBSYS_VENDOR_ID
\r
40 #define PCI_SUBSYSTEM_ID REG_SUBSYS_ID
\r
45 u16 vendor_id, device_id;
\r
46 struct pci_dev *next;
\r
50 * values to match devices against.
\r
51 * "-1" means "don't care", everything else requires an exact match
\r
54 int domain, bus, dev, func;
\r
56 struct pci_dev *devices;
\r
60 struct pci_dev *devices;
\r
63 u8 pci_read_byte(struct pci_dev *dev, int pos);
\r
64 u16 pci_read_word(struct pci_dev *dev, int pos);
\r
65 u32 pci_read_long(struct pci_dev *dev, int pos);
\r
67 int pci_write_byte(struct pci_dev *dev, int pos, u8 data);
\r
68 int pci_write_word(struct pci_dev *dev, int pos, u16 data);
\r
69 int pci_write_long(struct pci_dev *dev, int pos, u32 data);
\r
71 struct pci_access *pci_alloc(void);
\r
72 void pci_init(struct pci_access*);
\r
73 char *pci_filter_parse_slot(struct pci_filter*, const char*);
\r
74 int pci_filter_match(struct pci_filter*, struct pci_dev*);
\r
75 void pci_filter_init(struct pci_access*, struct pci_filter*);
\r
76 void pci_scan_bus(struct pci_access*);
\r
77 struct pci_dev *pci_get_dev(struct pci_access*, u16, u8, u8, u8);
\r