aboutsummaryrefslogtreecommitdiff
path: root/hw/i386/pc.c
diff options
context:
space:
mode:
authorIgor Mammedov <imammedo@redhat.com>2017-01-18 18:13:18 +0100
committerEduardo Habkost <ehabkost@redhat.com>2017-01-23 21:25:36 -0200
commitf2098f483589ed894f732acab0dde48c8822a5ac (patch)
tree1bb656429832e9ca38a8dda3f48f4d98110369df /hw/i386/pc.c
parent726401be06c95cd66c91a60c702a524fdd1b6e9d (diff)
pc: cleanup: move smbios_set_cpuid() into pc_build_smbios()
move smbios_set_cpuid() close to the rest of smbios init code where it belongs to instead of calling it from pc_cpus_init(). Signed-off-by: Igor Mammedov <imammedo@redhat.com> Message-Id: <1484759609-264075-3-git-send-email-imammedo@redhat.com> Reviewed-by: Eduardo Habkost <ehabkost@redhat.com> Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Diffstat (limited to 'hw/i386/pc.c')
-rw-r--r--hw/i386/pc.c17
1 files changed, 9 insertions, 8 deletions
diff --git a/hw/i386/pc.c b/hw/i386/pc.c
index f721fde0c2..c0d0d2c6a1 100644
--- a/hw/i386/pc.c
+++ b/hw/i386/pc.c
@@ -701,16 +701,20 @@ static uint32_t x86_cpu_apic_id_from_index(unsigned int cpu_index)
}
}
-static void pc_build_smbios(FWCfgState *fw_cfg)
+static void pc_build_smbios(PCMachineState *pcms)
{
uint8_t *smbios_tables, *smbios_anchor;
size_t smbios_tables_len, smbios_anchor_len;
struct smbios_phys_mem_area *mem_array;
unsigned i, array_count;
+ X86CPU *cpu = X86_CPU(pcms->possible_cpus->cpus[0].cpu);
+
+ /* tell smbios about cpuid version and features */
+ smbios_set_cpuid(cpu->env.cpuid_version, cpu->env.features[FEAT_1_EDX]);
smbios_tables = smbios_get_table_legacy(&smbios_tables_len);
if (smbios_tables) {
- fw_cfg_add_bytes(fw_cfg, FW_CFG_SMBIOS_ENTRIES,
+ fw_cfg_add_bytes(pcms->fw_cfg, FW_CFG_SMBIOS_ENTRIES,
smbios_tables, smbios_tables_len);
}
@@ -731,9 +735,9 @@ static void pc_build_smbios(FWCfgState *fw_cfg)
g_free(mem_array);
if (smbios_anchor) {
- fw_cfg_add_file(fw_cfg, "etc/smbios/smbios-tables",
+ fw_cfg_add_file(pcms->fw_cfg, "etc/smbios/smbios-tables",
smbios_tables, smbios_tables_len);
- fw_cfg_add_file(fw_cfg, "etc/smbios/smbios-anchor",
+ fw_cfg_add_file(pcms->fw_cfg, "etc/smbios/smbios-anchor",
smbios_anchor, smbios_anchor_len);
}
}
@@ -1191,9 +1195,6 @@ void pc_cpus_init(PCMachineState *pcms)
object_unref(OBJECT(cpu));
}
}
-
- /* tell smbios about cpuid version and features */
- smbios_set_cpuid(cpu->env.cpuid_version, cpu->env.features[FEAT_1_EDX]);
}
static void pc_build_feature_control_file(PCMachineState *pcms)
@@ -1266,7 +1267,7 @@ void pc_machine_done(Notifier *notifier, void *data)
acpi_setup();
if (pcms->fw_cfg) {
- pc_build_smbios(pcms->fw_cfg);
+ pc_build_smbios(pcms);
pc_build_feature_control_file(pcms);
/* update FW_CFG_NB_CPUS to account for -device added CPUs */
fw_cfg_modify_i16(pcms->fw_cfg, FW_CFG_NB_CPUS, pcms->boot_cpus);