[edk2-devel] [PATCH edk2-platforms WIP 0/5] Provide EHCI or XHCI USB controller

Marcin Juszkiewicz posted 5 patches 6 months, 3 weeks ago
Failed in applying to current master (apply log)
Silicon/Qemu/SbsaQemu/SbsaQemu.dec                  |   4 +-
Platform/Qemu/SbsaQemu/SbsaQemu.dsc                 |   6 +-
Silicon/Qemu/SbsaQemu/AcpiTables/AcpiTables.inf     |   6 +-
.../Drivers/SbsaQemuAcpiDxe/SbsaQemuAcpiDxe.inf     |   3 +
.../SbsaQemuPlatformDxe/SbsaQemuPlatformDxe.inf     |   4 +-
.../IndustryStandard/SbsaQemuPlatformVersion.h      |  25 ++++
.../Drivers/SbsaQemuAcpiDxe/SbsaQemuAcpiDxe.c       |  62 +++++++++
.../SbsaQemuPlatformDxe/SbsaQemuPlatformDxe.c       |   4 +-
Silicon/Qemu/SbsaQemu/AcpiTables/Dsdt.asl           | 116 -----------------
Silicon/Qemu/SbsaQemu/AcpiTables/Ehci.asl           | 132 ++++++++++++++++++++
Silicon/Qemu/SbsaQemu/AcpiTables/Xhci.asl           | 132 ++++++++++++++++++++
11 files changed, 368 insertions(+), 126 deletions(-)
[edk2-devel] [PATCH edk2-platforms WIP 0/5] Provide EHCI or XHCI USB controller
Posted by Marcin Juszkiewicz 6 months, 3 weeks ago
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.

So two solutions came to my mind:

1. rewrite DSDT generation into C
2. provide EHCI/XHCI in SSDT table instead of DSDT

This changeset is my attempt for the second solution. Idea is to have
both EHCI and XHCI as ASL code and then use
LocateAndInstallAcpiFromFvConfitional() function to choose which one
should be provided (based on PlatformVersion being less than 0.3 for
EHCI).

This does not work as LocateAndInstallAcpiFromFvConfitional() only sees
DBG2 and FACP tables. There was one or two moments when it saw all
generated ones so I assume some kind of race condition.

Any ideas what I did wrong? All patches are work-in-progress.

---
Marcin Juszkiewicz (5):
      SbsaQemu: introduce macro to compare platform version
      WIP: SbsaQemu: rename USB controller variables to be generic
      SbsaQemu: move XHCI to SSDT
      SbsaQemu: add EHCI to SSDT
      WIP: try to enable/disable proper USB controller

 Silicon/Qemu/SbsaQemu/SbsaQemu.dec                  |   4 +-
 Platform/Qemu/SbsaQemu/SbsaQemu.dsc                 |   6 +-
 Silicon/Qemu/SbsaQemu/AcpiTables/AcpiTables.inf     |   6 +-
 .../Drivers/SbsaQemuAcpiDxe/SbsaQemuAcpiDxe.inf     |   3 +
 .../SbsaQemuPlatformDxe/SbsaQemuPlatformDxe.inf     |   4 +-
 .../IndustryStandard/SbsaQemuPlatformVersion.h      |  25 ++++
 .../Drivers/SbsaQemuAcpiDxe/SbsaQemuAcpiDxe.c       |  62 +++++++++
 .../SbsaQemuPlatformDxe/SbsaQemuPlatformDxe.c       |   4 +-
 Silicon/Qemu/SbsaQemu/AcpiTables/Dsdt.asl           | 116 -----------------
 Silicon/Qemu/SbsaQemu/AcpiTables/Ehci.asl           | 132 ++++++++++++++++++++
 Silicon/Qemu/SbsaQemu/AcpiTables/Xhci.asl           | 132 ++++++++++++++++++++
 11 files changed, 368 insertions(+), 126 deletions(-)
---
base-commit: 06f6274d56422084281886fad447ab117fd0e487
change-id: 20231013-ehci-xhci-fix-c529356a7a8f

Best regards,
-- 
Marcin Juszkiewicz <marcin.juszkiewicz@linaro.org>



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#109586): https://edk2.groups.io/g/devel/message/109586
Mute This Topic: https://groups.io/mt/101938735/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-
Re: [edk2-devel] [PATCH edk2-platforms WIP 0/5] Provide EHCI or XHCI USB controller
Posted by Gerd Hoffmann 6 months, 3 weeks ago
  Hi,

> So two solutions came to my mind:
> 
> 1. rewrite DSDT generation into C

You might want have a look at DynamicTablesPkg/ for that


> 2. provide EHCI/XHCI in SSDT table instead of DSDT

Should work, except that I'd suggest to worry about xhci only.
ehci never actually worked anyway, so why advertise it to the OS in the
first place?


3. Add a _STA AML function to the XHCI DSDT description, which is able
to figure whenever XHCI is present.

We had that in qemu years ago, before switching to full DSDT generation,
where the _STA functions checked some bit in PCI config space of the ISA
bridge to figure whenever specific isa devices (floppy, serial/parallel
port) are present or not.


HTH & take care,
  Gerd



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#109592): https://edk2.groups.io/g/devel/message/109592
Mute This Topic: https://groups.io/mt/101938735/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-
Re: [edk2-devel] [PATCH edk2-platforms WIP 0/5] Provide EHCI or XHCI USB controller
Posted by Marcin Juszkiewicz 6 months, 3 weeks ago
W dniu 13.10.2023 o 15:24, Gerd Hoffmann pisze:

>> So two solutions came to my mind:
>>
>> 1. rewrite DSDT generation into C
> 
> You might want have a look at DynamicTablesPkg/ for that

Wasn't is involving using ConfigurationManager? Or maybe I just had 
wrong assumption after reading code.
>> 2. provide EHCI/XHCI in SSDT table instead of DSDT
> 
> Should work, except that I'd suggest to worry about xhci only.
> ehci never actually worked anyway, so why advertise it to the OS in the
> first place?

Good point.

> 3. Add a _STA AML function to the XHCI DSDT description, which is able
> to figure whenever XHCI is present.
> 
> We had that in qemu years ago, before switching to full DSDT generation,
> where the _STA functions checked some bit in PCI config space of the ISA
> bridge to figure whenever specific isa devices (floppy, serial/parallel
> port) are present or not.
Will look.

Thanks.


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#109593): https://edk2.groups.io/g/devel/message/109593
Mute This Topic: https://groups.io/mt/101938735/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-