[PATCH] acpi: method: add support for _CPC revision 2

Alex Hung alex.hung at canonical.com
Mon Jul 20 06:37:44 UTC 2015


Signed-off-by: Alex Hung <alex.hung at canonical.com>
---
 src/acpi/method/method.c | 57 +++++++++++++++++++++++++++++++++++++++++++-----
 1 file changed, 51 insertions(+), 6 deletions(-)

diff --git a/src/acpi/method/method.c b/src/acpi/method/method.c
index 4fbfa90..d0b98e6 100644
--- a/src/acpi/method/method.c
+++ b/src/acpi/method/method.c
@@ -2898,7 +2898,9 @@ static void method_test_CPC_return(
 	ACPI_OBJECT *obj,
 	void *private)
 {
-	static fwts_package_element elements[] = {
+	uint8_t revision;
+
+	static fwts_package_element elementsv1[] = {
 		{ ACPI_TYPE_INTEGER,	"Number of Entries" },
 		{ ACPI_TYPE_INTEGER,	"Revision" },
 		{ ACPI_TYPE_INTBUF,	"Highest Performance" },
@@ -2918,18 +2920,61 @@ static void method_test_CPC_return(
 		{ ACPI_TYPE_BUFFER,	"Enable Register" }
 	};
 
+	static fwts_package_element elementsv2[] = {
+		{ ACPI_TYPE_INTEGER,	"Number of Entries" },
+		{ ACPI_TYPE_INTEGER,	"Revision" },
+		{ ACPI_TYPE_INTBUF,	"Highest Performance" },
+		{ ACPI_TYPE_INTBUF,	"Nominal Performance" },
+		{ ACPI_TYPE_INTBUF,	"Lowest Non Linear Performance" },
+		{ ACPI_TYPE_INTBUF,	"Lowest Performance" },
+		{ ACPI_TYPE_BUFFER,	"Guaranteed Performance Register" },
+		{ ACPI_TYPE_BUFFER,	"Desired Performance Register" },
+		{ ACPI_TYPE_BUFFER,	"Minimum Performance Register" },
+		{ ACPI_TYPE_BUFFER,	"Maximum Performance Register" },
+		{ ACPI_TYPE_BUFFER,	"Performance Reduction Tolerance Register" },
+		{ ACPI_TYPE_BUFFER,	"Timed Window Register" },
+		{ ACPI_TYPE_INTBUF,	"Counter Wraparound Time" },
+		{ ACPI_TYPE_BUFFER,	"Reference Performance Counter Register" },
+		{ ACPI_TYPE_BUFFER,	"Delivered Performance Counter Register" },
+		{ ACPI_TYPE_BUFFER,	"Performance Limited Register" },
+		{ ACPI_TYPE_BUFFER,	"CPPC Enable Register" },
+		{ ACPI_TYPE_INTBUF,	"Autonomous Selection Enable" },
+		{ ACPI_TYPE_BUFFER,	"Autonomous Activity Window Register" },
+		{ ACPI_TYPE_BUFFER,	"Energy Performance Preference Register" },
+		{ ACPI_TYPE_INTBUF,	"Reference Performance" }
+	};
+
 	FWTS_UNUSED(private);
 
 	if (method_check_type(fw, name, buf, ACPI_TYPE_PACKAGE) != FWTS_OK)
 		return;
 
-	/* Something is really wrong if we don't have any elements in _CPC */
-	if (method_package_count_equal(fw, name, "_CPC", obj, 17) != FWTS_OK)
-		return;
+	revision = obj->Package.Elements[1].Integer.Value;
+
+	if (revision == 1) {		// acpi 5.0
+		/* Something is really wrong if we don't have any elements in _CPC */
+		if (method_package_count_equal(fw, name, "_CPC", obj, 17) != FWTS_OK)
+			return;
+
+		/* For now, just check types */
+		if (method_package_elements_type(fw, name, "_CPC", obj, elementsv1, 17) != FWTS_OK)
+			return;
+	} else if (revision == 2) {	// acpi 5.1 and later
+		/* Something is really wrong if we don't have any elements in _CPC */
+		if (method_package_count_equal(fw, name, "_CPC", obj, 21) != FWTS_OK)
+			return;
+
+		/* For now, just check types */
+		if (method_package_elements_type(fw, name, "_CPC", obj, elementsv2, 21) != FWTS_OK)
+			return;
+	} else {
+		fwts_failed(fw, LOG_LEVEL_HIGH,
+			"Method_CPCBadRevision",
+			"_CPC's _REV is incorrect, "
+			"expecting 1 or 2, got 0x%" PRIx8 , revision);
 
-	/* For now, just check types */
-	if (method_package_elements_type(fw, name, "_CPC", obj, elements, 17) != FWTS_OK)
 		return;
+	}
 
 	method_passed_sane(fw, name, "package");
 }
-- 
1.9.1




More information about the fwts-devel mailing list