mirror of
https://git.proxmox.com/git/qemu
synced 2025-06-15 20:07:23 +00:00
sh4: unbreak r2d
... by making sh_pci a subclass of TYPE_PCI_HOST_BRIDGE. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Reviewed-by: Anthony Liguori <aliguori@us.ibm.com> Message-id: 1374501278-31549-20-git-send-email-pbonzini@redhat.com Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
This commit is contained in:
parent
b332d24a8e
commit
b23ea25f50
@ -28,9 +28,14 @@
|
|||||||
#include "qemu/bswap.h"
|
#include "qemu/bswap.h"
|
||||||
#include "exec/address-spaces.h"
|
#include "exec/address-spaces.h"
|
||||||
|
|
||||||
|
#define TYPE_SH_PCI_HOST_BRIDGE "sh_pci"
|
||||||
|
|
||||||
|
#define SH_PCI_HOST_BRIDGE(obj) \
|
||||||
|
OBJECT_CHECK(SHPCIState, (obj), TYPE_SH_PCI_HOST_BRIDGE)
|
||||||
|
|
||||||
typedef struct SHPCIState {
|
typedef struct SHPCIState {
|
||||||
SysBusDevice busdev;
|
PCIHostState parent_obj;
|
||||||
PCIBus *bus;
|
|
||||||
PCIDevice *dev;
|
PCIDevice *dev;
|
||||||
qemu_irq irq[4];
|
qemu_irq irq[4];
|
||||||
MemoryRegion memconfig_p4;
|
MemoryRegion memconfig_p4;
|
||||||
@ -45,6 +50,8 @@ static void sh_pci_reg_write (void *p, hwaddr addr, uint64_t val,
|
|||||||
unsigned size)
|
unsigned size)
|
||||||
{
|
{
|
||||||
SHPCIState *pcic = p;
|
SHPCIState *pcic = p;
|
||||||
|
PCIHostState *phb = PCI_HOST_BRIDGE(pcic);
|
||||||
|
|
||||||
switch(addr) {
|
switch(addr) {
|
||||||
case 0 ... 0xfc:
|
case 0 ... 0xfc:
|
||||||
cpu_to_le32w((uint32_t*)(pcic->dev->config + addr), val);
|
cpu_to_le32w((uint32_t*)(pcic->dev->config + addr), val);
|
||||||
@ -64,7 +71,7 @@ static void sh_pci_reg_write (void *p, hwaddr addr, uint64_t val,
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 0x220:
|
case 0x220:
|
||||||
pci_data_write(pcic->bus, pcic->par, val, 4);
|
pci_data_write(phb->bus, pcic->par, val, 4);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -73,6 +80,8 @@ static uint64_t sh_pci_reg_read (void *p, hwaddr addr,
|
|||||||
unsigned size)
|
unsigned size)
|
||||||
{
|
{
|
||||||
SHPCIState *pcic = p;
|
SHPCIState *pcic = p;
|
||||||
|
PCIHostState *phb = PCI_HOST_BRIDGE(pcic);
|
||||||
|
|
||||||
switch(addr) {
|
switch(addr) {
|
||||||
case 0 ... 0xfc:
|
case 0 ... 0xfc:
|
||||||
return le32_to_cpup((uint32_t*)(pcic->dev->config + addr));
|
return le32_to_cpup((uint32_t*)(pcic->dev->config + addr));
|
||||||
@ -83,7 +92,7 @@ static uint64_t sh_pci_reg_read (void *p, hwaddr addr,
|
|||||||
case 0x1c8:
|
case 0x1c8:
|
||||||
return pcic->iobr;
|
return pcic->iobr;
|
||||||
case 0x220:
|
case 0x220:
|
||||||
return pci_data_read(pcic->bus, pcic->par, 4);
|
return pci_data_read(phb->bus, pcic->par, 4);
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -112,14 +121,16 @@ static void sh_pci_set_irq(void *opaque, int irq_num, int level)
|
|||||||
|
|
||||||
static int sh_pci_device_init(SysBusDevice *dev)
|
static int sh_pci_device_init(SysBusDevice *dev)
|
||||||
{
|
{
|
||||||
|
PCIHostState *phb;
|
||||||
SHPCIState *s;
|
SHPCIState *s;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
s = FROM_SYSBUS(SHPCIState, dev);
|
s = SH_PCI_HOST_BRIDGE(dev);
|
||||||
|
phb = PCI_HOST_BRIDGE(s);
|
||||||
for (i = 0; i < 4; i++) {
|
for (i = 0; i < 4; i++) {
|
||||||
sysbus_init_irq(dev, &s->irq[i]);
|
sysbus_init_irq(dev, &s->irq[i]);
|
||||||
}
|
}
|
||||||
s->bus = pci_register_bus(&s->busdev.qdev, "pci",
|
phb->bus = pci_register_bus(DEVICE(dev), "pci",
|
||||||
sh_pci_set_irq, sh_pci_map_irq,
|
sh_pci_set_irq, sh_pci_map_irq,
|
||||||
s->irq,
|
s->irq,
|
||||||
get_system_memory(),
|
get_system_memory(),
|
||||||
@ -136,7 +147,7 @@ static int sh_pci_device_init(SysBusDevice *dev)
|
|||||||
s->iobr = 0xfe240000;
|
s->iobr = 0xfe240000;
|
||||||
memory_region_add_subregion(get_system_memory(), s->iobr, &s->isa);
|
memory_region_add_subregion(get_system_memory(), s->iobr, &s->isa);
|
||||||
|
|
||||||
s->dev = pci_create_simple(s->bus, PCI_DEVFN(0, 0), "sh_pci_host");
|
s->dev = pci_create_simple(phb->bus, PCI_DEVFN(0, 0), "sh_pci_host");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -172,8 +183,8 @@ static void sh_pci_device_class_init(ObjectClass *klass, void *data)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static const TypeInfo sh_pci_device_info = {
|
static const TypeInfo sh_pci_device_info = {
|
||||||
.name = "sh_pci",
|
.name = TYPE_SH_PCI_HOST_BRIDGE,
|
||||||
.parent = TYPE_SYS_BUS_DEVICE,
|
.parent = TYPE_PCI_HOST_BRIDGE,
|
||||||
.instance_size = sizeof(SHPCIState),
|
.instance_size = sizeof(SHPCIState),
|
||||||
.class_init = sh_pci_device_class_init,
|
.class_init = sh_pci_device_class_init,
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user