On 11.04.2016 13:04, Alexander Gordeev wrote: > Cc: Thomas Huth <thuth@xxxxxxxxxx> > Cc: Andrew Jones <drjones@xxxxxxxxxx> > Signed-off-by: Alexander Gordeev <agordeev@xxxxxxxxxx> > --- > lib/pci.c | 8 ++++++++ > lib/pci.h | 1 + > 2 files changed, 9 insertions(+) > > diff --git a/lib/pci.c b/lib/pci.c > index 43e9c0c38434..46aee60e0f90 100644 > --- a/lib/pci.c > +++ b/lib/pci.c > @@ -84,6 +84,14 @@ phys_addr_t pci_bar_size(pcidevaddr_t dev, int bar_num) > } > } > > +void pci_bar_set(pcidevaddr_t dev, int bar_num, uint64_t addr) > +{ > + int off = PCI_BASE_ADDRESS_0 + bar_num * 4; > + pci_config_writel(dev, off, (uint32_t)addr); > + if (pci_bar_is64(dev, bar_num)) > + pci_config_writel(dev, (uint32_t)(addr >> 32), off + 4); > +} > + > bool pci_bar_is_memory(pcidevaddr_t dev, int bar_num) > { > uint32_t bar = pci_config_readl(dev, PCI_BASE_ADDRESS_0 + bar_num * 4); > diff --git a/lib/pci.h b/lib/pci.h > index 09b500ea19f0..69d2a62f1b32 100644 > --- a/lib/pci.h > +++ b/lib/pci.h > @@ -15,6 +15,7 @@ enum { > PCIDEVADDR_INVALID = 0xffff, > }; > pcidevaddr_t pci_find_dev(uint16_t vendor_id, uint16_t device_id); > +void pci_bar_set(pcidevaddr_t dev, int bar_num, uint64_t addr); > phys_addr_t pci_bar_addr(pcidevaddr_t dev, int bar_num); > phys_addr_t pci_bar_size(pcidevaddr_t dev, int bar_num); > bool pci_bar_is64(pcidevaddr_t dev, int bar_num); > Reviewed-by: Thomas Huth <thuth@xxxxxxxxxx> -- 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