Discussion:
[edk2] XHCI with ARM-v8 based platform
Thomas Jacob
2015-07-06 18:47:37 UTC
Permalink
Hi All,

I am working on bringing up EDK-II on a ARM-v8 based platform. I was
wondering if somebody has already brought up XHCI controllers on such
similar platforms. If so, did you face any problems ?

Regards,
Thomas
Andrew Fish
2015-07-06 21:38:38 UTC
Permalink
Post by Thomas Jacob
Hi All,
I am working on bringing up EDK-II on a ARM-v8 based platform. I was wondering if somebody has already brought up XHCI controllers on such similar platforms. If so, did you face any problems ?
Thomas,

There are two generic problems:
1) Not all ARM systems have PCI, and most existing code assumes PCI (that is how PCs work).
2) Bad DMA implementations. On x86 systems if code Violates the EFI DMA rules in a lot of cases you get lucky and it just works.

DMA Bus Master Read Operation
--------------------------------------------
Call Map() for EfiPciIoOperationBusMasterRead.
Program the DMA Bus Master with the DeviceAddress returned by Map(). Start the DMA Bus Master.
Wait for DMA Bus Master to complete the read operation.
Call Unmap().

DMA Bus Master Write Operation
--------------------------------------------
Call Map() for EfiPciOperationBusMasterWrite.
Program the DMA Bus Master with the DeviceAddress returned by Map().
Start the DMA Bus Master.
Wait for DMA Bus Master to complete the write operation.
Perform a PCI controller specific read transaction to flush all PCI write buffers (See PCI Specification Section 3.2.5.2) .
Call Flush().
Call Unmap().

DMA Bus Master Common Buffer Operation
----------------------------------------------------------
Call AllocateBuffer() to allocate a common buffer.
Call Map() for EfiPciIoOperationBusMasterCommonBuffer.
Program the DMA Bus Master with the DeviceAddress returned by Map().
The common buffer can now be accessed equally by the processor and the DMA bus master.
Call Unmap().
Call FreeBuffer().

Thanks,

Andrew Fish
Post by Thomas Jacob
Regards,
Thomas
------------------------------------------------------------------------------
Don't Limit Your Business. Reach for the Cloud.
GigeNET's Cloud Solutions provide you with the tools and support that
you need to offload your IT needs and focus on growing your business.
Configured For All Businesses. Start Your Cloud Today.
https://www.gigenetcloud.com/_______________________________________________
edk2-devel mailing list
https://lists.sourceforge.net/lists/listinfo/edk2-devel
Tian, Feng
2015-07-06 23:54:48 UTC
Permalink
You can refer to Omap35xxPkg\PciEmulation which produces PCI_IO protocol on arm board and try to build this driver and EDKII xHCI driver in your firmware to see if it works.

DMA issue mentioned by Andrew is the most likely to bring bugs as in most cases IA platforms are 1:1 mapping(identical) for host address and physical address (for example, DCBAAP should be filled with physical address rather than host address. As usually they are 1:1 mapping in IA platforms it will not bring issue even if we wrongly fill this register with host address) but ARM platforms aren't.

EDKII xHCI driver has been enhanced to follow EFI DMA rule, so it should work on arm platforms with a fake PciEmulation driver. If not, it's welcome for your contribution/fix:)

Thanks
Feng

-----Original Message-----
From: Andrew Fish [mailto:***@apple.com]
Sent: Tuesday, July 7, 2015 5:39 AM
To: edk2-***@lists.sourceforge.net
Subject: Re: [edk2] XHCI with ARM-v8 based platform
Post by Thomas Jacob
Hi All,
I am working on bringing up EDK-II on a ARM-v8 based platform. I was wondering if somebody has already brought up XHCI controllers on such similar platforms. If so, did you face any problems ?
Thomas,

There are two generic problems:
1) Not all ARM systems have PCI, and most existing code assumes PCI (that is how PCs work).
2) Bad DMA implementations. On x86 systems if code Violates the EFI DMA rules in a lot of cases you get lucky and it just works.

DMA Bus Master Read Operation
--------------------------------------------
Call Map() for EfiPciIoOperationBusMasterRead.
Program the DMA Bus Master with the DeviceAddress returned by Map(). Start the DMA Bus Master.
Wait for DMA Bus Master to complete the read operation.
Call Unmap().

DMA Bus Master Write Operation
--------------------------------------------
Call Map() for EfiPciOperationBusMasterWrite.
Program the DMA Bus Master with the DeviceAddress returned by Map().
Start the DMA Bus Master.
Wait for DMA Bus Master to complete the write operation.
Perform a PCI controller specific read transaction to flush all PCI write buffers (See PCI Specification Section 3.2.5.2) .
Call Flush().
Call Unmap().

DMA Bus Master Common Buffer Operation
----------------------------------------------------------
Call AllocateBuffer() to allocate a common buffer.
Call Map() for EfiPciIoOperationBusMasterCommonBuffer.
Program the DMA Bus Master with the DeviceAddress returned by Map().
The common buffer can now be accessed equally by the processor and the DMA bus master.
Call Unmap().
Call FreeBuffer().

Thanks,

Andrew Fish
Post by Thomas Jacob
Regards,
Thomas
----------------------------------------------------------------------
-------- Don't Limit Your Business. Reach for the Cloud.
GigeNET's Cloud Solutions provide you with the tools and support that
you need to offload your IT needs and focus on growing your business.
Configured For All Businesses. Start Your Cloud Today.
https://www.gigenetcloud.com/_________________________________________
______
edk2-devel mailing list
https://lists.sourceforge.net/lists/listinfo/edk2-devel
------------------------------------------------------------------------------
Don't Limit Your Business. Reach for the Cloud.
GigeNET's Cloud Solutions provide you with the tools and support that you need to offload your IT needs and focus on growing your business.
Configured For All Businesses. Start Your Cloud Today.
https://www.gigenetcloud.com/
_______________________________________________
edk2-devel mailing list
edk2-***@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/edk2-devel
Andrew Fish
2015-07-07 01:19:25 UTC
Permalink
Post by Tian, Feng
You can refer to Omap35xxPkg\PciEmulation which produces PCI_IO protocol on arm board and try to build this driver and EDKII xHCI driver in your firmware to see if it works.
DMA issue mentioned by Andrew is the most likely to bring bugs as in most cases IA platforms are 1:1 mapping(identical) for host address and physical address (for example, DCBAAP should be filled with physical address rather than host address. As usually they are 1:1 mapping in IA platforms it will not bring issue even if we wrongly fill this register with host address) but ARM platforms aren't.
On ARM it is not just 1:1 mapping, but also cache coherency. You can’t do DMA into catchable memory. So the Map(), Flush(), Unmap(), etc. functions hide the implementation detail from the driver code.

Thanks,

Andrew Fish
Post by Tian, Feng
EDKII xHCI driver has been enhanced to follow EFI DMA rule, so it should work on arm platforms with a fake PciEmulation driver. If not, it's welcome for your contribution/fix:)
Thanks
Feng
-----Original Message-----
Sent: Tuesday, July 7, 2015 5:39 AM
Subject: Re: [edk2] XHCI with ARM-v8 based platform
Post by Thomas Jacob
Hi All,
I am working on bringing up EDK-II on a ARM-v8 based platform. I was wondering if somebody has already brought up XHCI controllers on such similar platforms. If so, did you face any problems ?
Thomas,
1) Not all ARM systems have PCI, and most existing code assumes PCI (that is how PCs work).
2) Bad DMA implementations. On x86 systems if code Violates the EFI DMA rules in a lot of cases you get lucky and it just works.
DMA Bus Master Read Operation
--------------------------------------------
Call Map() for EfiPciIoOperationBusMasterRead.
Program the DMA Bus Master with the DeviceAddress returned by Map(). Start the DMA Bus Master.
Wait for DMA Bus Master to complete the read operation.
Call Unmap().
DMA Bus Master Write Operation
--------------------------------------------
Call Map() for EfiPciOperationBusMasterWrite.
Program the DMA Bus Master with the DeviceAddress returned by Map().
Start the DMA Bus Master.
Wait for DMA Bus Master to complete the write operation.
Perform a PCI controller specific read transaction to flush all PCI write buffers (See PCI Specification Section 3.2.5.2) .
Call Flush().
Call Unmap().
DMA Bus Master Common Buffer Operation
----------------------------------------------------------
Call AllocateBuffer() to allocate a common buffer.
Call Map() for EfiPciIoOperationBusMasterCommonBuffer.
Program the DMA Bus Master with the DeviceAddress returned by Map().
The common buffer can now be accessed equally by the processor and the DMA bus master.
Call Unmap().
Call FreeBuffer().
Thanks,
Andrew Fish
Post by Thomas Jacob
Regards,
Thomas
----------------------------------------------------------------------
-------- Don't Limit Your Business. Reach for the Cloud.
GigeNET's Cloud Solutions provide you with the tools and support that
you need to offload your IT needs and focus on growing your business.
Configured For All Businesses. Start Your Cloud Today.
https://www.gigenetcloud.com/_________________________________________
______
edk2-devel mailing list
https://lists.sourceforge.net/lists/listinfo/edk2-devel
------------------------------------------------------------------------------
Don't Limit Your Business. Reach for the Cloud.
GigeNET's Cloud Solutions provide you with the tools and support that you need to offload your IT needs and focus on growing your business.
Configured For All Businesses. Start Your Cloud Today.
https://www.gigenetcloud.com/
_______________________________________________
edk2-devel mailing list
https://lists.sourceforge.net/lists/listinfo/edk2-devel
------------------------------------------------------------------------------
Don't Limit Your Business. Reach for the Cloud.
GigeNET's Cloud Solutions provide you with the tools and support that
you need to offload your IT needs and focus on growing your business.
Configured For All Businesses. Start Your Cloud Today.
https://www.gigenetcloud.com/
_______________________________________________
edk2-devel mailing list
https://lists.sourceforge.net/lists/listinfo/edk2-devel
Loading...