14932b58aSMichael S. Tsirkin #ifndef PCI_H 24932b58aSMichael S. Tsirkin #define PCI_H 3*456c55bcSAndrew Jones /* 4*456c55bcSAndrew Jones * API for scanning a PCI bus for a given device, as well to access 5*456c55bcSAndrew Jones * BAR registers. 6*456c55bcSAndrew Jones * 7*456c55bcSAndrew Jones * Copyright (C) 2013, Red Hat Inc, Michael S. Tsirkin <mst@redhat.com> 8*456c55bcSAndrew Jones * 9*456c55bcSAndrew Jones * This work is licensed under the terms of the GNU LGPL, version 2. 10*456c55bcSAndrew Jones */ 114932b58aSMichael S. Tsirkin #include "libcflat.h" 124932b58aSMichael S. Tsirkin 134932b58aSMichael S. Tsirkin typedef uint16_t pcidevaddr_t; 144932b58aSMichael S. Tsirkin enum { 154932b58aSMichael S. Tsirkin PCIDEVADDR_INVALID = 0x0 164932b58aSMichael S. Tsirkin }; 174932b58aSMichael S. Tsirkin pcidevaddr_t pci_find_dev(uint16_t vendor_id, uint16_t device_id); 184932b58aSMichael S. Tsirkin unsigned long pci_bar_addr(pcidevaddr_t dev, int bar_num); 194932b58aSMichael S. Tsirkin bool pci_bar_is_memory(pcidevaddr_t dev, int bar_num); 204932b58aSMichael S. Tsirkin bool pci_bar_is_valid(pcidevaddr_t dev, int bar_num); 214932b58aSMichael S. Tsirkin 224932b58aSMichael S. Tsirkin #endif 23