qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Michael S. Tsirkin" <mst@redhat.com>
To: Shannon Zhao <zhaoshenglong@huawei.com>
Cc: peter.maydell@linaro.org, hangaohuai@huawei.com,
	a.spyridakis@virtualopensystems.com, claudio.fontana@huawei.com,
	qemu-devel@nongnu.org, wanghaibin.wang@huawei.com,
	peter.huangpeng@huawei.com, hanjun.guo@linaro.org,
	imammedo@redhat.com, pbonzini@redhat.com, lersek@redhat.com,
	christoffer.dall@linaro.org
Subject: Re: [Qemu-devel] [RFC PATCH 09/11] hw/acpi/acpi-build-utils: Add acpi_fixed_memory32() and acpi_extended_irq()
Date: Sun, 25 Jan 2015 10:39:21 +0200	[thread overview]
Message-ID: <20150125083921.GA19255@redhat.com> (raw)
In-Reply-To: <1422091280-14532-10-git-send-email-zhaoshenglong@huawei.com>

On Sat, Jan 24, 2015 at 05:21:18PM +0800, Shannon Zhao wrote:
> Add acpi_fixed_memory32() for describing device mmio region in resource template.
> Add acpi_extended_irq() for describing device interrupt in resource template.
> These can be used to generating DSDT table for ACPI on ARM.
> 
> Signed-off-by: Shannon Zhao <zhaoshenglong@huawei.com>
> ---
>  hw/acpi/acpi-build-utils.c         |   42 ++++++++++++++++++++++++++++++++++++
>  include/hw/acpi/acpi-build-utils.h |    2 +
>  2 files changed, 44 insertions(+), 0 deletions(-)
> 
> diff --git a/hw/acpi/acpi-build-utils.c b/hw/acpi/acpi-build-utils.c
> index 59873e3..211c4d3 100644
> --- a/hw/acpi/acpi-build-utils.c
> +++ b/hw/acpi/acpi-build-utils.c
> @@ -493,6 +493,48 @@ AcpiAml acpi_call4(const char *method, AcpiAml arg1, AcpiAml arg2,
>  }
>  
>  /*
> + * ACPI 5.1: 19.5.80 Memory32Fixed (Memory Resource Descriptor Macro)

Pls document the first spec which includes a feature, not the last one.

> + *           6.4.2 Small Resource Data Type

So add API for small resource data type?

> + */
> +AcpiAml acpi_fixed_memory32(uint64_t addr, uint64_t size, uint8_t rw_flag)

so name it memory32_fixed?

> +{
> +    AcpiAml var = aml_allocate_internal(0, NON_BLOCK);
> +    build_append_byte(var.buf, 0x86); /* Extended irq descriptor */
> +    build_append_byte(var.buf, 9);
> +    build_append_byte(var.buf, 0);
> +    build_append_byte(var.buf, rw_flag);
> +    build_append_byte(var.buf, addr & 0xff);
> +    build_append_byte(var.buf, (addr >> 8) & 0xff);
> +    build_append_byte(var.buf, (addr >> 16) & 0xff);
> +    build_append_byte(var.buf, (addr >> 24) & 0xff);
> +
> +    build_append_byte(var.buf, size & 0xff);
> +    build_append_byte(var.buf, (size >> 8) & 0xff);
> +    build_append_byte(var.buf, (size >> 16) & 0xff);
> +    build_append_byte(var.buf, (size >> 24) & 0xff);
> +    return var;
> +}
> +
> +/*
> + * ACPI 5.1: 19.5.61 Interrupt (Interrupt Resource Descriptor Macro)
> + *           6.4.2 Small Resource Data Type
> + */
> +AcpiAml acpi_extended_irq(uint8_t irq_flags, int irq)

So acpi_interrupt?

> +{
> +    AcpiAml var = aml_allocate_internal(0, NON_BLOCK);
> +    build_append_byte(var.buf, 0x89); /* Extended irq descriptor */
> +    build_append_byte(var.buf, 6);
> +    build_append_byte(var.buf, 0);
> +    build_append_byte(var.buf, irq_flags);
> +    build_append_byte(var.buf, 0x01);
> +    build_append_byte(var.buf, irq & 0xff);
> +    build_append_byte(var.buf, (irq >> 8) & 0xff);
> +    build_append_byte(var.buf, (irq >> 16) & 0xff);
> +    build_append_byte(var.buf, (irq >> 24) & 0xff);
> +    return var;


Pls add comments to document opcode constants.

> +}
> +
> +/*
>   * ACPI 5.0: 19.5.62 IO (IO Resource Descriptor Macro)
>   *           6.4.2 Small Resource Data Type
>  */
> diff --git a/include/hw/acpi/acpi-build-utils.h b/include/hw/acpi/acpi-build-utils.h
> index d39b5b1..bfed546 100644
> --- a/include/hw/acpi/acpi-build-utils.h
> +++ b/include/hw/acpi/acpi-build-utils.h
> @@ -115,6 +115,8 @@ AcpiAml acpi_call3(const char *method, AcpiAml arg1, AcpiAml arg2,
>                     AcpiAml arg3);
>  AcpiAml acpi_call4(const char *method, AcpiAml arg1, AcpiAml arg2,
>                     AcpiAml arg3, AcpiAml arg4);
> +AcpiAml acpi_fixed_memory32(uint64_t addr, uint64_t size, uint8_t rw_flag);
> +AcpiAml acpi_extended_irq(uint8_t irq_flags, int irq);
>  AcpiAml acpi_io(acpiIODecode dec, uint16_t min_base, uint16_t max_base,
>                  uint8_t aln, uint8_t len);
>  AcpiAml acpi_iqr_no_flags(uint8_t irq);
> -- 
> 1.7.1
> 

  reply	other threads:[~2015-01-25  8:39 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-01-24  9:21 [Qemu-devel] [RFC PATCH 00/11] Generate ACPI v5.1 tables and expose it to guest over fw_cfg on ARM Shannon Zhao
2015-01-24  9:21 ` [Qemu-devel] [RFC PATCH 01/11] hw/i386: Move ACPI header definitions in an arch-independent location Shannon Zhao
2015-01-24  9:21 ` [Qemu-devel] [RFC PATCH 02/11] hw/arm/virt-acpi-build: Basic framework for building ACPI tables Shannon Zhao
2015-01-24 16:22   ` Michael S. Tsirkin
2015-01-26  2:37     ` Shannon Zhao
2015-01-26 10:19   ` Igor Mammedov
2015-01-27  6:47     ` Shannon Zhao
2015-01-27 10:30       ` Igor Mammedov
2015-01-28  6:28         ` Shannon Zhao
2015-01-27 12:12   ` Hanjun Guo
2015-01-24  9:21 ` [Qemu-devel] [RFC PATCH 03/11] hw/arm/virt-acpi-build: Generate RSDP table Shannon Zhao
2015-01-26 10:22   ` Igor Mammedov
2015-01-27  6:50     ` Shannon Zhao
2015-01-27  9:36     ` Shannon Zhao
2015-01-27  9:42       ` Igor Mammedov
2015-01-24  9:21 ` [Qemu-devel] [RFC PATCH 04/11] hw/arm/virt-acpi-build: Generate XSDT table and add a build_header function Shannon Zhao
2015-01-24 22:04   ` Laszlo Ersek
2015-01-26  1:45     ` Shannon Zhao
2015-01-24  9:21 ` [Qemu-devel] [RFC PATCH 05/11] hw/arm/virt-acpi-build: Generate MADT table Shannon Zhao
2015-01-24  9:21 ` [Qemu-devel] [RFC PATCH 06/11] hw/arm/virt-acpi-build: Generate GTDT table Shannon Zhao
2015-01-24  9:21 ` [Qemu-devel] [RFC PATCH 07/11] hw/arm/virt-acpi-build: Generate FADT table and update ACPI headers Shannon Zhao
2015-01-24 22:05   ` Laszlo Ersek
2015-01-26  1:48     ` Shannon Zhao
2015-01-24  9:21 ` [Qemu-devel] [RFC PATCH 08/11] hw/arm/virt-acpi-build: Generate FACS " Shannon Zhao
2015-01-24  9:21 ` [Qemu-devel] [RFC PATCH 09/11] hw/acpi/acpi-build-utils: Add acpi_fixed_memory32() and acpi_extended_irq() Shannon Zhao
2015-01-25  8:39   ` Michael S. Tsirkin [this message]
2015-01-26  1:58     ` Shannon Zhao
2015-01-26 10:46     ` Igor Mammedov
2015-01-24  9:21 ` [Qemu-devel] [RFC PATCH 10/11] hw/arm/virt-acpi-build: Generation of DSDT table for virt devices Shannon Zhao
2015-01-26 10:40   ` Igor Mammedov
2015-01-27  7:19     ` Shannon Zhao
2015-01-24  9:21 ` [Qemu-devel] [RFC PATCH 11/11] hw/arm/virt: Enable dynamic generation of ACPI v5.1 tables Shannon Zhao
2015-01-24 18:56   ` Laszlo Ersek
2015-01-26  1:59     ` Shannon Zhao
2015-01-24 23:31 ` [Qemu-devel] [RFC PATCH 00/11] Generate ACPI v5.1 tables and expose it to guest over fw_cfg on ARM Laszlo Ersek
2015-01-26  2:34   ` Shannon Zhao

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=20150125083921.GA19255@redhat.com \
    --to=mst@redhat.com \
    --cc=a.spyridakis@virtualopensystems.com \
    --cc=christoffer.dall@linaro.org \
    --cc=claudio.fontana@huawei.com \
    --cc=hangaohuai@huawei.com \
    --cc=hanjun.guo@linaro.org \
    --cc=imammedo@redhat.com \
    --cc=lersek@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=peter.huangpeng@huawei.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-devel@nongnu.org \
    --cc=wanghaibin.wang@huawei.com \
    --cc=zhaoshenglong@huawei.com \
    /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).