summaryrefslogtreecommitdiffstats
path: root/hw/ppc/e500.c
diff options
context:
space:
mode:
authorAlexander Graf <agraf@suse.de>2012-12-13 01:16:24 +0100
committerAlexander Graf <agraf@suse.de>2012-12-14 13:12:57 +0100
commit9e2c12988bebca7b99c0cd064b23fb7ea6643c86 (patch)
tree7dee741527eb75b537cccac75ccef86aae9a70c0 /hw/ppc/e500.c
parent3bb7e02a9725a24e5bf915b35f914f82f5b07a1f (diff)
downloadhqemu-9e2c12988bebca7b99c0cd064b23fb7ea6643c86.zip
hqemu-9e2c12988bebca7b99c0cd064b23fb7ea6643c86.tar.gz
PPC: e500: pci: Export slot2irq calculation
We need the calculation method to get from a PCI slot ID to its respective interrupt line twice. Once in the internal map function and once when assembling the device tree. So let's extract the calculation to a separate function that can be called by both users. Signed-off-by: Alexander Graf <agraf@suse.de>
Diffstat (limited to 'hw/ppc/e500.c')
-rw-r--r--hw/ppc/e500.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/hw/ppc/e500.c b/hw/ppc/e500.c
index 564f654..af6b671 100644
--- a/hw/ppc/e500.c
+++ b/hw/ppc/e500.c
@@ -34,6 +34,7 @@
#include "hw/sysbus.h"
#include "exec-memory.h"
#include "host-utils.h"
+#include "hw/ppce500_pci.h"
#define BINARY_DEVICE_TREE_FILE "mpc8544ds.dtb"
#define UIMAGE_LOAD_BASE 0
@@ -72,6 +73,7 @@ static uint32_t *pci_map_create(void *fdt, uint32_t mpic, int first_slot,
int i = 0;
int slot;
int pci_irq;
+ int host_irq;
int last_slot = first_slot + nr_slots;
uint32_t *pci_map;
@@ -85,7 +87,8 @@ static uint32_t *pci_map_create(void *fdt, uint32_t mpic, int first_slot,
pci_map[i++] = cpu_to_be32(0x0);
pci_map[i++] = cpu_to_be32(pci_irq + 1);
pci_map[i++] = cpu_to_be32(mpic);
- pci_map[i++] = cpu_to_be32(((pci_irq + slot) % 4) + 1);
+ host_irq = ppce500_pci_map_irq_slot(slot, pci_irq);
+ pci_map[i++] = cpu_to_be32(host_irq + 1);
pci_map[i++] = cpu_to_be32(0x1);
}
}
OpenPOWER on IntegriCloud