[PATCH 1/2] acpi: method: add test for _CLS control method

Alex Hung alex.hung at canonical.com
Fri Apr 20 05:09:56 UTC 2018


While the document of PCI class code is not available, the format of
return package can still be checked.

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

diff --git a/src/acpi/method/method.c b/src/acpi/method/method.c
index db50c7c..9cc7501 100644
--- a/src/acpi/method/method.c
+++ b/src/acpi/method/method.c
@@ -65,7 +65,7 @@
  * _CCA 	 Y
  * _CDM 	 Y
  * _CID 	 Y
- * _CLS 	 N requires PCI SIG class info
+ * _CLS 	 Y
  * _CPC 	 Y
  * _CR3 	 Y
  * _CRS 	 Y
@@ -765,6 +765,33 @@ static int method_test_PIC(fwts_framework *fw)
 /*
  * Section 6.1 Device Identification Objects
  */
+static void method_test_CLS_return(
+	fwts_framework *fw,
+	char *name,
+	ACPI_BUFFER *buf,
+	ACPI_OBJECT *obj,
+	void *private)
+{
+	FWTS_UNUSED(private);
+
+	if (fwts_method_check_type(fw, name, buf, ACPI_TYPE_PACKAGE) != FWTS_OK)
+		return;
+
+	if (fwts_method_package_count_equal(fw, name, "_CLS", obj, 3) != FWTS_OK)
+		return;
+
+	if (fwts_method_package_elements_all_type(fw, name, "_CLS", obj, ACPI_TYPE_INTEGER) != FWTS_OK)
+		return;
+
+	fwts_method_passed_sane(fw, name, "package");
+}
+
+static int method_test_CLS(fwts_framework *fw)
+{
+	return method_evaluate_method(fw, METHOD_OPTIONAL,
+		"_CLS", NULL, 0, method_test_CLS_return, NULL);
+}
+
 static int method_test_DDN(fwts_framework *fw)
 {
 	return method_evaluate_method(fw, METHOD_OPTIONAL,
@@ -6018,7 +6045,7 @@ static fwts_framework_minor_test method_tests[] = {
 	/* Section 6.1 Device Identification Objects  */
 
 	{ method_test_CID, "Test _CID (Compatible ID)." },
-	/* { method_test_CLS, "Test _CLS (Class Code)." }, */
+	{ method_test_CLS, "Test _CLS (Class Code)." },
 	{ method_test_DDN, "Test _DDN (DOS Device Name)." },
 	{ method_test_HID, "Test _HID (Hardware ID)." },
 	{ method_test_HRV, "Test _HRV (Hardware Revision Number)." },
-- 
2.7.4




More information about the fwts-devel mailing list