On 15 September 2015 at 17:42, Andrew Jones <drjo...@redhat.com> 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 <leif.lindh...@linaro.org> >> --- >> 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