Hi Helge, Richard, On Tue, Jan 30, 2018 at 5:48 AM Richard Henderson <richard.hender...@linaro.org> wrote: > > From: Helge Deller <del...@gmx.de> > > Now that we have the prerequisites in target/hppa/, > implement the hardware for a PA7100LC. > > This also enables build for hppa-softmmu. > > Signed-off-by: Helge Deller <del...@gmx.de> > [rth: Since it is all new code, squashed all branch development > withing hw/hppa/ to a single patch.] > Signed-off-by: Richard Henderson <richard.hender...@linaro.org> > --- > Makefile.objs | 1 + > hw/hppa/hppa_hardware.h | 40 +++ > hw/hppa/hppa_sys.h | 24 ++ > hw/hppa/dino.c | 518 > +++++++++++++++++++++++++++++++++++++++ > hw/hppa/machine.c | 247 ++++++++++++++++++- > hw/hppa/pci.c | 90 +++++++ > default-configs/hppa-softmmu.mak | 14 ++ > hw/hppa/Makefile.objs | 2 +- > hw/hppa/trace-events | 4 + > 9 files changed, 938 insertions(+), 2 deletions(-) > create mode 100644 hw/hppa/hppa_hardware.h > create mode 100644 hw/hppa/hppa_sys.h > create mode 100644 hw/hppa/dino.c > create mode 100644 hw/hppa/pci.c > create mode 100644 default-configs/hppa-softmmu.mak > create mode 100644 hw/hppa/trace-events
> +PCIBus *dino_init(MemoryRegion *addr_space, > + qemu_irq *p_rtc_irq, qemu_irq *p_ser_irq) > +{ > + DeviceState *dev; > + DinoState *s; > + PCIBus *b; > + int i; > + > + dev = qdev_create(NULL, TYPE_DINO_PCI_HOST_BRIDGE); > + s = DINO_PCI_HOST_BRIDGE(dev); > + > + /* Dino PCI access from main memory. */ > + memory_region_init_io(&s->this_mem, OBJECT(s), &dino_chip_ops, > + s, "dino", 4096); > + memory_region_add_subregion(addr_space, DINO_HPA, &s->this_mem); > + > + /* Dino PCI config. */ > + memory_region_init_io(&s->parent_obj.conf_mem, OBJECT(&s->parent_obj), > + &pci_host_conf_be_ops, dev, "pci-conf-idx", 4); > + memory_region_init_io(&s->parent_obj.data_mem, OBJECT(&s->parent_obj), > + &dino_config_data_ops, dev, "pci-conf-data", 4); > + memory_region_add_subregion(&s->this_mem, DINO_PCI_CONFIG_ADDR, > + &s->parent_obj.conf_mem); > + memory_region_add_subregion(&s->this_mem, DINO_CONFIG_DATA, > + &s->parent_obj.data_mem); > + > + /* Dino PCI bus memory. */ > + memory_region_init(&s->pci_mem, OBJECT(s), "pci-memory", 1ull << 32); > + > + b = pci_register_root_bus(dev, "pci", dino_set_irq, dino_pci_map_irq, s, > + &s->pci_mem, get_system_io(), > + PCI_DEVFN(0, 0), 32, TYPE_PCI_BUS); > + s->parent_obj.bus = b; > + qdev_init_nofail(dev); > + > + /* Set up windows into PCI bus memory. */ > + for (i = 1; i < 31; i++) { > + uint32_t addr = 0xf0000000 + i * DINO_MEM_CHUNK_SIZE; > + char *name = g_strdup_printf("PCI Outbound Window %d", i); > + memory_region_init_alias(&s->pci_mem_alias[i], OBJECT(s), > + name, &s->pci_mem, addr, > + DINO_MEM_CHUNK_SIZE); Where are these aliases mapped? > + } > + > + /* Set up PCI view of memory: Bus master address space. */ > + memory_region_init(&s->bm, OBJECT(s), "bm-dino", 1ull << 32); > + memory_region_init_alias(&s->bm_ram_alias, OBJECT(s), > + "bm-system", addr_space, 0, > + 0xf0000000 + DINO_MEM_CHUNK_SIZE); > + memory_region_init_alias(&s->bm_pci_alias, OBJECT(s), > + "bm-pci", &s->pci_mem, > + 0xf0000000 + DINO_MEM_CHUNK_SIZE, > + 31 * DINO_MEM_CHUNK_SIZE); > + memory_region_add_subregion(&s->bm, 0, > + &s->bm_ram_alias); > + memory_region_add_subregion(&s->bm, > + 0xf0000000 + DINO_MEM_CHUNK_SIZE, > + &s->bm_pci_alias); > + address_space_init(&s->bm_as, &s->bm, "pci-bm"); > + pci_setup_iommu(b, dino_pcihost_set_iommu, s); > + > + *p_rtc_irq = qemu_allocate_irq(dino_set_timer_irq, s, 0); > + *p_ser_irq = qemu_allocate_irq(dino_set_serial_irq, s, 0); > + > + return b; > +}