* [PATCH edk2-platforms v2 0/3] Platform/SbsaQemu: use XHCI to replace EHCI
@ 2023-07-07 10:20 Yuquan Wang
2023-07-07 10:20 ` [PATCH edk2-platforms v2 1/3] Platform/Qemu/SbsaQemu/SbsaQemu.dsc: define XHCI Pcd settings Yuquan Wang
` (3 more replies)
0 siblings, 4 replies; 5+ messages in thread
From: Yuquan Wang @ 2023-07-07 10:20 UTC (permalink / raw)
To: devel; +Cc: chenbaozi, Yuquan Wang
This patchset implements XHCI on sbsa-ref board to replace EHCI.
As sbsa-ref does not have DRAM below 4G, it cannot utilize EHCI
that only has 32-bit DMA capablity. Now this board has XHCI as
an available usb controller with 64-bit DMA capablity.
History:
v1 -> v2:
- rebased on master as v1 did not applied
- moved pcd setting in dec file into the first commit
Yuquan Wang (3):
Platform/Qemu/SbsaQemu/SbsaQemu.dsc: define XHCI Pcd settings
SbsaQemu: Drivers: Add initial support for XHCI
SbsaQemu: AcpiTables: Add XHCI info into DSDT
Silicon/Qemu/SbsaQemu/SbsaQemu.dec | 4 +-
Platform/Qemu/SbsaQemu/SbsaQemu.dsc | 6 +-
.../Qemu/SbsaQemu/AcpiTables/AcpiTables.inf | 4 +-
.../SbsaQemuPlatformDxe.inf | 2 +
.../SbsaQemuPlatformDxe/SbsaQemuPlatformDxe.c | 41 ++++--
Silicon/Qemu/SbsaQemu/AcpiTables/Dsdt.asl | 125 ++----------------
6 files changed, 54 insertions(+), 128 deletions(-)
--
2.34.1
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH edk2-platforms v2 1/3] Platform/Qemu/SbsaQemu/SbsaQemu.dsc: define XHCI Pcd settings
2023-07-07 10:20 [PATCH edk2-platforms v2 0/3] Platform/SbsaQemu: use XHCI to replace EHCI Yuquan Wang
@ 2023-07-07 10:20 ` Yuquan Wang
2023-07-07 10:20 ` [PATCH edk2-platforms v2 2/3] SbsaQemu: Drivers: Add initial support for XHCI Yuquan Wang
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: Yuquan Wang @ 2023-07-07 10:20 UTC (permalink / raw)
To: devel; +Cc: chenbaozi, Yuquan Wang
Define the pcd settings for identifying the base address of XHCI
and XHCI's mmio size, and remove relevant EHCI settings.
Signed-off-by: Yuquan Wang <wangyuquan1236@phytium.com.cn>
---
Silicon/Qemu/SbsaQemu/SbsaQemu.dec | 4 ++--
Platform/Qemu/SbsaQemu/SbsaQemu.dsc | 6 +++---
2 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/Silicon/Qemu/SbsaQemu/SbsaQemu.dec b/Silicon/Qemu/SbsaQemu/SbsaQemu.dec
index 5182978cf56d..90776f1007dc 100644
--- a/Silicon/Qemu/SbsaQemu/SbsaQemu.dec
+++ b/Silicon/Qemu/SbsaQemu/SbsaQemu.dec
@@ -32,8 +32,8 @@ [PcdsFixedAtBuild.common]
# Non discoverable devices Pcds
gArmVirtSbsaQemuPlatformTokenSpaceGuid.PcdPlatformAhciBase|0|UINT64|0x00000001
gArmVirtSbsaQemuPlatformTokenSpaceGuid.PcdPlatformAhciSize|0x10000|UINT32|0x00000002
- gArmVirtSbsaQemuPlatformTokenSpaceGuid.PcdPlatformEhciBase|0|UINT64|0x00000003
- gArmVirtSbsaQemuPlatformTokenSpaceGuid.PcdPlatformEhciSize|0x10000|UINT32|0x00000004
+ gArmVirtSbsaQemuPlatformTokenSpaceGuid.PcdPlatformXhciBase|0|UINT64|0x00000003
+ gArmVirtSbsaQemuPlatformTokenSpaceGuid.PcdPlatformXhciSize|0x10000|UINT32|0x00000004
gArmVirtSbsaQemuPlatformTokenSpaceGuid.PcdDeviceTreeBaseAddress|0x10000000000|UINT64|0x00000005
# PCDs complementing PCIe layout pulled into ACPI tables
diff --git a/Platform/Qemu/SbsaQemu/SbsaQemu.dsc b/Platform/Qemu/SbsaQemu/SbsaQemu.dsc
index b88729ad8ad6..dbb08756d10f 100644
--- a/Platform/Qemu/SbsaQemu/SbsaQemu.dsc
+++ b/Platform/Qemu/SbsaQemu/SbsaQemu.dsc
@@ -429,11 +429,11 @@ [PcdsFixedAtBuild.common]
# Initial Device Tree Location
gArmVirtSbsaQemuPlatformTokenSpaceGuid.PcdDeviceTreeBaseAddress|0x10000000000
- # Non discoverable devices (AHCI,EHCI)
+ # Non discoverable devices (AHCI,XHCI)
gArmVirtSbsaQemuPlatformTokenSpaceGuid.PcdPlatformAhciBase|0x60100000
gArmVirtSbsaQemuPlatformTokenSpaceGuid.PcdPlatformAhciSize|0x00010000
- gArmVirtSbsaQemuPlatformTokenSpaceGuid.PcdPlatformEhciBase|0x60110000
- gArmVirtSbsaQemuPlatformTokenSpaceGuid.PcdPlatformEhciSize|0x00010000
+ gArmVirtSbsaQemuPlatformTokenSpaceGuid.PcdPlatformXhciBase|0x60110000
+ gArmVirtSbsaQemuPlatformTokenSpaceGuid.PcdPlatformXhciSize|0x00010000
# PL011 - Serial Terminal
gEfiMdeModulePkgTokenSpaceGuid.PcdSerialRegisterBase|0x60000000
--
2.34.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH edk2-platforms v2 2/3] SbsaQemu: Drivers: Add initial support for XHCI
2023-07-07 10:20 [PATCH edk2-platforms v2 0/3] Platform/SbsaQemu: use XHCI to replace EHCI Yuquan Wang
2023-07-07 10:20 ` [PATCH edk2-platforms v2 1/3] Platform/Qemu/SbsaQemu/SbsaQemu.dsc: define XHCI Pcd settings Yuquan Wang
@ 2023-07-07 10:20 ` Yuquan Wang
2023-07-07 10:20 ` [PATCH edk2-platforms v2 3/3] SbsaQemu: AcpiTables: Add XHCI info into DSDT Yuquan Wang
2023-07-07 16:13 ` [edk2-devel] [PATCH edk2-platforms v2 0/3] Platform/SbsaQemu: use XHCI to replace EHCI Marcin Juszkiewicz
3 siblings, 0 replies; 5+ messages in thread
From: Yuquan Wang @ 2023-07-07 10:20 UTC (permalink / raw)
To: devel; +Cc: chenbaozi, Yuquan Wang
This registers the non-discoverable XHCI for sbsa-ref.
Signed-off-by: Yuquan Wang <wangyuquan1236@phytium.com.cn>
---
.../SbsaQemuPlatformDxe.inf | 2 +
.../SbsaQemuPlatformDxe/SbsaQemuPlatformDxe.c | 41 +++++++++++++++----
2 files changed, 34 insertions(+), 9 deletions(-)
diff --git a/Silicon/Qemu/SbsaQemu/Drivers/SbsaQemuPlatformDxe/SbsaQemuPlatformDxe.inf b/Silicon/Qemu/SbsaQemu/Drivers/SbsaQemuPlatformDxe/SbsaQemuPlatformDxe.inf
index 545794a8c7ff..06700331efea 100644
--- a/Silicon/Qemu/SbsaQemu/Drivers/SbsaQemuPlatformDxe/SbsaQemuPlatformDxe.inf
+++ b/Silicon/Qemu/SbsaQemu/Drivers/SbsaQemuPlatformDxe/SbsaQemuPlatformDxe.inf
@@ -37,6 +37,8 @@ [LibraryClasses]
[Pcd]
gArmVirtSbsaQemuPlatformTokenSpaceGuid.PcdPlatformAhciBase
gArmVirtSbsaQemuPlatformTokenSpaceGuid.PcdPlatformAhciSize
+ gArmVirtSbsaQemuPlatformTokenSpaceGuid.PcdPlatformXhciBase
+ gArmVirtSbsaQemuPlatformTokenSpaceGuid.PcdPlatformXhciSize
gArmVirtSbsaQemuPlatformTokenSpaceGuid.PcdPlatformVersionMajor
gArmVirtSbsaQemuPlatformTokenSpaceGuid.PcdPlatformVersionMinor
diff --git a/Silicon/Qemu/SbsaQemu/Drivers/SbsaQemuPlatformDxe/SbsaQemuPlatformDxe.c b/Silicon/Qemu/SbsaQemu/Drivers/SbsaQemuPlatformDxe/SbsaQemuPlatformDxe.c
index f6a3e84483fe..969c25ae0e17 100644
--- a/Silicon/Qemu/SbsaQemu/Drivers/SbsaQemuPlatformDxe/SbsaQemuPlatformDxe.c
+++ b/Silicon/Qemu/SbsaQemu/Drivers/SbsaQemuPlatformDxe/SbsaQemuPlatformDxe.c
@@ -26,22 +26,23 @@ InitializeSbsaQemuPlatformDxe (
)
{
EFI_STATUS Status;
- UINTN Size;
- VOID* Base;
UINTN Arg0;
UINTN Arg1;
UINTN SmcResult;
RETURN_STATUS Result;
+ UINTN AhciSize, XhciSize;
+ VOID* AhciBase;
+ VOID* XhciBase;
DEBUG ((DEBUG_INFO, "%a: InitializeSbsaQemuPlatformDxe called\n", __FUNCTION__));
- Base = (VOID*)(UINTN)PcdGet64 (PcdPlatformAhciBase);
- ASSERT (Base != NULL);
- Size = (UINTN)PcdGet32 (PcdPlatformAhciSize);
- ASSERT (Size != 0);
+ AhciBase = (VOID*)(UINTN)PcdGet64 (PcdPlatformAhciBase);
+ ASSERT (AhciBase != NULL);
+ AhciSize = (UINTN)PcdGet32 (PcdPlatformAhciSize);
+ ASSERT (AhciSize != 0);
DEBUG ((DEBUG_INFO, "%a: Got platform AHCI %llx %u\n",
- __FUNCTION__, Base, Size));
+ __FUNCTION__, AhciBase, AhciSize));
Status = RegisterNonDiscoverableMmioDevice (
NonDiscoverableDeviceTypeAhci,
@@ -49,11 +50,33 @@ InitializeSbsaQemuPlatformDxe (
NULL,
NULL,
1,
- Base, Size);
+ AhciBase, AhciSize);
if (EFI_ERROR(Status)) {
DEBUG ((DEBUG_ERROR, "%a: NonDiscoverable: Cannot install AHCI device @%p (Staus == %r)\n",
- __FUNCTION__, Base, Status));
+ __FUNCTION__, AhciBase, Status));
+ return Status;
+ }
+
+ XhciBase = (VOID*)(UINTN)PcdGet64 (PcdPlatformXhciBase);
+ ASSERT (XhciBase != NULL);
+ XhciSize = (UINTN)PcdGet32 (PcdPlatformXhciSize);
+ ASSERT (XhciSize != 0);
+
+ DEBUG ((DEBUG_INFO, "%a: Got platform XHCI %llx %u\n",
+ __FUNCTION__, XhciBase, XhciSize));
+
+ Status = RegisterNonDiscoverableMmioDevice (
+ NonDiscoverableDeviceTypeXhci,
+ NonDiscoverableDeviceDmaTypeCoherent,
+ NULL,
+ NULL,
+ 1,
+ XhciBase, XhciSize);
+
+ if (EFI_ERROR(Status)) {
+ DEBUG ((DEBUG_ERROR, "%a: NonDiscoverable: Cannot install XHCI device @%p (Staus == %r)\n",
+ __FUNCTION__, XhciBase, Status));
return Status;
}
--
2.34.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH edk2-platforms v2 3/3] SbsaQemu: AcpiTables: Add XHCI info into DSDT
2023-07-07 10:20 [PATCH edk2-platforms v2 0/3] Platform/SbsaQemu: use XHCI to replace EHCI Yuquan Wang
2023-07-07 10:20 ` [PATCH edk2-platforms v2 1/3] Platform/Qemu/SbsaQemu/SbsaQemu.dsc: define XHCI Pcd settings Yuquan Wang
2023-07-07 10:20 ` [PATCH edk2-platforms v2 2/3] SbsaQemu: Drivers: Add initial support for XHCI Yuquan Wang
@ 2023-07-07 10:20 ` Yuquan Wang
2023-07-07 16:13 ` [edk2-devel] [PATCH edk2-platforms v2 0/3] Platform/SbsaQemu: use XHCI to replace EHCI Marcin Juszkiewicz
3 siblings, 0 replies; 5+ messages in thread
From: Yuquan Wang @ 2023-07-07 10:20 UTC (permalink / raw)
To: devel; +Cc: chenbaozi, Yuquan Wang
As sbsa-ref board uses xhci to replace ehci, the DSDT is updated to match
the platform xhci controller. This also removes previous ehci structure.
Signed-off-by: Yuquan Wang <wangyuquan1236@phytium.com.cn>
---
.../Qemu/SbsaQemu/AcpiTables/AcpiTables.inf | 4 +-
Silicon/Qemu/SbsaQemu/AcpiTables/Dsdt.asl | 125 ++----------------
2 files changed, 15 insertions(+), 114 deletions(-)
diff --git a/Silicon/Qemu/SbsaQemu/AcpiTables/AcpiTables.inf b/Silicon/Qemu/SbsaQemu/AcpiTables/AcpiTables.inf
index 0501c670d565..89afbd9315ae 100644
--- a/Silicon/Qemu/SbsaQemu/AcpiTables/AcpiTables.inf
+++ b/Silicon/Qemu/SbsaQemu/AcpiTables/AcpiTables.inf
@@ -69,8 +69,8 @@ [FixedPcd]
gArmVirtSbsaQemuPlatformTokenSpaceGuid.PcdPlatformAhciBase
gArmVirtSbsaQemuPlatformTokenSpaceGuid.PcdPlatformAhciSize
- gArmVirtSbsaQemuPlatformTokenSpaceGuid.PcdPlatformEhciBase
- gArmVirtSbsaQemuPlatformTokenSpaceGuid.PcdPlatformEhciSize
+ gArmVirtSbsaQemuPlatformTokenSpaceGuid.PcdPlatformXhciBase
+ gArmVirtSbsaQemuPlatformTokenSpaceGuid.PcdPlatformXhciSize
[Pcd]
gArmTokenSpaceGuid.PcdGicDistributorBase
diff --git a/Silicon/Qemu/SbsaQemu/AcpiTables/Dsdt.asl b/Silicon/Qemu/SbsaQemu/AcpiTables/Dsdt.asl
index e50772fcf76d..cc8b99a8fb31 100644
--- a/Silicon/Qemu/SbsaQemu/AcpiTables/Dsdt.asl
+++ b/Silicon/Qemu/SbsaQemu/AcpiTables/Dsdt.asl
@@ -68,120 +68,21 @@ DefinitionBlock ("DsdtTable.aml", "DSDT",
}
}
- // USB EHCI Host Controller
- Device (USB0) {
- Name (_HID, "LNRO0D20")
- Name (_CID, "PNP0D20")
+ // USB XHCI Host Controller
+ Device (XHCI) {
+ Name (_HID, "PNP0D10") // _HID: Hardware ID
+ Name (_UID, 0x00) // _UID: Unique ID
+ Name (_CCA, 0x01) // _CCA: Cache Coherency Attribute
+ Name (_CRS, ResourceTemplate() {
+ Memory32Fixed (ReadWrite,
+ FixedPcdGet32 (PcdPlatformXhciBase),
+ FixedPcdGet32 (PcdPlatformXhciSize))
+ Interrupt (ResourceConsumer, Level, ActiveHigh, Exclusive) { 43 }
+ })
Method (_STA) {
- Return (0xF)
+ Return (0xF)
}
- Method (_CRS, 0x0, Serialized) {
- Name (RBUF, ResourceTemplate() {
- Memory32Fixed (ReadWrite,
- FixedPcdGet32 (PcdPlatformEhciBase),
- FixedPcdGet32 (PcdPlatformEhciSize))
- Interrupt (ResourceConsumer, Level, ActiveHigh, Exclusive) { 43 }
- })
- Return (RBUF)
- }
-
- // Root Hub
- Device (RHUB) {
- Name (_ADR, 0x00000000) // Address of Root Hub should be 0 as per ACPI 5.0 spec
- Method (_STA) {
- Return (0xF)
- }
-
- // Ports connected to Root Hub
- Device (HUB1) {
- Name (_ADR, 0x00000001)
- Name (_UPC, Package() {
- 0x00, // Port is NOT connectable
- 0xFF, // Don't care
- 0x00000000, // Reserved 0 must be zero
- 0x00000000 // Reserved 1 must be zero
- })
- Method (_STA) {
- Return (0xF)
- }
-
- Device (PRT1) {
- Name (_ADR, 0x00000001)
- Name (_UPC, Package() {
- 0xFF, // Port is connectable
- 0x00, // Port connector is A
- 0x00000000,
- 0x00000000
- })
- Name (_PLD, Package() {
- Buffer(0x10) {
- 0x81, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x31, 0x1C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
- }
- })
- Method (_STA) {
- Return (0xF)
- }
- } // USB0_RHUB_HUB1_PRT1
- Device (PRT2) {
- Name (_ADR, 0x00000002)
- Name (_UPC, Package() {
- 0xFF, // Port is connectable
- 0x00, // Port connector is A
- 0x00000000,
- 0x00000000
- })
- Name (_PLD, Package() {
- Buffer(0x10) {
- 0x81, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x31, 0x1C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
- }
- })
- Method (_STA) {
- Return (0xF)
- }
- } // USB0_RHUB_HUB1_PRT2
-
- Device (PRT3) {
- Name (_ADR, 0x00000003)
- Name (_UPC, Package() {
- 0xFF, // Port is connectable
- 0x00, // Port connector is A
- 0x00000000,
- 0x00000000
- })
- Name (_PLD, Package() {
- Buffer (0x10) {
- 0x81, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x31, 0x1C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
- }
- })
- Method (_STA) {
- Return (0xF)
- }
- } // USB0_RHUB_HUB1_PRT3
-
- Device (PRT4) {
- Name (_ADR, 0x00000004)
- Name (_UPC, Package() {
- 0xFF, // Port is connectable
- 0x00, // Port connector is A
- 0x00000000,
- 0x00000000
- })
- Name (_PLD, Package() {
- Buffer (0x10){
- 0x81, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x31, 0x1C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
- }
- })
- Method (_STA) {
- Return (0xF)
- }
- } // USB0_RHUB_HUB1_PRT4
- } // USB0_RHUB_HUB1
- } // USB0_RHUB
- } // USB0
+ }
Device (PCI0)
{
--
2.34.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [edk2-devel] [PATCH edk2-platforms v2 0/3] Platform/SbsaQemu: use XHCI to replace EHCI
2023-07-07 10:20 [PATCH edk2-platforms v2 0/3] Platform/SbsaQemu: use XHCI to replace EHCI Yuquan Wang
` (2 preceding siblings ...)
2023-07-07 10:20 ` [PATCH edk2-platforms v2 3/3] SbsaQemu: AcpiTables: Add XHCI info into DSDT Yuquan Wang
@ 2023-07-07 16:13 ` Marcin Juszkiewicz
3 siblings, 0 replies; 5+ messages in thread
From: Marcin Juszkiewicz @ 2023-07-07 16:13 UTC (permalink / raw)
To: devel, wangyuquan1236
Cc: chenbaozi, Ard Biesheuvel, Leif Lindholm, Graeme Gregory
W dniu 7.07.2023 o 12:20, Yuquan Wang pisze:
> This patchset implements XHCI on sbsa-ref board to replace EHCI.
> As sbsa-ref does not have DRAM below 4G, it cannot utilize EHCI
> that only has 32-bit DMA capablity. Now this board has XHCI as
> an available usb controller with 64-bit DMA capablity.
>
> History:
> v1 -> v2:
> - rebased on master as v1 did not applied
> - moved pcd setting in dec file into the first commit
>
> Yuquan Wang (3):
> Platform/Qemu/SbsaQemu/SbsaQemu.dsc: define XHCI Pcd settings
> SbsaQemu: Drivers: Add initial support for XHCI
> SbsaQemu: AcpiTables: Add XHCI info into DSDT
Adding Ard, Leif and Graeme to Cc.
Tested-by: Marcin Juszkiewicz <marcin.juszkiewicz@linaro.org>
[ 16.813197] xhci-hcd PNP0D10:00: xHCI Host Controller
[ 16.813824] xhci-hcd PNP0D10:00: new USB bus registered, assigned bus number 1
[ 16.816530] xhci-hcd PNP0D10:00: hcc params 0x00087001 hci version 0x100 quirks 0x0000000000010010
[ 16.817242] xhci-hcd PNP0D10:00: irq 19, io mem 0x60110000
[ 16.828589] xhci-hcd PNP0D10:00: xhci_plat_probe get usb3phy fail (ret=-22)
[ 16.828936] xhci-hcd PNP0D10:00: xHCI Host Controller
[ 16.829225] xhci-hcd PNP0D10:00: new USB bus registered, assigned bus number 2
[ 16.829572] xhci-hcd PNP0D10:00: Host supports USB 3.0 SuperSpeed
[ 18.562702] input: QEMU QEMU USB Keyboard as /devices/platform/PNP0D10:00/usb1/1-1/1-1:1.0/0003:0627:0001.0001/input/input0
[ 18.638395] hid-generic 0003:0627:0001.0001: input,hidraw0: USB HID v1.11 Keyboard [QEMU QEMU USB Keyboard] on usb-PNP0D10:00-1/input0
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2023-07-07 16:13 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-07-07 10:20 [PATCH edk2-platforms v2 0/3] Platform/SbsaQemu: use XHCI to replace EHCI Yuquan Wang
2023-07-07 10:20 ` [PATCH edk2-platforms v2 1/3] Platform/Qemu/SbsaQemu/SbsaQemu.dsc: define XHCI Pcd settings Yuquan Wang
2023-07-07 10:20 ` [PATCH edk2-platforms v2 2/3] SbsaQemu: Drivers: Add initial support for XHCI Yuquan Wang
2023-07-07 10:20 ` [PATCH edk2-platforms v2 3/3] SbsaQemu: AcpiTables: Add XHCI info into DSDT Yuquan Wang
2023-07-07 16:13 ` [edk2-devel] [PATCH edk2-platforms v2 0/3] Platform/SbsaQemu: use XHCI to replace EHCI Marcin Juszkiewicz
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox