[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 20/28] acpi: extend aml_field() to support UpdateRule
From: |
Michael S. Tsirkin |
Subject: |
[Qemu-devel] [PULL 20/28] acpi: extend aml_field() to support UpdateRule |
Date: |
Mon, 11 May 2015 14:48:14 +0200 |
From: Zhu Guihua <address@hidden>
The flags field is declared with default update rule 'Preserve',
this patch extends aml_field() to support UpdateRule so that we
can specify different values per field.
Reviewed-by: Igor Mammedov <address@hidden>
Signed-off-by: Zhu Guihua <address@hidden>
Reviewed-by: Michael S. Tsirkin <address@hidden>
Signed-off-by: Michael S. Tsirkin <address@hidden>
---
include/hw/acpi/aml-build.h | 10 ++++++++--
hw/acpi/aml-build.c | 4 +++-
hw/i386/acpi-build.c | 13 ++++++++-----
3 files changed, 19 insertions(+), 8 deletions(-)
diff --git a/include/hw/acpi/aml-build.h b/include/hw/acpi/aml-build.h
index 1705001..15579e6 100644
--- a/include/hw/acpi/aml-build.h
+++ b/include/hw/acpi/aml-build.h
@@ -47,7 +47,13 @@ typedef enum {
aml_dword_acc = 3,
aml_qword_acc = 4,
aml_buffer_acc = 5,
-} AmlFieldFlags;
+} AmlAccessType;
+
+typedef enum {
+ aml_preserve = 0,
+ aml_write_as_ones = 1,
+ aml_write_as_zeros = 2,
+} AmlUpdateRule;
typedef enum {
aml_system_memory = 0x00,
@@ -205,7 +211,7 @@ Aml *aml_if(Aml *predicate);
Aml *aml_package(uint8_t num_elements);
Aml *aml_buffer(void);
Aml *aml_resource_template(void);
-Aml *aml_field(const char *name, AmlFieldFlags flags);
+Aml *aml_field(const char *name, AmlAccessType type, AmlUpdateRule rule);
Aml *aml_varpackage(uint32_t num_elements);
void
diff --git a/hw/acpi/aml-build.c b/hw/acpi/aml-build.c
index 8d01959..77ce00b 100644
--- a/hw/acpi/aml-build.c
+++ b/hw/acpi/aml-build.c
@@ -636,9 +636,11 @@ Aml *aml_reserved_field(unsigned length)
}
/* ACPI 1.0b: 16.2.5.2 Named Objects Encoding: DefField */
-Aml *aml_field(const char *name, AmlFieldFlags flags)
+Aml *aml_field(const char *name, AmlAccessType type, AmlUpdateRule rule)
{
Aml *var = aml_bundle(0x81 /* FieldOp */, AML_EXT_PACKAGE);
+ uint8_t flags = rule << 5 | type;
+
build_append_namestring(var->buf, "%s", name);
build_append_byte(var->buf, flags);
return var;
diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c
index c193ca5..085dc6d 100644
--- a/hw/i386/acpi-build.c
+++ b/hw/i386/acpi-build.c
@@ -746,7 +746,7 @@ build_ssdt(GArray *table_data, GArray *linker,
aml_append(dev, aml_operation_region("PEOR", aml_system_io,
misc->pvpanic_port, 1));
- field = aml_field("PEOR", aml_byte_acc);
+ field = aml_field("PEOR", aml_byte_acc, aml_preserve);
aml_append(field, aml_named_field("PEPT", 8));
aml_append(dev, field);
@@ -783,7 +783,7 @@ build_ssdt(GArray *table_data, GArray *linker,
/* declare CPU hotplug MMIO region and PRS field to access it */
aml_append(sb_scope, aml_operation_region(
"PRST", aml_system_io, pm->cpu_hp_io_base, pm->cpu_hp_io_len));
- field = aml_field("PRST", aml_byte_acc);
+ field = aml_field("PRST", aml_byte_acc, aml_preserve);
aml_append(field, aml_named_field("PRS", 256));
aml_append(sb_scope, field);
@@ -857,7 +857,8 @@ build_ssdt(GArray *table_data, GArray *linker,
pm->mem_hp_io_base, pm->mem_hp_io_len)
);
- field = aml_field(stringify(MEMORY_HOTPLUG_IO_REGION), aml_dword_acc);
+ field = aml_field(stringify(MEMORY_HOTPLUG_IO_REGION), aml_dword_acc,
+ aml_preserve);
aml_append(field, /* read only */
aml_named_field(stringify(MEMORY_SLOT_ADDR_LOW), 32));
aml_append(field, /* read only */
@@ -870,7 +871,8 @@ build_ssdt(GArray *table_data, GArray *linker,
aml_named_field(stringify(MEMORY_SLOT_PROXIMITY), 32));
aml_append(scope, field);
- field = aml_field(stringify(MEMORY_HOTPLUG_IO_REGION), aml_byte_acc);
+ field = aml_field(stringify(MEMORY_HOTPLUG_IO_REGION), aml_byte_acc,
+ aml_preserve);
aml_append(field, aml_reserved_field(160 /* bits, Offset(20) */));
aml_append(field, /* 1 if enabled, read only */
aml_named_field(stringify(MEMORY_SLOT_ENABLED), 1));
@@ -879,7 +881,8 @@ build_ssdt(GArray *table_data, GArray *linker,
aml_named_field(stringify(MEMORY_SLOT_INSERT_EVENT), 1));
aml_append(scope, field);
- field = aml_field(stringify(MEMORY_HOTPLUG_IO_REGION), aml_dword_acc);
+ field = aml_field(stringify(MEMORY_HOTPLUG_IO_REGION), aml_dword_acc,
+ aml_preserve);
aml_append(field, /* DIMM selector, write only */
aml_named_field(stringify(MEMORY_SLOT_SLECTOR), 32));
aml_append(field, /* _OST event code, write only */
--
MST
- [Qemu-devel] [PULL 11/28] virtio-ccw: using VIRTIO_NO_VECTOR instead of 0 for invalid virtqueue, (continued)
- [Qemu-devel] [PULL 11/28] virtio-ccw: using VIRTIO_NO_VECTOR instead of 0 for invalid virtqueue, Michael S. Tsirkin, 2015/05/11
- [Qemu-devel] [PULL 12/28] virtio: introduce vector to virtqueues mapping, Michael S. Tsirkin, 2015/05/11
- [Qemu-devel] [PULL 13/28] virtio-pci: speedup MSI-X masking and unmasking, Michael S. Tsirkin, 2015/05/11
- [Qemu-devel] [PULL 14/28] pci: remove hard-coded bar size in msix_init_exclusive_bar(), Michael S. Tsirkin, 2015/05/11
- [Qemu-devel] [PULL 16/28] docs: update documentation for memory hot unplug, Michael S. Tsirkin, 2015/05/11
- [Qemu-devel] [PULL 17/28] acpi, mem-hotplug: add acpi_memory_slot_status() to get MemStatus, Michael S. Tsirkin, 2015/05/11
- [Qemu-devel] [PULL 15/28] virtio: coding style tweak, Michael S. Tsirkin, 2015/05/11
- [Qemu-devel] [PULL 18/28] acpi, mem-hotplug: add unplug request cb for memory device, Michael S. Tsirkin, 2015/05/11
- [Qemu-devel] [PULL 19/28] acpi, mem-hotplug: add unplug cb for memory device, Michael S. Tsirkin, 2015/05/11
- [Qemu-devel] [PULL 21/28] acpi: fix "Memory device control fields" register, Michael S. Tsirkin, 2015/05/11
- [Qemu-devel] [PULL 20/28] acpi: extend aml_field() to support UpdateRule,
Michael S. Tsirkin <=
- [Qemu-devel] [PULL 24/28] acpi: add a missing backslash to the \_SB scope., Michael S. Tsirkin, 2015/05/11
- [Qemu-devel] [PULL 25/28] pci: Merge pci_nic_init() into pci_nic_init_nofail(), Michael S. Tsirkin, 2015/05/11
- [Qemu-devel] [PULL 22/28] acpi: add hardware implementation for memory hot unplug, Michael S. Tsirkin, 2015/05/11
- [Qemu-devel] [PULL 28/28] acpi: update expected files for memory unplug, Michael S. Tsirkin, 2015/05/11
- [Qemu-devel] [PULL 23/28] qmp-event: add event notification for memory hot unplug error, Michael S. Tsirkin, 2015/05/11
- [Qemu-devel] [PULL 26/28] virtio-net: Move DEFINE_VIRTIO_NET_FEATURES to virtio-net, Michael S. Tsirkin, 2015/05/11
- [Qemu-devel] [PULL 27/28] virtio-scsi: Move DEFINE_VIRTIO_SCSI_FEATURES to virtio-scsi, Michael S. Tsirkin, 2015/05/11
- Re: [Qemu-devel] [PULL 00/28] pc, virtio enhancements, Peter Maydell, 2015/05/12