From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:49330) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZNk8r-0001GD-1k for qemu-devel@nongnu.org; Fri, 07 Aug 2015 12:05:10 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZNk8p-0006YL-Hp for qemu-devel@nongnu.org; Fri, 07 Aug 2015 12:05:08 -0400 Received: from mx1.redhat.com ([209.132.183.28]:44882) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZNk8p-0006X7-AG for qemu-devel@nongnu.org; Fri, 07 Aug 2015 12:05:07 -0400 References: <1438881300-21738-1-git-send-email-wei@redhat.com> <1438881300-21738-2-git-send-email-wei@redhat.com> From: Laszlo Ersek Message-ID: <55C4D72B.7030400@redhat.com> Date: Fri, 7 Aug 2015 18:04:59 +0200 MIME-Version: 1.0 In-Reply-To: <1438881300-21738-2-git-send-email-wei@redhat.com> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [ARM SMBIOS V2 PATCH 1/6] smbios: extract x86 smbios building code into a function List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Wei Huang , qemu-devel@nongnu.org Cc: peter.maydell@linaro.org, drjones@redhat.com, ard.biesheuvel@linaro.org, ehabkost@redhat.com, ivan.khoronzhuk@linaro.org, mst@redhat.com, somlo@cmu.edu, zhaoshenglong@huawei.com, roy.franz@linaro.org, pbonzini@redhat.com, imammedo@redhat.com, jdelvare@suse.de, rth@twiddle.net On 08/06/15 19:14, Wei Huang wrote: > This patch extracts out the procedure of buidling x86 SMBIOS tables > into a dedicated function. > > Signed-off-by: Wei Huang > --- > hw/i386/pc.c | 38 ++++++++++++++++++++++---------------- > 1 file changed, 22 insertions(+), 16 deletions(-) > > diff --git a/hw/i386/pc.c b/hw/i386/pc.c > index 7661ea9..00e45f3 100644 > --- a/hw/i386/pc.c > +++ b/hw/i386/pc.c > @@ -718,11 +718,30 @@ static unsigned int pc_apic_id_limit(unsigned int max_cpus) > return x86_cpu_apic_id_from_index(max_cpus - 1) + 1; > } > > -static FWCfgState *bochs_bios_init(void) > +static void pc_build_smbios(FWCfgState *fw_cfg) > { > - FWCfgState *fw_cfg; > uint8_t *smbios_tables, *smbios_anchor; > size_t smbios_tables_len, smbios_anchor_len; > + > + smbios_tables = smbios_get_table_legacy(&smbios_tables_len); > + if (smbios_tables) { > + fw_cfg_add_bytes(fw_cfg, FW_CFG_SMBIOS_ENTRIES, > + smbios_tables, smbios_tables_len); > + } > + > + smbios_get_tables(&smbios_tables, &smbios_tables_len, > + &smbios_anchor, &smbios_anchor_len); > + if (smbios_anchor) { > + fw_cfg_add_file(fw_cfg, "etc/smbios/smbios-tables", > + smbios_tables, smbios_tables_len); > + fw_cfg_add_file(fw_cfg, "etc/smbios/smbios-anchor", > + smbios_anchor, smbios_anchor_len); > + } > +} > + > +static FWCfgState *bochs_bios_init(void) > +{ > + FWCfgState *fw_cfg; > uint64_t *numa_fw_cfg; > int i, j; > unsigned int apic_id_limit = pc_apic_id_limit(max_cpus); > @@ -748,20 +767,7 @@ static FWCfgState *bochs_bios_init(void) > acpi_tables, acpi_tables_len); > fw_cfg_add_i32(fw_cfg, FW_CFG_IRQ0_OVERRIDE, kvm_allows_irq0_override()); > > - smbios_tables = smbios_get_table_legacy(&smbios_tables_len); > - if (smbios_tables) { > - fw_cfg_add_bytes(fw_cfg, FW_CFG_SMBIOS_ENTRIES, > - smbios_tables, smbios_tables_len); > - } > - > - smbios_get_tables(&smbios_tables, &smbios_tables_len, > - &smbios_anchor, &smbios_anchor_len); > - if (smbios_anchor) { > - fw_cfg_add_file(fw_cfg, "etc/smbios/smbios-tables", > - smbios_tables, smbios_tables_len); > - fw_cfg_add_file(fw_cfg, "etc/smbios/smbios-anchor", > - smbios_anchor, smbios_anchor_len); > - } > + pc_build_smbios(fw_cfg); > > fw_cfg_add_bytes(fw_cfg, FW_CFG_E820_TABLE, > &e820_reserve, sizeof(e820_reserve)); > Reviewed-by: Laszlo Ersek