hw: Use the PCI_SLOT() macro from 'hw/pci/pci.h'
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>
This commit is contained in:
parent
d08b9c1b75
commit
8d40def66d
@ -496,7 +496,7 @@ static void dino_set_irq(void *opaque, int irq, int level)
|
||||
|
||||
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);
|
||||
|
||||
|
@ -140,7 +140,7 @@ typedef struct XenIOState {
|
||||
|
||||
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)
|
||||
|
@ -361,7 +361,7 @@ type_init(piix3_register_types)
|
||||
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;
|
||||
}
|
||||
|
||||
|
@ -982,7 +982,7 @@ static int gt64120_pci_map_irq(PCIDevice *pci_dev, int irq_num)
|
||||
{
|
||||
int slot;
|
||||
|
||||
slot = (pci_dev->devfn >> 3);
|
||||
slot = PCI_SLOT(pci_dev->devfn);
|
||||
|
||||
switch (slot) {
|
||||
/* PIIX4 USB */
|
||||
|
@ -570,7 +570,7 @@ static int pci_bonito_map_irq(PCIDevice *pci_dev, int irq_num)
|
||||
{
|
||||
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 */
|
||||
|
@ -342,7 +342,7 @@ static const MemoryRegionOps e500_pci_reg_ops = {
|
||||
|
||||
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);
|
||||
|
@ -243,7 +243,7 @@ static void ppc4xx_pci_reset(void *opaque)
|
||||
* 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);
|
||||
|
||||
|
@ -109,7 +109,7 @@ static const MemoryRegionOps sh_pci_reg_ops = {
|
||||
|
||||
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)
|
||||
|
Loading…
Reference in New Issue
Block a user