aboutsummaryrefslogtreecommitdiff
path: root/hw/i386/pc.c
diff options
context:
space:
mode:
authorPeter Maydell <peter.maydell@linaro.org>2021-02-05 15:27:02 +0000
committerPeter Maydell <peter.maydell@linaro.org>2021-02-05 15:27:02 +0000
commitd0dddab40e472ba62b5f43f11cc7dba085dabe71 (patch)
tree249639b15b62ad4f5c38a5de81193fb1360d741e /hw/i386/pc.c
parente2c5093c993ef646e4e28f7aa78429853bcc06ac (diff)
parent277a582bf88a3058fa094e078a5310a2deb37da6 (diff)
Merge remote-tracking branch 'remotes/mst/tags/for_upstream' into staging
pc,virtio,pci: fixes, features,code removal Fixes all over the place. Ability to control ACPI OEM ID's. Ability to control rom BAR size. Removal of deprecated pc machine types. Signed-off-by: Michael S. Tsirkin <mst@redhat.com> # gpg: Signature made Fri 05 Feb 2021 13:54:32 GMT # gpg: using RSA key 5D09FD0871C8F85B94CA8A0D281F0DB8D28D5469 # gpg: issuer "mst@redhat.com" # gpg: Good signature from "Michael S. Tsirkin <mst@kernel.org>" [full] # gpg: aka "Michael S. Tsirkin <mst@redhat.com>" [full] # Primary key fingerprint: 0270 606B 6F3C DF3D 0B17 0970 C350 3912 AFBE 8E67 # Subkey fingerprint: 5D09 FD08 71C8 F85B 94CA 8A0D 281F 0DB8 D28D 5469 * remotes/mst/tags/for_upstream: tests/acpi: disallow updates for expected data files tests/acpi: update expected data files tests/acpi: add OEM ID and OEM TABLE ID test acpi: use constants as strncpy limit acpi: Permit OEM ID and OEM table ID fields to be changed tests/acpi: allow updates for expected data files vhost: Check for valid vdev in vhost_backend_handle_iotlb_msg hw/virtio/virtio-balloon: Remove the "class" property hw/i386: Remove the deprecated pc-1.x machine types vhost: Unbreak SMMU and virtio-iommu on dev-iotlb support virtio-pmem: add trace events virtio: Add corresponding memory_listener_unregister to unrealize virtio-mmio: fix guest kernel crash with SHM regions virtio: move 'use-disabled-flag' property to hw_compat_4_2 pci: add romsize property pci: reject too large ROMs Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'hw/i386/pc.c')
-rw-r--r--hw/i386/pc.c64
1 files changed, 64 insertions, 0 deletions
diff --git a/hw/i386/pc.c b/hw/i386/pc.c
index 5458f61d10..8aa85dec54 100644
--- a/hw/i386/pc.c
+++ b/hw/i386/pc.c
@@ -1611,6 +1611,50 @@ 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)
{
PCMachineState *pcms = PC_MACHINE(obj);
@@ -1623,6 +1667,8 @@ 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;
@@ -1759,6 +1805,24 @@ 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 = {