Discussion:
[edk2] Query UEFI : PCIE Driver for Armv8 platform
Leekha Shaveta
2015-05-13 12:08:32 UTC
Permalink
Hi,

I was looking for PCIE driver/Root Bridge implementation for ARMv8 kind of platforms and have referred some code in files:

* ArmPlatformPkg/ArmVirtualizationPkg/PciHostBridgeDxe/PciRootBridgeIo.c

* ArmPlatformPkg/ArmVirtualizationPkg/PciHostBridgeDxe/PciHostBridge.c

But I couldn't see ATU programming code in this implementation, AFAIK ATU programming is required for any outbound and inbound transaction of PCI.
How the IO translation is being done in this?
Also what is the context of "aperture" used in this code?

Kindly help in clearing these doubts.

Regards,
Shaveta
Laszlo Ersek
2015-05-13 13:35:24 UTC
Permalink
On 05/13/15 14:08, Leekha Shaveta wrote:
> Hi,
>
>
>
> I was looking for PCIE driver/Root Bridge implementation for ARMv8 kind
> of platforms and have referred some code in files:
>
> ·
> ArmPlatformPkg/ArmVirtualizationPkg/PciHostBridgeDxe/PciRootBridgeIo.c
>
> ·
> ArmPlatformPkg/ArmVirtualizationPkg/PciHostBridgeDxe/PciHostBridge.c
>
>
>
> But I couldn’t see ATU programming code in this implementation, AFAIK
> ATU programming is required for any outbound and inbound transaction of PCI.
>
> How the IO translation is being done in this?
>
> Also what is the context of “aperture” used in this code?
>
>
>
> Kindly help in clearing these doubts.

"ArmPlatformPkg/ArmVirtualizationPkg/PciHostBridgeDxe" is a port from
the x86-specific "PcAtChipsetPkg/PciHostBridgeDxe". It is not meant to
run on physical hardware -- it is meant to be run in QEMU/KVM virtual
machines, with ARM or AARCH64 guest architecture.

You can find out how the driver was gradually ported by browsing the
commit history of the directory. That history should answer your
questions about "aperture" and "IO translation". Alternatively, the
final version of the patchset is archived at

http://thread.gmane.org/gmane.comp.bios.tianocore.devel/12861

The purpose of the port was to provide the platform independent PCI bus
UEFI driver in MdeModulePkg/Bus/Pci/PciBusDxe/ to enumerate virtual
devices, producing PciIo protocol instances for them. This way various
(virtual and non-virtual) PCI device drivers could be stacked on top of
the corresponding virtual PCI devices, such as:
- OvmfPkg/QemuVideoDxe for VGA
- virtio drivers using the virtio-pci backend
- USB host and device drivers (UhciDxe, EhciDxe, XhciDxe, UsbBusDxe,
UsbKbDxe)

If you are interested in a PCI host bridge driver that runs on physical
AARCH64 platforms, please talk to your vendor; hopefully they'll give
you access to their firmware code. Or, talk to Linaro perhaps.

Here's an example (not sure how fresh it is):

https://github.com/mlangsdorf/linaro-edk2/tree/acpi-share/ArmPlatformPkg/APMXGenePkg/Bus/Pci/PciHostBridgeDxe
https://github.com/mlangsdorf/linaro-edk2/tree/acpi-share/ArmPlatformPkg/APMXGenePkg/Modules/MdeModulePkg/Bus/Pci/PciBusDxe

Thanks
Laszlo
Leekha Shaveta
2015-05-14 04:49:25 UTC
Permalink
Thanks Laszlo!

Going through all these patches and code for reference, will get back to you in case of specific queries.

Thanks and Regards,
Shaveta

-----Original Message-----
From: Laszlo Ersek [mailto:***@redhat.com]
Sent: Wednesday, May 13, 2015 7:05 PM
To: Leekha Shaveta-B20052
Cc: edk2-***@lists.sourceforge.net
Subject: Re: [edk2] Query UEFI : PCIE Driver for Armv8 platform

On 05/13/15 14:08, Leekha Shaveta wrote:
> Hi,
>
>
>
> I was looking for PCIE driver/Root Bridge implementation for ARMv8
> kind of platforms and have referred some code in files:
>
> *
> ArmPlatformPkg/ArmVirtualizationPkg/PciHostBridgeDxe/PciRootBridgeIo.c
>
> *
> ArmPlatformPkg/ArmVirtualizationPkg/PciHostBridgeDxe/PciHostBridge.c
>
>
>
> But I couldn't see ATU programming code in this implementation, AFAIK
> ATU programming is required for any outbound and inbound transaction of PCI.
>
> How the IO translation is being done in this?
>
> Also what is the context of "aperture" used in this code?
>
>
>
> Kindly help in clearing these doubts.

"ArmPlatformPkg/ArmVirtualizationPkg/PciHostBridgeDxe" is a port from the x86-specific "PcAtChipsetPkg/PciHostBridgeDxe". It is not meant to run on physical hardware -- it is meant to be run in QEMU/KVM virtual machines, with ARM or AARCH64 guest architecture.

You can find out how the driver was gradually ported by browsing the commit history of the directory. That history should answer your questions about "aperture" and "IO translation". Alternatively, the final version of the patchset is archived at

http://thread.gmane.org/gmane.comp.bios.tianocore.devel/12861

The purpose of the port was to provide the platform independent PCI bus UEFI driver in MdeModulePkg/Bus/Pci/PciBusDxe/ to enumerate virtual devices, producing PciIo protocol instances for them. This way various (virtual and non-virtual) PCI device drivers could be stacked on top of the corresponding virtual PCI devices, such as:
- OvmfPkg/QemuVideoDxe for VGA
- virtio drivers using the virtio-pci backend
- USB host and device drivers (UhciDxe, EhciDxe, XhciDxe, UsbBusDxe,
UsbKbDxe)

If you are interested in a PCI host bridge driver that runs on physical
AARCH64 platforms, please talk to your vendor; hopefully they'll give you access to their firmware code. Or, talk to Linaro perhaps.

Here's an example (not sure how fresh it is):

https://github.com/mlangsdorf/linaro-edk2/tree/acpi-share/ArmPlatformPkg/APMXGenePkg/Bus/Pci/PciHostBridgeDxe
https://github.com/mlangsdorf/linaro-edk2/tree/acpi-share/ArmPlatformPkg/APMXGenePkg/Modules/MdeModulePkg/Bus/Pci/PciBusDxe

Thanks
Laszlo
Olivier Martin
2015-05-13 14:40:12 UTC
Permalink
Are lucky because I actually pushed the PCI Root Complex source code for ARM Juno development board R1 (Revision 1) yesterday in EDK2.
You should be able to find the code under ArmPlatformPkg/ArmJunoPkg/Drivers/PciHostBridgeDxe
I am guessing what you name 'ATU' is the logic to translate AXI bus <-> PCI bus. As far as I have seen so far, this logic is vendor specific.
You can see this initialization of the translation block for this PCI Root Complex in this file: ArmPlatformPkg/ArmJunoPkg/Drivers/PciHostBridgeDxe/XPressRich3.c

From: Leekha Shaveta [mailto:***@freescale.com]
Sent: 13 May 2015 13:09
To: edk2-***@lists.sourceforge.net
Subject: [edk2] Query UEFI : PCIE Driver for Armv8 platform

Hi,

I was looking for PCIE driver/Root Bridge implementation for ARMv8 kind of platforms and have referred some code in files:

* ArmPlatformPkg/ArmVirtualizationPkg/PciHostBridgeDxe/PciRootBridgeIo.c

* ArmPlatformPkg/ArmVirtualizationPkg/PciHostBridgeDxe/PciHostBridge.c

But I couldn't see ATU programming code in this implementation, AFAIK ATU programming is required for any outbound and inbound transaction of PCI.
How the IO translation is being done in this?
Also what is the context of "aperture" used in this code?

Kindly help in clearing these doubts.

Regards,
Shaveta


-- IMPORTANT NOTICE: The contents of this email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please notify the sender immediately and do not disclose the contents to any other person, use it for any purpose, or store or copy the information in any medium. Thank you.

ARM Limited, Registered office 110 Fulbourn Road, Cambridge CB1 9NJ, Registered in England & Wales, Company No: 2557590
ARM Holdings plc, Registered office 110 Fulbourn Road, Cambridge CB1 9NJ, Registered in England & Wales, Company No: 2548782
Sharma Bhupesh
2015-05-13 14:49:37 UTC
Permalink
Thanks for the pointers, Olivier.

Regards,
Bhupesh

From: Olivier Martin [mailto:***@arm.com]
Sent: Wednesday, May 13, 2015 8:10 PM
To: edk2-***@lists.sourceforge.net
Subject: Re: [edk2] Query UEFI : PCIE Driver for Armv8 platform

Are lucky because I actually pushed the PCI Root Complex source code for ARM Juno development board R1 (Revision 1) yesterday in EDK2.
You should be able to find the code under ArmPlatformPkg/ArmJunoPkg/Drivers/PciHostBridgeDxe
I am guessing what you name 'ATU' is the logic to translate AXI bus <-> PCI bus. As far as I have seen so far, this logic is vendor specific.
You can see this initialization of the translation block for this PCI Root Complex in this file: ArmPlatformPkg/ArmJunoPkg/Drivers/PciHostBridgeDxe/XPressRich3.c

From: Leekha Shaveta [mailto:***@freescale.com]
Sent: 13 May 2015 13:09
To: edk2-***@lists.sourceforge.net<mailto:edk2-***@lists.sourceforge.net>
Subject: [edk2] Query UEFI : PCIE Driver for Armv8 platform

Hi,

I was looking for PCIE driver/Root Bridge implementation for ARMv8 kind of platforms and have referred some code in files:

* ArmPlatformPkg/ArmVirtualizationPkg/PciHostBridgeDxe/PciRootBridgeIo.c

* ArmPlatformPkg/ArmVirtualizationPkg/PciHostBridgeDxe/PciHostBridge.c

But I couldn't see ATU programming code in this implementation, AFAIK ATU programming is required for any outbound and inbound transaction of PCI.
How the IO translation is being done in this?
Also what is the context of "aperture" used in this code?

Kindly help in clearing these doubts.

Regards,
Shaveta


-- IMPORTANT NOTICE: The contents of this email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please notify the sender immediately and do not disclose the contents to any other person, use it for any purpose, or store or copy the information in any medium. Thank you.

ARM Limited, Registered office 110 Fulbourn Road, Cambridge CB1 9NJ, Registered in England & Wales, Company No: 2557590
ARM Holdings plc, Registered office 110 Fulbourn Road, Cambridge CB1 9NJ, Registered in England & Wales, Company No: 2548782
Leekha Shaveta
2015-06-02 07:19:42 UTC
Permalink
Hi,

I am writing a PCI driver(Host Bridge) code for ARM platform with real devices like e1000 NIC card on PCI bus.

I have written a part of PCI Root Complex Initialization code, but have few doubts :

(1) Is all of the following functions have platform specific code, or they can be re-used from any of the PCI code like ARmJunoPkg etc? Are all these functions definitions mendatory?

* PciHbRaNotifyPhase, // ResAlloc.NotifyPhase

* PciHbRaGetNextRootBridge, // ResAlloc.GetNextRootBridge

* PciHbRaGetAllocAttributes, // ResAlloc.GetAllocAttributes

* PciHbRaStartBusEnumeration, // ResAlloc.StartBusEnumeration

* PciHbRaSetBusNumbers, // ResAlloc.SetBusNumbers

* PciHbRaSubmitResources, // ResAlloc.SubmitResources

* PciHbRaGetProposedResources, // ResAlloc.GetProposedResources

* PciHbRaPreprocessController



(2) Should "PCI bus scan for devices" kind of code be written as part of PCI Root Bridge code or it should be re-used from
MdeModulePkg/Bus/Pci/ code as it is?

(3) As I want to write e1000 PCI NIC card driver over it, is there any existing code for the same?

Thanks and Regards,
Shaveta

From: Sharma Bhupesh-B45370
Sent: Wednesday, May 13, 2015 8:20 PM
To: edk2-***@lists.sourceforge.net
Cc: Leekha Shaveta-B20052
Subject: RE: Query UEFI : PCIE Driver for Armv8 platform

Thanks for the pointers, Olivier.

Regards,
Bhupesh

From: Olivier Martin [mailto:***@arm.com]
Sent: Wednesday, May 13, 2015 8:10 PM
To: edk2-***@lists.sourceforge.net<mailto:edk2-***@lists.sourceforge.net>
Subject: Re: [edk2] Query UEFI : PCIE Driver for Armv8 platform

Are lucky because I actually pushed the PCI Root Complex source code for ARM Juno development board R1 (Revision 1) yesterday in EDK2.
You should be able to find the code under ArmPlatformPkg/ArmJunoPkg/Drivers/PciHostBridgeDxe
I am guessing what you name 'ATU' is the logic to translate AXI bus <-> PCI bus. As far as I have seen so far, this logic is vendor specific.
You can see this initialization of the translation block for this PCI Root Complex in this file: ArmPlatformPkg/ArmJunoPkg/Drivers/PciHostBridgeDxe/XPressRich3.c

From: Leekha Shaveta [mailto:***@freescale.com]
Sent: 13 May 2015 13:09
To: edk2-***@lists.sourceforge.net<mailto:edk2-***@lists.sourceforge.net>
Subject: [edk2] Query UEFI : PCIE Driver for Armv8 platform

Hi,

I was looking for PCIE driver/Root Bridge implementation for ARMv8 kind of platforms and have referred some code in files:

* ArmPlatformPkg/ArmVirtualizationPkg/PciHostBridgeDxe/PciRootBridgeIo.c

* ArmPlatformPkg/ArmVirtualizationPkg/PciHostBridgeDxe/PciHostBridge.c

But I couldn't see ATU programming code in this implementation, AFAIK ATU programming is required for any outbound and inbound transaction of PCI.
How the IO translation is being done in this?
Also what is the context of "aperture" used in this code?

Kindly help in clearing these doubts.

Regards,
Shaveta


-- IMPORTANT NOTICE: The contents of this email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please notify the sender immediately and do not disclose the contents to any other person, use it for any purpose, or store or copy the information in any medium. Thank you.

ARM Limited, Registered office 110 Fulbourn Road, Cambridge CB1 9NJ, Registered in England & Wales, Company No: 2557590
ARM Holdings plc, Registered office 110 Fulbourn Road, Cambridge CB1 9NJ, Registered in England & Wales, Company No: 2548782
Cohen, Eugene
2015-06-02 13:49:38 UTC
Permalink
? Is all of the following functions have platform specific code, or they can be re-used from any of the PCI code like ARmJunoPkg etc? Are all these functions definitions mendatory?

You have to implement the host bridge and root bridge protocols. When you implement a protocol you must implement the functions. Some of the functions don't have to do anything (like some of the NotifyPhase case statements).


? Should "PCI bus scan for devices" kind of code be written as part of PCI Root Bridge code or it should be re-used from

? MdeModulePkg/Bus/Pci/ code as it is?

The PCI bus driver already does a scan and enumeration. All you need to do is support the root/host bridge (provide config cycle generation, provide address ranges for mapping into memory spaces, etc).


From: Leekha Shaveta [mailto:***@freescale.com]
Sent: Tuesday, June 02, 2015 1:20 AM
To: edk2-***@lists.sourceforge.net
Cc: ***@arm.com
Subject: Re: [edk2] Query UEFI : PCIE Driver for Armv8 platform

Hi,

I am writing a PCI driver(Host Bridge) code for ARM platform with real devices like e1000 NIC card on PCI bus.

I have written a part of PCI Root Complex Initialization code, but have few doubts :

(1) Is all of the following functions have platform specific code, or they can be re-used from any of the PCI code like ARmJunoPkg etc? Are all these functions definitions mendatory?

* PciHbRaNotifyPhase, // ResAlloc.NotifyPhase

* PciHbRaGetNextRootBridge, // ResAlloc.GetNextRootBridge

* PciHbRaGetAllocAttributes, // ResAlloc.GetAllocAttributes

* PciHbRaStartBusEnumeration, // ResAlloc.StartBusEnumeration

* PciHbRaSetBusNumbers, // ResAlloc.SetBusNumbers

* PciHbRaSubmitResources, // ResAlloc.SubmitResources

* PciHbRaGetProposedResources, // ResAlloc.GetProposedResources

* PciHbRaPreprocessController



(2) Should "PCI bus scan for devices" kind of code be written as part of PCI Root Bridge code or it should be re-used from
MdeModulePkg/Bus/Pci/ code as it is?

(3) As I want to write e1000 PCI NIC card driver over it, is there any existing code for the same?

Thanks and Regards,
Shaveta

From: Sharma Bhupesh-B45370
Sent: Wednesday, May 13, 2015 8:20 PM
To: edk2-***@lists.sourceforge.net<mailto:edk2-***@lists.sourceforge.net>
Cc: Leekha Shaveta-B20052
Subject: RE: Query UEFI : PCIE Driver for Armv8 platform

Thanks for the pointers, Olivier.

Regards,
Bhupesh

From: Olivier Martin [mailto:***@arm.com]
Sent: Wednesday, May 13, 2015 8:10 PM
To: edk2-***@lists.sourceforge.net<mailto:edk2-***@lists.sourceforge.net>
Subject: Re: [edk2] Query UEFI : PCIE Driver for Armv8 platform

Are lucky because I actually pushed the PCI Root Complex source code for ARM Juno development board R1 (Revision 1) yesterday in EDK2.
You should be able to find the code under ArmPlatformPkg/ArmJunoPkg/Drivers/PciHostBridgeDxe
I am guessing what you name 'ATU' is the logic to translate AXI bus <-> PCI bus. As far as I have seen so far, this logic is vendor specific.
You can see this initialization of the translation block for this PCI Root Complex in this file: ArmPlatformPkg/ArmJunoPkg/Drivers/PciHostBridgeDxe/XPressRich3.c

From: Leekha Shaveta [mailto:***@freescale.com]
Sent: 13 May 2015 13:09
To: edk2-***@lists.sourceforge.net<mailto:edk2-***@lists.sourceforge.net>
Subject: [edk2] Query UEFI : PCIE Driver for Armv8 platform

Hi,

I was looking for PCIE driver/Root Bridge implementation for ARMv8 kind of platforms and have referred some code in files:

* ArmPlatformPkg/ArmVirtualizationPkg/PciHostBridgeDxe/PciRootBridgeIo.c

* ArmPlatformPkg/ArmVirtualizationPkg/PciHostBridgeDxe/PciHostBridge.c

But I couldn't see ATU programming code in this implementation, AFAIK ATU programming is required for any outbound and inbound transaction of PCI.
How the IO translation is being done in this?
Also what is the context of "aperture" used in this code?

Kindly help in clearing these doubts.

Regards,
Shaveta


-- IMPORTANT NOTICE: The contents of this email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please notify the sender immediately and do not disclose the contents to any other person, use it for any purpose, or store or copy the information in any medium. Thank you.

ARM Limited, Registered office 110 Fulbourn Road, Cambridge CB1 9NJ, Registered in England & Wales, Company No: 2557590
ARM Holdings plc, Registered office 110 Fulbourn Road, Cambridge CB1 9NJ, Registered in England & Wales, Company No: 2548782
Leekha Shaveta
2015-06-03 03:41:11 UTC
Permalink
Thanks Eugene!

Few more doubts:


(1) What exactly this "case EfiPciHostBridgeAllocateResources" of NotifyPhase does?

(2) In "StartBusEnumeration" function of PCI_HOST_BRIDGE, it
/ Fill an ACPI descriptor table with the Bus Number Range. This information will be used by the PCI Bus driver

// to set bus numbers to PCI-to-PCI bridge.

Is PCI bus implementation is ACPI based only?

(3) The PCI controller i am programming, does iATU (Internal address translation unit) programming for accessing PCI IO, Mem and config space. When this programming should happen? During RootBridge init time?

(4) The RootBridge protocol functions like : PciIoRead/PciIoWrite, PciMemRead/PciMemWrite, PciPciRead/PciPciWrite

They all use MmioRead/MmioWrite internally. Also PCI controller registers are already memory mapped.

So what is the significance of:

"Reading/Writing PCI controller registers in the PCI root bridge I/O space"

"Reading/Writing PCI controller registers in the PCI root bridge Memory space"

"Reading/Writing PCI controller registers in the PCI root bridge Configuration space"


Thanks and Regards,
Shaveta



From: Cohen, Eugene [mailto:***@hp.com]
Sent: Tuesday, June 02, 2015 7:20 PM
To: edk2-***@lists.sourceforge.net
Cc: ***@arm.com
Subject: Re: [edk2] Query UEFI : PCIE Driver for Armv8 platform


? Is all of the following functions have platform specific code, or they can be re-used from any of the PCI code like ARmJunoPkg etc? Are all these functions definitions mendatory?

You have to implement the host bridge and root bridge protocols. When you implement a protocol you must implement the functions. Some of the functions don't have to do anything (like some of the NotifyPhase case statements).


? Should "PCI bus scan for devices" kind of code be written as part of PCI Root Bridge code or it should be re-used from

? MdeModulePkg/Bus/Pci/ code as it is?

The PCI bus driver already does a scan and enumeration. All you need to do is support the root/host bridge (provide config cycle generation, provide address ranges for mapping into memory spaces, etc).


From: Leekha Shaveta [mailto:***@freescale.com]
Sent: Tuesday, June 02, 2015 1:20 AM
To: edk2-***@lists.sourceforge.net<mailto:edk2-***@lists.sourceforge.net>
Cc: ***@arm.com<mailto:***@arm.com>
Subject: Re: [edk2] Query UEFI : PCIE Driver for Armv8 platform

Hi,

I am writing a PCI driver(Host Bridge) code for ARM platform with real devices like e1000 NIC card on PCI bus.

I have written a part of PCI Root Complex Initialization code, but have few doubts :

(1) Is all of the following functions have platform specific code, or they can be re-used from any of the PCI code like ARmJunoPkg etc? Are all these functions definitions mendatory?

* PciHbRaNotifyPhase, // ResAlloc.NotifyPhase

* PciHbRaGetNextRootBridge, // ResAlloc.GetNextRootBridge

* PciHbRaGetAllocAttributes, // ResAlloc.GetAllocAttributes

* PciHbRaStartBusEnumeration, // ResAlloc.StartBusEnumeration

* PciHbRaSetBusNumbers, // ResAlloc.SetBusNumbers

* PciHbRaSubmitResources, // ResAlloc.SubmitResources

* PciHbRaGetProposedResources, // ResAlloc.GetProposedResources

* PciHbRaPreprocessController



(2) Should "PCI bus scan for devices" kind of code be written as part of PCI Root Bridge code or it should be re-used from
MdeModulePkg/Bus/Pci/ code as it is?

(3) As I want to write e1000 PCI NIC card driver over it, is there any existing code for the same?

Thanks and Regards,
Shaveta

From: Sharma Bhupesh-B45370
Sent: Wednesday, May 13, 2015 8:20 PM
To: edk2-***@lists.sourceforge.net<mailto:edk2-***@lists.sourceforge.net>
Cc: Leekha Shaveta-B20052
Subject: RE: Query UEFI : PCIE Driver for Armv8 platform

Thanks for the pointers, Olivier.

Regards,
Bhupesh

From: Olivier Martin [mailto:***@arm.com]
Sent: Wednesday, May 13, 2015 8:10 PM
To: edk2-***@lists.sourceforge.net<mailto:edk2-***@lists.sourceforge.net>
Subject: Re: [edk2] Query UEFI : PCIE Driver for Armv8 platform

Are lucky because I actually pushed the PCI Root Complex source code for ARM Juno development board R1 (Revision 1) yesterday in EDK2.
You should be able to find the code under ArmPlatformPkg/ArmJunoPkg/Drivers/PciHostBridgeDxe
I am guessing what you name 'ATU' is the logic to translate AXI bus <-> PCI bus. As far as I have seen so far, this logic is vendor specific.
You can see this initialization of the translation block for this PCI Root Complex in this file: ArmPlatformPkg/ArmJunoPkg/Drivers/PciHostBridgeDxe/XPressRich3.c

From: Leekha Shaveta [mailto:***@freescale.com]
Sent: 13 May 2015 13:09
To: edk2-***@lists.sourceforge.net<mailto:edk2-***@lists.sourceforge.net>
Subject: [edk2] Query UEFI : PCIE Driver for Armv8 platform

Hi,

I was looking for PCIE driver/Root Bridge implementation for ARMv8 kind of platforms and have referred some code in files:

* ArmPlatformPkg/ArmVirtualizationPkg/PciHostBridgeDxe/PciRootBridgeIo.c

* ArmPlatformPkg/ArmVirtualizationPkg/PciHostBridgeDxe/PciHostBridge.c

But I couldn't see ATU programming code in this implementation, AFAIK ATU programming is required for any outbound and inbound transaction of PCI.
How the IO translation is being done in this?
Also what is the context of "aperture" used in this code?

Kindly help in clearing these doubts.

Regards,
Shaveta


-- IMPORTANT NOTICE: The contents of this email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please notify the sender immediately and do not disclose the contents to any other person, use it for any purpose, or store or copy the information in any medium. Thank you.

ARM Limited, Registered office 110 Fulbourn Road, Cambridge CB1 9NJ, Registered in England & Wales, Company No: 2557590
ARM Holdings plc, Registered office 110 Fulbourn Road, Cambridge CB1 9NJ, Registered in England & Wales, Company No: 2548782
Bill Paul
2015-06-03 04:09:45 UTC
Permalink
Of all the gin joints in all the towns in all the world, Leekha Shaveta had to
walk into mine at 20:41:11 on Tuesday 02 June 2015 and say:

> Thanks Eugene!
>
> Few more doubts:
>
>
> (1) What exactly this "case EfiPciHostBridgeAllocateResources" of
> NotifyPhase does?
>
> (2) In "StartBusEnumeration" function of PCI_HOST_BRIDGE, it
> / Fill an ACPI descriptor table with the Bus Number Range. This information
> will be used by the PCI Bus driver
>
> // to set bus numbers to PCI-to-PCI bridge.
>
> Is PCI bus implementation is ACPI based only?
>
> (3) The PCI controller i am programming, does iATU (Internal address
> translation unit) programming for accessing PCI IO, Mem and config space.
> When this programming should happen? During RootBridge init time?

I think the answer to this question is yes (this is local to the PCIe
controller, so the driver for this controller should initialize it).

> (4) The RootBridge protocol functions like : PciIoRead/PciIoWrite,
> PciMemRead/PciMemWrite, PciPciRead/PciPciWrite
>
> They all use MmioRead/MmioWrite internally.

Maybe for your particular implementation they do, but this is not true for all
PCIe root complexes and/or host bridges.

> Also PCI controller registers
> are already memory mapped.
>
> So what is the significance of:
>
> "Reading/Writing PCI controller registers in the PCI root bridge I/O space"
>
> "Reading/Writing PCI controller registers in the PCI root bridge Memory
> space"

A device on the PCI bus may have both memory mapped and I/O space BARs. On the
Intel x86 architecture, I/O BARs are not memory mapped: I/O space accesses are
performed using special CPU instructions: inb/outb, inw/outw, inl/outl.
(Normally these are privileged instructions which can only be executed in
supervisor mode.) This dates back to the original PC design when you only have
ISA bus devices: when PCI came along, I/O space BARs were implemented by PCI
devices for compatibility reasons. (In theory you could take an existing ISA
bus device and slap a PCI front end on it, and recycle most of your existing
driver code.)

On the PCI bus, I/O space and memory mapped access are implemented with
separate transaction codes. How they translate to the host system is platform-
dependent.

On any platform other than Intel x86 (PPC, ARM, MIPS, SPARC, etc...), both I/O
space BARs and memory mapped BARs are memory mapped. This is probably why
you're questioning why you need two different methods. In your case,
technically speaking, you don't. If it turns out that a device has the same
register layout for both BARs, then you just end up with a second copy (alias)
of the device's registers, which is a bit redundant.

However not all devices work that way. One other limiting factor of the
original PC design was that there was only 64KB total of I/O space (the
inX/outX instructions only accept a 16-bit offset value), so devices usually
had very few registers. This has changed over the years. For example, the
Intel PRO/1000 ethernet MAC can have 256KB or even 512KB of MMIO register
space. This exceeds the total I/O space range available on the x86 platform.
To mitigate this, the I/O space BAR on an Intel PRO/1000 device is just large
enough to provide a set of offset and data "keyhole" registers and you use
them to indirectly access the total available register space.

(As to why you would ever need this, some older PRO/1000 devices had a chip
erratum that could cause the device to trigger a PCI protocol violation if you
used the memory-mapped command register to perform a device reset. The
workaround documented by Intel was to perform the reset using the I/O space
BAR instead of the MMIO BAR.)

Since it is permitted to bridge legacy PCI devices to a PCIe bus, it's usually
a good idea to implement both memory mapped and I/O space BAR support
correctly, otherwise some legacy devices might not be usable. That is, if the
PCIe controller hardware permits. (Apparently the Xilinx Zynq7K PCIe
controller implementation doesn't support I/O space read/write transactions.
I'm not sure if this is an overall defect in the design or if it's a question
of getting the right bitstream file.)

> "Reading/Writing PCI controller registers in the PCI root bridge
> Configuration space"

With the advent of extended configuration space (4KB per device vs. 256 bytes
per device), it's common for PCIe controllers to implement memory-mapped
access mechanisms on the host side. (This is how it works on the Intel x86
platform too.) However some PCIe controllers still use the address/data
"keyhole" register scheme instead.

Long story short: your particular controller may be implementing PCI I/O, MMIO
and config space reads using memory mapped registers, but that's not always
how it works, hence separate methods are provided for each case.

-Bill

>
> Thanks and Regards,
> Shaveta
>
>
>
> From: Cohen, Eugene [mailto:***@hp.com]
> Sent: Tuesday, June 02, 2015 7:20 PM
> To: edk2-***@lists.sourceforge.net
> Cc: ***@arm.com
> Subject: Re: [edk2] Query UEFI : PCIE Driver for Armv8 platform
>
>
> ? Is all of the following functions have platform specific code, or they
> can be re-used from any of the PCI code like ARmJunoPkg etc? Are all these
> functions definitions mendatory?
>
> You have to implement the host bridge and root bridge protocols. When you
> implement a protocol you must implement the functions. Some of the
> functions don't have to do anything (like some of the NotifyPhase case
> statements).
>
>
> ? Should "PCI bus scan for devices" kind of code be written as part of PCI
> Root Bridge code or it should be re-used from
>
> ? MdeModulePkg/Bus/Pci/ code as it is?
>
> The PCI bus driver already does a scan and enumeration. All you need to do
> is support the root/host bridge (provide config cycle generation, provide
> address ranges for mapping into memory spaces, etc).
>
>
> From: Leekha Shaveta [mailto:***@freescale.com]
> Sent: Tuesday, June 02, 2015 1:20 AM
> To:
> edk2-***@lists.sourceforge.net<mailto:edk2-***@lists.sourceforge.net>
> Cc: ***@arm.com<mailto:***@arm.com>
> Subject: Re: [edk2] Query UEFI : PCIE Driver for Armv8 platform
>
> Hi,
>
> I am writing a PCI driver(Host Bridge) code for ARM platform with real
> devices like e1000 NIC card on PCI bus.
>
> I have written a part of PCI Root Complex Initialization code, but have few
> doubts :
>
> (1) Is all of the following functions have platform specific code, or
> they can be re-used from any of the PCI code like ARmJunoPkg etc? Are all
> these functions definitions mendatory?
>
> * PciHbRaNotifyPhase, // ResAlloc.NotifyPhase
>
> * PciHbRaGetNextRootBridge, // ResAlloc.GetNextRootBridge
>
> * PciHbRaGetAllocAttributes, // ResAlloc.GetAllocAttributes
>
> * PciHbRaStartBusEnumeration, // ResAlloc.StartBusEnumeration
>
> * PciHbRaSetBusNumbers, // ResAlloc.SetBusNumbers
>
> * PciHbRaSubmitResources, // ResAlloc.SubmitResources
>
> * PciHbRaGetProposedResources, // ResAlloc.GetProposedResources
>
> * PciHbRaPreprocessController
>
>
>
> (2) Should "PCI bus scan for devices" kind of code be written as part of
> PCI Root Bridge code or it should be re-used from MdeModulePkg/Bus/Pci/
> code as it is?
>
> (3) As I want to write e1000 PCI NIC card driver over it, is there any
> existing code for the same?
>
> Thanks and Regards,
> Shaveta
>
> From: Sharma Bhupesh-B45370
> Sent: Wednesday, May 13, 2015 8:20 PM
> To:
> edk2-***@lists.sourceforge.net<mailto:edk2-***@lists.sourceforge.net>
> Cc: Leekha Shaveta-B20052
> Subject: RE: Query UEFI : PCIE Driver for Armv8 platform
>
> Thanks for the pointers, Olivier.
>
> Regards,
> Bhupesh
>
> From: Olivier Martin [mailto:***@arm.com]
> Sent: Wednesday, May 13, 2015 8:10 PM
> To:
> edk2-***@lists.sourceforge.net<mailto:edk2-***@lists.sourceforge.net>
> Subject: Re: [edk2] Query UEFI : PCIE Driver for Armv8 platform
>
> Are lucky because I actually pushed the PCI Root Complex source code for
> ARM Juno development board R1 (Revision 1) yesterday in EDK2. You should
> be able to find the code under
> ArmPlatformPkg/ArmJunoPkg/Drivers/PciHostBridgeDxe I am guessing what you
> name 'ATU' is the logic to translate AXI bus <-> PCI bus. As far as I have
> seen so far, this logic is vendor specific. You can see this
> initialization of the translation block for this PCI Root Complex in this
> file: ArmPlatformPkg/ArmJunoPkg/Drivers/PciHostBridgeDxe/XPressRich3.c
>
> From: Leekha Shaveta [mailto:***@freescale.com]
> Sent: 13 May 2015 13:09
> To:
> edk2-***@lists.sourceforge.net<mailto:edk2-***@lists.sourceforge.net>
> Subject: [edk2] Query UEFI : PCIE Driver for Armv8 platform
>
> Hi,
>
> I was looking for PCIE driver/Root Bridge implementation for ARMv8 kind of
> platforms and have referred some code in files:
>
> *
> ArmPlatformPkg/ArmVirtualizationPkg/PciHostBridgeDxe/PciRootBridgeIo.c
>
> *
> ArmPlatformPkg/ArmVirtualizationPkg/PciHostBridgeDxe/PciHostBridge.c
>
> But I couldn't see ATU programming code in this implementation, AFAIK ATU
> programming is required for any outbound and inbound transaction of PCI.
> How the IO translation is being done in this?
> Also what is the context of "aperture" used in this code?
>
> Kindly help in clearing these doubts.
>
> Regards,
> Shaveta
>
>
> -- IMPORTANT NOTICE: The contents of this email and any attachments are
> confidential and may also be privileged. If you are not the intended
> recipient, please notify the sender immediately and do not disclose the
> contents to any other person, use it for any purpose, or store or copy the
> information in any medium. Thank you.
>
> ARM Limited, Registered office 110 Fulbourn Road, Cambridge CB1 9NJ,
> Registered in England & Wales, Company No: 2557590 ARM Holdings plc,
> Registered office 110 Fulbourn Road, Cambridge CB1 9NJ, Registered in
> England & Wales, Company No: 2548782

--
=============================================================================
-Bill Paul (510) 749-2329 | Senior Member of Technical Staff,
***@windriver.com | Master of Unix-Fu - Wind River Systems
=============================================================================
"I put a dollar in a change machine. Nothing changed." - George Carlin
=============================================================================

------------------------------------------------------------------------------
Leekha Shaveta
2015-06-04 06:57:07 UTC
Permalink
Thanks Bill for such an elaborated reply !!

Few doubts left:
(1) In "StartBusEnumeration" function of PCI_HOST_BRIDGE, it
// Fill an ACPI descriptor table with the Bus Number Range. This
// information will be used by the PCI Bus driver
// to set bus numbers to PCI-to-PCI bridge.

Is PCI bus implementation is ACPI based only?

(2) I was referring ArmJunoPkg for PCI Host Bridge implementation. And found this ACPI configuration used:

RESOURCE_CONFIGURATION Configuration = {
{{ACPI_ADDRESS_SPACE_DESCRIPTOR, 0x2B, ACPI_ADDRESS_SPACE_TYPE_IO , 0, 0, 0, 0, 0, 0, 0},
{ACPI_ADDRESS_SPACE_DESCRIPTOR, 0x2B, ACPI_ADDRESS_SPACE_TYPE_MEM, 0, 0, 32, 0, 0, 0, 0},
{ACPI_ADDRESS_SPACE_DESCRIPTOR, 0x2B, ACPI_ADDRESS_SPACE_TYPE_MEM, 0, 6, 32, 0, 0, 0, 0},
{ACPI_ADDRESS_SPACE_DESCRIPTOR, 0x2B, ACPI_ADDRESS_SPACE_TYPE_MEM, 0, 0, 64, 0, 0, 0, 0},
{ACPI_ADDRESS_SPACE_DESCRIPTOR, 0x2B, ACPI_ADDRESS_SPACE_TYPE_MEM, 0, 6, 64, 0, 0, 0, 0},
{ACPI_ADDRESS_SPACE_DESCRIPTOR, 0x2B, ACPI_ADDRESS_SPACE_TYPE_BUS, 0, 0, 0, 0, 255, 0, 255}},
{ACPI_END_TAG_DESCRIPTOR, 0}
};

Hi Olivier,
Can you please help in understanding this resource configuration ?
Here you seem to be specifying one IO, 4 Mem and 1 Bus space. Why 6 of them and how do they differ?

(3) What exactly this "case EfiPciHostBridgeAllocateResources" of NotifyPhase does?
Is it allocate resources in sync with the ACPI configuration given?

(4) Is there some PCI NIC card or E1000 driver (PCI device driver) written on top of PCI bus driver, any references?

Thanks and Regards,
Shaveta

-----Original Message-----
From: Bill Paul [mailto:***@windriver.com]
Sent: Wednesday, June 03, 2015 9:40 AM
To: edk2-***@lists.sourceforge.net
Cc: Leekha Shaveta-B20052; ***@arm.com
Subject: Re: [edk2] Query UEFI : PCIE Driver for Armv8 platform

Of all the gin joints in all the towns in all the world, Leekha Shaveta had to walk into mine at 20:41:11 on Tuesday 02 June 2015 and say:

> Thanks Eugene!
>
> Few more doubts:
>
>
> (1) What exactly this "case EfiPciHostBridgeAllocateResources" of
> NotifyPhase does?
>
> (2) In "StartBusEnumeration" function of PCI_HOST_BRIDGE, it
> / Fill an ACPI descriptor table with the Bus Number Range. This
> information will be used by the PCI Bus driver
>
> // to set bus numbers to PCI-to-PCI bridge.
>
> Is PCI bus implementation is ACPI based only?
>
> (3) The PCI controller i am programming, does iATU (Internal address
> translation unit) programming for accessing PCI IO, Mem and config space.
> When this programming should happen? During RootBridge init time?

I think the answer to this question is yes (this is local to the PCIe controller, so the driver for this controller should initialize it).

> (4) The RootBridge protocol functions like : PciIoRead/PciIoWrite,
> PciMemRead/PciMemWrite, PciPciRead/PciPciWrite
>
> They all use MmioRead/MmioWrite internally.

Maybe for your particular implementation they do, but this is not true for all PCIe root complexes and/or host bridges.

> Also PCI controller registers
> are already memory mapped.
>
> So what is the significance of:
>
> "Reading/Writing PCI controller registers in the PCI root bridge I/O space"
>
> "Reading/Writing PCI controller registers in the PCI root bridge
> Memory space"

A device on the PCI bus may have both memory mapped and I/O space BARs. On the Intel x86 architecture, I/O BARs are not memory mapped: I/O space accesses are performed using special CPU instructions: inb/outb, inw/outw, inl/outl.
(Normally these are privileged instructions which can only be executed in supervisor mode.) This dates back to the original PC design when you only have ISA bus devices: when PCI came along, I/O space BARs were implemented by PCI devices for compatibility reasons. (In theory you could take an existing ISA bus device and slap a PCI front end on it, and recycle most of your existing driver code.)

On the PCI bus, I/O space and memory mapped access are implemented with separate transaction codes. How they translate to the host system is platform- dependent.

On any platform other than Intel x86 (PPC, ARM, MIPS, SPARC, etc...), both I/O space BARs and memory mapped BARs are memory mapped. This is probably why you're questioning why you need two different methods. In your case, technically speaking, you don't. If it turns out that a device has the same register layout for both BARs, then you just end up with a second copy (alias) of the device's registers, which is a bit redundant.

However not all devices work that way. One other limiting factor of the original PC design was that there was only 64KB total of I/O space (the inX/outX instructions only accept a 16-bit offset value), so devices usually had very few registers. This has changed over the years. For example, the Intel PRO/1000 ethernet MAC can have 256KB or even 512KB of MMIO register space. This exceeds the total I/O space range available on the x86 platform.
To mitigate this, the I/O space BAR on an Intel PRO/1000 device is just large enough to provide a set of offset and data "keyhole" registers and you use them to indirectly access the total available register space.

(As to why you would ever need this, some older PRO/1000 devices had a chip erratum that could cause the device to trigger a PCI protocol violation if you used the memory-mapped command register to perform a device reset. The workaround documented by Intel was to perform the reset using the I/O space BAR instead of the MMIO BAR.)

Since it is permitted to bridge legacy PCI devices to a PCIe bus, it's usually a good idea to implement both memory mapped and I/O space BAR support correctly, otherwise some legacy devices might not be usable. That is, if the PCIe controller hardware permits. (Apparently the Xilinx Zynq7K PCIe controller implementation doesn't support I/O space read/write transactions.
I'm not sure if this is an overall defect in the design or if it's a question of getting the right bitstream file.)

> "Reading/Writing PCI controller registers in the PCI root bridge
> Configuration space"

With the advent of extended configuration space (4KB per device vs. 256 bytes per device), it's common for PCIe controllers to implement memory-mapped access mechanisms on the host side. (This is how it works on the Intel x86 platform too.) However some PCIe controllers still use the address/data "keyhole" register scheme instead.

Long story short: your particular controller may be implementing PCI I/O, MMIO and config space reads using memory mapped registers, but that's not always how it works, hence separate methods are provided for each case.

-Bill

>
> Thanks and Regards,
> Shaveta
>
>
>
> From: Cohen, Eugene [mailto:***@hp.com]
> Sent: Tuesday, June 02, 2015 7:20 PM
> To: edk2-***@lists.sourceforge.net
> Cc: ***@arm.com
> Subject: Re: [edk2] Query UEFI : PCIE Driver for Armv8 platform
>
>
> ? Is all of the following functions have platform specific code, or
> they can be re-used from any of the PCI code like ARmJunoPkg etc? Are
> all these functions definitions mendatory?
>
> You have to implement the host bridge and root bridge protocols. When
> you implement a protocol you must implement the functions. Some of
> the functions don't have to do anything (like some of the NotifyPhase
> case statements).
>
>
> ? Should "PCI bus scan for devices" kind of code be written as part
> of PCI Root Bridge code or it should be re-used from
>
> ? MdeModulePkg/Bus/Pci/ code as it is?
>
> The PCI bus driver already does a scan and enumeration. All you need
> to do is support the root/host bridge (provide config cycle
> generation, provide address ranges for mapping into memory spaces, etc).
>
>
> From: Leekha Shaveta [mailto:***@freescale.com]
> Sent: Tuesday, June 02, 2015 1:20 AM
> To:
> edk2-***@lists.sourceforge.net<mailto:edk2-***@lists.sourceforge.n
> et>
> Cc: ***@arm.com<mailto:***@arm.com>
> Subject: Re: [edk2] Query UEFI : PCIE Driver for Armv8 platform
>
> Hi,
>
> I am writing a PCI driver(Host Bridge) code for ARM platform with real
> devices like e1000 NIC card on PCI bus.
>
> I have written a part of PCI Root Complex Initialization code, but
> have few doubts :
>
> (1) Is all of the following functions have platform specific code, or
> they can be re-used from any of the PCI code like ARmJunoPkg etc? Are
> all these functions definitions mendatory?
>
> * PciHbRaNotifyPhase, // ResAlloc.NotifyPhase
>
> * PciHbRaGetNextRootBridge, // ResAlloc.GetNextRootBridge
>
> * PciHbRaGetAllocAttributes, // ResAlloc.GetAllocAttributes
>
> * PciHbRaStartBusEnumeration, // ResAlloc.StartBusEnumeration
>
> * PciHbRaSetBusNumbers, // ResAlloc.SetBusNumbers
>
> * PciHbRaSubmitResources, // ResAlloc.SubmitResources
>
> * PciHbRaGetProposedResources, // ResAlloc.GetProposedResources
>
> * PciHbRaPreprocessController
>
>
>
> (2) Should "PCI bus scan for devices" kind of code be written as part of
> PCI Root Bridge code or it should be re-used from
> MdeModulePkg/Bus/Pci/ code as it is?
>
> (3) As I want to write e1000 PCI NIC card driver over it, is there any
> existing code for the same?
>
> Thanks and Regards,
> Shaveta
>
> From: Sharma Bhupesh-B45370
> Sent: Wednesday, May 13, 2015 8:20 PM
> To:
> edk2-***@lists.sourceforge.net<mailto:edk2-***@lists.sourceforge.n
> et>
> Cc: Leekha Shaveta-B20052
> Subject: RE: Query UEFI : PCIE Driver for Armv8 platform
>
> Thanks for the pointers, Olivier.
>
> Regards,
> Bhupesh
>
> From: Olivier Martin [mailto:***@arm.com]
> Sent: Wednesday, May 13, 2015 8:10 PM
> To:
> edk2-***@lists.sourceforge.net<mailto:edk2-***@lists.sourceforge.n
> et>
> Subject: Re: [edk2] Query UEFI : PCIE Driver for Armv8 platform
>
> Are lucky because I actually pushed the PCI Root Complex source code
> for ARM Juno development board R1 (Revision 1) yesterday in EDK2. You
> should be able to find the code under
> ArmPlatformPkg/ArmJunoPkg/Drivers/PciHostBridgeDxe I am guessing what
> you name 'ATU' is the logic to translate AXI bus <-> PCI bus. As far
> as I have seen so far, this logic is vendor specific. You can see this
> initialization of the translation block for this PCI Root Complex in
> this
> file: ArmPlatformPkg/ArmJunoPkg/Drivers/PciHostBridgeDxe/XPressRich3.c
>
> From: Leekha Shaveta [mailto:***@freescale.com]
> Sent: 13 May 2015 13:09
> To:
> edk2-***@lists.sourceforge.net<mailto:edk2-***@lists.sourceforge.n
> et>
> Subject: [edk2] Query UEFI : PCIE Driver for Armv8 platform
>
> Hi,
>
> I was looking for PCIE driver/Root Bridge implementation for ARMv8
> kind of platforms and have referred some code in files:
>
> *
> ArmPlatformPkg/ArmVirtualizationPkg/PciHostBridgeDxe/PciRootBridgeIo.c
>
> *
> ArmPlatformPkg/ArmVirtualizationPkg/PciHostBridgeDxe/PciHostBridge.c
>
> But I couldn't see ATU programming code in this implementation, AFAIK
> ATU programming is required for any outbound and inbound transaction of PCI.
> How the IO translation is being done in this?
> Also what is the context of "aperture" used in this code?
>
> Kindly help in clearing these doubts.
>
> Regards,
> Shaveta
>
>
> -- IMPORTANT NOTICE: The contents of this email and any attachments
> are confidential and may also be privileged. If you are not the
> intended recipient, please notify the sender immediately and do not
> disclose the contents to any other person, use it for any purpose, or
> store or copy the information in any medium. Thank you.
>
> ARM Limited, Registered office 110 Fulbourn Road, Cambridge CB1 9NJ,
> Registered in England & Wales, Company No: 2557590 ARM Holdings plc,
> Registered office 110 Fulbourn Road, Cambridge CB1 9NJ, Registered in
> England & Wales, Company No: 2548782

--
=============================================================================
-Bill Paul (510) 749-2329 | Senior Member of Technical Staff,
***@windriver.com | Master of Unix-Fu - Wind River Systems =============================================================================
"I put a dollar in a change machine. Nothing changed." - George Carlin =============================================================================

------------------------------------------------------------------------------
Andrew Fish
2015-06-04 07:06:35 UTC
Permalink
> On Jun 3, 2015, at 11:57 PM, Leekha Shaveta <***@freescale.com> wrote:
>
> Thanks Bill for such an elaborated reply !!
>
> Few doubts left:
> (1) In "StartBusEnumeration" function of PCI_HOST_BRIDGE, it
> // Fill an ACPI descriptor table with the Bus Number Range. This
> // information will be used by the PCI Bus driver
> // to set bus numbers to PCI-to-PCI bridge.
>
> Is PCI bus implementation is ACPI based only?
>

No while PCI is defined by a specification how a PCI Host Bridge hooks into a system is not defined. Thus the Firmware and the OS have no idea how a PCI Host Bridge works. The Firmware can carry a driver for the host bridge and generally the OS uses ACPI to abstract the PCI Host Bridge hardware and contains drivers that follow the PCI specifications. Given it was likely on a lot of systems that this would be true we decided to use ACPI resource descriptors to abstract the resources, we could have made up something new, but we figured the person writing the PCI Host Bridge driver would also likely have to write the ACPI AML to get the chip working, and would be familiar with this concept. We also figured if the firmware and the OS used the same description technique there would be less chance for error. It also seemed to us that ACPI had already solved this problem (describing resources), so why invent a new way to do it.

Thanks,

Andrew Fish

> (2) I was referring ArmJunoPkg for PCI Host Bridge implementation. And found this ACPI configuration used:
>
> RESOURCE_CONFIGURATION Configuration = {
> {{ACPI_ADDRESS_SPACE_DESCRIPTOR, 0x2B, ACPI_ADDRESS_SPACE_TYPE_IO , 0, 0, 0, 0, 0, 0, 0},
> {ACPI_ADDRESS_SPACE_DESCRIPTOR, 0x2B, ACPI_ADDRESS_SPACE_TYPE_MEM, 0, 0, 32, 0, 0, 0, 0},
> {ACPI_ADDRESS_SPACE_DESCRIPTOR, 0x2B, ACPI_ADDRESS_SPACE_TYPE_MEM, 0, 6, 32, 0, 0, 0, 0},
> {ACPI_ADDRESS_SPACE_DESCRIPTOR, 0x2B, ACPI_ADDRESS_SPACE_TYPE_MEM, 0, 0, 64, 0, 0, 0, 0},
> {ACPI_ADDRESS_SPACE_DESCRIPTOR, 0x2B, ACPI_ADDRESS_SPACE_TYPE_MEM, 0, 6, 64, 0, 0, 0, 0},
> {ACPI_ADDRESS_SPACE_DESCRIPTOR, 0x2B, ACPI_ADDRESS_SPACE_TYPE_BUS, 0, 0, 0, 0, 255, 0, 255}},
> {ACPI_END_TAG_DESCRIPTOR, 0}
> };
>
> Hi Olivier,
> Can you please help in understanding this resource configuration ?
> Here you seem to be specifying one IO, 4 Mem and 1 Bus space. Why 6 of them and how do they differ?
>
> (3) What exactly this "case EfiPciHostBridgeAllocateResources" of NotifyPhase does?
> Is it allocate resources in sync with the ACPI configuration given?
>
> (4) Is there some PCI NIC card or E1000 driver (PCI device driver) written on top of PCI bus driver, any references?
>
> Thanks and Regards,
> Shaveta
>
> -----Original Message-----
> From: Bill Paul [mailto:***@windriver.com]
> Sent: Wednesday, June 03, 2015 9:40 AM
> To: edk2-***@lists.sourceforge.net
> Cc: Leekha Shaveta-B20052; ***@arm.com
> Subject: Re: [edk2] Query UEFI : PCIE Driver for Armv8 platform
>
> Of all the gin joints in all the towns in all the world, Leekha Shaveta had to walk into mine at 20:41:11 on Tuesday 02 June 2015 and say:
>
>> Thanks Eugene!
>>
>> Few more doubts:
>>
>>
>> (1) What exactly this "case EfiPciHostBridgeAllocateResources" of
>> NotifyPhase does?
>>
>> (2) In "StartBusEnumeration" function of PCI_HOST_BRIDGE, it
>> / Fill an ACPI descriptor table with the Bus Number Range. This
>> information will be used by the PCI Bus driver
>>
>> // to set bus numbers to PCI-to-PCI bridge.
>>
>> Is PCI bus implementation is ACPI based only?
>>
>> (3) The PCI controller i am programming, does iATU (Internal address
>> translation unit) programming for accessing PCI IO, Mem and config space.
>> When this programming should happen? During RootBridge init time?
>
> I think the answer to this question is yes (this is local to the PCIe controller, so the driver for this controller should initialize it).
>
>> (4) The RootBridge protocol functions like : PciIoRead/PciIoWrite,
>> PciMemRead/PciMemWrite, PciPciRead/PciPciWrite
>>
>> They all use MmioRead/MmioWrite internally.
>
> Maybe for your particular implementation they do, but this is not true for all PCIe root complexes and/or host bridges.
>
>> Also PCI controller registers
>> are already memory mapped.
>>
>> So what is the significance of:
>>
>> "Reading/Writing PCI controller registers in the PCI root bridge I/O space"
>>
>> "Reading/Writing PCI controller registers in the PCI root bridge
>> Memory space"
>
> A device on the PCI bus may have both memory mapped and I/O space BARs. On the Intel x86 architecture, I/O BARs are not memory mapped: I/O space accesses are performed using special CPU instructions: inb/outb, inw/outw, inl/outl.
> (Normally these are privileged instructions which can only be executed in supervisor mode.) This dates back to the original PC design when you only have ISA bus devices: when PCI came along, I/O space BARs were implemented by PCI devices for compatibility reasons. (In theory you could take an existing ISA bus device and slap a PCI front end on it, and recycle most of your existing driver code.)
>
> On the PCI bus, I/O space and memory mapped access are implemented with separate transaction codes. How they translate to the host system is platform- dependent.
>
> On any platform other than Intel x86 (PPC, ARM, MIPS, SPARC, etc...), both I/O space BARs and memory mapped BARs are memory mapped. This is probably why you're questioning why you need two different methods. In your case, technically speaking, you don't. If it turns out that a device has the same register layout for both BARs, then you just end up with a second copy (alias) of the device's registers, which is a bit redundant.
>
> However not all devices work that way. One other limiting factor of the original PC design was that there was only 64KB total of I/O space (the inX/outX instructions only accept a 16-bit offset value), so devices usually had very few registers. This has changed over the years. For example, the Intel PRO/1000 ethernet MAC can have 256KB or even 512KB of MMIO register space. This exceeds the total I/O space range available on the x86 platform.
> To mitigate this, the I/O space BAR on an Intel PRO/1000 device is just large enough to provide a set of offset and data "keyhole" registers and you use them to indirectly access the total available register space.
>
> (As to why you would ever need this, some older PRO/1000 devices had a chip erratum that could cause the device to trigger a PCI protocol violation if you used the memory-mapped command register to perform a device reset. The workaround documented by Intel was to perform the reset using the I/O space BAR instead of the MMIO BAR.)
>
> Since it is permitted to bridge legacy PCI devices to a PCIe bus, it's usually a good idea to implement both memory mapped and I/O space BAR support correctly, otherwise some legacy devices might not be usable. That is, if the PCIe controller hardware permits. (Apparently the Xilinx Zynq7K PCIe controller implementation doesn't support I/O space read/write transactions.
> I'm not sure if this is an overall defect in the design or if it's a question of getting the right bitstream file.)
>
>> "Reading/Writing PCI controller registers in the PCI root bridge
>> Configuration space"
>
> With the advent of extended configuration space (4KB per device vs. 256 bytes per device), it's common for PCIe controllers to implement memory-mapped access mechanisms on the host side. (This is how it works on the Intel x86 platform too.) However some PCIe controllers still use the address/data "keyhole" register scheme instead.
>
> Long story short: your particular controller may be implementing PCI I/O, MMIO and config space reads using memory mapped registers, but that's not always how it works, hence separate methods are provided for each case.
>
> -Bill
>
>>
>> Thanks and Regards,
>> Shaveta
>>
>>
>>
>> From: Cohen, Eugene [mailto:***@hp.com]
>> Sent: Tuesday, June 02, 2015 7:20 PM
>> To: edk2-***@lists.sourceforge.net
>> Cc: ***@arm.com
>> Subject: Re: [edk2] Query UEFI : PCIE Driver for Armv8 platform
>>
>>
>> ? Is all of the following functions have platform specific code, or
>> they can be re-used from any of the PCI code like ARmJunoPkg etc? Are
>> all these functions definitions mendatory?
>>
>> You have to implement the host bridge and root bridge protocols. When
>> you implement a protocol you must implement the functions. Some of
>> the functions don't have to do anything (like some of the NotifyPhase
>> case statements).
>>
>>
>> ? Should "PCI bus scan for devices" kind of code be written as part
>> of PCI Root Bridge code or it should be re-used from
>>
>> ? MdeModulePkg/Bus/Pci/ code as it is?
>>
>> The PCI bus driver already does a scan and enumeration. All you need
>> to do is support the root/host bridge (provide config cycle
>> generation, provide address ranges for mapping into memory spaces, etc).
>>
>>
>> From: Leekha Shaveta [mailto:***@freescale.com]
>> Sent: Tuesday, June 02, 2015 1:20 AM
>> To:
>> edk2-***@lists.sourceforge.net<mailto:edk2-***@lists.sourceforge.n
>> et>
>> Cc: ***@arm.com<mailto:***@arm.com>
>> Subject: Re: [edk2] Query UEFI : PCIE Driver for Armv8 platform
>>
>> Hi,
>>
>> I am writing a PCI driver(Host Bridge) code for ARM platform with real
>> devices like e1000 NIC card on PCI bus.
>>
>> I have written a part of PCI Root Complex Initialization code, but
>> have few doubts :
>>
>> (1) Is all of the following functions have platform specific code, or
>> they can be re-used from any of the PCI code like ARmJunoPkg etc? Are
>> all these functions definitions mendatory?
>>
>> * PciHbRaNotifyPhase, // ResAlloc.NotifyPhase
>>
>> * PciHbRaGetNextRootBridge, // ResAlloc.GetNextRootBridge
>>
>> * PciHbRaGetAllocAttributes, // ResAlloc.GetAllocAttributes
>>
>> * PciHbRaStartBusEnumeration, // ResAlloc.StartBusEnumeration
>>
>> * PciHbRaSetBusNumbers, // ResAlloc.SetBusNumbers
>>
>> * PciHbRaSubmitResources, // ResAlloc.SubmitResources
>>
>> * PciHbRaGetProposedResources, // ResAlloc.GetProposedResources
>>
>> * PciHbRaPreprocessController
>>
>>
>>
>> (2) Should "PCI bus scan for devices" kind of code be written as part of
>> PCI Root Bridge code or it should be re-used from
>> MdeModulePkg/Bus/Pci/ code as it is?
>>
>> (3) As I want to write e1000 PCI NIC card driver over it, is there any
>> existing code for the same?
>>
>> Thanks and Regards,
>> Shaveta
>>
>> From: Sharma Bhupesh-B45370
>> Sent: Wednesday, May 13, 2015 8:20 PM
>> To:
>> edk2-***@lists.sourceforge.net<mailto:edk2-***@lists.sourceforge.n
>> et>
>> Cc: Leekha Shaveta-B20052
>> Subject: RE: Query UEFI : PCIE Driver for Armv8 platform
>>
>> Thanks for the pointers, Olivier.
>>
>> Regards,
>> Bhupesh
>>
>> From: Olivier Martin [mailto:***@arm.com]
>> Sent: Wednesday, May 13, 2015 8:10 PM
>> To:
>> edk2-***@lists.sourceforge.net<mailto:edk2-***@lists.sourceforge.n
>> et>
>> Subject: Re: [edk2] Query UEFI : PCIE Driver for Armv8 platform
>>
>> Are lucky because I actually pushed the PCI Root Complex source code
>> for ARM Juno development board R1 (Revision 1) yesterday in EDK2. You
>> should be able to find the code under
>> ArmPlatformPkg/ArmJunoPkg/Drivers/PciHostBridgeDxe I am guessing what
>> you name 'ATU' is the logic to translate AXI bus <-> PCI bus. As far
>> as I have seen so far, this logic is vendor specific. You can see this
>> initialization of the translation block for this PCI Root Complex in
>> this
>> file: ArmPlatformPkg/ArmJunoPkg/Drivers/PciHostBridgeDxe/XPressRich3.c
>>
>> From: Leekha Shaveta [mailto:***@freescale.com]
>> Sent: 13 May 2015 13:09
>> To:
>> edk2-***@lists.sourceforge.net<mailto:edk2-***@lists.sourceforge.n
>> et>
>> Subject: [edk2] Query UEFI : PCIE Driver for Armv8 platform
>>
>> Hi,
>>
>> I was looking for PCIE driver/Root Bridge implementation for ARMv8
>> kind of platforms and have referred some code in files:
>>
>> *
>> ArmPlatformPkg/ArmVirtualizationPkg/PciHostBridgeDxe/PciRootBridgeIo.c
>>
>> *
>> ArmPlatformPkg/ArmVirtualizationPkg/PciHostBridgeDxe/PciHostBridge.c
>>
>> But I couldn't see ATU programming code in this implementation, AFAIK
>> ATU programming is required for any outbound and inbound transaction of PCI.
>> How the IO translation is being done in this?
>> Also what is the context of "aperture" used in this code?
>>
>> Kindly help in clearing these doubts.
>>
>> Regards,
>> Shaveta
>>
>>
>> -- IMPORTANT NOTICE: The contents of this email and any attachments
>> are confidential and may also be privileged. If you are not the
>> intended recipient, please notify the sender immediately and do not
>> disclose the contents to any other person, use it for any purpose, or
>> store or copy the information in any medium. Thank you.
>>
>> ARM Limited, Registered office 110 Fulbourn Road, Cambridge CB1 9NJ,
>> Registered in England & Wales, Company No: 2557590 ARM Holdings plc,
>> Registered office 110 Fulbourn Road, Cambridge CB1 9NJ, Registered in
>> England & Wales, Company No: 2548782
>
> --
> =============================================================================
> -Bill Paul (510) 749-2329 | Senior Member of Technical Staff,
> ***@windriver.com | Master of Unix-Fu - Wind River Systems =============================================================================
> "I put a dollar in a change machine. Nothing changed." - George Carlin =============================================================================
>
> ------------------------------------------------------------------------------
> _______________________________________________
> edk2-devel mailing list
> edk2-***@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/edk2-devel


------------------------------------------------------------------------------
Leekha Shaveta
2015-06-05 11:23:35 UTC
Permalink
Thanks Andrew!

Few more Doubts :
How ACPI is defining PCI resources?
What are these PCI resources and their functions? Are these resources are like some regions in "PCI Express space" ?

As I was referring ArmJunoPkg for PCI Host Bridge implementation. And found this ACPI configuration used:
>
> RESOURCE_CONFIGURATION Configuration = {
> {{ACPI_ADDRESS_SPACE_DESCRIPTOR, 0x2B, ACPI_ADDRESS_SPACE_TYPE_IO , 0, 0, 0, 0, 0, 0, 0},
> {ACPI_ADDRESS_SPACE_DESCRIPTOR, 0x2B, ACPI_ADDRESS_SPACE_TYPE_MEM, 0, 0, 32, 0, 0, 0, 0},
> {ACPI_ADDRESS_SPACE_DESCRIPTOR, 0x2B, ACPI_ADDRESS_SPACE_TYPE_MEM, 0, 6, 32, 0, 0, 0, 0},
> {ACPI_ADDRESS_SPACE_DESCRIPTOR, 0x2B, ACPI_ADDRESS_SPACE_TYPE_MEM, 0, 0, 64, 0, 0, 0, 0},
> {ACPI_ADDRESS_SPACE_DESCRIPTOR, 0x2B, ACPI_ADDRESS_SPACE_TYPE_MEM, 0, 6, 64, 0, 0, 0, 0},
> {ACPI_ADDRESS_SPACE_DESCRIPTOR, 0x2B, ACPI_ADDRESS_SPACE_TYPE_BUS, 0, 0, 0, 0, 255, 0, 255}},
> {ACPI_END_TAG_DESCRIPTOR, 0}
> };
>
> Hi Olivier,
> Can you please help in understanding this resource configuration ?
> Here you seem to be specifying one IO, 4 Mem and 1 Bus space. Why 6 of them and how do they differ?

On which basis 6 resources are given here?

Thanks and Regards,
Shaveta


-----Original Message-----
From: Andrew Fish [mailto:***@apple.com]
Sent: Thursday, June 04, 2015 12:37 PM
To: edk2-***@lists.sourceforge.net
Cc: ***@arm.com
Subject: Re: [edk2] Query UEFI : PCIE Driver for Armv8 platform


> On Jun 3, 2015, at 11:57 PM, Leekha Shaveta <***@freescale.com> wrote:
>
> Thanks Bill for such an elaborated reply !!
>
> Few doubts left:
> (1) In "StartBusEnumeration" function of PCI_HOST_BRIDGE, it
> // Fill an ACPI descriptor table with the Bus Number Range. This
> // information will be used by the PCI Bus driver
> // to set bus numbers to PCI-to-PCI bridge.
>
> Is PCI bus implementation is ACPI based only?
>

No while PCI is defined by a specification how a PCI Host Bridge hooks into a system is not defined. Thus the Firmware and the OS have no idea how a PCI Host Bridge works. The Firmware can carry a driver for the host bridge and generally the OS uses ACPI to abstract the PCI Host Bridge hardware and contains drivers that follow the PCI specifications. Given it was likely on a lot of systems that this would be true we decided to use ACPI resource descriptors to abstract the resources, we could have made up something new, but we figured the person writing the PCI Host Bridge driver would also likely have to write the ACPI AML to get the chip working, and would be familiar with this concept. We also figured if the firmware and the OS used the same description technique there would be less chance for error. It also seemed to us that ACPI had already solved this problem (describing resources), so why invent a new way to do it.

Thanks,

Andrew Fish

> (2) I was referring ArmJunoPkg for PCI Host Bridge implementation. And found this ACPI configuration used:
>
> RESOURCE_CONFIGURATION Configuration = {
> {{ACPI_ADDRESS_SPACE_DESCRIPTOR, 0x2B, ACPI_ADDRESS_SPACE_TYPE_IO , 0, 0, 0, 0, 0, 0, 0},
> {ACPI_ADDRESS_SPACE_DESCRIPTOR, 0x2B, ACPI_ADDRESS_SPACE_TYPE_MEM, 0, 0, 32, 0, 0, 0, 0},
> {ACPI_ADDRESS_SPACE_DESCRIPTOR, 0x2B, ACPI_ADDRESS_SPACE_TYPE_MEM, 0, 6, 32, 0, 0, 0, 0},
> {ACPI_ADDRESS_SPACE_DESCRIPTOR, 0x2B, ACPI_ADDRESS_SPACE_TYPE_MEM, 0, 0, 64, 0, 0, 0, 0},
> {ACPI_ADDRESS_SPACE_DESCRIPTOR, 0x2B, ACPI_ADDRESS_SPACE_TYPE_MEM, 0, 6, 64, 0, 0, 0, 0},
> {ACPI_ADDRESS_SPACE_DESCRIPTOR, 0x2B, ACPI_ADDRESS_SPACE_TYPE_BUS, 0, 0, 0, 0, 255, 0, 255}},
> {ACPI_END_TAG_DESCRIPTOR, 0}
> };
>
> Hi Olivier,
> Can you please help in understanding this resource configuration ?
> Here you seem to be specifying one IO, 4 Mem and 1 Bus space. Why 6 of them and how do they differ?
>
> (3) What exactly this "case EfiPciHostBridgeAllocateResources" of NotifyPhase does?
> Is it allocate resources in sync with the ACPI configuration given?
>
> (4) Is there some PCI NIC card or E1000 driver (PCI device driver) written on top of PCI bus driver, any references?
>
> Thanks and Regards,
> Shaveta
>
> -----Original Message-----
> From: Bill Paul [mailto:***@windriver.com]
> Sent: Wednesday, June 03, 2015 9:40 AM
> To: edk2-***@lists.sourceforge.net
> Cc: Leekha Shaveta-B20052; ***@arm.com
> Subject: Re: [edk2] Query UEFI : PCIE Driver for Armv8 platform
>
> Of all the gin joints in all the towns in all the world, Leekha Shaveta had to walk into mine at 20:41:11 on Tuesday 02 June 2015 and say:
>
>> Thanks Eugene!
>>
>> Few more doubts:
>>
>>
>> (1) What exactly this "case EfiPciHostBridgeAllocateResources" of
>> NotifyPhase does?
>>
>> (2) In "StartBusEnumeration" function of PCI_HOST_BRIDGE, it
>> / Fill an ACPI descriptor table with the Bus Number Range. This
>> information will be used by the PCI Bus driver
>>
>> // to set bus numbers to PCI-to-PCI bridge.
>>
>> Is PCI bus implementation is ACPI based only?
>>
>> (3) The PCI controller i am programming, does iATU (Internal address
>> translation unit) programming for accessing PCI IO, Mem and config space.
>> When this programming should happen? During RootBridge init time?
>
> I think the answer to this question is yes (this is local to the PCIe controller, so the driver for this controller should initialize it).
>
>> (4) The RootBridge protocol functions like : PciIoRead/PciIoWrite,
>> PciMemRead/PciMemWrite, PciPciRead/PciPciWrite
>>
>> They all use MmioRead/MmioWrite internally.
>
> Maybe for your particular implementation they do, but this is not true for all PCIe root complexes and/or host bridges.
>
>> Also PCI controller registers
>> are already memory mapped.
>>
>> So what is the significance of:
>>
>> "Reading/Writing PCI controller registers in the PCI root bridge I/O space"
>>
>> "Reading/Writing PCI controller registers in the PCI root bridge
>> Memory space"
>
> A device on the PCI bus may have both memory mapped and I/O space BARs. On the Intel x86 architecture, I/O BARs are not memory mapped: I/O space accesses are performed using special CPU instructions: inb/outb, inw/outw, inl/outl.
> (Normally these are privileged instructions which can only be executed
> in supervisor mode.) This dates back to the original PC design when
> you only have ISA bus devices: when PCI came along, I/O space BARs
> were implemented by PCI devices for compatibility reasons. (In theory
> you could take an existing ISA bus device and slap a PCI front end on
> it, and recycle most of your existing driver code.)
>
> On the PCI bus, I/O space and memory mapped access are implemented with separate transaction codes. How they translate to the host system is platform- dependent.
>
> On any platform other than Intel x86 (PPC, ARM, MIPS, SPARC, etc...), both I/O space BARs and memory mapped BARs are memory mapped. This is probably why you're questioning why you need two different methods. In your case, technically speaking, you don't. If it turns out that a device has the same register layout for both BARs, then you just end up with a second copy (alias) of the device's registers, which is a bit redundant.
>
> However not all devices work that way. One other limiting factor of the original PC design was that there was only 64KB total of I/O space (the inX/outX instructions only accept a 16-bit offset value), so devices usually had very few registers. This has changed over the years. For example, the Intel PRO/1000 ethernet MAC can have 256KB or even 512KB of MMIO register space. This exceeds the total I/O space range available on the x86 platform.
> To mitigate this, the I/O space BAR on an Intel PRO/1000 device is just large enough to provide a set of offset and data "keyhole" registers and you use them to indirectly access the total available register space.
>
> (As to why you would ever need this, some older PRO/1000 devices had a
> chip erratum that could cause the device to trigger a PCI protocol
> violation if you used the memory-mapped command register to perform a
> device reset. The workaround documented by Intel was to perform the
> reset using the I/O space BAR instead of the MMIO BAR.)
>
> Since it is permitted to bridge legacy PCI devices to a PCIe bus, it's usually a good idea to implement both memory mapped and I/O space BAR support correctly, otherwise some legacy devices might not be usable. That is, if the PCIe controller hardware permits. (Apparently the Xilinx Zynq7K PCIe controller implementation doesn't support I/O space read/write transactions.
> I'm not sure if this is an overall defect in the design or if it's a
> question of getting the right bitstream file.)
>
>> "Reading/Writing PCI controller registers in the PCI root bridge
>> Configuration space"
>
> With the advent of extended configuration space (4KB per device vs. 256 bytes per device), it's common for PCIe controllers to implement memory-mapped access mechanisms on the host side. (This is how it works on the Intel x86 platform too.) However some PCIe controllers still use the address/data "keyhole" register scheme instead.
>
> Long story short: your particular controller may be implementing PCI I/O, MMIO and config space reads using memory mapped registers, but that's not always how it works, hence separate methods are provided for each case.
>
> -Bill
>
>>
>> Thanks and Regards,
>> Shaveta
>>
>>
>>
>> From: Cohen, Eugene [mailto:***@hp.com]
>> Sent: Tuesday, June 02, 2015 7:20 PM
>> To: edk2-***@lists.sourceforge.net
>> Cc: ***@arm.com
>> Subject: Re: [edk2] Query UEFI : PCIE Driver for Armv8 platform
>>
>>
>> ? Is all of the following functions have platform specific code, or
>> they can be re-used from any of the PCI code like ARmJunoPkg etc? Are
>> all these functions definitions mendatory?
>>
>> You have to implement the host bridge and root bridge protocols.
>> When you implement a protocol you must implement the functions. Some
>> of the functions don't have to do anything (like some of the
>> NotifyPhase case statements).
>>
>>
>> ? Should "PCI bus scan for devices" kind of code be written as part
>> of PCI Root Bridge code or it should be re-used from
>>
>> ? MdeModulePkg/Bus/Pci/ code as it is?
>>
>> The PCI bus driver already does a scan and enumeration. All you need
>> to do is support the root/host bridge (provide config cycle
>> generation, provide address ranges for mapping into memory spaces, etc).
>>
>>
>> From: Leekha Shaveta [mailto:***@freescale.com]
>> Sent: Tuesday, June 02, 2015 1:20 AM
>> To:
>> edk2-***@lists.sourceforge.net<mailto:edk2-***@lists.sourceforge.
>> n
>> et>
>> Cc: ***@arm.com<mailto:***@arm.com>
>> Subject: Re: [edk2] Query UEFI : PCIE Driver for Armv8 platform
>>
>> Hi,
>>
>> I am writing a PCI driver(Host Bridge) code for ARM platform with
>> real devices like e1000 NIC card on PCI bus.
>>
>> I have written a part of PCI Root Complex Initialization code, but
>> have few doubts :
>>
>> (1) Is all of the following functions have platform specific code, or
>> they can be re-used from any of the PCI code like ARmJunoPkg etc? Are
>> all these functions definitions mendatory?
>>
>> * PciHbRaNotifyPhase, // ResAlloc.NotifyPhase
>>
>> * PciHbRaGetNextRootBridge, // ResAlloc.GetNextRootBridge
>>
>> * PciHbRaGetAllocAttributes, // ResAlloc.GetAllocAttributes
>>
>> * PciHbRaStartBusEnumeration, // ResAlloc.StartBusEnumeration
>>
>> * PciHbRaSetBusNumbers, // ResAlloc.SetBusNumbers
>>
>> * PciHbRaSubmitResources, // ResAlloc.SubmitResources
>>
>> * PciHbRaGetProposedResources, // ResAlloc.GetProposedResources
>>
>> * PciHbRaPreprocessController
>>
>>
>>
>> (2) Should "PCI bus scan for devices" kind of code be written as part of
>> PCI Root Bridge code or it should be re-used from
>> MdeModulePkg/Bus/Pci/ code as it is?
>>
>> (3) As I want to write e1000 PCI NIC card driver over it, is there any
>> existing code for the same?
>>
>> Thanks and Regards,
>> Shaveta
>>
>> From: Sharma Bhupesh-B45370
>> Sent: Wednesday, May 13, 2015 8:20 PM
>> To:
>> edk2-***@lists.sourceforge.net<mailto:edk2-***@lists.sourceforge.
>> n
>> et>
>> Cc: Leekha Shaveta-B20052
>> Subject: RE: Query UEFI : PCIE Driver for Armv8 platform
>>
>> Thanks for the pointers, Olivier.
>>
>> Regards,
>> Bhupesh
>>
>> From: Olivier Martin [mailto:***@arm.com]
>> Sent: Wednesday, May 13, 2015 8:10 PM
>> To:
>> edk2-***@lists.sourceforge.net<mailto:edk2-***@lists.sourceforge.
>> n
>> et>
>> Subject: Re: [edk2] Query UEFI : PCIE Driver for Armv8 platform
>>
>> Are lucky because I actually pushed the PCI Root Complex source code
>> for ARM Juno development board R1 (Revision 1) yesterday in EDK2. You
>> should be able to find the code under
>> ArmPlatformPkg/ArmJunoPkg/Drivers/PciHostBridgeDxe I am guessing what
>> you name 'ATU' is the logic to translate AXI bus <-> PCI bus. As far
>> as I have seen so far, this logic is vendor specific. You can see
>> this initialization of the translation block for this PCI Root
>> Complex in this
>> file:
>> ArmPlatformPkg/ArmJunoPkg/Drivers/PciHostBridgeDxe/XPressRich3.c
>>
>> From: Leekha Shaveta [mailto:***@freescale.com]
>> Sent: 13 May 2015 13:09
>> To:
>> edk2-***@lists.sourceforge.net<mailto:edk2-***@lists.sourceforge.
>> n
>> et>
>> Subject: [edk2] Query UEFI : PCIE Driver for Armv8 platform
>>
>> Hi,
>>
>> I was looking for PCIE driver/Root Bridge implementation for ARMv8
>> kind of platforms and have referred some code in files:
>>
>> *
>> ArmPlatformPkg/ArmVirtualizationPkg/PciHostBridgeDxe/PciRootBridgeIo.
>> c
>>
>> *
>> ArmPlatformPkg/ArmVirtualizationPkg/PciHostBridgeDxe/PciHostBridge.c
>>
>> But I couldn't see ATU programming code in this implementation, AFAIK
>> ATU programming is required for any outbound and inbound transaction of PCI.
>> How the IO translation is being done in this?
>> Also what is the context of "aperture" used in this code?
>>
>> Kindly help in clearing these doubts.
>>
>> Regards,
>> Shaveta
>>
>>
>> -- IMPORTANT NOTICE: The contents of this email and any attachments
>> are confidential and may also be privileged. If you are not the
>> intended recipient, please notify the sender immediately and do not
>> disclose the contents to any other person, use it for any purpose, or
>> store or copy the information in any medium. Thank you.
>>
>> ARM Limited, Registered office 110 Fulbourn Road, Cambridge CB1 9NJ,
>> Registered in England & Wales, Company No: 2557590 ARM Holdings plc,
>> Registered office 110 Fulbourn Road, Cambridge CB1 9NJ, Registered in
>> England & Wales, Company No: 2548782
>
> --
> =============================================================================
> -Bill Paul (510) 749-2329 | Senior Member of Technical Staff,
> ***@windriver.com | Master of Unix-Fu - Wind River Systems =============================================================================
> "I put a dollar in a change machine. Nothing changed." - George
> Carlin
> ======================================================================
> =======
>
> ----------------------------------------------------------------------
> -------- _______________________________________________
> edk2-devel mailing list
> edk2-***@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/edk2-devel
Andrew Fish
2015-06-05 17:20:21 UTC
Permalink
> On Jun 5, 2015, at 4:23 AM, Leekha Shaveta <***@freescale.com> wrote:
>
> Thanks Andrew!
>
> Few more Doubts :
> How ACPI is defining PCI resources?
> What are these PCI resources and their functions? Are these resources are like some regions in "PCI Express space”

Leekha you need to think about it from the hardware point of view….

The PCI root bridge sits on the CPU bus and it produces PCI. So that PCI root bridge has to be configured to forward transactions.
From the firmware point of view you are configuring the chip to decode memory addresses and resources to forward them to PCI.
From an OS (or generic PCI bus driver) you are defining the resource pool that is available to config PCI devices. So assign bus numbers, and populate BARs.

> ?
>

> As I was referring ArmJunoPkg for PCI Host Bridge implementation. And found this ACPI configuration used:
>>
>> RESOURCE_CONFIGURATION Configuration = {
>> {{ACPI_ADDRESS_SPACE_DESCRIPTOR, 0x2B, ACPI_ADDRESS_SPACE_TYPE_IO , 0, 0, 0, 0, 0, 0, 0},
>> {ACPI_ADDRESS_SPACE_DESCRIPTOR, 0x2B, ACPI_ADDRESS_SPACE_TYPE_MEM, 0, 0, 32, 0, 0, 0, 0},
>> {ACPI_ADDRESS_SPACE_DESCRIPTOR, 0x2B, ACPI_ADDRESS_SPACE_TYPE_MEM, 0, 6, 32, 0, 0, 0, 0},
>> {ACPI_ADDRESS_SPACE_DESCRIPTOR, 0x2B, ACPI_ADDRESS_SPACE_TYPE_MEM, 0, 0, 64, 0, 0, 0, 0},
>> {ACPI_ADDRESS_SPACE_DESCRIPTOR, 0x2B, ACPI_ADDRESS_SPACE_TYPE_MEM, 0, 6, 64, 0, 0, 0, 0},
>> {ACPI_ADDRESS_SPACE_DESCRIPTOR, 0x2B, ACPI_ADDRESS_SPACE_TYPE_BUS, 0, 0, 0, 0, 255, 0, 255}},
>> {ACPI_END_TAG_DESCRIPTOR, 0}
>> };
>>
>> Hi Olivier,
>> Can you please help in understanding this resource configuration ?
>> Here you seem to be specifying one IO, 4 Mem and 1 Bus space. Why 6 of them and how do they differ?
>
> On which basis 6 resources are given here?
>

These are the basic resource types supported by PCI.

I/O so the inb outb instructions on X86 (IO BAR)
32-bit Prefetch and non-Prefetch memory (Memory BAR)
64-bit Prefetch and non-Prefetch memory (Memory BAR)
PCI Bus numbers. (Bus Number)

Thanks,

Andrew Fish

> Thanks and Regards,
> Shaveta
>
>
> -----Original Message-----
> From: Andrew Fish [mailto:***@apple.com]
> Sent: Thursday, June 04, 2015 12:37 PM
> To: edk2-***@lists.sourceforge.net
> Cc: ***@arm.com
> Subject: Re: [edk2] Query UEFI : PCIE Driver for Armv8 platform
>
>
>> On Jun 3, 2015, at 11:57 PM, Leekha Shaveta <***@freescale.com> wrote:
>>
>> Thanks Bill for such an elaborated reply !!
>>
>> Few doubts left:
>> (1) In "StartBusEnumeration" function of PCI_HOST_BRIDGE, it
>> // Fill an ACPI descriptor table with the Bus Number Range. This
>> // information will be used by the PCI Bus driver
>> // to set bus numbers to PCI-to-PCI bridge.
>>
>> Is PCI bus implementation is ACPI based only?
>>
>
> No while PCI is defined by a specification how a PCI Host Bridge hooks into a system is not defined. Thus the Firmware and the OS have no idea how a PCI Host Bridge works. The Firmware can carry a driver for the host bridge and generally the OS uses ACPI to abstract the PCI Host Bridge hardware and contains drivers that follow the PCI specifications. Given it was likely on a lot of systems that this would be true we decided to use ACPI resource descriptors to abstract the resources, we could have made up something new, but we figured the person writing the PCI Host Bridge driver would also likely have to write the ACPI AML to get the chip working, and would be familiar with this concept. We also figured if the firmware and the OS used the same description technique there would be less chance for error. It also seemed to us that ACPI had already solved this problem (describing resources), so why invent a new way to do it.
>
> Thanks,
>
> Andrew Fish
>
>> (2) I was referring ArmJunoPkg for PCI Host Bridge implementation. And found this ACPI configuration used:
>>
>> RESOURCE_CONFIGURATION Configuration = {
>> {{ACPI_ADDRESS_SPACE_DESCRIPTOR, 0x2B, ACPI_ADDRESS_SPACE_TYPE_IO , 0, 0, 0, 0, 0, 0, 0},
>> {ACPI_ADDRESS_SPACE_DESCRIPTOR, 0x2B, ACPI_ADDRESS_SPACE_TYPE_MEM, 0, 0, 32, 0, 0, 0, 0},
>> {ACPI_ADDRESS_SPACE_DESCRIPTOR, 0x2B, ACPI_ADDRESS_SPACE_TYPE_MEM, 0, 6, 32, 0, 0, 0, 0},
>> {ACPI_ADDRESS_SPACE_DESCRIPTOR, 0x2B, ACPI_ADDRESS_SPACE_TYPE_MEM, 0, 0, 64, 0, 0, 0, 0},
>> {ACPI_ADDRESS_SPACE_DESCRIPTOR, 0x2B, ACPI_ADDRESS_SPACE_TYPE_MEM, 0, 6, 64, 0, 0, 0, 0},
>> {ACPI_ADDRESS_SPACE_DESCRIPTOR, 0x2B, ACPI_ADDRESS_SPACE_TYPE_BUS, 0, 0, 0, 0, 255, 0, 255}},
>> {ACPI_END_TAG_DESCRIPTOR, 0}
>> };
>>
>> Hi Olivier,
>> Can you please help in understanding this resource configuration ?
>> Here you seem to be specifying one IO, 4 Mem and 1 Bus space. Why 6 of them and how do they differ?
>>
>> (3) What exactly this "case EfiPciHostBridgeAllocateResources" of NotifyPhase does?
>> Is it allocate resources in sync with the ACPI configuration given?
>>
>> (4) Is there some PCI NIC card or E1000 driver (PCI device driver) written on top of PCI bus driver, any references?
>>
>> Thanks and Regards,
>> Shaveta
>>
>> -----Original Message-----
>> From: Bill Paul [mailto:***@windriver.com]
>> Sent: Wednesday, June 03, 2015 9:40 AM
>> To: edk2-***@lists.sourceforge.net
>> Cc: Leekha Shaveta-B20052; ***@arm.com
>> Subject: Re: [edk2] Query UEFI : PCIE Driver for Armv8 platform
>>
>> Of all the gin joints in all the towns in all the world, Leekha Shaveta had to walk into mine at 20:41:11 on Tuesday 02 June 2015 and say:
>>
>>> Thanks Eugene!
>>>
>>> Few more doubts:
>>>
>>>
>>> (1) What exactly this "case EfiPciHostBridgeAllocateResources" of
>>> NotifyPhase does?
>>>
>>> (2) In "StartBusEnumeration" function of PCI_HOST_BRIDGE, it
>>> / Fill an ACPI descriptor table with the Bus Number Range. This
>>> information will be used by the PCI Bus driver
>>>
>>> // to set bus numbers to PCI-to-PCI bridge.
>>>
>>> Is PCI bus implementation is ACPI based only?
>>>
>>> (3) The PCI controller i am programming, does iATU (Internal address
>>> translation unit) programming for accessing PCI IO, Mem and config space.
>>> When this programming should happen? During RootBridge init time?
>>
>> I think the answer to this question is yes (this is local to the PCIe controller, so the driver for this controller should initialize it).
>>
>>> (4) The RootBridge protocol functions like : PciIoRead/PciIoWrite,
>>> PciMemRead/PciMemWrite, PciPciRead/PciPciWrite
>>>
>>> They all use MmioRead/MmioWrite internally.
>>
>> Maybe for your particular implementation they do, but this is not true for all PCIe root complexes and/or host bridges.
>>
>>> Also PCI controller registers
>>> are already memory mapped.
>>>
>>> So what is the significance of:
>>>
>>> "Reading/Writing PCI controller registers in the PCI root bridge I/O space"
>>>
>>> "Reading/Writing PCI controller registers in the PCI root bridge
>>> Memory space"
>>
>> A device on the PCI bus may have both memory mapped and I/O space BARs. On the Intel x86 architecture, I/O BARs are not memory mapped: I/O space accesses are performed using special CPU instructions: inb/outb, inw/outw, inl/outl.
>> (Normally these are privileged instructions which can only be executed
>> in supervisor mode.) This dates back to the original PC design when
>> you only have ISA bus devices: when PCI came along, I/O space BARs
>> were implemented by PCI devices for compatibility reasons. (In theory
>> you could take an existing ISA bus device and slap a PCI front end on
>> it, and recycle most of your existing driver code.)
>>
>> On the PCI bus, I/O space and memory mapped access are implemented with separate transaction codes. How they translate to the host system is platform- dependent.
>>
>> On any platform other than Intel x86 (PPC, ARM, MIPS, SPARC, etc...), both I/O space BARs and memory mapped BARs are memory mapped. This is probably why you're questioning why you need two different methods. In your case, technically speaking, you don't. If it turns out that a device has the same register layout for both BARs, then you just end up with a second copy (alias) of the device's registers, which is a bit redundant.
>>
>> However not all devices work that way. One other limiting factor of the original PC design was that there was only 64KB total of I/O space (the inX/outX instructions only accept a 16-bit offset value), so devices usually had very few registers. This has changed over the years. For example, the Intel PRO/1000 ethernet MAC can have 256KB or even 512KB of MMIO register space. This exceeds the total I/O space range available on the x86 platform.
>> To mitigate this, the I/O space BAR on an Intel PRO/1000 device is just large enough to provide a set of offset and data "keyhole" registers and you use them to indirectly access the total available register space.
>>
>> (As to why you would ever need this, some older PRO/1000 devices had a
>> chip erratum that could cause the device to trigger a PCI protocol
>> violation if you used the memory-mapped command register to perform a
>> device reset. The workaround documented by Intel was to perform the
>> reset using the I/O space BAR instead of the MMIO BAR.)
>>
>> Since it is permitted to bridge legacy PCI devices to a PCIe bus, it's usually a good idea to implement both memory mapped and I/O space BAR support correctly, otherwise some legacy devices might not be usable. That is, if the PCIe controller hardware permits. (Apparently the Xilinx Zynq7K PCIe controller implementation doesn't support I/O space read/write transactions.
>> I'm not sure if this is an overall defect in the design or if it's a
>> question of getting the right bitstream file.)
>>
>>> "Reading/Writing PCI controller registers in the PCI root bridge
>>> Configuration space"
>>
>> With the advent of extended configuration space (4KB per device vs. 256 bytes per device), it's common for PCIe controllers to implement memory-mapped access mechanisms on the host side. (This is how it works on the Intel x86 platform too.) However some PCIe controllers still use the address/data "keyhole" register scheme instead.
>>
>> Long story short: your particular controller may be implementing PCI I/O, MMIO and config space reads using memory mapped registers, but that's not always how it works, hence separate methods are provided for each case.
>>
>> -Bill
>>
>>>
>>> Thanks and Regards,
>>> Shaveta
>>>
>>>
>>>
>>> From: Cohen, Eugene [mailto:***@hp.com]
>>> Sent: Tuesday, June 02, 2015 7:20 PM
>>> To: edk2-***@lists.sourceforge.net
>>> Cc: ***@arm.com
>>> Subject: Re: [edk2] Query UEFI : PCIE Driver for Armv8 platform
>>>
>>>
>>> ? Is all of the following functions have platform specific code, or
>>> they can be re-used from any of the PCI code like ARmJunoPkg etc? Are
>>> all these functions definitions mendatory?
>>>
>>> You have to implement the host bridge and root bridge protocols.
>>> When you implement a protocol you must implement the functions. Some
>>> of the functions don't have to do anything (like some of the
>>> NotifyPhase case statements).
>>>
>>>
>>> ? Should "PCI bus scan for devices" kind of code be written as part
>>> of PCI Root Bridge code or it should be re-used from
>>>
>>> ? MdeModulePkg/Bus/Pci/ code as it is?
>>>
>>> The PCI bus driver already does a scan and enumeration. All you need
>>> to do is support the root/host bridge (provide config cycle
>>> generation, provide address ranges for mapping into memory spaces, etc).
>>>
>>>
>>> From: Leekha Shaveta [mailto:***@freescale.com]
>>> Sent: Tuesday, June 02, 2015 1:20 AM
>>> To:
>>> edk2-***@lists.sourceforge.net<mailto:edk2-***@lists.sourceforge.
>>> n
>>> et>
>>> Cc: ***@arm.com<mailto:***@arm.com>
>>> Subject: Re: [edk2] Query UEFI : PCIE Driver for Armv8 platform
>>>
>>> Hi,
>>>
>>> I am writing a PCI driver(Host Bridge) code for ARM platform with
>>> real devices like e1000 NIC card on PCI bus.
>>>
>>> I have written a part of PCI Root Complex Initialization code, but
>>> have few doubts :
>>>
>>> (1) Is all of the following functions have platform specific code, or
>>> they can be re-used from any of the PCI code like ARmJunoPkg etc? Are
>>> all these functions definitions mendatory?
>>>
>>> * PciHbRaNotifyPhase, // ResAlloc.NotifyPhase
>>>
>>> * PciHbRaGetNextRootBridge, // ResAlloc.GetNextRootBridge
>>>
>>> * PciHbRaGetAllocAttributes, // ResAlloc.GetAllocAttributes
>>>
>>> * PciHbRaStartBusEnumeration, // ResAlloc.StartBusEnumeration
>>>
>>> * PciHbRaSetBusNumbers, // ResAlloc.SetBusNumbers
>>>
>>> * PciHbRaSubmitResources, // ResAlloc.SubmitResources
>>>
>>> * PciHbRaGetProposedResources, // ResAlloc.GetProposedResources
>>>
>>> * PciHbRaPreprocessController
>>>
>>>
>>>
>>> (2) Should "PCI bus scan for devices" kind of code be written as part of
>>> PCI Root Bridge code or it should be re-used from
>>> MdeModulePkg/Bus/Pci/ code as it is?
>>>
>>> (3) As I want to write e1000 PCI NIC card driver over it, is there any
>>> existing code for the same?
>>>
>>> Thanks and Regards,
>>> Shaveta
>>>
>>> From: Sharma Bhupesh-B45370
>>> Sent: Wednesday, May 13, 2015 8:20 PM
>>> To:
>>> edk2-***@lists.sourceforge.net<mailto:edk2-***@lists.sourceforge.
>>> n
>>> et>
>>> Cc: Leekha Shaveta-B20052
>>> Subject: RE: Query UEFI : PCIE Driver for Armv8 platform
>>>
>>> Thanks for the pointers, Olivier.
>>>
>>> Regards,
>>> Bhupesh
>>>
>>> From: Olivier Martin [mailto:***@arm.com]
>>> Sent: Wednesday, May 13, 2015 8:10 PM
>>> To:
>>> edk2-***@lists.sourceforge.net<mailto:edk2-***@lists.sourceforge.
>>> n
>>> et>
>>> Subject: Re: [edk2] Query UEFI : PCIE Driver for Armv8 platform
>>>
>>> Are lucky because I actually pushed the PCI Root Complex source code
>>> for ARM Juno development board R1 (Revision 1) yesterday in EDK2. You
>>> should be able to find the code under
>>> ArmPlatformPkg/ArmJunoPkg/Drivers/PciHostBridgeDxe I am guessing what
>>> you name 'ATU' is the logic to translate AXI bus <-> PCI bus. As far
>>> as I have seen so far, this logic is vendor specific. You can see
>>> this initialization of the translation block for this PCI Root
>>> Complex in this
>>> file:
>>> ArmPlatformPkg/ArmJunoPkg/Drivers/PciHostBridgeDxe/XPressRich3.c
>>>
>>> From: Leekha Shaveta [mailto:***@freescale.com]
>>> Sent: 13 May 2015 13:09
>>> To:
>>> edk2-***@lists.sourceforge.net<mailto:edk2-***@lists.sourceforge.
>>> n
>>> et>
>>> Subject: [edk2] Query UEFI : PCIE Driver for Armv8 platform
>>>
>>> Hi,
>>>
>>> I was looking for PCIE driver/Root Bridge implementation for ARMv8
>>> kind of platforms and have referred some code in files:
>>>
>>> *
>>> ArmPlatformPkg/ArmVirtualizationPkg/PciHostBridgeDxe/PciRootBridgeIo.
>>> c
>>>
>>> *
>>> ArmPlatformPkg/ArmVirtualizationPkg/PciHostBridgeDxe/PciHostBridge.c
>>>
>>> But I couldn't see ATU programming code in this implementation, AFAIK
>>> ATU programming is required for any outbound and inbound transaction of PCI.
>>> How the IO translation is being done in this?
>>> Also what is the context of "aperture" used in this code?
>>>
>>> Kindly help in clearing these doubts.
>>>
>>> Regards,
>>> Shaveta
>>>
>>>
>>> -- IMPORTANT NOTICE: The contents of this email and any attachments
>>> are confidential and may also be privileged. If you are not the
>>> intended recipient, please notify the sender immediately and do not
>>> disclose the contents to any other person, use it for any purpose, or
>>> store or copy the information in any medium. Thank you.
>>>
>>> ARM Limited, Registered office 110 Fulbourn Road, Cambridge CB1 9NJ,
>>> Registered in England & Wales, Company No: 2557590 ARM Holdings plc,
>>> Registered office 110 Fulbourn Road, Cambridge CB1 9NJ, Registered in
>>> England & Wales, Company No: 2548782
>>
>> --
>> =============================================================================
>> -Bill Paul (510) 749-2329 | Senior Member of Technical Staff,
>> ***@windriver.com | Master of Unix-Fu - Wind River Systems =============================================================================
>> "I put a dollar in a change machine. Nothing changed." - George
>> Carlin
>> ======================================================================
>> =======
>>
>> ----------------------------------------------------------------------
>> -------- _______________________________________________
>> edk2-devel mailing list
>> edk2-***@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/edk2-devel
>
>
> ------------------------------------------------------------------------------
> _______________________________________________
> edk2-devel mailing list
> edk2-***@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/edk2-devel


------------------------------------------------------------------------------
Leekha Shaveta
2015-06-08 06:58:34 UTC
Permalink
Thanks Andrew!

Is there some PCI NIC card or E1000 driver (PCI device driver) written on top of PCI bus driver, any references?

One is Intel's e1000 driver, which is proprietary and is requested by the -D E1000_ENABLE build flag.

I have seen in logs that some libraries are referred like:

NetLib|MdeModulePkg/Library/DxeNetLib/
IpIoLib|MdeModulePkg/Library/DxeIpIoLib/
UdpIoLib|MdeModulePkg/Library/DxeUdpIoLib/
DpcLib|MdeModulePkg/Library/DxeDpcLib/


Are these required for PCI NIC driver?

Thanks and regards,
Shaveta

-----Original Message-----
From: Andrew Fish [mailto:***@apple.com]
Sent: Friday, June 05, 2015 10:50 PM
To: Leekha Shaveta-B20052
Cc: edk2-***@lists.sourceforge.net; ***@arm.com
Subject: Re: [edk2] Query UEFI : PCIE Driver for Armv8 platform


> On Jun 5, 2015, at 4:23 AM, Leekha Shaveta <***@freescale.com> wrote:
>
> Thanks Andrew!
>
> Few more Doubts :
> How ACPI is defining PCI resources?
> What are these PCI resources and their functions? Are these resources are like some regions in "PCI Express space”

Leekha you need to think about it from the hardware point of view….

The PCI root bridge sits on the CPU bus and it produces PCI. So that PCI root bridge has to be configured to forward transactions.
From the firmware point of view you are configuring the chip to decode memory addresses and resources to forward them to PCI.
From an OS (or generic PCI bus driver) you are defining the resource pool that is available to config PCI devices. So assign bus numbers, and populate BARs.

> ?
>

> As I was referring ArmJunoPkg for PCI Host Bridge implementation. And found this ACPI configuration used:
>>
>> RESOURCE_CONFIGURATION Configuration = {
>> {{ACPI_ADDRESS_SPACE_DESCRIPTOR, 0x2B, ACPI_ADDRESS_SPACE_TYPE_IO , 0, 0, 0, 0, 0, 0, 0},
>> {ACPI_ADDRESS_SPACE_DESCRIPTOR, 0x2B, ACPI_ADDRESS_SPACE_TYPE_MEM, 0, 0, 32, 0, 0, 0, 0},
>> {ACPI_ADDRESS_SPACE_DESCRIPTOR, 0x2B, ACPI_ADDRESS_SPACE_TYPE_MEM, 0, 6, 32, 0, 0, 0, 0},
>> {ACPI_ADDRESS_SPACE_DESCRIPTOR, 0x2B, ACPI_ADDRESS_SPACE_TYPE_MEM, 0, 0, 64, 0, 0, 0, 0},
>> {ACPI_ADDRESS_SPACE_DESCRIPTOR, 0x2B, ACPI_ADDRESS_SPACE_TYPE_MEM, 0, 6, 64, 0, 0, 0, 0},
>> {ACPI_ADDRESS_SPACE_DESCRIPTOR, 0x2B, ACPI_ADDRESS_SPACE_TYPE_BUS, 0, 0, 0, 0, 255, 0, 255}},
>> {ACPI_END_TAG_DESCRIPTOR, 0}
>> };
>>
>> Hi Olivier,
>> Can you please help in understanding this resource configuration ?
>> Here you seem to be specifying one IO, 4 Mem and 1 Bus space. Why 6 of them and how do they differ?
>
> On which basis 6 resources are given here?
>

These are the basic resource types supported by PCI.

I/O so the inb outb instructions on X86 (IO BAR) 32-bit Prefetch and non-Prefetch memory (Memory BAR) 64-bit Prefetch and non-Prefetch memory (Memory BAR) PCI Bus numbers. (Bus Number)

Thanks,

Andrew Fish

> Thanks and Regards,
> Shaveta
>
------------------------------------------------------------------------------
Olivier Martin
2015-06-16 18:01:33 UTC
Permalink
Sources for the E1000 EFI driver exists....
The sources are for EDK1. They can be downloaded here: http://tianocore.sourceforge.net/wiki/EDK

I think I had ported this driver to EDK2 in the past for fun - I did not have the opportunity to test it. I do not remember to have any difficulties to port it.


-----Original Message-----
From: Leekha Shaveta [mailto:***@freescale.com]
Sent: 08 June 2015 07:59
To: Andrew Fish; edk2-***@lists.sourceforge.net
Cc: Olivier Martin; Ruchika Gupta
Subject: RE: [edk2] Query UEFI : PCIE Driver for Armv8 platform

Thanks Andrew!

Is there some PCI NIC card or E1000 driver (PCI device driver) written on top of PCI bus driver, any references?

One is Intel's e1000 driver, which is proprietary and is requested by the -D E1000_ENABLE build flag.

I have seen in logs that some libraries are referred like:

NetLib|MdeModulePkg/Library/DxeNetLib/
IpIoLib|MdeModulePkg/Library/DxeIpIoLib/
UdpIoLib|MdeModulePkg/Library/DxeUdpIoLib/
DpcLib|MdeModulePkg/Library/DxeDpcLib/


Are these required for PCI NIC driver?

Thanks and regards,
Shaveta

-----Original Message-----
From: Andrew Fish [mailto:***@apple.com]
Sent: Friday, June 05, 2015 10:50 PM
To: Leekha Shaveta-B20052
Cc: edk2-***@lists.sourceforge.net; ***@arm.com
Subject: Re: [edk2] Query UEFI : PCIE Driver for Armv8 platform


> On Jun 5, 2015, at 4:23 AM, Leekha Shaveta <***@freescale.com> wrote:
>
> Thanks Andrew!
>
> Few more Doubts :
> How ACPI is defining PCI resources?
> What are these PCI resources and their functions? Are these resources are like some regions in "PCI Express space”

Leekha you need to think about it from the hardware point of view….

The PCI root bridge sits on the CPU bus and it produces PCI. So that PCI root bridge has to be configured to forward transactions.
From the firmware point of view you are configuring the chip to decode memory addresses and resources to forward them to PCI.
From an OS (or generic PCI bus driver) you are defining the resource pool that is available to config PCI devices. So assign bus numbers, and populate BARs.

> ?
>

> As I was referring ArmJunoPkg for PCI Host Bridge implementation. And found this ACPI configuration used:
>>
>> RESOURCE_CONFIGURATION Configuration = {
>> {{ACPI_ADDRESS_SPACE_DESCRIPTOR, 0x2B, ACPI_ADDRESS_SPACE_TYPE_IO , 0, 0, 0, 0, 0, 0, 0},
>> {ACPI_ADDRESS_SPACE_DESCRIPTOR, 0x2B, ACPI_ADDRESS_SPACE_TYPE_MEM, 0, 0, 32, 0, 0, 0, 0},
>> {ACPI_ADDRESS_SPACE_DESCRIPTOR, 0x2B, ACPI_ADDRESS_SPACE_TYPE_MEM, 0, 6, 32, 0, 0, 0, 0},
>> {ACPI_ADDRESS_SPACE_DESCRIPTOR, 0x2B, ACPI_ADDRESS_SPACE_TYPE_MEM, 0, 0, 64, 0, 0, 0, 0},
>> {ACPI_ADDRESS_SPACE_DESCRIPTOR, 0x2B, ACPI_ADDRESS_SPACE_TYPE_MEM, 0, 6, 64, 0, 0, 0, 0},
>> {ACPI_ADDRESS_SPACE_DESCRIPTOR, 0x2B, ACPI_ADDRESS_SPACE_TYPE_BUS, 0, 0, 0, 0, 255, 0, 255}},
>> {ACPI_END_TAG_DESCRIPTOR, 0}
>> };
>>
>> Hi Olivier,
>> Can you please help in understanding this resource configuration ?
>> Here you seem to be specifying one IO, 4 Mem and 1 Bus space. Why 6 of them and how do they differ?
>
> On which basis 6 resources are given here?
>

These are the basic resource types supported by PCI.

I/O so the inb outb instructions on X86 (IO BAR) 32-bit Prefetch and non-Prefetch memory (Memory BAR) 64-bit Prefetch and non-Prefetch memory (Memory BAR) PCI Bus numbers. (Bus Number)

Thanks,

Andrew Fish

> Thanks and Regards,
> Shaveta
>

-- IMPORTANT NOTICE: The contents of this email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please notify the sender immediately and do not disclose the contents to any other person, use it for any purpose, or store or copy the information in any medium. Thank you.

ARM Limited, Registered office 110 Fulbourn Road, Cambridge CB1 9NJ, Registered in England & Wales, Company No: 2557590
ARM Holdings plc, Registered office 110 Fulbourn Road, Cambridge CB1 9NJ, Registered in England & Wales, Company No: 2548782
------------------------------------------------------------------------------
Laszlo Ersek
2015-06-16 19:00:39 UTC
Permalink
On 06/16/15 20:01, Olivier Martin wrote:
> Sources for the E1000 EFI driver exists....
> The sources are for EDK1. They can be downloaded here: http://tianocore.sourceforge.net/wiki/EDK
>
> I think I had ported this driver to EDK2 in the past for fun - I did
> not have the opportunity to test it. I do not remember to have any
> difficulties to port it.

Very interesting! I wonder then why the PROEFI driver is now proprietary
and wrapped into a draconian license. (It's not even redistributable in
intact binary form IIRC.)

Do you have your edk2 port of the edk1 E1000 driver still around? That
would be a great addition to OVMF: at the moment we have a builtin
virtio-net driver, but for Windows guests, the emulated E1000 NIC seems
to be the default choice. (For example, the virtio-win driver ISO is
then not needed during guest installation, because Windows has a builtin
E1000 driver.)

iPXE does have a UEFI driver oprom for the E1000, but (a) sometimes you
don't want to use iPXE, (b) for ARM virtual machines, iPXE is not available.

QEMU already provides PCIe emulation for the "virt" machine type, and
ArmVirtPkg knows how to use it, so -- thinking of (upcoming?)
Windows-on-ARM guests -- an open source E1000 driver that builds as part
of ArmVirtPkg would be very cool.

Summary:
- OvmfPkg could PXE-boot off E1000 without iPXE
- ArmVirtPkg could PXE-boot off E1000 (as only E1000 option)
- some users prefer E1000 in VMs that run Windows

Thanks
Laszlo

>
>
> -----Original Message-----
> From: Leekha Shaveta [mailto:***@freescale.com]
> Sent: 08 June 2015 07:59
> To: Andrew Fish; edk2-***@lists.sourceforge.net
> Cc: Olivier Martin; Ruchika Gupta
> Subject: RE: [edk2] Query UEFI : PCIE Driver for Armv8 platform
>
> Thanks Andrew!
>
> Is there some PCI NIC card or E1000 driver (PCI device driver) written on top of PCI bus driver, any references?
>
> One is Intel's e1000 driver, which is proprietary and is requested by the -D E1000_ENABLE build flag.
>
> I have seen in logs that some libraries are referred like:
>
> NetLib|MdeModulePkg/Library/DxeNetLib/
> IpIoLib|MdeModulePkg/Library/DxeIpIoLib/
> UdpIoLib|MdeModulePkg/Library/DxeUdpIoLib/
> DpcLib|MdeModulePkg/Library/DxeDpcLib/
>
>
> Are these required for PCI NIC driver?
>
> Thanks and regards,
> Shaveta
>
> -----Original Message-----
> From: Andrew Fish [mailto:***@apple.com]
> Sent: Friday, June 05, 2015 10:50 PM
> To: Leekha Shaveta-B20052
> Cc: edk2-***@lists.sourceforge.net; ***@arm.com
> Subject: Re: [edk2] Query UEFI : PCIE Driver for Armv8 platform
>
>
>> On Jun 5, 2015, at 4:23 AM, Leekha Shaveta <***@freescale.com> wrote:
>>
>> Thanks Andrew!
>>
>> Few more Doubts :
>> How ACPI is defining PCI resources?
>> What are these PCI resources and their functions? Are these resources are like some regions in "PCI Express space”
>
> Leekha you need to think about it from the hardware point of view….
>
> The PCI root bridge sits on the CPU bus and it produces PCI. So that PCI root bridge has to be configured to forward transactions.
> From the firmware point of view you are configuring the chip to decode memory addresses and resources to forward them to PCI.
> From an OS (or generic PCI bus driver) you are defining the resource pool that is available to config PCI devices. So assign bus numbers, and populate BARs.
>
>> ?
>>
>
>> As I was referring ArmJunoPkg for PCI Host Bridge implementation. And found this ACPI configuration used:
>>>
>>> RESOURCE_CONFIGURATION Configuration = {
>>> {{ACPI_ADDRESS_SPACE_DESCRIPTOR, 0x2B, ACPI_ADDRESS_SPACE_TYPE_IO , 0, 0, 0, 0, 0, 0, 0},
>>> {ACPI_ADDRESS_SPACE_DESCRIPTOR, 0x2B, ACPI_ADDRESS_SPACE_TYPE_MEM, 0, 0, 32, 0, 0, 0, 0},
>>> {ACPI_ADDRESS_SPACE_DESCRIPTOR, 0x2B, ACPI_ADDRESS_SPACE_TYPE_MEM, 0, 6, 32, 0, 0, 0, 0},
>>> {ACPI_ADDRESS_SPACE_DESCRIPTOR, 0x2B, ACPI_ADDRESS_SPACE_TYPE_MEM, 0, 0, 64, 0, 0, 0, 0},
>>> {ACPI_ADDRESS_SPACE_DESCRIPTOR, 0x2B, ACPI_ADDRESS_SPACE_TYPE_MEM, 0, 6, 64, 0, 0, 0, 0},
>>> {ACPI_ADDRESS_SPACE_DESCRIPTOR, 0x2B, ACPI_ADDRESS_SPACE_TYPE_BUS, 0, 0, 0, 0, 255, 0, 255}},
>>> {ACPI_END_TAG_DESCRIPTOR, 0}
>>> };
>>>
>>> Hi Olivier,
>>> Can you please help in understanding this resource configuration ?
>>> Here you seem to be specifying one IO, 4 Mem and 1 Bus space. Why 6 of them and how do they differ?
>>
>> On which basis 6 resources are given here?
>>
>
> These are the basic resource types supported by PCI.
>
> I/O so the inb outb instructions on X86 (IO BAR) 32-bit Prefetch and non-Prefetch memory (Memory BAR) 64-bit Prefetch and non-Prefetch memory (Memory BAR) PCI Bus numbers. (Bus Number)
>
> Thanks,
>
> Andrew Fish
>
>> Thanks and Regards,
>> Shaveta
>>
>
> -- IMPORTANT NOTICE: The contents of this email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please notify the sender immediately and do not disclose the contents to any other person, use it for any purpose, or store or copy the information in any medium. Thank you.
>
> ARM Limited, Registered office 110 Fulbourn Road, Cambridge CB1 9NJ, Registered in England & Wales, Company No: 2557590
> ARM Holdings plc, Registered office 110 Fulbourn Road, Cambridge CB1 9NJ, Registered in England & Wales, Company No: 2548782
> ------------------------------------------------------------------------------
> _______________________________________________
> edk2-devel mailing list
> edk2-***@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/edk2-devel
>


------------------------------------------------------------------------------
Olivier Martin
2015-06-17 16:21:05 UTC
Permalink
Ahah, I knew this hidden link would make some people happy!

Hmm, I think the driver was on one of my old hard disk. I have just tried to see if I can redo the work again. It took me a couple of hours :-/
Anyway, I sent the patch. It builds with GCC49. But as I said I have not tested it.


-----Original Message-----
From: Laszlo Ersek [mailto:***@redhat.com]
Sent: 16 June 2015 20:01
To: Olivier Martin
Cc: edk2-***@lists.sourceforge.net; Leekha Shaveta; Andrew Fish; Ruchika Gupta
Subject: Re: [edk2] Query UEFI : PCIE Driver for Armv8 platform

On 06/16/15 20:01, Olivier Martin wrote:
> Sources for the E1000 EFI driver exists....
> The sources are for EDK1. They can be downloaded here:
> http://tianocore.sourceforge.net/wiki/EDK
>
> I think I had ported this driver to EDK2 in the past for fun - I did
> not have the opportunity to test it. I do not remember to have any
> difficulties to port it.

Very interesting! I wonder then why the PROEFI driver is now proprietary and wrapped into a draconian license. (It's not even redistributable in intact binary form IIRC.)

Do you have your edk2 port of the edk1 E1000 driver still around? That would be a great addition to OVMF: at the moment we have a builtin virtio-net driver, but for Windows guests, the emulated E1000 NIC seems to be the default choice. (For example, the virtio-win driver ISO is then not needed during guest installation, because Windows has a builtin
E1000 driver.)

iPXE does have a UEFI driver oprom for the E1000, but (a) sometimes you don't want to use iPXE, (b) for ARM virtual machines, iPXE is not available.

QEMU already provides PCIe emulation for the "virt" machine type, and ArmVirtPkg knows how to use it, so -- thinking of (upcoming?) Windows-on-ARM guests -- an open source E1000 driver that builds as part of ArmVirtPkg would be very cool.

Summary:
- OvmfPkg could PXE-boot off E1000 without iPXE
- ArmVirtPkg could PXE-boot off E1000 (as only E1000 option)
- some users prefer E1000 in VMs that run Windows

Thanks
Laszlo

>
>
> -----Original Message-----
> From: Leekha Shaveta [mailto:***@freescale.com]
> Sent: 08 June 2015 07:59
> To: Andrew Fish; edk2-***@lists.sourceforge.net
> Cc: Olivier Martin; Ruchika Gupta
> Subject: RE: [edk2] Query UEFI : PCIE Driver for Armv8 platform
>
> Thanks Andrew!
>
> Is there some PCI NIC card or E1000 driver (PCI device driver) written on top of PCI bus driver, any references?
>
> One is Intel's e1000 driver, which is proprietary and is requested by the -D E1000_ENABLE build flag.
>
> I have seen in logs that some libraries are referred like:
>
> NetLib|MdeModulePkg/Library/DxeNetLib/
> IpIoLib|MdeModulePkg/Library/DxeIpIoLib/
> UdpIoLib|MdeModulePkg/Library/DxeUdpIoLib/
> DpcLib|MdeModulePkg/Library/DxeDpcLib/
>
>
> Are these required for PCI NIC driver?
>
> Thanks and regards,
> Shaveta
>
> -----Original Message-----
> From: Andrew Fish [mailto:***@apple.com]
> Sent: Friday, June 05, 2015 10:50 PM
> To: Leekha Shaveta-B20052
> Cc: edk2-***@lists.sourceforge.net; ***@arm.com
> Subject: Re: [edk2] Query UEFI : PCIE Driver for Armv8 platform
>
>
>> On Jun 5, 2015, at 4:23 AM, Leekha Shaveta <***@freescale.com> wrote:
>>
>> Thanks Andrew!
>>
>> Few more Doubts :
>> How ACPI is defining PCI resources?
>> What are these PCI resources and their functions? Are these resources are like some regions in "PCI Express space”
>
> Leekha you need to think about it from the hardware point of view….
>
> The PCI root bridge sits on the CPU bus and it produces PCI. So that PCI root bridge has to be configured to forward transactions.
> From the firmware point of view you are configuring the chip to decode memory addresses and resources to forward them to PCI.
> From an OS (or generic PCI bus driver) you are defining the resource pool that is available to config PCI devices. So assign bus numbers, and populate BARs.
>
>> ?
>>
>
>> As I was referring ArmJunoPkg for PCI Host Bridge implementation. And found this ACPI configuration used:
>>>
>>> RESOURCE_CONFIGURATION Configuration = {
>>> {{ACPI_ADDRESS_SPACE_DESCRIPTOR, 0x2B, ACPI_ADDRESS_SPACE_TYPE_IO , 0, 0, 0, 0, 0, 0, 0},
>>> {ACPI_ADDRESS_SPACE_DESCRIPTOR, 0x2B, ACPI_ADDRESS_SPACE_TYPE_MEM, 0, 0, 32, 0, 0, 0, 0},
>>> {ACPI_ADDRESS_SPACE_DESCRIPTOR, 0x2B, ACPI_ADDRESS_SPACE_TYPE_MEM, 0, 6, 32, 0, 0, 0, 0},
>>> {ACPI_ADDRESS_SPACE_DESCRIPTOR, 0x2B, ACPI_ADDRESS_SPACE_TYPE_MEM, 0, 0, 64, 0, 0, 0, 0},
>>> {ACPI_ADDRESS_SPACE_DESCRIPTOR, 0x2B, ACPI_ADDRESS_SPACE_TYPE_MEM, 0, 6, 64, 0, 0, 0, 0},
>>> {ACPI_ADDRESS_SPACE_DESCRIPTOR, 0x2B, ACPI_ADDRESS_SPACE_TYPE_BUS, 0, 0, 0, 0, 255, 0, 255}},
>>> {ACPI_END_TAG_DESCRIPTOR, 0}
>>> };
>>>
>>> Hi Olivier,
>>> Can you please help in understanding this resource configuration ?
>>> Here you seem to be specifying one IO, 4 Mem and 1 Bus space. Why 6 of them and how do they differ?
>>
>> On which basis 6 resources are given here?
>>
>
> These are the basic resource types supported by PCI.
>
> I/O so the inb outb instructions on X86 (IO BAR) 32-bit Prefetch and
> non-Prefetch memory (Memory BAR) 64-bit Prefetch and non-Prefetch
> memory (Memory BAR) PCI Bus numbers. (Bus Number)
>
> Thanks,
>
> Andrew Fish
>
>> Thanks and Regards,
>> Shaveta
>>
>
> -- IMPORTANT NOTICE: The contents of this email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please notify the sender immediately and do not disclose the contents to any other person, use it for any purpose, or store or copy the information in any medium. Thank you.
>
> ARM Limited, Registered office 110 Fulbourn Road, Cambridge CB1 9NJ,
> Registered in England & Wales, Company No: 2557590 ARM Holdings plc,
> Registered office 110 Fulbourn Road, Cambridge CB1 9NJ, Registered in
> England & Wales, Company No: 2548782
> ----------------------------------------------------------------------
> -------- _______________________________________________
> edk2-devel mailing list
> edk2-***@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/edk2-devel
>


-- IMPORTANT NOTICE: The contents of this email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please notify the sender immediately and do not disclose the contents to any other person, use it for any purpose, or store or copy the information in any medium. Thank you.

ARM Limited, Registered office 110 Fulbourn Road, Cambridge CB1 9NJ, Registered in England & Wales, Company No: 2557590
ARM Holdings plc, Registered office 110 Fulbourn Road, Cambridge CB1 9NJ, Registered in England & Wales, Company No: 2548782
------------------------------------------------------------------------------
Laszlo Ersek
2015-06-17 18:34:32 UTC
Permalink
On 06/17/15 18:21, Olivier Martin wrote:
> Ahah, I knew this hidden link would make some people happy!
>
> Hmm, I think the driver was on one of my old hard disk. I have just
> tried to see if I can redo the work again. It took me a couple of
> hours :-/

Wow, thank you.

> Anyway, I sent the patch. It builds with GCC49. But as I said I have not tested it.

"37784 insertions" :) I don't think I'll ever try to review it, but I'll
tag it for testing under QEMU. Not sure when I'll get to it, but, again,
I'll tag it. Thank you!

Laszlo

>
>
> -----Original Message-----
> From: Laszlo Ersek [mailto:***@redhat.com]
> Sent: 16 June 2015 20:01
> To: Olivier Martin
> Cc: edk2-***@lists.sourceforge.net; Leekha Shaveta; Andrew Fish; Ruchika Gupta
> Subject: Re: [edk2] Query UEFI : PCIE Driver for Armv8 platform
>
> On 06/16/15 20:01, Olivier Martin wrote:
>> Sources for the E1000 EFI driver exists....
>> The sources are for EDK1. They can be downloaded here:
>> http://tianocore.sourceforge.net/wiki/EDK
>>
>> I think I had ported this driver to EDK2 in the past for fun - I did
>> not have the opportunity to test it. I do not remember to have any
>> difficulties to port it.
>
> Very interesting! I wonder then why the PROEFI driver is now proprietary and wrapped into a draconian license. (It's not even redistributable in intact binary form IIRC.)
>
> Do you have your edk2 port of the edk1 E1000 driver still around? That would be a great addition to OVMF: at the moment we have a builtin virtio-net driver, but for Windows guests, the emulated E1000 NIC seems to be the default choice. (For example, the virtio-win driver ISO is then not needed during guest installation, because Windows has a builtin
> E1000 driver.)
>
> iPXE does have a UEFI driver oprom for the E1000, but (a) sometimes you don't want to use iPXE, (b) for ARM virtual machines, iPXE is not available.
>
> QEMU already provides PCIe emulation for the "virt" machine type, and ArmVirtPkg knows how to use it, so -- thinking of (upcoming?) Windows-on-ARM guests -- an open source E1000 driver that builds as part of ArmVirtPkg would be very cool.
>
> Summary:
> - OvmfPkg could PXE-boot off E1000 without iPXE
> - ArmVirtPkg could PXE-boot off E1000 (as only E1000 option)
> - some users prefer E1000 in VMs that run Windows
>
> Thanks
> Laszlo
>
>>
>>
>> -----Original Message-----
>> From: Leekha Shaveta [mailto:***@freescale.com]
>> Sent: 08 June 2015 07:59
>> To: Andrew Fish; edk2-***@lists.sourceforge.net
>> Cc: Olivier Martin; Ruchika Gupta
>> Subject: RE: [edk2] Query UEFI : PCIE Driver for Armv8 platform
>>
>> Thanks Andrew!
>>
>> Is there some PCI NIC card or E1000 driver (PCI device driver) written on top of PCI bus driver, any references?
>>
>> One is Intel's e1000 driver, which is proprietary and is requested by the -D E1000_ENABLE build flag.
>>
>> I have seen in logs that some libraries are referred like:
>>
>> NetLib|MdeModulePkg/Library/DxeNetLib/
>> IpIoLib|MdeModulePkg/Library/DxeIpIoLib/
>> UdpIoLib|MdeModulePkg/Library/DxeUdpIoLib/
>> DpcLib|MdeModulePkg/Library/DxeDpcLib/
>>
>>
>> Are these required for PCI NIC driver?
>>
>> Thanks and regards,
>> Shaveta
>>
>> -----Original Message-----
>> From: Andrew Fish [mailto:***@apple.com]
>> Sent: Friday, June 05, 2015 10:50 PM
>> To: Leekha Shaveta-B20052
>> Cc: edk2-***@lists.sourceforge.net; ***@arm.com
>> Subject: Re: [edk2] Query UEFI : PCIE Driver for Armv8 platform
>>
>>
>>> On Jun 5, 2015, at 4:23 AM, Leekha Shaveta <***@freescale.com> wrote:
>>>
>>> Thanks Andrew!
>>>
>>> Few more Doubts :
>>> How ACPI is defining PCI resources?
>>> What are these PCI resources and their functions? Are these resources are like some regions in "PCI Express space”
>>
>> Leekha you need to think about it from the hardware point of view….
>>
>> The PCI root bridge sits on the CPU bus and it produces PCI. So that PCI root bridge has to be configured to forward transactions.
>> From the firmware point of view you are configuring the chip to decode memory addresses and resources to forward them to PCI.
>> From an OS (or generic PCI bus driver) you are defining the resource pool that is available to config PCI devices. So assign bus numbers, and populate BARs.
>>
>>> ?
>>>
>>
>>> As I was referring ArmJunoPkg for PCI Host Bridge implementation. And found this ACPI configuration used:
>>>>
>>>> RESOURCE_CONFIGURATION Configuration = {
>>>> {{ACPI_ADDRESS_SPACE_DESCRIPTOR, 0x2B, ACPI_ADDRESS_SPACE_TYPE_IO , 0, 0, 0, 0, 0, 0, 0},
>>>> {ACPI_ADDRESS_SPACE_DESCRIPTOR, 0x2B, ACPI_ADDRESS_SPACE_TYPE_MEM, 0, 0, 32, 0, 0, 0, 0},
>>>> {ACPI_ADDRESS_SPACE_DESCRIPTOR, 0x2B, ACPI_ADDRESS_SPACE_TYPE_MEM, 0, 6, 32, 0, 0, 0, 0},
>>>> {ACPI_ADDRESS_SPACE_DESCRIPTOR, 0x2B, ACPI_ADDRESS_SPACE_TYPE_MEM, 0, 0, 64, 0, 0, 0, 0},
>>>> {ACPI_ADDRESS_SPACE_DESCRIPTOR, 0x2B, ACPI_ADDRESS_SPACE_TYPE_MEM, 0, 6, 64, 0, 0, 0, 0},
>>>> {ACPI_ADDRESS_SPACE_DESCRIPTOR, 0x2B, ACPI_ADDRESS_SPACE_TYPE_BUS, 0, 0, 0, 0, 255, 0, 255}},
>>>> {ACPI_END_TAG_DESCRIPTOR, 0}
>>>> };
>>>>
>>>> Hi Olivier,
>>>> Can you please help in understanding this resource configuration ?
>>>> Here you seem to be specifying one IO, 4 Mem and 1 Bus space. Why 6 of them and how do they differ?
>>>
>>> On which basis 6 resources are given here?
>>>
>>
>> These are the basic resource types supported by PCI.
>>
>> I/O so the inb outb instructions on X86 (IO BAR) 32-bit Prefetch and
>> non-Prefetch memory (Memory BAR) 64-bit Prefetch and non-Prefetch
>> memory (Memory BAR) PCI Bus numbers. (Bus Number)
>>
>> Thanks,
>>
>> Andrew Fish
>>
>>> Thanks and Regards,
>>> Shaveta
>>>
>>
>> -- IMPORTANT NOTICE: The contents of this email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please notify the sender immediately and do not disclose the contents to any other person, use it for any purpose, or store or copy the information in any medium. Thank you.
>>
>> ARM Limited, Registered office 110 Fulbourn Road, Cambridge CB1 9NJ,
>> Registered in England & Wales, Company No: 2557590 ARM Holdings plc,
>> Registered office 110 Fulbourn Road, Cambridge CB1 9NJ, Registered in
>> England & Wales, Company No: 2548782
>> ----------------------------------------------------------------------
>> -------- _______________________________________________
>> edk2-devel mailing list
>> edk2-***@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/edk2-devel
>>
>
>
> -- IMPORTANT NOTICE: The contents of this email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please notify the sender immediately and do not disclose the contents to any other person, use it for any purpose, or store or copy the information in any medium. Thank you.
>
> ARM Limited, Registered office 110 Fulbourn Road, Cambridge CB1 9NJ, Registered in England & Wales, Company No: 2557590
> ARM Holdings plc, Registered office 110 Fulbourn Road, Cambridge CB1 9NJ, Registered in England & Wales, Company No: 2548782
>


------------------------------------------------------------------------------
Sharma Bhupesh
2015-06-17 19:13:20 UTC
Permalink
Hi Olivier,

Where can we have a peek at the patch. Is it already pushed to the public GIT

Regards,
Bhupesh

> -----Original Message-----
> From: Laszlo Ersek [mailto:***@redhat.com]
> Sent: Thursday, June 18, 2015 12:05 AM
> To: Olivier Martin
> Cc: edk2-***@lists.sourceforge.net; Gupta Ruchika-R66431
> Subject: Re: [edk2] Query UEFI : PCIE Driver for Armv8 platform
>
> On 06/17/15 18:21, Olivier Martin wrote:
> > Ahah, I knew this hidden link would make some people happy!
> >
> > Hmm, I think the driver was on one of my old hard disk. I have just
> > tried to see if I can redo the work again. It took me a couple of
> > hours :-/
>
> Wow, thank you.
>
> > Anyway, I sent the patch. It builds with GCC49. But as I said I have
> not tested it.
>
> "37784 insertions" :) I don't think I'll ever try to review it, but I'll
> tag it for testing under QEMU. Not sure when I'll get to it, but, again,
> I'll tag it. Thank you!
>
> Laszlo
>
> >
> >
> > -----Original Message-----
> > From: Laszlo Ersek [mailto:***@redhat.com]
> > Sent: 16 June 2015 20:01
> > To: Olivier Martin
> > Cc: edk2-***@lists.sourceforge.net; Leekha Shaveta; Andrew Fish;
> > Ruchika Gupta
> > Subject: Re: [edk2] Query UEFI : PCIE Driver for Armv8 platform
> >
> > On 06/16/15 20:01, Olivier Martin wrote:
> >> Sources for the E1000 EFI driver exists....
> >> The sources are for EDK1. They can be downloaded here:
> >> http://tianocore.sourceforge.net/wiki/EDK
> >>
> >> I think I had ported this driver to EDK2 in the past for fun - I did
> >> not have the opportunity to test it. I do not remember to have any
> >> difficulties to port it.
> >
> > Very interesting! I wonder then why the PROEFI driver is now
> > proprietary and wrapped into a draconian license. (It's not even
> > redistributable in intact binary form IIRC.)
> >
> > Do you have your edk2 port of the edk1 E1000 driver still around? That
> > would be a great addition to OVMF: at the moment we have a builtin
> > virtio-net driver, but for Windows guests, the emulated E1000 NIC
> > seems to be the default choice. (For example, the virtio-win driver
> > ISO is then not needed during guest installation, because Windows has
> > a builtin
> > E1000 driver.)
> >
> > iPXE does have a UEFI driver oprom for the E1000, but (a) sometimes you
> don't want to use iPXE, (b) for ARM virtual machines, iPXE is not
> available.
> >
> > QEMU already provides PCIe emulation for the "virt" machine type, and
> ArmVirtPkg knows how to use it, so -- thinking of (upcoming?) Windows-on-
> ARM guests -- an open source E1000 driver that builds as part of
> ArmVirtPkg would be very cool.
> >
> > Summary:
> > - OvmfPkg could PXE-boot off E1000 without iPXE
> > - ArmVirtPkg could PXE-boot off E1000 (as only E1000 option)
> > - some users prefer E1000 in VMs that run Windows
> >
> > Thanks
> > Laszlo
> >
> >>
> >>
> >> -----Original Message-----
> >> From: Leekha Shaveta [mailto:***@freescale.com]
> >> Sent: 08 June 2015 07:59
> >> To: Andrew Fish; edk2-***@lists.sourceforge.net
> >> Cc: Olivier Martin; Ruchika Gupta
> >> Subject: RE: [edk2] Query UEFI : PCIE Driver for Armv8 platform
> >>
> >> Thanks Andrew!
> >>
> >> Is there some PCI NIC card or E1000 driver (PCI device driver) written
> on top of PCI bus driver, any references?
> >>
> >> One is Intel's e1000 driver, which is proprietary and is requested by
> the -D E1000_ENABLE build flag.
> >>
> >> I have seen in logs that some libraries are referred like:
> >>
> >> NetLib|MdeModulePkg/Library/DxeNetLib/
> >> IpIoLib|MdeModulePkg/Library/DxeIpIoLib/
> >> UdpIoLib|MdeModulePkg/Library/DxeUdpIoLib/
> >> DpcLib|MdeModulePkg/Library/DxeDpcLib/
> >>
> >>
> >> Are these required for PCI NIC driver?
> >>
> >> Thanks and regards,
> >> Shaveta
> >>
> >> -----Original Message-----
> >> From: Andrew Fish [mailto:***@apple.com]
> >> Sent: Friday, June 05, 2015 10:50 PM
> >> To: Leekha Shaveta-B20052
> >> Cc: edk2-***@lists.sourceforge.net; ***@arm.com
> >> Subject: Re: [edk2] Query UEFI : PCIE Driver for Armv8 platform
> >>
> >>
> >>> On Jun 5, 2015, at 4:23 AM, Leekha Shaveta <***@freescale.com>
> wrote:
> >>>
> >>> Thanks Andrew!
> >>>
> >>> Few more Doubts :
> >>> How ACPI is defining PCI resources?
> >>> What are these PCI resources and their functions? Are these
> resources are like some regions in "PCI Express space”
> >>
> >> Leekha you need to think about it from the hardware point of view….
> >>
> >> The PCI root bridge sits on the CPU bus and it produces PCI. So that
> PCI root bridge has to be configured to forward transactions.
> >> From the firmware point of view you are configuring the chip to decode
> memory addresses and resources to forward them to PCI.
> >> From an OS (or generic PCI bus driver) you are defining the resource
> pool that is available to config PCI devices. So assign bus numbers, and
> populate BARs.
> >>
> >>> ?
> >>>
> >>
> >>> As I was referring ArmJunoPkg for PCI Host Bridge implementation. And
> found this ACPI configuration used:
> >>>>
> >>>> RESOURCE_CONFIGURATION Configuration = {
> >>>> {{ACPI_ADDRESS_SPACE_DESCRIPTOR, 0x2B, ACPI_ADDRESS_SPACE_TYPE_IO ,
> 0, 0, 0, 0, 0, 0, 0},
> >>>> {ACPI_ADDRESS_SPACE_DESCRIPTOR, 0x2B, ACPI_ADDRESS_SPACE_TYPE_MEM,
> 0, 0, 32, 0, 0, 0, 0},
> >>>> {ACPI_ADDRESS_SPACE_DESCRIPTOR, 0x2B, ACPI_ADDRESS_SPACE_TYPE_MEM,
> 0, 6, 32, 0, 0, 0, 0},
> >>>> {ACPI_ADDRESS_SPACE_DESCRIPTOR, 0x2B, ACPI_ADDRESS_SPACE_TYPE_MEM,
> 0, 0, 64, 0, 0, 0, 0},
> >>>> {ACPI_ADDRESS_SPACE_DESCRIPTOR, 0x2B, ACPI_ADDRESS_SPACE_TYPE_MEM,
> 0, 6, 64, 0, 0, 0, 0},
> >>>> {ACPI_ADDRESS_SPACE_DESCRIPTOR, 0x2B, ACPI_ADDRESS_SPACE_TYPE_BUS,
> 0, 0, 0, 0, 255, 0, 255}},
> >>>> {ACPI_END_TAG_DESCRIPTOR, 0}
> >>>> };
> >>>>
> >>>> Hi Olivier,
> >>>> Can you please help in understanding this resource configuration ?
> >>>> Here you seem to be specifying one IO, 4 Mem and 1 Bus space. Why 6
> of them and how do they differ?
> >>>
> >>> On which basis 6 resources are given here?
> >>>
> >>
> >> These are the basic resource types supported by PCI.
> >>
> >> I/O so the inb outb instructions on X86 (IO BAR) 32-bit Prefetch and
> >> non-Prefetch memory (Memory BAR) 64-bit Prefetch and non-Prefetch
> >> memory (Memory BAR) PCI Bus numbers. (Bus Number)
> >>
> >> Thanks,
> >>
> >> Andrew Fish
> >>
> >>> Thanks and Regards,
> >>> Shaveta
> >>>
> >>
> >> -- IMPORTANT NOTICE: The contents of this email and any attachments
> are confidential and may also be privileged. If you are not the intended
> recipient, please notify the sender immediately and do not disclose the
> contents to any other person, use it for any purpose, or store or copy
> the information in any medium. Thank you.
> >>
> >> ARM Limited, Registered office 110 Fulbourn Road, Cambridge CB1 9NJ,
> >> Registered in England & Wales, Company No: 2557590 ARM Holdings plc,
> >> Registered office 110 Fulbourn Road, Cambridge CB1 9NJ, Registered in
> >> England & Wales, Company No: 2548782
> >> ---------------------------------------------------------------------
> >> -
> >> -------- _______________________________________________
> >> edk2-devel mailing list
> >> edk2-***@lists.sourceforge.net
> >> https://lists.sourceforge.net/lists/listinfo/edk2-devel
> >>
> >
> >
> > -- IMPORTANT NOTICE: The contents of this email and any attachments are
> confidential and may also be privileged. If you are not the intended
> recipient, please notify the sender immediately and do not disclose the
> contents to any other person, use it for any purpose, or store or copy
> the information in any medium. Thank you.
> >
> > ARM Limited, Registered office 110 Fulbourn Road, Cambridge CB1 9NJ,
> > Registered in England & Wales, Company No: 2557590 ARM Holdings plc,
> > Registered office 110 Fulbourn Road, Cambridge CB1 9NJ, Registered in
> > England & Wales, Company No: 2548782
> >
>
>
> -------------------------------------------------------------------------
> -----
> _______________________________________________
> edk2-devel mailing list
> edk2-***@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/edk2-devel
------------------------------------------------------------------------------
Leekha Shaveta
2015-06-18 04:09:41 UTC
Permalink
Thanks for the patch Olivier!

As you said that this patch is not tested, is it taken from some tested reference? As it’s a huge untested patch :)

Regards,
Shaveta

-----Original Message-----
From: Olivier Martin [mailto:***@arm.com]
Sent: Wednesday, June 17, 2015 9:51 PM
To: Laszlo Ersek
Cc: edk2-***@lists.sourceforge.net; Leekha Shaveta-B20052; Andrew Fish; Gupta Ruchika-R66431
Subject: RE: [edk2] Query UEFI : PCIE Driver for Armv8 platform

Ahah, I knew this hidden link would make some people happy!

Hmm, I think the driver was on one of my old hard disk. I have just tried to see if I can redo the work again. It took me a couple of hours :-/ Anyway, I sent the patch. It builds with GCC49. But as I said I have not tested it.


-----Original Message-----
From: Laszlo Ersek [mailto:***@redhat.com]
Sent: 16 June 2015 20:01
To: Olivier Martin
Cc: edk2-***@lists.sourceforge.net; Leekha Shaveta; Andrew Fish; Ruchika Gupta
Subject: Re: [edk2] Query UEFI : PCIE Driver for Armv8 platform

On 06/16/15 20:01, Olivier Martin wrote:
> Sources for the E1000 EFI driver exists....
> The sources are for EDK1. They can be downloaded here:
> http://tianocore.sourceforge.net/wiki/EDK
>
> I think I had ported this driver to EDK2 in the past for fun - I did
> not have the opportunity to test it. I do not remember to have any
> difficulties to port it.

Very interesting! I wonder then why the PROEFI driver is now proprietary and wrapped into a draconian license. (It's not even redistributable in intact binary form IIRC.)

Do you have your edk2 port of the edk1 E1000 driver still around? That would be a great addition to OVMF: at the moment we have a builtin virtio-net driver, but for Windows guests, the emulated E1000 NIC seems to be the default choice. (For example, the virtio-win driver ISO is then not needed during guest installation, because Windows has a builtin
E1000 driver.)

iPXE does have a UEFI driver oprom for the E1000, but (a) sometimes you don't want to use iPXE, (b) for ARM virtual machines, iPXE is not available.

QEMU already provides PCIe emulation for the "virt" machine type, and ArmVirtPkg knows how to use it, so -- thinking of (upcoming?) Windows-on-ARM guests -- an open source E1000 driver that builds as part of ArmVirtPkg would be very cool.

Summary:
- OvmfPkg could PXE-boot off E1000 without iPXE
- ArmVirtPkg could PXE-boot off E1000 (as only E1000 option)
- some users prefer E1000 in VMs that run Windows

Thanks
Laszlo

>
>
> -----Original Message-----
> From: Leekha Shaveta [mailto:***@freescale.com]
> Sent: 08 June 2015 07:59
> To: Andrew Fish; edk2-***@lists.sourceforge.net
> Cc: Olivier Martin; Ruchika Gupta
> Subject: RE: [edk2] Query UEFI : PCIE Driver for Armv8 platform
>
> Thanks Andrew!
>
> Is there some PCI NIC card or E1000 driver (PCI device driver) written on top of PCI bus driver, any references?
>
> One is Intel's e1000 driver, which is proprietary and is requested by the -D E1000_ENABLE build flag.
>
> I have seen in logs that some libraries are referred like:
>
> NetLib|MdeModulePkg/Library/DxeNetLib/
> IpIoLib|MdeModulePkg/Library/DxeIpIoLib/
> UdpIoLib|MdeModulePkg/Library/DxeUdpIoLib/
> DpcLib|MdeModulePkg/Library/DxeDpcLib/
>
>
> Are these required for PCI NIC driver?
>
> Thanks and regards,
> Shaveta
>
> -----Original Message-----
> From: Andrew Fish [mailto:***@apple.com]
> Sent: Friday, June 05, 2015 10:50 PM
> To: Leekha Shaveta-B20052
> Cc: edk2-***@lists.sourceforge.net; ***@arm.com
> Subject: Re: [edk2] Query UEFI : PCIE Driver for Armv8 platform
>
>
>> On Jun 5, 2015, at 4:23 AM, Leekha Shaveta <***@freescale.com> wrote:
>>
>> Thanks Andrew!
>>
>> Few more Doubts :
>> How ACPI is defining PCI resources?
>> What are these PCI resources and their functions? Are these resources are like some regions in "PCI Express space”
>
> Leekha you need to think about it from the hardware point of view….
>
> The PCI root bridge sits on the CPU bus and it produces PCI. So that PCI root bridge has to be configured to forward transactions.
> From the firmware point of view you are configuring the chip to decode memory addresses and resources to forward them to PCI.
> From an OS (or generic PCI bus driver) you are defining the resource pool that is available to config PCI devices. So assign bus numbers, and populate BARs.
>
>> ?
>>
>
>> As I was referring ArmJunoPkg for PCI Host Bridge implementation. And found this ACPI configuration used:
>>>
>>> RESOURCE_CONFIGURATION Configuration = {
>>> {{ACPI_ADDRESS_SPACE_DESCRIPTOR, 0x2B, ACPI_ADDRESS_SPACE_TYPE_IO , 0, 0, 0, 0, 0, 0, 0},
>>> {ACPI_ADDRESS_SPACE_DESCRIPTOR, 0x2B, ACPI_ADDRESS_SPACE_TYPE_MEM, 0, 0, 32, 0, 0, 0, 0},
>>> {ACPI_ADDRESS_SPACE_DESCRIPTOR, 0x2B, ACPI_ADDRESS_SPACE_TYPE_MEM, 0, 6, 32, 0, 0, 0, 0},
>>> {ACPI_ADDRESS_SPACE_DESCRIPTOR, 0x2B, ACPI_ADDRESS_SPACE_TYPE_MEM, 0, 0, 64, 0, 0, 0, 0},
>>> {ACPI_ADDRESS_SPACE_DESCRIPTOR, 0x2B, ACPI_ADDRESS_SPACE_TYPE_MEM, 0, 6, 64, 0, 0, 0, 0},
>>> {ACPI_ADDRESS_SPACE_DESCRIPTOR, 0x2B, ACPI_ADDRESS_SPACE_TYPE_BUS, 0, 0, 0, 0, 255, 0, 255}},
>>> {ACPI_END_TAG_DESCRIPTOR, 0}
>>> };
>>>
>>> Hi Olivier,
>>> Can you please help in understanding this resource configuration ?
>>> Here you seem to be specifying one IO, 4 Mem and 1 Bus space. Why 6 of them and how do they differ?
>>
>> On which basis 6 resources are given here?
>>
>
> These are the basic resource types supported by PCI.
>
> I/O so the inb outb instructions on X86 (IO BAR) 32-bit Prefetch and
> non-Prefetch memory (Memory BAR) 64-bit Prefetch and non-Prefetch
> memory (Memory BAR) PCI Bus numbers. (Bus Number)
>
> Thanks,
>
> Andrew Fish
>
>> Thanks and Regards,
>> Shaveta
>>
>
> -- IMPORTANT NOTICE: The contents of this email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please notify the sender immediately and do not disclose the contents to any other person, use it for any purpose, or store or copy the information in any medium. Thank you.
>
> ARM Limited, Registered office 110 Fulbourn Road, Cambridge CB1 9NJ,
> Registered in England & Wales, Company No: 2557590 ARM Holdings plc,
> Registered office 110 Fulbourn Road, Cambridge CB1 9NJ, Registered in
> England & Wales, Company No: 2548782
> ----------------------------------------------------------------------
> -------- _______________________________________________
> edk2-devel mailing list
> edk2-***@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/edk2-devel
>


-- IMPORTANT NOTICE: The contents of this email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please notify the sender immediately and do not disclose the contents to any other person, use it for any purpose, or store or copy the information in any medium. Thank you.

ARM Limited, Registered office 110 Fulbourn Road, Cambridge CB1 9NJ, Registered in England & Wales, Company No: 2557590 ARM Holdings plc, Registered office 110 Fulbourn Road, Cambridge CB1 9NJ, Registered in England & Wales, Company No: 2548782
------------------------------------------------------------------------------
Olivier Martin
2015-06-18 07:54:48 UTC
Permalink
Yes, the patch is taken from source code that has been tested on x86 with EDK1.
________________________________________
From: Leekha Shaveta [***@freescale.com]
Sent: 18 June 2015 05:09
To: Olivier Martin; Laszlo Ersek
Cc: edk2-***@lists.sourceforge.net; Andrew Fish; Ruchika Gupta
Subject: RE: [edk2] Query UEFI : PCIE Driver for Armv8 platform

Thanks for the patch Olivier!

As you said that this patch is not tested, is it taken from some tested reference? As it’s a huge untested patch :)

Regards,
Shaveta

-----Original Message-----
From: Olivier Martin [mailto:***@arm.com]
Sent: Wednesday, June 17, 2015 9:51 PM
To: Laszlo Ersek
Cc: edk2-***@lists.sourceforge.net; Leekha Shaveta-B20052; Andrew Fish; Gupta Ruchika-R66431
Subject: RE: [edk2] Query UEFI : PCIE Driver for Armv8 platform

Ahah, I knew this hidden link would make some people happy!

Hmm, I think the driver was on one of my old hard disk. I have just tried to see if I can redo the work again. It took me a couple of hours :-/ Anyway, I sent the patch. It builds with GCC49. But as I said I have not tested it.


-----Original Message-----
From: Laszlo Ersek [mailto:***@redhat.com]
Sent: 16 June 2015 20:01
To: Olivier Martin
Cc: edk2-***@lists.sourceforge.net; Leekha Shaveta; Andrew Fish; Ruchika Gupta
Subject: Re: [edk2] Query UEFI : PCIE Driver for Armv8 platform

On 06/16/15 20:01, Olivier Martin wrote:
> Sources for the E1000 EFI driver exists....
> The sources are for EDK1. They can be downloaded here:
> http://tianocore.sourceforge.net/wiki/EDK
>
> I think I had ported this driver to EDK2 in the past for fun - I did
> not have the opportunity to test it. I do not remember to have any
> difficulties to port it.

Very interesting! I wonder then why the PROEFI driver is now proprietary and wrapped into a draconian license. (It's not even redistributable in intact binary form IIRC.)

Do you have your edk2 port of the edk1 E1000 driver still around? That would be a great addition to OVMF: at the moment we have a builtin virtio-net driver, but for Windows guests, the emulated E1000 NIC seems to be the default choice. (For example, the virtio-win driver ISO is then not needed during guest installation, because Windows has a builtin
E1000 driver.)

iPXE does have a UEFI driver oprom for the E1000, but (a) sometimes you don't want to use iPXE, (b) for ARM virtual machines, iPXE is not available.

QEMU already provides PCIe emulation for the "virt" machine type, and ArmVirtPkg knows how to use it, so -- thinking of (upcoming?) Windows-on-ARM guests -- an open source E1000 driver that builds as part of ArmVirtPkg would be very cool.

Summary:
- OvmfPkg could PXE-boot off E1000 without iPXE
- ArmVirtPkg could PXE-boot off E1000 (as only E1000 option)
- some users prefer E1000 in VMs that run Windows

Thanks
Laszlo

>
>
> -----Original Message-----
> From: Leekha Shaveta [mailto:***@freescale.com]
> Sent: 08 June 2015 07:59
> To: Andrew Fish; edk2-***@lists.sourceforge.net
> Cc: Olivier Martin; Ruchika Gupta
> Subject: RE: [edk2] Query UEFI : PCIE Driver for Armv8 platform
>
> Thanks Andrew!
>
> Is there some PCI NIC card or E1000 driver (PCI device driver) written on top of PCI bus driver, any references?
>
> One is Intel's e1000 driver, which is proprietary and is requested by the -D E1000_ENABLE build flag.
>
> I have seen in logs that some libraries are referred like:
>
> NetLib|MdeModulePkg/Library/DxeNetLib/
> IpIoLib|MdeModulePkg/Library/DxeIpIoLib/
> UdpIoLib|MdeModulePkg/Library/DxeUdpIoLib/
> DpcLib|MdeModulePkg/Library/DxeDpcLib/
>
>
> Are these required for PCI NIC driver?
>
> Thanks and regards,
> Shaveta
>
> -----Original Message-----
> From: Andrew Fish [mailto:***@apple.com]
> Sent: Friday, June 05, 2015 10:50 PM
> To: Leekha Shaveta-B20052
> Cc: edk2-***@lists.sourceforge.net; ***@arm.com
> Subject: Re: [edk2] Query UEFI : PCIE Driver for Armv8 platform
>
>
>> On Jun 5, 2015, at 4:23 AM, Leekha Shaveta <***@freescale.com> wrote:
>>
>> Thanks Andrew!
>>
>> Few more Doubts :
>> How ACPI is defining PCI resources?
>> What are these PCI resources and their functions? Are these resources are like some regions in "PCI Express space”
>
> Leekha you need to think about it from the hardware point of view….
>
> The PCI root bridge sits on the CPU bus and it produces PCI. So that PCI root bridge has to be configured to forward transactions.
> From the firmware point of view you are configuring the chip to decode memory addresses and resources to forward them to PCI.
> From an OS (or generic PCI bus driver) you are defining the resource pool that is available to config PCI devices. So assign bus numbers, and populate BARs.
>
>> ?
>>
>
>> As I was referring ArmJunoPkg for PCI Host Bridge implementation. And found this ACPI configuration used:
>>>
>>> RESOURCE_CONFIGURATION Configuration = {
>>> {{ACPI_ADDRESS_SPACE_DESCRIPTOR, 0x2B, ACPI_ADDRESS_SPACE_TYPE_IO , 0, 0, 0, 0, 0, 0, 0},
>>> {ACPI_ADDRESS_SPACE_DESCRIPTOR, 0x2B, ACPI_ADDRESS_SPACE_TYPE_MEM, 0, 0, 32, 0, 0, 0, 0},
>>> {ACPI_ADDRESS_SPACE_DESCRIPTOR, 0x2B, ACPI_ADDRESS_SPACE_TYPE_MEM, 0, 6, 32, 0, 0, 0, 0},
>>> {ACPI_ADDRESS_SPACE_DESCRIPTOR, 0x2B, ACPI_ADDRESS_SPACE_TYPE_MEM, 0, 0, 64, 0, 0, 0, 0},
>>> {ACPI_ADDRESS_SPACE_DESCRIPTOR, 0x2B, ACPI_ADDRESS_SPACE_TYPE_MEM, 0, 6, 64, 0, 0, 0, 0},
>>> {ACPI_ADDRESS_SPACE_DESCRIPTOR, 0x2B, ACPI_ADDRESS_SPACE_TYPE_BUS, 0, 0, 0, 0, 255, 0, 255}},
>>> {ACPI_END_TAG_DESCRIPTOR, 0}
>>> };
>>>
>>> Hi Olivier,
>>> Can you please help in understanding this resource configuration ?
>>> Here you seem to be specifying one IO, 4 Mem and 1 Bus space. Why 6 of them and how do they differ?
>>
>> On which basis 6 resources are given here?
>>
>
> These are the basic resource types supported by PCI.
>
> I/O so the inb outb instructions on X86 (IO BAR) 32-bit Prefetch and
> non-Prefetch memory (Memory BAR) 64-bit Prefetch and non-Prefetch
> memory (Memory BAR) PCI Bus numbers. (Bus Number)
>
> Thanks,
>
> Andrew Fish
>
>> Thanks and Regards,
>> Shaveta
>>
>
> -- IMPORTANT NOTICE: The contents of this email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please notify the sender immediately and do not disclose the contents to any other person, use it for any purpose, or store or copy the information in any medium. Thank you.
>
> ARM Limited, Registered office 110 Fulbourn Road, Cambridge CB1 9NJ,
> Registered in England & Wales, Company No: 2557590 ARM Holdings plc,
> Registered office 110 Fulbourn Road, Cambridge CB1 9NJ, Registered in
> England & Wales, Company No: 2548782
> ----------------------------------------------------------------------
> -------- _______________________________________________
> edk2-devel mailing list
> edk2-***@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/edk2-devel
>


-- IMPORTANT NOTICE: The contents of this email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please notify the sender immediately and do not disclose the contents to any other person, use it for any purpose, or store or copy the information in any medium. Thank you.

ARM Limited, Registered office 110 Fulbourn Road, Cambridge CB1 9NJ, Registered in England & Wales, Company No: 2557590 ARM Holdings plc, Registered office 110 Fulbourn Road, Cambridge CB1 9NJ, Registered in England & Wales, Company No: 2548782

-- IMPORTANT NOTICE: The contents of this email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please notify the sender immediately and do not disclose the contents to any other person, use it for any purpose, or store or copy the information in any medium. Thank you.

ARM Limited, Registered office 110 Fulbourn Road, Cambridge CB1 9NJ, Registered in England & Wales, Company No: 2557590
ARM Holdings plc, Registered office 110 Fulbourn Road, Cambridge CB1 9NJ, Registered in England & Wales, Company No: 2548782


------------------------------------------------------------------------------
Leekha Shaveta
2015-06-23 06:35:45 UTC
Permalink
Hi Olivier,

I was looking into root bridge IO protocol code of ArmJuno platform.

For function:
EFI_STATUS
PciRbMemWrite (
)

You are directly calling "CpuIo->Mem.Write" with the address.

Is the mapping 1:1 in your system.

I mean for PCI memory read you are reading memory with same address, no offset etc.
How are the memory region mappings defined in your case?

Thanks and Regards,
Shaveta


From: Olivier Martin [mailto:***@arm.com]
Sent: Wednesday, May 13, 2015 8:10 PM
To: edk2-***@lists.sourceforge.net
Subject: Re: [edk2] Query UEFI : PCIE Driver for Armv8 platform

Are lucky because I actually pushed the PCI Root Complex source code for ARM Juno development board R1 (Revision 1) yesterday in EDK2.
You should be able to find the code under ArmPlatformPkg/ArmJunoPkg/Drivers/PciHostBridgeDxe
I am guessing what you name 'ATU' is the logic to translate AXI bus <-> PCI bus. As far as I have seen so far, this logic is vendor specific.
You can see this initialization of the translation block for this PCI Root Complex in this file: ArmPlatformPkg/ArmJunoPkg/Drivers/PciHostBridgeDxe/XPressRich3.c

From: Leekha Shaveta [mailto:***@freescale.com]
Sent: 13 May 2015 13:09
To: edk2-***@lists.sourceforge.net<mailto:edk2-***@lists.sourceforge.net>
Subject: [edk2] Query UEFI : PCIE Driver for Armv8 platform

Hi,

I was looking for PCIE driver/Root Bridge implementation for ARMv8 kind of platforms and have referred some code in files:

* ArmPlatformPkg/ArmVirtualizationPkg/PciHostBridgeDxe/PciRootBridgeIo.c

* ArmPlatformPkg/ArmVirtualizationPkg/PciHostBridgeDxe/PciHostBridge.c

But I couldn't see ATU programming code in this implementation, AFAIK ATU programming is required for any outbound and inbound transaction of PCI.
How the IO translation is being done in this?
Also what is the context of "aperture" used in this code?

Kindly help in clearing these doubts.

Regards,
Shaveta


-- IMPORTANT NOTICE: The contents of this email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please notify the sender immediately and do not disclose the contents to any other person, use it for any purpose, or store or copy the information in any medium. Thank you.

ARM Limited, Registered office 110 Fulbourn Road, Cambridge CB1 9NJ, Registered in England & Wales, Company No: 2557590
ARM Holdings plc, Registered office 110 Fulbourn Road, Cambridge CB1 9NJ, Registered in England & Wales, Company No: 2548782
Loading...