From: Andrew Jones <drjones@redhat.com>
To: Leif Lindholm <leif.lindholm@linaro.org>
Cc: peter.maydell@linaro.org, qemu-devel@nongnu.org,
al.stone@linaro.org, shannon.zhao@linaro.org
Subject: Re: [Qemu-devel] [PATCH 2/2] hw/arm/virt-acpi-build: Add DBG2 table
Date: Mon, 7 Sep 2015 17:59:39 +0200 [thread overview]
Message-ID: <20150907155939.GH3014@hawk.localdomain> (raw)
In-Reply-To: <1441635826-4866-3-git-send-email-leif.lindholm@linaro.org>
On Mon, Sep 07, 2015 at 03:23:46PM +0100, Leif Lindholm wrote:
> Add a DBG2 table, describing the pl011 UART.
>
> Signed-off-by: Leif Lindholm <leif.lindholm@linaro.org>
> ---
> hw/arm/virt-acpi-build.c | 37 ++++++++++++++++++++++++++++++++++++-
> 1 file changed, 36 insertions(+), 1 deletion(-)
>
> diff --git a/hw/arm/virt-acpi-build.c b/hw/arm/virt-acpi-build.c
> index 9088248..6d53dbe 100644
> --- a/hw/arm/virt-acpi-build.c
> +++ b/hw/arm/virt-acpi-build.c
> @@ -352,6 +352,38 @@ build_rsdp(GArray *rsdp_table, GArray *linker, unsigned rsdt)
> }
>
> static void
> +build_dbg2(GArray *table_data, GArray *linker, VirtGuestInfo *guest_info)
> +{
> + AcpiDebugPort2 *dbg2;
> + const MemMapEntry *uart_memmap = &guest_info->memmap[VIRT_UART];
> +
> + dbg2 = acpi_data_push(table_data, sizeof(*dbg2));
> +
> + dbg2->debug_devices_offset = 44;
I'd prefer using offsetof(), even though it's unlikely to ever change.
> + dbg2->number_debug_devices = 1;
> + dbg2->debug_devices[0].revision = 0;
> + dbg2->debug_devices[0].length = 40;
If we keep the debug device structure definition, then this can be
sizeof()
> + dbg2->debug_devices[0].number_generic_address_registers = 1;
> + dbg2->debug_devices[0].namespace_string_length = 2;
> + dbg2->debug_devices[0].namespace_string_offset = 38;
Could use offsetof() if we have the debug device struct
> + dbg2->debug_devices[0].oem_data_length = 0;
> + dbg2->debug_devices[0].oem_data_offset = 0;
> + dbg2->debug_devices[0].port_type = 0x8000; /* Serial */
> + dbg2->debug_devices[0].port_subtype = 0x3; /* ARM PL011 UART */
> + dbg2->debug_devices[0].base_address_register_offset = 22;
offsetof()
> +
> + dbg2->debug_devices[0].base_address[0].space_id = AML_SYSTEM_MEMORY;
> + dbg2->debug_devices[0].base_address[0].bit_width = 8;
> + dbg2->debug_devices[0].base_address[0].bit_offset = 0;
> + dbg2->debug_devices[0].base_address[0].access_width = 1;
We're missing a bunch of cpu_to_le*'s for the >1 byte, non-zero assignments
above.
> + dbg2->debug_devices[0].base_address[0].address = cpu_to_le64(uart_memmap->base);
> +
> + strcpy((char *)dbg2->debug_devices[0].namespace_string, ".");
> +
> + build_header(linker, table_data, (void *)dbg2, "DBG2", sizeof(*dbg2), 0);
> +}
> +
> +static void
> build_spcr(GArray *table_data, GArray *linker, VirtGuestInfo *guest_info)
> {
> AcpiSerialPortConsoleRedirection *spcr;
> @@ -577,7 +609,7 @@ void virt_acpi_build(VirtGuestInfo *guest_info, AcpiBuildTables *tables)
> dsdt = tables_blob->len;
> build_dsdt(tables_blob, tables->linker, guest_info);
>
> - /* FADT MADT GTDT MCFG SPCR pointed to by RSDT */
> + /* FADT MADT GTDT MCFG DBG2 SPCR pointed to by RSDT */
> acpi_add_table(table_offsets, tables_blob);
> build_fadt(tables_blob, tables->linker, dsdt);
>
> @@ -591,6 +623,9 @@ void virt_acpi_build(VirtGuestInfo *guest_info, AcpiBuildTables *tables)
> build_mcfg(tables_blob, tables->linker, guest_info);
>
> acpi_add_table(table_offsets, tables_blob);
> + build_dbg2(tables_blob, tables->linker, guest_info);
> +
> + acpi_add_table(table_offsets, tables_blob);
> build_spcr(tables_blob, tables->linker, guest_info);
>
> /* RSDT is pointed to by RSDP */
> --
> 2.1.4
>
>
Thanks,
drew
next prev parent reply other threads:[~2015-09-07 15:59 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-09-07 14:23 [Qemu-devel] [PATCH 0/2] ACPI/arm-virt: add DBG2 Leif Lindholm
2015-09-07 14:23 ` [Qemu-devel] [PATCH 1/2] ACPI: Add definitions for the DBG2 table Leif Lindholm
2015-09-07 15:51 ` Andrew Jones
2015-09-10 8:19 ` Michael S. Tsirkin
2015-09-10 10:08 ` Igor Mammedov
2015-09-08 3:27 ` Shannon Zhao
2015-09-08 13:10 ` Leif Lindholm
2015-09-07 14:23 ` [Qemu-devel] [PATCH 2/2] hw/arm/virt-acpi-build: Add " Leif Lindholm
2015-09-07 15:59 ` Andrew Jones [this message]
2015-09-08 3:18 ` [Qemu-devel] [PATCH 0/2] ACPI/arm-virt: add DBG2 Shannon Zhao
2015-09-08 13:04 ` Leif Lindholm
2015-09-09 4:25 ` Shannon Zhao
2015-09-09 5:52 ` Andrew Jones
2015-09-09 21:23 ` Al Stone
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=20150907155939.GH3014@hawk.localdomain \
--to=drjones@redhat.com \
--cc=al.stone@linaro.org \
--cc=leif.lindholm@linaro.org \
--cc=peter.maydell@linaro.org \
--cc=qemu-devel@nongnu.org \
--cc=shannon.zhao@linaro.org \
/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).