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 227B3740039 for ; Wed, 18 Oct 2023 10:08:10 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=3JwHckw2ZzcW3+RftRod3odZPiV4mw7XoN08sW5Id5g=; c=relaxed/simple; d=groups.io; h=From:Date:Subject:MIME-Version:Message-Id:References:In-Reply-To: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=1697623689; v=1; b=NEGUQx5kAJBDB1Mre8RPJvdtqKh1THz+SSDe7RBJVZHlESqDuC/p600Gj0m3P81P4p0hnMbd On0fqETjhSywF6BNElu6VE0JVhHoM/QNblcPtWf6bqPASUaerxQjB98i/mkEycHUTftDyB8yC5H J6dhV2aDNKzcdhKwz+e9d2y8= X-Received: by 127.0.0.2 with SMTP id sx7XYY7687511xvpd7Mx236L; Wed, 18 Oct 2023 03:08:09 -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.278337.1697623688858113447 for ; Wed, 18 Oct 2023 03:08:09 -0700 X-Received: from localhost (localhost [127.0.0.1]) by muminek.juszkiewicz.com.pl (Postfix) with ESMTP id A6A9E260BB4; Wed, 18 Oct 2023 12:08:06 +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 4j9sLZC40xEp; Wed, 18 Oct 2023 12:08:05 +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 BC456260C04; Wed, 18 Oct 2023 12:08:03 +0200 (CEST) From: "Marcin Juszkiewicz" Date: Wed, 18 Oct 2023 12:07:55 +0200 Subject: [edk2-devel] [PATCH edk2-platforms v4 3/4] SbsaQemu: initialize XHCI only if it exists MIME-Version: 1.0 Message-Id: <20231018-ehci-xhci-fix-v4-3-aa53138997a5@linaro.org> References: <20231018-ehci-xhci-fix-v4-0-aa53138997a5@linaro.org> In-Reply-To: <20231018-ehci-xhci-fix-v4-0-aa53138997a5@linaro.org> 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: 2yAQSLLQOwp24qWuErhCSrGHx7686176AA= 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=NEGUQx5k; 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 We need platform version to be at least 0.3 to have XHCI in virtual hardware. On older platforms there is non-working EHCI which we ignore. Signed-off-by: Marcin Juszkiewicz --- .../SbsaQemuPlatformDxe/SbsaQemuPlatformDxe.c | 47 +++++++++++-----= ---- 1 file changed, 25 insertions(+), 22 deletions(-) diff --git a/Silicon/Qemu/SbsaQemu/Drivers/SbsaQemuPlatformDxe/SbsaQemuPlat= formDxe.c b/Silicon/Qemu/SbsaQemu/Drivers/SbsaQemuPlatformDxe/SbsaQemuPlatf= ormDxe.c index 36ada4270bbf..76a9cd62d4a4 100644 --- a/Silicon/Qemu/SbsaQemu/Drivers/SbsaQemuPlatformDxe/SbsaQemuPlatformDxe= .c +++ b/Silicon/Qemu/SbsaQemu/Drivers/SbsaQemuPlatformDxe/SbsaQemuPlatformDxe= .c @@ -15,6 +15,7 @@ #include #include #include +#include =20 #include =20 @@ -57,28 +58,6 @@ InitializeSbsaQemuPlatformDxe ( return Status; } =20 - Base =3D (VOID*)(UINTN)PcdGet64 (PcdPlatformXhciBase); - ASSERT (Base !=3D NULL); - Size =3D (UINTN)PcdGet32 (PcdPlatformXhciSize); - ASSERT (Size !=3D 0); - - DEBUG ((DEBUG_INFO, "%a: Got platform XHCI %llx %u\n", - __FUNCTION__, Base, Size)); - - Status =3D RegisterNonDiscoverableMmioDevice ( - NonDiscoverableDeviceTypeXhci, - NonDiscoverableDeviceDmaTypeCoherent, - NULL, - NULL, - 1, - Base, Size); - - if (EFI_ERROR(Status)) { - DEBUG ((DEBUG_ERROR, "%a: NonDiscoverable: Cannot install XHCI device = @%p (Staus =3D=3D %r)\n", - __FUNCTION__, Base, Status)); - return Status; - } - SmcResult =3D ArmCallSmc0 (SIP_SVC_VERSION, &Arg0, &Arg1, NULL); if (SmcResult =3D=3D SMC_ARCH_CALL_SUCCESS) { Result =3D PcdSet32S (PcdPlatformVersionMajor, Arg0); @@ -118,5 +97,29 @@ InitializeSbsaQemuPlatformDxe ( =20 DEBUG ((DEBUG_INFO, "GICI base: 0x%x\n", Arg0)); =20 + if (! PLATFORM_VERSION_LESS_THAN(0, 3) ) { + Base =3D (VOID*)(UINTN)PcdGet64 (PcdPlatformXhciBase); + ASSERT (Base !=3D NULL); + Size =3D (UINTN)PcdGet32 (PcdPlatformXhciSize); + ASSERT (Size !=3D 0); + + DEBUG ((DEBUG_INFO, "%a: Got platform XHCI %llx %u\n", + __FUNCTION__, Base, Size)); + + Status =3D RegisterNonDiscoverableMmioDevice ( + NonDiscoverableDeviceTypeXhci, + NonDiscoverableDeviceDmaTypeCoherent, + NULL, + NULL, + 1, + Base, Size); + + if (EFI_ERROR(Status)) { + DEBUG ((DEBUG_ERROR, "%a: NonDiscoverable: Cannot install XHCI device = @%p (Staus =3D=3D %r)\n", + __FUNCTION__, Base, Status)); + return Status; + } + } + return EFI_SUCCESS; } --=20 2.41.0 -=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 (#109721): https://edk2.groups.io/g/devel/message/109721 Mute This Topic: https://groups.io/mt/102035952/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-