On Fri, Nov 04, 2016 at 05:47:20PM +0100, Andrew Jones wrote: > On Wed, Oct 26, 2016 at 03:47:10PM +0800, Peter Xu wrote: > > Let's provide a more general way to scan PCI bars, rather than read the > > config registers every time. > > > > Signed-off-by: Peter Xu <peterx@xxxxxxxxxx> > > --- > > lib/pci.c | 14 ++++++++++++++ > > lib/pci.h | 3 +++ > > 2 files changed, 17 insertions(+) > > > > diff --git a/lib/pci.c b/lib/pci.c > > index bb41e0f..95a6581 100644 > > --- a/lib/pci.c > > +++ b/lib/pci.c > > @@ -35,6 +35,20 @@ int pci_find_dev(struct pci_dev *pci_dev, uint16_t vendor_id, uint16_t device_id > > return -1; > > } > > > > +void pci_scan_bars(struct pci_dev *dev) > > +{ > > + int i = 0; > > + > > + for (i = 0; i < PCI_BAR_NUM; i++) { > > I don't think we need a PCI_BAR_NUM def, but if you do introduce it > then please change all uses of '6' to it that should be changed. > Same goes for PCI_DEVFN_MAX. Then I will replace corresponding number "6" into PCI_BAR_NUM when necessary. Same for PCI_DEVFN_MAX. > > > + if (!pci_bar_is_valid(dev, i)) > > + continue; > > + dev->pci_bar[i] = pci_bar_get_addr(dev, i); > > + printf("PCI: init dev 0x%04x BAR %d [%s] addr 0x%lx\n", > > + dev->pci_bdf, i, pci_bar_is_memory(dev, i) ? > > + "MEM" : "IO", dev->pci_bar[i]); > > v9 of Alex's series has introduced pci_bar_print. You'll want to > use that here after modifying it to get the bars from struct. Ok. Will call pci_bar_print() here. Thanks, -- peterx -- To unsubscribe from this list: send the line "unsubscribe kvm" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html