PXA2xxPCMCIAState *pxa2xx_pcmcia_init(target_phys_addr_t base) { int iomemtype; PXA2xxPCMCIAState *s; s = (PXA2xxPCMCIAState *) qemu_mallocz(sizeof(PXA2xxPCMCIAState)); /* Socket I/O Memory Space */ iomemtype = cpu_register_io_memory(pxa2xx_pcmcia_io_readfn, pxa2xx_pcmcia_io_writefn, s); cpu_register_physical_memory(base | 0x00000000, 0x04000000, iomemtype); /* Then next 64 MB is reserved */ /* Socket Attribute Memory Space */ iomemtype = cpu_register_io_memory(pxa2xx_pcmcia_attr_readfn, pxa2xx_pcmcia_attr_writefn, s); cpu_register_physical_memory(base | 0x08000000, 0x04000000, iomemtype); /* Socket Common Memory Space */ iomemtype = cpu_register_io_memory(pxa2xx_pcmcia_common_readfn, pxa2xx_pcmcia_common_writefn, s); cpu_register_physical_memory(base | 0x0c000000, 0x04000000, iomemtype); if (base == 0x30000000) s->slot.slot_string = "PXA PC Card Socket 1"; else s->slot.slot_string = "PXA PC Card Socket 0"; s->slot.irq = qemu_allocate_irqs(pxa2xx_pcmcia_set_irq, s, 1)[0]; pcmcia_socket_register(&s->slot); return s; }
PXA2xxPCMCIAState *pxa2xx_pcmcia_init(MemoryRegion *sysmem, target_phys_addr_t base) { PXA2xxPCMCIAState *s; s = (PXA2xxPCMCIAState *) g_malloc0(sizeof(PXA2xxPCMCIAState)); /* Socket I/O Memory Space */ memory_region_init_io(&s->iomem, &pxa2xx_pcmcia_io_ops, s, "pxa2xx-pcmcia-io", 0x04000000); memory_region_add_subregion(sysmem, base | 0x00000000, &s->iomem); /* Then next 64 MB is reserved */ /* Socket Attribute Memory Space */ memory_region_init_io(&s->attr_iomem, &pxa2xx_pcmcia_attr_ops, s, "pxa2xx-pcmcia-attribute", 0x04000000); memory_region_add_subregion(sysmem, base | 0x08000000, &s->attr_iomem); /* Socket Common Memory Space */ memory_region_init_io(&s->common_iomem, &pxa2xx_pcmcia_common_ops, s, "pxa2xx-pcmcia-common", 0x04000000); memory_region_add_subregion(sysmem, base | 0x0c000000, &s->common_iomem); if (base == 0x30000000) s->slot.slot_string = "PXA PC Card Socket 1"; else s->slot.slot_string = "PXA PC Card Socket 0"; s->slot.irq = qemu_allocate_irqs(pxa2xx_pcmcia_set_irq, s, 1)[0]; pcmcia_socket_register(&s->slot); return s; }
static void pxa2xx_pcmcia_realize(DeviceState *dev, Error **errp) { PXA2xxPCMCIAState *s = PXA2XX_PCMCIA(dev); pcmcia_socket_register(&s->slot); }