diff options
author | Marian Postevca <posteuca@mutex.one> | 2021-02-21 02:17:36 +0200 |
---|---|---|
committer | Michael S. Tsirkin <mst@redhat.com> | 2021-03-22 18:58:19 -0400 |
commit | d07b22863b8e0981bdc9384a787a703f1fd4ba42 (patch) | |
tree | c58dcec6e3517523f9084dd783389f2e4cd2f13d /hw/i386/pc.c | |
parent | 50337286b796f3866d1880f6e8a895fa5853b543 (diff) |
acpi: Move setters/getters of oem fields to X86MachineState
The code that sets/gets oem fields is duplicated in both PC and MICROVM
variants. This commit moves it to X86MachineState so that all x86
variants can use it and duplication is removed.
Signed-off-by: Marian Postevca <posteuca@mutex.one>
Message-Id: <20210221001737.24499-2-posteuca@mutex.one>
Reviewed-by: Igor Mammedov <imammedo@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Diffstat (limited to 'hw/i386/pc.c')
-rw-r--r-- | hw/i386/pc.c | 63 |
1 files changed, 0 insertions, 63 deletions
diff --git a/hw/i386/pc.c b/hw/i386/pc.c index 35e1770950..8a84b25a03 100644 --- a/hw/i386/pc.c +++ b/hw/i386/pc.c @@ -1608,49 +1608,6 @@ static void pc_machine_set_max_fw_size(Object *obj, Visitor *v, pcms->max_fw_size = value; } -static char *pc_machine_get_oem_id(Object *obj, Error **errp) -{ - PCMachineState *pcms = PC_MACHINE(obj); - - return g_strdup(pcms->oem_id); -} - -static void pc_machine_set_oem_id(Object *obj, const char *value, Error **errp) -{ - PCMachineState *pcms = PC_MACHINE(obj); - size_t len = strlen(value); - - if (len > 6) { - error_setg(errp, - "User specified "PC_MACHINE_OEM_ID" value is bigger than " - "6 bytes in size"); - return; - } - - strncpy(pcms->oem_id, value, 6); -} - -static char *pc_machine_get_oem_table_id(Object *obj, Error **errp) -{ - PCMachineState *pcms = PC_MACHINE(obj); - - return g_strdup(pcms->oem_table_id); -} - -static void pc_machine_set_oem_table_id(Object *obj, const char *value, - Error **errp) -{ - PCMachineState *pcms = PC_MACHINE(obj); - size_t len = strlen(value); - - if (len > 8) { - error_setg(errp, - "User specified "PC_MACHINE_OEM_TABLE_ID" value is bigger than " - "8 bytes in size"); - return; - } - strncpy(pcms->oem_table_id, value, 8); -} static void pc_machine_initfn(Object *obj) { @@ -1664,8 +1621,6 @@ static void pc_machine_initfn(Object *obj) pcms->max_ram_below_4g = 0; /* use default */ /* acpi build is enabled by default if machine supports it */ pcms->acpi_build_enabled = PC_MACHINE_GET_CLASS(pcms)->has_acpi_build; - pcms->oem_id = g_strndup(ACPI_BUILD_APPNAME6, 6); - pcms->oem_table_id = g_strndup(ACPI_BUILD_APPNAME8, 8); pcms->smbus_enabled = true; pcms->sata_enabled = true; pcms->pit_enabled = true; @@ -1802,24 +1757,6 @@ static void pc_machine_class_init(ObjectClass *oc, void *data) NULL, NULL); object_class_property_set_description(oc, PC_MACHINE_MAX_FW_SIZE, "Maximum combined firmware size"); - - object_class_property_add_str(oc, PC_MACHINE_OEM_ID, - pc_machine_get_oem_id, - pc_machine_set_oem_id); - object_class_property_set_description(oc, PC_MACHINE_OEM_ID, - "Override the default value of field OEMID " - "in ACPI table header." - "The string may be up to 6 bytes in size"); - - - object_class_property_add_str(oc, PC_MACHINE_OEM_TABLE_ID, - pc_machine_get_oem_table_id, - pc_machine_set_oem_table_id); - object_class_property_set_description(oc, PC_MACHINE_OEM_TABLE_ID, - "Override the default value of field OEM Table ID " - "in ACPI table header." - "The string may be up to 8 bytes in size"); - } static const TypeInfo pc_machine_info = { |