From patchwork Sat Dec 30 01:45:58 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mario Limonciello X-Patchwork-Id: 1881265 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.ubuntu.com (client-ip=185.125.189.65; helo=lists.ubuntu.com; envelope-from=fwts-devel-bounces@lists.ubuntu.com; receiver=patchwork.ozlabs.org) Received: from lists.ubuntu.com (lists.ubuntu.com [185.125.189.65]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4T24pp4lRBz23dc for ; Sat, 30 Dec 2023 12:46:25 +1100 (AEDT) Received: from localhost ([127.0.0.1] helo=lists.ubuntu.com) by lists.ubuntu.com with esmtp (Exim 4.86_2) (envelope-from ) id 1rJOQa-0000Ww-4l; Sat, 30 Dec 2023 01:46:16 +0000 Received: from mail-dm6nam12on2068.outbound.protection.outlook.com ([40.107.243.68] helo=NAM12-DM6-obe.outbound.protection.outlook.com) by lists.ubuntu.com with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1rJOQX-0000WQ-7i for fwts-devel@lists.ubuntu.com; Sat, 30 Dec 2023 01:46:13 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=iIpWYbfEN6OXMoP6pT9yIbxUZRFF7sXjyMn2LblrsTYnxlx1VZJY8gjngfscGFfofu/gKnPxoTgQqqtLyqC5nMuPgUqHRRHB227kQHvI/tuGn3PBrq72T/bdmQQQJvQkGDJ0WYJRrlB8O8iXjlyaZrMQaC/31qVDhY+04Az5oi0jgScHYUn0BxdJCq4IMwgWpBWfL7LI1f1eZPZacB/uPZ2yoAqT1ONehnDoHsDM1j0HWaKrWyDKH4qWg5CjqSytkrH9bQWC6Elr4E4EHSOuKSO8zRi/JXSUEUic3TgdpwjEygJ1LiVsA3uGbogD/K3eUhmLNQyMt9jwMCdr1xSbAQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=7wldBIwlitZYOrNXtnI/up2zaepQTlkj25vj+F7Mew0=; b=F3WXftUVw9VQTP2/nCPudtnRRZrBvjlJh1RLthVOzf7AviIutyYkLg0MMuOUWj8cIC3QSaTo1BQiJvMGvFiWA8r34Nabr9ybKPBpBphvSorN46nv4lbxqTUfgOyCBROCMN9FQc7OcA877Jsh1yHuwqr/AE//yBh1EK8VLnciDJHZQCpxkN/Xeukn1YlzxJZXBXaYoW6hOpsRX2zO675oFW1eQ0oGJ5rF0ampnisSouU73tgDJGrcrY2xRL0O7AcGy7dPfvrEVhV/r4docEdnh7NIuru/mNbVztsFMy0khZHlbhce4+HP1Q+bhQ5UV+WjTjQpWBruIPCClbLIqLF1kg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=lists.ubuntu.com smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0) Received: from SA0PR11CA0036.namprd11.prod.outlook.com (2603:10b6:806:d0::11) by SJ0PR12MB5504.namprd12.prod.outlook.com (2603:10b6:a03:3ad::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7135.21; Sat, 30 Dec 2023 01:46:08 +0000 Received: from SA2PEPF000015CC.namprd03.prod.outlook.com (2603:10b6:806:d0:cafe::50) by SA0PR11CA0036.outlook.office365.com (2603:10b6:806:d0::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7135.20 via Frontend Transport; Sat, 30 Dec 2023 01:46:08 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by SA2PEPF000015CC.mail.protection.outlook.com (10.167.241.202) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7159.9 via Frontend Transport; Sat, 30 Dec 2023 01:46:08 +0000 Received: from AUS-P9-MLIMONCI.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.34; Fri, 29 Dec 2023 19:46:06 -0600 From: Mario Limonciello To: Subject: [PATCH v2] Add support for ACPI 6.5 _UPC return values Date: Fri, 29 Dec 2023 19:45:58 -0600 Message-ID: <20231230014559.1345-1-mario.limonciello@amd.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SA2PEPF000015CC:EE_|SJ0PR12MB5504:EE_ X-MS-Office365-Filtering-Correlation-Id: 8669005c-7f30-4879-a94f-08dc08d917fa X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: /Xxmv6GkYqIO34MSTj/1uLfk+VyrlH+qgvdBZ1u06aG9fURJg0ouPslfiQHjw4WftYtRulwR+znOVPWeAmH6WVbyO5KmmzuN9oo/WIIPGKIdlbdRuc7iiDeGgOxzwUjuKLTCil7L5CMpJ8XMwGsmJB3UInVLdsPrQkshEhRR2HRT4C9JQktfDyPowRSwbRD3pYoXzeN1bYntbFQdsuHhddfBgeQpTZ21P36+VJzWbn3kRSEvfSaq3wNQf/6I6b63+7sXPOb5wQLYSeghy6JwrRMO8kzz1TILGu/wk8C2GiCv3lugQIKpA3JKbOjoNbzbbylRVciDDewJYRHgQy7Mxyst10j7NJLVXCtjWeMScFjoUegfQIRHGv3OUcM1jd3aHe60Pqpq4c94yDHvXf4zS9UmVRPfgmE04461YcWgivDY9xaIzf51eZ0+yCdtwaQDLSgkesakNMpLMpbQkSe0KeH7+yK1DrXFKrUsWa7ibM3QFlzXJ+eBJelsgtluJ3weZdaicJW5tfzxNOS1b9mp9qappD1zRblHL4jGj0isWVJLQWnqGSN8yKK5O9STKJxxI5Y8qfQoRVy3MxHcYd+99z5rzAKevkqRCwsUoVPQ8ZjSTw7hT8RSro99WzNklekekU6+6JHIVyrM9/7Fp6cubrOXrVnqOkqEUJAU2RAntT0Ev/DW/fIAilVTTQEN7YIiG6K/cfDhCCkMdJTMN+qJlJkSwsz+AVLTsCxqV9RqrOzc/PBTWDMd807BUr8Ig2st X-Forefront-Antispam-Report: CIP:165.204.84.17; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:SATLEXMB04.amd.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(13230031)(4636009)(136003)(39860400002)(396003)(376002)(346002)(230922051799003)(451199024)(1800799012)(64100799003)(186009)(82310400011)(36840700001)(40470700004)(46966006)(41300700001)(36860700001)(47076005)(2906002)(40460700003)(2616005)(81166007)(6916009)(336012)(16526019)(86362001)(36756003)(426003)(26005)(316002)(70586007)(70206006)(1076003)(6666004)(7696005)(82740400003)(356005)(966005)(478600001)(5660300002)(4326008)(83380400001)(40480700001)(8936002)(8676002)(44832011)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Dec 2023 01:46:08.2371 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 8669005c-7f30-4879-a94f-08dc08d917fa X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d; Ip=[165.204.84.17]; Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: SA2PEPF000015CC.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ0PR12MB5504 X-BeenThere: fwts-devel@lists.ubuntu.com X-Mailman-Version: 2.1.20 Precedence: list List-Id: Firmware Test Suite Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Mario Limonciello Errors-To: fwts-devel-bounces@lists.ubuntu.com Sender: "fwts-devel" The ACPI 6.5 specification includes `USB-C Port Capabilities` as part of the possible return values for `_UPC`. Add checks that match this guidance. Link: https://uefi.org/specs/ACPI/6.5/09_ACPI_Defined_Devices_and_Device_Specific_Objects.html?highlight=upc#upc-usb-port-capabilities Signed-off-by: Mario Limonciello Acked-by: Ivan Hu --- v1->v2: * Drop unnecessary for loop --- src/acpi/method/method.c | 34 +++++++++++++++++++++++++++------- 1 file changed, 27 insertions(+), 7 deletions(-) diff --git a/src/acpi/method/method.c b/src/acpi/method/method.c index 27e2410d..ec48f72b 100644 --- a/src/acpi/method/method.c +++ b/src/acpi/method/method.c @@ -2844,12 +2844,12 @@ static void method_test_UPC_return( ACPI_OBJECT *obj, void *private) { - uint32_t i, connector_type; + uint32_t connector_type, capabilities; static const fwts_package_element elements[] = { { ACPI_TYPE_INTEGER, "Connectable" }, { ACPI_TYPE_INTEGER, "Type" }, - { ACPI_TYPE_INTEGER, "Reserved0" }, + { ACPI_TYPE_INTEGER, "USB-C Port Capabilities" }, { ACPI_TYPE_INTEGER, "Reserved1" }, }; @@ -2868,13 +2868,33 @@ static void method_test_UPC_return( return; } - for (i = 2; i < 4; i++) { - if (obj->Package.Elements[i].Integer.Value != 0) { - fwts_failed(fw, LOG_LEVEL_MEDIUM, - "Method_UPCBadReturnType", - "%s element %" PRIu32 " is not zero.", name, i); + capabilities = obj->Package.Elements[2].Integer.Value; + switch (connector_type) { + case 0x08: + case 0x09: + case 0x0a: + if (capabilities & 0xffffffc0) { + fwts_failed(fw, LOG_LEVEL_MEDIUM, "Method_UPCBadReturnType", + "%s %s set reserved bits (%d)", + name, elements[2].name, capabilities); + return; + } + break; + default: + if (capabilities != 0) { + fwts_failed(fw, LOG_LEVEL_MEDIUM, "Method_UPCBadReturnType", + "%s %s returned %d which is incompatible with connector type %d.", + name, elements[2].name, capabilities, connector_type); return; } + break; + } + + if (obj->Package.Elements[3].Integer.Value != 0) { + fwts_failed(fw, LOG_LEVEL_MEDIUM, + "Method_UPCBadReturnType", + "%s element 3 is not zero.", name); + return; } fwts_method_passed_sane(fw, name, "package");