提交 896b63db 编写于 作者: P Peter Maydell

Merge remote-tracking branch 'remotes/dgibson/tags/ppc-for-3.0-20180801' into staging

ppc patch queue for 2018-08-01

Here are a final couple of fixes for the 3.0 release.

# gpg: Signature made Wed 01 Aug 2018 04:52:57 BST
# gpg:                using RSA key 6C38CACA20D9B392
# gpg: Good signature from "David Gibson <david@gibson.dropbear.id.au>"
# gpg:                 aka "David Gibson (Red Hat) <dgibson@redhat.com>"
# gpg:                 aka "David Gibson (ozlabs.org) <dgibson@ozlabs.org>"
# gpg:                 aka "David Gibson (kernel.org) <dwg@kernel.org>"
# Primary key fingerprint: 75F4 6586 AE61 A66C C44E  87DC 6C38 CACA 20D9 B392

* remotes/dgibson/tags/ppc-for-3.0-20180801:
  sam460ex: Fix PCI interrupts with multiple devices
  hw/misc/macio: Fix device introspection problems in macio devices
Signed-off-by: NPeter Maydell <peter.maydell@linaro.org>
...@@ -554,9 +554,8 @@ static void cuda_init(Object *obj) ...@@ -554,9 +554,8 @@ static void cuda_init(Object *obj)
CUDAState *s = CUDA(obj); CUDAState *s = CUDA(obj);
SysBusDevice *sbd = SYS_BUS_DEVICE(obj); SysBusDevice *sbd = SYS_BUS_DEVICE(obj);
object_initialize(&s->mos6522_cuda, sizeof(s->mos6522_cuda), sysbus_init_child_obj(obj, "mos6522-cuda", &s->mos6522_cuda,
TYPE_MOS6522_CUDA); sizeof(s->mos6522_cuda), TYPE_MOS6522_CUDA);
qdev_set_parent_bus(DEVICE(&s->mos6522_cuda), sysbus_get_default());
memory_region_init_io(&s->mem, obj, &mos6522_cuda_ops, s, "cuda", 0x2000); memory_region_init_io(&s->mem, obj, &mos6522_cuda_ops, s, "cuda", 0x2000);
sysbus_init_mmio(sbd, &s->mem); sysbus_init_mmio(sbd, &s->mem);
......
...@@ -209,14 +209,11 @@ static void macio_oldworld_realize(PCIDevice *d, Error **errp) ...@@ -209,14 +209,11 @@ static void macio_oldworld_realize(PCIDevice *d, Error **errp)
static void macio_init_ide(MacIOState *s, MACIOIDEState *ide, size_t ide_size, static void macio_init_ide(MacIOState *s, MACIOIDEState *ide, size_t ide_size,
int index) int index)
{ {
gchar *name; gchar *name = g_strdup_printf("ide[%i]", index);
object_initialize(ide, ide_size, TYPE_MACIO_IDE); sysbus_init_child_obj(OBJECT(s), name, ide, ide_size, TYPE_MACIO_IDE);
qdev_set_parent_bus(DEVICE(ide), sysbus_get_default());
memory_region_add_subregion(&s->bar, 0x1f000 + ((index + 1) * 0x1000), memory_region_add_subregion(&s->bar, 0x1f000 + ((index + 1) * 0x1000),
&ide->mem); &ide->mem);
name = g_strdup_printf("ide[%i]", index);
object_property_add_child(OBJECT(s), name, OBJECT(ide), NULL);
g_free(name); g_free(name);
} }
...@@ -232,9 +229,7 @@ static void macio_oldworld_init(Object *obj) ...@@ -232,9 +229,7 @@ static void macio_oldworld_init(Object *obj)
qdev_prop_allow_set_link_before_realize, qdev_prop_allow_set_link_before_realize,
0, NULL); 0, NULL);
object_initialize(&s->cuda, sizeof(s->cuda), TYPE_CUDA); sysbus_init_child_obj(obj, "cuda", &s->cuda, sizeof(s->cuda), TYPE_CUDA);
qdev_set_parent_bus(DEVICE(&s->cuda), sysbus_get_default());
object_property_add_child(obj, "cuda", OBJECT(&s->cuda), NULL);
object_initialize(&os->nvram, sizeof(os->nvram), TYPE_MACIO_NVRAM); object_initialize(&os->nvram, sizeof(os->nvram), TYPE_MACIO_NVRAM);
dev = DEVICE(&os->nvram); dev = DEVICE(&os->nvram);
...@@ -390,8 +385,8 @@ static void macio_newworld_init(Object *obj) ...@@ -390,8 +385,8 @@ static void macio_newworld_init(Object *obj)
qdev_prop_allow_set_link_before_realize, qdev_prop_allow_set_link_before_realize,
0, NULL); 0, NULL);
object_initialize(&ns->gpio, sizeof(ns->gpio), TYPE_MACIO_GPIO); sysbus_init_child_obj(obj, "gpio", &ns->gpio, sizeof(ns->gpio),
qdev_set_parent_bus(DEVICE(&ns->gpio), sysbus_get_default()); TYPE_MACIO_GPIO);
for (i = 0; i < 2; i++) { for (i = 0; i < 2; i++) {
macio_init_ide(s, &ns->ide[i], sizeof(ns->ide[i]), i); macio_init_ide(s, &ns->ide[i], sizeof(ns->ide[i]), i);
...@@ -404,13 +399,10 @@ static void macio_instance_init(Object *obj) ...@@ -404,13 +399,10 @@ static void macio_instance_init(Object *obj)
memory_region_init(&s->bar, obj, "macio", 0x80000); memory_region_init(&s->bar, obj, "macio", 0x80000);
object_initialize(&s->dbdma, sizeof(s->dbdma), TYPE_MAC_DBDMA); sysbus_init_child_obj(obj, "dbdma", &s->dbdma, sizeof(s->dbdma),
qdev_set_parent_bus(DEVICE(&s->dbdma), sysbus_get_default()); TYPE_MAC_DBDMA);
object_property_add_child(obj, "dbdma", OBJECT(&s->dbdma), NULL);
object_initialize(&s->escc, sizeof(s->escc), TYPE_ESCC); sysbus_init_child_obj(obj, "escc", &s->escc, sizeof(s->escc), TYPE_ESCC);
qdev_set_parent_bus(DEVICE(&s->escc), sysbus_get_default());
object_property_add_child(obj, "escc", OBJECT(&s->escc), NULL);
} }
static const VMStateDescription vmstate_macio_oldworld = { static const VMStateDescription vmstate_macio_oldworld = {
......
...@@ -770,9 +770,8 @@ static void pmu_init(Object *obj) ...@@ -770,9 +770,8 @@ static void pmu_init(Object *obj)
qdev_prop_allow_set_link_before_realize, qdev_prop_allow_set_link_before_realize,
0, NULL); 0, NULL);
object_initialize(&s->mos6522_pmu, sizeof(s->mos6522_pmu), sysbus_init_child_obj(obj, "mos6522-pmu", &s->mos6522_pmu,
TYPE_MOS6522_PMU); sizeof(s->mos6522_pmu), TYPE_MOS6522_PMU);
qdev_set_parent_bus(DEVICE(&s->mos6522_pmu), sysbus_get_default());
memory_region_init_io(&s->mem, obj, &mos6522_pmu_ops, s, "via-pmu", memory_region_init_io(&s->mem, obj, &mos6522_pmu_ops, s, "via-pmu",
0x2000); 0x2000);
......
...@@ -57,7 +57,7 @@ typedef struct PPC440PCIXState { ...@@ -57,7 +57,7 @@ typedef struct PPC440PCIXState {
struct PLBOutMap pom[PPC440_PCIX_NR_POMS]; struct PLBOutMap pom[PPC440_PCIX_NR_POMS];
struct PLBInMap pim[PPC440_PCIX_NR_PIMS]; struct PLBInMap pim[PPC440_PCIX_NR_PIMS];
uint32_t sts; uint32_t sts;
qemu_irq irq[PCI_NUM_PINS]; qemu_irq irq;
AddressSpace bm_as; AddressSpace bm_as;
MemoryRegion bm; MemoryRegion bm;
...@@ -418,21 +418,20 @@ static void ppc440_pcix_reset(DeviceState *dev) ...@@ -418,21 +418,20 @@ static void ppc440_pcix_reset(DeviceState *dev)
* This may need further refactoring for other boards. */ * This may need further refactoring for other boards. */
static int ppc440_pcix_map_irq(PCIDevice *pci_dev, int irq_num) static int ppc440_pcix_map_irq(PCIDevice *pci_dev, int irq_num)
{ {
int slot = pci_dev->devfn >> 3; trace_ppc440_pcix_map_irq(pci_dev->devfn, irq_num, 0);
trace_ppc440_pcix_map_irq(pci_dev->devfn, irq_num, slot); return 0;
return slot - 1;
} }
static void ppc440_pcix_set_irq(void *opaque, int irq_num, int level) static void ppc440_pcix_set_irq(void *opaque, int irq_num, int level)
{ {
qemu_irq *pci_irqs = opaque; qemu_irq *pci_irq = opaque;
trace_ppc440_pcix_set_irq(irq_num); trace_ppc440_pcix_set_irq(irq_num);
if (irq_num < 0) { if (irq_num < 0) {
error_report("%s: PCI irq %d", __func__, irq_num); error_report("%s: PCI irq %d", __func__, irq_num);
return; return;
} }
qemu_set_irq(pci_irqs[irq_num], level); qemu_set_irq(*pci_irq, level);
} }
static AddressSpace *ppc440_pcix_set_iommu(PCIBus *b, void *opaque, int devfn) static AddressSpace *ppc440_pcix_set_iommu(PCIBus *b, void *opaque, int devfn)
...@@ -471,19 +470,15 @@ static int ppc440_pcix_initfn(SysBusDevice *dev) ...@@ -471,19 +470,15 @@ static int ppc440_pcix_initfn(SysBusDevice *dev)
{ {
PPC440PCIXState *s; PPC440PCIXState *s;
PCIHostState *h; PCIHostState *h;
int i;
h = PCI_HOST_BRIDGE(dev); h = PCI_HOST_BRIDGE(dev);
s = PPC440_PCIX_HOST_BRIDGE(dev); s = PPC440_PCIX_HOST_BRIDGE(dev);
for (i = 0; i < ARRAY_SIZE(s->irq); i++) { sysbus_init_irq(dev, &s->irq);
sysbus_init_irq(dev, &s->irq[i]);
}
memory_region_init(&s->busmem, OBJECT(dev), "pci bus memory", UINT64_MAX); memory_region_init(&s->busmem, OBJECT(dev), "pci bus memory", UINT64_MAX);
h->bus = pci_register_root_bus(DEVICE(dev), NULL, ppc440_pcix_set_irq, h->bus = pci_register_root_bus(DEVICE(dev), NULL, ppc440_pcix_set_irq,
ppc440_pcix_map_irq, s->irq, &s->busmem, ppc440_pcix_map_irq, &s->irq, &s->busmem,
get_system_io(), PCI_DEVFN(0, 0), 4, TYPE_PCI_BUS); get_system_io(), PCI_DEVFN(0, 0), 1, TYPE_PCI_BUS);
s->dev = pci_create_simple(h->bus, PCI_DEVFN(0, 0), "ppc4xx-host-bridge"); s->dev = pci_create_simple(h->bus, PCI_DEVFN(0, 0), "ppc4xx-host-bridge");
......
...@@ -515,10 +515,8 @@ static void sam460ex_init(MachineState *machine) ...@@ -515,10 +515,8 @@ static void sam460ex_init(MachineState *machine)
/* PCI bus */ /* PCI bus */
ppc460ex_pcie_init(env); ppc460ex_pcie_init(env);
/* FIXME: is this correct? */ /* All PCI irqs are connected to the same UIC pin (cf. UBoot source) */
dev = sysbus_create_varargs("ppc440-pcix-host", 0xc0ec00000, dev = sysbus_create_simple("ppc440-pcix-host", 0xc0ec00000, uic[1][0]);
uic[1][0], uic[1][20], uic[1][21], uic[1][22],
NULL);
pci_bus = (PCIBus *)qdev_get_child_bus(dev, "pci.0"); pci_bus = (PCIBus *)qdev_get_child_bus(dev, "pci.0");
if (!pci_bus) { if (!pci_bus) {
error_report("couldn't create PCI controller!"); error_report("couldn't create PCI controller!");
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册