All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Michael S. Tsirkin" <mst@redhat.com>
To: Bibo Mao <maobibo@loongson.cn>
Cc: "Igor Mammedov" <imammedo@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 1/2] acpi: ged: Add macro for acpi ged sleep register
Date: Tue, 10 Sep 2024 13:32:42 -0400	[thread overview]
Message-ID: <20240910133154-mutt-send-email-mst@kernel.org> (raw)
In-Reply-To: <20240906021943.150494-2-maobibo@loongson.cn>

On Fri, Sep 06, 2024 at 10:19:42AM +0800, Bibo Mao wrote:
> Macro definition is added for acpi ged sleep register, so that ged
> emulation driver can use this, also it can be used in FDT table if
> ged is exposed with FDT table.
> 
> Signed-off-by: Bibo Mao <maobibo@loongson.cn>
> ---
>  hw/acpi/generic_event_device.c         | 6 +++---
>  include/hw/acpi/generic_event_device.h | 3 +++
>  2 files changed, 6 insertions(+), 3 deletions(-)
> 
> diff --git a/hw/acpi/generic_event_device.c b/hw/acpi/generic_event_device.c
> index 15b4c3ebbf..10a338877c 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_MASK) >> ACPI_GED_SLP_TYP_SHIFT;
> +        slp_en  = !!(data  & ACPI_GED_SLP_ENABLE);
> +        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..526fea6efe 100644
> --- a/include/hw/acpi/generic_event_device.h
> +++ b/include/hw/acpi/generic_event_device.h
> @@ -82,7 +82,10 @@ OBJECT_DECLARE_SIMPLE_TYPE(AcpiGedState, ACPI_GED)
>  #define ACPI_GED_RESET_VALUE       0x42
>  
>  /* ACPI_GED_REG_SLEEP_CTL.SLP_TYP value for S5 (aka poweroff) */
> +#define ACPI_GED_SLP_TYP_SHIFT     0x02
>  #define ACPI_GED_SLP_TYP_S5        0x05
> +#define ACPI_GED_SLP_TYP_MASK      0x1C
> +#define ACPI_GED_SLP_ENABLE        0x20

The comment is wrong now, isn't it?
Pls document each value, copying name from spec verbatim.

>  
>  #define GED_DEVICE      "GED"
>  #define AML_GED_EVT_REG "EREG"
> -- 
> 2.39.3



  reply	other threads:[~2024-09-10 17:33 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-09-06  2:19 [PATCH 0/2] Add FDT table support with acpi ged pm register Bibo Mao
2024-09-06  2:19 ` [PATCH 1/2] acpi: ged: Add macro for acpi ged sleep register Bibo Mao
2024-09-10 17:32   ` Michael S. Tsirkin [this message]
2024-09-11  1:00     ` maobibo
2024-09-06  2:19 ` [PATCH 2/2] hw/loongarch/virt: Add FDT table support with acpi ged pm register Bibo Mao
2024-09-06  4:03 ` [PATCH 0/2] " Jason A. Donenfeld
2024-09-09  1:36 ` 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=20240910133154-mutt-send-email-mst@kernel.org \
    --to=mst@redhat.com \
    --cc=Jason@zx2c4.com \
    --cc=anisinha@redhat.com \
    --cc=gaosong@loongson.cn \
    --cc=imammedo@redhat.com \
    --cc=jiaxun.yang@flygoat.com \
    --cc=maobibo@loongson.cn \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.