From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by spool.mail.gandi.net (Postfix) with ESMTPS id 66AFD7803DE for ; Tue, 17 Oct 2023 13:23:29 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=eINFfVWbcfdszS/Xhm4kaT/NuSXR1WUdKPgXkBp4Qqo=; c=relaxed/simple; d=groups.io; h=From:Subject:Date:Message-Id:MIME-Version:To:Cc:Precedence:List-Subscribe:List-Help:Sender:List-Id:Mailing-List:Delivered-To:Reply-To:List-Unsubscribe-Post:List-Unsubscribe:Content-Type:Content-Transfer-Encoding; s=20140610; t=1697549008; v=1; b=l84RmPkIYOLyGBwiOXLRprnXIMpB0GfeSemycvRhkUvTWpT9sJ3+VaFzqcVKiBpYm1qSylVF g+L4PJPKoRJF6M9OkCfM23QuN2A5n2lMR2R+LeylaYm55Z01Xt+sVUPSSNLzWaqorWcKryZc9PH J7Wjiff+h15OEUN4Asm3SUaU= X-Received: by 127.0.0.2 with SMTP id 4tGCYY7687511xFcqoj64mFA; Tue, 17 Oct 2023 06:23:28 -0700 X-Received: from muminek.juszkiewicz.com.pl (muminek.juszkiewicz.com.pl [213.251.184.221]) by mx.groups.io with SMTP id smtpd.web10.214932.1697549007162566214 for ; Tue, 17 Oct 2023 06:23:27 -0700 X-Received: from localhost (localhost [127.0.0.1]) by muminek.juszkiewicz.com.pl (Postfix) with ESMTP id 23205260C04; Tue, 17 Oct 2023 15:23:24 +0200 (CEST) X-Virus-Scanned: Debian amavis at juszkiewicz.com.pl X-Received: from muminek.juszkiewicz.com.pl ([127.0.0.1]) by localhost (muminek.juszkiewicz.com.pl [127.0.0.1]) (amavis, port 10024) with ESMTP id phehenXiS86y; Tue, 17 Oct 2023 15:23:22 +0200 (CEST) X-Received: from [172.17.0.1] (83.11.27.172.ipv4.supernova.orange.pl [83.11.27.172]) by muminek.juszkiewicz.com.pl (Postfix) with ESMTPSA id 45BDE2600DA; Tue, 17 Oct 2023 15:23:21 +0200 (CEST) From: "Marcin Juszkiewicz" Subject: [edk2-devel] [PATCH edk2-platforms v3 0/4] Provide XHCI USB controller only for newer hardware Date: Tue, 17 Oct 2023 15:23:14 +0200 Message-Id: <20231017-ehci-xhci-fix-v3-0-0b9ec9847947@linaro.org> MIME-Version: 1.0 X-B4-Tracking: v=1; b=H4sIAMKKLmUC/3WMQQrCMBBFryKzNpJMTFpdeQ9xEdJJOyCNJBIqp Xc37UoFNx/eh/dmyJSYMpx3MyQqnDmOFfR+B35wY0+Cu8qAErWSSgsaPItpncCT8AZP2ljXuDZ AdR6J6r31rrfKA+dnTK8tX9T6/isVJaQIxgZsqZGk7eXOo0vxEFMPa6rgp25/day6J2/RHI3qX PjSl2V5Axh57TnqAAAA To: devel@edk2.groups.io Cc: Leif Lindholm , Ard Biesheuvel , Jeremy Linton , Nhi Pham , Chuong Tran , Rebecca Cran , Marcin Juszkiewicz Precedence: Bulk List-Subscribe: List-Help: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,marcin.juszkiewicz@linaro.org List-Unsubscribe-Post: List-Unsubscribe=One-Click List-Unsubscribe: X-Gm-Message-State: iJYGzbo2xtobsatPtLsIAQqax7686176AA= Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-GND-Status: LEGIT Authentication-Results: spool.mail.gandi.net; dkim=pass header.d=groups.io header.s=20140610 header.b=l84RmPkI; dmarc=fail reason="SPF not aligned (relaxed), DKIM not aligned (relaxed)" header.from=linaro.org (policy=none); spf=pass (spool.mail.gandi.net: domain of bounce@groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce@groups.io Platform version 0.3 introduced XHCI USB controller instead of EHCI one. But we did it in a way that there is no in-EDK2 check for platform version (XHCI is always given). This behaviour works with Linux as it complains about being unable to initialize EHCI and goes on. Free/Net/Open BSD systems hang in such situation. Now we check are we on Platform Version 0.3 at least and then initialize XHCI controller. Otherwise we disable it's node in DSDT table. I checked several ways to handle the situation.=20 SSDT overlay enabling with LocateAndInstallAcpiFromFvConfitional() was first one but this function had only DBG2 and FACP tables. Then looked at trying to detect XHCI from _STA method. But this is sysbus device which is there or not without way to discover it. Next attempt was to have variable in DSDT and to use it in _STA. Too much trouble. Then looked again at code from Ampere/JadePkg/Drivers/AcpiPlatformDxe/AcpiDsdt.c and noticed UpdateStatusMethodObject() function. Copied some code and it worked. Booting OpenBSD reminded me to update table checksum. Nhi Pham pointed me to AcpiLib/AcpiAmlObjectUpdateInteger() function. So v3 got AML variable (called XHCI) which is set to 0xF (enabled, working) by default or to 0x0 (disabled, ignore) on Platform Version below 0.3 one. This allowed to remove copy of UpdateStatusMethodObject() function. --- Changes in v3: - use AML variable in DSDT Changes in v2: - XHCI initialized only on PlatVer 0.3+ - XHCI disabled in DSDT for older platforms - no SSDT overlays for EHCI/XHCI - no EHCI at all (it does not work anyway) - no Pcd renaming --- Marcin Juszkiewicz (4): SbsaQemu: introduce macro to compare platform version SbsaQemu: add AcpiLib SbsaQemu: initialize XHCI only if it exists SbsaQemu: disable XHCI in DSDT if not present Platform/Qemu/SbsaQemu/SbsaQemu.dsc | 2 + .../Drivers/SbsaQemuAcpiDxe/SbsaQemuAcpiDxe.inf | 4 ++ .../IndustryStandard/SbsaQemuPlatformVersion.h | 25 ++++++++ .../Drivers/SbsaQemuAcpiDxe/SbsaQemuAcpiDxe.c | 60 ++++++++++++++++= ++++ .../SbsaQemuPlatformDxe/SbsaQemuPlatformDxe.c | 47 ++++++++------- Silicon/Qemu/SbsaQemu/AcpiTables/Dsdt.asl | 3 +- 6 files changed, 118 insertions(+), 23 deletions(-) --- base-commit: 06f6274d56422084281886fad447ab117fd0e487 change-id: 20231013-ehci-xhci-fix-c529356a7a8f Best regards, --=20 Marcin Juszkiewicz -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#109681): https://edk2.groups.io/g/devel/message/109681 Mute This Topic: https://groups.io/mt/102017312/7686176 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-