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 533AD941353 for ; Mon, 16 Oct 2023 10:06:44 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=/UEnck9tqQRTcpo3N6vigr9FIIu8zWFey97VRtcViLI=; 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=1697450802; v=1; b=aWtSeU4CSvTxen+0a31mQGE7KTzhJkxdD/gZYiWZqF591BtfHkhed4q/uXEmjYKINU+V5VD5 dUqg4Ns/sx6TV9v3K7AeUEIpMvSxkElSlehQT44wjuURA2OW3jXBjPHlgmrwZL2UMIkCAdTYb/Q 3VqniA7uOKJ0QUp+w++Tp7Dg= X-Received: by 127.0.0.2 with SMTP id bV6eYY7687511xXveVSkYHj8; Mon, 16 Oct 2023 03:06:42 -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.115205.1697450801928552373 for ; Mon, 16 Oct 2023 03:06:42 -0700 X-Received: from localhost (localhost [127.0.0.1]) by muminek.juszkiewicz.com.pl (Postfix) with ESMTP id D71D2260B30; Mon, 16 Oct 2023 12:06:38 +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 na5LlEY5T2Zl; Mon, 16 Oct 2023 12:06:36 +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 C624F26074C; Mon, 16 Oct 2023 12:06:35 +0200 (CEST) From: "Marcin Juszkiewicz" Subject: [edk2-devel] [PATCH edk2-platforms v2 0/4] Provide XHCI USB controller only for newer hardware Date: Mon, 16 Oct 2023 12:06:26 +0200 Message-Id: <20231016-ehci-xhci-fix-v2-0-cec625451daf@linaro.org> MIME-Version: 1.0 X-B4-Tracking: v=1; b=H4sIACILLWUC/3WMywrDIBBFfyXMuhYfaNKu+h8lC7FjHChaNEhK8 N9rsu/mwjlwzw4FM2GB+7BDxkqFUuwgLwO4YOOCjF6dQXKpBBeKYXDEtmM8bcxpeVPa2NFOHvr nk7Hrs/ecOwcqa8rfM1/FYf+VqmCceW28nHDkqMzjTdHmdE15gbm19gNuffHxqwAAAA== 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: IAeZj9WD9Z8HM2F6XFYs05ihx7686176AA= 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=aWtSeU4C; 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. --- 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 | 93 ++++++++++++++++= ++++ .../SbsaQemuPlatformDxe/SbsaQemuPlatformDxe.c | 47 +++++----- 5 files changed, 149 insertions(+), 22 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 (#109625): https://edk2.groups.io/g/devel/message/109625 Mute This Topic: https://groups.io/mt/101992601/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-