Recent

Author Topic: Does anyone have the idea about Writing XHCI Driver using pascal?  (Read 464 times)

TYDQ

  • Full Member
  • ***
  • Posts: 129
My full repository is on https://github.com/TYDQSoft/UEFIPascalOS.
These days I code an XHCI Driver for my kernel,however,this XHCI Driver(usb.pas) is errorous when I trying to receive the data from my XHCI Driver.
Does anyone have the idea edit this XHCI driver(usb.pas)?If you have any problem about these errorous driver source code,I will solve it within 2 days.
The usb.pas is too large to place in this topic,So I provide github link for you to look up.

WayneSherman

  • Sr. Member
  • ****
  • Posts: 255
Re: Does anyone have the idea about Writing XHCI Driver using pascal?
« Reply #1 on: April 25, 2025, 12:58:19 am »
Did you compare your code to the xHCI spec?  See 4.2 Host Controller Initialization here:

https://www.intel.com/content/www/us/en/content-details/625472/extensible-host-controller-interface-for-universal-serial-bus-xhci-requirements-specification.html

Is the PCIe bus initialized properly?
Are you detecting the xHCI controller on the PCIe bus?

Did you compare your code with some working xHCI drivers?
XHCI driver in Linux:
https://github.com/torvalds/linux/blob/master/drivers/usb/host/xhci-pci.c
https://github.com/torvalds/linux/blob/master/drivers/usb/host/xhci.c
https://github.com/torvalds/linux/tree/master/drivers/usb/host

XHCI driver in Tianocore UEFI firmware:
https://github.com/tianocore/edk2/tree/master/MdeModulePkg/Bus/Pci/XhciDxe

USB XHCI driver tutorial:
https://www.reddit.com/r/osdev/comments/1k3vn9p/xhci_driver_tutorial_series/
https://www.youtube.com/playlist?list=PLATP7rOKo3E82tBnMp90B4zejpWeAKlxn
"Learn how to write a USB xHCI driver from scratch. This series walks through the xHCI specification, explains data structures and register-level interactions, and shows how to build a robust, interrupt-driven USB 3.0 host controller driver step by step."

[EDIT] This repo is for the XHCI tutorial above:
https://github.com/FlareCoding/stellux-xhci-tutorial/tree/setup-0
This one has the full driver from stellux OS:
https://github.com/FlareCoding/StelluxOS/tree/master/kernel/src/drivers/usb/xhci

Also, if you running under UEFI, it looks like that provides a higher level interface for USB:
https://uefi.org/specs/UEFI/2.11/17_Protocols_USB_Support.html
« Last Edit: April 25, 2025, 01:12:35 am by WayneSherman »

TYDQ

  • Full Member
  • ***
  • Posts: 129
Re: Does anyone have the idea about Writing XHCI Driver using pascal?
« Reply #2 on: April 27, 2025, 09:45:38 am »
Did you compare your code to the xHCI spec?  See 4.2 Host Controller Initialization here:

https://www.intel.com/content/www/us/en/content-details/625472/extensible-host-controller-interface-for-universal-serial-bus-xhci-requirements-specification.html

Is the PCIe bus initialized properly?
Are you detecting the xHCI controller on the PCIe bus?

Did you compare your code with some working xHCI drivers?
XHCI driver in Linux:
https://github.com/torvalds/linux/blob/master/drivers/usb/host/xhci-pci.c
https://github.com/torvalds/linux/blob/master/drivers/usb/host/xhci.c
https://github.com/torvalds/linux/tree/master/drivers/usb/host

XHCI driver in Tianocore UEFI firmware:
https://github.com/tianocore/edk2/tree/master/MdeModulePkg/Bus/Pci/XhciDxe

USB XHCI driver tutorial:
https://www.reddit.com/r/osdev/comments/1k3vn9p/xhci_driver_tutorial_series/
https://www.youtube.com/playlist?list=PLATP7rOKo3E82tBnMp90B4zejpWeAKlxn
"Learn how to write a USB xHCI driver from scratch. This series walks through the xHCI specification, explains data structures and register-level interactions, and shows how to build a robust, interrupt-driven USB 3.0 host controller driver step by step."

[EDIT] This repo is for the XHCI tutorial above:
https://github.com/FlareCoding/stellux-xhci-tutorial/tree/setup-0
This one has the full driver from stellux OS:
https://github.com/FlareCoding/StelluxOS/tree/master/kernel/src/drivers/usb/xhci

Also, if you running under UEFI, it looks like that provides a higher level interface for USB:
https://uefi.org/specs/UEFI/2.11/17_Protocols_USB_Support.html
Ok,Thank you for giving me the documentation,I have exitbootservices() and UEFI BootServices does not function.

 

TinyPortal © 2005-2018