Lines Matching refs:pm
98 Pegasos2MachineState *pm = PEGASOS2_MACHINE(current_machine); in pegasos2_cpu_reset() local
102 if (pm->vof) { in pegasos2_cpu_reset()
111 Pegasos2MachineState *pm = opaque; in pegasos2_pci_irq() local
114 qemu_set_irq(pm->mv_pirq[n], level); in pegasos2_pci_irq()
115 qemu_set_irq(pm->via_pirq[n], level); in pegasos2_pci_irq()
120 Pegasos2MachineState *pm = PEGASOS2_MACHINE(machine); in pegasos2_init() local
134 pm->cpu = POWERPC_CPU(cpu_create(machine->cpu_type)); in pegasos2_init()
135 env = &pm->cpu->env; in pegasos2_init()
143 qemu_register_reset(pegasos2_cpu_reset, pm->cpu); in pegasos2_init()
158 if (!machine->firmware && !pm->vof) { in pegasos2_init()
159 pm->vof = g_malloc0(sizeof(*pm->vof)); in pegasos2_init()
166 sz = load_image_targphys(filename, pm->vof ? 0 : PROM_ADDR, PROM_SIZE); in pegasos2_init()
173 if (pm->vof) { in pegasos2_init()
174 pm->vof->fw_size = sz; in pegasos2_init()
178 pm->mv = DEVICE(sysbus_create_simple(TYPE_MV64361, -1, in pegasos2_init()
179 qdev_get_gpio_in(DEVICE(pm->cpu), PPC6xx_INPUT_INT))); in pegasos2_init()
181 pm->mv_pirq[i] = qdev_get_gpio_in_named(pm->mv, "gpp", 12 + i); in pegasos2_init()
183 pci_bus = mv64361_get_pci_bus(pm->mv, 1); in pegasos2_init()
196 pm->via_pirq[i] = qdev_get_gpio_in_named(DEVICE(via), "pirq", i); in pegasos2_init()
202 qdev_get_gpio_in_named(pm->mv, "gpp", 31)); in pegasos2_init()
220 pd = DEVICE(object_resolve_path_component(OBJECT(pm->mv), pn)); in pegasos2_init()
223 OrIRQState *ori = &pm->orirq[i]; in pegasos2_init()
228 object_initialize_child_with_props(OBJECT(pm), n, in pegasos2_init()
233 qemu_init_irq(&pm->pci_irqs[i], pegasos2_pci_irq, pm, i); in pegasos2_init()
234 qdev_connect_gpio_out(DEVICE(ori), 0, &pm->pci_irqs[i]); in pegasos2_init()
242 &pm->kernel_entry, &pm->kernel_addr, NULL, NULL, 1, in pegasos2_init()
249 pm->kernel_size = sz; in pegasos2_init()
250 if (!pm->vof) { in pegasos2_init()
253 } else if (pm->vof && !qtest_enabled()) { in pegasos2_init()
258 pm->initrd_addr = pm->kernel_addr + pm->kernel_size + 64 * KiB; in pegasos2_init()
259 pm->initrd_addr = ROUND_UP(pm->initrd_addr, 4); in pegasos2_init()
260 pm->initrd_addr = MAX(pm->initrd_addr, INITRD_MIN_ADDR); in pegasos2_init()
261 sz = load_image_targphys(machine->initrd_filename, pm->initrd_addr, in pegasos2_init()
262 machine->ram_size - pm->initrd_addr); in pegasos2_init()
268 pm->initrd_size = sz; in pegasos2_init()
271 if (!pm->vof && machine->kernel_cmdline && machine->kernel_cmdline[0]) { in pegasos2_init()
276 static uint32_t pegasos2_mv_reg_read(Pegasos2MachineState *pm, in pegasos2_mv_reg_read() argument
279 MemoryRegion *r = sysbus_mmio_get_region(SYS_BUS_DEVICE(pm->mv), 0); in pegasos2_mv_reg_read()
286 static void pegasos2_mv_reg_write(Pegasos2MachineState *pm, uint32_t addr, in pegasos2_mv_reg_write() argument
289 MemoryRegion *r = sysbus_mmio_get_region(SYS_BUS_DEVICE(pm->mv), 0); in pegasos2_mv_reg_write()
294 static uint32_t pegasos2_pci_config_read(Pegasos2MachineState *pm, int bus, in pegasos2_pci_config_read() argument
301 pegasos2_mv_reg_write(pm, pcicfg, 4, addr | BIT(31)); in pegasos2_pci_config_read()
302 val = pegasos2_mv_reg_read(pm, pcicfg + 4, len); in pegasos2_pci_config_read()
307 static void pegasos2_pci_config_write(Pegasos2MachineState *pm, int bus, in pegasos2_pci_config_write() argument
312 pegasos2_mv_reg_write(pm, pcicfg, 4, addr | BIT(31)); in pegasos2_pci_config_write()
313 pegasos2_mv_reg_write(pm, pcicfg + 4, len, val); in pegasos2_pci_config_write()
324 Pegasos2MachineState *pm = PEGASOS2_MACHINE(machine); in pegasos2_machine_reset() local
330 if (!pm->vof) { in pegasos2_machine_reset()
335 pegasos2_mv_reg_write(pm, 0, 4, 0x28020ff); in pegasos2_machine_reset()
336 pegasos2_mv_reg_write(pm, 0x278, 4, 0xa31fc); in pegasos2_machine_reset()
337 pegasos2_mv_reg_write(pm, 0xf300, 4, 0x11ff0400); in pegasos2_machine_reset()
338 pegasos2_mv_reg_write(pm, 0xf10c, 4, 0x80000000); in pegasos2_machine_reset()
339 pegasos2_mv_reg_write(pm, 0x1c, 4, 0x8000000); in pegasos2_machine_reset()
340 pegasos2_pci_config_write(pm, 0, PCI_COMMAND, 2, PCI_COMMAND_IO | in pegasos2_machine_reset()
342 pegasos2_pci_config_write(pm, 1, PCI_COMMAND, 2, PCI_COMMAND_IO | in pegasos2_machine_reset()
345 pegasos2_pci_config_write(pm, 1, (PCI_DEVFN(12, 0) << 8) | in pegasos2_machine_reset()
347 pegasos2_pci_config_write(pm, 1, (PCI_DEVFN(12, 0) << 8) | in pegasos2_machine_reset()
353 pegasos2_pci_config_write(pm, 1, (PCI_DEVFN(12, 0) << 8) | in pegasos2_machine_reset()
355 pegasos2_pci_config_write(pm, 1, (PCI_DEVFN(12, 0) << 8) | in pegasos2_machine_reset()
357 pegasos2_pci_config_write(pm, 1, (PCI_DEVFN(12, 0) << 8) | in pegasos2_machine_reset()
359 pegasos2_pci_config_write(pm, 1, (PCI_DEVFN(12, 0) << 8) | in pegasos2_machine_reset()
362 pegasos2_pci_config_write(pm, 1, (PCI_DEVFN(12, 1) << 8) | in pegasos2_machine_reset()
364 pegasos2_pci_config_write(pm, 1, (PCI_DEVFN(12, 1) << 8) | in pegasos2_machine_reset()
366 pegasos2_pci_config_write(pm, 1, (PCI_DEVFN(12, 1) << 8) | in pegasos2_machine_reset()
368 pegasos2_pci_config_write(pm, 1, (PCI_DEVFN(12, 1) << 8) | in pegasos2_machine_reset()
370 pegasos2_pci_config_write(pm, 1, (PCI_DEVFN(12, 1) << 8) | in pegasos2_machine_reset()
373 pegasos2_pci_config_write(pm, 1, (PCI_DEVFN(12, 2) << 8) | in pegasos2_machine_reset()
375 pegasos2_pci_config_write(pm, 1, (PCI_DEVFN(12, 2) << 8) | in pegasos2_machine_reset()
378 pegasos2_pci_config_write(pm, 1, (PCI_DEVFN(12, 3) << 8) | in pegasos2_machine_reset()
380 pegasos2_pci_config_write(pm, 1, (PCI_DEVFN(12, 3) << 8) | in pegasos2_machine_reset()
383 pegasos2_pci_config_write(pm, 1, (PCI_DEVFN(12, 4) << 8) | in pegasos2_machine_reset()
385 pegasos2_pci_config_write(pm, 1, (PCI_DEVFN(12, 4) << 8) | in pegasos2_machine_reset()
387 pegasos2_pci_config_write(pm, 1, (PCI_DEVFN(12, 4) << 8) | in pegasos2_machine_reset()
389 pegasos2_pci_config_write(pm, 1, (PCI_DEVFN(12, 4) << 8) | in pegasos2_machine_reset()
392 pegasos2_pci_config_write(pm, 1, (PCI_DEVFN(12, 5) << 8) | in pegasos2_machine_reset()
395 pegasos2_pci_config_write(pm, 1, (PCI_DEVFN(12, 6) << 8) | in pegasos2_machine_reset()
399 vof_init(pm->vof, machine->ram_size, &error_fatal); in pegasos2_machine_reset()
400 if (vof_claim(pm->vof, 0, VOF_STACK_SIZE, VOF_STACK_SIZE) == -1) { in pegasos2_machine_reset()
404 if (pm->kernel_size && in pegasos2_machine_reset()
405 vof_claim(pm->vof, pm->kernel_addr, pm->kernel_size, 0) == -1) { in pegasos2_machine_reset()
409 if (pm->initrd_size && in pegasos2_machine_reset()
410 vof_claim(pm->vof, pm->initrd_addr, pm->initrd_size, 0) == -1) { in pegasos2_machine_reset()
416 d[0] = cpu_to_be64(pm->kernel_entry); in pegasos2_machine_reset()
417 d[1] = cpu_to_be64(pm->kernel_size - (pm->kernel_entry - pm->kernel_addr)); in pegasos2_machine_reset()
421 g_free(pm->fdt_blob); in pegasos2_machine_reset()
422 pm->fdt_blob = fdt; in pegasos2_machine_reset()
424 vof_build_dt(fdt, pm->vof); in pegasos2_machine_reset()
425 vof_client_open_store(fdt, pm->vof, "/chosen", "stdout", "/failsafe"); in pegasos2_machine_reset()
430 pm->cpu->vhyp = PPC_VIRTUAL_HYPERVISOR(machine); in pegasos2_machine_reset()
431 pm->cpu->vhyp_class = PPC_VIRTUAL_HYPERVISOR_GET_CLASS(pm->cpu->vhyp); in pegasos2_machine_reset()
452 static target_ulong pegasos2_rtas(PowerPCCPU *cpu, Pegasos2MachineState *pm, in pegasos2_rtas() argument
500 val = pegasos2_pci_config_read(pm, !(addr >> 24), in pegasos2_rtas()
517 pegasos2_pci_config_write(pm, !(addr >> 24), in pegasos2_rtas()
555 Pegasos2MachineState *pm = PEGASOS2_MACHINE(vhyp); in pegasos2_hypercall() local
565 env->gpr[3] = pegasos2_rtas(cpu, pm, env->gpr[4]); in pegasos2_hypercall()
567 int ret = vof_client_call(MACHINE(pm), pm->vof, pm->fdt_blob, in pegasos2_hypercall()
873 Pegasos2MachineState *pm = PEGASOS2_MACHINE(machine); in build_fdt() local
874 PowerPCCPU *cpu = pm->cpu; in build_fdt()
923 pci_bus = mv64361_get_pci_bus(pm->mv, 0); in build_fdt()
958 pci_bus = mv64361_get_pci_bus(pm->mv, 1); in build_fdt()
1063 if (pm->initrd_addr && pm->initrd_size) { in build_fdt()
1065 pm->initrd_addr + pm->initrd_size); in build_fdt()
1067 pm->initrd_addr); in build_fdt()