On 14/03/2016 09:18, Ni, Ruiyu wrote:
> I tried to hook a software SMI (triggered by B2) but the handler/callback
> was never called.
> 
> I know that when booting to ACPI OS, OS writes to B2 with certain value
> to tell firmware to enable SCI. That is achieved through the software SMI.
> The software SMI handler gets called when a certain value is written to B2.
> I am wondering how that is implemented in OVMF.

Because of the historical lack of SMI support in the firmware, this was
implemented directly in QEMU.  In the case of Q35:

static void ich9_apm_ctrl_changed(uint32_t val, void *arg)
{
    ICH9LPCState *lpc = arg;

    /* ACPI specs 3.0, 4.7.2.5 */
    acpi_pm1_cnt_update(&lpc->pm.acpi_regs,
                        val == ICH9_APM_ACPI_ENABLE,
                        val == ICH9_APM_ACPI_DISABLE);
    if (val == ICH9_APM_ACPI_ENABLE || val == ICH9_APM_ACPI_DISABLE) {
        return;
    }

    /* SMI_EN = PMBASE + 30. SMI control and enable register */
    if (lpc->pm.smi_en & ICH9_PMIO_SMI_EN_APMC_EN) {
        cpu_interrupt(current_cpu, CPU_INTERRUPT_SMI);
    }
}

There are other parts of SMI support where QEMU is incomplete compared
to a real chipset, most notably EOS.

Paolo
_______________________________________________
edk2-devel mailing list
[email protected]
https://lists.01.org/mailman/listinfo/edk2-devel

Reply via email to