Commit graph

21 commits

Author SHA1 Message Date
Abhishek Shah 08ed93fed9 drivers: pcie: refactor pcie directory to make RC and EP independent
With this refactoring of pcie directory, RC drivers are placed under
host/ directory, EP drivers are placed under endpoint/ directory and
they are completely independent of each other.

Signed-off-by: Abhishek Shah <abhishek.shah@broadcom.com>
2020-07-14 19:35:31 -04:00
Andy Ross 43d84147d9 drivers/pcie: Fix BAR address size limitation
The PCI API was originally limited to 32 bit addresses.  Even though
it had code to skip over the high word in 64 bit BAR entries, it
refused to use it and returned a 32 bit value.  Some devices in the
wild have default mappings from the firmware for devices above 4G.

Also remove the "iobar" API.  It's dead code, we don't call it and we
don't test it.  IO space BAR entries are a legacy feature from way,
way back in PCI history (I genuinely have never heard of a real device
that uses them!).  And there's no difference in format between one of
these and a 32 bit "memory" BAR anyway, someone who actually had this
requirement could just use the existing API without worry.

Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
2020-07-08 12:34:09 +02:00
Abhishek Shah ca523c1cf6 drivers: pcie: Do not enable PCIe RC module shell for endpoint
PCIe shell was enabled by default if shell is enabled in below commit:
commit ee985d81aa ("shell: enable modules by default if shell is
enabled").

However, this shell file has tests for PCIe RC, not applicable to EP.
So, should not be default enabled for PCIe EP.

If we add EP shell tests in future, they should be added under
drivers/pcie/endpoint/ directory.

Signed-off-by: Abhishek Shah <abhishek.shah@broadcom.com>
2020-07-01 11:21:57 -04:00
Anas Nashif de57d60732 pcie: shell: add subcommands
pcie has an all in one command for listing pci devices. Make it support
additional commands and move lspcie to `pcie ls`.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2020-06-24 21:37:12 -04:00
Anas Nashif ee985d81aa shell: enable modules by default if shell is enabled
If shell is enabled then enable all sub-shells if their dependencies are
satisfied. This was done for some modules and subsystems but was not
consistent.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2020-06-24 21:37:12 -04:00
Abhishek Shah 11972a48c2 drivers: pcie: ep: iproc: Add reset callback support
Add support to register callback function for each PCIe reset.
These callback functions are executed from corresponding
PCIe reset interrupt handler if registered.

Signed-off-by: Shivaraj Shetty <shivaraj.shetty@broadcom.com>
Signed-off-by: Abhishek Shah <abhishek.shah@broadcom.com>
2020-06-22 12:44:54 +02:00
Abhishek Shah 7d587abc6e drivers: pcie: ep: iproc: Add reset interrupt handlers
Add reset interrupt handlers for all three types of reset
interrupts that iProc PCIe EP can receive - namely PERST,
INB PERST and FLR.

Signed-off-by: Shivaraj Shetty <shivaraj.shetty@broadcom.com>
Signed-off-by: Abhishek Shah <abhishek.shah@broadcom.com>
2020-06-22 12:44:54 +02:00
Abhishek Shah ecc1673b78 pcie: endpoint: Add iProc PCIe EP driver
iProc PCIe EP IP is present in Broadcom PCIe offload chips.
Add iProc PCIe EP driver to provide basic PCIe EP functionality.

Signed-off-by: Abhishek Shah <abhishek.shah@broadcom.com>
Signed-off-by: Shivaraj Shetty <shivaraj.shetty@broadcom.com>
2020-06-13 01:35:19 -07:00
Abhishek Shah 3c2fa8cd51 pcie: endpoint: Introduce API to achieve PCIe data transfer
Introduce common API to achieve data transfer using memcpy
to/from outbound region of PCIe EP.

Signed-off-by: Abhishek Shah <abhishek.shah@broadcom.com>
2020-06-13 01:35:19 -07:00
Abhishek Shah ca17315d7f pcie: endpoint: Add public APIs for PCIe endpoint driver
Add public APIs for PCIe endpoint driver:
- EP configuration space read/write
- Mapping/Unmapping of Host buffer and PCIe outbound region
- Raise interrupt to Host
These are minimal base APIs to make PCIe EP functional.

Also, add a Kconfig and an empty CMakeLists.txt for drivers to extend.

Signed-off-by: Abhishek Shah <abhishek.shah@broadcom.com>
2020-06-13 01:35:19 -07:00
Abhishek Shah bee0fdea1e drivers: pcie: remove depends on X86
Remove depends on X86 for config PCIE,
Let the platforms select PCIE if they want to.

Signed-off-by: Abhishek Shah <abhishek.shah@broadcom.com>
2020-06-13 01:35:19 -07:00
Kumar Gala a1b77fd589 zephyr: replace zephyr integer types with C99 types
git grep -l 'u\(8\|16\|32\|64\)_t' | \
		xargs sed -i "s/u\(8\|16\|32\|64\)_t/uint\1_t/g"
	git grep -l 's\(8\|16\|32\|64\)_t' | \
		xargs sed -i "s/s\(8\|16\|32\|64\)_t/int\1_t/g"

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-06-08 08:23:57 -05:00
Ulf Magnusson 984bfae831 global: Remove leading/trailing blank lines in files
Remove leading/trailing blank lines in .c, .h, .py, .rst, .yml, and
.yaml files.

Will avoid failures with the new CI test in
https://github.com/zephyrproject-rtos/ci-tools/pull/112, though it only
checks changed files.

Move the 'target-notes' target in boards/xtensa/odroid_go/doc/index.rst
to get rid of the trailing blank line there. It was probably misplaced.

Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
2019-12-11 19:17:27 +01:00
Ulf Magnusson 87e917a925 kconfig: Remove redundant 'default n' and 'prompt' properties
Bool symbols implicitly default to 'n'.

A 'default n' can make sense e.g. in a Kconfig.defconfig file, if you
want to override a 'default y' on the base definition of the symbol. It
isn't used like that on any of these symbols though.

Also replace some

    config
    	prompt "foo"
    	bool/int

with the more common shorthand

    config
    	bool/int "foo"

See the 'Style recommendations and shorthands' section in
https://docs.zephyrproject.org/latest/guides/kconfig/index.html.

Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
2019-12-09 16:14:50 +01:00
Ulf Magnusson bd6e04411e kconfig: Clean up header comments and make them consistent
Use this short header style in all Kconfig files:

    # <description>

    # <copyright>
    # <license>

    ...

Also change all <description>s from

    # Kconfig[.extension] - Foo-related options

to just

    # Foo-related options

It's clear enough that it's about Kconfig.

The <description> cleanup was done with this command, along with some
manual cleanup (big letter at the start, etc.)

    git ls-files '*Kconfig*' | \
        xargs sed -i -E '1 s/#\s*Kconfig[\w.-]*\s*-\s*/# /'

Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
2019-11-04 17:31:27 -05:00
Charles E. Youse ea1e19107c drivers/pcie/shell: add basic probe for MSI-X capability
This trivial patch extends the PCIe shell to check for and report
on a device's ability to use MSI-X interrupt signaling.

Signed-off-by: Charles E. Youse <charles.youse@intel.com>
2019-06-10 10:52:02 -04:00
Anas Nashif 4c32258606 style: add braces around if/while statements
Per guidelines, all statements should have braces around them. We do not
have a CI check for this, so a few went in unnoticed.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2019-06-06 15:20:21 +02:00
Charles Youse 629805d881 drivers/pcie: do not verify configured IRQ
Some firmwares (looking at you, slimbootloader) don't set the registers
in PCI configuration space to indicate the IRQ routing, so we remove
the check that verifies that the user and firmware agree on IRQ number.

Also eliminate the return value of pcie_irq_enable() since no one uses
it and we can't return a meaningful value any longer.

Signed-off-by: Charles Youse <charles.youse@intel.com>
2019-06-01 10:00:32 -04:00
Charles E. Youse f16f7fc491 drivers/pcie: add support to read wired IRQ configuration
Firmware is supposed to set a register in PCI configuration space which
indicates the hardware IRQ that the endpoint is attached to.

A function is implemented which reads this register, and the PCIe shell
is updated to use it instead of doing it "manually".

Signed-off-by: Charles E. Youse <charles.youse@intel.com>
2019-05-04 18:29:32 -04:00
Charles E. Youse 18833ac0ef drivers/pcie: verify PCI(e) assigned interrupts
A new function pcie_irq_enable() is added to be used in lieu of
irq_enable() when the target device is PCI(e)-attached. The function
attempts to use MSI, when configured in the kernel and supported by
the endpoint; failing that, it will verify that IRQ requested is in
fact routed to the device by the boot firmware before enabling it.

The NS16550 UART driver is updated to use pcie_irq_enable().

The PCI(e) shell is extended to dump information about wired IRQs.

The up_squared devicetree is fixed (reverted?) to IRQ5 for UART1.

The galileo enables MSI by default.

Signed-off-by: Charles E. Youse <charles.youse@intel.com>
2019-04-28 13:36:28 -04:00
Charles E. Youse e039053546 uart/ns16550, drivers/pcie: add PCI(e) support
A parallel PCI implementation ("pcie") is added with features for PCIe.
In particular, message-signaled interrupts (MSI) are supported, which
are essential to the use of any non-trivial PCIe device.

The NS16550 UART driver is modified to use pcie.

pcie is a complete replacement for the old PCI support ("pci"). It is
smaller, by an order of magnitude, and cleaner. Both pci and pcie can
(and do) coexist in the same builds, but the intent is to rework any
existing drivers that depend on pci and ultimately remove pci entirely.

This patch is large, but things in mirror are smaller than they appear.
Most of the modified files are configuration-related, and are changed
only slightly to accommodate the modified UART driver.

Deficiencies:

64-bit support is minimal. The code works fine with 64-bit capable
devices, but will not cooperate with MMIO regions (or MSI targets) that
have high bits set. This is not needed on any current boards, and is
unlikely to be needed in the future. Only superficial changes would
be required if we change our minds.

The method specifying PCI endpoints in devicetree is somewhat kludgey.
The "right" way would be to hang PCI devices off a topological tree;
while this would be more aesthetically pleasing, I don't think it's
worth the effort, given our non-standard use of devicetree.

Signed-off-by: Charles E. Youse <charles.youse@intel.com>
2019-04-17 10:50:05 -07:00