[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 04/35] hw: Use the PCI_DEVFN() macro from 'hw/pci/pci.h'
From: |
Philippe Mathieu-Daudé |
Subject: |
[PULL 04/35] hw: Use the PCI_DEVFN() macro from 'hw/pci/pci.h' |
Date: |
Sun, 3 Jan 2021 21:49:50 +0100 |
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é <f4bug@amsat.org>
Acked-by: David Gibson <david@gibson.dropbear.id.au>
Message-Id: <20201012124506.3406909-6-philmd@redhat.com>
Reviewed-by: Huacai Chen <chenhuacai@kernel.org>
Message-Id: <20201231224911.1467352-4-f4bug@amsat.org>
---
hw/arm/virt.c | 3 ++-
hw/pci-host/bonito.c | 2 +-
hw/pci-host/uninorth.c | 6 ++----
3 files changed, 5 insertions(+), 6 deletions(-)
diff --git a/hw/arm/virt.c b/hw/arm/virt.c
index 96985917d3b..bf3a7171118 100644
--- a/hw/arm/virt.c
+++ b/hw/arm/virt.c
@@ -1147,7 +1147,8 @@ static void create_pcie_irq_map(const VirtMachineState
*vms,
full_irq_map, sizeof(full_irq_map));
qemu_fdt_setprop_cells(vms->fdt, nodename, "interrupt-map-mask",
- 0x1800, 0, 0, /* devfn (PCI_SLOT(3)) */
+ cpu_to_be16(PCI_DEVFN(3, 0)), /* Slot 3 */
+ 0, 0,
0x7 /* PCI irq */);
}
diff --git a/hw/pci-host/bonito.c b/hw/pci-host/bonito.c
index ee8b193e15b..40dda237d8e 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 f0a4d8c7178..d25b62d6a5b 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);
--
2.26.2
- [PULL 00/35] MIPS patches for 2021-01-03, Philippe Mathieu-Daudé, 2021/01/03
- [PULL 01/35] hw/pci-host: Use the PCI_BUILD_BDF() macro from 'hw/pci/pci.h', Philippe Mathieu-Daudé, 2021/01/03
- [PULL 02/35] hw/pci-host/uninorth: Use the PCI_FUNC() macro from 'hw/pci/pci.h', Philippe Mathieu-Daudé, 2021/01/03
- [PULL 03/35] hw: Use the PCI_SLOT() macro from 'hw/pci/pci.h', Philippe Mathieu-Daudé, 2021/01/03
- [PULL 04/35] hw: Use the PCI_DEVFN() macro from 'hw/pci/pci.h',
Philippe Mathieu-Daudé <=
- [PULL 05/35] hw/pci-host/bonito: Display hexadecimal value with '0x' prefix, Philippe Mathieu-Daudé, 2021/01/03
- [PULL 06/35] hw/pci-host/bonito: Use pci_config_set_interrupt_pin(), Philippe Mathieu-Daudé, 2021/01/03
- [PULL 07/35] vt82c686: Rename AC97/MC97 parts from VT82C686B to VIA, Philippe Mathieu-Daudé, 2021/01/03
- [PULL 08/35] vt82c686: Remove unnecessary _DEVICE suffix from type macros, Philippe Mathieu-Daudé, 2021/01/03
- [PULL 09/35] vt82c686: Rename VT82C686B to VT82C686B_ISA, Philippe Mathieu-Daudé, 2021/01/03
- [PULL 10/35] vt82c686: Remove vt82c686b_[am]c97_init() functions, Philippe Mathieu-Daudé, 2021/01/03
- [PULL 11/35] vt82c686: Split off via-[am]c97 into separate file in hw/audio, Philippe Mathieu-Daudé, 2021/01/03
- [PULL 12/35] audio/via-ac97: Simplify code and set user_creatable to false, Philippe Mathieu-Daudé, 2021/01/03
- [PULL 13/35] vt82c686: Remove legacy vt82c686b_isa_init() function, Philippe Mathieu-Daudé, 2021/01/03
- [PULL 14/35] vt82c686: Remove legacy vt82c686b_pm_init() function, Philippe Mathieu-Daudé, 2021/01/03