mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-05 16:53:55 -06:00
uninorth: create new uninorth device
Commit 4e46dcdbd3
"PPC: Newworld: Add uninorth token register" added a TODO
which was to convert the uninorth registers hack to a proper device. Move
these registers to a new uninorth device, removing the old hacks from
mac_newworld.c.
Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
This commit is contained in:
parent
47a9b55154
commit
0662946aa6
5 changed files with 77 additions and 39 deletions
|
@ -18,3 +18,5 @@ unin_set_irq(int irq_num, int level) "setting INT %d = %d"
|
|||
unin_get_config_reg(uint32_t reg, uint32_t addr, uint32_t retval) "converted config space accessor 0x%"PRIx32 "/0x%"PRIx32 " -> 0x%"PRIx32
|
||||
unin_data_write(uint64_t addr, unsigned len, uint64_t val) "write addr 0x%"PRIx64 " len %d val 0x%"PRIx64
|
||||
unin_data_read(uint64_t addr, unsigned len, uint64_t val) "read addr 0x%"PRIx64 " len %d val 0x%"PRIx64
|
||||
unin_write(uint64_t addr, uint64_t value) "addr=0x%" PRIx64 " val=0x%"PRIx64
|
||||
unin_read(uint64_t addr, uint64_t value) "addr=0x%" PRIx64 " val=0x%"PRIx64
|
||||
|
|
|
@ -519,6 +519,62 @@ static const TypeInfo pci_unin_internal_info = {
|
|||
.class_init = pci_unin_internal_class_init,
|
||||
};
|
||||
|
||||
/* UniN device */
|
||||
static void unin_write(void *opaque, hwaddr addr, uint64_t value,
|
||||
unsigned size)
|
||||
{
|
||||
trace_unin_write(addr, value);
|
||||
if (addr == 0x0) {
|
||||
*(int *)opaque = value;
|
||||
}
|
||||
}
|
||||
|
||||
static uint64_t unin_read(void *opaque, hwaddr addr, unsigned size)
|
||||
{
|
||||
uint32_t value;
|
||||
|
||||
value = 0;
|
||||
switch (addr) {
|
||||
case 0:
|
||||
value = *(int *)opaque;
|
||||
}
|
||||
|
||||
trace_unin_read(addr, value);
|
||||
|
||||
return value;
|
||||
}
|
||||
|
||||
static const MemoryRegionOps unin_ops = {
|
||||
.read = unin_read,
|
||||
.write = unin_write,
|
||||
.endianness = DEVICE_BIG_ENDIAN,
|
||||
};
|
||||
|
||||
static void unin_init(Object *obj)
|
||||
{
|
||||
UNINState *s = UNI_NORTH(obj);
|
||||
SysBusDevice *sbd = SYS_BUS_DEVICE(obj);
|
||||
|
||||
memory_region_init_io(&s->mem, obj, &unin_ops, &s->token, "unin", 0x1000);
|
||||
|
||||
sysbus_init_mmio(sbd, &s->mem);
|
||||
}
|
||||
|
||||
static void unin_class_init(ObjectClass *klass, void *data)
|
||||
{
|
||||
DeviceClass *dc = DEVICE_CLASS(klass);
|
||||
|
||||
set_bit(DEVICE_CATEGORY_BRIDGE, dc->categories);
|
||||
}
|
||||
|
||||
static const TypeInfo unin_info = {
|
||||
.name = TYPE_UNI_NORTH,
|
||||
.parent = TYPE_SYS_BUS_DEVICE,
|
||||
.instance_size = sizeof(UNINState),
|
||||
.instance_init = unin_init,
|
||||
.class_init = unin_class_init,
|
||||
};
|
||||
|
||||
static void unin_register_types(void)
|
||||
{
|
||||
type_register_static(&unin_main_pci_host_info);
|
||||
|
@ -530,6 +586,8 @@ static void unin_register_types(void)
|
|||
type_register_static(&pci_u3_agp_info);
|
||||
type_register_static(&pci_unin_agp_info);
|
||||
type_register_static(&pci_unin_internal_info);
|
||||
|
||||
type_register_static(&unin_info);
|
||||
}
|
||||
|
||||
type_init(unin_register_types)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue