void acpi_pm1_cnt_write(ACPIREGS *ar, uint16_t val)

{

    ar->pm1.cnt.cnt = val & ~(ACPI_BITMASK_SLEEP_ENABLE);



    if (val & ACPI_BITMASK_SLEEP_ENABLE) {

        /* change suspend type */

        uint16_t sus_typ = (val >> 10) & 7;

        switch(sus_typ) {

        case 0: /* soft power off */

            qemu_system_shutdown_request();

            break;

        case 1:

            /* ACPI_BITMASK_WAKE_STATUS should be set on resume.

               Pretend that resume was caused by power button */

            ar->pm1.evt.sts |=

                (ACPI_BITMASK_WAKE_STATUS | ACPI_BITMASK_POWER_BUTTON_STATUS);

            qemu_system_reset_request();

            qemu_irq_raise(ar->pm1.cnt.cmos_s3);

        default:

            break;

        }

    }

}

void acpi_pm1_cnt_write(ACPIREGS *ar, uint16_t val)

{

    ar->pm1.cnt.cnt = val & ~(ACPI_BITMASK_SLEEP_ENABLE);



    if (val & ACPI_BITMASK_SLEEP_ENABLE) {

        

        uint16_t sus_typ = (val >> 10) & 7;

        switch(sus_typ) {

        case 0: 

            qemu_system_shutdown_request();

            break;

        case 1:

            



            ar->pm1.evt.sts |=

                (ACPI_BITMASK_WAKE_STATUS | ACPI_BITMASK_POWER_BUTTON_STATUS);

            qemu_system_reset_request();

            qemu_irq_raise(ar->pm1.cnt.cmos_s3);

        default:

            break;

        }

    }

}

void FUNC_0(ACPIREGS *VAR_0, uint16_t VAR_1)

{

    VAR_0->pm1.cnt.cnt = VAR_1 & ~(ACPI_BITMASK_SLEEP_ENABLE);



    if (VAR_1 & ACPI_BITMASK_SLEEP_ENABLE) {

        

        uint16_t sus_typ = (VAR_1 >> 10) & 7;

        switch(sus_typ) {

        case 0: 

            qemu_system_shutdown_request();

            break;

        case 1:

            



            VAR_0->pm1.evt.sts |=

                (ACPI_BITMASK_WAKE_STATUS | ACPI_BITMASK_POWER_BUTTON_STATUS);

            qemu_system_reset_request();

            qemu_irq_raise(VAR_0->pm1.cnt.cmos_s3);

        default:

            break;

        }

    }

}

void FUNC_0(ACPIREGS *VAR_0, uint16_t VAR_1)
{ VAR_0->pm1.cnt.cnt = VAR_1 & ~(ACPI_BITMASK_SLEEP_ENABLE); if (VAR_1 & ACPI_BITMASK_SLEEP_ENABLE) { uint16_t sus_typ = (VAR_1 >> 10) & 7; switch(sus_typ) { case 0:
qemu_system_shutdown_request(); break; case 1:
VAR_0->pm1.evt.sts |=
(ACPI_BITMASK_WAKE_STATUS | ACPI_BITMASK_POWER_BUTTON_STATUS); qemu_system_reset_request(); qemu_irq_raise(VAR_0->pm1.cnt.cmos_s3); default:
break; } } }