From patchwork Thu Dec 14 18:42:44 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mario Limonciello X-Patchwork-Id: 1876379 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 4Srjw84VH7z23nt for ; Fri, 15 Dec 2023 07:03:36 +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 1rDrvc-0005pS-Gq; Thu, 14 Dec 2023 20:03:28 +0000 Received: from mail-bn8nam12on2083.outbound.protection.outlook.com ([40.107.237.83] helo=NAM12-BN8-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 1rDrva-0005pA-FI for fwts-devel@lists.ubuntu.com; Thu, 14 Dec 2023 20:03:26 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=oUb4zocdQ2c5H6eLFy36gYAKiwGVPWhMkdE01ay5syNkoC1qPwHh02X0JMkd4dLPQoWGZzaGN6+KUYM37RtJQqch+gt7pYUI1+U6AxddXbjGqlH1j0NBmFo41Oc1Kj2CYc5vHzOuPf8gInrSPX7IRSZVHN8bIPBY8wdA7F3PHYLR72iew07Hv14Cns4T4qSydza58VaqN0E5vUP+97lpVXZaJ3gRNxoKee7rryWZkD80qsWj5srP1E7PpGSrLSe/ozyummuzfAtdL1QEWx0ycwx3FkCaqEqrP/bPThlpq0I45oOJGaVEjDlv/jsYIsGmDryUMDlA31xi3TsPhl8CYQ== 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=qkYTux6ezUkh8Vfh3oeIPUN+uW0bJnOMvXl93a2zi30=; b=Vs1nirVIhaD+GzUoK7hKRWbUhLEsj2k6SY/HHERiT8Lfu/lN0Z4S+ZMxUuyboNbNFfD9YXwmhABy9Au2juQ2JoXBcSXS5hy3eQK31vO6AFdvjEJ3/0P/lgCeVwQupMzd5akuVOEwXscD8p1pKaDGLe8Xpdt6NCjLQ6886Ofcooxl5QC/AoNzTF2Bs5X3KrqRxl4mLXqCEFa6OM1lwIzzhwqayV1CQK65zSMyyR4vLd/VqG23bnusB4fKwntFw2G99JW9Bg58C/xMdam/SDYaotvhfl4NYNlOS4wmV/syZG4tdbb2a5qKHP1B1Aar4O02P4gDjAIMTim5hZw8m9I0Fg== 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 MW4PR03CA0056.namprd03.prod.outlook.com (2603:10b6:303:8e::31) by IA1PR12MB8466.namprd12.prod.outlook.com (2603:10b6:208:44b::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7091.28; Thu, 14 Dec 2023 20:03:23 +0000 Received: from MWH0EPF000989E6.namprd02.prod.outlook.com (2603:10b6:303:8e:cafe::52) by MW4PR03CA0056.outlook.office365.com (2603:10b6:303:8e::31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7091.26 via Frontend Transport; Thu, 14 Dec 2023 20:03:22 +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 MWH0EPF000989E6.mail.protection.outlook.com (10.167.241.133) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7091.26 via Frontend Transport; Thu, 14 Dec 2023 20:03:22 +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; Thu, 14 Dec 2023 14:03:21 -0600 From: Mario Limonciello To: Subject: [PATCH] Add support for ACPI 6.5 _UPC return values Date: Thu, 14 Dec 2023 12:42:44 -0600 Message-ID: <20231214184244.6969-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: MWH0EPF000989E6:EE_|IA1PR12MB8466:EE_ X-MS-Office365-Filtering-Correlation-Id: 39984126-49f0-45f8-2a59-08dbfcdfb97a X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: zIlYEcB76Occosae8LtKP6Nlt3g3UzCOcXEF1oiJamNWSPMEbqKLS9YNlNWme2bXThIsjw286Jh4ppKiPrjlnJb1v3OdNsGyaD8rScVBvBnxz8lEW9J8/u/mbMvYpPForLYgAvUeivzu5aOnKgyZkOCukgrN7O5+tAw22rZutl5ALiW9qdZ46wAOiqL/1zI1ibK4nj/JOWSFru740vd0yV7sW/no++EJm2Sis/HojlcfqLZtmtj6RNJhoU02KvR8IPv3JfAgtlxalAnL5V6uPMNMfD3yqA91y/TKhqf1a50A8/rMihyVDeUfFm8zzO+CZF05SQVUu+AHaZTimDfvmB3XDEVPbd1FkMMS7WhWdW3j1j4ZpYqnF9GsN72vmIna3jByU1ZxJCxydpyU6fRfKEQJ3U89tl1lXQLEvixa7RrpqjIF6XWSQUu/O5O6qy/sWfJwKIXrlM4EyV/rt9CWj4KJ9xY04xRb/jCxWMKiXCaajIxqHjiQjBFOv4QVN6QObQPhKWplLzFECKW6C/p+/UNBIGzeYsVwarlyM0G+q9VSpiQ8cCPYPN16V4BeTy1ADiYOKndeS76VtwElCH7ilyD/Fq5wn6QuAEuic82B/D9Dzc7lHhsDznQ8O5Q6q9MVIBobXiQuMY/VAndYX0/D0K34vhgLKzyIU8nd5XErfzbTB6jNBo5QUTyDUjfoWkEijm/Elg1sN1EO8XFw0GJwpvHLPEnyP2ANZiyEuGfG9lBFSGmkzySw7HsAGoM/RHSn 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)(396003)(136003)(39860400002)(346002)(376002)(230922051799003)(451199024)(64100799003)(186009)(1800799012)(82310400011)(36840700001)(40470700004)(46966006)(86362001)(4326008)(8676002)(8936002)(44832011)(2906002)(5660300002)(41300700001)(36756003)(7696005)(336012)(1076003)(2616005)(26005)(426003)(6666004)(40480700001)(966005)(478600001)(83380400001)(47076005)(36860700001)(16526019)(40460700003)(70586007)(70206006)(81166007)(316002)(6916009)(82740400003)(356005)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Dec 2023 20:03:22.1037 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 39984126-49f0-45f8-2a59-08dbfcdfb97a 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: MWH0EPF000989E6.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: IA1PR12MB8466 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 --- src/acpi/method/method.c | 28 +++++++++++++++++++++++++--- 1 file changed, 25 insertions(+), 3 deletions(-) diff --git a/src/acpi/method/method.c b/src/acpi/method/method.c index 27e2410d..32c8d2d4 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 i, 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,7 +2868,29 @@ static void method_test_UPC_return( return; } - for (i = 2; i < 4; 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; + } + + for (i = 3; i < 4; i++) { if (obj->Package.Elements[i].Integer.Value != 0) { fwts_failed(fw, LOG_LEVEL_MEDIUM, "Method_UPCBadReturnType",