[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v9 4/8] hw/acpi/aml-build: Add Processor hierarchy node structure
From: |
Yanan Wang |
Subject: |
[PATCH v9 4/8] hw/acpi/aml-build: Add Processor hierarchy node structure |
Date: |
Wed, 20 Oct 2021 22:21:21 +0800 |
Add a generic API to build Processor hierarchy node structure (Type 0),
which is strictly consistent with descriptions in ACPI 6.3: 5.2.29.1.
This function will be used to build ACPI PPTT table for cpu topology.
Co-developed-by: Ying Fang <fangying1@huawei.com>
Co-developed-by: Henglong Fan <fanhenglong@huawei.com>
Co-developed-by: Yanan Wang <wangyanan55@huawei.com>
Signed-off-by: Yanan Wang <wangyanan55@huawei.com>
Reviewed-by: Andrew Jones <drjones@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Reviewed-by: Eric Auger <eric.auger@redhat.com>
---
hw/acpi/aml-build.c | 30 ++++++++++++++++++++++++++++++
1 file changed, 30 insertions(+)
diff --git a/hw/acpi/aml-build.c b/hw/acpi/aml-build.c
index 76af0ebaf9..5195324585 100644
--- a/hw/acpi/aml-build.c
+++ b/hw/acpi/aml-build.c
@@ -1964,6 +1964,36 @@ void build_slit(GArray *table_data, BIOSLinker *linker,
MachineState *ms,
acpi_table_end(linker, &table);
}
+/*
+ * ACPI spec, Revision 6.3
+ * 5.2.29.1 Processor hierarchy node structure (Type 0)
+ */
+static void build_processor_hierarchy_node(GArray *tbl, uint32_t flags,
+ uint32_t parent, uint32_t id,
+ uint32_t *priv_rsrc,
+ uint32_t priv_num)
+{
+ int i;
+
+ build_append_byte(tbl, 0); /* Type 0 - processor */
+ build_append_byte(tbl, 20 + priv_num * 4); /* Length */
+ build_append_int_noprefix(tbl, 0, 2); /* Reserved */
+ build_append_int_noprefix(tbl, flags, 4); /* Flags */
+ build_append_int_noprefix(tbl, parent, 4); /* Parent */
+ build_append_int_noprefix(tbl, id, 4); /* ACPI Processor ID */
+
+ /* Number of private resources */
+ build_append_int_noprefix(tbl, priv_num, 4);
+
+ /* Private resources[N] */
+ if (priv_num > 0) {
+ assert(priv_rsrc);
+ for (i = 0; i < priv_num; i++) {
+ build_append_int_noprefix(tbl, priv_rsrc[i], 4);
+ }
+ }
+}
+
/* build rev1/rev3/rev5.1 FADT */
void build_fadt(GArray *tbl, BIOSLinker *linker, const AcpiFadtData *f,
const char *oem_id, const char *oem_table_id)
--
2.19.1
- [PATCH v9 0/8] hw/arm/virt: Introduce cpu topology support, Yanan Wang, 2021/10/20
- [PATCH v9 1/8] hw/arm/virt: Only describe cpu topology since virt-6.2, Yanan Wang, 2021/10/20
- [PATCH v9 4/8] hw/acpi/aml-build: Add Processor hierarchy node structure,
Yanan Wang <=
- [PATCH v9 2/8] device_tree: Add qemu_fdt_add_path, Yanan Wang, 2021/10/20
- [PATCH v9 8/8] tests/data/acpi/virt: Update the empty expected file for PPTT, Yanan Wang, 2021/10/20
- [PATCH v9 7/8] hw/arm/virt-acpi-build: Generate PPTT table, Yanan Wang, 2021/10/20
- [PATCH v9 5/8] hw/acpi/aml-build: Add PPTT table, Yanan Wang, 2021/10/20
- [PATCH v9 3/8] hw/arm/virt: Add cpu-map to device tree, Yanan Wang, 2021/10/20
- [PATCH v9 6/8] tests/data/acpi/virt: Add an empty expected file for PPTT, Yanan Wang, 2021/10/20
- Re: [PATCH v9 0/8] hw/arm/virt: Introduce cpu topology support, Richard Henderson, 2021/10/21