From: Igor Mammedov <imammedo@redhat.com>
To: Bibo Mao <maobibo@loongson.cn>
Cc: "Michael S . Tsirkin" <mst@redhat.com>,
"Song Gao" <gaosong@loongson.cn>,
"Ani Sinha" <anisinha@redhat.com>,
"Jiaxun Yang" <jiaxun.yang@flygoat.com>,
"Jason A . Donenfeld" <Jason@zx2c4.com>,
"Thomas Weißschuh" <thomas@t-8ch.de>,
qemu-devel@nongnu.org
Subject: Re: [PATCH v3 1/2] acpi: ged: Add macro for acpi sleep control register
Date: Wed, 18 Sep 2024 14:21:47 +0200 [thread overview]
Message-ID: <20240918142147.50ef7b60@imammedo.users.ipa.redhat.com> (raw)
In-Reply-To: <20240918014206.2165821-2-maobibo@loongson.cn>
On Wed, 18 Sep 2024 09:42:05 +0800
Bibo Mao <maobibo@loongson.cn> wrote:
> Macro definition is added for acpi sleep control register, ged emulation
> driver can use the macro , also it can be used in FDT table if ged is
> exposed with FDT table.
>
> Signed-off-by: Bibo Mao <maobibo@loongson.cn>
Reviewed-by: Igor Mammedov <imammedo@redhat.com>
> ---
> hw/acpi/generic_event_device.c | 6 +++---
> include/hw/acpi/generic_event_device.h | 7 +++++--
> 2 files changed, 8 insertions(+), 5 deletions(-)
>
> diff --git a/hw/acpi/generic_event_device.c b/hw/acpi/generic_event_device.c
> index 15b4c3ebbf..d00f5a6c1c 100644
> --- a/hw/acpi/generic_event_device.c
> +++ b/hw/acpi/generic_event_device.c
> @@ -201,9 +201,9 @@ static void ged_regs_write(void *opaque, hwaddr addr, uint64_t data,
>
> switch (addr) {
> case ACPI_GED_REG_SLEEP_CTL:
> - slp_typ = (data >> 2) & 0x07;
> - slp_en = (data >> 5) & 0x01;
> - if (slp_en && slp_typ == 5) {
> + slp_typ = (data >> ACPI_GED_SLP_TYP_POS) & ACPI_GED_SLP_TYP_MASK;
> + slp_en = !!(data & ACPI_GED_SLP_EN);
> + if (slp_en && slp_typ == ACPI_GED_SLP_TYP_S5) {
> qemu_system_shutdown_request(SHUTDOWN_CAUSE_GUEST_SHUTDOWN);
> }
> return;
> diff --git a/include/hw/acpi/generic_event_device.h b/include/hw/acpi/generic_event_device.h
> index 40af3550b5..d2dac87b4a 100644
> --- a/include/hw/acpi/generic_event_device.h
> +++ b/include/hw/acpi/generic_event_device.h
> @@ -81,8 +81,11 @@ OBJECT_DECLARE_SIMPLE_TYPE(AcpiGedState, ACPI_GED)
> /* ACPI_GED_REG_RESET value for reset*/
> #define ACPI_GED_RESET_VALUE 0x42
>
> -/* ACPI_GED_REG_SLEEP_CTL.SLP_TYP value for S5 (aka poweroff) */
> -#define ACPI_GED_SLP_TYP_S5 0x05
> +/* [ACPI 5.0 Chapter 4.8.3.7] Sleep Control and Status Register */
> +#define ACPI_GED_SLP_TYP_POS 0x2 /* SLP_TYPx Bit Offset */
> +#define ACPI_GED_SLP_TYP_MASK 0x07 /* SLP_TYPx 3-bit mask */
> +#define ACPI_GED_SLP_TYP_S5 0x05 /* System _S5 State (Soft Off) */
> +#define ACPI_GED_SLP_EN 0x20 /* SLP_EN write-only bit */
>
> #define GED_DEVICE "GED"
> #define AML_GED_EVT_REG "EREG"
next prev parent reply other threads:[~2024-09-18 12:22 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-09-18 1:42 [PATCH v3 0/2] Add FDT table support with acpi ged pm register Bibo Mao
2024-09-18 1:42 ` [PATCH v3 1/2] acpi: ged: Add macro for acpi sleep control register Bibo Mao
2024-09-18 12:21 ` Igor Mammedov [this message]
2024-09-18 1:42 ` [PATCH v3 2/2] hw/loongarch/virt: Add FDT table support with acpi ged pm register Bibo Mao
2024-09-29 7:45 ` gaosong
2024-09-29 7:45 ` [PATCH v3 0/2] " gaosong
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240918142147.50ef7b60@imammedo.users.ipa.redhat.com \
--to=imammedo@redhat.com \
--cc=Jason@zx2c4.com \
--cc=anisinha@redhat.com \
--cc=gaosong@loongson.cn \
--cc=jiaxun.yang@flygoat.com \
--cc=maobibo@loongson.cn \
--cc=mst@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=thomas@t-8ch.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).