hw/pci-host: Use the PCI_BUILD_BDF() macro from 'hw/pci/pci.h'

We already have a generic PCI_BUILD_BDF() macro in "hw/pci/pci.h"
to pack these values, use it.

Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Acked-by: David Gibson <david@gibson.dropbear.id.au>
Acked-by: Michael S. Tsirkin <mst@redhat.com>
Message-Id: <20201012124506.3406909-3-philmd@redhat.com>
This commit is contained in:
Philippe Mathieu-Daudé 2020-10-11 17:18:59 +02:00
parent e551455f1e
commit 0374cbd2f1
2 changed files with 2 additions and 3 deletions

View File

@ -196,8 +196,7 @@ FIELD(BONGENCFG, PCIQUEUE, 12, 1)
#define PCI_IDSEL_VIA686B (1 << PCI_IDSEL_VIA686B_BIT) #define PCI_IDSEL_VIA686B (1 << PCI_IDSEL_VIA686B_BIT)
#define PCI_ADDR(busno , devno , funno , regno) \ #define PCI_ADDR(busno , devno , funno , regno) \
((((busno) << 16) & 0xff0000) + (((devno) << 11) & 0xf800) + \ ((PCI_BUILD_BDF(busno, PCI_DEVFN(devno , funno)) << 8) + (regno))
(((funno) << 8) & 0x700) + (regno))
typedef struct BonitoState BonitoState; typedef struct BonitoState BonitoState;

View File

@ -889,7 +889,7 @@ static bool pnv_phb4_resolve_pe(PnvPhb4DMASpace *ds)
/* Read RTE */ /* Read RTE */
bus_num = pci_bus_num(ds->bus); bus_num = pci_bus_num(ds->bus);
addr = rtt & PHB_RTT_BASE_ADDRESS_MASK; addr = rtt & PHB_RTT_BASE_ADDRESS_MASK;
addr += 2 * ((bus_num << 8) | ds->devfn); addr += 2 * PCI_BUILD_BDF(bus_num, ds->devfn);
if (dma_memory_read(&address_space_memory, addr, &rte, sizeof(rte))) { if (dma_memory_read(&address_space_memory, addr, &rte, sizeof(rte))) {
phb_error(ds->phb, "Failed to read RTT entry at 0x%"PRIx64, addr); phb_error(ds->phb, "Failed to read RTT entry at 0x%"PRIx64, addr);
/* Set error bits ? fence ? ... */ /* Set error bits ? fence ? ... */