aboutsummaryrefslogtreecommitdiff
path: root/sys/dev/pci/pcivar.h
Commit message (Collapse)AuthorAgeFilesLines
* pci: Fix dependency on ACPICA for non-ACPI buildsAymeric Wibo2025-08-081-0/+12
| | | | | | | | | | | | | | | | Commit 84bbfc32a3f4 introduced a dependency on ACPICA for non-ACPI builds. This removes that unintended dependency. While here, print "D3hot" for D3hot in ACPI code instead of just "D3", as it was unclear whether that referred to D3hot or D3cold and was inconsistent with the `PCI_POWERSTATE_D3` and `ACPI_D_STATE_D3` defines. Reported by: jrtc27, freebsd@sysctl.cz Reviewed by: jrtc27, des, jrm (mentor) Approved by: jrtc27, jrm (mentor) Fixes: 84bbfc32a3f4 ("acpi_powerres: D3cold support") Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D51823
* acpi_powerres: D3cold supportAymeric Wibo2025-08-081-12/+15
| | | | | | | | | | | | | | | | | | | | | Cherry-pick commit 0b76c0a from ACPICA (actypes: Distinguish between D3hot/cold, and default `ACPI_STATE_D3` to D3cold). The same distinction is made between `PCI_POWERSTATE_D3_HOT` and `PCI_POWERSTATE_D3_COLD`, as they're defined by ACPI (and are asserted to be the same). D3cold is essentially the same as D3hot except the power resources are turned off. Add support for D3cold to `acpi_pwr_switch_consumer`. `acpi_d_state_to_str` replaces the `printf("D%d", d_state)` pattern, allowing for "D3hot" and "D3cold" strings to be printed instead of just "D3". Reviewed by: markj, ziaee, mckusick (mentor) Approved by: markj, mckusick (mentor) Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D48384
* sys: Make the iommu xref uintptr_tAndrew Turner2025-04-081-1/+1
| | | | | | | | | | On arm64 we use the iommu base address as an xref. This fails when the address has the lower 32-bits in common with another iommu as they will share an xref. Reviewed by: kib Sponsored by: Arm Ltd Differential Revision: https://reviews.freebsd.org/D48726
* pci: Use a single variable for the offset of the power management registersJohn Baldwin2025-03-271-3/+1
| | | | | | | This is the more typical pattern for other capability register sets, and two of these variables weren't used. Differential Revision: https://reviews.freebsd.org/D49267
* pci: Add helper routines to manage PME in device driversJohn Baldwin2025-03-271-0/+2
| | | | | | | | | | | pci_has_pm is a quick check that returns true if a PCI device supports the power management capability. pci_enable_pme can be used in DEVICE_SUSPEND driver methods to enable PME# during suspend. Reviewed by: Krzysztof Galazka <krzysztof.galazka@intel.com>x Differential Revision: https://reviews.freebsd.org/D49250
* pci: Clear active PME# and disable PME# generationJohn Baldwin2025-03-271-0/+1
| | | | | | | | | | | | | | | | | The PCI power management specification requires that the OS clear any pending PME# interrupt and generation of PME# interrupts during "initial operating system load". Note that clearing a pending PME# interrupt requires writing a 1 to the Read/Write-Clear PME bit in the power management status register. To handle the boot time case, clear PME# state in pci_read_cap() when scanning new PCI devices. This should also cover hotplug devices. In addition, clear this state on every PCI device after resume from sleep in pci_resume_child before invoking the driver's DEVICE_RESUME method. Reviewed by: imp Differential Revision: https://reviews.freebsd.org/D49222
* pci: Don't cache the count of MSI/MSI-X messages before allocationJohn Baldwin2025-02-111-2/+0
| | | | | | | | | | | | | | | | A device can in theory change the read-only fields in the MSI/MSI-X control registers that indicate the maximum number of supported registers in response to changing other device registers. For example, certain Intel networking VFs change the number of messages as a result of changes in the PCI_IOV_ADD_VF callback. To support this, always read the current value of the relevant control register in the *_count and *_alloc methods. Once messages have been allocated, the control register value remains cached. Reported by: Krzysztof Galazka <krzysztof.galazka@intel.com> Reviewed by: Krzysztof Galazka <krzysztof.galazka@intel.com>, erj Differential Revision: https://reviews.freebsd.org/D48890
* pci: Cosmetic cleanups to MSI/MSI-X routinesJohn Baldwin2025-02-111-2/+2
| | | | | | | | | | | | | - Use unsigned integers for various variables. The count argument to the alloc method as well as the IRQ values used with the pcib_if.m methods should also be unsigned eventually. - Use mallocarray to allocate arrays - Use bool in a few places Reviewed by: Krzysztof Galazka <krzysztof.galazka@intel.com> Differential Revision: https://reviews.freebsd.org/D48889
* pci: Add `pci_find_base_class_from()`Jean-Sébastien Pédron2025-01-311-0/+1
| | | | | | | | | | | | | | | | | [Why] linuxkpi needs to export `pci_get_base_class()` for DRM drivers from Linux 6.7. [How] This new function searches a PCI device with the given base class and returns it, regardless of its subclass. The behavior is the same as `pci_find_class_from()` but the subclass is ignored. Reviewed by: manu Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D48745
* sys: Remove $FreeBSD$: two-line .h patternWarner Losh2023-08-161-2/+0
| | | | Remove /^\s*\*\n \*\s+\$FreeBSD\$$\n/
* spdx: The BSD-2-Clause-FreeBSD identifier is obsolete, drop -FreeBSDWarner Losh2023-05-121-1/+1
| | | | | | | | | The SPDX folks have obsoleted the BSD-2-Clause-FreeBSD identifier. Catch up to that fact and revert to their recommended match of BSD-2-Clause. Discussed with: pfg MFC After: 3 days Sponsored by: Netflix
* pci: Add helper routines to iterate over a device's BARs.John Baldwin2022-08-191-0/+2
| | | | | | | Reviewed by: imp, markj, emaste MFC after: 1 week Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D36237
* Add OFW_IOMMU id type for pci_get_id() so we can ask parent IOMMURuslan Bukin2022-05-071-0/+5
| | | | | | | | controller to map PCI RID to an IOMMU specifier. Sponsored by: UKRI Discussed with: jhb Differential Revision: https://reviews.freebsd.org/D35129
* Implement pci_get_relaxed_ordering_enabled() helper function.Hans Petter Selasky2021-03-171-0/+1
| | | | | | Discussed with: kib@ MFC after: 1 week Sponsored by: Mellanox Technologies // NVIDIA Networking
* pci: Add pci_find_class_fromEmmanuel Vadot2021-01-121-0/+1
| | | | | | | | | | | pci_find_class_from help finding one or multiple device matching a class and subclass. If the from argument is not null we will first loop in the device list until we find the matching device and only then start to check if the class/subclass matches. Reviewed by: jhb Differential Revision: https://reviews.freebsd.org/D27549
* Add initial driver for ACPI Platform Error Interfaces.Alexander Motin2020-07-271-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | APEI allows platform to report different kinds of errors to OS in several ways. We've found that Supermicro X10/X11 motherboards report PCIe errors appearing on hot-unplug via this interface using NMI. Without respective driver it ended up in kernel panic without any additional information. This driver introduces support for the APEI Generic Hardware Error Source reporting via NMI, SCI or polling. It decodes the reported errors and either pass them to pci(4) for processing or just logs otherwise. Errors marked as fatal still end up in kernel panic, but some more informative. When somebody get to native PCIe AER support implementation both of the reporting mechanisms should get common error recovery code. Since in our case errors happen when the device is already gone, there is nothing to recover, so the code just clears the error statuses, practically ignoring the otherwise destructive NMIs in nicer way. MFC after: 2 weeks Relnotes: yes Sponsored by: iXsystems, Inc. Notes: svn path=/head/; revision=363624
* Add mostly dummy hw.pci.enable_aspm tunable.Alexander Motin2020-06-261-0/+1
| | | | | | | | | | | | | | | | | | | | | | The only thing this tunable enables now is reporting to ACPI _OSC that Active State Power Management and Clock Power Management Capability are "supported" by the OS. I've found that at least some Supermicro server boards do not allow OS to support native PCIe hot-plug unless it reports those capabilities. After spending significant time in PCIe specs I have found very little motivation for that, and none of it applies to those motherboards, not enabling ASPM themselves. So unless OS explicitly wants to save power, I see nothing for it to do there actually. I guess it may get sense to support ASPM when we get Thunderbolt support. Otherwise I have no system with PCIe hot-plug where power saving matters. It would be nice to enable this by default, but I worry that it affect power saving of some laptops, even though I haven't noticed that myself. Notes: svn path=/head/; revision=362661
* Remove "All rights reserved" phrase from copyright notes.Stefan Eßer2019-12-041-2/+1
| | | | | | | | | | | | | | | | | | | | With the ratification of the Berne Convention in 2000, it became obsolete. I have removed that phrase and the "(c)" only from files without copyright claims by other parties. There are 2 files (pci.c, pci_private.h) that are also claimed by Michael Smith <msmith@freebsd.org> and by BSDi, which have therefore not been included in this commit. When all member nations of the Buenos Aires Convention adopted the Berne Convention, the phrase "All rights reserved" became unnecessary to assert copyright. Remove it from files under my copyright. There are 2 files (pci.c, pci_private.h) that) that do also bear msmith's and BSDi's copyright. I have left them unchanged for now, since I do not know whether they (or the legal successor in case of BSDi) would agree. Notes: svn path=/head/; revision=355382
* Extract eventfilter declarations to sys/_eventfilter.hConrad Meyer2019-05-201-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | This allows replacing "sys/eventfilter.h" includes with "sys/_eventfilter.h" in other header files (e.g., sys/{bus,conf,cpu}.h) and reduces header pollution substantially. EVENTHANDLER_DECLARE and EVENTHANDLER_LIST_DECLAREs were moved out of .c files into appropriate headers (e.g., sys/proc.h, powernv/opal.h). As a side effect of reduced header pollution, many .c files and headers no longer contain needed definitions. The remainder of the patch addresses adding appropriate includes to fix those files. LOCK_DEBUG and LOCK_FILE_LINE_ARG are moved to sys/_lock.h, as required by sys/mutex.h since r326106 (but silently protected by header pollution prior to this change). No functional change (intended). Of course, any out of tree modules that relied on header pollution for sys/eventhandler.h, sys/lock.h, or sys/mutex.h inclusion need to be fixed. __FreeBSD_version has been bumped. Notes: svn path=/head/; revision=347984
* remove the 4GB boundary requirement on PCI DMA segmentsTycho Nightingale2019-04-191-8/+0
| | | | | | | | | | Reviewed by: kib Discussed with: jhb Sponsored by: Dell EMC Isilon Differential Revision: https://reviews.freebsd.org/D19867 Notes: svn path=/head/; revision=346386
* Implement resets for PCI buses and PCIe bridges.Konstantin Belousov2019-04-051-0/+2
| | | | | | | | | | | | | | | | | For PCI device (i.e. child of a PCI bus), reset tries FLR if implemented and worked, and falls to power reset otherwise. For PCIe bus (child of a PCIe bridge or root port), reset disables PCIe link and then re-trains it, performing what is known as link-level reset. Reviewed by: imp (previous version), jhb (previous version) Sponsored by: Mellanox Technologies MFC after: 2 weeks Differential revision: https://reviews.freebsd.org/D19646 Notes: svn path=/head/; revision=345963
* Fix two typos: an -> and; the the -> theWarner Losh2019-03-191-6/+5
| | | | | | | | | | And justify the paragraph after the change (and set fill column to 80 instead of 70). Noticed by: rpokala@, vangyzen@ Notes: svn path=/head/; revision=345311
* Add comment about why we bother to use endian macros here, and why weWarner Losh2019-03-191-0/+8
| | | | | | | must use bitfields. Notes: svn path=/head/; revision=345298
* Reapply, with minor tweaks, r338025, from the original commit:Warner Losh2018-09-261-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Remove unused and easy to misuse PNP macro parameter Inspired by r338025, just remove the element size parameter to the MODULE_PNP_INFO macro entirely. The 'table' parameter is now required to have correct pointer (or array) type. Since all invocations of the macro already had this property and the emitted PNP data continues to include the element size, there is no functional change. Mostly done with the coccinelle 'spatch' tool: $ cat modpnpsize0.cocci @normaltables@ identifier b,c; expression a,d,e; declarer MODULE_PNP_INFO; @@ MODULE_PNP_INFO(a,b,c,d, -sizeof(d[0]), e); @singletons@ identifier b,c,d; expression a; declarer MODULE_PNP_INFO; @@ MODULE_PNP_INFO(a,b,c,&d, -sizeof(d), 1); $ rg -l MODULE_PNP_INFO -- sys | \ xargs spatch --in-place --sp-file modpnpsize0.cocci (Note that coccinelle invokes diff(1) via a PATH search and expects diff to tolerate the -B flag, which BSD diff does not. So I had to link gdiff into PATH as diff to use spatch.) Tinderbox'd (-DMAKE_JUST_KERNELS). Approved by: re (glen) Notes: svn path=/head/; revision=338948
* Back out r338035 until Warner is finished churning GSoC PNP patchesConrad Meyer2018-08-191-1/+1
| | | | | | | | | | I was not aware Warner was making or planning to make forward progress in this area and have since been informed of that. It's easy to apply/reapply when churn dies down. Notes: svn path=/head/; revision=338037
* Remove unused and easy to misuse PNP macro parameterConrad Meyer2018-08-191-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Inspired by r338025, just remove the element size parameter to the MODULE_PNP_INFO macro entirely. The 'table' parameter is now required to have correct pointer (or array) type. Since all invocations of the macro already had this property and the emitted PNP data continues to include the element size, there is no functional change. Mostly done with the coccinelle 'spatch' tool: $ cat modpnpsize0.cocci @normaltables@ identifier b,c; expression a,d,e; declarer MODULE_PNP_INFO; @@ MODULE_PNP_INFO(a,b,c,d, -sizeof(d[0]), e); @singletons@ identifier b,c,d; expression a; declarer MODULE_PNP_INFO; @@ MODULE_PNP_INFO(a,b,c,&d, -sizeof(d), 1); $ rg -l MODULE_PNP_INFO -- sys | \ xargs spatch --in-place --sp-file modpnpsize0.cocci (Note that coccinelle invokes diff(1) via a PATH search and expects diff to tolerate the -B flag, which BSD diff does not. So I had to link gdiff into PATH as diff to use spatch.) Tinderbox'd (-DMAKE_JUST_KERNELS). Notes: svn path=/head/; revision=338035
* Rudimentary AER reading code for ddb(4).Konstantin Belousov2018-08-181-0/+2
| | | | | | | | | | | | | | | | | | | | | | This is very primitive code to inspect the PCI error state and AER error state, dump the log and clear errors, from ddb. pci_print_faulted_dev() is made external to allow calling it from other places. It was called from NMI handler but this chunk is not included. Also there is a tunable-controlled code to clear AER on device attach, disabled by default. All this code was useful to me when I debugged ACPI_DMAR failures (not faults) long time ago. Reviewed by: cem, imp (previous version) Sponsored by: The FreeBSD Foundation MFC after: 2 weeks Differential revision: https://reviews.freebsd.org/D7813 Notes: svn path=/head/; revision=338024
* Create PCI_MATCH and pci_match_deviceWarner Losh2018-07-071-1/+61
| | | | | | | | | | Create a covenience function to match PCI device IDs. It's about 15 years overdue. Differential Revision: https://reviews.freebsd.org/D15999 Notes: svn path=/head/; revision=336066
* Add PCI methods to iterate over the PCI capabilitiesBryan Venteicher2018-02-191-0/+21
| | | | | | | | | | | | VirtIO V1 provides configuration in multiple VENDOR capabilities so this allows all of the configuration to be discovered. Reviewed by: jhb MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D14325 Notes: svn path=/head/; revision=329598
* sys/dev: further adoption of SPDX licensing ID tags.Pedro F. Giffuni2017-11-271-0/+2
| | | | | | | | | | | | | | | Mainly focus on files that use BSD 2-Clause license, however the tool I was using misidentified many licenses so this was mostly a manual - error prone - task. The Software Package Data Exchange (SPDX) group provides a specification to make it easier for automated tools to detect and summarize well known opensource licenses. We are gradually adopting the specification, noting that the tags are considered only advisory and do not, in any way, superceed or replace the license texts. Notes: svn path=/head/; revision=326255
* Inline pcie_link_{status,caps} where needed. Remove them as theyWarner Losh2017-11-151-2/+0
| | | | | | | | | | aren't really needed and I don't want to document them. Suggested by: jhb@ Sponsored by: Netflix Notes: svn path=/head/; revision=325838
* Provide pcie_link_status and pcie_link_cap convenience functions.Warner Losh2017-11-141-0/+2
| | | | | | | Sponsored by: Netflix Notes: svn path=/head/; revision=325793
* Reset PCI pass through devices via PCI-e FLR during VM start and end.John Baldwin2016-09-061-1/+3
| | | | | | | | | | | | | | | | | | Add routines to trigger a function level reset (FLR) of a PCI-express device via the PCI-express device control register. This also includes support routines to wait for pending transactions to complete as well as calculating the maximum completion timeout permitted by a device. Change the ppt(4) driver to reset pass through devices before attaching to a VM during startup and before detaching from a VM during shutdown. Reviewed by: imp, wblock (earlier version) MFC after: 1 month Sponsored by: Chelsio Communications Differential Revision: https://reviews.freebsd.org/D7751 Notes: svn path=/head/; revision=305502
* Update the I/O MMU in bhyve when PCI devices are added and removed.John Baldwin2016-09-061-0/+9
| | | | | | | | | | | | | | | | | | | | | | When the I/O MMU is active in bhyve, all PCI devices need valid entries in the DMAR context tables. The I/O MMU code does a single enumeration of the available PCI devices during initialization to add all existing devices to a domain representing the host. The ppt(4) driver then moves pass through devices in and out of domains for virtual machines as needed. However, when new PCI devices were added at runtime either via SR-IOV or HotPlug, the I/O MMU tables were not updated. This change adds a new set of EVENTHANDLERS that are invoked when PCI devices are added and deleted. The I/O MMU driver in bhyve installs handlers for these events which it uses to add and remove devices to the "host" domain. Reviewed by: imp Sponsored by: Chelsio Communications Differential Revision: https://reviews.freebsd.org/D7667 Notes: svn path=/head/; revision=305497
* Consistently use `device_t`Jean-Sébastien Pédron2016-08-091-1/+1
| | | | | | | | | | | | | | | | | | Several files use the internal name of `struct device` instead of `device_t` which is part of the public API. This patch changes all `struct device *` to `device_t`. The remaining occurrences of `struct device` are those referring to the Linux or OpenBSD version of the structure, or the code is not built on FreeBSD and it's unclear what to do. Submitted by: Matthew Macy <mmacy@nextbsd.org> (previous version) Approved by: emaste, jhibbits, sbruno MFC after: 3 days Differential Revision: https://reviews.freebsd.org/D7447 Notes: svn path=/head/; revision=303890
* Add pci_get_max_payload() to fetch the PCI-express maximum payload size.John Baldwin2016-06-241-0/+1
| | | | | | | | | | Approved by: re (gjb) MFC after: 2 weeks Sponsored by: Chelsio Communications Differential Revision: https://reviews.freebsd.org/D6951 Notes: svn path=/head/; revision=302175
* Re-commit r299467 having fixed the build:Andrew Turner2016-05-161-1/+17
| | | | | | | | | | | | | | | | | | | | | | | Add a new get_id interface to pci and pcib. This will allow us to both detect failures, and get different PCI IDs. For the former the interface returns an int to signal an error. The ID is returned at a uintptr_t * argument. For the latter there is a type argument that allows selecting the ID type. This only specifies a single type, however a MSI type will be added to handle the need to find the ID the hardware passes to the ARM GICv3 interrupt controller. A follow up commit will be made to remove pci_get_rid. Reviewed by: jhb, rstone (previous version) Obtained from: ABT Systems Ltd Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D6239 Notes: svn path=/head/; revision=299929
* Revert r299467 to fix the kernel build.Conrad Meyer2016-05-111-21/+1
| | | | | | | | | $ svn merge -c -299467 . Approved by: build being broken for six hours Notes: svn path=/head/; revision=299493
* Add a new get_id interface to pci and pcib. This will allow us to bothAndrew Turner2016-05-111-1/+21
| | | | | | | | | | | | | | | | | | | | | | detect failures, and get different PCI IDs. For the former the interface returns an int to signal an error. The ID is returned at a uintptr_t * argument. For the latter there is a type argument that allows selecting the ID type. This only specifies a single type, however a MSI type will be added to handle the need to find the ID the hardware passes to the ARM GICv3 interrupt controller. A follow up commit will be made to remove pci_get_rid. Reviewed by: jhb, rstone Obtained from: ABT Systems Ltd Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D6239 Notes: svn path=/head/; revision=299467
* Add a new PCI bus interface method to alloc the ivars (dinfo) for a device.John Baldwin2016-04-151-1/+0
| | | | | | | | | | | | | | | | | The ACPI and OFW PCI bus drivers as well as CardBus override this to allocate the larger ivars to hold additional info beyond the stock PCI ivars. This removes the need to pass the size to functions like pci_add_iov_child() and pci_read_device() simplifying IOV and bus rescanning implementations. As a result of this and earlier changes, the ACPI PCI bus driver no longer needs its own device_attach and pci_create_iov_child methods but can use the methods in the stock PCI bus driver instead. Differential Revision: https://reviews.freebsd.org/D5891 Notes: svn path=/head/; revision=298029
* Support for Enhanced Allocation in PCIWojciech Macek2016-03-021-0/+15
| | | | | | | | | | | | | | | On some platforms, BAR entries are hardcoded and must not be accessed using standard method. Add functionality to identify this situation and configure the bus based on Enhanced Allocation structure. Obtained from: Semihalf Sponsored by: Cavium Approved by: cognet (mentor) Reviewed by: jhb Differential revision: https://reviews.freebsd.org/D5242 Notes: svn path=/head/; revision=296308
* Convert rman to use rman_res_t instead of u_longJustin Hibbits2016-01-271-2/+2
| | | | | | | | | | | | | | | | | | | | | | | 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 Notes: svn path=/head/; revision=294883
* Add accessor methods to fetch the BAR holding the MSI-X table and PBA.John Baldwin2015-12-231-0/+12
| | | | | | | | | | | | While here, explicitly note the requirement that the BAR(s) must be allocated prior to calling pci_alloc_msix(). Reviewed by: andrew, emaste MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D4688 Notes: svn path=/head/; revision=292669
* Add a new -B flag for use with list mode (-l) that lists details aboutJohn Baldwin2015-11-231-5/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | bridges. Currently this includes information about what resources a bridge decodes on the upstream side for use by downstream devices including bus numbers, I/O port resources, and memory resources. Windows and bus ranges are enumerated for both PCI-PCI bridges and PCI-CardBus bridges. To simplify the implementation, all enumeration is done by reading the appropriate config space registers directly rather than querying the bridge driver in the kernel via new ioctls. This does result in a few limitations. First, an unimplemented window in a PCI-PCI bridge cannot be accurately detected as accurate detection requires writing to the window base register. That is not safe for pciconf(8). Instead, this assumes that any window where both the base and limit read as all zeroes is unimplemented. Second, the PCI-PCI bridge driver in a tree has a few quirks for PCI-PCI bridges that use subtractive decoding but do not indicate that via the progif config register. The list of quirks is duplicated in pciconf's source. Reviewed by: imp MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D4171 Notes: svn path=/head/; revision=291225
* Add a new helper function for PCI devices to locate the upstreamJohn Baldwin2015-11-051-0/+1
| | | | | | | | | | | | PCI-express root port of a given PCI device. Reviewed by: kib, imp MFC after: 1 week Sponsored by: Chelsio Differential Revision: https://reviews.freebsd.org/D4089 Notes: svn path=/head/; revision=290415
* Add helper routines for PCI device drivers to read, write, and modifyJohn Baldwin2015-11-051-0/+4
| | | | | | | | | | | | | | | | | PCI-Express capability registers (that is, PCI config registers in the standard PCI config space belonging to the PCI-Express capability register set). Note that all of the current PCI-e registers are either 16 or 32-bits, so only widths of 2 or 4 bytes are supported. Reviewed by: imp MFC after: 1 week Sponsored by: Chelsio Differential Revision: https://reviews.freebsd.org/D4088 Notes: svn path=/head/; revision=290414
* Create a separate kobj interface for leaf-driver PCI IOV methods.John Baldwin2015-05-281-15/+0
| | | | | | | | | | | Leaf drivers should not import the PCI bus interface to add IOV handling. Instead, move the IOV client methods to a separate kobj interface. Differential Revision: https://reviews.freebsd.org/D2584 Reviewed by: rstone Notes: svn path=/head/; revision=283670
* Update the pci_cfg_save/restore routines to operate on bridge devicesJohn Baldwin2015-04-221-0/+10
| | | | | | | | | | | | | | | | | | | | | (type 1 and type 2) as well as leaf devices (type 0). In particular, this allows the existing PCI bus logic to save and restore capability registers such as MSI and PCI-express work for bridge devices rather than requiring that code to be duplicated in bridge drivers. It also means that bridge drivers no longer need to save and restore basic registers such as the PCI command register or BARs nor manage powerstates for the bridge device. While here, pci_setup_secbus() has been changed to initialize the 'sec' and 'sub' fields in the 'secbus' structure instead of requiring the pcib and pccbb drivers to do this in the NEW_PCIB + PCI_RES_BUS case. Differential Revision: https://reviews.freebsd.org/D2240 Reviewed by: imp, jmg MFC after: 2 weeks Notes: svn path=/head/; revision=281874
* vgapci: New vga_pci_repost() functionJean-Sébastien Pédron2015-03-011-0/+1
| | | | | | | | | This can be used to restore the VGA mode after a KMS driver is unloaded. Differential Revision: https://reviews.freebsd.org/D687 Notes: svn path=/head/; revision=279487
* Add infrastructure for exporting config schema from PF driversRyan Stone2015-03-011-2/+5
| | | | | | | | | Differential Revision: https://reviews.freebsd.org/D80 MFC after: 1 month Sponsored by: Sandvine Inc. Notes: svn path=/head/; revision=279451