We already have a generic PCI_SLOT() macro in "hw/pci/pci.h"
to extract the PCI slot identifier, use it.
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Acked-by: Paul Durrant <paul@xen.org>
Acked-by: David Gibson <david@gibson.dropbear.id.au>
Acked-by: Michael S. Tsirkin <mst@redhat.com>
Message-Id: <
20201012124506.
3406909-5-philmd@redhat.com>
static int dino_pci_map_irq(PCIDevice *d, int irq_num)
{
- int slot = d->devfn >> 3;
+ int slot = PCI_SLOT(d->devfn);
assert(irq_num >= 0 && irq_num <= 3);
int xen_pci_slot_get_pirq(PCIDevice *pci_dev, int irq_num)
{
- return irq_num + ((pci_dev->devfn >> 3) << 2);
+ return irq_num + (PCI_SLOT(pci_dev->devfn) << 2);
}
void xen_piix3_set_irq(void *opaque, int irq_num, int level)
static int pci_slot_get_pirq(PCIDevice *pci_dev, int pci_intx)
{
int slot_addend;
- slot_addend = (pci_dev->devfn >> 3) - 1;
+ slot_addend = PCI_SLOT(pci_dev->devfn) - 1;
return (pci_intx + slot_addend) & 3;
}
{
int slot;
- slot = (pci_dev->devfn >> 3);
+ slot = PCI_SLOT(pci_dev->devfn);
switch (slot) {
/* PIIX4 USB */
{
int slot;
- slot = (pci_dev->devfn >> 3);
+ slot = PCI_SLOT(pci_dev->devfn);
switch (slot) {
case 5: /* FULOONG2E_VIA_SLOT, SouthBridge, IDE, USB, ACPI, AC97, MC97 */
static int mpc85xx_pci_map_irq(PCIDevice *pci_dev, int pin)
{
- int devno = pci_dev->devfn >> 3;
+ int devno = PCI_SLOT(pci_dev->devfn);
int ret;
ret = ppce500_pci_map_irq_slot(devno, pin);
* may need further refactoring for other boards. */
static int ppc4xx_pci_map_irq(PCIDevice *pci_dev, int irq_num)
{
- int slot = pci_dev->devfn >> 3;
+ int slot = PCI_SLOT(pci_dev->devfn);
trace_ppc4xx_pci_map_irq(pci_dev->devfn, irq_num, slot);
static int sh_pci_map_irq(PCIDevice *d, int irq_num)
{
- return (d->devfn >> 3);
+ return PCI_SLOT(d->devfn);
}
static void sh_pci_set_irq(void *opaque, int irq_num, int level)