From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:39991) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZbtMa-0002M5-Cp for qemu-devel@nongnu.org; Tue, 15 Sep 2015 12:45:49 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZbtMW-0006Vm-4c for qemu-devel@nongnu.org; Tue, 15 Sep 2015 12:45:48 -0400 Received: from mail-vk0-f54.google.com ([209.85.213.54]:36590) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZbtMW-0006Vf-1e for qemu-devel@nongnu.org; Tue, 15 Sep 2015 12:45:44 -0400 Received: by vkfp126 with SMTP id p126so83507679vkf.3 for ; Tue, 15 Sep 2015 09:45:43 -0700 (PDT) MIME-Version: 1.0 In-Reply-To: <20150915164232.GC3165@hawk.localdomain> References: <1442328281-18039-1-git-send-email-leif.lindholm@linaro.org> <1442328281-18039-3-git-send-email-leif.lindholm@linaro.org> <20150915164232.GC3165@hawk.localdomain> From: Peter Maydell Date: Tue, 15 Sep 2015 17:45:24 +0100 Message-ID: Content-Type: text/plain; charset=UTF-8 Subject: Re: [Qemu-devel] [PATCH v3 2/2] hw/arm/virt-acpi-build: Add DBG2 table List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Andrew Jones Cc: Al Stone , QEMU Developers , Leif Lindholm , Shannon Zhao On 15 September 2015 at 17:42, Andrew Jones wrote: > On Tue, Sep 15, 2015 at 03:44:41PM +0100, Leif Lindholm wrote: >> Add a DBG2 table, describing the pl011 UART. >> >> Signed-off-by: Leif Lindholm >> --- >> hw/arm/virt-acpi-build.c | 88 +++++++++++++++++++++++++++++++++++++++++++++++- >> 1 file changed, 87 insertions(+), 1 deletion(-) >> >> diff --git a/hw/arm/virt-acpi-build.c b/hw/arm/virt-acpi-build.c >> index 9088248..763d531 100644 >> --- a/hw/arm/virt-acpi-build.c >> +++ b/hw/arm/virt-acpi-build.c >> @@ -351,6 +351,89 @@ build_rsdp(GArray *rsdp_table, GArray *linker, unsigned rsdt) >> return rsdp_table; >> } >> >> +static int >> +dbg2_addresses_size(int num_addr) >> +{ >> + return num_addr * (sizeof(struct AcpiGenericAddress) + sizeof(uint32_t)); >> +} >> + >> +static int >> +dbg2_dev_length(int num_addr, const char *namepath, int oemdata_length) >> +{ >> + int size; >> + >> + size = sizeof(AcpiDebugPort2Device); >> + size += dbg2_addresses_size(num_addr); >> + size += strlen(namepath) + 1; >> + size += oemdata_length; >> + >> + return size; >> +} > > I think macros should suffice for the above helpers. ...but if you can write them as functions then why not do so? The compiler's smart enough to inline as appropriate, and it's not like performance is critical with one-time ACPI table building anyhow. Incidentally putting a linebreak before the function name is not the usual QEMU style for function definitions. thanks -- PMM