mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-06 09:13:55 -06:00
hw/acpi/ich9: Add periodic and swsmi timer
This patch implements the periodic and the swsmi ICH9 chipset timers. They are especially useful when prototyping UEFI firmware (e.g. with EDK2's OVMF) using QEMU. For backwards compatibility, the compat properties "x-smi-swsmi-timer", and "x-smi-periodic-timer" are introduced. Additionally, writes to the SMI_STS register are enabled for the corresponding two bits using a write mask to make future work easier. Signed-off-by: Dominic Prinz <git@dprinz.de> Message-Id: <1d90ea69e01ab71a0f2ced116801dc78e04f4448.1725991505.git.git@dprinz.de> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
This commit is contained in:
parent
95b717a815
commit
6e3c2d58e9
8 changed files with 168 additions and 2 deletions
|
@ -35,6 +35,7 @@
|
|||
#include "sysemu/runstate.h"
|
||||
#include "hw/acpi/acpi.h"
|
||||
#include "hw/acpi/ich9_tco.h"
|
||||
#include "hw/acpi/ich9_timer.h"
|
||||
|
||||
#include "hw/southbridge/ich9.h"
|
||||
#include "hw/mem/pc-dimm.h"
|
||||
|
@ -108,6 +109,18 @@ static void ich9_smi_writel(void *opaque, hwaddr addr, uint64_t val,
|
|||
}
|
||||
pm->smi_en &= ~pm->smi_en_wmask;
|
||||
pm->smi_en |= (val & pm->smi_en_wmask);
|
||||
if (pm->swsmi_timer_enabled) {
|
||||
ich9_pm_update_swsmi_timer(pm, pm->smi_en &
|
||||
ICH9_PMIO_SMI_EN_SWSMI_EN);
|
||||
}
|
||||
if (pm->periodic_timer_enabled) {
|
||||
ich9_pm_update_periodic_timer(pm, pm->smi_en &
|
||||
ICH9_PMIO_SMI_EN_PERIODIC_EN);
|
||||
}
|
||||
break;
|
||||
case 4:
|
||||
pm->smi_sts &= ~pm->smi_sts_wmask;
|
||||
pm->smi_sts |= (val & pm->smi_sts_wmask);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -286,6 +299,8 @@ static void pm_powerdown_req(Notifier *n, void *opaque)
|
|||
|
||||
void ich9_pm_init(PCIDevice *lpc_pci, ICH9LPCPMRegs *pm, qemu_irq sci_irq)
|
||||
{
|
||||
pm->smi_sts_wmask = 0;
|
||||
|
||||
memory_region_init(&pm->io, OBJECT(lpc_pci), "ich9-pm", ICH9_PMIO_SIZE);
|
||||
memory_region_set_enabled(&pm->io, false);
|
||||
memory_region_add_subregion(pci_address_space_io(lpc_pci),
|
||||
|
@ -305,6 +320,14 @@ void ich9_pm_init(PCIDevice *lpc_pci, ICH9LPCPMRegs *pm, qemu_irq sci_irq)
|
|||
"acpi-smi", 8);
|
||||
memory_region_add_subregion(&pm->io, ICH9_PMIO_SMI_EN, &pm->io_smi);
|
||||
|
||||
if (pm->swsmi_timer_enabled) {
|
||||
ich9_pm_swsmi_timer_init(pm);
|
||||
}
|
||||
|
||||
if (pm->periodic_timer_enabled) {
|
||||
ich9_pm_periodic_timer_init(pm);
|
||||
}
|
||||
|
||||
if (pm->enable_tco) {
|
||||
acpi_pm_tco_init(&pm->tco_regs, &pm->io);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue