History log of /freebsd-current/sys/dev/pci/pci_host_generic.c
Revision Date Author Comments
# 637ee139 04-Jun-2024 Enji Cooper <ngie@FreeBSD.org>

pci(4): unbreak the build

`argsp` is not defined in `generic_pcie_unmap_resource(..)`. Remove the
parameter passed to `bus_generic_unmap_resource(..)` as this parameter
is never passed to `generic_pcie_unmap_resource(..)`.

Fixes: 98056127ddfa ("acpi/pci/vmd: Fix a nit with nested resource mapping requests")
Reported by: Jenkins (aarch64, armv6, armv7, etc)
Differential Revision: https://reviews.freebsd.org/D45493


# 98056127 04-Jun-2024 John Baldwin <jhb@FreeBSD.org>

acpi/pci/vmd: Fix a nit with nested resource mapping requests

Some bus drivers use rmans to suballocate resources to child devices.
When the driver for a child device requests a mapping for a
suballocated resource, the bus driver translates this into a mapping
request for a suitable subrange of the original resource the bus
driver allocated from its parent. This nested mapping request should
look like any other resource mapping request being made by the bus
device (i.e. as if the bus device had called bus_map_resource() or
bus_alloc_resource() with RF_ACTIVE).

I had slightly flubbed this last bit though since the direct use of
bus_generic_map/unmap_resource passed up the original child device
(second argument to the underlying kobj interface). While this is
currently harmless, it is not strictly correct as the resource being
mapped is owned by the bus device, not the child and can break for
other bus drivers in the future.

Instead, use bus_map/unmap_resource for the nested request where the
requesting device is now the bus device that owns the parent resource.

Reviewed by: imp
Fixes: 0e1246e33461 acpi: Cleanup handling of suballocated resources
Fixes: b377ff8110e3 pcib: Refine handling of resources allocated from bridge windows
Fixes: d79b6b8ec267 pci_host_generic: Don't rewrite resource start address for translation
Fixes: d714e73f7895 vmd: Use bus_generic_rman_* for PCI bus and memory resources
Differential Revision: https://reviews.freebsd.org/D45433


# 03713f80 09-Apr-2024 John Baldwin <jhb@FreeBSD.org>

pci_host_generic: Tolerate range resource allocation failures

QEMU for armv7 includes a PCI memory range whose CPU address is
greater than 4GB. This falls outside the range of armv7's global
mem_rman used by the nexus driver. As a result, pcib0 fails to
attach blocking all PCI devices.

Instead, change the driver to be a bit more tolerant. If allocating a
resource for a range fails, don't fail attaching the entire driver,
but do skip adding the associated PCI range to the relevant rman in
the pcib driver. This will prevent child devices from using BARs that
allocate from this range. In the case of QEMU on armv7 devices can
still allocate from an earlier PCI memory range that is within the
32-bit address space (and in fact none of the firmware-assigned memory
BARs use addresses from the upper range).

While here, reorder the operations on I/O ranges a bit: 1) print the
range under bootverbose first (rather than last) so that the range is
printed before any relevant errors for the range, 2) move
rman_manage_region last after the parent resource has been set and
allocated.

Reported by: markj, Jenkins
Reviewed by: markj
Fixes: d79b6b8ec267 pci_host_generic: Don't rewrite resource start address for translation
Differential Revision: https://reviews.freebsd.org/D44698


# 9dbf5b0e 13-Mar-2024 John Baldwin <jhb@FreeBSD.org>

new-bus: Remove the 'rid' and 'type' arguments from BUS_RELEASE_RESOURCE

The public bus_release_resource() API still accepts both forms, but
the internal kobj method no longer passes the arguments.
Implementations which need the rid or type now use rman_get_rid() or
rman_get_type() to fetch the value from the allocated resource.

Reviewed by: imp
Differential Revision: https://reviews.freebsd.org/D44131


# 2baed46e 13-Mar-2024 John Baldwin <jhb@FreeBSD.org>

new-bus: Remove the 'rid' and 'type' arguments from BUS_*ACTIVATE_RESOURCE

The public bus_activate/deactivate_resource() API still accepts both
forms, but the internal kobj methods no longer pass the arguments.
Implementations which need the rid or type now use rman_get_rid() or
rman_get_type() to fetch the value from the allocated resource.

Reviewed by: imp
Differential Revision: https://reviews.freebsd.org/D44130


# d77f2092 13-Mar-2024 John Baldwin <jhb@FreeBSD.org>

new-bus: Remove the 'type' argument from BUS_MAP/UNMAP_RESOURCE

The public bus_map/unmap_resource() API still accepts both forms, but
the internal kobj methods no longer pass the argument.
Implementations which need the type now use rman_get_type() to fetch
the value from the allocated resource.

Reviewed by: imp
Differential Revision: https://reviews.freebsd.org/D44129


# fef01f04 13-Mar-2024 John Baldwin <jhb@FreeBSD.org>

new-bus: Remove the 'type' argument from BUS_ADJUST_RESOURCE

The public bus_adjust_resource() API still accepts both forms, but the
internal kobj method no longer passes the argument. Implementations
which need the type now use rman_get_type() to fetch the value from
the allocated resource.

Reviewed by: imp
Differential Revision: https://reviews.freebsd.org/D44128


# 291079d0 04-Mar-2024 John Baldwin <jhb@FreeBSD.org>

pci_host_generic: Simplify generic_pcie_translate_resource

Inline generic_pcie_translate_resource_common into its sole caller.
No functional change.

Reviewed by: tuexen
Differential Revision: https://reviews.freebsd.org/D44206


# 332dbd3a 04-Mar-2024 John Baldwin <jhb@FreeBSD.org>

pci_host_generic: Pass a valid end address in generic_pcie_translate_resource

The generic_pcie_containing_range helper added in commit d79b6b8ec267
assumed that the passed in (start, end) range used to locate the
containing mapping range was a valid address range (with end >=
start). The previous version of
generic_pcie_translate_resource_common only used the start address to
locate a mapping range, so the end address of 0 did not matter, but an
end of 0 now causes the first range to match and an incorrect
translation for resources using a later range.

PR: 277211
Reported by: dch, tuexen
Reviewed by: tuexen
Fixes: d79b6b8ec267 pci_host_generic: Don't rewrite resource start address for translation
Differential Revision: https://reviews.freebsd.org/D44205


# b2867001 01-Mar-2024 John Baldwin <jhb@FreeBSD.org>

pci_host_generic: Enumerate resource ranges under bootverbose

Previously ranges were only enumerated for the FDT attachment but not
ACPI. This commit moves the enumeration to the shared attach routine
so it is done for both. While here, don't list empty ranges but do
include the resource type for each range.

Reviewed by: andrew
Differential Revision: https://reviews.freebsd.org/D44132


# 66d37dbe 16-Feb-2024 John Baldwin <jhb@FreeBSD.org>

pci_host_generic: Fix build without PCI_RES_BUS

Fixes: d79b6b8ec267 pci_host_generic: Don't rewrite resource start address for translation


# feefc3c7 15-Feb-2024 John Baldwin <jhb@FreeBSD.org>

pci_host_generic: Properly handle bus_release_resource of IRQ resources

Unlike other bus methods updated to use bus_generic_rman_* in commit
d79b6b8ec267, the bus_release_resource method was using
bus_generic_rman_release_resource for all types other than
PCI_RES_BUS. Instead, bus_generic_rman_* should only be used for
memory and I/O port resources for this driver.

Tested by: cperciva
Reviewed by: cperciva
Fixes: d79b6b8ec267 pci_host_generic: Don't rewrite resource start address for translation
Differential Revision: https://reviews.freebsd.org/D43925


# 992f5b16 15-Feb-2024 John Baldwin <jhb@FreeBSD.org>

pci_host_generic: Set a valid error if allocating a range resource fails

Previously pci_host_generic_attach was returning 0 (success)
incorrectly if allocating a range failed. The error value was 0 from
the previously successful call to bus_set_resource in this case.

Fixes: d79b6b8ec267 pci_host_generic: Don't rewrite resource start address for translation


# d79b6b8e 14-Feb-2024 John Baldwin <jhb@FreeBSD.org>

pci_host_generic: Don't rewrite resource start address for translation

Allocate resources from the parent device for decoded physical address
ranges. When child resources suballocated from rman's are mapped,
translate those mapping requests into a mapping request of the
associated physical address range in a bus_map_resource method.

While here, convert generic_pcie_rman to a bus_get_rman method and use
bus_generic_rman_* for operations on child resources.

Factor out a generic_pcie_containing_range to share logic between
bus_translate_resource and bus_*map_resource.

Reviewed by: imp
Differential Revision: https://reviews.freebsd.org/D43894


# 51f8ac22 14-Feb-2024 John Baldwin <jhb@FreeBSD.org>

pci_host_generic: Include the bridge's device name in rman descriptions

The rman description strings now match those used in the PCI-PCI
bridge driver. Using more specific names removes ambiguity in devinfo -u
output on systems with multiple host to PCI bridges.

Reviewed by: imp
Differential Revision: https://reviews.freebsd.org/D43890


# e9eb353b 23-Jan-2024 John Baldwin <jhb@FreeBSD.org>

pci_host_generic: Use pci_domain_[de]activate_bus for PCI_RES_BUS resources

Reviewed by: imp
Differential Revision: https://reviews.freebsd.org/D43429


# 7098f3c7 13-Oct-2023 Andrew Turner <andrew@FreeBSD.org>

pci: Set the domain in the pci_generic driver

Tell bus_dma(9) which NUMA domain the PCI driver is closest to so it
can allocate memory from there when possible.

Reviewed by: markj, jhb
Sponsored by: Arm Ltd
Differential Revision: https://reviews.freebsd.org/D42186


# 685dc743 16-Aug-2023 Warner Losh <imp@FreeBSD.org>

sys: Remove $FreeBSD$: one-line .c pattern

Remove /^[\s*]*__FBSDID\("\$FreeBSD\$"\);?\s*\n/


# 8bc94f25 23-Apr-2023 Andrew Turner <andrew@FreeBSD.org>

Remove redundant data from pci host generic

The bus tag and handle fields are already stored in the resource. Use
this with the bus_read/bus_write helper macros.

Sponsored by: Arm Ltd


# 7029f2c8 04-Jun-2022 Andrew Turner <andrew@FreeBSD.org>

Allow pci_host_generic attachments to manage registers

To allow for attachments that don't use memory mapped registers add
a flag they can set when the base driver shouldn't map them.

Sponsored by: Arm Ltd
Differential Revision: https://reviews.freebsd.org/D39227


# 527bf200 06-Mar-2023 Andrew Turner <andrew@FreeBSD.org>

Remove a #error that sneaked in


# cb894f74 04-Mar-2023 Andrew Turner <andrew@FreeBSD.org>

Map arm64 pci config memory as non-posted

On arm64 PCI config memory is expected to be mapped with a non-posted
device type. To handle this use the new bus_map_resource support in
arm64 to map memory with the new VM_MEMATTR_DEVICE_NP attribute. This
memory has already been allocated and activated, it just needs to be
mapped.

Reviewed by: kevans, mmel
Differential Revision: https://reviews.freebsd.org/D30079


# bd93b5f7 26-Sep-2022 Kyle Evans <kevans@FreeBSD.org>

pci_host_generic: stop address translation in bus_alloc_resource

Translating the provided range prior to rman_reserve_resource(9) is
decidedly wrong; the caller may be trying to do a wildcard allocation,
for which the implementation is expected to DTRT and clamp the range to
what's actually feasible.

We don't use the resulting translation here anyways, so just remove it
entirely -- the rman in the default implementation is derived from
sc->ranges, so the translation should trivially succeed every time as
long as the reservation succeeded. If something has gone awry in a
derived driver, we'll detect it when we translate prior to activation,
so there's likely no diagnostic value in retaining the translation after
reservation either.

Reviewed by: andrew
Noticed by: jhb
Differential Revision: https://reviews.freebsd.org/D36618


# d843dd0e 23-May-2022 Andrew Turner <andrew@FreeBSD.org>

Clean up in the pci host generic driver

Add clean up on failure and a detach function to the pci host generic
driver.

Reviewed by: jhb (earlier version)
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D35291


# f6abb39b 08-Apr-2022 John Baldwin <jhb@FreeBSD.org>

pci fdt host drivers: Remove unused variables.


# 1fb99e97 15-Nov-2021 Mark Johnston <markj@FreeBSD.org>

bus: Make BUS_TRANSLATE_RESOURCE behave more like other bus methods

- Return an errno value upon failure, instead of 1.
- Provide a bus_translate_resource() wrapper.
- Implement the generic version, which traverses the hierarchy until a
bus driver with a non-trivial implementation is found, in subr_bus.c
like other similar default implementations.
- Make ofw_pcib_translate_resource() return an error if a matching PCI
address range is not found.
- Make generic_pcie_translate_resource_common() return an int instead of
a bool. Fix up callers.

No functional change intended.

Reviewed by: imp, jhb
MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D32855


# aeb76076 12-Oct-2021 Ruslan Bukin <br@FreeBSD.org>

Prevent repeated deallocation of a resource.
Also deactivate resource if needed.

Discussed with: jrtc27
Differential Revision: https://reviews.freebsd.org/D32458


# 0eb901f7 20-Sep-2021 Greg V <greg@unrelenting.technology>

pci_host_generic: implement bus_translate_resource (for LinuxKPI)

In D21096 BUS_TRANSLATE_RESOURCE was introduced to allow LinuxKPI to get
physical addresses in pci_resource_start for PowerPC and implemented
in ofw_pci.
When the translation was implemented in pci_host_generic in 372c142b4fc,
this method was not implemented; instead a local static function was
added for a similar purpose.
Rename the static function to "_common" and implement the bus function
as a wrapper around that. With this a LinuxKPI driver using
physical addresses correctly finds the configuration registers of
the GPU.
This unbreaks amdgpu on NXP Layerscape LX2160A SoC (SolidRun HoneyComb
LX2K workstation) which has a Translation Offset in ACPI for
below-4G PCI addresses.

More info: https://github.com/freebsd/drm-kmod/issues/84
Tested by: dan.kotowski_a9development.com
Reviewed by: hselasky
Differential Revision: https://reviews.freebsd.org/D30986


# 2de4c7f6 13-Sep-2021 Pawel Anikiel <pan@semihalf.com>

pci_host_generic: Add Synopsys Designware PCIe controller quirk

Due to the quirky nature of the Synopsys Designware PCIe IP,
the type 0 configuration is broadcast and whatever device
is plugged into slot, will appear at each 32 device
positions of bus0. Mitigate the issue by filtering out
duplicated devices on this bus for both DT and ACPI cases.

Reviewed by: mw
Sponsored by: Semihalf
MFC: after 3 weeks
Differential revision: https://reviews.freebsd.org/D31887


# 04e8183f 01-Sep-2020 Mateusz Guzik <mjg@FreeBSD.org>

pci: clean up empty lines in .c and .h files


# 372c142b 22-Jun-2020 Andrew Turner <andrew@FreeBSD.org>

Translaate the PCI address when activating a resource

When the PCI address != physical address we need to translate from the
former to the latter before passing to the parent to map into the kernels
virtual address space.

Sponsored by: Innovate UK


# 41b84341 19-Jun-2020 Andrew Turner <andrew@FreeBSD.org>

Use the correct address when creating pci resources

When the PCI and CPU physical addresses are identical it doesn't matter
which is used to create the resources, however on some systems, e.g.
qemu armv7 virt, they are different. This leads to a panic as we try to
map the wrong physical address into the kernel address space.

Reported by: Jenkins via trasz
Sponsored by: Innovate UK


# c794cdc0 18-Jun-2020 Andrew Turner <andrew@FreeBSD.org>

Stop assuming we can print rman_res_t with %lx

This is not the case on armv6 and armv7, where we also build this driver.
Fix by casting through uintmax_t and using %jx.

Sponsored by: Innovate UK


# 9a7053ce 17-Jun-2020 Andrew Turner <andrew@FreeBSD.org>

Clean up the pci host generic driver

- Support Prefetchable Memory.
- Use the correct rman when allocating memory and ioports.
- Translate PCI addresses in bus_alloc_resource to allow physical
addresses that are different than pci addresses.

Reviewed by: Robert Crowston <crowston_protonmail.com>
Sponsored by: Innovate UK
Differential Revision: https://reviews.freebsd.org/D25121


# 9a82a56b 24-Jan-2020 Ruslan Bukin <br@FreeBSD.org>

Move the ECAM macroses to the header file.

These will be used by other PCI root complex drivers.

Sponsored by: DARPA, AFRL


# aa91d4b3 05-Sep-2019 Ed Maste <emaste@FreeBSD.org>

pcie: return an error if a matching resource is not found

Submitted by: markj
Reviewed by: manu
Event: vBSDCon FreeBSD hackathon
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D20884


# ec55b6c5 17-May-2019 Emmanuel Vadot <manu@FreeBSD.org>

pci: ecam: Correctly parse memory and IO region

When activating a resource do not compare the resource id to the adress.
Treat IO region as MEMORY region too.

Submitted by: Tuan Phan <tphan@amperecomputing.com> (Original Version)
Sponsored by: Ampere Computing, LLC
Differential Revision: https://reviews.freebsd.org/D20214


# bd158cdd 18-Nov-2018 Jayachandran C. <jchandra@FreeBSD.org>

pci_host_generic : move activate/release to generic code

Now that the ACPI and FDT implementations for activating and
deactivating resources are the same, we can move it to
pci_host_generic.c. No functional changes.

Reviewed by: andrew
Differential Revision: https://reviews.freebsd.org/D17793


# f916d057 18-Nov-2018 Jayachandran C. <jchandra@FreeBSD.org>

pci_host_generic, acpi_resource: drop unneeded code

Now that we are handling PCI resources in pci_host_generic_acpi.c, we
don't need these change (made by r336129)

Reviewed by: andrew
Differential Revision: https://reviews.freebsd.org/D17792


# 697c57e5 18-Nov-2018 Jayachandran C. <jchandra@FreeBSD.org>

pci_host_generic*: basic implementation of bus range

Both ACPI and FDT support bus ranges for pci host bridges. Update
pci_host_generic*.[ch] with a default implementation to support this.
This will be used in the next set of changes for ACPI based host
bridge. No functional changes in this commit.

Reviewed by: andrew
Differential Revision: https://reviews.freebsd.org/D17657


# ad785aaf 18-Nov-2018 Jayachandran C. <jchandra@FreeBSD.org>

pci_host_generic: allocate resources against devices

Fix up pci_host_generic.c and pci_host_generic_fdt.c to allocate
resources against devices that requested them. Currently the
allocation happens against the pcib, which is incorrect.

This is needed for the upcoming changes for fixing up
pci_host_generic_acpi.c

Reviewed by: andrew
Differential Revision: https://reviews.freebsd.org/D17656


# f3c5181a 18-Nov-2018 Jayachandran C. <jchandra@FreeBSD.org>

pci_host_generic: remove unneeded ThunderX2 quirk

The current quirk implementation writes a fixed address to the PCI BAR
to fix a firmware bug. The PCI BARs are allocated by firmware and will
change depending on PCI devices present. So using a fixed address here
is not correct.

This quirk worked around a firmware bug that programmed the MSI-X bar
of the SATA controller incorrectly. The newer firmware does not have
this issue, so it is better to drop this quirk altogether.

Reviewed by: andrew
Differential Revision: https://reviews.freebsd.org/D17655


# ad90dbb8 10-Jul-2018 Wojciech Macek <wma@FreeBSD.org>

Fix build broken by r336130

Add ifdef's to compile parts of pci_host_generic only on armv8


# d50fbe3f 09-Jul-2018 Wojciech Macek <wma@FreeBSD.org>

ARM64: Add quirk mechanism to pci_host_generic_acpi

Add few quirks which are necessary to use AHCI on ThX2

Submitted by: Patryk Duda <pdk@semihalf.com>
Obtained from: Semihalf
Sponsored by: Cavium
Differential revision: https://reviews.freebsd.org/D15929


# db2156bc 09-Jul-2018 Wojciech Macek <wma@FreeBSD.org>

ARM64: Add support for ThunderX2 PCIe

Submitted by: Patryk Duda <pdk@semihalf.com>
Obtained from: Semihalf
Sponsored by: Cavium
Differential revision: https://reviews.freebsd.org/D15141


# f94f8e62 21-Nov-2016 Andrew Turner <andrew@FreeBSD.org>

To allow for an ACPI attachment to the generic PCIe driver split off the
FDT attachment to a new file. A separate ACPI attachment will then be added
to allow arm64 servers with ACPI to use it over FDT.

This should also help with merging this with the ofwpci driver, with
further work needed to remove restrictions this driver places on resource
allocation.

Obtained from: ABT Systems Ltd
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D7319


# d8f1c69c 06-Sep-2016 Wojciech Macek <wma@FreeBSD.org>

Remove check for 64-bit FDT ranges in pci-host-generic

This allows 32-bit platforms to use pci-host-generic.

Obtained from: Semihalf
Submitted by: Michal Stanek <mst@semihalf.com>
Sponsored by: Annapurna Labs
Reviewed by: wma
Differential Revision: https://reviews.freebsd.org/D7560


# 895c8b1c 19-Aug-2016 Michal Meloun <mmel@FreeBSD.org>

INTRNG: Rework handling with resources. Partially revert r301453.
- Read interrupt properties at bus enumeration time and store
it into global mapping table.
- At bus_activate_resource() time, given mapping entry is resolved and
connected to real interrupt source. A copy of mapping entry is attached
to given resource.
- At bus_setup_intr() time, mapping entry stored in resource is used
for delivery of requested interrupt configuration.
- For MSI/MSIX interrupts, mapping entry is created within
pci_alloc_msi()/pci_alloc_msix() call.
- For legacy PCI interrupts, mapping entry must be created within
pcib_route_interrupt() by pcib driver itself.

Reviewed by: nwhitehorn, andrew
Differential Revision: https://reviews.freebsd.org/D7493


# 08916a36 14-Jul-2016 Andrew Turner <andrew@FreeBSD.org>

Remove support for the arm64 pre-INTRNG interrupt framework from the PCI
driver. Support for this was removed in r302375.

Obtained from: ABT Systems Ltd
MFC after: 1 month
Sponsored by: The FreeBSD Foundation


# ad5244ec 05-Jun-2016 Svatopluk Kraus <skra@FreeBSD.org>

INTRNG - change the way how an interrupt mapping data are provided
to the framework in OFW (FDT) case.

This is a follow-up to r301451.

Differential Revision: https://reviews.freebsd.org/D6634


# 4b2933da 31-May-2016 Andrew Turner <andrew@FreeBSD.org>

Move a device_printf under bootverbose where it should have been.

Reported by: bz
Obtained from: ABT Systems Ltd
Sponsored by: The FreeBSD Foundation


# 2760c2ca 31-May-2016 Andrew Turner <andrew@FreeBSD.org>

Mark the ThunderX and generic PCI drivers as cache-coherent when we know
this to be the case. This will mean we don't try and handle the cache in
bus_dmamap_sync when it is not needed.

Obtained from: ABT Systems Ltd
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D6605


# 6d2f7ef6 20-May-2016 Andrew Turner <andrew@FreeBSD.org>

Handle PCI_RES_BUS on the generic and ThunderX PCIe drivers. This has been
tested on the Pass 1.1 and 2.0 ThunderX machines in the Netperf cluster.

Reviewed by: jhb
Obtained from: ABT Systems Ltd
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D6453


# 1beaee0c 15-May-2016 Andrew Turner <andrew@FreeBSD.org>

Call ofw_bus_msimap to find the parent MSI controller, it may not use the
msi-parent property.

Obtained from: ABT Systems Ltd
Sponsored by: The FreeBSD Foundation


# 1e43b18c 16-May-2016 Andrew Turner <andrew@FreeBSD.org>

Add a pcib interface for use by interrupt controllers that need to
translate the pci rid to a controller ID. The translation could be based
on the 'msi-map' OFW property, a similar ACPI option, or hard-coded for
hardware lacking the above options.

Reviewed by: wma
Obtained from: ABT Systems Ltd
Sponsored by: The FreeBSD Foundation


# 3fc155dc 16-May-2016 Andrew Turner <andrew@FreeBSD.org>

Introduce MSI and MSI-X support to intrng. This adds a new msi device
interface with 5 methods to mirror the 5 MSI/MSI-X methods in the pcib
interface. The pcib driver will need to perform a device specific lookup
to find the MSI controller and pass this to intrng as the xref. Intrng
will finally find the controller and have it handle the requested operation.

Obtained from: ABT Systems Ltd
MFH: yes
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D5985


# 8f519854 13-May-2016 Bjoern A. Zeeb <bz@FreeBSD.org>

When using IOPORT with pci_host_generic we are missing setting the rman_end()
which leads to end being before start and thus a signed extended very large
number of size later on, which kva_alloc() will fail upon and we will panic.
Add the missing call.

Debugged with: andrew
Reviewed by: br, andrew
Sponsored by: DARPA/AFRL
Found: while using virtio with gem5
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D6337


# 9ca014f6 18-Apr-2016 Andrew Turner <andrew@FreeBSD.org>

Pull the MSI/MSI-X handling functions out to help with INTRNG integration.

Obtained from: ABT Systems Ltd
Sponsored by: The FreeBSD Foundation


# 9b0c982b 18-Mar-2016 Bjoern A. Zeeb <bz@FreeBSD.org>

Convert the printfs here from %lx to %jx as well after r297000 in order
to be able to compile this into arm kernels.

Sponsored by: DARPA/AFRL


# 788c03c3 02-Mar-2016 Bjoern A. Zeeb <bz@FreeBSD.org>

Add gem5 support, so we attach there as well.

Fix the boundary limit to end at the end of the region and not one beyond (1).

Diagnosed by: andrew (1)
Reviewed by: andrew, br
Sponsored by: DARPA/AFRL
Differential Revision: https://reviews.freebsd.org/D5493


# 82ed3cb0 01-Mar-2016 Justin Hibbits <jhibbits@FreeBSD.org>

Replace some more default range checks with RMAN_IS_DEFAULT_RANGE().

This is a follow-on to r295832.


# 2445e7c8 25-Feb-2016 Wojciech Macek <wma@FreeBSD.org>

Restore ThunderX Pass1.1 PCI changes removed by r295962

If Enhanced Allocation is not used, we can't allocate any random
range. All internal devices have hardcoded place where they can
be located within PCI address space. Fortunately, we can read
this value from BAR.

Obtained from: Semihalf
Sponsored by: Cavium
Approved by: cognet (mentor)
Reviewed by: zbb
Differential revision: https://reviews.freebsd.org/D5455


# fb05500b 23-Feb-2016 Wojciech Macek <wma@FreeBSD.org>

Make pci_host_generic and thunderx_pci common
* provided OFW interface for pci_host_generic (for handling devices which are present in DTS under the PCI node)
* removed support for internal PCI from arm64/cavium
* cleaned up and made most of the code common

Obtained from: Semihalf
Sponsored by: Cavium
Approved by: cognet (mentor)
Reviewed by: zbb
Differential revision: https://reviews.freebsd.org/D5261


# 2dd1bdf1 26-Jan-2016 Justin Hibbits <jhibbits@FreeBSD.org>

Convert rman to use rman_res_t instead of u_long

Summary:
Migrate to using the semi-opaque type rman_res_t to specify rman resources. For
now, this is still compatible with u_long.

This is step one in migrating rman to use uintmax_t for resources instead of
u_long.

Going forward, this could feasibly be used to specify architecture-specific
definitions of resource ranges, rather than baking a specific integer type into
the API.

This change has been broken out to facilitate MFC'ing drivers back to 10 without
breaking ABI.

Reviewed By: jhb
Sponsored by: Alex Perez/Inertial Computing
Differential Revision: https://reviews.freebsd.org/D5075


# c6b23b0a 14-Dec-2015 Andrew Turner <andrew@FreeBSD.org>

Update the handling of interrupts on the generic PCIe driver:
* Use the interrupt-map property to route interrupts
* Remove the IRQ rman, it's now unneeded
* Support MSI/MSI-X interrupts

With this I'm able to use the two NICs I've tested (em and msk), however
while I can boot with an AHCI devie attached it fails when any drives are
connected.

Obtained from: ABT Systems Ltd
Sponsored by: SoftIron Inc


# 9c22d3b1 12-Jun-2015 Ruslan Bukin <br@FreeBSD.org>

Rename ECAM PCI driver file.

Requested by: imp