xref: /qemu/include/hw/acpi/ich9.h (revision 3baa3c9d62bb35904cf6dadbf152922d87f06e8f)
1e516572fSJason Baron /*
2e516572fSJason Baron  * QEMU GMCH/ICH9 LPC PM Emulation
3e516572fSJason Baron  *
4e516572fSJason Baron  *  Copyright (c) 2009 Isaku Yamahata <yamahata at valinux co jp>
5e516572fSJason Baron  *                     VA Linux Systems Japan K.K.
6e516572fSJason Baron  *
7e516572fSJason Baron  * This library is free software; you can redistribute it and/or
8e516572fSJason Baron  * modify it under the terms of the GNU Lesser General Public
9e516572fSJason Baron  * License as published by the Free Software Foundation; either
1061f3c91aSChetan Pant  * version 2.1 of the License, or (at your option) any later version.
11e516572fSJason Baron  *
12e516572fSJason Baron  * This library is distributed in the hope that it will be useful,
13e516572fSJason Baron  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14e516572fSJason Baron  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15e516572fSJason Baron  * Lesser General Public License for more details.
16e516572fSJason Baron  *
17e516572fSJason Baron  * You should have received a copy of the GNU Lesser General Public
18e516572fSJason Baron  * License along with this library; if not, see <http://www.gnu.org/licenses/>
19e516572fSJason Baron  */
20e516572fSJason Baron 
21e516572fSJason Baron #ifndef HW_ACPI_ICH9_H
22e516572fSJason Baron #define HW_ACPI_ICH9_H
23e516572fSJason Baron 
240d09e41aSPaolo Bonzini #include "hw/acpi/acpi.h"
25d6610bc2SIgor Mammedov #include "hw/acpi/cpu_hotplug.h"
265e1b5d93SIgor Mammedov #include "hw/acpi/cpu.h"
27c0e427d6SJulia Suvorova #include "hw/acpi/pcihp.h"
281f862184SIgor Mammedov #include "hw/acpi/memory_hotplug.h"
2943f50410SIgor Mammedov #include "hw/acpi/acpi_dev_interface.h"
30fbae27e8SPhilippe Mathieu-Daudé #include "hw/acpi/ich9_tco.h"
31e516572fSJason Baron 
320e780da7SAni Sinha #define ACPI_PCIHP_ADDR_ICH9 0x0cc0
33caf108bcSJulia Suvorova 
34e516572fSJason Baron typedef struct ICH9LPCPMRegs {
35e516572fSJason Baron     /*
36e516572fSJason Baron      * In ich9 spec says that pm1_cnt register is 32bit width and
37e516572fSJason Baron      * that the upper 16bits are reserved and unused.
38e516572fSJason Baron      * PM1a_CNT_BLK = 2 in FADT so it is defined as uint16_t.
39e516572fSJason Baron      */
40e516572fSJason Baron     ACPIREGS acpi_regs;
41503b19fcSGerd Hoffmann 
42cacaab8bSGerd Hoffmann     MemoryRegion io;
4376a7daf9SGerd Hoffmann     MemoryRegion io_gpe;
4410cc69b0SGerd Hoffmann     MemoryRegion io_smi;
45503b19fcSGerd Hoffmann 
46e516572fSJason Baron     uint32_t smi_en;
4711e66a15SGerd Hoffmann     uint32_t smi_en_wmask;
48e516572fSJason Baron     uint32_t smi_sts;
49*6e3c2d58SDominic Prinz     uint32_t smi_sts_wmask;
50e516572fSJason Baron 
51e516572fSJason Baron     qemu_irq irq;      /* SCI */
52e516572fSJason Baron 
53e516572fSJason Baron     uint32_t pm_io_base;
54e516572fSJason Baron     Notifier powerdown_notifier;
55d6610bc2SIgor Mammedov 
5616bcab97SIgor Mammedov     bool cpu_hotplug_legacy;
57d6610bc2SIgor Mammedov     AcpiCpuHotplug gpe_cpu;
585e1b5d93SIgor Mammedov     CPUHotplugState cpuhp_state;
591f862184SIgor Mammedov 
60c318bef7SJulia Suvorova     bool keep_pci_slot_hpc;
61c0e427d6SJulia Suvorova     bool use_acpi_hotplug_bridge;
62c0e427d6SJulia Suvorova     AcpiPciHpState acpi_pci_hotplug;
631f862184SIgor Mammedov     MemHotplugState acpi_memory_hotplug;
646ac0d8d4SAmit Shah 
656ac0d8d4SAmit Shah     uint8_t disable_s3;
666ac0d8d4SAmit Shah     uint8_t disable_s4;
676ac0d8d4SAmit Shah     uint8_t s4_val;
6820fe3af2SBernhard Beschow     bool smm_enabled;
6924cd04fcSIsaku Yamahata     bool smm_compat;
7092055797SPaulo Alcantara     bool enable_tco;
7192055797SPaulo Alcantara     TCOIORegs tco_regs;
72*6e3c2d58SDominic Prinz 
73*6e3c2d58SDominic Prinz     bool swsmi_timer_enabled;
74*6e3c2d58SDominic Prinz     bool periodic_timer_enabled;
75*6e3c2d58SDominic Prinz     QEMUTimer *swsmi_timer;
76*6e3c2d58SDominic Prinz     QEMUTimer *periodic_timer;
77e516572fSJason Baron } ICH9LPCPMRegs;
78e516572fSJason Baron 
79b1c439d1SPhilippe Mathieu-Daudé #define ACPI_PM_PROP_TCO_ENABLED "enable_tco"
80b1c439d1SPhilippe Mathieu-Daudé 
8120fe3af2SBernhard Beschow void ich9_pm_init(PCIDevice *lpc_pci, ICH9LPCPMRegs *pm, qemu_irq sci_irq);
8292055797SPaulo Alcantara 
83e516572fSJason Baron void ich9_pm_iospace_update(ICH9LPCPMRegs *pm, uint32_t pm_io_base);
84e516572fSJason Baron extern const VMStateDescription vmstate_ich9_pm;
85e516572fSJason Baron 
8640c2281cSMarkus Armbruster void ich9_pm_add_properties(Object *obj, ICH9LPCPMRegs *pm);
876f1426abSMichael S. Tsirkin 
889040e6dfSWei Yang void ich9_pm_device_pre_plug_cb(HotplugHandler *hotplug_dev, DeviceState *dev,
899040e6dfSWei Yang                                 Error **errp);
900058c082SIgor Mammedov void ich9_pm_device_plug_cb(HotplugHandler *hotplug_dev, DeviceState *dev,
91469b8ad2STang Chen                             Error **errp);
920058c082SIgor Mammedov void ich9_pm_device_unplug_request_cb(HotplugHandler *hotplug_dev,
930058c082SIgor Mammedov                                       DeviceState *dev, Error **errp);
940058c082SIgor Mammedov void ich9_pm_device_unplug_cb(HotplugHandler *hotplug_dev, DeviceState *dev,
9591a734a6STang Chen                               Error **errp);
96f18e29fcSIgor Mammedov bool ich9_pm_is_hotpluggable_bus(HotplugHandler *hotplug_dev, BusState *bus);
9743f50410SIgor Mammedov 
9843f50410SIgor Mammedov void ich9_pm_ospm_status(AcpiDeviceIf *adev, ACPIOSTInfoList ***list);
99e516572fSJason Baron #endif /* HW_ACPI_ICH9_H */
100