Lines Matching full:pm
55 ICH9LPCPMRegs *pm = container_of(regs, ICH9LPCPMRegs, acpi_regs); in ich9_pm_update_sci_fn() local
56 acpi_update_sci(&pm->acpi_regs, pm->irq); in ich9_pm_update_sci_fn()
61 ICH9LPCPMRegs *pm = opaque; in ich9_gpe_readb() local
62 return acpi_gpe_ioport_readb(&pm->acpi_regs, addr); in ich9_gpe_readb()
68 ICH9LPCPMRegs *pm = opaque; in ich9_gpe_writeb() local
69 acpi_gpe_ioport_writeb(&pm->acpi_regs, addr, val); in ich9_gpe_writeb()
70 acpi_update_sci(&pm->acpi_regs, pm->irq); in ich9_gpe_writeb()
85 ICH9LPCPMRegs *pm = opaque; in ich9_smi_readl() local
88 return pm->smi_en; in ich9_smi_readl()
90 return pm->smi_sts; in ich9_smi_readl()
99 ICH9LPCPMRegs *pm = opaque; in ich9_smi_writel() local
100 TCOIORegs *tr = &pm->tco_regs; in ich9_smi_writel()
105 tco_en = pm->smi_en & ICH9_PMIO_SMI_EN_TCO_EN; in ich9_smi_writel()
110 pm->smi_en &= ~pm->smi_en_wmask; in ich9_smi_writel()
111 pm->smi_en |= (val & pm->smi_en_wmask); in ich9_smi_writel()
112 if (pm->swsmi_timer_enabled) { in ich9_smi_writel()
113 ich9_pm_update_swsmi_timer(pm, pm->smi_en & in ich9_smi_writel()
116 if (pm->periodic_timer_enabled) { in ich9_smi_writel()
117 ich9_pm_update_periodic_timer(pm, pm->smi_en & in ich9_smi_writel()
122 pm->smi_sts &= ~pm->smi_sts_wmask; in ich9_smi_writel()
123 pm->smi_sts |= (val & pm->smi_sts_wmask); in ich9_smi_writel()
136 void ich9_pm_iospace_update(ICH9LPCPMRegs *pm, uint32_t pm_io_base) in ich9_pm_iospace_update() argument
142 pm->pm_io_base = pm_io_base; in ich9_pm_iospace_update()
144 memory_region_set_enabled(&pm->io, pm->pm_io_base != 0); in ich9_pm_iospace_update()
145 memory_region_set_address(&pm->io, pm->pm_io_base); in ich9_pm_iospace_update()
151 ICH9LPCPMRegs *pm = opaque; in ich9_pm_post_load() local
152 uint32_t pm_io_base = pm->pm_io_base; in ich9_pm_post_load()
153 pm->pm_io_base = 0; in ich9_pm_post_load()
154 ich9_pm_iospace_update(pm, pm_io_base); in ich9_pm_post_load()
271 ICH9LPCPMRegs *pm = opaque; in pm_reset() local
272 ich9_pm_iospace_update(pm, 0); in pm_reset()
274 acpi_pm1_evt_reset(&pm->acpi_regs); in pm_reset()
275 acpi_pm1_cnt_reset(&pm->acpi_regs); in pm_reset()
276 acpi_pm_tmr_reset(&pm->acpi_regs); in pm_reset()
277 acpi_gpe_reset(&pm->acpi_regs); in pm_reset()
279 pm->smi_en = 0; in pm_reset()
280 if (!pm->smm_enabled) { in pm_reset()
282 pm->smi_en |= ICH9_PMIO_SMI_EN_APMC_EN; in pm_reset()
284 pm->smi_en_wmask = ~0; in pm_reset()
286 if (pm->acpi_pci_hotplug.use_acpi_hotplug_bridge) { in pm_reset()
287 acpi_pcihp_reset(&pm->acpi_pci_hotplug); in pm_reset()
290 acpi_update_sci(&pm->acpi_regs, pm->irq); in pm_reset()
295 ICH9LPCPMRegs *pm = container_of(n, ICH9LPCPMRegs, powerdown_notifier); in pm_powerdown_req() local
297 acpi_pm1_evt_power_down(&pm->acpi_regs); in pm_powerdown_req()
300 void ich9_pm_init(PCIDevice *lpc_pci, ICH9LPCPMRegs *pm, qemu_irq sci_irq) in ich9_pm_init() argument
302 pm->smi_sts_wmask = 0; in ich9_pm_init()
304 memory_region_init(&pm->io, OBJECT(lpc_pci), "ich9-pm", ICH9_PMIO_SIZE); in ich9_pm_init()
305 memory_region_set_enabled(&pm->io, false); in ich9_pm_init()
307 0, &pm->io); in ich9_pm_init()
309 acpi_pm_tmr_init(&pm->acpi_regs, ich9_pm_update_sci_fn, &pm->io); in ich9_pm_init()
310 acpi_pm1_evt_init(&pm->acpi_regs, ich9_pm_update_sci_fn, &pm->io); in ich9_pm_init()
311 acpi_pm1_cnt_init(&pm->acpi_regs, &pm->io, pm->disable_s3, pm->disable_s4, in ich9_pm_init()
312 pm->s4_val, !pm->smm_compat && !pm->smm_enabled); in ich9_pm_init()
314 acpi_gpe_init(&pm->acpi_regs, ICH9_PMIO_GPE0_LEN); in ich9_pm_init()
315 memory_region_init_io(&pm->io_gpe, OBJECT(lpc_pci), &ich9_gpe_ops, pm, in ich9_pm_init()
317 memory_region_add_subregion(&pm->io, ICH9_PMIO_GPE0_STS, &pm->io_gpe); in ich9_pm_init()
319 memory_region_init_io(&pm->io_smi, OBJECT(lpc_pci), &ich9_smi_ops, pm, in ich9_pm_init()
321 memory_region_add_subregion(&pm->io, ICH9_PMIO_SMI_EN, &pm->io_smi); in ich9_pm_init()
323 if (pm->swsmi_timer_enabled) { in ich9_pm_init()
324 ich9_pm_swsmi_timer_init(pm); in ich9_pm_init()
327 if (pm->periodic_timer_enabled) { in ich9_pm_init()
328 ich9_pm_periodic_timer_init(pm); in ich9_pm_init()
331 if (pm->enable_tco) { in ich9_pm_init()
332 acpi_pm_tco_init(&pm->tco_regs, &pm->io); in ich9_pm_init()
335 if (pm->acpi_pci_hotplug.use_acpi_hotplug_bridge) { in ich9_pm_init()
337 &pm->acpi_pci_hotplug, in ich9_pm_init()
346 pm->irq = sci_irq; in ich9_pm_init()
347 qemu_register_reset(pm_reset, pm); in ich9_pm_init()
348 pm->powerdown_notifier.notify = pm_powerdown_req; in ich9_pm_init()
349 qemu_register_powerdown_notifier(&pm->powerdown_notifier); in ich9_pm_init()
352 OBJECT(lpc_pci), &pm->gpe_cpu, ICH9_CPU_HOTPLUG_IO_BASE); in ich9_pm_init()
355 &pm->acpi_memory_hotplug, in ich9_pm_init()
362 ICH9LPCPMRegs *pm = opaque; in ich9_pm_get_gpe0_blk() local
363 uint32_t value = pm->pm_io_base + ICH9_PMIO_GPE0_STS; in ich9_pm_get_gpe0_blk()
372 return s->pm.cpu_hotplug_legacy; in ich9_pm_get_cpu_hotplug_legacy()
381 if (s->pm.cpu_hotplug_legacy && value == false) { in ich9_pm_set_cpu_hotplug_legacy()
382 acpi_switch_to_modern_cphp(&s->pm.gpe_cpu, &s->pm.cpuhp_state, in ich9_pm_set_cpu_hotplug_legacy()
385 s->pm.cpu_hotplug_legacy = value; in ich9_pm_set_cpu_hotplug_legacy()
391 return s->pm.enable_tco; in ich9_pm_get_enable_tco()
397 s->pm.enable_tco = value; in ich9_pm_set_enable_tco()
404 return s->pm.acpi_pci_hotplug.use_acpi_hotplug_bridge; in ich9_pm_get_acpi_pci_hotplug()
411 s->pm.acpi_pci_hotplug.use_acpi_hotplug_bridge = value; in ich9_pm_set_acpi_pci_hotplug()
418 return s->pm.keep_pci_slot_hpc; in ich9_pm_get_keep_pci_slot_hpc()
425 s->pm.keep_pci_slot_hpc = value; in ich9_pm_set_keep_pci_slot_hpc()
428 void ich9_pm_add_properties(Object *obj, ICH9LPCPMRegs *pm) in ich9_pm_add_properties() argument
431 pm->acpi_memory_hotplug.is_enabled = true; in ich9_pm_add_properties()
432 pm->cpu_hotplug_legacy = true; in ich9_pm_add_properties()
433 pm->disable_s3 = 0; in ich9_pm_add_properties()
434 pm->disable_s4 = 0; in ich9_pm_add_properties()
435 pm->s4_val = 2; in ich9_pm_add_properties()
436 pm->acpi_pci_hotplug.use_acpi_hotplug_bridge = true; in ich9_pm_add_properties()
437 pm->keep_pci_slot_hpc = true; in ich9_pm_add_properties()
438 pm->enable_tco = true; in ich9_pm_add_properties()
441 &pm->pm_io_base, OBJ_PROP_FLAG_READ); in ich9_pm_add_properties()
444 NULL, NULL, pm); in ich9_pm_add_properties()
451 &pm->disable_s3, OBJ_PROP_FLAG_READWRITE); in ich9_pm_add_properties()
453 &pm->disable_s4, OBJ_PROP_FLAG_READWRITE); in ich9_pm_add_properties()
455 &pm->s4_val, OBJ_PROP_FLAG_READWRITE); in ich9_pm_add_properties()
498 acpi_memory_plug_cb(hotplug_dev, &lpc->pm.acpi_memory_hotplug, in ich9_pm_device_plug_cb()
502 if (lpc->pm.cpu_hotplug_legacy) { in ich9_pm_device_plug_cb()
503 legacy_acpi_cpu_plug_cb(hotplug_dev, &lpc->pm.gpe_cpu, dev, errp); in ich9_pm_device_plug_cb()
505 acpi_cpu_plug_cb(hotplug_dev, &lpc->pm.cpuhp_state, dev, errp); in ich9_pm_device_plug_cb()
508 acpi_pcihp_device_plug_cb(hotplug_dev, &lpc->pm.acpi_pci_hotplug, in ich9_pm_device_plug_cb()
523 &lpc->pm.acpi_memory_hotplug, dev, in ich9_pm_device_unplug_request_cb()
526 !lpc->pm.cpu_hotplug_legacy) { in ich9_pm_device_unplug_request_cb()
539 acpi_cpu_unplug_request_cb(hotplug_dev, &lpc->pm.cpuhp_state, in ich9_pm_device_unplug_request_cb()
543 &lpc->pm.acpi_pci_hotplug, in ich9_pm_device_unplug_request_cb()
557 acpi_memory_unplug_cb(&lpc->pm.acpi_memory_hotplug, dev, errp); in ich9_pm_device_unplug_cb()
559 !lpc->pm.cpu_hotplug_legacy) { in ich9_pm_device_unplug_cb()
560 acpi_cpu_unplug_cb(&lpc->pm.cpuhp_state, dev, errp); in ich9_pm_device_unplug_cb()
562 acpi_pcihp_device_unplug_cb(hotplug_dev, &lpc->pm.acpi_pci_hotplug, in ich9_pm_device_unplug_cb()
573 return acpi_pcihp_is_hotpluggbale_bus(&lpc->pm.acpi_pci_hotplug, bus); in ich9_pm_is_hotpluggable_bus()
580 acpi_memory_ospm_status(&s->pm.acpi_memory_hotplug, list); in ich9_pm_ospm_status()
581 if (!s->pm.cpu_hotplug_legacy) { in ich9_pm_ospm_status()
582 acpi_cpu_ospm_status(&s->pm.cpuhp_state, list); in ich9_pm_ospm_status()