From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from zg8tmtyylji0my4xnjqumte4.icoremail.net (zg8tmtyylji0my4xnjqumte4.icoremail.net [162.243.164.118]) by mx.groups.io with SMTP id smtpd.web10.6617.1685969313243431833 for ; Mon, 05 Jun 2023 05:48:34 -0700 Authentication-Results: mx.groups.io; dkim=missing; spf=pass (domain: phytium.com.cn, ip: 162.243.164.118, mailfrom: wangyuquan1236@phytium.com.cn) Received: from prodtpl.icoremail.net (unknown [10.12.1.20]) by hzbj-icmmx-6 (Coremail) with SMTP id AQAAfwCXXtSa2n1kocC2AQ--.51093S2; Mon, 05 Jun 2023 20:52:42 +0800 (CST) Received: from phytium.com.cn (unknown [123.150.8.50]) by mail (Coremail) with SMTP id AQAAfwBXgyOI2X1kQagAAA--.994S5; Mon, 05 Jun 2023 20:48:14 +0800 (CST) From: "wangyuquan1236" To: ardb+tianocore@kernel.org, quic_llindhol@quicinc.com Cc: quic_ggregory@quicinc.com, rad@semihalf.com, devel@edk2.groups.io, chenbaozi@phytium.com.cn, marcin.juszkiewicz@linaro.org, peter.maydell@linaro.org, Yuquan Wang Subject: [PATCH v1 2/3] SbsaQemu: Drivers: Add initial support for XHCI Date: Mon, 5 Jun 2023 20:47:25 +0800 Message-Id: <20230605124726.124268-3-wangyuquan1236@phytium.com.cn> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230605124726.124268-1-wangyuquan1236@phytium.com.cn> References: <20230605124726.124268-1-wangyuquan1236@phytium.com.cn> MIME-Version: 1.0 X-CM-TRANSID: AQAAfwBXgyOI2X1kQagAAA--.994S5 X-CM-SenderInfo: 5zdqw5pxtxt0arstlqxsk13x1xpou0fpof0/1tbiAQABAWR84icFhAAAsd Authentication-Results: hzbj-icmmx-6; spf=neutral smtp.mail=wangyuquan 1236@phytium.com.cn; X-Coremail-Antispam: 1Uk129KBjvJXoWxXFW7AF4fGFy8Xw4UGFyDWrg_yoWrCw17pF 10vFZ3Cw1xGryayw43Ga4rXr4YkFyakrWDGrsIqF10kwsxXF1UXw4YqFy8ZF9rJFnxXw4D Ar10y34jyFs5urJanT9S1TB71UUUUU7qnTZGkaVYY2UrUUUUj1kv1TuYvTs0mT0YCTnIWj DUYxn0WfASr-VFAU7a7-sFnT9fnUUIcSsGvfJ3UbIYCTnIWIevJa73UjIFyTuYvj4RJUUU UUUUU Content-Transfer-Encoding: quoted-printable This registers the non-discoverable XHCI for sbsa-ref.=0D =0D Signed-off-by: Yuquan Wang =0D ---=0D .../SbsaQemuPlatformDxe/SbsaQemuPlatformDxe.c | 40 ++++++++++++++-----=0D .../SbsaQemuPlatformDxe.inf | 2 +=0D Silicon/Qemu/SbsaQemu/SbsaQemu.dec | 4 +-=0D 3 files changed, 35 insertions(+), 11 deletions(-)=0D =0D diff --git a/Silicon/Qemu/SbsaQemu/Drivers/SbsaQemuPlatformDxe/SbsaQemuPlat= formDxe.c b/Silicon/Qemu/SbsaQemu/Drivers/SbsaQemuPlatformDxe/SbsaQemuPlatf= ormDxe.c=0D index b7270a07..1a34773f 100644=0D --- a/Silicon/Qemu/SbsaQemu/Drivers/SbsaQemuPlatformDxe/SbsaQemuPlatformDxe= .c=0D +++ b/Silicon/Qemu/SbsaQemu/Drivers/SbsaQemuPlatformDxe/SbsaQemuPlatformDxe= .c=0D @@ -24,18 +24,19 @@ InitializeSbsaQemuPlatformDxe (=0D )=0D {=0D EFI_STATUS Status;=0D - UINTN Size;=0D - VOID* Base;=0D + UINTN AhciSize, XhciSize;=0D + VOID* AhciBase;=0D + VOID* XhciBase;=0D =0D DEBUG ((DEBUG_INFO, "%a: InitializeSbsaQemuPlatformDxe called\n", __FUNC= TION__));=0D =0D - Base =3D (VOID*)(UINTN)PcdGet64 (PcdPlatformAhciBase);=0D - ASSERT (Base !=3D NULL);=0D - Size =3D (UINTN)PcdGet32 (PcdPlatformAhciSize);=0D - ASSERT (Size !=3D 0);=0D + AhciBase =3D (VOID*)(UINTN)PcdGet64 (PcdPlatformAhciBase);=0D + ASSERT (AhciBase !=3D NULL);=0D + AhciSize =3D (UINTN)PcdGet32 (PcdPlatformAhciSize);=0D + ASSERT (AhciSize !=3D 0);=0D =0D DEBUG ((DEBUG_INFO, "%a: Got platform AHCI %llx %u\n",=0D - __FUNCTION__, Base, Size));=0D + __FUNCTION__, AhciBase, AhciSize));=0D =0D Status =3D RegisterNonDiscoverableMmioDevice (=0D NonDiscoverableDeviceTypeAhci,=0D @@ -43,13 +44,34 @@ InitializeSbsaQemuPlatformDxe (=0D NULL,=0D NULL,=0D 1,=0D - Base, Size);=0D + AhciBase, AhciSize);=0D =0D if (EFI_ERROR(Status)) {=0D DEBUG ((DEBUG_ERROR, "%a: NonDiscoverable: Cannot install AHCI device = @%p (Staus =3D=3D %r)\n",=0D - __FUNCTION__, Base, Status));=0D + __FUNCTION__, AhciBase, Status));=0D return Status;=0D }=0D =0D + XhciBase =3D (VOID*)(UINTN)PcdGet64 (PcdPlatformXhciBase);=0D + ASSERT (XhciBase !=3D NULL);=0D + XhciSize =3D (UINTN)PcdGet32 (PcdPlatformXhciSize);=0D + ASSERT (XhciSize !=3D 0);=0D +=0D + DEBUG ((DEBUG_INFO, "%a: Got platform XHCI %llx %u\n",=0D + __FUNCTION__, XhciBase, XhciSize));=0D +=0D + Status =3D RegisterNonDiscoverableMmioDevice (=0D + NonDiscoverableDeviceTypeXhci,=0D + NonDiscoverableDeviceDmaTypeCoherent,=0D + NULL,=0D + NULL,=0D + 1,=0D + XhciBase, XhciSize);=0D +=0D + if (EFI_ERROR(Status)) {=0D + DEBUG ((DEBUG_ERROR, "%a: NonDiscoverable: Cannot install XHCI device = @%p (Staus =3D=3D %r)\n",=0D + __FUNCTION__, XhciBase, Status));=0D + return Status;=0D + }=0D return EFI_SUCCESS;=0D }=0D diff --git a/Silicon/Qemu/SbsaQemu/Drivers/SbsaQemuPlatformDxe/SbsaQemuPlat= formDxe.inf b/Silicon/Qemu/SbsaQemu/Drivers/SbsaQemuPlatformDxe/SbsaQemuPla= tformDxe.inf=0D index 21d2135f..41cdcf16 100644=0D --- a/Silicon/Qemu/SbsaQemu/Drivers/SbsaQemuPlatformDxe/SbsaQemuPlatformDxe= .inf=0D +++ b/Silicon/Qemu/SbsaQemu/Drivers/SbsaQemuPlatformDxe/SbsaQemuPlatformDxe= .inf=0D @@ -35,6 +35,8 @@=0D [Pcd]=0D gArmVirtSbsaQemuPlatformTokenSpaceGuid.PcdPlatformAhciBase=0D gArmVirtSbsaQemuPlatformTokenSpaceGuid.PcdPlatformAhciSize=0D + gArmVirtSbsaQemuPlatformTokenSpaceGuid.PcdPlatformXhciBase=0D + gArmVirtSbsaQemuPlatformTokenSpaceGuid.PcdPlatformXhciSize=0D =0D [Depex]=0D TRUE=0D diff --git a/Silicon/Qemu/SbsaQemu/SbsaQemu.dec b/Silicon/Qemu/SbsaQemu/Sbs= aQemu.dec=0D index 94488529..028c2974 100644=0D --- a/Silicon/Qemu/SbsaQemu/SbsaQemu.dec=0D +++ b/Silicon/Qemu/SbsaQemu/SbsaQemu.dec=0D @@ -32,8 +32,8 @@=0D # Non discoverable devices Pcds=0D gArmVirtSbsaQemuPlatformTokenSpaceGuid.PcdPlatformAhciBase|0|UINT64|0x00= 000001=0D gArmVirtSbsaQemuPlatformTokenSpaceGuid.PcdPlatformAhciSize|0x10000|UINT3= 2|0x00000002=0D - gArmVirtSbsaQemuPlatformTokenSpaceGuid.PcdPlatformEhciBase|0|UINT64|0x00= 000003=0D - gArmVirtSbsaQemuPlatformTokenSpaceGuid.PcdPlatformEhciSize|0x10000|UINT3= 2|0x00000004=0D + gArmVirtSbsaQemuPlatformTokenSpaceGuid.PcdPlatformXhciBase|0|UINT64|0x00= 000003=0D + gArmVirtSbsaQemuPlatformTokenSpaceGuid.PcdPlatformXhciSize|0x10000|UINT3= 2|0x00000004=0D gArmVirtSbsaQemuPlatformTokenSpaceGuid.PcdDeviceTreeBaseAddress|0x100000= 00000|UINT64|0x00000005=0D =0D # PCDs complementing PCIe layout pulled into ACPI tables=0D -- =0D 2.34.1=0D =0D