From 4934e479f1806e69cfab637156fe136994619c03 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Date: Mon, 12 Oct 2020 08:36:41 +0200 Subject: hw: Use the PCI_DEVFN() macro from 'hw/pci/pci.h' MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit We already have a generic PCI_DEVFN() macro in "hw/pci/pci.h" to pack the PCI slot/function identifiers, use it. Signed-off-by: Philippe Mathieu-Daudé Acked-by: David Gibson Message-Id: <20201012124506.3406909-6-philmd@redhat.com> Reviewed-by: Huacai Chen Acked-by: Michael S. Tsirkin Message-Id: <20201231224911.1467352-4-f4bug@amsat.org> --- hw/pci-host/bonito.c | 2 +- hw/pci-host/uninorth.c | 6 ++---- 2 files changed, 3 insertions(+), 5 deletions(-) (limited to 'hw/pci-host') diff --git a/hw/pci-host/bonito.c b/hw/pci-host/bonito.c index ee8b193..40dda23 100644 --- a/hw/pci-host/bonito.c +++ b/hw/pci-host/bonito.c @@ -631,7 +631,7 @@ static void bonito_pcihost_realize(DeviceState *dev, Error **errp) phb->bus = pci_register_root_bus(dev, "pci", pci_bonito_set_irq, pci_bonito_map_irq, dev, &bs->pci_mem, get_system_io(), - 0x28, 32, TYPE_PCI_BUS); + PCI_DEVFN(5, 0), 32, TYPE_PCI_BUS); for (size_t i = 0; i < 3; i++) { char *name = g_strdup_printf("pci.lomem%zu", i); diff --git a/hw/pci-host/uninorth.c b/hw/pci-host/uninorth.c index f0a4d8c..d25b62d 100644 --- a/hw/pci-host/uninorth.c +++ b/hw/pci-host/uninorth.c @@ -68,10 +68,8 @@ static uint32_t unin_get_config_reg(uint32_t reg, uint32_t addr) /* ... and then convert them to x86 format */ /* config pointer */ retval = (reg & (0xff - 7)) | (addr & 7); - /* slot */ - retval |= slot << 11; - /* fn */ - retval |= func << 8; + /* slot, fn */ + retval |= PCI_DEVFN(slot, func) << 8; } trace_unin_get_config_reg(reg, addr, retval); -- cgit v1.1