[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 2/3] nvdimm, acpi: add NFIT platform capabilities
From: |
Ross Zwisler |
Subject: |
[Qemu-devel] [PATCH 2/3] nvdimm, acpi: add NFIT platform capabilities |
Date: |
Fri, 27 Apr 2018 15:53:13 -0600 |
Add support for the NFIT Platform Capabilities Structure, newly added in
ACPI 6.2 Errata A.
Signed-off-by: Ross Zwisler <address@hidden>
---
hw/acpi/nvdimm.c | 32 ++++++++++++++++++++++++++++++++
1 file changed, 32 insertions(+)
diff --git a/hw/acpi/nvdimm.c b/hw/acpi/nvdimm.c
index 59d6e4254c..859b390e07 100644
--- a/hw/acpi/nvdimm.c
+++ b/hw/acpi/nvdimm.c
@@ -169,6 +169,21 @@ struct NvdimmNfitControlRegion {
} QEMU_PACKED;
typedef struct NvdimmNfitControlRegion NvdimmNfitControlRegion;
+/*
+ * NVDIMM Platform Capabilities Structure
+ *
+ * Defined in section 5.2.25.9 of ACPI 6.2 Errata A, September 2017
+ */
+struct NvdimmNfitPlatformCaps {
+ uint16_t type;
+ uint16_t length;
+ uint8_t highest_cap;
+ uint8_t reserved[3];
+ uint32_t capabilities;
+ uint8_t reserved2[4];
+} QEMU_PACKED;
+typedef struct NvdimmNfitPlatformCaps NvdimmNfitPlatformCaps;
+
/*
* Module serial number is a unique number for each device. We use the
* slot id of NVDIMM device to generate this number so that each device
@@ -351,6 +366,21 @@ static void nvdimm_build_structure_dcr(GArray *structures,
DeviceState *dev)
JEDEC Annex L Release 3. */);
}
+/*
+ * ACPI 6.2 Errata A: 5.2.25.9 NVDIMM Platform Capabilities Structure
+ */
+static void
+nvdimm_build_structure_caps(GArray *structures)
+{
+ NvdimmNfitPlatformCaps *nfit_caps;
+
+ nfit_caps = acpi_data_push(structures, sizeof(*nfit_caps));
+
+ nfit_caps->type = cpu_to_le16(7 /* NVDIMM Platform Capabilities */);
+ nfit_caps->length = cpu_to_le16(sizeof(*nfit_caps));
+ nfit_caps->highest_cap = 1;
+ nfit_caps->capabilities = cpu_to_le32(2 /* memory controller */);
+}
static GArray *nvdimm_build_device_structure(void)
{
GSList *device_list = nvdimm_get_device_list();
@@ -373,6 +403,8 @@ static GArray *nvdimm_build_device_structure(void)
}
g_slist_free(device_list);
+ nvdimm_build_structure_caps(structures);
+
return structures;
}
--
2.14.3